From 73782055237ee8948b26935348e8ca2b8a71a95a Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 10 Sep 2019 21:57:06 +0300 Subject: Expand .apng and .webp support for get_image_suffix Add get_image_suffix for all .gif's so that all animated pieces can be .webp or .apng instead Expand on .webp .apng support and clean up the code somewhat --- include/aoapplication.h | 2 +- src/aocharmovie.cpp | 11 ++++------- src/aomovie.cpp | 14 +++++++------- src/aoscene.cpp | 45 +++++++++++++++++++++++++++++---------------- src/courtroom.cpp | 11 ++++++++--- src/text_file_functions.cpp | 5 +++-- 6 files changed, 52 insertions(+), 36 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 5475eb7b..68e82ce3 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -219,7 +219,7 @@ 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. + // Can we use APNG for this? If not, WEBP? If not, fall back to gif. QString get_image_suffix(QString path_to_check); //Returns the value of p_search_line within target_tag and terminator_tag diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 57487233..eacf8530 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -19,16 +19,13 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { - QString original_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif"); + QString original_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)); QString alt_path = ao_app->get_character_path(p_char, p_emote + ".png"); - QString apng_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng"); - QString placeholder_path = ao_app->get_theme_path("placeholder.gif"); - QString placeholder_default_path = ao_app->get_default_theme_path("placeholder.gif"); + QString placeholder_path = ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")); + QString placeholder_default_path = ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")); QString gif_path; - if (file_exists(apng_path)) - gif_path = apng_path; - else if (file_exists(original_path)) + if (file_exists(original_path)) gif_path = original_path; else if (file_exists(alt_path)) gif_path = alt_path; diff --git a/src/aomovie.cpp b/src/aomovie.cpp index edf5bdb0..71a5a76a 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -32,12 +32,12 @@ void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme) else custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble")); - QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_gif + "_bubble.gif"; - QString custom_theme_path = ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif"); - QString 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 misc_path = ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_gif + "_bubble"); + QString custom_theme_path = ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_gif)); + QString theme_path = ao_app->get_image_suffix(ao_app->get_theme_path(p_gif)); + QString default_theme_path = ao_app->get_image_suffix(ao_app->get_default_theme_path(p_gif)); + QString placeholder_path = ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")); + QString default_placeholder_path =ao_app->get_image_suffix( ao_app->get_default_theme_path("placeholder")); if (file_exists(custom_path)) gif_path = custom_path; @@ -70,7 +70,7 @@ void AOMovie::stop() void AOMovie::frame_change(int n_frame) { - if (n_frame == (m_movie->frameCount() - 1) && play_once) + if (n_frame >= (m_movie->frameCount() - 1) && play_once) { //we need this or else the last frame wont show delay(m_movie->nextFrameDelay()); diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 344522b6..6d2dc890 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -12,8 +12,8 @@ AOScene::AOScene(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) void AOScene::set_image(QString p_image) { QString background_path = ao_app->get_background_path(p_image + ".png"); - QString animated_background_path = ao_app->get_background_path(p_image + ".gif"); QString default_path = ao_app->get_default_background_path(p_image + ".png"); + QString animated_background_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); QPixmap background(background_path); QPixmap default_bg(default_path); @@ -34,13 +34,9 @@ void AOScene::set_image(QString p_image) m_movie->start(); } else if (file_exists(background_path)) - { this->setPixmap(background.scaled(w, h)); - } else - { this->setPixmap(default_bg.scaled(w, h)); - } } void AOScene::set_legacy_desk(QString p_image) @@ -48,16 +44,12 @@ 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_background_path(p_image + ".png"); + QString animated_desk_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); + QString default_path = ao_app->get_image_suffix(ao_app->get_default_background_path(p_image)); QPixmap f_desk; - if (file_exists(desk_path)) - f_desk.load(desk_path); - else - f_desk.load(default_path); - int vp_width = m_parent->width(); int vp_height = m_parent->height(); @@ -69,8 +61,29 @@ void AOScene::set_legacy_desk(QString p_image) //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(animated_desk_path); + + m_movie->setScaledSize(QSize(vp_width, vp_height)); + + if (m_movie->isValid()) + { + this->setMovie(m_movie); + m_movie->start(); + } + else + { + if (file_exists(desk_path)) + f_desk.load(desk_path); + else + f_desk.load(default_path); + + //this->resize(final_w, final_h); + //this->setPixmap(f_desk.scaled(final_w, final_h)); + this->resize(vp_width, final_h); + this->setPixmap(f_desk.scaled(vp_width, final_h)); + } } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index a1714163..cc69a1ee 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -909,7 +909,8 @@ void Courtroom::enter_courtroom(int p_cid) if (ao_app->custom_objection_enabled && (file_exists(ao_app->get_character_path(current_char, "custom.gif")) || - file_exists(ao_app->get_character_path(current_char, "custom.apng"))) && + file_exists(ao_app->get_character_path(current_char, "custom.apng")) || + file_exists(ao_app->get_character_path(current_char, "custom.webp"))) && file_exists(ao_app->get_character_path(current_char, "custom.wav"))) ui_custom_objection->show(); else @@ -2409,13 +2410,17 @@ void Courtroom::set_scene() 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")))) + file_exists(ao_app->get_background_path("jurystand.gif")) || + file_exists(ao_app->get_background_path("jurystand.apng")) || + file_exists(ao_app->get_background_path("jurystand.webp")))) { 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")))) + file_exists(ao_app->get_background_path("seancestand.gif")) || + file_exists(ao_app->get_background_path("seancestand.apng")) || + file_exists(ao_app->get_background_path("seancestand.webp")))) { f_background = "seancestand"; f_desk_image = "seancedesk"; diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 5a34ac8b..904e212f 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -385,11 +385,12 @@ QString AOApplication::get_sfx_suffix(QString sound_to_check) QString AOApplication::get_image_suffix(QString path_to_check) { + QString webp_check = path_to_check + ".webp"; QString apng_check = path_to_check + ".apng"; + if (file_exists(webp_check)) + return webp_check; if (file_exists(apng_check)) - { return apng_check; - } return path_to_check + ".gif"; } -- cgit From 7e2ec58c7eb62077733f354764d0b729fe0e0a93 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 10 Sep 2019 23:26:03 +0300 Subject: Prevent the animated background/foreground from restarting itself if the image is the exact same as the currently playing one --- include/aoscene.h | 1 + src/aoscene.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/aoscene.h b/include/aoscene.h index b58c0fd0..ddbefe08 100644 --- a/include/aoscene.h +++ b/include/aoscene.h @@ -21,6 +21,7 @@ private: QWidget *m_parent; QMovie *m_movie; AOApplication *ao_app; + QString last_image; }; diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 6d2dc890..0f4e7458 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -7,6 +7,7 @@ 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) @@ -15,6 +16,9 @@ void AOScene::set_image(QString p_image) QString default_path = ao_app->get_default_background_path(p_image + ".png"); QString animated_background_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); + if (file_exists(animated_background_path) && animated_background_path == last_image) + return; + QPixmap background(background_path); QPixmap default_bg(default_path); @@ -32,11 +36,16 @@ void AOScene::set_image(QString p_image) { this->setMovie(m_movie); m_movie->start(); + last_image = animated_background_path; } else if (file_exists(background_path)) + { this->setPixmap(background.scaled(w, h)); + } else + { this->setPixmap(default_bg.scaled(w, h)); + } } void AOScene::set_legacy_desk(QString p_image) @@ -48,6 +57,9 @@ void AOScene::set_legacy_desk(QString p_image) QString animated_desk_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); QString default_path = ao_app->get_image_suffix(ao_app->get_default_background_path(p_image)); + if (file_exists(animated_desk_path) && animated_desk_path == last_image) + return; + QPixmap f_desk; int vp_width = m_parent->width(); @@ -73,6 +85,7 @@ void AOScene::set_legacy_desk(QString p_image) { this->setMovie(m_movie); m_movie->start(); + last_image = animated_desk_path; } else { -- cgit From 3b415f5a7005fd0b42ba7ccbb9a8836746a72d41 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 15:40:19 +0300 Subject: Expand get_image_suffix to fall back on .png last Reorganize the file_exists checks to be an array iterator instead for much less code duplication and easier ordering of priority Reorganize desk and set_image loading on AOScene class, resolve issues with last_image setting to prevent animations from being restarted when characters talk on the same pos in succession Apply get_image_suffix for seancestand and jurystand searches TODO: At the moment, if you feed a .png shout, it will send the "Done" signal on the first frame (frame 0), not showing you the .png image at all. The shout code should be reorganized to allow static images to be displayed for exactly 720ms - the standard AA objection length. Usage of the timer similarly to the realizationflash.png might be possible. --- include/aoapplication.h | 2 +- src/aocharmovie.cpp | 33 ++++++++++++++-------------- src/aomovie.cpp | 51 ++++++++++++++++++------------------------- src/aoscene.cpp | 53 +++++++++++++++------------------------------ src/courtroom.cpp | 18 +++++---------- src/text_file_functions.cpp | 14 ++++++------ 6 files changed, 69 insertions(+), 102 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 68e82ce3..19924e46 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -219,7 +219,7 @@ 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, WEBP? If not, fall back to gif. + // Can we use APNG for this? If not, WEBP? If not, GIF? If not, fall back to PNG. QString get_image_suffix(QString path_to_check); //Returns the value of p_search_line within target_tag and terminator_tag diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index eacf8530..883530bd 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -19,25 +19,26 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { - QString original_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)); - QString alt_path = ao_app->get_character_path(p_char, p_emote + ".png"); - QString placeholder_path = ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")); - QString placeholder_default_path = ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")); - QString gif_path; - - if (file_exists(original_path)) - gif_path = original_path; - else if (file_exists(alt_path)) - gif_path = alt_path; - else if (file_exists(placeholder_path)) - gif_path = placeholder_path; - else - gif_path = placeholder_default_path; + QString emote_path; + QList pathlist; + pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)) <get_character_path(p_char, p_emote + ".png") << //Non-animated path if emote_prefix fails + ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")) << //Theme placeholder path + ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")); //Default theme placeholder path + + for (QString path : pathlist) + { + if (file_exists(path)) + { + emote_path = path; + break; + } + } m_movie->stop(); - m_movie->setFileName(gif_path); + m_movie->setFileName(emote_path); - QImageReader *reader = new QImageReader(gif_path); + QImageReader *reader = new QImageReader(emote_path); movie_frames.clear(); QImage f_image = reader->read(); diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 71a5a76a..a378a3dd 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -24,39 +24,30 @@ void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme) { m_movie->stop(); - QString gif_path; - - QString custom_path; + QString shout_path; + QList pathlist; if (p_gif == "custom") - custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif)); - else - custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble")); - - QString misc_path = ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_gif + "_bubble"); - QString custom_theme_path = ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_gif)); - QString theme_path = ao_app->get_image_suffix(ao_app->get_theme_path(p_gif)); - QString default_theme_path = ao_app->get_image_suffix(ao_app->get_default_theme_path(p_gif)); - QString placeholder_path = ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")); - QString default_placeholder_path =ao_app->get_image_suffix( ao_app->get_default_theme_path("placeholder")); - - 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; + pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif)); else - gif_path = ""; + pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble")); + + 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(gif_path); + m_movie->setFileName(shout_path); this->show(); m_movie->start(); diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 0f4e7458..c9314258 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -12,16 +12,13 @@ AOScene::AOScene(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) void AOScene::set_image(QString p_image) { - QString background_path = ao_app->get_background_path(p_image + ".png"); - QString default_path = ao_app->get_default_background_path(p_image + ".png"); - QString animated_background_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); + 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 - if (file_exists(animated_background_path) && animated_background_path == last_image) + if (file_exists(background_path) && background_path == last_image) return; - QPixmap background(background_path); - QPixmap default_bg(default_path); - int w = this->width(); int h = this->height(); @@ -29,74 +26,60 @@ 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()) { this->setMovie(m_movie); m_movie->start(); - last_image = animated_background_path; - } - else if (file_exists(background_path)) - { - this->setPixmap(background.scaled(w, h)); } else { - this->setPixmap(default_bg.scaled(w, h)); + QPixmap background(background_path); + this->setPixmap(background.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 + ".png"); - QString animated_desk_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); - QString default_path = ao_app->get_image_suffix(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 - if (file_exists(animated_desk_path) && animated_desk_path == last_image) + if (file_exists(desk_path) && desk_path == last_image) return; - QPixmap f_desk; + QPixmap f_desk(desk_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->clear(); this->setMovie(nullptr); m_movie->stop(); - m_movie->setFileName(animated_desk_path); + m_movie->setFileName(desk_path); - m_movie->setScaledSize(QSize(vp_width, vp_height)); + m_movie->setScaledSize(QSize(vp_width, final_h)); if (m_movie->isValid()) { this->setMovie(m_movie); m_movie->start(); - last_image = animated_desk_path; } else { - if (file_exists(desk_path)) - f_desk.load(desk_path); - else - f_desk.load(default_path); - - //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)); } + last_image = desk_path; } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index cc69a1ee..cc4410d5 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -908,10 +908,8 @@ void Courtroom::enter_courtroom(int p_cid) } if (ao_app->custom_objection_enabled && - (file_exists(ao_app->get_character_path(current_char, "custom.gif")) || - file_exists(ao_app->get_character_path(current_char, "custom.apng")) || - file_exists(ao_app->get_character_path(current_char, "custom.webp"))) && - file_exists(ao_app->get_character_path(current_char, "custom.wav"))) + (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(); else ui_custom_objection->hide(); @@ -2378,6 +2376,7 @@ void Courtroom::set_scene() QString f_desk_mod = m_chatmessage[DESK_MOD]; QString f_side = m_chatmessage[SIDE]; + //This thing desperately needs to be made into an array iteration. if (f_side == "def") { f_background = "defenseempty"; @@ -2409,18 +2408,12 @@ 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")) || - file_exists(ao_app->get_background_path("jurystand.apng")) || - file_exists(ao_app->get_background_path("jurystand.webp")))) + 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")) || - file_exists(ao_app->get_background_path("seancestand.apng")) || - file_exists(ao_app->get_background_path("seancestand.webp")))) + 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"; @@ -2436,7 +2429,6 @@ void Courtroom::set_scene() 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" || diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 904e212f..afe7a674 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -385,13 +385,13 @@ QString AOApplication::get_sfx_suffix(QString sound_to_check) QString AOApplication::get_image_suffix(QString path_to_check) { - QString webp_check = path_to_check + ".webp"; - QString apng_check = path_to_check + ".apng"; - if (file_exists(webp_check)) - return webp_check; - if (file_exists(apng_check)) - return apng_check; - return path_to_check + ".gif"; + 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"; } -- cgit From 2a899b14762be4084e4cd65e42918c1f43f5e4da Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 18:28:08 +0300 Subject: Allow AOMovie to have timers that take priority over the animated image frame count Set it up so feeding the timer value when playing the AOMovie would use the timer but only in cases where a non-animated image is used Update shouts and wtce to pass the 'duration' argument which will be used if the image used is non-animated. Otherwise, prioritize the animated image duration. --- include/aomovie.h | 5 ++++- src/aomovie.cpp | 36 +++++++++++++++++++++++++++--------- src/courtroom.cpp | 16 ++++++++-------- 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/include/aomovie.h b/include/aomovie.h index 1f278bf8..33b31586 100644 --- a/include/aomovie.h +++ b/include/aomovie.h @@ -15,13 +15,15 @@ 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 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 +31,7 @@ signals: private slots: void frame_change(int n_frame); + void timer_done(); }; #endif // AOMOVIE_H diff --git a/src/aomovie.cpp b/src/aomovie.cpp index a378a3dd..2598bb76 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -12,7 +12,11 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) this->setMovie(m_movie); + timer = new QTimer(this); + 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) @@ -20,7 +24,12 @@ void AOMovie::set_play_once(bool p_play_once) play_once = p_play_once; } -void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme) +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(); @@ -51,6 +60,8 @@ void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme) this->show(); m_movie->start(); + if (m_movie->frameCount() == 0 && duration > 0) + this->start_timer(duration); } void AOMovie::stop() @@ -61,16 +72,23 @@ 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 + delay(m_movie->nextFrameDelay()); - this->stop(); + this->stop(); - //signal connected to courtroom object, let it figure out what to do - done(); - } + //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/courtroom.cpp b/src/courtroom.cpp index cc4410d5..50ba2db8 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1349,20 +1349,20 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) 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, 724); 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, 724); objection_player->play("objection.wav", f_char, f_custom_theme); break; case 3: - ui_vp_objection->play("takethat", f_char, f_custom_theme); + ui_vp_objection->play("takethat", f_char, f_custom_theme, 724); 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); + ui_vp_objection->play("custom", f_char, f_custom_theme, 724); objection_player->play("custom.wav", f_char, f_custom_theme); break; default: @@ -2571,7 +2571,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) if (p_wtce == "testimony1") { sfx_player->play(ao_app->get_sfx("witness_testimony")); - ui_vp_wtce->play("witnesstestimony"); + ui_vp_wtce->play("witnesstestimony", "", "", 1500); testimony_in_progress = true; show_testimony(); } @@ -2579,7 +2579,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) else if (p_wtce == "testimony2") { sfx_player->play(ao_app->get_sfx("cross_examination")); - ui_vp_wtce->play("crossexamination"); + ui_vp_wtce->play("crossexamination", "", "", 1500); testimony_in_progress = false; } else if (p_wtce == "judgeruling") @@ -2587,12 +2587,12 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) if (variant == 0) { sfx_player->play(ao_app->get_sfx("not_guilty")); - ui_vp_wtce->play("notguilty"); + ui_vp_wtce->play("notguilty", "", "", 3000); testimony_in_progress = false; } else if (variant == 1) { sfx_player->play(ao_app->get_sfx("guilty")); - ui_vp_wtce->play("guilty"); + ui_vp_wtce->play("guilty", "", "", 3000); testimony_in_progress = false; } } -- cgit From 932f430b683dffb0b965c32cd2247e2b6361dd0e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 19:03:42 +0300 Subject: Remove unecessary hard-coded timers for the witness testimony .png Make the witness testimony use AOMovie instead of AOImage Remove pointless "testimony_in_progress" variable CONTROVERSIAL: Make the witness testimony indicator be position-ignorant so as to reduce the amount of hardcoding and allow broader usage of the witness testimony system (For example, Danganronpa investigation indicator, etc.) - This should not affect how the testimony indicator is received currently, as witness testimony usually requires the entire rest of the court to shut up until the cross-examination either way. --- include/courtroom.h | 15 +-------------- src/courtroom.cpp | 54 +++++++++-------------------------------------------- 2 files changed, 10 insertions(+), 59 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index f0b69967..e053e237 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -309,11 +309,6 @@ 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; @@ -323,14 +318,6 @@ private: 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; @@ -407,8 +394,8 @@ private: AOImage *ui_vp_chatbox; QLabel *ui_vp_showname; QTextEdit *ui_vp_message; - AOImage *ui_vp_testimony; AOImage *ui_vp_realization; + AOMovie *ui_vp_testimony; AOMovie *ui_vp_wtce; AOMovie *ui_vp_objection; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 50ba2db8..4c42b9a7 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -58,12 +58,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); - music_player = new AOMusicPlayer(this, ao_app); music_player->set_volume(0); @@ -101,7 +95,8 @@ 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_testimony = new AOMovie(this, ao_app); + ui_vp_testimony->set_play_once(false); ui_vp_realization = new AOImage(this, ao_app); ui_vp_wtce = new AOMovie(this, ao_app); ui_vp_objection = new AOMovie(this, ao_app); @@ -280,9 +275,6 @@ 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())); @@ -492,9 +484,7 @@ 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()); @@ -824,8 +814,7 @@ void Courtroom::done_received() void Courtroom::set_background(QString p_background) { - testimony_in_progress = false; - + ui_vp_testimony->stop(); current_background = p_background; is_ao2_bg = file_exists(ao_app->get_background_path("defensedesk.png")) && @@ -932,7 +921,7 @@ void Courtroom::enter_courtroom(int p_cid) objection_player->set_volume(ui_sfx_slider->value()); blip_player->set_volume(ui_blip_slider->value()); - testimony_in_progress = false; + ui_vp_testimony->stop(); set_widgets(); @@ -2334,27 +2323,6 @@ void Courtroom::chat_tick() } } - -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); -} - void Courtroom::play_sfx() { QString sfx_name = m_chatmessage[SFX_NAME]; @@ -2367,9 +2335,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"; QString f_desk_image = "stand"; @@ -2572,15 +2537,14 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) { sfx_player->play(ao_app->get_sfx("witness_testimony")); ui_vp_wtce->play("witnesstestimony", "", "", 1500); - testimony_in_progress = true; - show_testimony(); + ui_vp_testimony->play("testimony"); } //cross examination else if (p_wtce == "testimony2") { sfx_player->play(ao_app->get_sfx("cross_examination")); ui_vp_wtce->play("crossexamination", "", "", 1500); - testimony_in_progress = false; + ui_vp_testimony->stop(); } else if (p_wtce == "judgeruling") { @@ -2588,12 +2552,12 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) { sfx_player->play(ao_app->get_sfx("not_guilty")); ui_vp_wtce->play("notguilty", "", "", 3000); - testimony_in_progress = false; + ui_vp_testimony->stop(); } else if (variant == 1) { sfx_player->play(ao_app->get_sfx("guilty")); ui_vp_wtce->play("guilty", "", "", 3000); - testimony_in_progress = false; + ui_vp_testimony->stop(); } } } -- cgit From bb98f79083648243216f665852a7d2326af11be0 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 19:37:44 +0300 Subject: Fix compilation error Allow realization flashes to be animated images by making them AOMovies Eploit the newly added 'duration' system for realization AOMovie --- include/courtroom.h | 10 +--------- src/courtroom.cpp | 18 +++--------------- src/text_file_functions.cpp | 2 +- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index e053e237..fe870b46 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -306,9 +306,6 @@ private: //delay before sfx plays QTimer *sfx_delay_timer; - //keeps track of how long realization is visible(it's just a white square and should be visible less than a second) - QTimer *realization_timer; - //every time point in char.inis times this equals the final time const int time_mod = 40; @@ -394,7 +391,7 @@ private: AOImage *ui_vp_chatbox; QLabel *ui_vp_showname; QTextEdit *ui_vp_message; - AOImage *ui_vp_realization; + AOMovie *ui_vp_realization; AOMovie *ui_vp_testimony; AOMovie *ui_vp_wtce; AOMovie *ui_vp_objection; @@ -538,11 +535,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); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 4c42b9a7..04826876 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -55,9 +55,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() sfx_delay_timer = new QTimer(this); sfx_delay_timer->setSingleShot(true); - realization_timer = new QTimer(this); - realization_timer->setSingleShot(true); - music_player = new AOMusicPlayer(this, ao_app); music_player->set_volume(0); @@ -97,7 +94,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_vp_testimony = new AOMovie(this, ao_app); ui_vp_testimony->set_play_once(false); - ui_vp_realization = new AOImage(this, ao_app); + ui_vp_realization = new AOMovie(this, ao_app); ui_vp_wtce = new AOMovie(this, ao_app); ui_vp_objection = new AOMovie(this, ao_app); @@ -273,8 +270,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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())); @@ -487,9 +482,7 @@ void Courtroom::set_widgets() 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()); @@ -1971,10 +1964,6 @@ void Courtroom::preanim_done() handle_chatmessage_3(); } -void Courtroom::realization_done() -{ - ui_vp_realization->hide(); -} void Courtroom::start_chat_ticking() { @@ -1984,8 +1973,7 @@ void Courtroom::start_chat_ticking() if (m_chatmessage[REALIZATION] == "1") { - realization_timer->start(60); - ui_vp_realization->show(); + ui_vp_realization->play("realizationflash", "", "", 60); sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index afe7a674..837e7e8f 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -593,7 +593,7 @@ QString AOApplication::get_custom_realization(QString p_char) if (f_result == "") return get_sfx("realization"); - else return f_result; + else return get_sfx_suffix(f_result); } bool AOApplication::get_blank_blip() -- cgit From e76a83ddfe8f6fe16ee7e2a91d3ac30e89f80345 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 18:28:08 +0300 Subject: Allow AOMovie to have timers that take priority over the animated image frame count Set it up so feeding the timer value when playing the AOMovie would use the timer but only in cases where a non-animated image is used Update shouts and wtce to pass the 'duration' argument which will be used if the image used is non-animated. Otherwise, prioritize the animated image duration. --- include/aomovie.h | 5 +++- src/aomovie.cpp | 87 ++++++++++++++++++++++++++++++------------------------- src/courtroom.cpp | 16 +++++----- 3 files changed, 60 insertions(+), 48 deletions(-) diff --git a/include/aomovie.h b/include/aomovie.h index 1f278bf8..33b31586 100644 --- a/include/aomovie.h +++ b/include/aomovie.h @@ -15,13 +15,15 @@ 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 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 +31,7 @@ signals: private slots: void frame_change(int n_frame); + void timer_done(); }; #endif // AOMOVIE_H diff --git a/src/aomovie.cpp b/src/aomovie.cpp index edf5bdb0..2598bb76 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -12,7 +12,11 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) this->setMovie(m_movie); + timer = new QTimer(this); + 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) @@ -20,46 +24,44 @@ void AOMovie::set_play_once(bool p_play_once) play_once = p_play_once; } -void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme) +void AOMovie::start_timer(int delay) { - m_movie->stop(); + timer->start(delay); +} - QString gif_path; +void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme, int duration) +{ + m_movie->stop(); - QString custom_path; + QString shout_path; + QList pathlist; if (p_gif == "custom") - custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif)); - else - custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble")); - - 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"); - - 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; + pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif)); else - gif_path = ""; + pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble")); - m_movie->setFileName(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 + + for (QString path : pathlist) + { + if (file_exists(path)) + { + shout_path = path; + break; + } + } + + m_movie->setFileName(shout_path); this->show(); m_movie->start(); + if (m_movie->frameCount() == 0 && duration > 0) + this->start_timer(duration); } void AOMovie::stop() @@ -70,16 +72,23 @@ 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 + delay(m_movie->nextFrameDelay()); - this->stop(); + this->stop(); - //signal connected to courtroom object, let it figure out what to do - done(); - } + //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/courtroom.cpp b/src/courtroom.cpp index a1714163..14409780 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1350,20 +1350,20 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) 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, 724); 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, 724); objection_player->play("objection.wav", f_char, f_custom_theme); break; case 3: - ui_vp_objection->play("takethat", f_char, f_custom_theme); + ui_vp_objection->play("takethat", f_char, f_custom_theme, 724); 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); + ui_vp_objection->play("custom", f_char, f_custom_theme, 724); objection_player->play("custom.wav", f_char, f_custom_theme); break; default: @@ -2574,7 +2574,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) if (p_wtce == "testimony1") { sfx_player->play(ao_app->get_sfx("witness_testimony")); - ui_vp_wtce->play("witnesstestimony"); + ui_vp_wtce->play("witnesstestimony", "", "", 1500); testimony_in_progress = true; show_testimony(); } @@ -2582,7 +2582,7 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) else if (p_wtce == "testimony2") { sfx_player->play(ao_app->get_sfx("cross_examination")); - ui_vp_wtce->play("crossexamination"); + ui_vp_wtce->play("crossexamination", "", "", 1500); testimony_in_progress = false; } else if (p_wtce == "judgeruling") @@ -2590,12 +2590,12 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) if (variant == 0) { sfx_player->play(ao_app->get_sfx("not_guilty")); - ui_vp_wtce->play("notguilty"); + ui_vp_wtce->play("notguilty", "", "", 3000); testimony_in_progress = false; } else if (variant == 1) { sfx_player->play(ao_app->get_sfx("guilty")); - ui_vp_wtce->play("guilty"); + ui_vp_wtce->play("guilty", "", "", 3000); testimony_in_progress = false; } } -- cgit From 5a31516a36e0f13211db807a48214f11ccef827d Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 19:03:42 +0300 Subject: Remove unecessary hard-coded timers for the witness testimony .png Make the witness testimony use AOMovie instead of AOImage Remove pointless "testimony_in_progress" variable CONTROVERSIAL: Make the witness testimony indicator be position-ignorant so as to reduce the amount of hardcoding and allow broader usage of the witness testimony system (For example, Danganronpa investigation indicator, etc.) - This should not affect how the testimony indicator is received currently, as witness testimony usually requires the entire rest of the court to shut up until the cross-examination either way. (cherry picked from commit 932f430b683dffb0b965c32cd2247e2b6361dd0e) --- include/courtroom.h | 15 +-------------- src/courtroom.cpp | 54 +++++++++-------------------------------------------- 2 files changed, 10 insertions(+), 59 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index f0b69967..e053e237 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -309,11 +309,6 @@ 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; @@ -323,14 +318,6 @@ private: 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; @@ -407,8 +394,8 @@ private: AOImage *ui_vp_chatbox; QLabel *ui_vp_showname; QTextEdit *ui_vp_message; - AOImage *ui_vp_testimony; AOImage *ui_vp_realization; + AOMovie *ui_vp_testimony; AOMovie *ui_vp_wtce; AOMovie *ui_vp_objection; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 14409780..c82f6f2e 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -58,12 +58,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); - music_player = new AOMusicPlayer(this, ao_app); music_player->set_volume(0); @@ -101,7 +95,8 @@ 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_testimony = new AOMovie(this, ao_app); + ui_vp_testimony->set_play_once(false); ui_vp_realization = new AOImage(this, ao_app); ui_vp_wtce = new AOMovie(this, ao_app); ui_vp_objection = new AOMovie(this, ao_app); @@ -280,9 +275,6 @@ 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())); @@ -492,9 +484,7 @@ 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()); @@ -824,8 +814,7 @@ void Courtroom::done_received() void Courtroom::set_background(QString p_background) { - testimony_in_progress = false; - + ui_vp_testimony->stop(); current_background = p_background; is_ao2_bg = file_exists(ao_app->get_background_path("defensedesk.png")) && @@ -933,7 +922,7 @@ void Courtroom::enter_courtroom(int p_cid) objection_player->set_volume(ui_sfx_slider->value()); blip_player->set_volume(ui_blip_slider->value()); - testimony_in_progress = false; + ui_vp_testimony->stop(); set_widgets(); @@ -2335,27 +2324,6 @@ void Courtroom::chat_tick() } } - -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); -} - void Courtroom::play_sfx() { QString sfx_name = m_chatmessage[SFX_NAME]; @@ -2368,9 +2336,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"; QString f_desk_image = "stand"; @@ -2575,15 +2540,14 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) { sfx_player->play(ao_app->get_sfx("witness_testimony")); ui_vp_wtce->play("witnesstestimony", "", "", 1500); - testimony_in_progress = true; - show_testimony(); + ui_vp_testimony->play("testimony"); } //cross examination else if (p_wtce == "testimony2") { sfx_player->play(ao_app->get_sfx("cross_examination")); ui_vp_wtce->play("crossexamination", "", "", 1500); - testimony_in_progress = false; + ui_vp_testimony->stop(); } else if (p_wtce == "judgeruling") { @@ -2591,12 +2555,12 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) { sfx_player->play(ao_app->get_sfx("not_guilty")); ui_vp_wtce->play("notguilty", "", "", 3000); - testimony_in_progress = false; + ui_vp_testimony->stop(); } else if (variant == 1) { sfx_player->play(ao_app->get_sfx("guilty")); ui_vp_wtce->play("guilty", "", "", 3000); - testimony_in_progress = false; + ui_vp_testimony->stop(); } } } -- cgit From 3b3507df60673079482372b4da08eeabf9317a20 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 19:37:44 +0300 Subject: Fix compilation error Allow realization flashes to be animated images by making them AOMovies Eploit the newly added 'duration' system for realization AOMovie (cherry picked from commit bb98f79083648243216f665852a7d2326af11be0) --- include/courtroom.h | 10 +--------- src/courtroom.cpp | 18 +++--------------- src/text_file_functions.cpp | 2 +- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index e053e237..fe870b46 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -306,9 +306,6 @@ private: //delay before sfx plays QTimer *sfx_delay_timer; - //keeps track of how long realization is visible(it's just a white square and should be visible less than a second) - QTimer *realization_timer; - //every time point in char.inis times this equals the final time const int time_mod = 40; @@ -394,7 +391,7 @@ private: AOImage *ui_vp_chatbox; QLabel *ui_vp_showname; QTextEdit *ui_vp_message; - AOImage *ui_vp_realization; + AOMovie *ui_vp_realization; AOMovie *ui_vp_testimony; AOMovie *ui_vp_wtce; AOMovie *ui_vp_objection; @@ -538,11 +535,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); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c82f6f2e..5ae71f8e 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -55,9 +55,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() sfx_delay_timer = new QTimer(this); sfx_delay_timer->setSingleShot(true); - realization_timer = new QTimer(this); - realization_timer->setSingleShot(true); - music_player = new AOMusicPlayer(this, ao_app); music_player->set_volume(0); @@ -97,7 +94,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_vp_testimony = new AOMovie(this, ao_app); ui_vp_testimony->set_play_once(false); - ui_vp_realization = new AOImage(this, ao_app); + ui_vp_realization = new AOMovie(this, ao_app); ui_vp_wtce = new AOMovie(this, ao_app); ui_vp_objection = new AOMovie(this, ao_app); @@ -273,8 +270,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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())); @@ -487,9 +482,7 @@ void Courtroom::set_widgets() 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()); @@ -1972,10 +1965,6 @@ void Courtroom::preanim_done() handle_chatmessage_3(); } -void Courtroom::realization_done() -{ - ui_vp_realization->hide(); -} void Courtroom::start_chat_ticking() { @@ -1985,8 +1974,7 @@ void Courtroom::start_chat_ticking() if (m_chatmessage[REALIZATION] == "1") { - realization_timer->start(60); - ui_vp_realization->show(); + ui_vp_realization->play("realizationflash", "", "", 60); sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 5a34ac8b..8f6ee236 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -592,7 +592,7 @@ QString AOApplication::get_custom_realization(QString p_char) if (f_result == "") return get_sfx("realization"); - else return f_result; + else return get_sfx_suffix(f_result); } bool AOApplication::get_blank_blip() -- cgit From 2a5cd56d5774265fb474d0767964c47272283da8 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 22:55:24 +0300 Subject: Fixes Objections hiding the current character, instead of overlaying on top of it. (from goofball's 2.7 branch commit e6cb5bd2cf241d638941ad5b403ab5fd7490335c) --- src/courtroom.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index db97bb9c..6e01ea75 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1288,7 +1288,6 @@ 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(); ui_vp_evidence_display->reset(); -- cgit From 8a5bc8632eb69db751ded4d6034e5648208b9212 Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Fri, 18 Jan 2019 19:08:56 -0800 Subject: Kill Music on Object option (todo: actual functionality, cherrypicked from Goofball's 2.7 branch) --- Attorney_Online.pro | 4 ++-- include/aoapplication.h | 3 +++ include/aooptionsdialog.h | 2 ++ src/aooptionsdialog.cpp | 12 ++++++++++++ src/text_file_functions.cpp | 6 ++++++ 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 32781a1b..b7476190 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -16,13 +16,13 @@ HEADERS += $$files($$PWD/include/*.h) LIBS += -L$$PWD/lib -#DEFINES += DISCORD +DEFINES += DISCORD contains(DEFINES, DISCORD) { LIBS += -ldiscord-rpc } -#DEFINES += BASSAUDIO +DEFINES += BASSAUDIO contains(DEFINES, BASSAUDIO) { LIBS += -lbass diff --git a/include/aoapplication.h b/include/aoapplication.h index 19924e46..94508ff8 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -150,6 +150,9 @@ public: //Returns true if blank blips is enabled in config.ini and false otherwise bool get_blank_blip(); + //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(); diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 934d2577..34ae2b77 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -88,6 +88,8 @@ private: QLabel *ui_bliprate_lbl; QCheckBox *ui_blank_blips_cb; QLabel *ui_blank_blips_lbl; + QLabel *ui_objectmusic_lbl; + QCheckBox *ui_objectmusic_cb; QDialogButtonBox *ui_settings_buttons; QWidget *ui_casing_tab; diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 82507a1f..c8263ade 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -334,6 +334,17 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb); + 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_audio_layout->setWidget(9, QFormLayout::LabelRole, ui_objectmusic_lbl); + + ui_objectmusic_cb = new QCheckBox(ui_audio_widget); + ui_objectmusic_cb->setChecked(p_ao_app->get_objectmusic()); + + ui_audio_layout->setWidget(9, QFormLayout::FieldRole, ui_objectmusic_cb); + // The casing tab! ui_casing_tab = new QWidget(); ui_settings_tabs->addTab(ui_casing_tab, tr("Casing")); @@ -506,6 +517,7 @@ void AOOptionsDialog::save_pressed() 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("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()); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 837e7e8f..026de164 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -602,6 +602,12 @@ bool AOApplication::get_blank_blip() return result.startsWith("true"); } +bool AOApplication::get_objectmusic() +{ + QString result = configini->value("kill_music_on_object", "true").value(); + return result.startsWith("true"); +} + bool AOApplication::is_discord_enabled() { QString result = configini->value("discord", "true").value(); -- cgit From ba41b070a208af9393abebd721fb1488fbedee57 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 13 Sep 2019 11:03:23 +0300 Subject: Cut music on objection if config is enabled for it (does not transmit networked message yet) --- src/courtroom.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 6e01ea75..276b0fac 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1336,6 +1336,8 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) case 2: ui_vp_objection->play("objection", f_char, f_custom_theme, 724); objection_player->play("objection.wav", f_char, f_custom_theme); + if (ao_app->get_objectmusic()) + music_player->play(""); //I'd prefer if this sent a networked message instead so everyone would have their music cut when you object. break; case 3: ui_vp_objection->play("takethat", f_char, f_custom_theme, 724); -- cgit From 455e020b19bb1801304cedd08b2675fe4bb30605 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 13 Sep 2019 11:13:50 +0300 Subject: Make log go downwards by default Rename kill_music_on_object to objection_stop_music for readability Update blip rate (faster overall, more accurate to the trilogy) - based on AOV values Update default blip rate to be "once every two symbols" --- include/aoapplication.h | 4 ++-- include/courtroom.h | 2 +- src/aooptionsdialog.cpp | 4 ++-- src/courtroom.cpp | 2 +- src/text_file_functions.cpp | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 94508ff8..e6cb21d6 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -150,8 +150,8 @@ public: //Returns true if blank blips is enabled in config.ini and false otherwise bool get_blank_blip(); - //Returns true if kill music on object is enabled in the config.ini - bool get_objectmusic(); + //Returns true if stop music on objection is enabled in the config.ini + bool objection_stop_music(); //Returns the value of default_music in config.ini int get_default_music(); diff --git a/include/courtroom.h b/include/courtroom.h index a3c4736b..ed5199df 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -249,7 +249,7 @@ 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[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. diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index c8263ade..e86255bb 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -341,7 +341,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_audio_layout->setWidget(9, QFormLayout::LabelRole, ui_objectmusic_lbl); ui_objectmusic_cb = new QCheckBox(ui_audio_widget); - ui_objectmusic_cb->setChecked(p_ao_app->get_objectmusic()); + ui_objectmusic_cb->setChecked(p_ao_app->objection_stop_music()); ui_audio_layout->setWidget(9, QFormLayout::FieldRole, ui_objectmusic_cb); @@ -517,7 +517,7 @@ void AOOptionsDialog::save_pressed() 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("kill_music_on_object", ui_objectmusic_cb->isChecked()); + configini->setValue("objection_stop_music", ui_objectmusic_cb->isChecked()); configini->setValue("casing_enabled", ui_casing_enabled_cb->isChecked()); configini->setValue("casing_defence_enabled", ui_casing_def_cb->isChecked()); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 276b0fac..cd510041 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1336,7 +1336,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) case 2: ui_vp_objection->play("objection", f_char, f_custom_theme, 724); objection_player->play("objection.wav", f_char, f_custom_theme); - if (ao_app->get_objectmusic()) + if (ao_app->objection_stop_music()) music_player->play(""); //I'd prefer if this sent a networked message instead so everyone would have their music cut when you object. break; case 3: diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 026de164..9a0cd2fe 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -8,7 +8,7 @@ QString AOApplication::read_theme() int AOApplication::read_blip_rate() { - int result = configini->value("blip_rate", 1).toInt(); + int result = configini->value("blip_rate", 2).toInt(); if (result < 1) return 1; @@ -48,7 +48,7 @@ int AOApplication::get_max_log_size() bool AOApplication::get_log_goes_downwards() { - QString result = configini->value("log_goes_downwards", "false").value(); + QString result = configini->value("log_goes_downwards", "true").value(); return result.startsWith("true"); } @@ -602,9 +602,9 @@ bool AOApplication::get_blank_blip() return result.startsWith("true"); } -bool AOApplication::get_objectmusic() +bool AOApplication::objection_stop_music() { - QString result = configini->value("kill_music_on_object", "true").value(); + QString result = configini->value("objection_stop_music", "false").value(); return result.startsWith("true"); } -- cgit From 5c69d10cd5fface32aea04cea1d288783d376179 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 13 Sep 2019 11:31:06 +0300 Subject: Add a tool tip to blip rate settings Adapt the blip rate to allow variable speed value array sizes --- include/aoapplication.h | 2 +- src/aooptionsdialog.cpp | 2 ++ src/courtroom.cpp | 7 +++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index e6cb21d6..4a3c669b 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -144,7 +144,7 @@ public: //Returns the value of ooc_name in config.ini QString get_ooc_name(); - //Returns the blip rate from config.ini + //Returns the blip rate from config.ini (once per X symbols) int read_blip_rate(); //Returns true if blank blips is enabled in config.ini and false otherwise diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index e86255bb..a918c0c9 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -319,6 +319,8 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate()); ui_bliprate_spinbox->setMinimum(1); + ui_bliprate_spinbox->setToolTip(tr("Play a blip sound \"once per every X symbols\", where " + "X is the blip rate.")); ui_audio_layout->setWidget(6, QFormLayout::FieldRole, ui_bliprate_spinbox); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index cd510041..0faab3e9 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2275,13 +2275,11 @@ void Courtroom::chat_tick() if (f_character != ' ' || blank_blip) { - if (blip_pos % blip_rate == 0 && !formatting_char) { blip_pos = 0; blip_player->blip_tick(); } - ++blip_pos; } @@ -2289,14 +2287,15 @@ void Courtroom::chat_tick() // Restart the timer, but according to the newly set speeds, if there were any. // Keep the speed at bay. + int max_speed = sizeof(message_display_speed) / sizeof(message_display_speed[0]); //7 entries by default if (current_display_speed < 0) { current_display_speed = 0; } - if (current_display_speed > 6) + if (current_display_speed >= max_speed) { - current_display_speed = 6; + current_display_speed = max_speed-1; } // If we had a formatting char, we shouldn't wait so long again, as it won't appear! -- cgit From 8027bbffadc63b269091567f2557b8cd81abee56 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 13 Sep 2019 11:37:06 +0300 Subject: Use brace constructors instead of << append operator for path lists --- src/aocharmovie.cpp | 10 ++++++---- src/aomovie.cpp | 22 +++++++++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 883530bd..23da710a 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -21,10 +21,12 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { QString emote_path; QList pathlist; - pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)) <get_character_path(p_char, p_emote + ".png") << //Non-animated path if emote_prefix fails - ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")) << //Theme placeholder path - ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")); //Default theme placeholder path + pathlist = { + ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)), //Default path + ao_app->get_character_path(p_char, p_emote + ".png"), //Non-animated path if emote_prefix fails + ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Theme placeholder path + ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")), //Default theme placeholder path + }; for (QString path : pathlist) { diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 2598bb76..726a5159 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -35,17 +35,21 @@ void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme, int du QString shout_path; QList pathlist; + + 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 + }; + + //Add this at the beginning of the list - order matters. if (p_gif == "custom") - pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif)); + pathlist.prepend(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")); - - 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 + pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble"))); for (QString path : pathlist) { -- cgit From bb8edab5798be59476557c0eae2b6aa1f4257448 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 13 Sep 2019 11:41:59 +0300 Subject: Make shout, verdict and wtce default duration values into constants --- include/courtroom.h | 9 +++++++++ src/courtroom.cpp | 16 ++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index ed5199df..b3303374 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -311,6 +311,15 @@ private: //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 = 23; QString m_chatmessage[chatmessage_size]; bool chatmessage_is_empty = false; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 0faab3e9..b1fd1c2e 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1330,22 +1330,22 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) switch (objection_mod) { case 1: - ui_vp_objection->play("holdit", f_char, f_custom_theme, 724); + 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, 724); + 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->objection_stop_music()) music_player->play(""); //I'd prefer if this sent a networked message instead so everyone would have their music cut when you object. break; case 3: - ui_vp_objection->play("takethat", f_char, f_custom_theme, 724); + 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, 724); + 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: @@ -2524,14 +2524,14 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) if (p_wtce == "testimony1") { sfx_player->play(ao_app->get_sfx("witness_testimony")); - ui_vp_wtce->play("witnesstestimony", "", "", 1500); + ui_vp_wtce->play("witnesstestimony", "", "", wtce_stay_time); ui_vp_testimony->play("testimony"); } //cross examination else if (p_wtce == "testimony2") { sfx_player->play(ao_app->get_sfx("cross_examination")); - ui_vp_wtce->play("crossexamination", "", "", 1500); + ui_vp_wtce->play("crossexamination", "", "", wtce_stay_time); ui_vp_testimony->stop(); } else if (p_wtce == "judgeruling") @@ -2539,12 +2539,12 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) if (variant == 0) { sfx_player->play(ao_app->get_sfx("not_guilty")); - ui_vp_wtce->play("notguilty", "", "", 3000); + ui_vp_wtce->play("notguilty", "", "", verdict_stay_time); ui_vp_testimony->stop(); } else if (variant == 1) { sfx_player->play(ao_app->get_sfx("guilty")); - ui_vp_wtce->play("guilty", "", "", 3000); + ui_vp_wtce->play("guilty", "", "", verdict_stay_time); ui_vp_testimony->stop(); } } -- cgit From 9aa88b1d6e84538761a963249d8c8029314e26d7 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 13 Sep 2019 11:37:06 +0300 Subject: Use brace constructors instead of << append operator for path lists Rename gif_path into emote_path for charmovie.cpp Rename p_gif into p_image for aomovie.cpp --- src/aocharmovie.cpp | 50 +++++++++++++++++++++++++------------------------- src/aomovie.cpp | 26 +++++++++++++++----------- 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 57487233..90baa555 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -19,28 +19,28 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { - QString original_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif"); - QString alt_path = ao_app->get_character_path(p_char, p_emote + ".png"); - QString apng_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng"); - QString placeholder_path = ao_app->get_theme_path("placeholder.gif"); - QString placeholder_default_path = ao_app->get_default_theme_path("placeholder.gif"); - QString gif_path; - - if (file_exists(apng_path)) - gif_path = apng_path; - else if (file_exists(original_path)) - gif_path = original_path; - else if (file_exists(alt_path)) - gif_path = alt_path; - else if (file_exists(placeholder_path)) - gif_path = placeholder_path; - else - gif_path = placeholder_default_path; + QString emote_path; + QList pathlist; + pathlist = { + ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)), //Default path + ao_app->get_character_path(p_char, p_emote + ".png"), //Non-animated path if emote_prefix fails + ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Theme placeholder path + ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")), //Default theme placeholder path + }; + + for (QString path : pathlist) + { + if (file_exists(path)) + { + emote_path = path; + break; + } + } m_movie->stop(); - m_movie->setFileName(gif_path); + m_movie->setFileName(emote_path); - QImageReader *reader = new QImageReader(gif_path); + QImageReader *reader = new QImageReader(emote_path); movie_frames.clear(); QImage f_image = reader->read(); @@ -61,11 +61,11 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) { - QString gif_path = ao_app->get_character_path(p_char, p_emote); + QString emote_path = ao_app->get_character_path(p_char, p_emote); m_movie->stop(); this->clear(); - m_movie->setFileName(gif_path); + m_movie->setFileName(emote_path); m_movie->jumpToFrame(0); int full_duration = duration * time_mod; @@ -116,11 +116,11 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) void AOCharMovie::play_talking(QString p_char, QString p_emote) { - QString gif_path = ao_app->get_character_path(p_char, "(b)" + p_emote); + QString emote_path = ao_app->get_character_path(p_char, "(b)" + p_emote); m_movie->stop(); this->clear(); - m_movie->setFileName(gif_path); + m_movie->setFileName(emote_path); play_once = false; m_movie->setSpeed(100); @@ -129,11 +129,11 @@ void AOCharMovie::play_talking(QString p_char, QString p_emote) void AOCharMovie::play_idle(QString p_char, QString p_emote) { - QString gif_path = ao_app->get_character_path(p_char, "(a)" + p_emote); + QString emote_path = ao_app->get_character_path(p_char, "(a)" + p_emote); m_movie->stop(); this->clear(); - m_movie->setFileName(gif_path); + m_movie->setFileName(emote_path); play_once = false; m_movie->setSpeed(100); diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 2598bb76..851ae570 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -29,23 +29,27 @@ void AOMovie::start_timer(int delay) timer->start(delay); } -void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme, int duration) +void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int duration) { m_movie->stop(); QString shout_path; QList pathlist; - if (p_gif == "custom") - pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif)); + + pathlist = { + ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image + "_bubble"), //Misc path + ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path + ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path + ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //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 + }; + + //Add this at the beginning of the list - order matters. + if (p_image == "custom") + pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image))); else - pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble")); - - 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 + pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image + "_bubble"))); for (QString path : pathlist) { -- cgit From 86523bb101e73417e44eaae71e6cac5a11a70751 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 13 Sep 2019 11:56:22 +0300 Subject: Rename dubious "duration" to "default_duration" for play function in AOMovie class --- include/aomovie.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/aomovie.h b/include/aomovie.h index 33b31586..974559d2 100644 --- a/include/aomovie.h +++ b/include/aomovie.h @@ -16,7 +16,7 @@ public: void set_play_once(bool p_play_once); void start_timer(int delay); - void play(QString p_gif, QString p_char = "", QString p_custom_theme = "", int duration = 0); + 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(); -- cgit From 040898feff5d15f7236afb5e41c3bcc47e703a2a Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 13 Sep 2019 15:11:30 +0300 Subject: Set up screenshake button ui Rewrite Goofball's doScreenshake() function to be much more modular and multi-purpose (also rename to do_screenshake() to match other functions) Add networking needed to make screenshake work. Works with AOV version of tsuserver3 (button screenshake only so far). Add get_theme_pos helper function, currently unused. --- include/aoapplication.h | 1 + include/courtroom.h | 15 ++++- include/datatypes.h | 7 ++- src/courtroom.cpp | 132 +++++++++++++++++++++++++++++++++++++++++++- src/packet_distribution.cpp | 3 + 5 files changed, 155 insertions(+), 3 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 4a3c669b..8d998f46 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -78,6 +78,7 @@ public: bool arup_enabled = false; bool casing_alerts_enabled = false; bool modcall_reason_enabled = false; + bool looping_sfx_support_enabled = false; ///////////////loading info/////////////////// diff --git a/include/courtroom.h b/include/courtroom.h index b3303374..682e12a1 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -49,6 +49,9 @@ #include #include #include +#include +#include +#include #include @@ -124,6 +127,9 @@ public: //reads theme inis and sets size and pos based on the identifier void set_size_and_pos(QWidget *p_widget, QString p_identifier); + //reads theme inis and returns the size and pos as defined by it + 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); @@ -213,6 +219,8 @@ public: void announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno); void check_connection_received(); + void do_screenshake(); + void doRealization(); ~Courtroom(); @@ -231,6 +239,8 @@ private: bool first_message_sent = false; int maximumMessages = 0; + QParallelAnimationGroup *screenshake_animation_group; + // This is for inline message-colouring. enum INLINE_COLOURS { @@ -320,7 +330,7 @@ private: //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 = 23; + static const int chatmessage_size = 28; QString m_chatmessage[chatmessage_size]; bool chatmessage_is_empty = false; @@ -346,6 +356,7 @@ private: int objection_state = 0; int realization_state = 0; + int screenshake_state = 0; int text_color = 0; bool is_presenting_evidence = false; @@ -472,6 +483,7 @@ private: AOButton *ui_custom_objection; AOButton *ui_realization; + AOButton *ui_screenshake; AOButton *ui_mute; AOButton *ui_defense_plus; @@ -595,6 +607,7 @@ private slots: void on_custom_objection_clicked(); void on_realization_clicked(); + void on_screenshake_clicked(); void on_mute_clicked(); void on_pair_clicked(); diff --git a/include/datatypes.h b/include/datatypes.h index aaa5de52..1b76f725 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -100,7 +100,12 @@ enum CHAT_MESSAGE SELF_OFFSET, OTHER_OFFSET, OTHER_FLIP, - NONINTERRUPTING_PRE + NONINTERRUPTING_PRE, + LOOPING_SFX, + SCREENSHAKE, + FRAME_SCREENSHAKE, + FRAME_REALIZATION, + FRAME_SFX }; enum COLOR diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 5ae71f8e..04c2f86e 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -211,6 +211,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_custom_objection = new AOButton(this, ao_app); 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); @@ -291,6 +292,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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_mute, SIGNAL(clicked()), this, SLOT(on_mute_clicked())); @@ -625,6 +627,9 @@ void Courtroom::set_widgets() 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"); @@ -784,6 +789,23 @@ void Courtroom::set_taken(int n_char, bool p_taken) char_list.replace(n_char, f_char); } +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::done_received() { m_cid = -1; @@ -1232,6 +1254,50 @@ void Courtroom::on_chat_return_pressed() } } + // 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("0"); //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; + + QString frame_screenshake = ""; + QString frame_realization = ""; + QString frame_sfx = ""; + + QString preemote_sfx = ao_app->get_pre_emote(current_char, current_emote) + "^"; + QString preemote_shake = ao_app->get_pre_emote(current_char, current_emote) + "^"; + QString preemote_flash = ao_app->get_pre_emote(current_char, current_emote) + "^"; + + QString talkemote_sfx = "(b)" + ao_app->get_emote(current_char, current_emote) + "^"; + QString talkemote_shake = "(b)" + ao_app->get_emote(current_char, current_emote) + "^"; + QString talkemote_flash = "(b)" + ao_app->get_emote(current_char, current_emote) + "^"; + + QString idleemote_sfx = "(a)" + ao_app->get_emote(current_char, current_emote) + "^"; + QString idleemote_shake = "(a)" + ao_app->get_emote(current_char, current_emote) + "^"; + QString idleemote_flash = "(a)" + ao_app->get_emote(current_char, current_emote) + "^"; + + 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; + qDebug() << "Final strings:"; + qDebug() << frame_screenshake; + qDebug() << frame_realization; + qDebug() << frame_sfx; + + packet_contents.append(frame_screenshake); + packet_contents.append(frame_realization); + packet_contents.append(frame_sfx); + } ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } @@ -1300,6 +1366,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_ic_chat_message->clear(); objection_state = 0; realization_state = 0; + screenshake_state = 0; is_presenting_evidence = false; ui_pre->setChecked(false); ui_hold_it->set_image("holdit.png"); @@ -1307,6 +1374,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) 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"); } @@ -1565,7 +1633,6 @@ void Courtroom::handle_chatmessage_2() } } } - switch (emote_mod) { case 1: case 2: case 6: @@ -1582,6 +1649,48 @@ void Courtroom::handle_chatmessage_2() } } +void Courtroom::do_screenshake() +{ + if (screenshake_animation_group && screenshake_animation_group->state() == QAbstractAnimation::Running) + screenshake_animation_group->setCurrentTime(screenshake_animation_group->duration()); //Force it to finish and delete itself + + screenshake_animation_group = new QParallelAnimationGroup; + + QList affected_list = { + ui_vp_background, + ui_vp_player_char, + ui_vp_sideplayer_char, + ui_vp_chatbox, + }; + + //I would prefer if this was its own "shake" function to be honest. + foreach (QWidget* ui_element, affected_list) + { + QPropertyAnimation *screenshake_animation = new QPropertyAnimation(ui_element, "pos", this); + QPoint pos_default = QPoint(ui_element->x(), ui_element->y()); + + int duration = 300; //How long does the screenshake last + int frequency = 20; //How often in ms is there a "jolt" frame + int maxframes = duration/frequency; + int max_x = 7; //Max deviation from origin on x axis + int max_y = 7; //Max deviation from origin on y axis + screenshake_animation->setDuration(duration); + for (int frame=0; frame < maxframes; frame++) + { + double fraction = double(frame*frequency)/duration; + quint32 rng = QRandomGenerator::global()->generate(); + int rand_x = int(rng) % max_x; + int rand_y = int(rng+100) % max_y; + screenshake_animation->setKeyValueAt(fraction, QPoint(pos_default.x() + rand_x, pos_default.y() + rand_y)); + } + screenshake_animation->setEndValue(pos_default); + screenshake_animation->setEasingCurve(QEasingCurve::Linear); + screenshake_animation_group->addAnimation(screenshake_animation); + } + + screenshake_animation_group->start(QAbstractAnimation::DeletionPolicy::DeleteWhenStopped); +} + void Courtroom::handle_chatmessage_3() { start_chat_ticking(); @@ -1978,6 +2087,11 @@ void Courtroom::start_chat_ticking() sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); } + if (m_chatmessage[SCREENSHAKE] == "1") + { + this->do_screenshake(); + } + ui_vp_message->clear(); set_text_color(); rainbow_counter = 0; @@ -3184,6 +3298,22 @@ void Courtroom::on_realization_clicked() 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()) diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index cfd6d8c6..420aea28 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -156,6 +156,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) 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") @@ -216,6 +217,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet) 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; } else if (header == "PN") { -- cgit From f1b31697130101ab493a2f2907e3974f3cf1fa58 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 13 Sep 2019 15:13:40 +0300 Subject: CONTROVERSIAL: Detach ui_vp_message from ui_vp_chatbox to prevent it from being affected by the screenshake. ui_vp_message still sets position relative to the chat box for now (as doing otherwise would break a lot of themes). --- src/courtroom.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 04c2f86e..2e174f26 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -86,7 +86,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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 = new QTextEdit(this); ui_vp_message->setFrameStyle(QFrame::NoFrame); ui_vp_message->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); ui_vp_message->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -476,6 +476,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_vp_showname, "showname"); set_size_and_pos(ui_vp_message, "message"); + //We detached the text as parent from the chatbox so it doesn't get affected by the screenshake. +// ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y()); ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: white"); -- cgit From f9b3bd5bb5fdbb739e806d004af09443bdbb2aac Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 13 Sep 2019 17:57:30 +0300 Subject: forgot to actually uncomment the change, oops --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 2e174f26..41712d2f 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -477,7 +477,7 @@ void Courtroom::set_widgets() set_size_and_pos(ui_vp_message, "message"); //We detached the text as parent from the chatbox so it doesn't get affected by the screenshake. -// ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y()); + ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y()); ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: white"); -- cgit From 1139bf5cd0473817ba223ac8a9fe9d193575206a Mon Sep 17 00:00:00 2001 From: iamgoofball Date: Sat, 19 Jan 2019 21:01:19 -0800 Subject: Bass.dll functionality-based clientside music looping system by using channel loopable flags (no use of QTimer required) Implement Goofball's AOV loopable music server message where any value that's not -1 when the length of the handle_message packet is longer than 3 will not loop the music (still confused about this but w/e) --- include/aomusicplayer.h | 5 ++++- src/aomusicplayer.cpp | 26 +++++++++++++++++++++++--- src/courtroom.cpp | 18 +++++++++++++++++- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index b34267c9..da47128c 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -17,15 +17,18 @@ class AOMusicPlayer { public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - ~AOMusicPlayer(); + virtual ~AOMusicPlayer(); void play(QString p_song); + void stop(); void set_volume(int p_value); + void set_looping(bool toggle); private: QWidget *m_parent; AOApplication *ao_app; + bool m_looping = true; int m_volume = 0; HSTREAM m_stream; }; diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 27918092..781a90c9 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -17,22 +17,42 @@ void AOMusicPlayer::play(QString p_song) BASS_ChannelStop(m_stream); QString f_path = ao_app->get_music_path(p_song); - - m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + unsigned int flags = BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE; + m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); this->set_volume(m_volume); - + this->set_looping(m_looping); if (ao_app->get_audio_output_device() != "default") BASS_ChannelSetDevice(m_stream, BASS_GetDevice()); BASS_ChannelPlay(m_stream, false); } +void AOMusicPlayer::stop() +{ + BASS_ChannelStop(m_stream); +} + void AOMusicPlayer::set_volume(int p_value) { m_volume = p_value; float volume = m_volume / 100.0f; BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume); } + +void AOMusicPlayer::set_looping(bool toggle) +{ + m_looping = toggle; + if (BASS_ChannelFlags(m_stream, 0, 0) & BASS_SAMPLE_LOOP) + { + if (m_looping == false) + BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP); // remove the LOOP flag + } + else + { + if (m_looping == true) + BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag + } +} #elif defined(QTAUDIO) AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) { diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 41712d2f..06f5aa06 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2616,7 +2616,23 @@ void Courtroom::handle_song(QStringList *p_contents) if (p_contents->length() > 2) { - str_show = p_contents->at(2); + if(p_contents->at(2) != "") + { + str_show = p_contents->at(2); + } + } + if (p_contents->length() > 3) + { + //I am really confused why "-1" is "loop this song" and why anything else passes as "don't loop" + //(if we even have this length) but alright + if(p_contents->at(3) != "-1") + { + music_player->set_looping(false); + } + else + { + music_player->set_looping(true); + } } if (!mute_map.value(n_char)) -- cgit From 4645d9dd080964560477e48d99812bc494c1965b Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 14 Sep 2019 00:46:46 +0300 Subject: Add a blip sound QElapsedTimer so blipsounds don't play more frequently than 60ms to preserve all of our ears. Adjust the message display speeds to feel more accurate to AA, with }}} speed displaying text instantly for that section --- include/aoblipplayer.h | 4 ++++ include/courtroom.h | 2 +- src/aoblipplayer.cpp | 4 ++++ src/courtroom.cpp | 28 +++++++++++----------------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/include/aoblipplayer.h b/include/aoblipplayer.h index 44ca48bb..9a428371 100644 --- a/include/aoblipplayer.h +++ b/include/aoblipplayer.h @@ -11,6 +11,7 @@ #include #include +#include #include @@ -26,9 +27,12 @@ public: int m_cycle = 0; private: + const int max_blip_ms = 60; + QWidget *m_parent; AOApplication *ao_app; qreal m_volume; + QElapsedTimer delay; void set_volume_internal(qreal p_volume); diff --git a/include/courtroom.h b/include/courtroom.h index 682e12a1..9c79a3e3 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -259,7 +259,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] = {0, 10, 25, 40, 50, 70, 90}; // This is for checking if the character should start talking again // when an inline blue text ends. diff --git a/src/aoblipplayer.cpp b/src/aoblipplayer.cpp index 1c668ab4..5f4dc6cc 100644 --- a/src/aoblipplayer.cpp +++ b/src/aoblipplayer.cpp @@ -23,6 +23,10 @@ void AOBlipPlayer::set_blips(QString p_sfx) void AOBlipPlayer::blip_tick() { + if (delay.isValid() && delay.elapsed() < max_blip_ms) + return; + + delay.start(); int f_cycle = m_cycle++; if (m_cycle == 5) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 06f5aa06..1435b0d4 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2386,23 +2386,6 @@ void Courtroom::chat_tick() QScrollBar *scroll = ui_vp_message->verticalScrollBar(); scroll->setValue(scroll->maximum()); - if(blank_blip) - qDebug() << "blank_blip found true"; - - if (f_character != ' ' || blank_blip) - { - - if (blip_pos % blip_rate == 0 && !formatting_char) - { - blip_pos = 0; - blip_player->blip_tick(); - } - - ++blip_pos; - } - - tick_pos += f_char_length; - // Restart the timer, but according to the newly set speeds, if there were any. // Keep the speed at bay. if (current_display_speed < 0) @@ -2415,6 +2398,17 @@ void Courtroom::chat_tick() current_display_speed = 6; } + if (!formatting_char && (f_character != ' ' || blank_blip)) + { + if (blip_pos % blip_rate == 0) + { + blip_player->blip_tick(); + } + ++blip_pos; + } + + tick_pos += f_char_length; + // If we had a formatting char, we shouldn't wait so long again, as it won't appear! if (formatting_char) { -- cgit From 4b452e968d07d4f49f1e6e3c86ba52c6d175033c Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 14 Sep 2019 00:48:07 +0300 Subject: Fix the objection_stop_music option not doing anything Stop the animation for the side player char in pairing so as not to affect anything Remove the "DOOM" packet as anyone who has the source code can just remove it anyway --- src/courtroom.cpp | 3 +++ src/packet_distribution.cpp | 7 ------- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 1435b0d4..3729c982 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1408,6 +1408,8 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) case 2: ui_vp_objection->play("objection", f_char, f_custom_theme, 724); objection_player->play("objection.wav", f_char, f_custom_theme); + if(ao_app->objection_stop_music()) + music_player->stop(); break; case 3: ui_vp_objection->play("takethat", f_char, f_custom_theme, 724); @@ -1505,6 +1507,7 @@ void Courtroom::handle_chatmessage_2() { // If there 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); diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 420aea28..6059edb9 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -109,13 +109,6 @@ void AOApplication::ms_packet_received(AOPacket *p_packet) 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: -- cgit From b608f841003c461d914e6ace0c91a67b884a7b01 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 14 Sep 2019 01:20:01 +0300 Subject: Resolve a segfault with screenshake, need to determine a better method to finish previous animation (if it exists) properly. --- src/courtroom.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3729c982..32e39d09 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1656,21 +1656,24 @@ void Courtroom::handle_chatmessage_2() void Courtroom::do_screenshake() { - if (screenshake_animation_group && screenshake_animation_group->state() == QAbstractAnimation::Running) - screenshake_animation_group->setCurrentTime(screenshake_animation_group->duration()); //Force it to finish and delete itself +//Code below causes segfault, do not uncomment unless you know what you're doing. +// if (screenshake_animation_group != nullptr && screenshake_animation_group->state() == QAbstractAnimation::Running) +// screenshake_animation_group->setCurrentTime(screenshake_animation_group->duration()); //Force it to finish and delete itself screenshake_animation_group = new QParallelAnimationGroup; - QList affected_list = { + QList affected_list = { ui_vp_background, ui_vp_player_char, ui_vp_sideplayer_char, - ui_vp_chatbox, + ui_vp_chatbox }; + int i = 0; //I would prefer if this was its own "shake" function to be honest. foreach (QWidget* ui_element, affected_list) { + qDebug() << ++i; QPropertyAnimation *screenshake_animation = new QPropertyAnimation(ui_element, "pos", this); QPoint pos_default = QPoint(ui_element->x(), ui_element->y()); -- cgit From f225df6f19aa68789ba702fa298db8675741a495 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 14 Sep 2019 14:50:16 +0300 Subject: Fix objections hiding the character --- src/courtroom.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 32e39d09..477f3955 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1357,7 +1357,6 @@ 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(); ui_vp_evidence_display->reset(); -- cgit From 51c97ad51ce564ab400f5333eaad75b1fb2e5461 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 14 Sep 2019 19:38:56 +0300 Subject: Allow [Time] to be blank for pre-anims to not be required to use it play_talking and play_idle reduced in useless code --- include/aocharmovie.h | 2 +- src/aocharmovie.cpp | 15 ++------------- src/courtroom.cpp | 3 +-- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/include/aocharmovie.h b/include/aocharmovie.h index 7ef7da3f..f54f5105 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -36,7 +36,7 @@ private: QVector movie_frames; QTimer *preanim_timer; - const int time_mod = 62; + const int time_mod = 60; // These are the X and Y values before they are fixed based on the sprite's width. int x = 0; diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 90baa555..ac12f638 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -75,6 +75,7 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame) { + qDebug() << "frame " << n_frame << " delay of " << m_movie->nextFrameDelay(); real_duration += m_movie->nextFrameDelay(); m_movie->jumpToFrame(n_frame + 1); } @@ -86,7 +87,7 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) double percentage_modifier = 100.0; - if (real_duration != 0 && duration != 0) + if (real_duration != 0 && duration > 0) { double modifier = full_duration / static_cast(real_duration); percentage_modifier = 100 / modifier; @@ -116,12 +117,6 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) void AOCharMovie::play_talking(QString p_char, QString p_emote) { - QString emote_path = ao_app->get_character_path(p_char, "(b)" + p_emote); - - m_movie->stop(); - this->clear(); - m_movie->setFileName(emote_path); - play_once = false; m_movie->setSpeed(100); play(p_char, p_emote, "(b)"); @@ -129,12 +124,6 @@ void AOCharMovie::play_talking(QString p_char, QString p_emote) void AOCharMovie::play_idle(QString p_char, QString p_emote) { - QString emote_path = ao_app->get_character_path(p_char, "(a)" + p_emote); - - m_movie->stop(); - this->clear(); - m_movie->setFileName(emote_path); - play_once = false; m_movie->setSpeed(100); play(p_char, p_emote, "(a)"); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 477f3955..47e3a0e7 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2049,8 +2049,7 @@ void Courtroom::play_preanim(bool noninterrupting) 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 (!file_exists(anim_to_find)) { if (noninterrupting) anim_state = 4; -- cgit From ab30cca586a05506c3cfb502cee53957409242e8 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 14 Sep 2019 19:50:46 +0300 Subject: Use a ticker and QImageReader instead of QMovie Issue: absolutely fucking broken, needs shittons of fixing or ditching. Might not be that efficient, anyway. --- include/aocharmovie.h | 16 +++-- src/aocharmovie.cpp | 169 +++++++++++++++++++++----------------------------- 2 files changed, 79 insertions(+), 106 deletions(-) diff --git a/include/aocharmovie.h b/include/aocharmovie.h index f54f5105..65ab79fe 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -1,7 +1,7 @@ #ifndef AOCHARMOVIE_H #define AOCHARMOVIE_H -#include +#include #include #include #include @@ -21,20 +21,24 @@ 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_frame(QImage image); void stop(); + void set_flipped(bool p_flipped) {m_flipped = p_flipped;} + void move(int ax, int ay); void combo_resize(int w, int h); + private: AOApplication *ao_app; - QMovie *m_movie; - QVector movie_frames; + QImageReader *m_reader; QTimer *preanim_timer; + QTimer *ticker; + QString last_path; const int time_mod = 60; @@ -50,8 +54,8 @@ signals: void done(); private slots: - void frame_change(int n_frame); - void timer_done(); + void preanim_done(); + void movie_ticker(); }; #endif // AOCHARMOVIE_H diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index ac12f638..8004a540 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -7,14 +7,15 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) { ao_app = p_ao_app; - - m_movie = new QMovie(this); - preanim_timer = new QTimer(this); preanim_timer->setSingleShot(true); - connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); - connect(preanim_timer, SIGNAL(timeout()), this, SLOT(timer_done())); + ticker = new QTimer(this); + ticker->setSingleShot(true); + connect(ticker, SIGNAL(timeout()), this, SLOT(movie_ticker())); + +// connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); + connect(preanim_timer, SIGNAL(timeout()), this, SLOT(preanim_done())); } void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) @@ -37,111 +38,79 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) } } - m_movie->stop(); - m_movie->setFileName(emote_path); - - QImageReader *reader = new QImageReader(emote_path); - - movie_frames.clear(); - QImage f_image = reader->read(); - while (!f_image.isNull()) - { - if (m_flipped) - movie_frames.append(f_image.mirrored(true, false)); - else - movie_frames.append(f_image); - f_image = reader->read(); - } - - delete reader; - + this->clear(); + m_reader = new QImageReader(emote_path); + + QImage f_image = m_reader->read(); +// while (!f_image.isNull()) +// { +// if (m_flipped) +// movie_frames.append(f_image.mirrored(true, false)); +// else +// movie_frames.append(f_image); +// f_image = reader->read(); +// } + +// delete m_reader; this->show(); - m_movie->start(); + qDebug() << "Setting image to " << f_image; + this->set_frame(f_image); + if (m_reader->supportsAnimation()) + ticker->start(m_reader->nextImageDelay()); } void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) { - QString emote_path = ao_app->get_character_path(p_char, p_emote); - - m_movie->stop(); - this->clear(); - m_movie->setFileName(emote_path); - m_movie->jumpToFrame(0); - - int full_duration = duration * time_mod; - int real_duration = 0; - - play_once = false; - - for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame) - { - qDebug() << "frame " << n_frame << " delay of " << m_movie->nextFrameDelay(); - real_duration += m_movie->nextFrameDelay(); - m_movie->jumpToFrame(n_frame + 1); - } - -#ifdef DEBUG_GIF - qDebug() << "full_duration: " << full_duration; - qDebug() << "real_duration: " << real_duration; -#endif - - double percentage_modifier = 100.0; - - if (real_duration != 0 && duration > 0) - { - double modifier = full_duration / static_cast(real_duration); - percentage_modifier = 100 / modifier; - - if (percentage_modifier > 100.0) - percentage_modifier = 100.0; - } - -#ifdef DEBUG_GIF - qDebug() << "% mod: " << percentage_modifier; -#endif - - if (full_duration == 0 || full_duration >= real_duration) - { - play_once = true; - } - else - { - play_once = false; - preanim_timer->start(full_duration); - } - - - m_movie->setSpeed(static_cast(percentage_modifier)); +// QString emote_path = ao_app->get_character_path(p_char, p_emote); + play_once = true; play(p_char, p_emote, ""); } void AOCharMovie::play_talking(QString p_char, QString p_emote) { play_once = false; - m_movie->setSpeed(100); play(p_char, p_emote, "(b)"); } void AOCharMovie::play_idle(QString p_char, QString p_emote) { play_once = false; - m_movie->setSpeed(100); play(p_char, p_emote, "(a)"); } 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 - m_movie->stop(); + ticker->stop(); preanim_timer->stop(); this->hide(); } +void AOCharMovie::set_frame(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; + + 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)); + + QLabel::move(x + (this->width() - this->pixmap()->width())/2, y); +} + void AOCharMovie::combo_resize(int w, int h) { QSize f_size(w, h); this->resize(f_size); - m_movie->setScaledSize(f_size); +// m_reader->setScaledSize(f_size); } void AOCharMovie::move(int ax, int ay) @@ -151,34 +120,34 @@ void AOCharMovie::move(int ax, int ay) QLabel::move(x, y); } -void AOCharMovie::frame_change(int n_frame) +void AOCharMovie::movie_ticker() { - - if (movie_frames.size() > n_frame) + if(m_reader->format() != "gif") + ticker->start(m_reader->nextImageDelay()); + if(m_reader->currentImageNumber() == -1) { - QPixmap f_pixmap = QPixmap::fromImage(movie_frames.at(n_frame)); - auto aspect_ratio = Qt::KeepAspectRatio; - - if (f_pixmap.size().width() > f_pixmap.size().height()) - aspect_ratio = Qt::KeepAspectRatioByExpanding; - - if (f_pixmap.size().width() > this->size().width() || f_pixmap.size().height() > this->size().height()) - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::SmoothTransformation)); + if(play_once) + { + preanim_done(); + return; + } else - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation)); - - QLabel::move(x + (this->width() - this->pixmap()->width())/2, y); - } - - if (m_movie->frameCount() - 1 == n_frame && play_once) + m_reader->jumpToImage(0); //Loop back + } + QImage f_image = m_reader->read(); + if(f_image.isNull()) { - preanim_timer->start(m_movie->nextFrameDelay()); - m_movie->stop(); + qDebug() << "Animated image error on frame" << m_reader->currentImageNumber() << m_reader->errorString(); + stop(); + return; } + this->set_frame(f_image); + qDebug() << m_reader->format() << "frame" << m_reader->nextImageDelay() << m_reader->currentImageNumber() << m_reader->imageCount(); + if(m_reader->format() == "gif") + ticker->start(m_reader->nextImageDelay()); } -void AOCharMovie::timer_done() +void AOCharMovie::preanim_done() { - done(); } -- cgit From 14ced5ce156eec4974b424fc59e47da948aa080d Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 14 Sep 2019 20:20:38 +0300 Subject: 2.7.2 way of animating charmovie.cpp ported over --- include/aocharmovie.h | 7 ++++- src/aocharmovie.cpp | 76 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 54 insertions(+), 29 deletions(-) diff --git a/include/aocharmovie.h b/include/aocharmovie.h index f54f5105..bc0e30a5 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -29,12 +29,15 @@ public: void combo_resize(int w, int h); + void set_frame(QImage image); + private: AOApplication *ao_app; QMovie *m_movie; QVector movie_frames; QTimer *preanim_timer; + QTimer *ticker; const int time_mod = 60; @@ -46,11 +49,13 @@ private: bool play_once = true; + bool preprocess = false; + signals: void done(); private slots: - void frame_change(int n_frame); + void movie_ticker(); void timer_done(); }; diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index ac12f638..a0afc357 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -13,12 +13,16 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ preanim_timer = new QTimer(this); preanim_timer->setSingleShot(true); - connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); + ticker = new QTimer(this); + ticker->setSingleShot(true); + connect(preanim_timer, SIGNAL(timeout()), this, SLOT(timer_done())); + connect(ticker, SIGNAL(timeout()), this, SLOT(movie_ticker())); } void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { + preprocess = false; QString emote_path; QList pathlist; pathlist = { @@ -33,30 +37,22 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) if (file_exists(path)) { emote_path = path; + if (emote_path.endsWith(".apng")) + preprocess = true; break; } } + delete m_movie; + m_movie = new QMovie(this); m_movie->stop(); + this->clear(); m_movie->setFileName(emote_path); - - QImageReader *reader = new QImageReader(emote_path); - - movie_frames.clear(); - QImage f_image = reader->read(); - while (!f_image.isNull()) - { - if (m_flipped) - movie_frames.append(f_image.mirrored(true, false)); - else - movie_frames.append(f_image); - f_image = reader->read(); - } - - delete reader; - + m_movie->jumpToFrame(0); + this->set_frame(m_movie->currentImage()); + qDebug() << "playing file path: " << emote_path; this->show(); - m_movie->start(); + ticker->start(m_movie->nextFrameDelay()); } void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) @@ -151,12 +147,43 @@ void AOCharMovie::move(int ax, int ay) QLabel::move(x, y); } -void AOCharMovie::frame_change(int n_frame) +void AOCharMovie::movie_ticker() { + if(preprocess) + ticker->start(m_movie->nextFrameDelay()); - if (movie_frames.size() > n_frame) + if(m_movie->currentFrameNumber() == m_movie->frameCount() - 1) { - QPixmap f_pixmap = QPixmap::fromImage(movie_frames.at(n_frame)); + QString last_path = m_movie->fileName(); + 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(); + } + } + else + { + m_movie->jumpToNextFrame(); + } + this->set_frame(m_movie->currentImage()); +// this->play_frame_sfx(); + if(!preprocess){ + ticker->start(m_movie->nextFrameDelay()); + } +} + +void AOCharMovie::set_frame(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; if (f_pixmap.size().width() > f_pixmap.size().height()) @@ -168,13 +195,6 @@ void AOCharMovie::frame_change(int n_frame) this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation)); QLabel::move(x + (this->width() - this->pixmap()->width())/2, y); - } - - if (m_movie->frameCount() - 1 == n_frame && play_once) - { - preanim_timer->start(m_movie->nextFrameDelay()); - m_movie->stop(); - } } void AOCharMovie::timer_done() -- cgit From 938f1aeea15c6b68495bb1cb0a80467f4e8cf343 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 14 Sep 2019 22:35:02 +0300 Subject: Optimize the heck out of animated images. There is no lag after the image is loaded now. HOWEVER, there's lag when the image is first loaded due to the aspect ratio and sizing (at least with .apng's). --- include/aocharmovie.h | 11 +++++--- src/aocharmovie.cpp | 74 ++++++++++++++++++++++++++++----------------------- 2 files changed, 48 insertions(+), 37 deletions(-) diff --git a/include/aocharmovie.h b/include/aocharmovie.h index 65ab79fe..0921bc5f 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -6,6 +6,7 @@ #include #include #include +#include class AOApplication; @@ -21,7 +22,8 @@ public: void play_talking(QString p_char, QString p_emote); void play_idle(QString p_char, QString p_emote); - void set_frame(QImage image); + QPixmap get_pixmap(QImage image); + void set_frame(QPixmap f_pixmap); void stop(); @@ -35,19 +37,22 @@ public: private: AOApplication *ao_app; - QImageReader *m_reader; + QVector movie_frames; + QVector movie_delays; QTimer *preanim_timer; QTimer *ticker; QString last_path; + QElapsedTimer actual_time; const int time_mod = 60; // These are the X and Y values before they are fixed based on the sprite's width. int x = 0; int y = 0; - bool m_flipped = false; + int frame = 0; + bool m_flipped = false; bool play_once = true; signals: diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 8004a540..2d370ec7 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -11,7 +11,8 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ preanim_timer->setSingleShot(true); ticker = new QTimer(this); - ticker->setSingleShot(true); + ticker->setTimerType(Qt::PreciseTimer); + ticker->setSingleShot(false); connect(ticker, SIGNAL(timeout()), this, SLOT(movie_ticker())); // connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); @@ -20,6 +21,7 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { + actual_time.restart(); QString emote_path; QList pathlist; pathlist = { @@ -39,24 +41,29 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) } this->clear(); - m_reader = new QImageReader(emote_path); + ticker->stop(); + movie_frames.clear(); + movie_delays.clear(); + + QImageReader *m_reader = new QImageReader(emote_path); QImage f_image = m_reader->read(); -// while (!f_image.isNull()) -// { -// if (m_flipped) -// movie_frames.append(f_image.mirrored(true, false)); -// else -// movie_frames.append(f_image); -// f_image = reader->read(); -// } - -// delete m_reader; + while (!f_image.isNull()) + { + movie_frames.append(this->get_pixmap(f_image)); + movie_delays.append(m_reader->nextImageDelay()); + f_image = m_reader->read(); + } + + delete m_reader; + this->show(); - qDebug() << "Setting image to " << f_image; - this->set_frame(f_image); - if (m_reader->supportsAnimation()) - ticker->start(m_reader->nextImageDelay()); + qDebug() << "Setting image to " << emote_path << "Time taken to process image:" << actual_time.elapsed(); + frame = 0; + actual_time.restart(); + this->set_frame(movie_frames[frame]); + if (movie_frames.size() > 0) + ticker->start(movie_delays[frame]); } void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) @@ -86,7 +93,7 @@ void AOCharMovie::stop() this->hide(); } -void AOCharMovie::set_frame(QImage image) +QPixmap AOCharMovie::get_pixmap(QImage image) { QPixmap f_pixmap; if(m_flipped) @@ -99,10 +106,16 @@ void AOCharMovie::set_frame(QImage image) 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)); + f_pixmap = 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)); + f_pixmap = f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation); + return f_pixmap; +} + +void AOCharMovie::set_frame(QPixmap f_pixmap) +{ + this->setPixmap(f_pixmap); QLabel::move(x + (this->width() - this->pixmap()->width())/2, y); } @@ -122,29 +135,22 @@ void AOCharMovie::move(int ax, int ay) void AOCharMovie::movie_ticker() { - if(m_reader->format() != "gif") - ticker->start(m_reader->nextImageDelay()); - if(m_reader->currentImageNumber() == -1) + ++frame; + if(frame == movie_frames.size()) { if(play_once) { preanim_done(); + ticker->stop(); return; } else - m_reader->jumpToImage(0); //Loop back - } - QImage f_image = m_reader->read(); - if(f_image.isNull()) - { - qDebug() << "Animated image error on frame" << m_reader->currentImageNumber() << m_reader->errorString(); - stop(); - return; + frame = 0; } - this->set_frame(f_image); - qDebug() << m_reader->format() << "frame" << m_reader->nextImageDelay() << m_reader->currentImageNumber() << m_reader->imageCount(); - if(m_reader->format() == "gif") - ticker->start(m_reader->nextImageDelay()); +// qint64 difference = elapsed - movie_delays[frame]; + qDebug() << frame << movie_delays[frame] << "actual time taken from last frame:" << actual_time.restart(); + this->set_frame(movie_frames[frame]); + ticker->setInterval(movie_delays[frame]); } void AOCharMovie::preanim_done() -- cgit From 37d192b4300efd1c2f3e35b2efb40e93ec99fa03 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 15 Sep 2019 02:14:40 +0300 Subject: Load frames as they're needed instead of loading everything at once, and cache them for optimization. The cache is cleared when a new animation is played. Resolve an issue where if a preanim transitions into (a)idle it would get stuck on the first frame of that (removed the ticker->stop();) --- include/aocharmovie.h | 2 ++ src/aocharmovie.cpp | 46 +++++++++++++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/include/aocharmovie.h b/include/aocharmovie.h index 0921bc5f..c852bb36 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -42,6 +42,7 @@ private: QTimer *preanim_timer; QTimer *ticker; QString last_path; + QImageReader *m_reader = new QImageReader(); QElapsedTimer actual_time; const int time_mod = 60; @@ -51,6 +52,7 @@ private: int y = 0; int frame = 0; + int max_frames = 0; bool m_flipped = false; bool play_once = true; diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 2d370ec7..1251a200 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -21,7 +21,9 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { +#ifdef DEBUG_CHARMOVIE actual_time.restart(); +#endif QString emote_path; QList pathlist; pathlist = { @@ -42,28 +44,31 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) this->clear(); ticker->stop(); + preanim_timer->stop(); movie_frames.clear(); movie_delays.clear(); - QImageReader *m_reader = new QImageReader(emote_path); - + m_reader->setFileName(emote_path); QImage f_image = m_reader->read(); - while (!f_image.isNull()) - { - movie_frames.append(this->get_pixmap(f_image)); - movie_delays.append(m_reader->nextImageDelay()); - f_image = m_reader->read(); - } + int f_delay = m_reader->nextImageDelay(); - delete m_reader; - - this->show(); - qDebug() << "Setting image to " << emote_path << "Time taken to process image:" << actual_time.elapsed(); frame = 0; + max_frames = m_reader->imageCount(); + +#ifdef DEBUG_CHARMOVIE + qDebug() << max_frames << "Setting image to " << emote_path << "Time taken to process image:" << actual_time.elapsed(); + actual_time.restart(); +#endif + this->set_frame(movie_frames[frame]); - if (movie_frames.size() > 0) + this->show(); + if (max_frames > 1) + { + movie_frames.append(this->get_pixmap(f_image)); + movie_delays.append(f_delay); ticker->start(movie_delays[frame]); + } } void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) @@ -136,19 +141,30 @@ void AOCharMovie::move(int ax, int ay) void AOCharMovie::movie_ticker() { ++frame; - if(frame == movie_frames.size()) + if(frame == max_frames) { if(play_once) { preanim_done(); - ticker->stop(); return; } else frame = 0; } // qint64 difference = elapsed - movie_delays[frame]; + if(frame >= movie_frames.size()) + { + m_reader->jumpToImage(frame); + movie_frames.resize(frame + 1); + movie_frames[frame] = this->get_pixmap(m_reader->read()); + movie_delays.resize(frame + 1); + movie_delays[frame] = m_reader->nextImageDelay(); + } + +#ifdef DEBUG_CHARMOVIE qDebug() << frame << movie_delays[frame] << "actual time taken from last frame:" << actual_time.restart(); +#endif + this->set_frame(movie_frames[frame]); ticker->setInterval(movie_delays[frame]); } -- cgit From 5419641c1ebe1e8749ad6e78b82c11cbd1bc13b7 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 15 Sep 2019 02:17:20 +0300 Subject: Revert "2.7.2 way of animating charmovie.cpp ported over" This reverts commit 14ced5ce156eec4974b424fc59e47da948aa080d. --- include/aocharmovie.h | 7 +---- src/aocharmovie.cpp | 76 +++++++++++++++++++-------------------------------- 2 files changed, 29 insertions(+), 54 deletions(-) diff --git a/include/aocharmovie.h b/include/aocharmovie.h index bc0e30a5..f54f5105 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -29,15 +29,12 @@ public: void combo_resize(int w, int h); - void set_frame(QImage image); - private: AOApplication *ao_app; QMovie *m_movie; QVector movie_frames; QTimer *preanim_timer; - QTimer *ticker; const int time_mod = 60; @@ -49,13 +46,11 @@ private: bool play_once = true; - bool preprocess = false; - signals: void done(); private slots: - void movie_ticker(); + void frame_change(int n_frame); void timer_done(); }; diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index a0afc357..ac12f638 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -13,16 +13,12 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ preanim_timer = new QTimer(this); preanim_timer->setSingleShot(true); - ticker = new QTimer(this); - ticker->setSingleShot(true); - + connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); connect(preanim_timer, SIGNAL(timeout()), this, SLOT(timer_done())); - connect(ticker, SIGNAL(timeout()), this, SLOT(movie_ticker())); } void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { - preprocess = false; QString emote_path; QList pathlist; pathlist = { @@ -37,22 +33,30 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) if (file_exists(path)) { emote_path = path; - if (emote_path.endsWith(".apng")) - preprocess = true; break; } } - delete m_movie; - m_movie = new QMovie(this); m_movie->stop(); - this->clear(); m_movie->setFileName(emote_path); - m_movie->jumpToFrame(0); - this->set_frame(m_movie->currentImage()); - qDebug() << "playing file path: " << emote_path; + + QImageReader *reader = new QImageReader(emote_path); + + movie_frames.clear(); + QImage f_image = reader->read(); + while (!f_image.isNull()) + { + if (m_flipped) + movie_frames.append(f_image.mirrored(true, false)); + else + movie_frames.append(f_image); + f_image = reader->read(); + } + + delete reader; + this->show(); - ticker->start(m_movie->nextFrameDelay()); + m_movie->start(); } void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) @@ -147,43 +151,12 @@ void AOCharMovie::move(int ax, int ay) QLabel::move(x, y); } -void AOCharMovie::movie_ticker() +void AOCharMovie::frame_change(int n_frame) { - if(preprocess) - ticker->start(m_movie->nextFrameDelay()); - if(m_movie->currentFrameNumber() == m_movie->frameCount() - 1) + if (movie_frames.size() > n_frame) { - QString last_path = m_movie->fileName(); - 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(); - } - } - else - { - m_movie->jumpToNextFrame(); - } - this->set_frame(m_movie->currentImage()); -// this->play_frame_sfx(); - if(!preprocess){ - ticker->start(m_movie->nextFrameDelay()); - } -} - -void AOCharMovie::set_frame(QImage image) -{ - QPixmap f_pixmap; - if(m_flipped) - f_pixmap = QPixmap::fromImage(image.mirrored(true, false)); - else - f_pixmap = QPixmap::fromImage(image); + QPixmap f_pixmap = QPixmap::fromImage(movie_frames.at(n_frame)); auto aspect_ratio = Qt::KeepAspectRatio; if (f_pixmap.size().width() > f_pixmap.size().height()) @@ -195,6 +168,13 @@ void AOCharMovie::set_frame(QImage image) this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation)); QLabel::move(x + (this->width() - this->pixmap()->width())/2, y); + } + + if (m_movie->frameCount() - 1 == n_frame && play_once) + { + preanim_timer->start(m_movie->nextFrameDelay()); + m_movie->stop(); + } } void AOCharMovie::timer_done() -- cgit From 4db114007456f12c77f002cac4e26cd3f6917638 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 15 Sep 2019 14:26:57 +0300 Subject: Add a bunch of cool refactors to support variable speed percentage Partially bring back the differing [Time] duration variable, however, the speed of the image will not be adjusted to accomodate it due to the need for using m_reader to read through every frame to determine the final full delay value (which tanks performance). Comment all the functions for the charmovie in aocharmovie.h --- include/aocharmovie.h | 26 +++++++++++++++++++++++++- src/aocharmovie.cpp | 47 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 57 insertions(+), 16 deletions(-) diff --git a/include/aocharmovie.h b/include/aocharmovie.h index c852bb36..b8b73b7e 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -17,22 +17,44 @@ class AOCharMovie : public QLabel public: AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app); - void play(QString p_char, QString p_emote, QString emote_prefix); + //Set the movie's image to provided paths, preparing for playback. + void load_image(QString p_char, QString p_emote, QString emote_prefix); + + //Start playback of the movie (if animated). + void play(); + + //Play a hat.gif - style preanimation void play_pre(QString p_char, QString p_emote, int duration); + + //Play a (b)normal.gif - style animation (talking) void play_talking(QString p_char, QString p_emote); + + //Play an (a)normal.gif - style animation (not talking) void play_idle(QString p_char, QString p_emote); + //Retreive a pixmap adjused for mirroring/aspect ratio shenanigans from a provided QImage QPixmap get_pixmap(QImage image); + + //Set the movie's frame to provided pixmap void set_frame(QPixmap f_pixmap); + //Stop the movie, clearing the image void stop(); + //Set the m_flipped variable to true/false void set_flipped(bool p_flipped) {m_flipped = p_flipped;} + //Set the movie's playback speed (between 10% and 1000%) + void set_speed(int modifier) {speed = qMax(10, qMin(modifier, 1000));} + + //Move the label itself around void move(int ax, int ay); + //This is somewhat pointless now as there's no "QMovie" object to resize, aka no "combo" to speak of void combo_resize(int w, int h); + //Return the frame delay adjusted for speed + int get_frame_delay(int delay); private: AOApplication *ao_app; @@ -54,6 +76,8 @@ private: int frame = 0; int max_frames = 0; + int speed = 100; + bool m_flipped = false; bool play_once = true; diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 1251a200..0c389b1e 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -19,7 +19,7 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ connect(preanim_timer, SIGNAL(timeout()), this, SLOT(preanim_done())); } -void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) +void AOCharMovie::load_image(QString p_char, QString p_emote, QString emote_prefix) { #ifdef DEBUG_CHARMOVIE actual_time.restart(); @@ -49,45 +49,56 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) movie_delays.clear(); m_reader->setFileName(emote_path); - QImage f_image = m_reader->read(); + QPixmap f_pixmap = this->get_pixmap(m_reader->read()); int f_delay = m_reader->nextImageDelay(); frame = 0; max_frames = m_reader->imageCount(); + this->set_frame(f_pixmap); + this->show(); + if (max_frames > 1) + { + movie_frames.append(f_pixmap); + movie_delays.append(f_delay); + } #ifdef DEBUG_CHARMOVIE qDebug() << max_frames << "Setting image to " << emote_path << "Time taken to process image:" << actual_time.elapsed(); actual_time.restart(); #endif +} - this->set_frame(movie_frames[frame]); - this->show(); - if (max_frames > 1) - { - movie_frames.append(this->get_pixmap(f_image)); - movie_delays.append(f_delay); - ticker->start(movie_delays[frame]); - } +void AOCharMovie::play() +{ + if (max_frames <= 1) + return; + ticker->start(this->get_frame_delay(movie_delays[frame])); } void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) { -// QString emote_path = ao_app->get_character_path(p_char, p_emote); + load_image(p_char, p_emote, ""); + //As much as I'd like to screw around with [Time] durations modifying the animation speed, I don't think I can reliably do that, + //not without looping through all frames in the image at least - which causes lag. So for now it simply ends the preanimation early instead. play_once = true; - play(p_char, p_emote, ""); + if (duration > 0) //It's -1 if there's no definition in [Time] for it. In which case, it will let the animation run out in full. Duration 0 does the same. + preanim_timer->start(duration); //This timer will not fire if the animation finishes earlier than that + play(); } void AOCharMovie::play_talking(QString p_char, QString p_emote) { play_once = false; - play(p_char, p_emote, "(b)"); + load_image(p_char, p_emote, "(b)"); + play(); } void AOCharMovie::play_idle(QString p_char, QString p_emote) { play_once = false; - play(p_char, p_emote, "(a)"); + load_image(p_char, p_emote, "(a)"); + play(); } void AOCharMovie::stop() @@ -131,6 +142,11 @@ void AOCharMovie::combo_resize(int w, int h) // m_reader->setScaledSize(f_size); } +int AOCharMovie::get_frame_delay(int delay) +{ + return static_cast(double(delay) * double(speed/100)); +} + void AOCharMovie::move(int ax, int ay) { x = ax; @@ -166,10 +182,11 @@ void AOCharMovie::movie_ticker() #endif this->set_frame(movie_frames[frame]); - ticker->setInterval(movie_delays[frame]); + ticker->setInterval(this->get_frame_delay(movie_delays[frame])); } void AOCharMovie::preanim_done() { + preanim_timer->stop(); done(); } -- cgit From a2f9df4042585ab0849b54e2bb0b9699f9064aed Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 15 Sep 2019 17:44:02 +0300 Subject: Finally implement frame-specific effects such as screenshake, realization flash, sound effects, etc. Fix screenshake animation modifying the default positions of shook elements Fix aomovie sometimes not playing the last frame and causing lagspikes due to the delay() method --- include/aoapplication.h | 12 +++++ include/aocharmovie.h | 12 +++++ include/aomovie.h | 1 - include/courtroom.h | 7 +-- src/aocharmovie.cpp | 57 ++++++++++++++++++++++ src/aomovie.cpp | 16 ++----- src/courtroom.cpp | 114 +++++++++++++++++++++++++++++--------------- src/text_file_functions.cpp | 36 ++++++++++++++ 8 files changed, 200 insertions(+), 55 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 8d998f46..8164e166 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -271,6 +271,18 @@ public: //Returns the sfx of p_char's p_emote QString get_sfx_name(QString p_char, int p_emote); + //Returns if the sfx is defined as looping in char.ini + QString get_sfx_looping(QString p_char, QString p_sfx); + + //Returns if an emote has a frame specific SFX for it + QString get_sfx_frame(QString p_char, QString p_emote, int n_frame); + + //Returns if an emote has a frame specific SFX for it + QString get_flash_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); diff --git a/include/aocharmovie.h b/include/aocharmovie.h index b8b73b7e..5eaafaf6 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -32,6 +32,9 @@ public: //Play an (a)normal.gif - style animation (not talking) void play_idle(QString p_char, QString p_emote); + //Play a frame-specific effect, if there's any defined for that specific frame. + void play_frame_effect(int frame); + //Retreive a pixmap adjused for mirroring/aspect ratio shenanigans from a provided QImage QPixmap get_pixmap(QImage image); @@ -61,6 +64,12 @@ private: QVector movie_frames; QVector movie_delays; + + //Effects such as sfx, screenshakes and realization flashes are stored in here. + //QString entry format: "sfx^[sfx_name]", "shake", "flash". + //The program uses the QVector index as reference. + QVector> movie_effects; + QTimer *preanim_timer; QTimer *ticker; QString last_path; @@ -83,6 +92,9 @@ private: signals: void done(); + void shake(); + void flash(); + void play_sfx(QString sfx); private slots: void preanim_done(); diff --git a/include/aomovie.h b/include/aomovie.h index 974559d2..a5af735e 100644 --- a/include/aomovie.h +++ b/include/aomovie.h @@ -15,7 +15,6 @@ public: AOMovie(QWidget *p_parent, AOApplication *p_ao_app); void set_play_once(bool p_play_once); - 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(); diff --git a/include/courtroom.h b/include/courtroom.h index 9c79a3e3..7fbde274 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -219,8 +219,6 @@ public: void announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno); void check_connection_received(); - void do_screenshake(); - void doRealization(); ~Courtroom(); @@ -239,7 +237,7 @@ private: bool first_message_sent = false; int maximumMessages = 0; - QParallelAnimationGroup *screenshake_animation_group; + QParallelAnimationGroup *screenshake_animation_group = new QParallelAnimationGroup; // This is for inline message-colouring. @@ -557,6 +555,9 @@ private: public slots: void objection_done(); void preanim_done(); + void do_screenshake(); + void do_flash(); + void play_char_sfx(QString sfx_name); void mod_called(QString p_ip); diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 0c389b1e..efe24735 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -47,6 +47,7 @@ void AOCharMovie::load_image(QString p_char, QString p_emote, QString emote_pref preanim_timer->stop(); movie_frames.clear(); movie_delays.clear(); + movie_effects.clear(); m_reader->setFileName(emote_path); QPixmap f_pixmap = this->get_pixmap(m_reader->read()); @@ -62,6 +63,32 @@ void AOCharMovie::load_image(QString p_char, QString p_emote, QString emote_pref movie_frames.append(f_pixmap); movie_delays.append(f_delay); } + + movie_effects.resize(max_frames); + for (int e_frame = 0; e_frame < max_frames; ++e_frame) + { + qDebug() << p_char << p_emote << e_frame; + QString effect = ao_app->get_screenshake_frame(p_char, emote_prefix + p_emote, e_frame); + if (effect != "") + { + movie_effects[e_frame].append("shake"); + qDebug() << e_frame << "shake"; + } + + effect = ao_app->get_flash_frame(p_char, emote_prefix + p_emote, e_frame); + if (effect != "") + { + movie_effects[e_frame].append("flash"); + qDebug() << e_frame << "flash"; + } + + effect = ao_app->get_sfx_frame(p_char, emote_prefix + p_emote, e_frame); + if (effect != "") + { + movie_effects[e_frame].append("sfx^"+effect); + qDebug() << e_frame << effect; + } + } #ifdef DEBUG_CHARMOVIE qDebug() << max_frames << "Setting image to " << emote_path << "Time taken to process image:" << actual_time.elapsed(); @@ -71,6 +98,7 @@ void AOCharMovie::load_image(QString p_char, QString p_emote, QString emote_pref void AOCharMovie::play() { + play_frame_effect(frame); if (max_frames <= 1) return; ticker->start(this->get_frame_delay(movie_delays[frame])); @@ -101,6 +129,34 @@ void AOCharMovie::play_idle(QString p_char, QString p_emote) play(); } +void AOCharMovie::play_frame_effect(int frame) +{ + if(frame < max_frames) + { + foreach (QString effect, movie_effects[frame]) + { + if(effect == "shake") + { + shake(); + qDebug() << "Attempting to play shake on frame" << frame; + } + + if(effect == "flash") + { + flash(); + qDebug() << "Attempting to play flash on frame" << frame; + } + + if(effect.startsWith("sfx^")) + { + QString sfx = effect.section("^", 1); + play_sfx(sfx); + qDebug() << "Attempting to play sfx" << sfx << "on frame" << frame; + } + } + } +} + 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 @@ -182,6 +238,7 @@ void AOCharMovie::movie_ticker() #endif this->set_frame(movie_frames[frame]); + play_frame_effect(frame); ticker->setInterval(this->get_frame_delay(movie_delays[frame])); } diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 851ae570..7f7fb205 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -13,6 +13,7 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) 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))); @@ -24,11 +25,6 @@ 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_image, QString p_char, QString p_custom_theme, int duration) { m_movie->stop(); @@ -65,7 +61,7 @@ void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int this->show(); m_movie->start(); if (m_movie->frameCount() == 0 && duration > 0) - this->start_timer(duration); + timer->start(duration); } void AOMovie::stop() @@ -81,17 +77,13 @@ void AOMovie::frame_change(int n_frame) if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) || !play_once) return; //we need this or else the last frame wont show - delay(m_movie->nextFrameDelay()); - - this->stop(); - - //signal connected to courtroom object, let it figure out what to do - done(); + timer->start(m_movie->nextFrameDelay()); } void AOMovie::timer_done() { this->stop(); + //signal connected to courtroom object, let it figure out what to do done(); } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 47e3a0e7..30921d84 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -265,6 +265,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_vp_objection, SIGNAL(done()), this, SLOT(objection_done())); connect(ui_vp_player_char, SIGNAL(done()), this, SLOT(preanim_done())); + connect(ui_vp_player_char, SIGNAL(shake()), this, SLOT(do_screenshake())); + connect(ui_vp_player_char, SIGNAL(flash()), this, SLOT(do_flash())); + connect(ui_vp_player_char, SIGNAL(play_sfx(QString)), this, SLOT(play_char_sfx(QString))); connect(text_delay_timer, SIGNAL(timeout()), this, SLOT(start_chat_ticking())); connect(sfx_delay_timer, SIGNAL(timeout()), this, SLOT(play_sfx())); @@ -1655,47 +1658,58 @@ void Courtroom::handle_chatmessage_2() void Courtroom::do_screenshake() { -//Code below causes segfault, do not uncomment unless you know what you're doing. -// if (screenshake_animation_group != nullptr && screenshake_animation_group->state() == QAbstractAnimation::Running) -// screenshake_animation_group->setCurrentTime(screenshake_animation_group->duration()); //Force it to finish and delete itself - - screenshake_animation_group = new QParallelAnimationGroup; - - QList affected_list = { - ui_vp_background, - ui_vp_player_char, - ui_vp_sideplayer_char, - ui_vp_chatbox - }; - - int i = 0; - //I would prefer if this was its own "shake" function to be honest. - foreach (QWidget* ui_element, affected_list) + //This way, the animation is reset in such a way that last played screenshake would return to its "final frame" properly. + //This properly resets all UI elements without having to bother keeping track of "origin" positions. + //Works great wit the chat text being detached from the chat box! + screenshake_animation_group->setCurrentTime(screenshake_animation_group->duration()); + screenshake_animation_group->clear(); + + QList affected_list = { + ui_vp_background, + ui_vp_player_char, + ui_vp_sideplayer_char, + ui_vp_chatbox + }; + + int i = 0; + //I would prefer if this was its own "shake" function to be honest. + foreach (QWidget* ui_element, affected_list) + { + qDebug() << ++i; + QPropertyAnimation *screenshake_animation = new QPropertyAnimation(ui_element, "pos", this); + QPoint pos_default = QPoint(ui_element->x(), ui_element->y()); + + int duration = 300; //How long does the screenshake last + int frequency = 20; //How often in ms is there a "jolt" frame + int maxframes = duration/frequency; + int max_x = 7; //Max deviation from origin on x axis + int max_y = 7; //Max deviation from origin on y axis + screenshake_animation->setDuration(duration); + for (int frame=0; frame < maxframes; frame++) { - qDebug() << ++i; - QPropertyAnimation *screenshake_animation = new QPropertyAnimation(ui_element, "pos", this); - QPoint pos_default = QPoint(ui_element->x(), ui_element->y()); - - int duration = 300; //How long does the screenshake last - int frequency = 20; //How often in ms is there a "jolt" frame - int maxframes = duration/frequency; - int max_x = 7; //Max deviation from origin on x axis - int max_y = 7; //Max deviation from origin on y axis - screenshake_animation->setDuration(duration); - for (int frame=0; frame < maxframes; frame++) - { - double fraction = double(frame*frequency)/duration; - quint32 rng = QRandomGenerator::global()->generate(); - int rand_x = int(rng) % max_x; - int rand_y = int(rng+100) % max_y; - screenshake_animation->setKeyValueAt(fraction, QPoint(pos_default.x() + rand_x, pos_default.y() + rand_y)); - } - screenshake_animation->setEndValue(pos_default); - screenshake_animation->setEasingCurve(QEasingCurve::Linear); - screenshake_animation_group->addAnimation(screenshake_animation); + double fraction = double(frame*frequency)/duration; + quint32 rng = QRandomGenerator::global()->generate(); + int rand_x = int(rng) % max_x; + int rand_y = int(rng+100) % max_y; + screenshake_animation->setKeyValueAt(fraction, QPoint(pos_default.x() + rand_x, pos_default.y() + rand_y)); } + screenshake_animation->setEndValue(pos_default); + screenshake_animation->setEasingCurve(QEasingCurve::Linear); + screenshake_animation_group->addAnimation(screenshake_animation); + } - screenshake_animation_group->start(QAbstractAnimation::DeletionPolicy::DeleteWhenStopped); + screenshake_animation_group->start(); +} + +void Courtroom::do_flash() +{ + ui_vp_realization->play("realizationflash", "", "", 60); +} + +void Courtroom::play_char_sfx(QString sfx_name) +{ + sfx_player->play(ao_app->get_sfx_suffix(sfx_name)); + sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name)!="0"); } void Courtroom::handle_chatmessage_3() @@ -1829,6 +1843,16 @@ QString Courtroom::filter_ic_text(QString p_text) p_text.remove(trick_check_pos,1); } + else if (f_character == "$" and !ic_next_is_not_special) + { + p_text.remove(trick_check_pos,1); + } + + else if (f_character == "@" and !ic_next_is_not_special) + { + p_text.remove(trick_check_pos,1); + } + // Orange inline colourisation. else if (f_character == "|" and !ic_next_is_not_special) { @@ -2089,7 +2113,7 @@ void Courtroom::start_chat_ticking() if (m_chatmessage[REALIZATION] == "1") { - ui_vp_realization->play("realizationflash", "", "", 60); + this->do_flash(); sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); } @@ -2208,6 +2232,18 @@ void Courtroom::chat_tick() formatting_char = true; } + else if (f_character == "@" and !next_character_is_not_special) + { + this->do_screenshake(); + formatting_char = true; + } + + else if (f_character == "$" and !next_character_is_not_special) + { + this->do_flash(); + formatting_char = true; + } + // Orange inline colourisation. else if (f_character == "|" and !next_character_is_not_special) { diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 9a0cd2fe..0944040c 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -578,6 +578,42 @@ int AOApplication::get_sfx_delay(QString p_char, int p_emote) else return f_result.toInt(); } +QString AOApplication::get_sfx_looping(QString p_char, QString p_sfx) +{ + QString f_result = read_char_ini(p_char, p_sfx, "SoundL"); + + if (f_result == "") + return "0"; + else return f_result; +} + +QString AOApplication::get_sfx_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("_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_flash_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_text_delay(QString p_char, QString p_emote) { QString f_result = read_char_ini(p_char, p_emote, "TextDelay"); -- cgit From e94640b3493700a266619388d75dac5e56b3189a Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 15 Sep 2019 17:44:47 +0300 Subject: Looping SFX system - Defined this way: [SoundL] sfx-roar = 1 --- include/aoapplication.h | 3 ++ include/aosfxplayer.h | 13 ++++++--- src/aocharmovie.cpp | 14 +++++++++ src/aosfxplayer.cpp | 70 +++++++++++++++++++++++++++++++++++++++------ src/courtroom.cpp | 5 +++- src/text_file_functions.cpp | 6 ++++ 6 files changed, 97 insertions(+), 14 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 8164e166..88855968 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -151,6 +151,9 @@ public: //Returns true if blank blips is enabled in config.ini and false otherwise bool get_blank_blip(); + //Returns true if looping sound effects are enabled in the config.ini + bool get_looping_sfx(); + //Returns true if stop music on objection is enabled in the config.ini bool objection_stop_music(); diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h index 19d4bdf3..112e3ec6 100644 --- a/include/aosfxplayer.h +++ b/include/aosfxplayer.h @@ -18,19 +18,24 @@ class AOSfxPlayer public: AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app); - void play(QString p_sfx, QString p_char = "", QString shout = ""); - void stop(); + void clear(); + void loop_clear(); + void play(QString p_sfx, QString p_char = "", QString shout = "", int channel=-1); + void stop(int channel=-1); void set_volume(qreal p_volume); - + void set_looping(bool toggle, int channel=-1); + int m_channel = 0; private: QWidget *m_parent; AOApplication *ao_app; qreal m_volume = 0; + bool m_looping = true; void set_volume_internal(qreal p_volume); #if defined(BASSAUDIO) - HSTREAM m_stream; + const int m_channelmax = 5; + HSTREAM m_stream_list[5]; #elif defined(QTAUDIO) QSoundEffect m_sfx; #endif diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index efe24735..d67cf98e 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -67,26 +67,34 @@ void AOCharMovie::load_image(QString p_char, QString p_emote, QString emote_pref movie_effects.resize(max_frames); for (int e_frame = 0; e_frame < max_frames; ++e_frame) { +#ifdef DEBUG_CHARMOVIE qDebug() << p_char << p_emote << e_frame; +#endif QString effect = ao_app->get_screenshake_frame(p_char, emote_prefix + p_emote, e_frame); if (effect != "") { movie_effects[e_frame].append("shake"); +#ifdef DEBUG_CHARMOVIE qDebug() << e_frame << "shake"; +#endif } effect = ao_app->get_flash_frame(p_char, emote_prefix + p_emote, e_frame); if (effect != "") { movie_effects[e_frame].append("flash"); +#ifdef DEBUG_CHARMOVIE qDebug() << e_frame << "flash"; +#endif } effect = ao_app->get_sfx_frame(p_char, emote_prefix + p_emote, e_frame); if (effect != "") { movie_effects[e_frame].append("sfx^"+effect); +#ifdef DEBUG_CHARMOVIE qDebug() << e_frame << effect; +#endif } } #ifdef DEBUG_CHARMOVIE @@ -138,20 +146,26 @@ void AOCharMovie::play_frame_effect(int frame) if(effect == "shake") { shake(); +#ifdef DEBUG_CHARMOVIE qDebug() << "Attempting to play shake on frame" << frame; +#endif } if(effect == "flash") { flash(); +#ifdef DEBUG_CHARMOVIE qDebug() << "Attempting to play flash on frame" << frame; +#endif } if(effect.startsWith("sfx^")) { QString sfx = effect.section("^", 1); play_sfx(sfx); +#ifdef DEBUG_CHARMOVIE qDebug() << "Attempting to play sfx" << sfx << "on frame" << frame; +#endif } } } diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index ad8ced60..b9410c8d 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -8,9 +8,35 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) ao_app = p_ao_app; } -void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) +void AOSfxPlayer::clear() +{ + for (int n_stream = 0 ; n_stream < m_channelmax ; ++n_stream) + { + BASS_ChannelStop(m_stream_list[n_stream]); + } + set_volume_internal(m_volume); +} + +void AOSfxPlayer::loop_clear() { - BASS_ChannelStop(m_stream); + for (int n_stream = 0 ; n_stream < m_channelmax ; ++n_stream) + { + if((BASS_ChannelFlags(m_stream_list[n_stream], 0, 0)&BASS_SAMPLE_LOOP)) + BASS_ChannelStop(m_stream_list[n_stream]); + } + set_volume_internal(m_volume); +} + +void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, int channel) +{ + if (channel == -1) + { + if (m_stream_list[channel] != NULL) + m_channel = (m_channel + 1) % m_channelmax; + channel = m_channel; + } + + BASS_ChannelStop(m_stream_list[channel]); QString misc_path = ""; QString char_path = ""; @@ -30,18 +56,22 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) else f_path = sound_path; - m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + m_stream_list[channel] = 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); + BASS_ChannelSetDevice(m_stream_list[m_channel], BASS_GetDevice()); + BASS_ChannelPlay(m_stream_list[m_channel], false); } -void AOSfxPlayer::stop() +void AOSfxPlayer::stop(int channel) { - BASS_ChannelStop(m_stream); + if (channel == -1) + { + channel = m_channel; + } + BASS_ChannelStop(m_stream_list[channel]); } void AOSfxPlayer::set_volume(qreal p_value) @@ -52,8 +82,30 @@ 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 = static_cast(p_value); + for (int n_stream = 0 ; n_stream < m_channelmax ; ++n_stream) + { + BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); + } +} + +void AOSfxPlayer::set_looping(bool toggle, int channel) +{ + if (channel == -1) + { + channel = m_channel; + } + m_looping = toggle; + if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) + { + if (m_looping == false) + BASS_ChannelFlags(m_stream_list[channel], 0, BASS_SAMPLE_LOOP); // remove the LOOP flag + } + else + { + if (m_looping == true) + BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag + } } #elif defined(QTAUDIO) //Using Qt's QSoundEffect class AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 30921d84..2aa82b52 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1425,7 +1425,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) default: qDebug() << "W: Logic error in objection switch statement!"; } - + sfx_player->clear(); //Objection played! Cut all sfx. int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); if (emote_mod == 0) @@ -1444,6 +1444,8 @@ void Courtroom::handle_chatmessage_2() { ui_vp_speedlines->stop(); ui_vp_player_char->stop(); + //Clear all looping sfx to prevent obnoxiousness + sfx_player->loop_clear(); if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) { @@ -2470,6 +2472,7 @@ void Courtroom::play_sfx() return; sfx_player->play(ao_app->get_sfx_suffix(sfx_name)); + sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name)!="0"); } void Courtroom::set_scene() diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 0944040c..3d557c64 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -638,6 +638,12 @@ bool AOApplication::get_blank_blip() return result.startsWith("true"); } +bool AOApplication::get_looping_sfx() +{ + QString result = configini->value("looping_sfx", "true").value(); + return result.startsWith("true"); +} + bool AOApplication::objection_stop_music() { QString result = configini->value("objection_stop_music", "false").value(); -- cgit From 661ec87646fe57a0081d49e428267b0dfe3f0d65 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 15 Sep 2019 20:02:24 +0300 Subject: Implement networking for frame-specific effects data sending/parsing if the server supports it Reorganize charmovie.h a bit and make some functions private Add a new helper function "read_char_ini_tag" which returns a qstringlist of all key=value strings associated with the tag --- include/aoapplication.h | 3 ++ include/aocharmovie.h | 41 ++++++++++++++-------- src/aocharmovie.cpp | 83 ++++++++++++++++++++++++++++++++++----------- src/courtroom.cpp | 71 +++++++++++++++++++------------------- src/text_file_functions.cpp | 16 +++++++++ 5 files changed, 143 insertions(+), 71 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 88855968..eb12b0c1 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -232,6 +232,9 @@ public: //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 a QStringList of all key=value definitions on a given tag. + QStringList read_char_ini_tag(QString p_char, QString target_tag); + //Returns the side of the p_char character from that characters ini file QString get_char_side(QString p_char); diff --git a/include/aocharmovie.h b/include/aocharmovie.h index 5eaafaf6..d066a399 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -17,12 +17,6 @@ class AOCharMovie : public QLabel public: AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app); - //Set the movie's image to provided paths, preparing for playback. - void load_image(QString p_char, QString p_emote, QString emote_prefix); - - //Start playback of the movie (if animated). - void play(); - //Play a hat.gif - style preanimation void play_pre(QString p_char, QString p_emote, int duration); @@ -32,15 +26,6 @@ public: //Play an (a)normal.gif - style animation (not talking) void play_idle(QString p_char, QString p_emote); - //Play a frame-specific effect, if there's any defined for that specific frame. - void play_frame_effect(int frame); - - //Retreive a pixmap adjused for mirroring/aspect ratio shenanigans from a provided QImage - QPixmap get_pixmap(QImage image); - - //Set the movie's frame to provided pixmap - void set_frame(QPixmap f_pixmap); - //Stop the movie, clearing the image void stop(); @@ -59,6 +44,8 @@ public: //Return the frame delay adjusted for speed int get_frame_delay(int delay); + QStringList network_strings; + private: AOApplication *ao_app; @@ -75,6 +62,9 @@ private: QString last_path; QImageReader *m_reader = new QImageReader(); + QString m_char; + QString m_emote; + QElapsedTimer actual_time; const int time_mod = 60; @@ -90,6 +80,27 @@ private: bool m_flipped = false; bool play_once = true; + //Set the movie's image to provided paths, preparing for playback. + void load_image(QString p_char, QString p_emote, QString emote_prefix); + + //Start playback of the movie (if animated). + void play(); + + //Play a frame-specific effect, if there's any defined for that specific frame. + void play_frame_effect(int frame); + + //Retreive a pixmap adjused for mirroring/aspect ratio shenanigans from a provided QImage + QPixmap get_pixmap(QImage image); + + //Set the movie's frame to provided pixmap + void set_frame(QPixmap f_pixmap); + + //Initialize the frame-specific effects from the char.ini + void load_effects(); + + //Initialize the frame-specific effects from the provided network_strings, this is only initialized if network_strings has size more than 0. + void load_network_effects(); + signals: void done(); void shake(); diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index d67cf98e..34c6c813 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -64,44 +64,89 @@ void AOCharMovie::load_image(QString p_char, QString p_emote, QString emote_pref movie_delays.append(f_delay); } + m_char = p_char; + m_emote = emote_prefix + p_emote; + + if (network_strings.size() > 0) //our FX overwritten by networked ones + this->load_network_effects(); + else //Use default ini FX + this->load_effects(); +#ifdef DEBUG_CHARMOVIE + qDebug() << max_frames << "Setting image to " << emote_path << "Time taken to process image:" << actual_time.elapsed(); + + actual_time.restart(); +#endif +} + +void AOCharMovie::load_effects() +{ + movie_effects.clear(); movie_effects.resize(max_frames); for (int e_frame = 0; e_frame < max_frames; ++e_frame) { -#ifdef DEBUG_CHARMOVIE - qDebug() << p_char << p_emote << e_frame; -#endif - QString effect = ao_app->get_screenshake_frame(p_char, emote_prefix + p_emote, e_frame); + QString effect = ao_app->get_screenshake_frame(m_char, m_emote, e_frame); if (effect != "") { movie_effects[e_frame].append("shake"); -#ifdef DEBUG_CHARMOVIE - qDebug() << e_frame << "shake"; -#endif } - effect = ao_app->get_flash_frame(p_char, emote_prefix + p_emote, e_frame); + effect = ao_app->get_flash_frame(m_char, m_emote, e_frame); if (effect != "") { movie_effects[e_frame].append("flash"); -#ifdef DEBUG_CHARMOVIE - qDebug() << e_frame << "flash"; -#endif } - effect = ao_app->get_sfx_frame(p_char, emote_prefix + p_emote, e_frame); + effect = ao_app->get_sfx_frame(m_char, m_emote, e_frame); if (effect != "") { movie_effects[e_frame].append("sfx^"+effect); -#ifdef DEBUG_CHARMOVIE - qDebug() << e_frame << effect; -#endif } } -#ifdef DEBUG_CHARMOVIE - qDebug() << max_frames << "Setting image to " << emote_path << "Time taken to process image:" << actual_time.elapsed(); +} - actual_time.restart(); -#endif +void AOCharMovie::load_network_effects() +{ + movie_effects.clear(); + movie_effects.resize(max_frames); + //Order is important!!! + QStringList effects_list = {"shake", "flash", "sfx^"}; + + //Determines which list is smaller - effects_list or network_strings - and uses it as basis for the loop. + //This way, incomplete network_strings would still be parsed, and excess/unaccounted for networked information is omitted. + int effects_size = qMin(effects_list.size(), network_strings.size()); + + for (int i = 0; i < effects_size; ++i) + { + QString netstring = network_strings.at(i); + QStringList emote_splits = netstring.split("^"); + foreach (QString emote, emote_splits) + { + QStringList parsed = emote.split("|"); + if (parsed.size() <= 0 || parsed.at(0) != m_emote) + continue; + foreach (QString frame_data, parsed) + { + QStringList frame_split = frame_data.split("="); + if (frame_split.size() <= 1) //We might still be hanging at the emote itself (entry 0). + continue; + int f_frame = frame_split.at(0).toInt(); + if (f_frame >= max_frames) + { + qDebug() << "Warning: out of bounds" << effects_list[i] << "frame" << f_frame << "out of" << max_frames << "for" << m_char << m_emote; + continue; + } + QString f_data = frame_split.at(1); + if (f_data != "") + { + QString effect = effects_list[i]; + if (effect == "sfx^") //Currently the only frame result that feeds us data, let's yank it in. + effect += f_data; + qDebug() << effect << f_data << "frame" << f_frame << "for" << m_char << m_emote; + movie_effects[f_frame].append(effect); + } + } + } + } } void AOCharMovie::play() diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 2aa82b52..2e4fbb21 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1267,41 +1267,31 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(QString::number(screenshake_state)); qDebug() << "Are we screen shaking this one? " << screenshake_state; - QString frame_screenshake = ""; - QString frame_realization = ""; - QString frame_sfx = ""; - - QString preemote_sfx = ao_app->get_pre_emote(current_char, current_emote) + "^"; - QString preemote_shake = ao_app->get_pre_emote(current_char, current_emote) + "^"; - QString preemote_flash = ao_app->get_pre_emote(current_char, current_emote) + "^"; - - QString talkemote_sfx = "(b)" + ao_app->get_emote(current_char, current_emote) + "^"; - QString talkemote_shake = "(b)" + ao_app->get_emote(current_char, current_emote) + "^"; - QString talkemote_flash = "(b)" + ao_app->get_emote(current_char, current_emote) + "^"; - - QString idleemote_sfx = "(a)" + ao_app->get_emote(current_char, current_emote) + "^"; - QString idleemote_shake = "(a)" + ao_app->get_emote(current_char, current_emote) + "^"; - QString idleemote_flash = "(a)" + ao_app->get_emote(current_char, current_emote) + "^"; - - 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; - qDebug() << "Final strings:"; - qDebug() << frame_screenshake; - qDebug() << frame_realization; - qDebug() << frame_sfx; - - packet_contents.append(frame_screenshake); - packet_contents.append(frame_realization); - packet_contents.append(frame_sfx); + QString pre_emote = ao_app->get_pre_emote(current_char, current_emote); + QString emote = ao_app->get_emote(current_char, current_emote); + QStringList emotes_to_check = {pre_emote, "(b)" + emote, "(a)" + emote}; + QStringList effects_to_check = {"_FrameScreenshake", "_FrameRealization", "_FrameSFX"}; + + foreach (QString f_effect, effects_to_check) + { + QString packet; + foreach (QString f_emote, emotes_to_check) + { + packet += f_emote; + QString sfx_frames = ao_app->read_char_ini_tag(current_char, f_emote.append(f_effect)).join("|"); + if (sfx_frames != "") + packet += "|" + sfx_frames; + packet += "^"; + } + qDebug() << f_effect << "packet" << packet; + packet_contents.append(packet); + } + + //"roar|thing=thong^(b)roar^(a)roar^" + +// packet_contents.append(frame_screenshake); +// packet_contents.append(frame_realization); +// packet_contents.append(frame_sfx); } ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } @@ -1447,6 +1437,15 @@ void Courtroom::handle_chatmessage_2() //Clear all looping sfx to prevent obnoxiousness sfx_player->loop_clear(); + if (!m_chatmessage[FRAME_SFX].isEmpty()) + { + //ORDER IS IMPORTANT!! + QStringList netstrings = {m_chatmessage[FRAME_SCREENSHAKE], m_chatmessage[FRAME_REALIZATION], m_chatmessage[FRAME_SFX]}; + ui_vp_player_char->network_strings = netstrings; + } + else + ui_vp_player_char->network_strings.clear(); + if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) { QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; @@ -1673,11 +1672,9 @@ void Courtroom::do_screenshake() ui_vp_chatbox }; - int i = 0; //I would prefer if this was its own "shake" function to be honest. foreach (QWidget* ui_element, affected_list) { - qDebug() << ++i; QPropertyAnimation *screenshake_animation = new QPropertyAnimation(ui_element, "pos", this); QPoint pos_default = QPoint(ui_element->x(), ui_element->y()); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 3d557c64..4c0885e1 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -406,6 +406,22 @@ QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QStr return value; } +//returns all the values of target_tag +QStringList AOApplication::read_char_ini_tag(QString p_char, QString target_tag) +{ + QStringList r_values; + QSettings settings(get_character_path(p_char, "char.ini"), QSettings::IniFormat); + settings.beginGroup(target_tag); + QStringList keys = settings.allKeys(); + foreach (QString key, keys) + { + QString value = settings.value(key).toString(); + r_values << key + "=" + value; + } + settings.endGroup(); + return r_values; +} + QString AOApplication::get_char_name(QString p_char) { QString f_result = read_char_ini(p_char, "name", "Options"); -- cgit From ba28c244aa7591892abb2699cdc547ec431543a7 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 15 Sep 2019 21:15:40 +0300 Subject: Add an opton to enable/disable screenshake + flashing Fix moderation guard button not doing what it's supposed to (enable/disable modcalls) Fix moderation guard button appearing with failed logins Fix the option to toggle looping sfx not doing anything --- include/aoapplication.h | 4 ++++ include/aooptionsdialog.h | 5 +++++ src/courtroom.cpp | 26 +++++++++++++++++--------- src/text_file_functions.cpp | 6 ++++++ 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index eb12b0c1..6bc86e6d 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -170,6 +170,10 @@ public: // 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_shake_flash_enabled(); + // Returns the value of the maximum amount of lines the IC chatlog // may contain, from config.ini. int get_max_log_size(); diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 34ae2b77..0deb0a82 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -64,6 +64,9 @@ private: QLabel *ui_language_label; QComboBox *ui_language_combobox; + QLabel *ui_epilepsy_lbl; + QCheckBox *ui_epilepsy_cb; + QWidget *ui_callwords_tab; QWidget *ui_callwords_widget; QVBoxLayout *ui_callwords_layout; @@ -88,6 +91,8 @@ private: QLabel *ui_bliprate_lbl; QCheckBox *ui_blank_blips_cb; QLabel *ui_blank_blips_lbl; + QLabel *ui_loopsfx_lbl; + QCheckBox *ui_loopsfx_cb; QLabel *ui_objectmusic_lbl; QCheckBox *ui_objectmusic_cb; QDialogButtonBox *ui_settings_buttons; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 2e4fbb21..d7d1ff52 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1081,6 +1081,11 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QSt 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", "You were granted the Disable Modcalls button.", "1"); + } ui_server_chatlog->append_chatmessage(p_name, p_message, colour); } @@ -1659,6 +1664,9 @@ void Courtroom::handle_chatmessage_2() void Courtroom::do_screenshake() { + if(!ao_app->is_shake_flash_enabled()) + return; + //This way, the animation is reset in such a way that last played screenshake would return to its "final frame" properly. //This properly resets all UI elements without having to bother keeping track of "origin" positions. //Works great wit the chat text being detached from the chat box! @@ -1702,13 +1710,17 @@ void Courtroom::do_screenshake() void Courtroom::do_flash() { + if(!ao_app->is_shake_flash_enabled()) + return; + ui_vp_realization->play("realizationflash", "", "", 60); } void Courtroom::play_char_sfx(QString sfx_name) { sfx_player->play(ao_app->get_sfx_suffix(sfx_name)); - sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name)!="0"); + if(ao_app->get_looping_sfx()) + sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name)!="0"); } void Courtroom::handle_chatmessage_3() @@ -2451,7 +2463,7 @@ void Courtroom::chat_tick() // If we had a formatting char, we shouldn't wait so long again, as it won't appear! if (formatting_char) { - chat_tick_timer->start(1); + chat_tick_timer->start(0); } else { @@ -2469,7 +2481,8 @@ void Courtroom::play_sfx() return; sfx_player->play(ao_app->get_sfx_suffix(sfx_name)); - sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name)!="0"); + if(ao_app->get_looping_sfx()) + sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name)!="0"); } void Courtroom::set_scene() @@ -2765,7 +2778,7 @@ void Courtroom::toggle_judge_buttons(bool is_on) void Courtroom::mod_called(QString p_ip) { ui_server_chatlog->append(p_ip); - if (ui_guard->isChecked()) + if (!ui_guard->isChecked()) { modcall_player->play(ao_app->get_sfx("mod_call")); ao_app->alert(this); @@ -2807,11 +2820,6 @@ void Courtroom::on_ooc_return_pressed() toggle_judge_buttons(false); } } - else if (ooc_message.startsWith("/login")) - { - ui_guard->show(); - append_server_chatmessage("CLIENT", tr("You were granted the Guard button."), "1"); - } else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended) { //ui_text_color->addItem("Rainbow"); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 4c0885e1..750df012 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -672,6 +672,12 @@ bool AOApplication::is_discord_enabled() return result.startsWith("true"); } +bool AOApplication::is_shake_flash_enabled() +{ + QString result = configini->value("shakeandflash", "true").value(); + return result.startsWith("true"); +} + bool AOApplication::get_casing_enabled() { QString result = configini->value("casing_enabled", "false").value(); -- cgit From 6afce056618d17aa770b6aa51eea477468aad8ab Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 15 Sep 2019 21:17:12 +0300 Subject: Adjust options dialog to use a "row" variable for adding new elements easier Add the "allow shake/flash" button Add the "enable looping SFX" button --- src/aooptionsdialog.cpp | 170 +++++++++++++++++++++++++++++++----------------- 1 file changed, 110 insertions(+), 60 deletions(-) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index a918c0c9..259f43e7 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -46,14 +46,15 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); ui_gameplay_form->setContentsMargins(0, 0, 0, 0); + int row = 0; + ui_theme_label = new QLabel(ui_form_layout_widget); ui_theme_label->setText(tr("Theme:")); ui_theme_label->setToolTip(tr("Sets the theme used in-game. If the new theme changes " "the lobby's look as well, you'll need to reload the " "lobby for the changes to take effect, such as by joining " "a server and leaving it.")); - ui_gameplay_form->setWidget(0, QFormLayout::LabelRole, ui_theme_label); - + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_theme_label); ui_theme_combobox = new QComboBox(ui_form_layout_widget); // Fill the combobox with the names of the themes. @@ -67,14 +68,15 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_theme_combobox->setCurrentIndex(ui_theme_combobox->count()-1); } - ui_gameplay_form->setWidget(0, QFormLayout::FieldRole, ui_theme_combobox); + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_theme_combobox); ui_theme_log_divider = new QFrame(ui_form_layout_widget); ui_theme_log_divider->setMidLineWidth(0); ui_theme_log_divider->setFrameShape(QFrame::HLine); ui_theme_log_divider->setFrameShadow(QFrame::Sunken); - ui_gameplay_form->setWidget(1, QFormLayout::FieldRole, ui_theme_log_divider); + row += 1; + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_theme_log_divider); ui_downwards_lbl = new QLabel(ui_form_layout_widget); ui_downwards_lbl->setText(tr("Log goes downwards:")); @@ -82,44 +84,48 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi "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); + row += 1; + ui_gameplay_form->setWidget(row, 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_gameplay_form->setWidget(row, 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); + row += 1; + ui_gameplay_form->setWidget(row, 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_gameplay_form->setWidget(row, 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); + row += 1; + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_names_divider); ui_username_lbl = new QLabel(ui_form_layout_widget); ui_username_lbl->setText(tr("Default username:")); ui_username_lbl->setToolTip(tr("Your OOC name will be automatically set to this value " "when you join a server.")); - ui_gameplay_form->setWidget(5, QFormLayout::LabelRole, ui_username_lbl); + row += 1; + ui_gameplay_form->setWidget(row, 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(row, QFormLayout::FieldRole, ui_username_textbox); ui_showname_lbl = new QLabel(ui_form_layout_widget); ui_showname_lbl->setText(tr("Custom shownames:")); @@ -127,31 +133,34 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi "tickbox, which in turn determines whether the client should " "display custom in-character names.")); - ui_gameplay_form->setWidget(6, QFormLayout::LabelRole, ui_showname_lbl); + row += 1; + ui_gameplay_form->setWidget(row, 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(row, 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); + row += 1; + ui_gameplay_form->setWidget(row, 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(8, QFormLayout::LabelRole, ui_ms_lbl); + row += 1; + ui_gameplay_form->setWidget(row, 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(row, QFormLayout::FieldRole, ui_ms_textbox); ui_discord_lbl = new QLabel(ui_form_layout_widget); ui_discord_lbl->setText(tr("Discord:")); @@ -159,17 +168,19 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi "what character are you playing, and how long you have " "been playing for.")); - ui_gameplay_form->setWidget(9, QFormLayout::LabelRole, ui_discord_lbl); + row += 1; + ui_gameplay_form->setWidget(row, 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(row, QFormLayout::FieldRole, ui_discord_cb); + row += 1; 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(10, QFormLayout::LabelRole, ui_language_label); + ui_gameplay_form->setWidget(row, 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"); @@ -179,7 +190,19 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_language_combobox->addItem("es - Español"); ui_language_combobox->addItem("jp - 日本語"); ui_language_combobox->addItem("ru - Русский"); - ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_language_combobox); + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_language_combobox); + + 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.")); + + row += 1; + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_epilepsy_lbl); + + ui_epilepsy_cb = new QCheckBox(ui_form_layout_widget); + ui_epilepsy_cb->setChecked(ao_app->is_shake_flash_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_epilepsy_cb); // Here we start the callwords tab. ui_callwords_tab = new QWidget(); @@ -223,12 +246,13 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi 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); + row = 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_layout->setWidget(row, QFormLayout::LabelRole, ui_audio_device_lbl); ui_audio_device_combobox = new QComboBox(ui_audio_widget); @@ -256,65 +280,70 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi 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_layout->setWidget(row, 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); + row += 1; + ui_audio_layout->setWidget(row, 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); + row += 1; + ui_audio_layout->setWidget(row, 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_audio_layout->setWidget(2, QFormLayout::FieldRole, ui_music_volume_spinbox); + ui_audio_layout->setWidget(row, 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); + row += 1; + ui_audio_layout->setWidget(row, 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_audio_layout->setWidget(row, 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); + row += 1; + ui_audio_layout->setWidget(row, 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_audio_layout->setWidget(4, QFormLayout::FieldRole, ui_blips_volume_spinbox); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_blips_volume_spinbox); ui_volume_blip_divider = new QFrame(ui_audio_widget); ui_volume_blip_divider->setFrameShape(QFrame::HLine); ui_volume_blip_divider->setFrameShadow(QFrame::Sunken); - ui_audio_layout->setWidget(5, QFormLayout::FieldRole, ui_volume_blip_divider); + row += 1; + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_volume_blip_divider); ui_bliprate_lbl = new QLabel(ui_audio_widget); ui_bliprate_lbl->setText(tr("Blip rate:")); ui_bliprate_lbl->setToolTip(tr("Sets the delay between playing the blip sounds.")); - ui_audio_layout->setWidget(6, QFormLayout::LabelRole, ui_bliprate_lbl); + row += 1; + ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_bliprate_lbl); ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate()); @@ -322,30 +351,44 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_bliprate_spinbox->setToolTip(tr("Play a blip sound \"once per every X symbols\", where " "X is the blip rate.")); - ui_audio_layout->setWidget(6, QFormLayout::FieldRole, ui_bliprate_spinbox); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_bliprate_spinbox); ui_blank_blips_lbl = new QLabel(ui_audio_widget); ui_blank_blips_lbl->setText(tr("Blank blips:")); ui_blank_blips_lbl->setToolTip(tr("If true, the game will play a blip sound even " "when a space is 'being said'.")); - ui_audio_layout->setWidget(7, QFormLayout::LabelRole, ui_blank_blips_lbl); + row += 1; + ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_blank_blips_lbl); ui_blank_blips_cb = new QCheckBox(ui_audio_widget); ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip()); - ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_blank_blips_cb); + + 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.")); + + row += 1; + ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_loopsfx_lbl); + + ui_loopsfx_cb = new QCheckBox(ui_audio_widget); + ui_loopsfx_cb->setChecked(p_ao_app->get_looping_sfx()); + + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_loopsfx_cb); 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_objectmusic_lbl->setToolTip(tr("If true, AO2 will stop the music for you when you or someone else does 'Objection!'.")); - ui_audio_layout->setWidget(9, QFormLayout::LabelRole, ui_objectmusic_lbl); + row += 1; + ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_objectmusic_lbl); ui_objectmusic_cb = new QCheckBox(ui_audio_widget); ui_objectmusic_cb->setChecked(p_ao_app->objection_stop_music()); - ui_audio_layout->setWidget(9, QFormLayout::FieldRole, ui_objectmusic_cb); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_objectmusic_cb); // The casing tab! ui_casing_tab = new QWidget(); @@ -358,6 +401,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi 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); + row = 0; // -- SERVER SUPPORTS CASING @@ -368,119 +412,127 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_casing_supported_lbl->setText(tr("This server does not support case alerts.")); ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory.")); - ui_casing_layout->setWidget(0, QFormLayout::FieldRole, ui_casing_supported_lbl); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_supported_lbl); // -- CASE ANNOUNCEMENTS + row += 1; ui_casing_enabled_lbl = new QLabel(ui_casing_widget); ui_casing_enabled_lbl->setText(tr("Casing:")); ui_casing_enabled_lbl->setToolTip(tr("If checked, you will get alerts about case " "announcements.")); - ui_casing_layout->setWidget(1, QFormLayout::LabelRole, ui_casing_enabled_lbl); + ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_enabled_lbl); ui_casing_enabled_cb = new QCheckBox(ui_casing_widget); ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled()); - ui_casing_layout->setWidget(1, QFormLayout::FieldRole, ui_casing_enabled_cb); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_enabled_cb); // -- DEFENSE ANNOUNCEMENTS + row += 1; ui_casing_def_lbl = new QLabel(ui_casing_widget); ui_casing_def_lbl->setText(tr("Defense:")); ui_casing_def_lbl->setToolTip(tr("If checked, you will get alerts about case " "announcements if a defense spot is open.")); - ui_casing_layout->setWidget(2, QFormLayout::LabelRole, ui_casing_def_lbl); + ui_casing_layout->setWidget(row, 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); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_def_cb); // -- PROSECUTOR ANNOUNCEMENTS + row += 1; ui_casing_pro_lbl = new QLabel(ui_casing_widget); ui_casing_pro_lbl->setText(tr("Prosecution:")); ui_casing_pro_lbl->setToolTip(tr("If checked, you will get alerts about case " "announcements if a prosecutor spot is open.")); - ui_casing_layout->setWidget(3, QFormLayout::LabelRole, ui_casing_pro_lbl); + ui_casing_layout->setWidget(row, 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); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_pro_cb); // -- JUDGE ANNOUNCEMENTS + row += 1; ui_casing_jud_lbl = new QLabel(ui_casing_widget); ui_casing_jud_lbl->setText(tr("Judge:")); ui_casing_jud_lbl->setToolTip(tr("If checked, you will get alerts about case " "announcements if the judge spot is open.")); - ui_casing_layout->setWidget(4, QFormLayout::LabelRole, ui_casing_jud_lbl); + ui_casing_layout->setWidget(row, 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); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_jud_cb); // -- JUROR ANNOUNCEMENTS + row += 1; ui_casing_jur_lbl = new QLabel(ui_casing_widget); ui_casing_jur_lbl->setText(tr("Juror:")); ui_casing_jur_lbl->setToolTip(tr("If checked, you will get alerts about case " "announcements if a juror spot is open.")); - ui_casing_layout->setWidget(5, QFormLayout::LabelRole, ui_casing_jur_lbl); + ui_casing_layout->setWidget(row, 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); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_jur_cb); // -- STENO ANNOUNCEMENTS + row += 1; ui_casing_steno_lbl = new QLabel(ui_casing_widget); ui_casing_steno_lbl->setText(tr("Stenographer:")); ui_casing_steno_lbl->setToolTip(tr("If checked, you will get alerts about case " "announcements if a stenographer spot is open.")); - ui_casing_layout->setWidget(6, QFormLayout::LabelRole, ui_casing_steno_lbl); + ui_casing_layout->setWidget(row, 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); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_steno_cb); // -- CM ANNOUNCEMENTS + row += 1; ui_casing_cm_lbl = new QLabel(ui_casing_widget); ui_casing_cm_lbl->setText(tr("CM:")); ui_casing_cm_lbl->setToolTip(tr("If checked, you will appear amongst the potential " "CMs on the server.")); - ui_casing_layout->setWidget(7, QFormLayout::LabelRole, ui_casing_cm_lbl); + ui_casing_layout->setWidget(row, 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_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_cm_cb); // -- CM CASES ANNOUNCEMENTS + row += 1; ui_casing_cm_cases_lbl = new QLabel(ui_casing_widget); ui_casing_cm_cases_lbl->setText(tr("Hosting cases:")); ui_casing_cm_cases_lbl->setToolTip(tr("If you're a CM, enter what cases you are " "willing to host.")); - ui_casing_layout->setWidget(8, QFormLayout::LabelRole, ui_casing_cm_cases_lbl); + ui_casing_layout->setWidget(row, 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(8, QFormLayout::FieldRole, ui_casing_cm_cases_textbox); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_cm_cases_textbox); // When we're done, we should continue the updates! setUpdatesEnabled(true); @@ -499,14 +551,11 @@ void AOOptionsDialog::save_pressed() configini->setValue("master", ui_ms_textbox->text()); configini->setValue("discord", ui_discord_cb->isChecked()); configini->setValue("language", ui_language_combobox->currentText().left(2)); + configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked()); QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); - if (!callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) - { - // Nevermind! - } - else + if (callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) { QTextStream out(callwordsini); out << ui_callwords_textbox->toPlainText(); @@ -519,6 +568,7 @@ void AOOptionsDialog::save_pressed() 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("objection_stop_music", ui_objectmusic_cb->isChecked()); configini->setValue("casing_enabled", ui_casing_enabled_cb->isChecked()); -- cgit From 1b36be9dbc0cc665ddb69e1e1ee70267612b5d6c Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 15 Sep 2019 21:39:39 +0300 Subject: Add an option for networking frame-specific effects I'm starting to realize the options menu/system needs a complete overhaul at this point. (Auto-generating options menu, anyone?) --- include/aoapplication.h | 4 ++++ include/aooptionsdialog.h | 2 ++ src/aooptionsdialog.cpp | 51 ++++++++++++++++++++++++++++----------------- src/courtroom.cpp | 11 ++++++---- src/text_file_functions.cpp | 6 ++++++ 5 files changed, 51 insertions(+), 23 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 6bc86e6d..e63ab8e7 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -174,6 +174,10 @@ public: // from the config.ini. bool is_shake_flash_enabled(); + // Returns the value of whether frame-specific effects defined in char.ini should be sent/received over the network. + // from the config.ini. + bool is_frame_network_enabled(); + // Returns the value of the maximum amount of lines the IC chatlog // may contain, from config.ini. int get_max_log_size(); diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 0deb0a82..03226619 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -66,6 +66,8 @@ private: QLabel *ui_epilepsy_lbl; QCheckBox *ui_epilepsy_cb; + QLabel *ui_framenetwork_lbl; + QCheckBox *ui_framenetwork_cb; QWidget *ui_callwords_tab; QWidget *ui_callwords_widget; diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 259f43e7..7c524022 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -70,21 +70,21 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_theme_combobox); + row += 1; 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); - row += 1; ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_theme_log_divider); + row += 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.")); - row += 1; ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_downwards_lbl); ui_downwards_cb = new QCheckBox(ui_form_layout_widget); @@ -92,12 +92,12 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_downwards_cb); + row += 1; 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'.")); - row += 1; ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_length_lbl); ui_length_spinbox = new QSpinBox(ui_form_layout_widget); @@ -106,19 +106,19 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_length_spinbox); + row += 1; ui_log_names_divider = new QFrame(ui_form_layout_widget); ui_log_names_divider->setFrameShape(QFrame::HLine); ui_log_names_divider->setFrameShadow(QFrame::Sunken); - row += 1; ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_names_divider); + row += 1; 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.")); - row += 1; ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_username_lbl); ui_username_textbox = new QLineEdit(ui_form_layout_widget); @@ -127,13 +127,13 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_username_textbox); + row += 1; 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.")); - row += 1; ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_showname_lbl); ui_showname_cb = new QCheckBox(ui_form_layout_widget); @@ -141,19 +141,19 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_showname_cb); + row += 1; ui_net_divider = new QFrame(ui_form_layout_widget); ui_net_divider->setFrameShape(QFrame::HLine); ui_net_divider->setFrameShadow(QFrame::Sunken); - row += 1; ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_net_divider); + row += 1; 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.")); - row += 1; ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_ms_lbl); QSettings* configini = ao_app->configini; @@ -162,13 +162,13 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_ms_textbox); + row += 1; 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.")); - row += 1; ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_discord_lbl); ui_discord_cb = new QCheckBox(ui_form_layout_widget); @@ -192,11 +192,11 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_language_combobox->addItem("ru - Русский"); ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_language_combobox); + row += 1; 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.")); - row += 1; ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_epilepsy_lbl); ui_epilepsy_cb = new QCheckBox(ui_form_layout_widget); @@ -204,6 +204,18 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_epilepsy_cb); + row += 1; + ui_framenetwork_lbl = new QLabel(ui_form_layout_widget); + ui_framenetwork_lbl->setText(tr("Network Frame Effects:")); + ui_framenetwork_lbl->setToolTip(tr("Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_framenetwork_lbl); + + ui_framenetwork_cb = new QCheckBox(ui_form_layout_widget); + ui_framenetwork_cb->setChecked(ao_app->is_shake_flash_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_framenetwork_cb); + // Here we start the callwords tab. ui_callwords_tab = new QWidget(); ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords")); @@ -282,18 +294,18 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi #endif ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_audio_device_combobox); + row += 1; ui_audio_volume_divider = new QFrame(ui_audio_widget); ui_audio_volume_divider->setFrameShape(QFrame::HLine); ui_audio_volume_divider->setFrameShadow(QFrame::Sunken); - row += 1; ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_audio_volume_divider); + row += 1; 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.")); - row += 1; ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_music_volume_lbl); ui_music_volume_spinbox = new QSpinBox(ui_audio_widget); @@ -303,11 +315,11 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_music_volume_spinbox); + row += 1; 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'.")); - row += 1; ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_sfx_volume_lbl); ui_sfx_volume_spinbox = new QSpinBox(ui_audio_widget); @@ -317,11 +329,11 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_sfx_volume_spinbox); + row += 1; 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.")); - row += 1; ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_blips_volume_lbl); ui_blips_volume_spinbox = new QSpinBox(ui_audio_widget); @@ -331,18 +343,18 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_blips_volume_spinbox); + row += 1; ui_volume_blip_divider = new QFrame(ui_audio_widget); ui_volume_blip_divider->setFrameShape(QFrame::HLine); ui_volume_blip_divider->setFrameShadow(QFrame::Sunken); - row += 1; ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_volume_blip_divider); + row += 1; 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.")); - row += 1; ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_bliprate_lbl); ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); @@ -353,12 +365,12 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_bliprate_spinbox); + row += 1; 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'.")); - row += 1; ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_blank_blips_lbl); ui_blank_blips_cb = new QCheckBox(ui_audio_widget); @@ -366,11 +378,11 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_blank_blips_cb); + row += 1; 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.")); - row += 1; ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_loopsfx_lbl); ui_loopsfx_cb = new QCheckBox(ui_audio_widget); @@ -378,11 +390,11 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_loopsfx_cb); + row += 1; ui_objectmusic_lbl = new QLabel(ui_audio_widget); ui_objectmusic_lbl->setText(tr("Kill Music On Objection:")); ui_objectmusic_lbl->setToolTip(tr("If true, AO2 will stop the music for you when you or someone else does 'Objection!'.")); - row += 1; ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_objectmusic_lbl); ui_objectmusic_cb = new QCheckBox(ui_audio_widget); @@ -552,6 +564,7 @@ void AOOptionsDialog::save_pressed() configini->setValue("discord", ui_discord_cb->isChecked()); configini->setValue("language", ui_language_combobox->currentText().left(2)); configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked()); + configini->setValue("framenetwork", ui_framenetwork_cb->isChecked()); QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index d7d1ff52..f54cc249 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1283,9 +1283,12 @@ void Courtroom::on_chat_return_pressed() foreach (QString f_emote, emotes_to_check) { packet += f_emote; - QString sfx_frames = ao_app->read_char_ini_tag(current_char, f_emote.append(f_effect)).join("|"); - if (sfx_frames != "") - packet += "|" + sfx_frames; + if (ao_app->is_frame_network_enabled()) + { + QString sfx_frames = ao_app->read_char_ini_tag(current_char, f_emote.append(f_effect)).join("|"); + if (sfx_frames != "") + packet += "|" + sfx_frames; + } packet += "^"; } qDebug() << f_effect << "packet" << packet; @@ -1442,7 +1445,7 @@ void Courtroom::handle_chatmessage_2() //Clear all looping sfx to prevent obnoxiousness sfx_player->loop_clear(); - if (!m_chatmessage[FRAME_SFX].isEmpty()) + if (!m_chatmessage[FRAME_SFX].isEmpty() && ao_app->is_frame_network_enabled()) { //ORDER IS IMPORTANT!! QStringList netstrings = {m_chatmessage[FRAME_SCREENSHAKE], m_chatmessage[FRAME_REALIZATION], m_chatmessage[FRAME_SFX]}; diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 750df012..d286c032 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -678,6 +678,12 @@ bool AOApplication::is_shake_flash_enabled() return result.startsWith("true"); } +bool AOApplication::is_frame_network_enabled() +{ + QString result = configini->value("framenetwork", "true").value(); + return result.startsWith("true"); +} + bool AOApplication::get_casing_enabled() { QString result = configini->value("casing_enabled", "false").value(); -- cgit From bf999f195a0be20519356644df1940cf18d905e7 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 01:16:37 +0300 Subject: Add file reading, writing and appending functions that create folders if bool is true Fix server_address not being properly created in packet distribution Create a log file when you join a server in the logs//.log and update it every time there's a new chat entry minor refactor of chatlogpiece --- include/aoapplication.h | 12 ++++++++ include/chatlogpiece.h | 4 +-- src/chatlogpiece.cpp | 15 +++++----- src/courtroom.cpp | 6 ++-- src/packet_distribution.cpp | 9 ++++-- src/text_file_functions.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 100 insertions(+), 14 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index e63ab8e7..24dc35ce 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -201,6 +201,15 @@ public: //Returns the list of words in callwords.ini QStringList get_call_words(); + //Process a file and return its text as a QString + QString read_file(QString filename); + + //Write text to file. make_dir would auto-create the directory if it doesn't exist. + bool write_to_file(QString p_text, QString p_file, bool make_dir = false); + + //Append text to the end of the file. make_dir would auto-create the directory if it doesn't exist. + bool append_to_file(QString p_text, QString p_file, bool make_dir = false); + //Appends the argument string to serverlist.txt void write_to_serverlist_txt(QString p_line); @@ -337,6 +346,9 @@ public: // Get the message for the CM for casing alerts. QString get_casing_can_host_cases(); + //The file name of the log file in base/logs. + QString log_filename; + private: const int RELEASE = 2; const int MAJOR_VERSION = 6; diff --git a/include/chatlogpiece.h b/include/chatlogpiece.h index 34c5926b..303c2351 100644 --- a/include/chatlogpiece.h +++ b/include/chatlogpiece.h @@ -14,7 +14,7 @@ public: QString get_name(); QString get_showname(); QString get_message(); - bool get_is_song(); + bool is_song(); QDateTime get_datetime(); QString get_datetime_as_string(); @@ -25,7 +25,7 @@ private: QString showname; QString message; QDateTime datetime; - bool is_song; + bool p_is_song; }; #endif // CHATLOGPIECE_H diff --git a/src/chatlogpiece.cpp b/src/chatlogpiece.cpp index 6c861f01..eb7c188a 100644 --- a/src/chatlogpiece.cpp +++ b/src/chatlogpiece.cpp @@ -5,7 +5,7 @@ chatlogpiece::chatlogpiece() name = "UNKNOWN"; showname = "UNKNOWN"; message = "UNKNOWN"; - is_song = false; + p_is_song = false; datetime = QDateTime::currentDateTime().toUTC(); } @@ -14,7 +14,7 @@ chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message name = p_name; showname = p_showname; message = p_message; - is_song = p_song; + p_is_song = p_song; datetime = QDateTime::currentDateTime().toUTC(); } @@ -23,7 +23,7 @@ chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message name = p_name; showname = p_showname; message = p_message; - is_song = p_song; + p_is_song = p_song; datetime = p_datetime.toUTC(); } @@ -47,9 +47,9 @@ QDateTime chatlogpiece::get_datetime() return datetime; } -bool chatlogpiece::get_is_song() +bool chatlogpiece::is_song() { - return is_song; + return p_is_song; } QString chatlogpiece::get_datetime_as_string() @@ -57,18 +57,17 @@ QString chatlogpiece::get_datetime_as_string() return datetime.toString(); } - QString chatlogpiece::get_full() { QString full = "["; full.append(get_datetime_as_string()); - full.append(" UTC] "); + full.append("] "); full.append(get_showname()); full.append(" ("); full.append(get_name()); full.append(")"); - if (is_song) + if (p_is_song) full.append(" has played a song: "); full.append(get_message()); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index f54cc249..433041cc 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1382,6 +1382,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false); ic_chatlog_history.append(*temp); + ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) { @@ -2689,6 +2690,7 @@ void Courtroom::handle_song(QStringList *p_contents) { chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true); ic_chatlog_history.append(*temp); + ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) { @@ -3638,14 +3640,14 @@ void Courtroom::on_showname_enable_clicked() foreach (chatlogpiece item, ic_chatlog_history) { if (ui_showname_enable->isChecked()) { - if (item.get_is_song()) + if (item.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()) + if (item.is_song()) append_ic_text(item.get_message(), item.get_name(), true); else append_ic_text(item.get_message(), item.get_name()); diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 6059edb9..72840f75 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -251,7 +251,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet) 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); + server_address = QString("%1:%2").arg(info.ip, QString::number(info.port)); + qDebug() << server_address; window_title += ": " + server_name; } } @@ -260,7 +261,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet) 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; + server_address = QString("%1:%2").arg(info.ip, QString::number(info.port)); + qDebug() << server_address; window_title += ": " + server_name; } } @@ -280,6 +282,9 @@ void AOApplication::server_packet_received(AOPacket *p_packet) send_server_packet(f_packet); + //Remove any characters not accepted in folder names for the server_name here + this->log_filename = QDateTime::currentDateTime().toUTC().toString("'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|]")) + "/'ddd MMMM yyyy hh.mm.ss t'.log'"); + this->write_to_file("Joined server " + server_name + " on address " + server_address +" on " + QDateTime::currentDateTime().toUTC().toString(), log_filename, true); QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256); hash.addData(server_address.toUtf8()); if (is_discord_enabled()) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index d286c032..ae17ac53 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -95,6 +95,74 @@ QStringList AOApplication::get_call_words() return return_value; } +QString AOApplication::read_file(QString filename) +{ + QFile f_log(filename); + + if(!f_log.open(QIODevice::ReadOnly | QIODevice::Text)) + { + qDebug() << "Couldn't open" << filename; + return ""; + } + + QTextStream in(&f_log); + QString text = in.readAll(); + f_log.close(); + return text; +} + +bool AOApplication::write_to_file(QString p_text, QString p_file, bool make_dir) +{ + QString path = QFileInfo(p_file).path(); + if(make_dir) + { + //Create the dir if it doesn't exist yet + QDir dir(path); + if (!dir.exists()) + if (!dir.mkpath(".")) + return false; + } + + QFile f_log(p_file); + if(f_log.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) + { + QTextStream out(&f_log); + + out << p_text; + + f_log.flush(); + f_log.close(); + return true; + } + return false; +} + +bool AOApplication::append_to_file(QString p_text, QString p_file, bool make_dir) +{ + QString path = QFileInfo(p_file).path(); + //Create the dir if it doesn't exist yet + if(make_dir) + { + QDir dir(path); + if (!dir.exists()) + if (!dir.mkpath(".")) + return false; + } + + QFile f_log(p_file); + if(f_log.open(QIODevice::WriteOnly | QIODevice::Append)) + { + QTextStream out(&f_log); + + out << "\r\n" << p_text; + + f_log.flush(); + f_log.close(); + return true; + } + return false; +} + void AOApplication::write_to_serverlist_txt(QString p_line) { QFile serverlist_txt; -- cgit From 2268df7b152ac6de774d4eb8afa7ae502026b543 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 01:17:13 +0300 Subject: Update preanim_timer to follow the weird ass time_mod constant --- include/aocharmovie.h | 2 ++ src/aocharmovie.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/aocharmovie.h b/include/aocharmovie.h index d066a399..ec7b9522 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -66,6 +66,8 @@ private: QString m_emote; QElapsedTimer actual_time; + + //it will forever be a mystery who thought this time_mod system would ever be a good idea with precision-based emotes const int time_mod = 60; // These are the X and Y values before they are fixed based on the sprite's width. diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 34c6c813..b795847a 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -164,7 +164,7 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) //not without looping through all frames in the image at least - which causes lag. So for now it simply ends the preanimation early instead. play_once = true; if (duration > 0) //It's -1 if there's no definition in [Time] for it. In which case, it will let the animation run out in full. Duration 0 does the same. - preanim_timer->start(duration); //This timer will not fire if the animation finishes earlier than that + preanim_timer->start(duration * time_mod); //This timer will not fire if the animation finishes earlier than that play(); } -- cgit From 6785f357622363edf73cb55763b730bcb0542229 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 01:20:03 +0300 Subject: Begin implementation of scroll bars in the options menu --- include/aooptionsdialog.h | 1 + src/aooptionsdialog.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 03226619..51984106 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 7c524022..b9267821 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -12,7 +12,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_settings_buttons = new QDialogButtonBox(this); - QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Fixed); + QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Maximum); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(ui_settings_buttons->sizePolicy().hasHeightForWidth()); @@ -37,9 +37,9 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi // First, we'll start with 'Gameplay'. ui_gameplay_tab = new QWidget(); ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay")); - ui_form_layout_widget = new QWidget(ui_gameplay_tab); ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 211)); + ui_form_layout_widget->setSizePolicy(sizePolicy1); ui_gameplay_form = new QFormLayout(ui_form_layout_widget); ui_gameplay_form->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); @@ -216,6 +216,12 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_framenetwork_cb); + QScrollArea *scroll = new QScrollArea; + scroll->setWidget(ui_form_layout_widget); + ui_gameplay_tab->setLayout(new QVBoxLayout); + ui_gameplay_tab->layout()->addWidget(scroll); + ui_gameplay_tab->show(); + // Here we start the callwords tab. ui_callwords_tab = new QWidget(); ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords")); -- cgit From 03ebad6bb6c922323b16b3ae6a701ddc34ba538b Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 04:16:59 +0300 Subject: Add expanded style sheet support Allow lobby fonts to happen --- include/aoapplication.h | 3 +++ include/courtroom.h | 6 +++++ include/lobby.h | 4 +++ src/courtroom.cpp | 38 ++++++++++++++++++++++----- src/lobby.cpp | 62 +++++++++++++++++++++++++++++++++++++++++++++ src/text_file_functions.cpp | 39 ++++++++++++++++++++++++++++ 6 files changed, 145 insertions(+), 7 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 24dc35ce..fcee38fd 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -252,6 +252,9 @@ public: //Returns a QStringList of all key=value definitions on a given tag. QStringList read_char_ini_tag(QString p_char, QString target_tag); + //Returns the text between target_tag and terminator_tag in p_file + QString get_stylesheet(QString target_tag, QString p_file); + //Returns the side of the p_char character from that characters ini file QString get_char_side(QString p_char); diff --git a/include/courtroom.h b/include/courtroom.h index 7fbde274..9d33a911 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -122,6 +122,12 @@ public: //helper function that calls above function on the relevant widgets void set_fonts(); + //sets dropdown menu stylesheet + void set_dropdown(QWidget *widget, QString target_tag); + + //helper funciton that call above function on the relevant widgets + void set_dropdowns(); + void set_window_title(QString p_title); //reads theme inis and sets size and pos based on the identifier diff --git a/include/lobby.h b/include/lobby.h index 4293ac36..e0cd03da 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -32,6 +32,10 @@ public: void append_chatmessage(QString f_name, QString f_message); void append_error(QString f_message); void set_player_count(int players_online, int max_players); + void set_stylesheet(QWidget *widget, QString target_tag); + void set_stylesheets(); + void set_fonts(); + void set_font(QWidget *widget, QString p_identifier); void set_loading_text(QString p_text); void show_loading_overlay(){ui_loading_background->show();} void hide_loading_overlay(){ui_loading_background->hide();} diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 433041cc..c87da55b 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -709,6 +709,8 @@ void Courtroom::set_widgets() ui_char_select_right->set_image("arrow_right.png"); set_size_and_pos(ui_spectator, "spectator"); + + set_dropdowns(); } void Courtroom::set_fonts() @@ -719,7 +721,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"; @@ -739,21 +741,43 @@ void Courtroom::set_font(QWidget *widget, QString p_identifier) 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)); + QString font_name = ao_app->get_font_name(p_identifier + "_font", design_file); + widget->setFont(QFont(font_name, f_weight)); QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); + int bold = ao_app->get_font_size(p_identifier + "_bold", design_file); // is the font bold or not? + + QString is_bold = ""; + if(bold == 1) is_bold = "bold"; + 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); }"; + "color: rgba(" + + QString::number(f_color.red()) + ", " + + QString::number(f_color.green()) + ", " + + QString::number(f_color.blue()) + ", 255);\n" + "font: " + is_bold + "; }"; widget->setStyleSheet(style_sheet_string); } +void Courtroom::set_dropdown(QWidget *widget, QString target_tag) +{ + QString f_file = "courtroom_stylesheets.css"; + QString style_sheet_string = ao_app->get_stylesheet(target_tag, f_file); + if (style_sheet_string != "") + widget->setStyleSheet(style_sheet_string); +} + +void Courtroom::set_dropdowns() +{ + set_dropdown(ui_text_color, "[TEXT COLOR]"); + set_dropdown(ui_pos_dropdown, "[POS DROPDOWN]"); + set_dropdown(ui_emote_dropdown, "[EMOTE DROPDOWN]"); + set_dropdown(ui_mute_list, "[MUTE LIST]"); +} + void Courtroom::set_window_title(QString p_title) { this->setWindowTitle(p_title); diff --git a/src/lobby.cpp b/src/lobby.cpp index 6f257cec..7df2cdc5 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -153,6 +153,8 @@ void Lobby::set_widgets() ui_loading_background->hide(); + set_fonts(); + set_stylesheets(); } void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier) @@ -173,6 +175,66 @@ void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier) } } +void Lobby::set_fonts() +{ + set_font(ui_player_count, "player_count"); + set_font(ui_description, "description"); + set_font(ui_chatbox, "chatbox"); + set_font(ui_chatname, "chatname"); + set_font(ui_chatmessage, "chatmessage"); + set_font(ui_loading_text, "loading_text"); + set_font(ui_server_list, "server_list"); +} + +void Lobby::set_stylesheet(QWidget *widget, QString target_tag) +{ + QString f_file = "lobby_stylesheets.css"; + QString style_sheet_string = ao_app->get_stylesheet(target_tag, f_file); + if (style_sheet_string != "") + widget->setStyleSheet(style_sheet_string); +} + +void Lobby::set_stylesheets() +{ + set_stylesheet(ui_player_count, "[PLAYER COUNT]"); + set_stylesheet(ui_description, "[DESCRIPTION]"); + set_stylesheet(ui_chatbox, "[CHAT BOX]"); + set_stylesheet(ui_chatname, "[CHAT NAME]"); + set_stylesheet(ui_chatmessage, "[CHAT MESSAGE]"); + set_stylesheet(ui_loading_text, "[LOADING TEXT]"); + set_stylesheet(ui_server_list, "[SERVER LIST]"); +} + +void Lobby::set_font(QWidget *widget, QString p_identifier) +{ + QString design_file = "lobby_fonts.ini"; + int f_weight = ao_app->get_font_size(p_identifier, design_file); + QString class_name = widget->metaObject()->className(); + QString font_name = ao_app->get_font_name("font_" + p_identifier, design_file); + QFont font(font_name, f_weight); + bool use = static_cast(ao_app->get_font_size("use_custom_fonts", design_file)); + if(use) + { + widget->setFont(font); + QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); + bool bold = static_cast(ao_app->get_font_size(p_identifier + "_bold", design_file)); // is the font bold or not? + bool center = static_cast(ao_app->get_font_size(p_identifier + "_center", design_file)); // should it be centered? + QString is_bold = ""; + if(bold) is_bold = "bold"; + QString is_center = ""; + if(center) is_center = "qproperty-alignment: AlignCenter;"; + 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);\n" + + is_center + "\n" + + "font: " + is_bold + "; }"; + widget->setStyleSheet(style_sheet_string); + } + return; +} + void Lobby::set_loading_text(QString p_text) { ui_loading_text->clear(); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index ae17ac53..ad82581e 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -350,6 +350,45 @@ QColor AOApplication::get_color(QString p_identifier, QString p_file) return return_color; } +QString AOApplication::get_stylesheet(QString target_tag, QString p_file) +{ + QString design_ini_path = get_theme_path(p_file); + + QFile design_ini; + + design_ini.setFileName(design_ini_path); + + if(!design_ini.open(QIODevice::ReadOnly)) + return ""; + + QTextStream in(&design_ini); + + QString f_text; + + bool tag_found = false; + + while(!in.atEnd()) + { + QString line = in.readLine(); + + if (line.startsWith(target_tag, Qt::CaseInsensitive)) + { + tag_found = true; + continue; + } + + if(tag_found) + { + if((line.startsWith("[") && line.endsWith("]"))) + break; + f_text.append(line); + } + } + + design_ini.close(); + return f_text; +} + QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) { QColor return_color(255, 255, 255); -- cgit From 9b39b7d6aa2beb8b5496a528c2351adf125c4601 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 06:09:39 +0300 Subject: Allow char.ini to override the chat font and font size with chat_font = and chat_size = Scream at the coders that decided hard-coding fonts and colors was a good idea (gotta properly let the themes modify that later) Fix a lot of ui elements not properly respecting the themes and their colors add a set_qfont method for those situations that need it Allow the theme to change sender colors for ooc and ms chatlogs rename url parser variable to something more immediately apparent as to what it is for readability's sake --- include/aoapplication.h | 8 +++++++- include/aotextarea.h | 2 +- include/courtroom.h | 5 +++++ src/aotextarea.cpp | 4 ++-- src/courtroom.cpp | 44 ++++++++++++++++++++++++++++++-------------- src/evidence.cpp | 1 + src/lobby.cpp | 1 + src/text_file_functions.cpp | 16 ++++++++++++++++ 8 files changed, 63 insertions(+), 18 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index fcee38fd..e4a5b7f6 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -261,9 +261,15 @@ public: //Returns the showname from the ini of p_char QString get_showname(QString p_char); - //Returns the value of chat from the specific p_char's ini file + //Returns the value of chat image from the specific p_char's ini file QString get_chat(QString p_char); + //Returns the value of chat font from the specific p_char's ini file + QString get_chat_font(QString p_char); + + //Returns the value of chat font size from the specific p_char's ini file + int get_chat_size(QString p_char); + //Returns the value of shouts from the specified p_char's ini file QString get_char_shouts(QString p_char); diff --git a/include/aotextarea.h b/include/aotextarea.h index d44596b2..266b7222 100644 --- a/include/aotextarea.h +++ b/include/aotextarea.h @@ -16,7 +16,7 @@ public: void append_error(QString p_message); private: - const QRegExp omnis_dank_url_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b"); + const QRegExp url_parser_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b"); void auto_scroll(QTextCursor old_cursor, int scrollbar_value, bool is_scrolled_down); }; diff --git a/include/courtroom.h b/include/courtroom.h index 9d33a911..304dd64f 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -117,8 +117,13 @@ public: //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); + + //actual operation of setting the font on a widget + void set_qfont(QWidget *widget, QFont font, QColor f_color = Qt::black, bool bold = false); + //helper function that calls above function on the relevant widgets void set_fonts(); diff --git a/src/aotextarea.cpp b/src/aotextarea.cpp index 5e146326..f9d21e6e 100644 --- a/src/aotextarea.cpp +++ b/src/aotextarea.cpp @@ -18,7 +18,7 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p //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(url_parser_regex, "\\1" ); this->insertHtml(result); @@ -36,7 +36,7 @@ void AOTextArea::append_error(QString p_message) this->append(""); p_message += " "; - QString result = p_message.replace("\n", "
").replace(omnis_dank_url_regex, "\\1" ); + QString result = p_message.replace("\n", "
").replace(url_parser_regex, "\\1" ); this->insertHtml("" + result + ""); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c87da55b..d56719f0 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -86,6 +86,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_vp_chatbox = new AOImage(this, ao_app); ui_vp_showname = new QLabel(ui_vp_chatbox); + ui_vp_showname->setAlignment(Qt::AlignHCenter); ui_vp_message = new QTextEdit(this); ui_vp_message->setFrameStyle(QFrame::NoFrame); ui_vp_message->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -482,8 +483,8 @@ void Courtroom::set_widgets() //We detached the text as parent from the chatbox so it doesn't get affected by the screenshake. ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y()); ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); - ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: white"); +// 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()); @@ -514,8 +515,6 @@ void Courtroom::set_widgets() 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);"); - set_size_and_pos(ui_music_list, "music_list"); if (is_ao2_bg) @@ -739,18 +738,20 @@ 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 font_name = ao_app->get_font_name(p_identifier + "_font", design_file); - - widget->setFont(QFont(font_name, f_weight)); - QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - int bold = ao_app->get_font_size(p_identifier + "_bold", design_file); // is the font bold or not? + bool bold = static_cast(ao_app->get_font_size(p_identifier + "_bold", design_file)); // is the font bold or not? + this->set_qfont(widget, QFont(font_name, f_weight), f_color, bold); +} + +void Courtroom::set_qfont(QWidget *widget, QFont font, QColor f_color, bool bold) +{ + QString class_name = widget->metaObject()->className(); + widget->setFont(font); QString is_bold = ""; - if(bold == 1) is_bold = "bold"; + if(bold) is_bold = "bold"; QString style_sheet_string = class_name + " { background-color: rgba(0, 0, 0, 0);\n" + "color: rgba(" + @@ -1094,7 +1095,7 @@ void Courtroom::list_areas() void Courtroom::append_ms_chatmessage(QString f_name, QString f_message) { - ui_ms_chatlog->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name()); + ui_ms_chatlog->append_chatmessage(f_name, f_message, ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini").name()); } void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QString p_colour) @@ -1102,9 +1103,9 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QSt QString colour = "#000000"; if (p_colour == "0") - colour = ao_app->get_color("ooc_default_color", "courtroom_design.ini").name(); + colour = ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini").name(); if (p_colour == "1") - colour = ao_app->get_color("ooc_server_color", "courtroom_design.ini").name(); + colour = ao_app->get_color("server_chatlog_sender_color", "courtroom_fonts.ini").name(); if(p_message == "Logged in as a moderator.") { ui_guard->show(); @@ -1505,6 +1506,21 @@ void Courtroom::handle_chatmessage_2() ui_vp_chatbox->set_image_from_path(chatbox_path); } + QString design_file = "courtroom_fonts.ini"; + int f_weight = ao_app->get_font_size("message", design_file); + QString font_name = ao_app->get_font_name("message_font", design_file); + QColor f_color = ao_app->get_color("message_color", design_file); + bool bold = static_cast(ao_app->get_font_size("message_bold", design_file)); // is the font bold or not? + + QString chatfont = ao_app->get_chat_font(m_chatmessage[CHAR_NAME]); + if (chatfont != "") + font_name = chatfont; + + int chatsize = ao_app->get_chat_size(m_chatmessage[CHAR_NAME]); + if (chatsize != -1) + f_weight = chatsize; + this->set_qfont(ui_vp_message, QFont(font_name, f_weight), f_color, bold); + ui_vp_showname->setStyleSheet("QLabel { color : " + get_text_color("_showname").name() + "; }"); set_scene(); diff --git a/src/evidence.cpp b/src/evidence.cpp index 341bed0f..7e29b256 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -7,6 +7,7 @@ void Courtroom::construct_evidence() //ui_evidence_name = new QLabel(ui_evidence); ui_evidence_name = new AOLineEdit(ui_evidence); ui_evidence_name->setAlignment(Qt::AlignCenter); + //WHY IS THIS FONT HARDCODED, WHAT IS WRONG WITH YOU ui_evidence_name->setFont(QFont("Arial", 14, QFont::Bold)); ui_evidence_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: rgba(255, 128, 0, 255);"); diff --git a/src/lobby.cpp b/src/lobby.cpp index 7df2cdc5..951ff9a8 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -139,6 +139,7 @@ void Lobby::set_widgets() set_size_and_pos(ui_loading_text, "loading_label"); + //WHY IS THIS FONT HARDCODED, WHAT IS WRONG WITH YOU ui_loading_text->setFont(QFont("Arial", 20, QFont::Bold)); ui_loading_text->setReadOnly(true); ui_loading_text->setAlignment(Qt::AlignCenter); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index ad82581e..02c0b711 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -576,6 +576,22 @@ QString AOApplication::get_chat(QString p_char) return f_result; } +QString AOApplication::get_chat_font(QString p_char) +{ + QString f_result = read_char_ini(p_char, "chat_font", "Options"); + + return f_result; +} + +int AOApplication::get_chat_size(QString p_char) +{ + QString f_result = read_char_ini(p_char, "chat_size", "Options"); + + if (f_result == "") + return -1; + return f_result.toInt(); +} + QString AOApplication::get_char_shouts(QString p_char) { QString f_result = read_char_ini(p_char, "shouts", "Options"); -- cgit From b037edc9d8360ee679cae8d5f6c4d138ede4482b Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 18:11:19 +0300 Subject: Add additive text option where your messages are added to your previous one, fully networked and ready for the server Adjust some pointless static bool casts to be actual logic checks --- include/aoapplication.h | 1 + include/aocharmovie.h | 6 +++--- include/courtroom.h | 9 +++++++-- include/datatypes.h | 3 ++- src/courtroom.cpp | 45 ++++++++++++++++++++++++++++++++++++--------- src/lobby.cpp | 6 +++--- src/packet_distribution.cpp | 3 +++ 7 files changed, 55 insertions(+), 18 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index e4a5b7f6..f499faf0 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -79,6 +79,7 @@ public: bool casing_alerts_enabled = false; bool modcall_reason_enabled = false; bool looping_sfx_support_enabled = false; + bool additive_enabled = false; ///////////////loading info/////////////////// diff --git a/include/aocharmovie.h b/include/aocharmovie.h index ec7b9522..adfa7b88 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -46,6 +46,9 @@ public: QStringList network_strings; + QString m_char; + QString m_emote; + private: AOApplication *ao_app; @@ -62,9 +65,6 @@ private: QString last_path; QImageReader *m_reader = new QImageReader(); - QString m_char; - QString m_emote; - QElapsedTimer actual_time; //it will forever be a mystery who thought this time_mod system would ever be a good idea with precision-based emotes diff --git a/include/courtroom.h b/include/courtroom.h index 304dd64f..9b3c0577 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -315,6 +315,9 @@ private: bool rainbow_appended = false; bool blank_blip = false; + //Whether or not is this message additive to the previous one + bool is_additive = false; + // Used for getting the current maximum blocks allowed in the IC chatlog. int log_maximum_blocks = 0; @@ -339,7 +342,7 @@ private: //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; + static const int chatmessage_size = 29; QString m_chatmessage[chatmessage_size]; bool chatmessage_is_empty = false; @@ -484,6 +487,7 @@ private: QCheckBox *ui_pre; QCheckBox *ui_flip; + QCheckBox *ui_additive; QCheckBox *ui_guard; QCheckBox *ui_casing; @@ -601,7 +605,7 @@ private slots: void on_emote_dropdown_changed(int p_index); void on_pos_dropdown_changed(int p_index); - void on_evidence_name_edited(); + void on_evidence_name_edited(QString text); void on_evidence_image_name_edited(); void on_evidence_image_button_clicked(); void on_evidence_clicked(int p_id); @@ -653,6 +657,7 @@ private slots: void on_pre_clicked(); void on_flip_clicked(); + void on_additive_clicked(); void on_guard_clicked(); void on_showname_enable_clicked(); diff --git a/include/datatypes.h b/include/datatypes.h index 1b76f725..54e5c741 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -105,7 +105,8 @@ enum CHAT_MESSAGE SCREENSHAKE, FRAME_SCREENSHAKE, FRAME_REALIZATION, - FRAME_SFX + FRAME_SFX, + ADDITIVE }; enum COLOR diff --git a/src/courtroom.cpp b/src/courtroom.cpp index d56719f0..59d37d3a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -197,6 +197,10 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_guard->setText(tr("Guard")); ui_guard->hide(); + ui_additive = new QCheckBox(this); + ui_additive->setText(tr("Additive")); + ui_additive->hide(); + ui_casing = new QCheckBox(this); ui_casing->setChecked(ao_app->get_casing_enabled()); ui_casing->setText(tr("Casing")); @@ -331,6 +335,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked())); connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked())); + connect(ui_additive, SIGNAL(clicked()), this, SLOT(on_additive_clicked())); connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked())); connect(ui_casing, SIGNAL(clicked()), this, SLOT(on_casing_clicked())); @@ -619,6 +624,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); set_size_and_pos(ui_flip, "flip"); + set_size_and_pos(ui_additive, "additive"); + set_size_and_pos(ui_guard, "guard"); set_size_and_pos(ui_casing, "casing"); @@ -741,7 +748,7 @@ void Courtroom::set_font(QWidget *widget, QString p_identifier) QString font_name = ao_app->get_font_name(p_identifier + "_font", design_file); QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - bool bold = static_cast(ao_app->get_font_size(p_identifier + "_bold", design_file)); // is the font bold or not? + bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? this->set_qfont(widget, QFont(font_name, f_weight), f_color, bold); } @@ -954,6 +961,11 @@ void Courtroom::enter_courtroom(int p_cid) else ui_flip->hide(); + if (ao_app->additive_enabled) + ui_additive->show(); + else + ui_additive->hide(); + if (ao_app->casing_alerts_enabled) ui_casing->show(); else @@ -1319,13 +1331,13 @@ void Courtroom::on_chat_return_pressed() qDebug() << f_effect << "packet" << packet; packet_contents.append(packet); } + } - //"roar|thing=thong^(b)roar^(a)roar^" - -// packet_contents.append(frame_screenshake); -// packet_contents.append(frame_realization); -// packet_contents.append(frame_sfx); + if (ao_app->additive_enabled) + { + packet_contents.append(ui_additive->isChecked() ? "1" : "0"); } + ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } @@ -1388,6 +1400,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; + is_additive = false; if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() && m_chatmessage[CHAR_ID].toInt() == m_cid) { ui_ic_chat_message->clear(); @@ -1403,6 +1416,10 @@ 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"); + + + if (ao_app->additive_enabled && ui_vp_player_char->m_char == m_chatmessage[CHAR_NAME]) + is_additive = m_chatmessage[ADDITIVE].toInt() == 1; } chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false); @@ -1493,7 +1510,7 @@ void Courtroom::handle_chatmessage_2() ui_vp_showname->setText(m_chatmessage[SHOWNAME]); } - ui_vp_message->clear(); + ui_vp_message->hide(); ui_vp_chatbox->hide(); QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); @@ -1510,7 +1527,7 @@ void Courtroom::handle_chatmessage_2() int f_weight = ao_app->get_font_size("message", design_file); QString font_name = ao_app->get_font_name("message_font", design_file); QColor f_color = ao_app->get_color("message_color", design_file); - bool bold = static_cast(ao_app->get_font_size("message_bold", design_file)); // is the font bold or not? + bool bold = ao_app->get_font_size("message_bold", design_file) == 1; // is the font bold or not? QString chatfont = ao_app->get_chat_font(m_chatmessage[CHAR_NAME]); if (chatfont != "") @@ -2177,7 +2194,6 @@ void Courtroom::start_chat_ticking() this->do_screenshake(); } - ui_vp_message->clear(); set_text_color(); rainbow_counter = 0; @@ -2196,6 +2212,12 @@ void Courtroom::start_chat_ticking() } ui_vp_chatbox->show(); + ui_vp_message->show(); + + if (!is_additive) + { + ui_vp_message->clear(); + } tick_pos = 0; blip_pos = 0; @@ -3667,6 +3689,11 @@ void Courtroom::on_flip_clicked() ui_ic_chat_message->setFocus(); } +void Courtroom::on_additive_clicked() +{ + ui_ic_chat_message->setFocus(); +} + void Courtroom::on_guard_clicked() { ui_ic_chat_message->setFocus(); diff --git a/src/lobby.cpp b/src/lobby.cpp index 951ff9a8..758f0fbf 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -213,13 +213,13 @@ void Lobby::set_font(QWidget *widget, QString p_identifier) QString class_name = widget->metaObject()->className(); QString font_name = ao_app->get_font_name("font_" + p_identifier, design_file); QFont font(font_name, f_weight); - bool use = static_cast(ao_app->get_font_size("use_custom_fonts", design_file)); + bool use = ao_app->get_font_size("use_custom_fonts", design_file) == 1; if(use) { widget->setFont(font); QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - bool bold = static_cast(ao_app->get_font_size(p_identifier + "_bold", design_file)); // is the font bold or not? - bool center = static_cast(ao_app->get_font_size(p_identifier + "_center", design_file)); // should it be centered? + bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? + bool center = ao_app->get_font_size(p_identifier + "_center", design_file) == 1; // should it be centered? QString is_bold = ""; if(bold) is_bold = "bold"; QString is_center = ""; diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 72840f75..ff43f273 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -150,6 +150,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) casing_alerts_enabled = false; modcall_reason_enabled = false; looping_sfx_support_enabled = false; + additive_enabled = false; //workaround for tsuserver4 if (f_contents.at(0) == "NOENCRYPT") @@ -212,6 +213,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet) modcall_reason_enabled = true; if (f_packet.contains("looping_sfx",Qt::CaseInsensitive)) looping_sfx_support_enabled = true; + if (f_packet.contains("additive",Qt::CaseInsensitive)) + additive_enabled = true; } else if (header == "PN") { -- cgit From b085be5a2a0512c432bc9fd58413a9d8f93d451e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 21:08:43 +0300 Subject: Add two new helper functions - get_design_element and get_static_image_suffix Modify all set_image calls to utilize said suffix helper function Dynamically change betweehn chatblank, chat, chatmed, chatbig based on the showname's length Use char.ini showname if showname is set to whitespace (doesn't yet check if char.ini showname is also whitespace) --- include/aoapplication.h | 6 ++ include/aoimage.h | 4 +- src/aobutton.cpp | 4 +- src/aocharbutton.cpp | 6 +- src/aoemotebutton.cpp | 2 +- src/aoevidencebutton.cpp | 4 +- src/aoimage.cpp | 33 ++++--- src/charselect.cpp | 2 +- src/courtroom.cpp | 213 +++++++++++++++++++++++++------------------- src/emotes.cpp | 8 +- src/evidence.cpp | 9 +- src/lobby.cpp | 40 ++++----- src/text_file_functions.cpp | 13 +++ 13 files changed, 201 insertions(+), 143 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index f499faf0..052ad08a 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -226,6 +226,9 @@ public: //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 value to you + QString get_design_element(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); @@ -247,6 +250,9 @@ public: // Can we use APNG for this? If not, WEBP? If not, GIF? If not, fall back to PNG. QString get_image_suffix(QString path_to_check); + // If this image is static and non-animated, return the supported static image formats. Currently only PNG. + QString get_static_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); diff --git a/include/aoimage.h b/include/aoimage.h index 4713be0a..25c8e068 100644 --- a/include/aoimage.h +++ b/include/aoimage.h @@ -17,8 +17,8 @@ public: QWidget *m_parent; AOApplication *ao_app; - void set_image(QString p_image); - void set_image_from_path(QString p_path); + bool set_image(QString p_image); + bool set_chatbox(QString p_path); void set_size_and_pos(QString identifier); }; diff --git a/src/aobutton.cpp b/src/aobutton.cpp index 5be2e678..1459729f 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -15,8 +15,8 @@ AOButton::~AOButton() void AOButton::set_image(QString p_image) { - QString image_path = ao_app->get_theme_path(p_image); - QString default_image_path = ao_app->get_default_theme_path(p_image); + QString image_path = ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); + QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); if (file_exists(image_path)) this->setStyleSheet("border-image:url(\"" + image_path + "\")"); diff --git a/src/aocharbutton.cpp b/src/aocharbutton.cpp index 76610270..d571b953 100644 --- a/src/aocharbutton.cpp +++ b/src/aocharbutton.cpp @@ -15,7 +15,7 @@ AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, ui_taken = new AOImage(this, ao_app); ui_taken->resize(60, 60); - ui_taken->set_image("char_taken.png"); + ui_taken->set_image("char_taken"); ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents); ui_taken->hide(); @@ -28,7 +28,7 @@ AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, ui_selector = new AOImage(parent, ao_app); ui_selector->resize(62, 62); ui_selector->move(x_pos - 1, y_pos - 1); - ui_selector->set_image("char_selector.png"); + ui_selector->set_image("char_selector"); ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); ui_selector->hide(); } @@ -65,7 +65,7 @@ void AOCharButton::set_passworded() void AOCharButton::set_image(QString p_character) { - QString image_path = ao_app->get_character_path(p_character, "char_icon.png"); + QString image_path = ao_app->get_static_image_suffix(ao_app->get_character_path(p_character, "char_icon")); this->setText(""); diff --git a/src/aoemotebutton.cpp b/src/aoemotebutton.cpp index 9c1d3889..ca4d6941 100644 --- a/src/aoemotebutton.cpp +++ b/src/aoemotebutton.cpp @@ -16,7 +16,7 @@ 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_static_image_suffix(ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix)); if (file_exists(image_path)) { diff --git a/src/aoevidencebutton.cpp b/src/aoevidencebutton.cpp index 15b598fc..616f6367 100644 --- a/src/aoevidencebutton.cpp +++ b/src/aoevidencebutton.cpp @@ -10,14 +10,14 @@ AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, i ui_selected = new AOImage(p_parent, ao_app); ui_selected->resize(70, 70); ui_selected->move(p_x, p_y); - ui_selected->set_image("evidence_selected.png"); + ui_selected->set_image("evidence_selected"); ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents); ui_selected->hide(); ui_selector = new AOImage(p_parent, ao_app); ui_selector->resize(71, 71); ui_selector->move(p_x - 1, p_y - 1); - ui_selector->set_image("evidence_selector.png"); + ui_selector->set_image("evidence_selector"); ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); ui_selector->hide(); diff --git a/src/aoimage.cpp b/src/aoimage.cpp index 7bb56bb6..17c2ea61 100644 --- a/src/aoimage.cpp +++ b/src/aoimage.cpp @@ -13,35 +13,40 @@ AOImage::~AOImage() } -void AOImage::set_image(QString p_image) +bool AOImage::set_image(QString p_image) { - QString theme_image_path = ao_app->get_theme_path(p_image); - QString default_image_path = ao_app->get_default_theme_path(p_image); + QString theme_image_path = ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); + QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); QString final_image_path; if (file_exists(theme_image_path)) final_image_path = theme_image_path; - else + else if (file_exists(default_image_path)) final_image_path = default_image_path; + else + { + qDebug() << "Warning: Image" << p_image << "not found! Can't set!"; + return false; + } QPixmap f_pixmap(final_image_path); this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + return true; } -void AOImage::set_image_from_path(QString p_path) +bool AOImage::set_chatbox(QString p_path) { - QString default_path = ao_app->get_default_theme_path("chatmed.png"); - - QString final_path; - - if (file_exists(p_path)) - final_path = p_path; - else - final_path = default_path; + p_path = ao_app->get_static_image_suffix(p_path); + if (!file_exists(p_path)) + { + qDebug() << "Warning: Chatbox" << p_path << "not found! Can't set!"; + return false; + } - QPixmap f_pixmap(final_path); + QPixmap f_pixmap(p_path); this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + return true; } diff --git a/src/charselect.cpp b/src/charselect.cpp index 0cfb7753..23b05134 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -71,7 +71,7 @@ void Courtroom::set_char_select() this->resize(f_charselect.width, f_charselect.height); ui_char_select_background->resize(f_charselect.width, f_charselect.height); - ui_char_select_background->set_image("charselect_background.png"); + ui_char_select_background->set_image("charselect_background"); filter_character_list(); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 59d37d3a..cfdc8fbb 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -418,7 +418,7 @@ void Courtroom::set_widgets() ui_background->move(0, 0); ui_background->resize(m_courtroom_width, m_courtroom_height); - ui_background->set_image("courtroombackground.png"); + ui_background->set_image("courtroombackground"); set_size_and_pos(ui_viewport, "viewport"); @@ -517,7 +517,7 @@ void Courtroom::set_widgets() 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"); + ui_pair_button->set_image("pair_button"); set_size_and_pos(ui_area_list, "music_list"); set_size_and_pos(ui_music_list, "music_list"); @@ -538,11 +538,11 @@ void Courtroom::set_widgets() 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->set_image("chatblank"); ui_vp_chatbox->hide(); ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); - ui_muted->set_image("muted.png"); + ui_muted->set_image("muted"); set_size_and_pos(ui_ooc_chat_message, "ooc_chat_message"); ui_ooc_chat_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); @@ -556,19 +556,19 @@ void Courtroom::set_widgets() set_size_and_pos(ui_emotes, "emotes"); set_size_and_pos(ui_emote_left, "emote_left"); - ui_emote_left->set_image("arrow_left.png"); + ui_emote_left->set_image("arrow_left"); set_size_and_pos(ui_emote_right, "emote_right"); - ui_emote_right->set_image("arrow_right.png"); + ui_emote_right->set_image("arrow_right."); 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"); + ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state)); set_size_and_pos(ui_prosecution_bar, "prosecution_bar"); - ui_prosecution_bar->set_image("prosecutionbar" + QString::number(prosecution_bar_state) + ".png"); + ui_prosecution_bar->set_image("prosecutionbar" + QString::number(prosecution_bar_state)); set_size_and_pos(ui_music_label, "music_label"); ui_music_label->setText(tr("Music")); @@ -581,24 +581,24 @@ void Courtroom::set_widgets() ui_log_limit_label->setText(tr("Log limit")); set_size_and_pos(ui_hold_it, "hold_it"); - ui_hold_it->set_image("holdit.png"); + ui_hold_it->set_image("holdit"); set_size_and_pos(ui_objection, "objection"); - ui_objection->set_image("objection.png"); + ui_objection->set_image("objection"); set_size_and_pos(ui_take_that, "take_that"); - ui_take_that->set_image("takethat.png"); + ui_take_that->set_image("takethat"); set_size_and_pos(ui_ooc_toggle, "ooc_toggle"); ui_ooc_toggle->setText(tr("Server")); set_size_and_pos(ui_witness_testimony, "witness_testimony"); - ui_witness_testimony->set_image("witnesstestimony.png"); + ui_witness_testimony->set_image("witnesstestimony"); set_size_and_pos(ui_cross_examination, "cross_examination"); - ui_cross_examination->set_image("crossexamination.png"); + ui_cross_examination->set_image("crossexamination"); set_size_and_pos(ui_guilty, "guilty"); - ui_guilty->set_image("guilty.png"); + ui_guilty->set_image("guilty"); set_size_and_pos(ui_not_guilty, "not_guilty"); - ui_not_guilty->set_image("notguilty.png"); + ui_not_guilty->set_image("notguilty"); set_size_and_pos(ui_change_character, "change_character"); ui_change_character->setText(tr("Change character")); @@ -633,28 +633,28 @@ void Courtroom::set_widgets() 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"); + ui_custom_objection->set_image("custom"); set_size_and_pos(ui_realization, "realization"); - ui_realization->set_image("realization.png"); + ui_realization->set_image("realization"); set_size_and_pos(ui_screenshake, "screenshake"); - ui_screenshake->set_image("screenshake.png"); + ui_screenshake->set_image("screenshake"); set_size_and_pos(ui_mute, "mute_button"); - ui_mute->set_image("mute.png"); + ui_mute->set_image("mute"); set_size_and_pos(ui_defense_plus, "defense_plus"); - ui_defense_plus->set_image("defplus.png"); + ui_defense_plus->set_image("defplus"); set_size_and_pos(ui_defense_minus, "defense_minus"); - ui_defense_minus->set_image("defminus.png"); + ui_defense_minus->set_image("defminus"); set_size_and_pos(ui_prosecution_plus, "prosecution_plus"); - ui_prosecution_plus->set_image("proplus.png"); + ui_prosecution_plus->set_image("proplus"); set_size_and_pos(ui_prosecution_minus, "prosecution_minus"); - ui_prosecution_minus->set_image("prominus.png"); + ui_prosecution_minus->set_image("prominus"); set_size_and_pos(ui_text_color, "text_color"); @@ -665,40 +665,40 @@ void Courtroom::set_widgets() 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"); + ui_evidence_button->set_image("evidencebutton"); set_size_and_pos(ui_evidence, "evidence_background"); - ui_evidence->set_image("evidencebackground.png"); + ui_evidence->set_image("evidencebackground"); 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"); + ui_evidence_left->set_image("arrow_left"); set_size_and_pos(ui_evidence_right, "evidence_right"); - ui_evidence_right->set_image("arrow_right.png"); + ui_evidence_right->set_image("arrow_right"); set_size_and_pos(ui_evidence_present, "evidence_present"); - ui_evidence_present->set_image("present_disabled.png"); + ui_evidence_present->set_image("present_disabled"); set_size_and_pos(ui_evidence_overlay, "evidence_overlay"); - ui_evidence_overlay->set_image("evidenceoverlay.png"); + ui_evidence_overlay->set_image("evidenceoverlay"); set_size_and_pos(ui_evidence_delete, "evidence_delete"); - ui_evidence_delete->set_image("deleteevidence.png"); + ui_evidence_delete->set_image("deleteevidence"); 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"); + ui_evidence_x->set_image("evidencex"); set_size_and_pos(ui_evidence_description, "evidence_description"); - ui_selector->set_image("char_selector.png"); + ui_selector->set_image("char_selector"); ui_selector->hide(); set_size_and_pos(ui_back_to_lobby, "back_to_lobby"); @@ -709,10 +709,10 @@ void Courtroom::set_widgets() 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"); + ui_char_select_left->set_image("arrow_left"); set_size_and_pos(ui_char_select_right, "char_select_right"); - ui_char_select_right->set_image("arrow_right.png"); + ui_char_select_right->set_image("arrow_right"); set_size_and_pos(ui_spectator, "spectator"); @@ -869,9 +869,9 @@ 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")); + is_ao2_bg = file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("defensedesk"))) && + file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("prosecutiondesk"))) && + file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("stand"))); if (is_ao2_bg) { @@ -1386,6 +1386,9 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) f_showname = m_chatmessage[SHOWNAME]; } + if(f_showname.trimmed().isEmpty()) //Pure whitespace showname, get outta here. + f_showname = m_chatmessage[CHAR_NAME]; + QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n'; @@ -1409,13 +1412,13 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) 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_hold_it->set_image("holdit"); + ui_objection->set_image("objection"); + ui_take_that->set_image("takethat"); + ui_custom_objection->set_image("custom"); + ui_realization->set_image("realization"); + ui_screenshake->set_image("screenshake"); + ui_evidence_present->set_image("present_disabled"); if (ao_app->additive_enabled && ui_vp_player_char->m_char == m_chatmessage[CHAR_NAME]) @@ -1510,19 +1513,51 @@ void Courtroom::handle_chatmessage_2() ui_vp_showname->setText(m_chatmessage[SHOWNAME]); } - ui_vp_message->hide(); - ui_vp_chatbox->hide(); + if(ui_vp_showname->text().trimmed().isEmpty()) //Whitespace showname + { + ui_vp_chatbox->set_image("chatblank"); + } + else //Aw yeah dude do some showname resizing magic + { + ui_vp_chatbox->set_image("chat"); - QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); + QFontMetrics fm(ui_vp_showname->font()); + int fm_width=fm.horizontalAdvance(ui_vp_showname->text()); - if (chatbox == "") - ui_vp_chatbox->set_image("chatmed.png"); - else - { - QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png"; - ui_vp_chatbox->set_image_from_path(chatbox_path); + qDebug() << "showname shenanigans" << ui_vp_showname->width() << fm_width << ui_vp_showname->text(); + + QString chatbox_path = ao_app->get_theme_path("chat"); + QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); + qDebug() << chatbox; + if (chatbox != "") + { + chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat"; + } + + pos_size_type default_width = ao_app->get_element_dimensions("showname", "courtroom_design.ini"); + int extra_width = ao_app->get_design_element("showname_extra_width", "courtroom_design.ini").toInt(); + qDebug() << extra_width; + + if(extra_width > 0) + { + qDebug() << default_width.width << chatbox_path; + + if (fm_width > default_width.width && ui_vp_chatbox->set_chatbox(chatbox_path + "med")) //This text be big. Let's do some shenanigans. + { + ui_vp_showname->resize(default_width.width+extra_width, ui_vp_showname->height()); + if (fm_width > ui_vp_showname->width() && ui_vp_chatbox->set_chatbox(chatbox_path + "big")) //Biggest possible size for us. + { + ui_vp_showname->resize(static_cast(default_width.width+(extra_width*2)), ui_vp_showname->height()); + } + } + else + ui_vp_showname->resize(default_width.width, ui_vp_showname->height()); + } } + ui_vp_message->hide(); + ui_vp_chatbox->hide(); + QString design_file = "courtroom_fonts.ini"; int f_weight = ao_app->get_font_size("message", design_file); QString font_name = ao_app->get_font_name("message_font", design_file); @@ -2590,14 +2625,12 @@ 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"; @@ -2689,7 +2722,7 @@ void Courtroom::set_mute(bool p_muted, int p_cid) } ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); - ui_muted->set_image("muted.png"); + ui_muted->set_image("muted"); is_muted = p_muted; ui_ic_chat_message->setEnabled(!p_muted); @@ -2806,12 +2839,12 @@ void Courtroom::set_hp_bar(int p_bar, int p_state) if (p_bar == 1) { - ui_defense_bar->set_image("defensebar" + QString::number(p_state) + ".png"); + ui_defense_bar->set_image("defensebar" + QString::number(p_state)); defense_bar_state = p_state; } else if (p_bar == 2) { - ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state) + ".png"); + ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state)); prosecution_bar_state = p_state; } } @@ -3333,16 +3366,16 @@ void Courtroom::on_hold_it_clicked() { if (objection_state == 1) { - ui_hold_it->set_image("holdit.png"); + ui_hold_it->set_image("holdit"); 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_objection->set_image("objection"); + ui_take_that->set_image("takethat"); + ui_custom_objection->set_image("custom"); - ui_hold_it->set_image("holdit_selected.png"); + ui_hold_it->set_image("holdit_selected"); objection_state = 1; } @@ -3353,16 +3386,16 @@ void Courtroom::on_objection_clicked() { if (objection_state == 2) { - ui_objection->set_image("objection.png"); + ui_objection->set_image("objection"); 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_hold_it->set_image("holdit"); + ui_take_that->set_image("takethat"); + ui_custom_objection->set_image("custom"); - ui_objection->set_image("objection_selected.png"); + ui_objection->set_image("objection_selected"); objection_state = 2; } @@ -3373,16 +3406,16 @@ void Courtroom::on_take_that_clicked() { if (objection_state == 3) { - ui_take_that->set_image("takethat.png"); + ui_take_that->set_image("takethat"); 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_objection->set_image("objection"); + ui_hold_it->set_image("holdit"); + ui_custom_objection->set_image("custom"); - ui_take_that->set_image("takethat_selected.png"); + ui_take_that->set_image("takethat_selected"); objection_state = 3; } @@ -3393,16 +3426,16 @@ void Courtroom::on_custom_objection_clicked() { if (objection_state == 4) { - ui_custom_objection->set_image("custom.png"); + ui_custom_objection->set_image("custom"); objection_state = 0; } else { - ui_objection->set_image("objection.png"); - ui_take_that->set_image("takethat.png"); - ui_hold_it->set_image("holdit.png"); + ui_objection->set_image("objection"); + ui_take_that->set_image("takethat"); + ui_hold_it->set_image("holdit"); - ui_custom_objection->set_image("custom_selected.png"); + ui_custom_objection->set_image("custom_selected"); objection_state = 4; } @@ -3414,12 +3447,12 @@ void Courtroom::on_realization_clicked() if (realization_state == 0) { realization_state = 1; - ui_realization->set_image("realization_pressed.png"); + ui_realization->set_image("realization_pressed"); } else { realization_state = 0; - ui_realization->set_image("realization.png"); + ui_realization->set_image("realization"); } ui_ic_chat_message->setFocus(); @@ -3430,12 +3463,12 @@ void Courtroom::on_screenshake_clicked() if (screenshake_state == 0) { screenshake_state = 1; - ui_screenshake->set_image("screenshake_pressed.png"); + ui_screenshake->set_image("screenshake_pressed"); } else { screenshake_state = 0; - ui_screenshake->set_image("screenshake.png"); + ui_screenshake->set_image("screenshake"); } ui_ic_chat_message->setFocus(); @@ -3448,13 +3481,13 @@ void Courtroom::on_mute_clicked() 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"); + ui_pair_button->set_image("pair_button"); + ui_mute->set_image("mute_pressed"); } else { ui_mute_list->hide(); - ui_mute->set_image("mute.png"); + ui_mute->set_image("mute"); } } @@ -3465,14 +3498,14 @@ void Courtroom::on_pair_clicked() 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"); + ui_mute->set_image("mute"); + ui_pair_button->set_image("pair_button_pressed"); } else { ui_pair_list->hide(); ui_pair_offset_spinbox->hide(); - ui_pair_button->set_image("pair_button.png"); + ui_pair_button->set_image("pair_button"); } } diff --git a/src/emotes.cpp b/src/emotes.cpp index b6a217e6..daa8d6d4 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -89,9 +89,9 @@ void Courtroom::set_emote_page() AOEmoteButton *f_emote = ui_emote_list.at(n_emote); if (n_real_emote == current_emote) - f_emote->set_image(current_char, n_real_emote, "_on.png"); + f_emote->set_image(current_char, n_real_emote, "_on"); else - f_emote->set_image(current_char, n_real_emote, "_off.png"); + f_emote->set_image(current_char, n_real_emote, "_off"); f_emote->show(); } @@ -119,14 +119,14 @@ 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"); 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"); int emote_mod = ao_app->get_emote_mod(current_char, current_emote); diff --git a/src/evidence.cpp b/src/evidence.cpp index 7e29b256..75806854 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -72,7 +72,7 @@ void Courtroom::construct_evidence() } } - connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited())); + connect(ui_evidence_name, SIGNAL(textEdited(QString)), this, SLOT(on_evidence_name_edited(QString))); 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())); @@ -153,7 +153,7 @@ void Courtroom::set_evidence_page() } } -void Courtroom::on_evidence_name_edited() +void Courtroom::on_evidence_name_edited(QString text) { if (current_evidence >= local_evidence_list.size()) return; @@ -163,6 +163,7 @@ void Courtroom::on_evidence_name_edited() evi_type f_evi = local_evidence_list.at(current_evidence); f_contents.append(QString::number(current_evidence)); + qDebug() << text; f_contents.append(ui_evidence_name->text()); f_contents.append(f_evi.description); f_contents.append(f_evi.image); @@ -297,9 +298,9 @@ void Courtroom::on_evidence_right_clicked() void Courtroom::on_evidence_present_clicked() { if (is_presenting_evidence) - ui_evidence_present->set_image("present_disabled.png"); + ui_evidence_present->set_image("present_disabled"); else - ui_evidence_present->set_image("present.png"); + ui_evidence_present->set_image("present"); is_presenting_evidence = !is_presenting_evidence; diff --git a/src/lobby.cpp b/src/lobby.cpp index 758f0fbf..b8e3efdb 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -84,28 +84,28 @@ void Lobby::set_widgets() } set_size_and_pos(ui_background, "lobby"); - ui_background->set_image("lobbybackground.png"); + ui_background->set_image("lobbybackground"); set_size_and_pos(ui_public_servers, "public_servers"); - ui_public_servers->set_image("publicservers_selected.png"); + ui_public_servers->set_image("publicservers_selected"); set_size_and_pos(ui_favorites, "favorites"); - ui_favorites->set_image("favorites.png"); + ui_favorites->set_image("favorites"); set_size_and_pos(ui_refresh, "refresh"); - ui_refresh->set_image("refresh.png"); + ui_refresh->set_image("refresh"); set_size_and_pos(ui_add_to_fav, "add_to_fav"); - ui_add_to_fav->set_image("addtofav.png"); + ui_add_to_fav->set_image("addtofav"); set_size_and_pos(ui_connect, "connect"); - ui_connect->set_image("connect.png"); + ui_connect->set_image("connect"); 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"); + ui_about->set_image("about"); set_size_and_pos(ui_server_list, "server_list"); ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);" @@ -135,7 +135,7 @@ void Lobby::set_widgets() "selection-background-color: rgba(0, 0, 0, 0);"); ui_loading_background->resize(this->width(), this->height()); - ui_loading_background->set_image("loadingbackground.png"); + ui_loading_background->set_image("loadingbackground"); set_size_and_pos(ui_loading_text, "loading_label"); @@ -262,8 +262,8 @@ void Lobby::set_loading_value(int p_value) void Lobby::on_public_servers_clicked() { - ui_public_servers->set_image("publicservers_selected.png"); - ui_favorites->set_image("favorites.png"); + ui_public_servers->set_image("publicservers_selected"); + ui_favorites->set_image("favorites"); list_servers(); @@ -272,8 +272,8 @@ void Lobby::on_public_servers_clicked() void Lobby::on_favorites_clicked() { - ui_favorites->set_image("favorites_selected.png"); - ui_public_servers->set_image("publicservers.png"); + ui_favorites->set_image("favorites_selected"); + ui_public_servers->set_image("publicservers"); ao_app->set_favorite_list(); //ao_app->favorite_list = read_serverlist_txt(); @@ -285,12 +285,12 @@ void Lobby::on_favorites_clicked() void Lobby::on_refresh_pressed() { - ui_refresh->set_image("refresh_pressed.png"); + ui_refresh->set_image("refresh_pressed"); } void Lobby::on_refresh_released() { - ui_refresh->set_image("refresh.png"); + ui_refresh->set_image("refresh"); AOPacket *f_packet = new AOPacket("ALL#%"); @@ -299,12 +299,12 @@ void Lobby::on_refresh_released() void Lobby::on_add_to_fav_pressed() { - ui_add_to_fav->set_image("addtofav_pressed.png"); + ui_add_to_fav->set_image("addtofav_pressed"); } void Lobby::on_add_to_fav_released() { - ui_add_to_fav->set_image("addtofav.png"); + ui_add_to_fav->set_image("addtofav"); //you cant add favorites from favorites m8 if (!public_servers_selected) @@ -315,12 +315,12 @@ void Lobby::on_add_to_fav_released() void Lobby::on_connect_pressed() { - ui_connect->set_image("connect_pressed.png"); + ui_connect->set_image("connect_pressed"); } void Lobby::on_connect_released() { - ui_connect->set_image("connect.png"); + ui_connect->set_image("connect"); AOPacket *f_packet; @@ -416,8 +416,8 @@ void Lobby::on_chatfield_return_pressed() void Lobby::list_servers() { public_servers_selected = true; - ui_favorites->set_image("favorites.png"); - ui_public_servers->set_image("publicservers_selected.png"); + ui_favorites->set_image("favorites"); + ui_public_servers->set_image("publicservers_selected"); ui_server_list->clear(); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 02c0b711..48ebeea9 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -292,6 +292,15 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QStrin return return_value; } +QString AOApplication::get_design_element(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); + return f_result; +} QString AOApplication::get_font_name(QString p_identifier, QString p_file) { QString design_ini_path = get_theme_path(p_file); @@ -501,6 +510,10 @@ QString AOApplication::get_image_suffix(QString path_to_check) return path_to_check + ".png"; } +QString AOApplication::get_static_image_suffix(QString path_to_check) +{ + return path_to_check + ".png"; +} //returns whatever is to the right of "search_line =" within target_tag and terminator_tag, trimmed //returns the empty string if the search line couldnt be found -- cgit From f3c7beab70aeb1e9b1446553c3cb57345a1e5eb7 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 21:10:21 +0300 Subject: Chat arrow indicator to inform you if the current message stopped being processed Can be modified from the theme in chat_arrow of courtroom_design.ini Uses chat_arrow .png/.gif/etc. --- include/courtroom.h | 1 + src/courtroom.cpp | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/courtroom.h b/include/courtroom.h index 9b3c0577..45a3dfd3 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -424,6 +424,7 @@ private: AOEvidenceDisplay *ui_vp_evidence_display; AOImage *ui_vp_chatbox; QLabel *ui_vp_showname; + AOMovie *ui_vp_chat_arrow; QTextEdit *ui_vp_message; AOMovie *ui_vp_realization; AOMovie *ui_vp_testimony; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index cfdc8fbb..b2c98bc0 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -87,6 +87,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_vp_chatbox = new AOImage(this, ao_app); ui_vp_showname = new QLabel(ui_vp_chatbox); ui_vp_showname->setAlignment(Qt::AlignHCenter); + ui_vp_chat_arrow = new AOMovie(ui_vp_chatbox, ao_app); + ui_vp_chat_arrow->set_play_once(false); + ui_vp_message = new QTextEdit(this); ui_vp_message->setFrameStyle(QFrame::NoFrame); ui_vp_message->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -491,6 +494,20 @@ void Courtroom::set_widgets() // ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" // "color: white"); + ui_vp_chat_arrow->move(0, 0); + pos_size_type design_ini_result = ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini"); + + if (design_ini_result.width < 0 || design_ini_result.height < 0) + { + qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; + ui_vp_chat_arrow->hide(); + } + else + { + ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); + ui_vp_chat_arrow->combo_resize(design_ini_result.width, design_ini_result.height); + } + ui_vp_testimony->move(ui_viewport->x(), ui_viewport->y()); ui_vp_testimony->combo_resize(ui_viewport->width(), ui_viewport->height()); @@ -1395,6 +1412,9 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) if (f_message == previous_ic_message) return; + //Stop the chat arrow from animating + ui_vp_chat_arrow->stop(); + text_state = 0; anim_state = 0; ui_vp_objection->stop(); @@ -2302,6 +2322,7 @@ void Courtroom::chat_tick() anim_state = 3; ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); } + ui_vp_chat_arrow->play("chat_arrow"); //Chat stopped being processed, indicate that. } else -- cgit From 13221319b889a48255f8409389ef41f37ee8ac98 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 23:22:34 +0300 Subject: Change get_stylesheet to return text of a parsed stylesheet file, its functionality was transferred to get_tagged_stylesheet Remove some useless/unused ui elements Implement stylesheet for courtrooms in a way that lets the end user modify a lot of its elements Use get_image_suffix for evidence_appear images --- include/aoapplication.h | 6 ++- include/courtroom.h | 9 ++--- src/aoevidencedisplay.cpp | 11 ++---- src/courtroom.cpp | 95 ++++++++++++++------------------------------- src/lobby.cpp | 2 +- src/text_file_functions.cpp | 31 ++++++++++++++- 6 files changed, 72 insertions(+), 82 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 052ad08a..c33130f4 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -259,8 +259,12 @@ public: //Returns a QStringList of all key=value definitions on a given tag. QStringList read_char_ini_tag(QString p_char, QString target_tag); + + //Returns the text between target_tag and terminator_tag in p_file + QString get_stylesheet(QString p_file); + //Returns the text between target_tag and terminator_tag in p_file - QString get_stylesheet(QString target_tag, QString p_file); + QString get_tagged_stylesheet(QString target_tag, QString p_file); //Returns the side of the p_char character from that characters ini file QString get_char_side(QString p_char); diff --git a/include/courtroom.h b/include/courtroom.h index 45a3dfd3..0a7002bc 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -119,16 +119,16 @@ public: void set_widgets(); //sets font size based on theme ini files - void set_font(QWidget *widget, QString p_identifier); + void set_font(QWidget *widget, QString class_name, QString p_identifier); //actual operation of setting the font on a widget - void set_qfont(QWidget *widget, QFont font, QColor f_color = Qt::black, bool bold = false); + void set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color = Qt::black, bool bold = false); //helper function that calls above function on the relevant widgets void set_fonts(); //sets dropdown menu stylesheet - void set_dropdown(QWidget *widget, QString target_tag); + void set_dropdown(QWidget *widget); //helper funciton that call above function on the relevant widgets void set_dropdowns(); @@ -514,9 +514,6 @@ private: AOImage *ui_muted; - QSpinBox *ui_log_limit_spinbox; - QLabel *ui_log_limit_label; - AOButton *ui_evidence_button; AOImage *ui_evidence; AOLineEdit *ui_evidence_name; diff --git a/src/aoevidencedisplay.cpp b/src/aoevidencedisplay.cpp index 9ec105dd..3fde05aa 100644 --- a/src/aoevidencedisplay.cpp +++ b/src/aoevidencedisplay.cpp @@ -32,12 +32,12 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid if (is_left_side) { icon_identifier = "left_evidence_icon"; - gif_name = "evidence_appear_left.gif"; + gif_name = "evidence_appear_left"; } else { icon_identifier = "right_evidence_icon"; - gif_name = "evidence_appear_right.gif"; + gif_name = "evidence_appear_right"; } pos_size_type icon_dimensions = ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini"); @@ -47,8 +47,8 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid 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); + QString f_default_gif_path = ao_app->get_image_suffix(ao_app->get_default_theme_path(gif_name)); + QString f_gif_path = ao_app->get_image_suffix(ao_app->get_theme_path(gif_name)); if (file_exists(f_gif_path)) final_gif_path = f_gif_path; @@ -57,9 +57,6 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid evidence_movie->setFileName(final_gif_path); - if(evidence_movie->frameCount() < 1) - return; - this->setMovie(evidence_movie); evidence_movie->start(); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index b2c98bc0..6c8a9bd6 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -84,7 +84,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_vp_evidence_display = new AOEvidenceDisplay(this, ao_app); - ui_vp_chatbox = new AOImage(this, ao_app); + ui_vp_chatbox = new AOImage(ui_viewport, ao_app); ui_vp_showname = new QLabel(ui_vp_chatbox); ui_vp_showname->setAlignment(Qt::AlignHCenter); ui_vp_chat_arrow = new AOMovie(ui_vp_chatbox, ao_app); @@ -170,8 +170,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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); @@ -251,10 +249,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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); @@ -318,8 +312,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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))); @@ -456,8 +448,6 @@ void Courtroom::set_widgets() // 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()); @@ -594,9 +584,6 @@ void Courtroom::set_widgets() 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"); set_size_and_pos(ui_objection, "objection"); @@ -679,8 +666,6 @@ void Courtroom::set_widgets() 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"); @@ -732,33 +717,22 @@ void Courtroom::set_widgets() ui_char_select_right->set_image("arrow_right"); set_size_and_pos(ui_spectator, "spectator"); - - set_dropdowns(); } 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_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); + set_dropdowns(); } -void Courtroom::set_font(QWidget *widget, QString p_identifier) +void Courtroom::set_font(QWidget *widget, QString class_name, QString p_identifier) { QString design_file = "courtroom_fonts.ini"; int f_weight = ao_app->get_font_size(p_identifier, design_file); @@ -766,41 +740,41 @@ void Courtroom::set_font(QWidget *widget, QString p_identifier) QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? - this->set_qfont(widget, QFont(font_name, f_weight), f_color, bold); + this->set_qfont(widget, class_name, QFont(font_name, f_weight), f_color, bold); } -void Courtroom::set_qfont(QWidget *widget, QFont font, QColor f_color, bool bold) +void Courtroom::set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color, bool bold) { - QString class_name = widget->metaObject()->className(); + if(class_name == "") + class_name = widget->metaObject()->className(); widget->setFont(font); QString is_bold = ""; - if(bold) is_bold = "bold"; + if(bold) is_bold = "font: bold;"; 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);\n" - "font: " + is_bold + "; }"; - + QString::number(f_color.blue()) + ", 255);\n" + is_bold + "}"; widget->setStyleSheet(style_sheet_string); } -void Courtroom::set_dropdown(QWidget *widget, QString target_tag) +void Courtroom::set_dropdown(QWidget *widget) { QString f_file = "courtroom_stylesheets.css"; - QString style_sheet_string = ao_app->get_stylesheet(target_tag, f_file); + QString style_sheet_string = ao_app->get_stylesheet(f_file); if (style_sheet_string != "") widget->setStyleSheet(style_sheet_string); } void Courtroom::set_dropdowns() { - set_dropdown(ui_text_color, "[TEXT COLOR]"); - set_dropdown(ui_pos_dropdown, "[POS DROPDOWN]"); - set_dropdown(ui_emote_dropdown, "[EMOTE DROPDOWN]"); - set_dropdown(ui_mute_list, "[MUTE LIST]"); + set_dropdown(this); //EXPERIMENTAL - Read the style-sheet as-is for maximum memeage +// set_dropdown(ui_text_color, "[TEXT COLOR]"); +// set_dropdown(ui_pos_dropdown, "[POS DROPDOWN]"); +// set_dropdown(ui_emote_dropdown, "[EMOTE DROPDOWN]"); +// set_dropdown(ui_mute_list, "[MUTE LIST]"); } void Courtroom::set_window_title(QString p_title) @@ -903,7 +877,7 @@ void Courtroom::set_background(QString p_background) } void Courtroom::enter_courtroom(int p_cid) -{ +{ m_cid = p_cid; QString f_char; @@ -1322,9 +1296,7 @@ void Courtroom::on_chat_return_pressed() if (ao_app->looping_sfx_support_enabled) { packet_contents.append("0"); //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; QString pre_emote = ao_app->get_pre_emote(current_char, current_emote); QString emote = ao_app->get_emote(current_char, current_emote); @@ -1345,7 +1317,6 @@ void Courtroom::on_chat_return_pressed() } packet += "^"; } - qDebug() << f_effect << "packet" << packet; packet_contents.append(packet); } } @@ -1544,11 +1515,8 @@ void Courtroom::handle_chatmessage_2() QFontMetrics fm(ui_vp_showname->font()); int fm_width=fm.horizontalAdvance(ui_vp_showname->text()); - qDebug() << "showname shenanigans" << ui_vp_showname->width() << fm_width << ui_vp_showname->text(); - QString chatbox_path = ao_app->get_theme_path("chat"); QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); - qDebug() << chatbox; if (chatbox != "") { chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat"; @@ -1556,12 +1524,9 @@ void Courtroom::handle_chatmessage_2() pos_size_type default_width = ao_app->get_element_dimensions("showname", "courtroom_design.ini"); int extra_width = ao_app->get_design_element("showname_extra_width", "courtroom_design.ini").toInt(); - qDebug() << extra_width; if(extra_width > 0) { - qDebug() << default_width.width << chatbox_path; - if (fm_width > default_width.width && ui_vp_chatbox->set_chatbox(chatbox_path + "med")) //This text be big. Let's do some shenanigans. { ui_vp_showname->resize(default_width.width+extra_width, ui_vp_showname->height()); @@ -1591,9 +1556,7 @@ void Courtroom::handle_chatmessage_2() int chatsize = ao_app->get_chat_size(m_chatmessage[CHAR_NAME]); if (chatsize != -1) f_weight = chatsize; - this->set_qfont(ui_vp_message, QFont(font_name, f_weight), f_color, bold); - - ui_vp_showname->setStyleSheet("QLabel { color : " + get_text_color("_showname").name() + "; }"); + this->set_qfont(ui_vp_message, "", QFont(font_name, f_weight), f_color, bold); set_scene(); set_text_color(); @@ -1866,7 +1829,7 @@ void Courtroom::handle_chatmessage_3() ui_vp_legacy_desk->hide(); // Since we're zooming, hide the second character, and centre the first. - ui_vp_sideplayer_char->hide(); + ui_vp_sideplayer_char->hide(); ui_vp_player_char->move(0,0); if (side == "pro" || @@ -2960,7 +2923,7 @@ void Courtroom::on_ooc_return_pressed() { ui_ooc_chat_message->clear(); ooc_message.remove(0,6); - + bool ok; int whom = ooc_message.toInt(&ok); if (ok) @@ -2989,7 +2952,7 @@ void Courtroom::on_ooc_return_pressed() { ui_ooc_chat_message->clear(); ooc_message.remove(0,8); - + bool ok; int off = ooc_message.toInt(&ok); if (ok) @@ -3651,7 +3614,7 @@ void Courtroom::on_change_character_clicked() } void Courtroom::on_reload_theme_clicked() -{ +{ ao_app->reload_theme(); //to update status on the background diff --git a/src/lobby.cpp b/src/lobby.cpp index b8e3efdb..963ed44f 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -190,7 +190,7 @@ void Lobby::set_fonts() void Lobby::set_stylesheet(QWidget *widget, QString target_tag) { QString f_file = "lobby_stylesheets.css"; - QString style_sheet_string = ao_app->get_stylesheet(target_tag, f_file); + QString style_sheet_string = ao_app->get_tagged_stylesheet(target_tag, f_file); if (style_sheet_string != "") widget->setStyleSheet(style_sheet_string); } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 48ebeea9..a70fdc50 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -359,7 +359,36 @@ QColor AOApplication::get_color(QString p_identifier, QString p_file) return return_color; } -QString AOApplication::get_stylesheet(QString target_tag, QString p_file) +QString AOApplication::get_stylesheet(QString p_file) +{ + QString design_ini_path = get_theme_path(p_file); + QString default_path = get_default_theme_path(p_file); + + QFile design_ini; + + design_ini.setFileName(design_ini_path); + + if(!design_ini.open(QIODevice::ReadOnly)) + { + design_ini.setFileName(default_path); + if(!design_ini.open(QIODevice::ReadOnly)) + return ""; + } + + QTextStream in(&design_ini); + + QString f_text; + + while(!in.atEnd()) + { + f_text.append(in.readLine()); + } + + design_ini.close(); + return f_text; +} + +QString AOApplication::get_tagged_stylesheet(QString target_tag, QString p_file) { QString design_ini_path = get_theme_path(p_file); -- cgit From 19ff6cd5f8a74188d65aa0a0ffaf2827f6471586 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 23:53:32 +0300 Subject: Fix an incredibly obscure bug where if the viewport message is inside the viewport itself it would not let you scroll it up should the message be too long. --- src/courtroom.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 6c8a9bd6..08ece887 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2231,6 +2231,7 @@ void Courtroom::start_chat_ticking() ui_vp_chatbox->show(); ui_vp_message->show(); + ui_vp_message->raise(); //So you can scroll it if (!is_additive) { -- cgit From 684e26cb776b143175590845c77813763927e759 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 16 Sep 2019 23:54:42 +0300 Subject: Change the way sideplayer/playerchar ordering works to be stackUnder instead of Raise so it doesn't break anything (like the chatbox) --- src/courtroom.cpp | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 08ece887..f01c1780 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1635,16 +1635,12 @@ void Courtroom::handle_chatmessage_2() // 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(); + ui_vp_sideplayer_char->stackUnder(ui_vp_player_char); } else { - ui_vp_player_char->raise(); - ui_vp_sideplayer_char->raise(); + ui_vp_player_char->stackUnder(ui_vp_sideplayer_char); } - ui_vp_desk->raise(); - ui_vp_legacy_desk->raise(); } else if (side == "pro") { @@ -1668,18 +1664,14 @@ void Courtroom::handle_chatmessage_2() ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100); // Finally, we reorder them based on who is more to the right. - if (hor2_offset <= hor_offset) + if (hor2_offset >= hor_offset) { - ui_vp_sideplayer_char->raise(); - ui_vp_player_char->raise(); + ui_vp_sideplayer_char->stackUnder(ui_vp_player_char); } else { - ui_vp_player_char->raise(); - ui_vp_sideplayer_char->raise(); + ui_vp_player_char->stackUnder(ui_vp_sideplayer_char); } - ui_vp_desk->raise(); - ui_vp_legacy_desk->raise(); } else { @@ -1696,16 +1688,12 @@ void Courtroom::handle_chatmessage_2() // 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(); + ui_vp_sideplayer_char->stackUnder(ui_vp_player_char); } else { - ui_vp_player_char->raise(); - ui_vp_sideplayer_char->raise(); + ui_vp_player_char->stackUnder(ui_vp_sideplayer_char); } - 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) -- cgit From 9695c621c23e3ebe1fded621c13eaea75bfc4372 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 17 Sep 2019 00:56:39 +0300 Subject: so this solution doesn't really work. It makes the chat message box appear over the character select screen. this bug only occurs when the chat box is initialized inside the viewport. Annoying as hell but at least it can be reproduced reliably. --- src/courtroom.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index f01c1780..3f06b796 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2219,7 +2219,6 @@ void Courtroom::start_chat_ticking() ui_vp_chatbox->show(); ui_vp_message->show(); - ui_vp_message->raise(); //So you can scroll it if (!is_additive) { -- cgit From 6747bfdd5edee3693144c088ad1e732b5748fb8b Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 17 Sep 2019 03:31:18 +0300 Subject: Allow lobby server descriptions to parse links Fix bad reference to ui_emote_right image Fix chatbox being part of the viewport (gets cut off if it's outside) --- include/aotextarea.h | 1 + src/aotextarea.cpp | 6 ++++++ src/courtroom.cpp | 4 ++-- src/lobby.cpp | 3 ++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/aotextarea.h b/include/aotextarea.h index 266b7222..13b29c9e 100644 --- a/include/aotextarea.h +++ b/include/aotextarea.h @@ -12,6 +12,7 @@ class AOTextArea : public QTextBrowser public: AOTextArea(QWidget *p_parent = nullptr); + void append_linked(QString p_message); void append_chatmessage(QString p_name, QString p_message, QString p_colour); void append_error(QString p_message); diff --git a/src/aotextarea.cpp b/src/aotextarea.cpp index f9d21e6e..a34bb1a6 100644 --- a/src/aotextarea.cpp +++ b/src/aotextarea.cpp @@ -5,6 +5,12 @@ AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) } +void AOTextArea::append_linked(QString p_message) +{ + QString result = p_message.toHtmlEscaped().replace("\n", "
").replace(url_parser_regex, "\\1" ); + this->insertHtml(result); +} + void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p_colour) { const QTextCursor old_cursor = this->textCursor(); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3f06b796..a179fb88 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -84,7 +84,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_vp_evidence_display = new AOEvidenceDisplay(this, ao_app); - ui_vp_chatbox = new AOImage(ui_viewport, ao_app); + ui_vp_chatbox = new AOImage(this, ao_app); ui_vp_showname = new QLabel(ui_vp_chatbox); ui_vp_showname->setAlignment(Qt::AlignHCenter); ui_vp_chat_arrow = new AOMovie(ui_vp_chatbox, ao_app); @@ -566,7 +566,7 @@ void Courtroom::set_widgets() ui_emote_left->set_image("arrow_left"); set_size_and_pos(ui_emote_right, "emote_right"); - ui_emote_right->set_image("arrow_right."); + ui_emote_right->set_image("arrow_right"); set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); diff --git a/src/lobby.cpp b/src/lobby.cpp index 963ed44f..79f18e52 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -23,6 +23,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() ui_server_list = new QListWidget(this); ui_player_count = new QLabel(this); ui_description = new AOTextArea(this); + ui_description->setOpenExternalLinks(true); ui_chatbox = new AOTextArea(this); ui_chatbox->setOpenExternalLinks(true); ui_chatname = new QLineEdit(this); @@ -376,7 +377,7 @@ void Lobby::on_server_list_clicked(QModelIndex p_model) } ui_description->clear(); - ui_description->append(f_server.desc); + ui_description->append_linked(f_server.desc); ui_description->moveCursor(QTextCursor::Start); ui_description->ensureCursorVisible(); -- cgit From 9d20cf03222add2ef04d4d2cc305458bdf00fcad Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 17 Sep 2019 18:51:40 +0300 Subject: Streamlined ini swapping so the user can set up multiple character folders associated with a character. This will save to the character folder's iniswaps.ini. You can click on the dropdown and edit the text inside to add an iniswap, and press the [X] button that'll appear next to it to remove the ini swap. Recode the enter_courtroom and add a new update_character feature - the two are now separate and responsible for different things. The courtroom will reload the whole theme and widgets while the character is only responsible for all ui elements related to the character. This drastically improves performance when switching characters using /switch or something Add a set_char_ini helper function that allows you to modify the character variables. For now only used to set name= field when iniswapping --- include/aoapplication.h | 5 ++ include/courtroom.h | 12 ++++- src/charselect.cpp | 10 ++-- src/courtroom.cpp | 120 +++++++++++++++++++++++++++++++++++++------- src/packet_distribution.cpp | 2 +- src/text_file_functions.cpp | 21 ++++++-- 6 files changed, 141 insertions(+), 29 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index c33130f4..f26c8161 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -202,6 +202,9 @@ public: //Returns the list of words in callwords.ini QStringList get_call_words(); + //returns all of the file's lines in a QStringList + QStringList get_list_file(QString p_file); + //Process a file and return its text as a QString QString read_file(QString filename); @@ -259,6 +262,8 @@ public: //Returns a QStringList of all key=value definitions on a given tag. QStringList read_char_ini_tag(QString p_char, QString target_tag); + //Sets the char.ini p_search_line key under tag target_tag to value. + void set_char_ini(QString p_char, QString value, QString p_search_line, QString target_tag); //Returns the text between target_tag and terminator_tag in p_file QString get_stylesheet(QString p_file); diff --git a/include/courtroom.h b/include/courtroom.h index 0a7002bc..91f1f9ac 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -184,8 +184,11 @@ public: QString get_current_char() {return current_char;} QString get_current_background() {return current_background;} + //updates character to p_cid and updates necessary ui elements + void update_character(int p_cid); + //properly sets up some varibles: resets user state - void enter_courtroom(int p_cid); + void enter_courtroom(); //helper function that populates ui_music_list with the contents of music_list void list_music(); @@ -461,6 +464,9 @@ private: QComboBox *ui_emote_dropdown; QComboBox *ui_pos_dropdown; + QComboBox *ui_iniswap_dropdown; + AOButton *ui_iniswap_remove; + AOImage *ui_defense_bar; AOImage *ui_prosecution_bar; @@ -602,6 +608,10 @@ private slots: void on_emote_dropdown_changed(int p_index); void on_pos_dropdown_changed(int p_index); + void on_iniswap_dropdown_changed(int p_index); + + void set_iniswap_dropdown(); + void on_iniswap_remove_clicked(); void on_evidence_name_edited(QString text); void on_evidence_image_name_edited(); diff --git a/src/charselect.cpp b/src/charselect.cpp index 23b05134..972a17a3 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -64,7 +64,7 @@ void Courtroom::set_char_select() if (f_charselect.width < 0 || f_charselect.height < 0) { - qDebug() << "W: did not find courtroom width or height in courtroom_design.ini!"; + qDebug() << "W: did not find char_select width or height in courtroom_design.ini!"; this->resize(714, 668); } else @@ -129,15 +129,13 @@ void Courtroom::char_clicked(int n_char) return; } - if (n_char == m_cid) - { - enter_courtroom(m_cid); - } - else + if (n_char != m_cid) { 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() + "#%")); } + update_character(n_char); + enter_courtroom(); ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index a179fb88..2b8f218a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -163,6 +163,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_pos_dropdown->addItem("jur"); ui_pos_dropdown->addItem("sea"); + ui_iniswap_dropdown = new QComboBox(this); + ui_iniswap_remove = new AOButton(this, ao_app); + ui_defense_bar = new AOImage(this, ao_app); ui_prosecution_bar = new AOImage(this, ao_app); @@ -282,6 +285,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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_iniswap_dropdown, SIGNAL(activated(int)), this, SLOT(on_iniswap_dropdown_changed(int))); + connect(ui_iniswap_remove, SIGNAL(clicked()), this, SLOT(on_iniswap_remove_clicked())); + 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())); @@ -571,6 +577,13 @@ void Courtroom::set_widgets() set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); + set_size_and_pos(ui_iniswap_dropdown, "iniswap_dropdown"); + ui_iniswap_dropdown->setEditable(true); + ui_iniswap_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); + set_size_and_pos(ui_iniswap_remove, "iniswap_remove"); +// ui_iniswap_remove->setText("X"); + ui_iniswap_remove->set_image("evidencex"); + set_size_and_pos(ui_defense_bar, "defense_bar"); ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state)); @@ -585,10 +598,15 @@ void Courtroom::set_widgets() ui_blip_label->setText(tr("Blips")); set_size_and_pos(ui_hold_it, "hold_it"); +// ui_hold_it->setText(tr("Hold It!")); ui_hold_it->set_image("holdit"); + set_size_and_pos(ui_objection, "objection"); +// ui_objection->setText(tr("Objection!")); ui_objection->set_image("objection"); + set_size_and_pos(ui_take_that, "take_that"); +// ui_take_that->setText(tr("Take That!")); ui_take_that->set_image("takethat"); set_size_and_pos(ui_ooc_toggle, "ooc_toggle"); @@ -876,8 +894,10 @@ void Courtroom::set_background(QString p_background) } } -void Courtroom::enter_courtroom(int p_cid) +void Courtroom::update_character(int p_cid) { + bool newchar = m_cid != p_cid; + m_cid = p_cid; QString f_char; @@ -909,11 +929,6 @@ void Courtroom::enter_courtroom(int p_cid) set_emote_page(); set_emote_dropdown(); - current_evidence_page = 0; - current_evidence = 0; - - set_evidence_page(); - QString side = ao_app->get_char_side(f_char); if (side == "jud") @@ -947,6 +962,21 @@ void Courtroom::enter_courtroom(int p_cid) else ui_custom_objection->hide(); + ui_char_select_background->hide(); + ui_ic_chat_message->setEnabled(m_cid != -1); + ui_ic_chat_message->setFocus(); + + if (newchar) + set_iniswap_dropdown(); +} + +void Courtroom::enter_courtroom() +{ + current_evidence_page = 0; + current_evidence = 0; + + set_evidence_page(); + if (ao_app->flipping_enabled) ui_flip->show(); else @@ -975,11 +1005,6 @@ void Courtroom::enter_courtroom(int p_cid) 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() @@ -3224,6 +3249,70 @@ void Courtroom::on_pos_dropdown_changed(int p_index) ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/pos " + f_pos + "#%")); } +void Courtroom::set_iniswap_dropdown() +{ + ui_iniswap_dropdown->clear(); + if (m_cid == -1) + { + ui_iniswap_dropdown->hide(); + return; + } + QStringList iniswaps = ao_app->get_list_file(ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")); + iniswaps.prepend(char_list.at(m_cid).name); + if (iniswaps.size() <= 0) + { + ui_iniswap_dropdown->hide(); + return; + } + ui_iniswap_dropdown->show(); + ui_iniswap_dropdown->addItems(iniswaps); + + for (int i = 0; i < iniswaps.size(); ++i) + { + if (iniswaps.at(i) == current_char) + { + ui_iniswap_dropdown->setCurrentIndex(i); + if (i != 0) + ui_iniswap_remove->show(); + else + ui_iniswap_remove->hide(); + break; + } + } +} + +void Courtroom::on_iniswap_dropdown_changed(int p_index) +{ + ui_ic_chat_message->setFocus(); + QString iniswap = ui_iniswap_dropdown->itemText(p_index); + ao_app->set_char_ini(char_list.at(m_cid).name, iniswap, "name", "Options"); + + QStringList swaplist; + for (int i = 0; i < ui_iniswap_dropdown->count(); ++i) + { + QString entry = ui_iniswap_dropdown->itemText(i); + if (!swaplist.contains(entry) && entry != char_list.at(m_cid).name) + swaplist.append(entry); + } + ao_app->write_to_file(swaplist.join("\n"), ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")); + ui_iniswap_dropdown->setCurrentIndex(p_index); + update_character(m_cid); + if (p_index != 0) + ui_iniswap_remove->show(); + else + ui_iniswap_remove->hide(); +} + +void Courtroom::on_iniswap_remove_clicked() +{ + if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) != char_list.at(m_cid).name) + { + ui_iniswap_dropdown->removeItem(ui_iniswap_dropdown->currentIndex()); + on_iniswap_dropdown_changed(0); //Reset back to original + update_character(m_cid); + } +} + void Courtroom::on_mute_list_clicked(QModelIndex p_index) { QListWidgetItem *f_item = ui_mute_list->item(p_index.row()); @@ -3607,7 +3696,8 @@ void Courtroom::on_reload_theme_clicked() //to update status on the background set_background(current_background); - enter_courtroom(m_cid); + update_character(m_cid); + enter_courtroom(); anim_state = 4; text_state = 3; @@ -3633,11 +3723,7 @@ void Courtroom::on_char_select_right_clicked() void Courtroom::on_spectator_clicked() { - enter_courtroom(-1); - - ui_emotes->hide(); - - ui_char_select_background->hide(); + update_character(-1); } void Courtroom::on_call_mod_clicked() diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index ff43f273..9eea1797 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -601,7 +601,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) goto end; if (courtroom_constructed) - w_courtroom->enter_courtroom(f_contents.at(2).toInt()); + w_courtroom->update_character(f_contents.at(2).toInt()); } else if (header == "MS") { diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index a70fdc50..f22bc748 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -74,17 +74,22 @@ QString AOApplication::get_audio_output_device() } QStringList AOApplication::get_call_words() +{ + return get_list_file(get_base_path() + "callwords.ini"); +} + +QStringList AOApplication::get_list_file(QString p_file) { QStringList return_value; - QFile callwords_ini; + QFile p_ini; - callwords_ini.setFileName(get_base_path() + "callwords.ini"); + p_ini.setFileName(p_file); - if (!callwords_ini.open(QIODevice::ReadOnly)) + if (!p_ini.open(QIODevice::ReadOnly)) return return_value; - QTextStream in(&callwords_ini); + QTextStream in(&p_ini); while (!in.atEnd()) { @@ -555,6 +560,14 @@ QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QStr return value; } +void AOApplication::set_char_ini(QString p_char, QString value, QString p_search_line, QString target_tag) +{ + QSettings settings(get_character_path(p_char, "char.ini"), QSettings::IniFormat); + settings.beginGroup(target_tag); + settings.setValue(p_search_line, value); + settings.endGroup(); +} + //returns all the values of target_tag QStringList AOApplication::read_char_ini_tag(QString p_char, QString target_tag) { -- cgit From 8409b71611d8c213fd7286359d4404f2a181e59b Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 17 Sep 2019 21:17:30 +0300 Subject: Tool tips! Tool tips for everyone! Change the way AOButton loads images into itself (stylesheet broke tooltips) --- src/aobutton.cpp | 16 +++++++++++++-- src/courtroom.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 70 insertions(+), 6 deletions(-) diff --git a/src/aobutton.cpp b/src/aobutton.cpp index 1459729f..d80226f2 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -19,8 +19,20 @@ void AOButton::set_image(QString p_image) QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); if (file_exists(image_path)) - this->setStyleSheet("border-image:url(\"" + image_path + "\")"); + { + this->setIcon(QIcon(image_path)); + this->setIconSize(this->size()); + this->setStyleSheet("border:0px"); + this->setText(""); + } + else if (file_exists(default_image_path)) + { + this->setIcon(QIcon(default_image_path)); + this->setIconSize(this->size()); + this->setStyleSheet("border:0px"); + this->setText(""); + } else - this->setStyleSheet("border-image:url(\"" + default_image_path + "\")"); + return; } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 2b8f218a..a160703c 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -527,10 +527,13 @@ void Courtroom::set_widgets() set_size_and_pos(ui_pair_list, "pair_list"); ui_pair_list->hide(); + ui_pair_list->setToolTip(tr("Select a character you wish to pair with.")); set_size_and_pos(ui_pair_offset_spinbox, "pair_offset_spinbox"); ui_pair_offset_spinbox->hide(); + ui_pair_offset_spinbox->setToolTip(tr("Change the percentage offset of your character's position from the center of the screen.")); set_size_and_pos(ui_pair_button, "pair_button"); ui_pair_button->set_image("pair_button"); + ui_pair_button->setToolTip(tr("Display the list of characters to pair with.")); set_size_and_pos(ui_area_list, "music_list"); set_size_and_pos(ui_music_list, "music_list"); @@ -556,12 +559,15 @@ void Courtroom::set_widgets() ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); ui_muted->set_image("muted"); + ui_muted->setToolTip(tr("Oops, you're muted!")); set_size_and_pos(ui_ooc_chat_message, "ooc_chat_message"); ui_ooc_chat_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); + ui_ooc_chat_message->setToolTip(tr("Type your message to display in the server chat here.")); set_size_and_pos(ui_ooc_chat_name, "ooc_chat_name"); ui_ooc_chat_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); + ui_ooc_chat_name->setToolTip(tr("Set your name to display in the server chat.")); //set_size_and_pos(ui_area_password, "area_password"); set_size_and_pos(ui_music_search, "music_search"); @@ -576,13 +582,18 @@ void Courtroom::set_widgets() set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); + ui_pos_dropdown->setToolTip(tr("Set your character's supplementary background.")); set_size_and_pos(ui_iniswap_dropdown, "iniswap_dropdown"); ui_iniswap_dropdown->setEditable(true); ui_iniswap_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); + ui_iniswap_dropdown->setToolTip(tr("Set an 'iniswap', or an alternative character folder to refer to from your current character." + "This information is saved to your base/characters//iniswaps.ini")); + set_size_and_pos(ui_iniswap_remove, "iniswap_remove"); -// ui_iniswap_remove->setText("X"); + ui_iniswap_remove->setText("X"); ui_iniswap_remove->set_image("evidencex"); + ui_iniswap_remove->setToolTip(tr("Remove the currently selected iniswap from the list and return to the original character folder.")); set_size_and_pos(ui_defense_bar, "defense_bar"); ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state)); @@ -598,19 +609,23 @@ void Courtroom::set_widgets() ui_blip_label->setText(tr("Blips")); set_size_and_pos(ui_hold_it, "hold_it"); -// ui_hold_it->setText(tr("Hold It!")); + ui_hold_it->setText(tr("Hold It!")); + ui_hold_it->setToolTip(tr("When this is turned on, your next in-character message will be a shout!")); ui_hold_it->set_image("holdit"); set_size_and_pos(ui_objection, "objection"); -// ui_objection->setText(tr("Objection!")); + ui_objection->setText(tr("Objection!")); + ui_objection->setToolTip(tr("When this is turned on, your next in-character message will be a shout!")); ui_objection->set_image("objection"); set_size_and_pos(ui_take_that, "take_that"); -// ui_take_that->setText(tr("Take That!")); + ui_take_that->setText(tr("Take That!")); + ui_take_that->setToolTip(tr("When this is turned on, your next in-character message will be a shout!")); ui_take_that->set_image("takethat"); set_size_and_pos(ui_ooc_toggle, "ooc_toggle"); ui_ooc_toggle->setText(tr("Server")); + ui_ooc_toggle->setToolTip(tr("Toggle between server chat and global AO2 chat.")); set_size_and_pos(ui_witness_testimony, "witness_testimony"); ui_witness_testimony->set_image("witnesstestimony"); @@ -618,67 +633,101 @@ void Courtroom::set_widgets() ui_cross_examination->set_image("crossexamination"); set_size_and_pos(ui_guilty, "guilty"); + ui_guilty->setText(tr("Guilty!")); ui_guilty->set_image("guilty"); + ui_guilty->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); set_size_and_pos(ui_not_guilty, "not_guilty"); ui_not_guilty->set_image("notguilty"); + ui_not_guilty->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); set_size_and_pos(ui_change_character, "change_character"); ui_change_character->setText(tr("Change character")); + ui_change_character->set_image("change_character"); + ui_change_character->setToolTip(tr("Bring up the Character Select Screen and change your character.")); set_size_and_pos(ui_reload_theme, "reload_theme"); ui_reload_theme->setText(tr("Reload theme")); + ui_reload_theme->set_image("reload_theme"); + ui_reload_theme->setToolTip(tr("Refresh the theme and update all of the ui elements to match.")); set_size_and_pos(ui_call_mod, "call_mod"); ui_call_mod->setText(tr("Call mod")); + ui_call_mod->set_image("call_mod"); + ui_call_mod->setToolTip(tr("Request the attention of the current server's moderator.")); set_size_and_pos(ui_settings, "settings"); ui_settings->setText(tr("Settings")); + ui_settings->set_image("settings"); + ui_settings->setToolTip(tr("Allows you to change various aspects of the client.")); set_size_and_pos(ui_announce_casing, "casing_button"); ui_announce_casing->setText(tr("Casing")); + ui_announce_casing->set_image("casing_button"); + ui_announce_casing->setToolTip(tr("uhhhhh")); set_size_and_pos(ui_switch_area_music, "switch_area_music"); ui_switch_area_music->setText(tr("A/M")); + ui_switch_area_music->set_image("switch_area_music"); + ui_switch_area_music->setToolTip(tr("Switch between Areas and Music lists")); set_size_and_pos(ui_pre, "pre"); ui_pre->setText(tr("Preanim")); + ui_pre->setToolTip(tr("Play a single-shot animation as defined by the emote when checked.")); set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); + ui_pre_non_interrupt->setToolTip(tr("If preanim is checked, display the input text immediately as the animation plays concurrently.")); + set_size_and_pos(ui_flip, "flip"); + ui_flip->setToolTip(tr("Mirror your character's emotes when checked.")); set_size_and_pos(ui_additive, "additive"); + ui_additive->setToolTip(tr("Add text to your last spoken message when checked.")); set_size_and_pos(ui_guard, "guard"); + ui_additive->setToolTip(tr("Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window.")); set_size_and_pos(ui_casing, "casing"); + ui_casing->setToolTip(tr("((((((Case?))))))")); set_size_and_pos(ui_showname_enable, "showname_enable"); + ui_showname_enable->setToolTip(tr("Display customized shownames for all users when checked.")); set_size_and_pos(ui_custom_objection, "custom_objection"); + ui_custom_objection->setText(tr("Custom Shout!")); ui_custom_objection->set_image("custom"); + ui_custom_objection->setToolTip(tr("This will display the custom character-defined animation in the viewport as soon as it is pressed.")); set_size_and_pos(ui_realization, "realization"); ui_realization->set_image("realization"); + ui_realization->setToolTip(tr("Play realization sound and animation in the viewport on the next spoken message when checked.")); set_size_and_pos(ui_screenshake, "screenshake"); ui_screenshake->set_image("screenshake"); + ui_screenshake->setToolTip(tr("Shake the screen on next spoken message when checked.")); set_size_and_pos(ui_mute, "mute_button"); + ui_mute->setText("Mute"); ui_mute->set_image("mute"); + ui_mute->setToolTip(tr("Display the list of character folders you wish to mute.")); set_size_and_pos(ui_defense_plus, "defense_plus"); ui_defense_plus->set_image("defplus"); + ui_defense_plus->setToolTip(tr("Increase the health bar.")); set_size_and_pos(ui_defense_minus, "defense_minus"); ui_defense_minus->set_image("defminus"); + ui_defense_minus->setToolTip(tr("Decrease the health bar.")); set_size_and_pos(ui_prosecution_plus, "prosecution_plus"); ui_prosecution_plus->set_image("proplus"); + ui_prosecution_plus->setToolTip(tr("Increase the health bar.")); set_size_and_pos(ui_prosecution_minus, "prosecution_minus"); ui_prosecution_minus->set_image("prominus"); + ui_prosecution_minus->setToolTip(tr("Decrease the health bar.")); set_size_and_pos(ui_text_color, "text_color"); + ui_text_color->setToolTip(tr("Change the text color of the spoken message.")); set_size_and_pos(ui_music_slider, "music_slider"); set_size_and_pos(ui_sfx_slider, "sfx_slider"); @@ -686,6 +735,7 @@ void Courtroom::set_widgets() set_size_and_pos(ui_evidence_button, "evidence_button"); ui_evidence_button->set_image("evidencebutton"); + ui_evidence_button->setToolTip(tr("Bring up the Evidence screen.")); set_size_and_pos(ui_evidence, "evidence_background"); ui_evidence->set_image("evidencebackground"); @@ -723,6 +773,7 @@ void Courtroom::set_widgets() set_size_and_pos(ui_back_to_lobby, "back_to_lobby"); ui_back_to_lobby->setText(tr("Back to Lobby")); + ui_back_to_lobby->setToolTip(tr("Return back to the server list.")); set_size_and_pos(ui_char_password, "char_password"); @@ -735,6 +786,7 @@ void Courtroom::set_widgets() ui_char_select_right->set_image("arrow_right"); set_size_and_pos(ui_spectator, "spectator"); + ui_spectator->setToolTip(tr("Become a spectator. You won't be able to interact with the in-character screen.")); } void Courtroom::set_fonts() -- cgit From e151964785301269500b96ecfd25dbdf227f55f8 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 17 Sep 2019 23:50:01 +0300 Subject: Add a sfx list that allows you to choose custom sfx from a list. Allows the same amount of customization as the iniswap list. It tries to read soundlist.ini in the character folder first. If it can't find it, it will fall back to the theme's character_soundlist.ini. It will only save the soundlist.ini if it differs from the character.soundlist.ini. There is currently no way to dynamically change sound delay atm but the function for it is there. Add more tooltips, my favorite! --- include/courtroom.h | 12 +++++- src/courtroom.cpp | 120 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 126 insertions(+), 6 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 91f1f9ac..8d1588e9 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -467,6 +467,9 @@ private: QComboBox *ui_iniswap_dropdown; AOButton *ui_iniswap_remove; + QComboBox *ui_sfx_dropdown; + AOButton *ui_sfx_remove; + AOImage *ui_defense_bar; AOImage *ui_prosecution_bar; @@ -608,11 +611,18 @@ private slots: void on_emote_dropdown_changed(int p_index); void on_pos_dropdown_changed(int p_index); - void on_iniswap_dropdown_changed(int p_index); + void on_iniswap_dropdown_changed(int p_index); void set_iniswap_dropdown(); void on_iniswap_remove_clicked(); + void on_sfx_dropdown_changed(int p_index); + void set_sfx_dropdown(); + void on_sfx_remove_clicked(); + + QString get_char_sfx(); + int get_char_sfx_delay(); + void on_evidence_name_edited(QString text); void on_evidence_image_name_edited(); void on_evidence_image_button_clicked(); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index a160703c..7ece780e 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -166,6 +166,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_iniswap_dropdown = new QComboBox(this); ui_iniswap_remove = new AOButton(this, ao_app); + ui_sfx_dropdown = new QComboBox(this); + ui_sfx_remove = new AOButton(this, ao_app); + ui_defense_bar = new AOImage(this, ao_app); ui_prosecution_bar = new AOImage(this, ao_app); @@ -288,6 +291,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_iniswap_dropdown, SIGNAL(activated(int)), this, SLOT(on_iniswap_dropdown_changed(int))); connect(ui_iniswap_remove, SIGNAL(clicked()), this, SLOT(on_iniswap_remove_clicked())); + connect(ui_sfx_dropdown, SIGNAL(activated(int)), this, SLOT(on_sfx_dropdown_changed(int))); + connect(ui_sfx_remove, SIGNAL(clicked()), this, SLOT(on_sfx_remove_clicked())); + 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())); @@ -587,7 +593,7 @@ void Courtroom::set_widgets() set_size_and_pos(ui_iniswap_dropdown, "iniswap_dropdown"); ui_iniswap_dropdown->setEditable(true); ui_iniswap_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); - ui_iniswap_dropdown->setToolTip(tr("Set an 'iniswap', or an alternative character folder to refer to from your current character." + ui_iniswap_dropdown->setToolTip(tr("Set an 'iniswap', or an alternative character folder to refer to from your current character.\n" "This information is saved to your base/characters//iniswaps.ini")); set_size_and_pos(ui_iniswap_remove, "iniswap_remove"); @@ -595,6 +601,17 @@ void Courtroom::set_widgets() ui_iniswap_remove->set_image("evidencex"); ui_iniswap_remove->setToolTip(tr("Remove the currently selected iniswap from the list and return to the original character folder.")); + set_size_and_pos(ui_sfx_dropdown, "sfx_dropdown"); + ui_sfx_dropdown->setEditable(true); + ui_sfx_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); + ui_sfx_dropdown->setToolTip(tr("Set an 'iniswap', or an alternative character folder to refer to from your current character.\n" + "This information is saved to your base/characters//iniswaps.ini")); + + set_size_and_pos(ui_sfx_remove, "sfx_remove"); + ui_sfx_remove->setText("X"); + ui_sfx_remove->set_image("evidencex"); + ui_sfx_remove->setToolTip(tr("Remove the currently selected iniswap from the list and return to the original character folder.")); + set_size_and_pos(ui_defense_bar, "defense_bar"); ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state)); @@ -629,8 +646,10 @@ void Courtroom::set_widgets() set_size_and_pos(ui_witness_testimony, "witness_testimony"); ui_witness_testimony->set_image("witnesstestimony"); + ui_witness_testimony->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); set_size_and_pos(ui_cross_examination, "cross_examination"); ui_cross_examination->set_image("crossexamination"); + ui_cross_examination->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); set_size_and_pos(ui_guilty, "guilty"); ui_guilty->setText(tr("Guilty!")); @@ -663,7 +682,7 @@ void Courtroom::set_widgets() set_size_and_pos(ui_announce_casing, "casing_button"); ui_announce_casing->setText(tr("Casing")); ui_announce_casing->set_image("casing_button"); - ui_announce_casing->setToolTip(tr("uhhhhh")); + ui_announce_casing->setToolTip(tr("An interface to help you announce a case (you have to be a CM first to be able to announce cases)")); set_size_and_pos(ui_switch_area_music, "switch_area_music"); ui_switch_area_music->setText(tr("A/M")); @@ -687,7 +706,8 @@ void Courtroom::set_widgets() ui_additive->setToolTip(tr("Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window.")); set_size_and_pos(ui_casing, "casing"); - ui_casing->setToolTip(tr("((((((Case?))))))")); + ui_casing->setToolTip(tr("Lets you receive case alerts when enabled.\n" + "(You can set your preferences in the Settings!)")); set_size_and_pos(ui_showname_enable, "showname_enable"); ui_showname_enable->setToolTip(tr("Display customized shownames for all users when checked.")); @@ -981,6 +1001,8 @@ void Courtroom::update_character(int p_cid) set_emote_page(); set_emote_dropdown(); + set_sfx_dropdown(); + QString side = ao_app->get_char_side(f_char); if (side == "jud") @@ -1253,7 +1275,7 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(f_side); - packet_contents.append(ao_app->get_sfx_name(current_char, current_emote)); + packet_contents.append(get_char_sfx()); int f_emote_mod = ao_app->get_emote_mod(current_char, current_emote); @@ -1286,7 +1308,7 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(QString::number(f_emote_mod)); packet_contents.append(QString::number(m_cid)); - packet_contents.append(QString::number(ao_app->get_sfx_delay(current_char, current_emote))); + packet_contents.append(QString::number(get_char_sfx_delay())); QString f_obj_state; @@ -3307,6 +3329,7 @@ void Courtroom::set_iniswap_dropdown() if (m_cid == -1) { ui_iniswap_dropdown->hide(); + ui_iniswap_remove->hide(); return; } QStringList iniswaps = ao_app->get_list_file(ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")); @@ -3314,6 +3337,7 @@ void Courtroom::set_iniswap_dropdown() if (iniswaps.size() <= 0) { ui_iniswap_dropdown->hide(); + ui_iniswap_remove->hide(); return; } ui_iniswap_dropdown->show(); @@ -3365,6 +3389,92 @@ void Courtroom::on_iniswap_remove_clicked() } } +void Courtroom::set_sfx_dropdown() +{ + ui_sfx_dropdown->clear(); + if (m_cid == -1) + { + ui_sfx_dropdown->hide(); + ui_sfx_remove->hide(); + return; + } + QStringList soundlist = ao_app->get_list_file(ao_app->get_character_path(current_char, "soundlist.ini")); + + if (soundlist.size() <= 0) + { + soundlist = ao_app->get_list_file(ao_app->get_theme_path("character_soundlist.ini")); + if (soundlist.size() <= 0) + { + soundlist = ao_app->get_list_file(ao_app->get_default_theme_path("character_soundlist.ini")); + } + } + + soundlist.prepend("Default"); + if (soundlist.size() <= 0) + { + ui_sfx_dropdown->hide(); + ui_sfx_remove->hide(); + return; + } + ui_sfx_dropdown->show(); + ui_sfx_dropdown->addItems(soundlist); + ui_sfx_dropdown->setCurrentIndex(0); + ui_sfx_remove->hide(); +} + +void Courtroom::on_sfx_dropdown_changed(int p_index) +{ + ui_ic_chat_message->setFocus(); + + QStringList soundlist; + for (int i = 0; i < ui_sfx_dropdown->count(); ++i) + { + QString entry = ui_sfx_dropdown->itemText(i); + if (!soundlist.contains(entry) && entry != "Default") + soundlist.append(entry); + } + + QStringList defaultlist = ao_app->get_list_file(ao_app->get_theme_path("character_soundlist.ini")); + if (defaultlist.size() <= 0) + { + defaultlist = ao_app->get_list_file(ao_app->get_default_theme_path("character_soundlist.ini")); + } + + if (defaultlist.size() > 0 && defaultlist.toSet().subtract(soundlist.toSet()).size() > 0) //There's a difference from the default configuration + ao_app->write_to_file(soundlist.join("\n"), ao_app->get_character_path(current_char, "soundlist.ini")); //Create a new sound list + + ui_sfx_dropdown->setCurrentIndex(p_index); + if (p_index != 0) + ui_sfx_remove->show(); + else + ui_sfx_remove->hide(); +} + +void Courtroom::on_sfx_remove_clicked() +{ + if (ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()) != "Default") + { + ui_sfx_dropdown->removeItem(ui_sfx_dropdown->currentIndex()); + on_sfx_dropdown_changed(0); //Reset back to original + } +} + +QString Courtroom::get_char_sfx() +{ + QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); + if (sfx != "" && sfx != "Default") + return sfx; + return ao_app->get_sfx_name(current_char, current_emote); +} + +int Courtroom::get_char_sfx_delay() +{ +// QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); +// if (sfx != "" && sfx != "Default") +// return 0; //todo: a way to define this + return ao_app->get_sfx_delay(current_char, current_emote); +} + void Courtroom::on_mute_list_clicked(QModelIndex p_index) { QListWidgetItem *f_item = ui_mute_list->item(p_index.row()); -- cgit From 605e15bb8c0ad103fb0f75454d8912ba83ba7a17 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 04:14:52 +0300 Subject: Implement effects system that reads your folder in theme/effects, or misc// Add an effect packet Allow aomovie to be fed a direct path Add some really terrible helper functions that shouldn't exist, sorry. --- include/aoapplication.h | 13 +++++++ include/aomovie.h | 2 +- include/courtroom.h | 12 +++++-- include/datatypes.h | 3 +- src/aomovie.cpp | 32 ++++++++++------- src/courtroom.cpp | 80 +++++++++++++++++++++++++++++++++++++---- src/packet_distribution.cpp | 2 ++ src/text_file_functions.cpp | 87 +++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 208 insertions(+), 23 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index f26c8161..f8ce2269 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -80,6 +80,7 @@ public: bool modcall_reason_enabled = false; bool looping_sfx_support_enabled = false; bool additive_enabled = false; + bool effects_enabled = false; ///////////////loading info/////////////////// @@ -298,6 +299,18 @@ public: //Not in use int get_text_delay(QString p_char, QString p_emote); + //Get the effects folder referenced by the char.ini, read it and return the list of filenames in a string + QStringList get_char_effects(QString p_char); + + //Get the theme's effects folder, read it and return the list of filenames in a string + QStringList get_effects(); + + //t + QString get_effect(QString effect, QString p_char); + + //Return the effect sound associated with the fx_name in the misc/effects//sounds.ini, or theme/effects/sounds.ini. + QString get_effect_sound(QString fx_name, QString p_char); + // Returns the custom realisation used by the character. QString get_custom_realization(QString p_char); diff --git a/include/aomovie.h b/include/aomovie.h index a5af735e..ec286199 100644 --- a/include/aomovie.h +++ b/include/aomovie.h @@ -15,7 +15,7 @@ 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 = "", int default_duration = 0); + void play(QString p_image, QString p_char = "", QString p_custom_theme = "", int default_duration = 0); void combo_resize(int w, int h); void stop(); diff --git a/include/courtroom.h b/include/courtroom.h index 8d1588e9..6ba3d651 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -345,7 +345,7 @@ private: //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 = 29; + static const int chatmessage_size = 30; QString m_chatmessage[chatmessage_size]; bool chatmessage_is_empty = false; @@ -375,6 +375,8 @@ private: int text_color = 0; bool is_presenting_evidence = false; + QString effect = ""; + int defense_bar_state = 0; int prosecution_bar_state = 0; @@ -429,7 +431,7 @@ private: QLabel *ui_vp_showname; AOMovie *ui_vp_chat_arrow; QTextEdit *ui_vp_message; - AOMovie *ui_vp_realization; + AOMovie *ui_vp_effect; AOMovie *ui_vp_testimony; AOMovie *ui_vp_wtce; AOMovie *ui_vp_objection; @@ -470,6 +472,8 @@ private: QComboBox *ui_sfx_dropdown; AOButton *ui_sfx_remove; + QComboBox *ui_effects_dropdown; + AOImage *ui_defense_bar; AOImage *ui_prosecution_bar; @@ -579,6 +583,7 @@ public slots: void preanim_done(); void do_screenshake(); void do_flash(); + void do_effect(QString fx_path, QString fx_sound, QString p_char); void play_char_sfx(QString sfx_name); void mod_called(QString p_ip); @@ -620,6 +625,9 @@ private slots: void set_sfx_dropdown(); void on_sfx_remove_clicked(); + void set_effects_dropdown(); + void on_effects_dropdown_changed(int p_index); + QString get_char_sfx(); int get_char_sfx_delay(); diff --git a/include/datatypes.h b/include/datatypes.h index 54e5c741..5426d981 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -106,7 +106,8 @@ enum CHAT_MESSAGE FRAME_SCREENSHAKE, FRAME_REALIZATION, FRAME_SFX, - ADDITIVE + ADDITIVE, + EFFECTS }; enum COLOR diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 7f7fb205..fff8014c 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -29,35 +29,41 @@ void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int { m_movie->stop(); - QString shout_path; - QList pathlist; + QString shout_path = p_image; + if (!file_exists(p_image)) + { + QList pathlist; - pathlist = { + pathlist = { ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image + "_bubble"), //Misc path ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //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 - }; + }; - //Add this at the beginning of the list - order matters. - if (p_image == "custom") - pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image))); - else - pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image + "_bubble"))); + //Add this at the beginning of the list - order matters. + if (p_image == "custom") + pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image))); + else + pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image + "_bubble"))); - for (QString path : pathlist) - { + for (QString path : pathlist) + { if (file_exists(path)) { - shout_path = path; - break; + 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) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 7ece780e..f26c6dc5 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -98,7 +98,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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_effect = new AOMovie(this, ao_app); ui_vp_wtce = new AOMovie(this, ao_app); ui_vp_objection = new AOMovie(this, ao_app); @@ -169,6 +169,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_sfx_dropdown = new QComboBox(this); ui_sfx_remove = new AOButton(this, ao_app); + ui_effects_dropdown = new QComboBox(this); + ui_defense_bar = new AOImage(this, ao_app); ui_prosecution_bar = new AOImage(this, ao_app); @@ -294,6 +296,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_sfx_dropdown, SIGNAL(activated(int)), this, SLOT(on_sfx_dropdown_changed(int))); connect(ui_sfx_remove, SIGNAL(clicked()), this, SLOT(on_sfx_remove_clicked())); + connect(ui_effects_dropdown, SIGNAL(activated(int)), this, SLOT(on_effects_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())); @@ -513,8 +517,8 @@ void Courtroom::set_widgets() 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->combo_resize(ui_viewport->width(), ui_viewport->height()); + ui_vp_effect->move(ui_viewport->x(), ui_viewport->y()); + ui_vp_effect->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()); @@ -612,6 +616,12 @@ void Courtroom::set_widgets() ui_sfx_remove->set_image("evidencex"); ui_sfx_remove->setToolTip(tr("Remove the currently selected iniswap from the list and return to the original character folder.")); + set_size_and_pos(ui_effects_dropdown, "effects_dropdown"); + ui_effects_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); + ui_effects_dropdown->setToolTip(tr("Choose an effect to play on your next spoken message.")); + ui_effects_dropdown->setIconSize(QSize(16, 16)); //Todo: don't do hardcoding hell - make it part of courtroom_design.ini + //Todo: actual list of effects + set_size_and_pos(ui_defense_bar, "defense_bar"); ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state)); @@ -1002,6 +1012,7 @@ void Courtroom::update_character(int p_cid) set_emote_dropdown(); set_sfx_dropdown(); + set_effects_dropdown(); QString side = ao_app->get_char_side(f_char); @@ -1424,6 +1435,12 @@ void Courtroom::on_chat_return_pressed() { packet_contents.append(ui_additive->isChecked() ? "1" : "0"); } + if (ao_app->effects_enabled) + { + QString fx_sound = ao_app->get_effect_sound(effect, current_char); + packet_contents.append(effect + "|" + fx_sound); + qDebug() << effect << fx_sound; + } ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } @@ -1879,7 +1896,18 @@ void Courtroom::do_flash() if(!ao_app->is_shake_flash_enabled()) return; - ui_vp_realization->play("realizationflash", "", "", 60); + ui_vp_effect->play("realizationflash", "", "", 60); +} + +void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char) +{ + if(!ao_app->is_shake_flash_enabled()) + return; + + ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping. Static effects will linger. + ui_vp_effect->play(ao_app->get_effect(fx_name, p_char)); // It will set_play_once to true if the filepath provided is not designed to loop more than once + if (fx_sound != "") + sfx_player->play(ao_app->get_sfx_suffix(fx_sound)); } void Courtroom::play_char_sfx(QString sfx_name) @@ -2288,7 +2316,18 @@ void Courtroom::start_chat_ticking() if (text_state != 0) return; - if (m_chatmessage[REALIZATION] == "1") + if (m_chatmessage[EFFECTS] != "") + { + QStringList fx_list = m_chatmessage[EFFECTS].split("|"); + qDebug() << m_chatmessage[EFFECTS] << fx_list; + QString fx = fx_list[0]; + QString fx_sound; + if (fx_list.length() > 1) + fx_sound = fx_list[1]; + + this->do_effect(fx, fx_sound, m_chatmessage[CHAR_NAME]); + } + else if (m_chatmessage[REALIZATION] == "1") { this->do_flash(); sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); @@ -3409,13 +3448,14 @@ void Courtroom::set_sfx_dropdown() } } - soundlist.prepend("Default"); if (soundlist.size() <= 0) { ui_sfx_dropdown->hide(); ui_sfx_remove->hide(); return; } + soundlist.prepend("Default"); + ui_sfx_dropdown->show(); ui_sfx_dropdown->addItems(soundlist); ui_sfx_dropdown->setCurrentIndex(0); @@ -3459,6 +3499,34 @@ void Courtroom::on_sfx_remove_clicked() } } +void Courtroom::set_effects_dropdown() +{ + ui_effects_dropdown->clear(); + if (m_cid == -1) + { + ui_effects_dropdown->hide(); + return; + } + QStringList effectslist = ao_app->get_effects() << ao_app->get_char_effects(current_char); + + if (effectslist.size() <= 0) + { + ui_effects_dropdown->hide(); + return; + } + effectslist.prepend("None"); + + ui_effects_dropdown->show(); + ui_effects_dropdown->addItems(effectslist); + ui_effects_dropdown->setCurrentIndex(0); +} + +void Courtroom::on_effects_dropdown_changed(int p_index) +{ + effect = ui_effects_dropdown->itemText(p_index); + ui_ic_chat_message->setFocus(); +} + QString Courtroom::get_char_sfx() { QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 9eea1797..e483ef91 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -215,6 +215,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet) looping_sfx_support_enabled = true; if (f_packet.contains("additive",Qt::CaseInsensitive)) additive_enabled = true; + if (f_packet.contains("effects",Qt::CaseInsensitive)) + effects_enabled = true; } else if (header == "PN") { diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index f22bc748..d478582c 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -817,6 +817,93 @@ int AOApplication::get_text_delay(QString p_char, QString p_emote) else return f_result.toInt(); } +QStringList AOApplication::get_char_effects(QString p_char) +{ + QString p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_path = get_base_path() + "misc/" + p_effect + "/"; + QStringList filters = QStringList() << "*.gif" << "*.webp" << "*.apng" << "*.png" << "*.GIF" << "*.WEBP" << "*.APNG" << "*.PNG"; + + QDir directory(p_path); + QStringList images = directory.entryList(filters, QDir::Files); + + QStringList effects; + foreach (QString effect, images) + { + effect = effect.left(effect.lastIndexOf(".")); + if (!effects.contains(effect)) //Do that juicy priority meme + effects.append(effect); + } + + return effects; +} + +QStringList AOApplication::get_effects() +{ + QString design_ini_path = get_theme_path("effects/"); + QString default_path = get_default_theme_path("effects/"); + QStringList filters = QStringList() << "*.gif" << "*.webp" << "*.apng" << "*.png" << "*.GIF" << "*.WEBP" << "*.APNG" << "*.PNG"; + + QDir directory(design_ini_path); + QStringList images = directory.entryList(filters, QDir::Files); + if (images.size() <= 0) + { + directory.cd(default_path); + images = directory.entryList(filters, QDir::Files); + } + + QStringList effects; + foreach (QString effect, images) + { + effect = effect.left(effect.lastIndexOf(".")); + if (!effects.contains(effect)) //Do that juicy priority meme + effects.append(effect); + } + + return effects; +} + +QString AOApplication::get_effect(QString effect, QString p_char) +{ + QString p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_path = get_image_suffix(get_base_path() + "misc/" + p_effect + effect); + QString design_ini_path = get_image_suffix(get_theme_path("effects/" + effect)); + QString default_path = get_image_suffix(get_default_theme_path("effects/" + effect)); + + if (!file_exists(p_path)) + { + p_path = design_ini_path; + if (!file_exists(p_path)) + { + p_path = default_path; + if (!file_exists(p_path)) + { + return ""; + } + } + } + + return p_path; +} + +QString AOApplication::get_effect_sound(QString fx_name, QString p_char) +{ + QString p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_path = get_base_path() + "misc/effects/" + p_effect + "/effect_sounds.ini"; + QString design_ini_path = get_theme_path("effects/effect_sounds.ini"); + QString default_path = get_default_theme_path("effects/effect_sounds.ini"); + + QString f_result = read_design_ini(fx_name, p_path); + if (f_result == "") + { + f_result = read_design_ini(fx_name, design_ini_path); + if (f_result == "") + { + f_result = read_design_ini(fx_name, default_path); + } + } + return f_result; +} + QString AOApplication::get_custom_realization(QString p_char) { QString f_result = read_char_ini(p_char, "realization", "Options"); -- cgit From ad057c6f7a71ffac53e8d5adbbd22ab17d3e0e98 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 05:22:00 +0300 Subject: make icons for effects n shit they're grabbed from the effects/icons/*same name as effects* gotta be .png or w/e i need my sleep --- include/aoapplication.h | 2 +- src/courtroom.cpp | 41 +++++++++++++++++++++++++++++++++++++---- src/text_file_functions.cpp | 44 ++++++++++++++++++++------------------------ 3 files changed, 58 insertions(+), 29 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index f8ce2269..78de2b80 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -303,7 +303,7 @@ public: QStringList get_char_effects(QString p_char); //Get the theme's effects folder, read it and return the list of filenames in a string - QStringList get_effects(); + QStringList get_effects(QString p_char); //t QString get_effect(QString effect, QString p_char); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index f26c6dc5..48aa637d 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1439,7 +1439,8 @@ void Courtroom::on_chat_return_pressed() { QString fx_sound = ao_app->get_effect_sound(effect, current_char); packet_contents.append(effect + "|" + fx_sound); - qDebug() << effect << fx_sound; + ui_effects_dropdown->setCurrentIndex(0); + effect = ""; } ao_app->send_server_packet(new AOPacket("MS", packet_contents)); @@ -1902,10 +1903,14 @@ void Courtroom::do_flash() void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char) { if(!ao_app->is_shake_flash_enabled()) - return; + return; + + QString effect = ao_app->get_effect(fx_name, p_char); + if (effect == "") + return; ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping. Static effects will linger. - ui_vp_effect->play(ao_app->get_effect(fx_name, p_char)); // It will set_play_once to true if the filepath provided is not designed to loop more than once + ui_vp_effect->play(effect); // It will set_play_once to true if the filepath provided is not designed to loop more than once if (fx_sound != "") sfx_player->play(ao_app->get_sfx_suffix(fx_sound)); } @@ -3507,17 +3512,45 @@ void Courtroom::set_effects_dropdown() ui_effects_dropdown->hide(); return; } - QStringList effectslist = ao_app->get_effects() << ao_app->get_char_effects(current_char); + QStringList effectslist = ao_app->get_effects(current_char); if (effectslist.size() <= 0) { ui_effects_dropdown->hide(); return; } + + effectslist.prepend("None"); ui_effects_dropdown->show(); ui_effects_dropdown->addItems(effectslist); + + //ICON-MAKING HELL + QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); + QString custom_path = ao_app->get_base_path() + "misc/" + p_effect + "/icons/"; + QString theme_path = ao_app->get_theme_path("effects/icons/"); + QString default_path = ao_app->get_default_theme_path("effects/icons/"); + for (int i = 0; i < ui_effects_dropdown->count(); ++i) + { + QString entry = ui_effects_dropdown->itemText(i); + QString iconpath = ao_app->get_static_image_suffix(custom_path + entry); + qDebug() << iconpath << entry; + if (!file_exists(iconpath)) + { + iconpath = ao_app->get_static_image_suffix(theme_path + entry); + qDebug() << iconpath << entry; + if (!file_exists(iconpath)) + { + iconpath = ao_app->get_static_image_suffix(default_path + entry); + qDebug() << iconpath << entry; + if (!file_exists(iconpath)) + continue; + } + } + ui_effects_dropdown->setItemIcon(i, QIcon(iconpath)); + } + ui_effects_dropdown->setCurrentIndex(0); } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index d478582c..261b0ffd 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -820,42 +820,38 @@ int AOApplication::get_text_delay(QString p_char, QString p_emote) QStringList AOApplication::get_char_effects(QString p_char) { QString p_effect = read_char_ini(p_char, "effects", "Options"); - QString p_path = get_base_path() + "misc/" + p_effect + "/"; - QStringList filters = QStringList() << "*.gif" << "*.webp" << "*.apng" << "*.png" << "*.GIF" << "*.WEBP" << "*.APNG" << "*.PNG"; + QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; - QDir directory(p_path); - QStringList images = directory.entryList(filters, QDir::Files); + QStringList lines = read_file(p_path).split("\n"); QStringList effects; - foreach (QString effect, images) + foreach (QString effect, lines) { - effect = effect.left(effect.lastIndexOf(".")); - if (!effects.contains(effect)) //Do that juicy priority meme + effect = effect.split("=")[0].trimmed(); + qDebug() << effect; + if (effect != "" && !effects.contains(effect)) effects.append(effect); } - return effects; } -QStringList AOApplication::get_effects() +QStringList AOApplication::get_effects(QString p_char) { - QString design_ini_path = get_theme_path("effects/"); - QString default_path = get_default_theme_path("effects/"); - QStringList filters = QStringList() << "*.gif" << "*.webp" << "*.apng" << "*.png" << "*.GIF" << "*.WEBP" << "*.APNG" << "*.PNG"; + QString p_path = get_theme_path("effects/effects.ini"); + QString default_path = get_default_theme_path("effects/effects.ini"); - QDir directory(design_ini_path); - QStringList images = directory.entryList(filters, QDir::Files); - if (images.size() <= 0) + if (!file_exists(p_path)) { - directory.cd(default_path); - images = directory.entryList(filters, QDir::Files); + p_path = default_path; } + QStringList lines = read_file(p_path).split("\n"); - QStringList effects; - foreach (QString effect, images) + QStringList effects = get_char_effects(p_char); + foreach (QString effect, lines) { - effect = effect.left(effect.lastIndexOf(".")); - if (!effects.contains(effect)) //Do that juicy priority meme + effect = effect.split("=")[0].trimmed(); + qDebug() << effect; + if (effect != "" && !effects.contains(effect)) effects.append(effect); } @@ -888,9 +884,9 @@ QString AOApplication::get_effect(QString effect, QString p_char) QString AOApplication::get_effect_sound(QString fx_name, QString p_char) { QString p_effect = read_char_ini(p_char, "effects", "Options"); - QString p_path = get_base_path() + "misc/effects/" + p_effect + "/effect_sounds.ini"; - QString design_ini_path = get_theme_path("effects/effect_sounds.ini"); - QString default_path = get_default_theme_path("effects/effect_sounds.ini"); + QString p_path = get_base_path() + "misc/effects/" + p_effect + "/effects.ini"; + QString design_ini_path = get_theme_path("effects/effects.ini"); + QString default_path = get_default_theme_path("effects/effects.ini"); QString f_result = read_design_ini(fx_name, p_path); if (f_result == "") -- cgit From 9b0f07d125e423471665be9fa2895621969bacaf Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 05:24:40 +0300 Subject: Make effects stop when next message is received --- src/courtroom.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 48aa637d..9083951c 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1596,6 +1596,7 @@ void Courtroom::handle_chatmessage_2() { ui_vp_speedlines->stop(); ui_vp_player_char->stop(); + ui_vp_effect->stop(); //Clear all looping sfx to prevent obnoxiousness sfx_player->loop_clear(); -- cgit From 2d329cdbd27c19d958275fbf1c6862135c96a395 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 05:45:02 +0300 Subject: Bugfixes for the thing and how it orders things --- include/aoapplication.h | 2 +- src/text_file_functions.cpp | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 78de2b80..5fb63386 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -300,7 +300,7 @@ public: int get_text_delay(QString p_char, QString p_emote); //Get the effects folder referenced by the char.ini, read it and return the list of filenames in a string - QStringList get_char_effects(QString p_char); + QStringList get_theme_effects(); //Get the theme's effects folder, read it and return the list of filenames in a string QStringList get_effects(QString p_char); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 261b0ffd..6c34c410 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -817,11 +817,15 @@ int AOApplication::get_text_delay(QString p_char, QString p_emote) else return f_result.toInt(); } -QStringList AOApplication::get_char_effects(QString p_char) +QStringList AOApplication::get_theme_effects() { - QString p_effect = read_char_ini(p_char, "effects", "Options"); - QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; + QString p_path = get_theme_path("effects/effects.ini"); + QString default_path = get_default_theme_path("effects/effects.ini"); + if (!file_exists(p_path)) + { + p_path = default_path; + } QStringList lines = read_file(p_path).split("\n"); QStringList effects; @@ -837,16 +841,12 @@ QStringList AOApplication::get_char_effects(QString p_char) QStringList AOApplication::get_effects(QString p_char) { - QString p_path = get_theme_path("effects/effects.ini"); - QString default_path = get_default_theme_path("effects/effects.ini"); + QString p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; - if (!file_exists(p_path)) - { - p_path = default_path; - } QStringList lines = read_file(p_path).split("\n"); - QStringList effects = get_char_effects(p_char); + QStringList effects = get_theme_effects(); foreach (QString effect, lines) { effect = effect.split("=")[0].trimmed(); @@ -861,7 +861,7 @@ QStringList AOApplication::get_effects(QString p_char) QString AOApplication::get_effect(QString effect, QString p_char) { QString p_effect = read_char_ini(p_char, "effects", "Options"); - QString p_path = get_image_suffix(get_base_path() + "misc/" + p_effect + effect); + QString p_path = get_image_suffix(get_base_path() + "misc/" + p_effect + "/" + effect); QString design_ini_path = get_image_suffix(get_theme_path("effects/" + effect)); QString default_path = get_image_suffix(get_default_theme_path("effects/" + effect)); -- cgit From f8d3d5d8fdeda3d01595e02b7c616606be32f6aa Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 14:28:26 +0300 Subject: Fix a bug with sound effect from misc/ folder not being read Make an "effects_icon_size" entry in courtroom_design.ini for scaling the buttons in the effects list --- src/courtroom.cpp | 7 +++++-- src/text_file_functions.cpp | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 9083951c..bcf3a42a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -619,8 +619,11 @@ void Courtroom::set_widgets() set_size_and_pos(ui_effects_dropdown, "effects_dropdown"); ui_effects_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); ui_effects_dropdown->setToolTip(tr("Choose an effect to play on your next spoken message.")); - ui_effects_dropdown->setIconSize(QSize(16, 16)); //Todo: don't do hardcoding hell - make it part of courtroom_design.ini - //Todo: actual list of effects + //Todo: recode this entire fucking system with these dumbass goddamn ini's why is everything so specifically coded for all these purposes + //is ABSTRACT CODING not a thing now huh what the FUCK why do I gotta do this pleASE FOR THE LOVE OF GOD SPARE ME FROM THIS FRESH HELL + //btw i still love coding. + QPoint p_point = ao_app->get_button_spacing("effects_icon_size", filename); + ui_effects_dropdown->setIconSize(QSize(p_point.x(), p_point.y())); set_size_and_pos(ui_defense_bar, "defense_bar"); ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state)); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 6c34c410..06caf291 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -884,7 +884,7 @@ QString AOApplication::get_effect(QString effect, QString p_char) QString AOApplication::get_effect_sound(QString fx_name, QString p_char) { QString p_effect = read_char_ini(p_char, "effects", "Options"); - QString p_path = get_base_path() + "misc/effects/" + p_effect + "/effects.ini"; + QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; QString design_ini_path = get_theme_path("effects/effects.ini"); QString default_path = get_default_theme_path("effects/effects.ini"); -- cgit From 04daff7446061bb87bdf85ed080079041a75f142 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 15:46:43 +0300 Subject: When the realization button is pressed, update the Effects thing too. --- include/courtroom.h | 1 + src/courtroom.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/include/courtroom.h b/include/courtroom.h index 6ba3d651..a980aba8 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -627,6 +627,7 @@ private slots: void set_effects_dropdown(); void on_effects_dropdown_changed(int p_index); + bool effects_dropdown_find_and_set(QString effect); QString get_char_sfx(); int get_char_sfx_delay(); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index bcf3a42a..423c5602 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3564,6 +3564,20 @@ void Courtroom::on_effects_dropdown_changed(int p_index) ui_ic_chat_message->setFocus(); } +bool Courtroom::effects_dropdown_find_and_set(QString effect) +{ + for (int i = 0; i < ui_effects_dropdown->count(); ++i) + { + QString entry = ui_effects_dropdown->itemText(i); + if (entry == effect) + { + ui_effects_dropdown->setCurrentIndex(i); + return true; + } + } + return false; +} + QString Courtroom::get_char_sfx() { QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); @@ -3775,11 +3789,14 @@ void Courtroom::on_realization_clicked() if (realization_state == 0) { realization_state = 1; + effects_dropdown_find_and_set("realization"); ui_realization->set_image("realization_pressed"); } else { realization_state = 0; + ui_effects_dropdown->setCurrentIndex(0); + on_effects_dropdown_changed(ui_effects_dropdown->currentIndex()); ui_realization->set_image("realization"); } -- cgit From 0fe94d5d9f0e175ba8355305cdfd6cd35e0a545f Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 17:34:22 +0300 Subject: Evidence and emotes reloading when reload_theme is pressed Update evidence a bit and change the way it sets images to something much better and less confusing Update the hovering logic a bit so there's less weird occurences happening e.g. evidence button is deleted --- include/aoevidencebutton.h | 1 - include/courtroom.h | 6 ++++-- src/aoevidencebutton.cpp | 38 +++++++++++++++++++------------------- src/courtroom.cpp | 38 +++++++++++++++----------------------- src/emotes.cpp | 25 ++++++++++++++++++++++++- src/evidence.cpp | 39 ++++++++++++++++++++++++--------------- 6 files changed, 86 insertions(+), 61 deletions(-) diff --git a/include/aoevidencebutton.h b/include/aoevidencebutton.h index 80b747cd..f7baa9fa 100644 --- a/include/aoevidencebutton.h +++ b/include/aoevidencebutton.h @@ -15,7 +15,6 @@ class AOEvidenceButton : public QPushButton public: 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;} diff --git a/include/courtroom.h b/include/courtroom.h index a980aba8..97f695c9 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -571,11 +571,13 @@ private: void put_button_in_place(int starting, int chars_on_this_page); void filter_character_list(); - void construct_emotes(); + void initialize_emotes(); + void refresh_emotes(); void set_emote_page(); void set_emote_dropdown(); - void construct_evidence(); + void initialize_evidence(); + void refresh_evidence(); void set_evidence_page(); public slots: diff --git a/src/aoevidencebutton.cpp b/src/aoevidencebutton.cpp index 616f6367..871b4775 100644 --- a/src/aoevidencebutton.cpp +++ b/src/aoevidencebutton.cpp @@ -7,48 +7,49 @@ AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, i ao_app = p_ao_app; m_parent = p_parent; - ui_selected = new AOImage(p_parent, ao_app); + //HELLO AND WELCOME TO HARDCODE CENTRAL, MAY I TAKE YOUR FRESH ORDER OF PAIN AND SUFFERING + ui_selected = new AOImage(this, ao_app); ui_selected->resize(70, 70); - ui_selected->move(p_x, p_y); +// ui_selected->move(p_x, p_y); ui_selected->set_image("evidence_selected"); ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents); ui_selected->hide(); - ui_selector = new AOImage(p_parent, ao_app); - ui_selector->resize(71, 71); - ui_selector->move(p_x - 1, p_y - 1); + ui_selector = new AOImage(this, ao_app); + ui_selector->resize(70, 70); +// ui_selector->move(p_x - 1, p_y - 1); ui_selector->set_image("evidence_selector"); ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); ui_selector->hide(); this->move(p_x, p_y); this->resize(70, 70); - this->setAcceptDrops(true); +// this->setAcceptDrops(true); connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); } -void AOEvidenceButton::reset() -{ - this->hide(); - ui_selected->hide(); - ui_selector->hide(); -} - void AOEvidenceButton::set_image(QString p_image) { QString image_path = ao_app->get_evidence_path(p_image); - - if (file_exists(image_path)) + qDebug() << image_path << p_image; + if (file_exists(p_image)) + { + this->setText(""); + this->setIcon(QIcon(p_image)); + } + else if (file_exists(image_path)) { this->setText(""); - this->setStyleSheet("border-image:url(\"" + image_path + "\")"); + this->setIcon(QIcon(image_path)); } else { this->setText(p_image); - this->setStyleSheet(""); + this->setIcon(QIcon()); } + this->setIconSize(this->size()); + this->setStyleSheet("border:0px"); } void AOEvidenceButton::set_theme_image(QString p_image) @@ -63,8 +64,7 @@ void AOEvidenceButton::set_theme_image(QString p_image) else final_image_path = default_image_path; - this->setText(""); - this->setStyleSheet("border-image:url(\"" + final_image_path + "\")"); + this->set_image(final_image_path); } void AOEvidenceButton::set_selected(bool p_selected) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 423c5602..295f407b 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -98,9 +98,13 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_vp_testimony = new AOMovie(this, ao_app); ui_vp_testimony->set_play_once(false); + ui_vp_testimony->setAttribute(Qt::WA_TransparentForMouseEvents); ui_vp_effect = new AOMovie(this, ao_app); + ui_vp_effect->setAttribute(Qt::WA_TransparentForMouseEvents); ui_vp_wtce = new AOMovie(this, ao_app); + ui_vp_wtce->setAttribute(Qt::WA_TransparentForMouseEvents); ui_vp_objection = new AOMovie(this, ao_app); + ui_vp_objection->setAttribute(Qt::WA_TransparentForMouseEvents); ui_ic_chatlog = new QTextEdit(this); ui_ic_chatlog->setReadOnly(true); @@ -147,12 +151,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_music_search->setFrame(false); ui_music_search->setPlaceholderText(tr("Search")); - construct_emotes(); + initialize_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"); @@ -267,7 +267,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_evidence_button = new AOButton(this, ao_app); - construct_evidence(); + initialize_evidence(); construct_char_select(); @@ -284,10 +284,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(chat_tick_timer, SIGNAL(timeout()), this, SLOT(chat_tick())); - 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_iniswap_dropdown, SIGNAL(activated(int)), this, SLOT(on_iniswap_dropdown_changed(int))); @@ -582,14 +578,6 @@ void Courtroom::set_widgets() //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"); - - set_size_and_pos(ui_emote_right, "emote_right"); - ui_emote_right->set_image("arrow_right"); - set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); ui_pos_dropdown->setToolTip(tr("Set your character's supplementary background.")); @@ -820,6 +808,9 @@ void Courtroom::set_widgets() set_size_and_pos(ui_spectator, "spectator"); ui_spectator->setToolTip(tr("Become a spectator. You won't be able to interact with the in-character screen.")); + + refresh_evidence(); + refresh_emotes(); } void Courtroom::set_fonts() @@ -1060,6 +1051,8 @@ void Courtroom::update_character(int p_cid) void Courtroom::enter_courtroom() { + set_widgets(); + current_evidence_page = 0; current_evidence = 0; @@ -1089,9 +1082,6 @@ void Courtroom::enter_courtroom() blip_player->set_volume(ui_blip_slider->value()); ui_vp_testimony->stop(); - - set_widgets(); - //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); } @@ -3789,7 +3779,9 @@ void Courtroom::on_realization_clicked() if (realization_state == 0) { realization_state = 1; - effects_dropdown_find_and_set("realization"); + if (effects_dropdown_find_and_set("realization")) + on_effects_dropdown_changed(ui_effects_dropdown->currentIndex()); + ui_realization->set_image("realization_pressed"); } else @@ -3980,8 +3972,8 @@ void Courtroom::on_reload_theme_clicked() //to update status on the background set_background(current_background); - update_character(m_cid); enter_courtroom(); + update_character(m_cid); anim_state = 4; text_state = 3; diff --git a/src/emotes.cpp b/src/emotes.cpp index daa8d6d4..4ce2eb73 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -2,12 +2,35 @@ #include "aoemotebutton.h" -void Courtroom::construct_emotes() +void Courtroom::initialize_emotes() { ui_emotes = new QWidget(this); + ui_emote_left = new AOButton(this, ao_app); + ui_emote_right = new AOButton(this, ao_app); + + ui_emote_dropdown = new QComboBox(this); + + 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))); +} + +void Courtroom::refresh_emotes() +{ + //Should properly refresh the emote list + qDeleteAll(ui_emote_list.begin(), ui_emote_list.end()); + ui_emote_list.clear(); + set_size_and_pos(ui_emotes, "emotes"); + set_size_and_pos(ui_emote_left, "emote_left"); + ui_emote_left->set_image("arrow_left"); + + set_size_and_pos(ui_emote_right, "emote_right"); + ui_emote_right->set_image("arrow_right"); + QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini"); const int button_width = 40; diff --git a/src/evidence.cpp b/src/evidence.cpp index 75806854..d8f37434 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -1,6 +1,6 @@ #include "courtroom.h" -void Courtroom::construct_evidence() +void Courtroom::initialize_evidence() { ui_evidence = new AOImage(this, ao_app); @@ -30,6 +30,24 @@ void Courtroom::construct_evidence() ui_evidence_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: white;"); + connect(ui_evidence_name, SIGNAL(textEdited(QString)), this, SLOT(on_evidence_name_edited(QString))); + 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(); +} + +void Courtroom::refresh_evidence() +{ + //Should properly refresh the evidence list + qDeleteAll(ui_evidence_list.begin(), ui_evidence_list.end()); + ui_evidence_list.clear(); + set_size_and_pos(ui_evidence, "evidence_background"); set_size_and_pos(ui_evidence_buttons, "evidence_buttons"); @@ -71,17 +89,6 @@ void Courtroom::construct_evidence() x_mod_count = 0; } } - - connect(ui_evidence_name, SIGNAL(textEdited(QString)), this, SLOT(on_evidence_name_edited(QString))); - 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(); } void Courtroom::set_evidence_list(QVector &p_evi_list) @@ -101,7 +108,7 @@ void Courtroom::set_evidence_page() for (AOEvidenceButton *i_button : ui_evidence_list) { - i_button->reset(); + i_button->hide(); } //to account for the "add evidence" button @@ -135,20 +142,22 @@ void Courtroom::set_evidence_page() AOEvidenceButton *f_evidence_button = ui_evidence_list.at(n_evidence_button); //ie. the add evidence button + f_evidence_button->set_selected(false); 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); if (n_real_evidence == current_evidence) f_evidence_button->set_selected(true); - else - f_evidence_button->set_selected(false); } else f_evidence_button->set_image(""); + f_evidence_button->show(); } } -- cgit From cda7d430b3fa988258819012a5a96249aa553f1e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 19:43:11 +0300 Subject: use SetIcon for AOEmoteButton instead of stylesheets Fix aolineedit not sending the double_clicked signal Add tooltips for emotes that display the number and the emote_comment (name) Add similar tooltips to evidence buttons Resolve an issue where you could edit evidence name without double-clicking a piece of evidence first --- include/aoemotebutton.h | 5 ++--- src/aoemotebutton.cpp | 21 ++++++++++++++------- src/aolineedit.cpp | 1 + src/emotes.cpp | 11 ++++++----- src/evidence.cpp | 19 ++++++++++++++++--- 5 files changed, 39 insertions(+), 18 deletions(-) diff --git a/include/aoemotebutton.h b/include/aoemotebutton.h index c99a73b0..4c310147 100644 --- a/include/aoemotebutton.h +++ b/include/aoemotebutton.h @@ -13,9 +13,8 @@ class AOEmoteButton : public QPushButton 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_image(QString p_char, int p_emote, QString suffix); + void set_image(QString p_image, QString p_emote_comment); + void set_char_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;} diff --git a/src/aoemotebutton.cpp b/src/aoemotebutton.cpp index ca4d6941..8d687126 100644 --- a/src/aoemotebutton.cpp +++ b/src/aoemotebutton.cpp @@ -13,23 +13,30 @@ AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); } -void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix) +void AOEmoteButton::set_image(QString p_image, QString p_emote_comment) { - QString emotion_number = QString::number(p_emote + 1); - QString image_path = ao_app->get_static_image_suffix(ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix)); - - if (file_exists(image_path)) + if (file_exists(p_image)) { + this->setIcon(QIcon(p_image)); + this->setIconSize(this->size()); + this->setStyleSheet("border:0px"); this->setText(""); - this->setStyleSheet("border-image:url(\"" + image_path + "\")"); } else { - this->setText(ao_app->get_emote_comment(p_char, p_emote)); + this->setText(p_emote_comment); this->setStyleSheet("border-image:url(\"\")"); } } +void AOEmoteButton::set_char_image(QString p_char, int p_emote, QString suffix) +{ + QString emotion_number = QString::number(p_emote + 1); + QString image_path = ao_app->get_static_image_suffix(ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix)); + + this->set_image(image_path, ao_app->get_emote_comment(p_char, p_emote)); +} + void AOEmoteButton::on_clicked() { emote_clicked(m_id); diff --git a/src/aolineedit.cpp b/src/aolineedit.cpp index f6026e14..13f87f31 100644 --- a/src/aolineedit.cpp +++ b/src/aolineedit.cpp @@ -13,6 +13,7 @@ void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e) QLineEdit::mouseDoubleClickEvent(e); this->setReadOnly(false); + double_clicked(); } void AOLineEdit::on_enter_pressed() diff --git a/src/emotes.cpp b/src/emotes.cpp index 4ce2eb73..f6239eef 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -112,11 +112,12 @@ void Courtroom::set_emote_page() AOEmoteButton *f_emote = ui_emote_list.at(n_emote); if (n_real_emote == current_emote) - f_emote->set_image(current_char, n_real_emote, "_on"); + f_emote->set_char_image(current_char, n_real_emote, "_on"); else - f_emote->set_image(current_char, n_real_emote, "_off"); + f_emote->set_char_image(current_char, n_real_emote, "_off"); f_emote->show(); + f_emote->setToolTip(QString::number(n_real_emote+1) + ": " + ao_app->get_emote_comment(current_char, n_real_emote)); } } @@ -130,7 +131,7 @@ void Courtroom::set_emote_dropdown() for (int n = 0 ; n < total_emotes ; ++n) { - emote_list.append(ao_app->get_emote_comment(current_char, n)); + emote_list.append(QString::number(n+1) + ": " + ao_app->get_emote_comment(current_char, n)); } ui_emote_dropdown->addItems(emote_list); @@ -142,14 +143,14 @@ 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"); + ui_emote_list.at(current_emote % max_emotes_on_page)->set_char_image(current_char, current_emote, "_off"); 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"); + ui_emote_list.at(current_emote % max_emotes_on_page)->set_char_image(current_char, current_emote, "_on"); int emote_mod = ao_app->get_emote_mod(current_char, current_emote); diff --git a/src/evidence.cpp b/src/evidence.cpp index d8f37434..5e5bc9d8 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -141,8 +141,8 @@ void Courtroom::set_evidence_page() 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 f_evidence_button->set_selected(false); + f_evidence_button->setToolTip(""); if (n_real_evidence == (total_evidence - 1)) { f_evidence_button->set_theme_image("addevidence.png"); @@ -153,11 +153,12 @@ void Courtroom::set_evidence_page() if (n_real_evidence == current_evidence) f_evidence_button->set_selected(true); + + f_evidence_button->setToolTip(QString::number(n_real_evidence+1) + ": " + local_evidence_list.at(n_real_evidence).name); } else f_evidence_button->set_image(""); - f_evidence_button->show(); } } @@ -180,6 +181,14 @@ void Courtroom::on_evidence_name_edited(QString text) ao_app->send_server_packet(new AOPacket("EE", f_contents)); } +void Courtroom::on_evidence_name_double_clicked() +{ + if (ui_evidence_overlay->isVisible()) + ui_evidence_name->setReadOnly(false); + else + ui_evidence_name->setReadOnly(true); +} + void Courtroom::on_evidence_image_name_edited() { if (current_evidence >= local_evidence_list.size()) @@ -243,7 +252,7 @@ void Courtroom::on_evidence_clicked(int p_id) current_evidence = f_real_id; - ui_ic_chat_message->setFocus(); +// ui_ic_chat_message->setFocus(); } @@ -319,6 +328,7 @@ void Courtroom::on_evidence_present_clicked() void Courtroom::on_evidence_delete_clicked() { ui_evidence_description->setReadOnly(true); + ui_evidence_name->setReadOnly(true); ui_evidence_overlay->hide(); ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%")); @@ -331,7 +341,10 @@ void Courtroom::on_evidence_delete_clicked() void Courtroom::on_evidence_x_clicked() { ui_evidence_description->setReadOnly(true); + ui_evidence_name->setReadOnly(true); ui_evidence_overlay->hide(); + ui_ic_chat_message->setFocus(); +} if (current_evidence >= local_evidence_list.size()) return; -- cgit From a175a1884cd057cb01e53b66f56491f9ae0e80d5 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 20:02:51 +0300 Subject: Concurrent evidence updating! Similar to the way Google Docs work, the evidence will be updated immediately as you make any changes to it. --- include/courtroom.h | 2 ++ src/evidence.cpp | 38 +++++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 97f695c9..d02c756d 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -691,10 +691,12 @@ private slots: void on_showname_enable_clicked(); + void on_evidence_name_double_clicked(); void on_evidence_button_clicked(); void on_evidence_delete_clicked(); void on_evidence_x_clicked(); + void on_evidence_description_edited(); void on_back_to_lobby_clicked(); diff --git a/src/evidence.cpp b/src/evidence.cpp index 5e5bc9d8..b2e85571 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -31,6 +31,7 @@ void Courtroom::initialize_evidence() "color: white;"); connect(ui_evidence_name, SIGNAL(textEdited(QString)), this, SLOT(on_evidence_name_edited(QString))); + connect(ui_evidence_name, SIGNAL(double_clicked()), this, SLOT(on_evidence_name_double_clicked())); 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())); @@ -38,6 +39,7 @@ void Courtroom::initialize_evidence() 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_description, SIGNAL(textChanged()), this, SLOT(on_evidence_description_edited())); ui_evidence->hide(); } @@ -97,6 +99,19 @@ void Courtroom::set_evidence_list(QVector &p_evi_list) local_evidence_list = p_evi_list; set_evidence_page(); + + if (ui_evidence_overlay->isVisible())//Update the currently edited evidence for this user + { + if (current_evidence >= local_evidence_list.size()) + { + on_evidence_x_clicked(); + ui_evidence_name->setText(""); + } + else + { + on_evidence_double_clicked(current_evidence); + } + } } void Courtroom::set_evidence_page() @@ -267,14 +282,23 @@ void Courtroom::on_evidence_double_clicked(int p_id) evi_type f_evi = local_evidence_list.at(f_real_id); - ui_evidence_description->clear(); - ui_evidence_description->appendPlainText(f_evi.description); + QTextCursor cursor = ui_evidence_description->textCursor(); + int pos = cursor.position(); + + //ISSUE: Undo/redo history is completely inaccessible. :( + ui_evidence_description->blockSignals(true); + ui_evidence_description->setPlainText(f_evi.description); + ui_evidence_description->blockSignals(false); + + cursor.setPosition(pos); //Reset the cursor position back in place + ui_evidence_description->setTextCursor(cursor); ui_evidence_image_name->setText(f_evi.image); + ui_evidence_name->setText(f_evi.name); ui_evidence_overlay->show(); - ui_ic_chat_message->setFocus(); +// ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_hover(int p_id, bool p_state) @@ -346,9 +370,8 @@ void Courtroom::on_evidence_x_clicked() ui_ic_chat_message->setFocus(); } - if (current_evidence >= local_evidence_list.size()) - return; - +void Courtroom::on_evidence_description_edited() +{ QStringList f_contents; evi_type f_evi = local_evidence_list.at(current_evidence); @@ -359,7 +382,4 @@ void Courtroom::on_evidence_x_clicked() f_contents.append(f_evi.image); ao_app->send_server_packet(new AOPacket("EE", f_contents)); - - ui_ic_chat_message->setFocus(); } - -- cgit From 38137657de4400306a3221b2478247576db8077e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 20:45:36 +0300 Subject: emote_button_size,evidence_button_size added to courtroom_design.ini evidence_name, evidence_image_name, evidence_description added to courtroom_fonts.ini --- src/emotes.cpp | 5 +++-- src/evidence.cpp | 13 +++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/emotes.cpp b/src/emotes.cpp index f6239eef..a08043c9 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -32,12 +32,13 @@ void Courtroom::refresh_emotes() ui_emote_right->set_image("arrow_right"); QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini"); + QPoint p_point = ao_app->get_button_spacing("emote_button_size", "courtroom_design.ini"); - const int button_width = 40; + const int button_width = p_point.x(); int x_spacing = f_spacing.x(); int x_mod_count = 0; - const int button_height = 40; + const int button_height = p_point.y(); int y_spacing = f_spacing.y(); int y_mod_count = 0; diff --git a/src/evidence.cpp b/src/evidence.cpp index b2e85571..523c410e 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -7,10 +7,6 @@ void Courtroom::initialize_evidence() //ui_evidence_name = new QLabel(ui_evidence); ui_evidence_name = new AOLineEdit(ui_evidence); ui_evidence_name->setAlignment(Qt::AlignCenter); - //WHY IS THIS FONT HARDCODED, WHAT IS WRONG WITH YOU - ui_evidence_name->setFont(QFont("Arial", 14, QFont::Bold)); - ui_evidence_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: rgba(255, 128, 0, 255);"); ui_evidence_buttons = new QWidget(ui_evidence); @@ -46,6 +42,10 @@ void Courtroom::initialize_evidence() void Courtroom::refresh_evidence() { + set_font(ui_evidence_name, "", "evidence_name"); + set_font(ui_evidence_image_name, "", "evidence_image_name"); + set_font(ui_evidence_description, "", "evidence_description"); + //Should properly refresh the evidence list qDeleteAll(ui_evidence_list.begin(), ui_evidence_list.end()); ui_evidence_list.clear(); @@ -54,12 +54,13 @@ void Courtroom::refresh_evidence() set_size_and_pos(ui_evidence_buttons, "evidence_buttons"); QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", "courtroom_design.ini"); + QPoint p_point = ao_app->get_button_spacing("evidence_button_size", "courtroom_design.ini"); - const int button_width = 70; + const int button_width = p_point.x(); int x_spacing = f_spacing.x(); int x_mod_count = 0; - const int button_height = 70; + const int button_height = p_point.y(); int y_spacing = f_spacing.y(); int y_mod_count = 0; -- cgit From df08ec4be6ff519f82e22a7485725128999ce174 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 22:46:10 +0300 Subject: Get rid of some debug text --- src/courtroom.cpp | 5 +---- src/evidence.cpp | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 295f407b..fac564c4 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2318,7 +2318,7 @@ void Courtroom::start_chat_ticking() if (m_chatmessage[EFFECTS] != "") { QStringList fx_list = m_chatmessage[EFFECTS].split("|"); - qDebug() << m_chatmessage[EFFECTS] << fx_list; +// qDebug() << m_chatmessage[EFFECTS] << fx_list; QString fx = fx_list[0]; QString fx_sound; if (fx_list.length() > 1) @@ -3529,15 +3529,12 @@ void Courtroom::set_effects_dropdown() { QString entry = ui_effects_dropdown->itemText(i); QString iconpath = ao_app->get_static_image_suffix(custom_path + entry); - qDebug() << iconpath << entry; if (!file_exists(iconpath)) { iconpath = ao_app->get_static_image_suffix(theme_path + entry); - qDebug() << iconpath << entry; if (!file_exists(iconpath)) { iconpath = ao_app->get_static_image_suffix(default_path + entry); - qDebug() << iconpath << entry; if (!file_exists(iconpath)) continue; } diff --git a/src/evidence.cpp b/src/evidence.cpp index 523c410e..727f4bf6 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -189,7 +189,6 @@ void Courtroom::on_evidence_name_edited(QString text) evi_type f_evi = local_evidence_list.at(current_evidence); f_contents.append(QString::number(current_evidence)); - qDebug() << text; f_contents.append(ui_evidence_name->text()); f_contents.append(f_evi.description); f_contents.append(f_evi.image); -- cgit From 3899dbe0bd82875214ebd676130692120f89a412 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 20 Sep 2019 05:30:07 +0300 Subject: I dunno what the fuck was I doing for the past 4 hours but I made crossfading music work. Music packets can receive channel to play the song in and the crossfading option too. --- include/aomusicplayer.h | 25 +++++++++---- src/aomusicplayer.cpp | 94 +++++++++++++++++++++++++++++++++++++++---------- src/aosfxplayer.cpp | 2 +- src/courtroom.cpp | 37 +++++++++++++++---- 4 files changed, 126 insertions(+), 32 deletions(-) diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index da47128c..8ed07710 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -1,5 +1,6 @@ #ifndef AOMUSICPLAYER_H #define AOMUSICPLAYER_H +#include "file_functions.h" #if defined(BASSAUDIO) #include "bass.h" @@ -19,18 +20,30 @@ public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); virtual ~AOMusicPlayer(); - void play(QString p_song); - void stop(); - void set_volume(int p_value); - void set_looping(bool toggle); + void play(QString p_song, int channel=0, bool crossfade=false); + void stop(int channel=0); + void set_volume(int p_value, int channel=0); + void set_looping(bool toggle, int channel=0); + + //These have to be public for the stupid sync thing +// QWORD loop_start = 0; +// QWORD loop_end = 0; private: QWidget *m_parent; AOApplication *ao_app; - bool m_looping = true; + bool m_looping = false; int m_volume = 0; - HSTREAM m_stream; + + const int m_channelmax = 4; + // Channel 0 = music + // Channel 1 = ambience + // Channel 2 = extra + // Channel 3 = extra + HSTREAM m_stream_list[4]; + +// HSYNC loop_sync; }; #elif defined(QTAUDIO) class AOMusicPlayer diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 781a90c9..f6bcb17a 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -1,6 +1,6 @@ #include "aomusicplayer.h" -#if defined(BASSAUDIO) +#ifdef BASSAUDIO AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; @@ -9,48 +9,104 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) AOMusicPlayer::~AOMusicPlayer() { - BASS_ChannelStop(m_stream); + for (int n_stream = 0 ; n_stream < m_channelmax ; ++n_stream) + { + BASS_ChannelStop(m_stream_list[n_stream]); + } } -void AOMusicPlayer::play(QString p_song) +void AOMusicPlayer::play(QString p_song, int channel, bool crossfade) { - BASS_ChannelStop(m_stream); - + channel = channel % m_channelmax; QString f_path = ao_app->get_music_path(p_song); - unsigned int flags = BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE; - m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); +// QString d_path = f_path + ".txt"; + +// if (file_exists(d_path)) //Contains loop/etc. information file +// { +// QStringList lines = ao_app->read_file(d_path).split("\n"); +// foreach (QString line, lines) +// { +// QStringList args = line.split("="); +// if (args.size() < 2) +// continue; +// QString arg = args[0].trimmed(); +// if (arg == "loop_start") +// loop_start = args[1].trimmed().toUInt(); +// else if (arg == "loop_end") +// loop_end = args[1].trimmed().toUInt(); +// } +// qDebug() << "Found data file for song" << p_song << loop_start << loop_end; +// } + + unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE; + DWORD newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); - this->set_volume(m_volume); - this->set_looping(m_looping); if (ao_app->get_audio_output_device() != "default") - BASS_ChannelSetDevice(m_stream, BASS_GetDevice()); - BASS_ChannelPlay(m_stream, false); + BASS_ChannelSetDevice(m_stream_list[channel], BASS_GetDevice()); + + if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING && crossfade) + { + DWORD oldstream = m_stream_list[channel]; + + //Fade out the other sample and stop it + BASS_ChannelSlideAttribute(oldstream, BASS_ATTRIB_VOL|BASS_SLIDE_LOG, -1, 5000); + BASS_ChannelLock(oldstream, true); + //Mute the new sample + BASS_ChannelSetAttribute(newstream, BASS_ATTRIB_VOL, 0); + //Sync it with the new sample + BASS_ChannelSetPosition(newstream, BASS_ChannelGetPosition(oldstream, BASS_POS_BYTE), BASS_POS_BYTE); + //Start it + BASS_ChannelPlay(newstream, false); + //Fade in our sample + BASS_ChannelSlideAttribute(newstream, BASS_ATTRIB_VOL, static_cast(m_volume / 100.0f), 1000); + BASS_ChannelLock(oldstream, false); + m_stream_list[channel] = newstream; + } + else + { + BASS_ChannelStop(m_stream_list[channel]); + m_stream_list[channel] = newstream; + BASS_ChannelPlay(m_stream_list[channel], false); + this->set_volume(m_volume); + } + + this->set_looping(m_looping); //Have to do this here due to any crossfading-related changes, etc. } -void AOMusicPlayer::stop() +void AOMusicPlayer::stop(int channel) { - BASS_ChannelStop(m_stream); + BASS_ChannelStop(m_stream_list[channel]); } -void AOMusicPlayer::set_volume(int p_value) +void AOMusicPlayer::set_volume(int p_value, int channel) { m_volume = p_value; float volume = m_volume / 100.0f; - BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume); + BASS_ChannelSetAttribute(m_stream_list[channel], BASS_ATTRIB_VOL, volume); } -void AOMusicPlayer::set_looping(bool toggle) +//void CALLBACK loopProc(HSYNC handle, DWORD channel, DWORD data, void *user) +//{ +// AOMusicPlayer *self= static_cast(user); +// qDebug() << BASS_ChannelGetPosition(channel, BASS_POS_BYTE); +// BASS_ChannelSetPosition(channel, self->loop_start, BASS_POS_BYTE); +//} + +void AOMusicPlayer::set_looping(bool toggle, int channel) { m_looping = toggle; - if (BASS_ChannelFlags(m_stream, 0, 0) & BASS_SAMPLE_LOOP) + if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) { if (m_looping == false) - BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP); // remove the LOOP flag + BASS_ChannelFlags(m_stream_list[channel], 0, BASS_SAMPLE_LOOP); // remove the LOOP flag +// BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync); } else { if (m_looping == true) - BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag + BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag +// if (loop_end > 0 && loop_end < BASS_ChannelGetLength(m_stream_list[channel], BASS_POS_BYTE)) +// loop_sync = BASS_ChannelSetSync(m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end, loopProc, this); } } #elif defined(QTAUDIO) diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index b9410c8d..ca2b3930 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -31,7 +31,7 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, int channel { if (channel == -1) { - if (m_stream_list[channel] != NULL) + if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING) m_channel = (m_channel + 1) % m_channelmax; channel = m_channel; } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index fac564c4..4291468b 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2862,12 +2862,28 @@ void Courtroom::handle_song(QStringList *p_contents) if (n_char < 0 || n_char >= char_list.size()) { - music_player->play(f_song); + music_player->set_looping(true); + int channel = 0; + if (p_contents->length() > 3 && p_contents->at(3) != "-1") + music_player->set_looping(false); + + if (p_contents->length() > 4) //eyyy we want to change this song's CHANNEL huh + channel = p_contents->at(4).toInt(); //let the music player handle it if it's bigger than the channel list + + bool crossfade = false; + if (p_contents->length() > 5) //CROSSFADE!? Are you MAD? + { + qDebug() << p_contents->at(5); + crossfade = p_contents->at(5) == "1"; //let the music player handle it if it's bigger than the channel list + } + + music_player->play(f_song, channel, crossfade); } else { QString str_char = char_list.at(n_char).name; QString str_show = char_list.at(n_char).name; + music_player->set_looping(true); if (p_contents->length() > 2) { @@ -2884,11 +2900,14 @@ void Courtroom::handle_song(QStringList *p_contents) { music_player->set_looping(false); } - else - { - music_player->set_looping(true); - } } + int channel = 0; + if (p_contents->length() > 4) //eyyy we want to change this song's CHANNEL huh + channel = p_contents->at(4).toInt(); //let the music player handle it if it's bigger than the channel list + + bool crossfade = false; + if (p_contents->length() > 5) //CROSSFADE!? Are you MAD? + crossfade = p_contents->at(5) == "1"; //let the music player handle it if it's bigger than the channel list if (!mute_map.value(n_char)) { @@ -2902,7 +2921,7 @@ void Courtroom::handle_song(QStringList *p_contents) } append_ic_text(f_song_clear, str_show, true); - music_player->play(f_song); + music_player->play(f_song, channel, crossfade); } } } @@ -4055,6 +4074,12 @@ void Courtroom::on_flip_clicked() void Courtroom::on_additive_clicked() { + if (ui_additive->isChecked()) + { + ui_ic_chat_message->home(false); //move cursor to the start of the message + ui_ic_chat_message->insert(" "); //preface the message by whitespace + ui_ic_chat_message->end(false); //move cursor to the end of the message without selecting anything + } ui_ic_chat_message->setFocus(); } -- cgit From d3f23708c43bc132c322b778b2aa8d31a68d1c0c Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 20 Sep 2019 15:54:45 +0300 Subject: Revert buttons using setIcon and use a better stylesheet method instead Fix evidence buttons and emote buttons being hardcoded size --- include/aoemotebutton.h | 2 +- include/aoevidencebutton.h | 2 +- src/aobutton.cpp | 10 ++++------ src/aocharbutton.cpp | 8 ++++++-- src/aoemotebutton.cpp | 12 ++++++------ src/aoevidencebutton.cpp | 21 ++++++++++----------- src/emotes.cpp | 2 +- src/evidence.cpp | 2 +- 8 files changed, 30 insertions(+), 29 deletions(-) diff --git a/include/aoemotebutton.h b/include/aoemotebutton.h index 4c310147..a13688bb 100644 --- a/include/aoemotebutton.h +++ b/include/aoemotebutton.h @@ -11,7 +11,7 @@ class AOEmoteButton : public QPushButton Q_OBJECT public: - AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y); + AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, int p_w, int p_h); void set_image(QString p_image, QString p_emote_comment); void set_char_image(QString p_char, int p_emote, QString suffix); diff --git a/include/aoevidencebutton.h b/include/aoevidencebutton.h index f7baa9fa..53fa11ff 100644 --- a/include/aoevidencebutton.h +++ b/include/aoevidencebutton.h @@ -13,7 +13,7 @@ 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, int p_w, int p_h); void set_image(QString p_image); void set_theme_image(QString p_image); diff --git a/src/aobutton.cpp b/src/aobutton.cpp index d80226f2..9efe13d0 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -20,17 +20,15 @@ void AOButton::set_image(QString p_image) if (file_exists(image_path)) { - this->setIcon(QIcon(image_path)); - this->setIconSize(this->size()); - this->setStyleSheet("border:0px"); this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); } else if (file_exists(default_image_path)) { - this->setIcon(QIcon(default_image_path)); - this->setIconSize(this->size()); - this->setStyleSheet("border:0px"); this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + default_image_path + "\"); }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); } else return; diff --git a/src/aocharbutton.cpp b/src/aocharbutton.cpp index d571b953..6acad70b 100644 --- a/src/aocharbutton.cpp +++ b/src/aocharbutton.cpp @@ -70,10 +70,14 @@ void AOCharButton::set_image(QString p_character) this->setText(""); if (file_exists(image_path)) - this->setStyleSheet("border-image:url(\"" + image_path + "\")"); + { + this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); + } else { - this->setStyleSheet("border-image:url()"); + this->setStyleSheet("QPushButton { border-image: url(); }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); this->setText(p_character); } } diff --git a/src/aoemotebutton.cpp b/src/aoemotebutton.cpp index 8d687126..e42bb73c 100644 --- a/src/aoemotebutton.cpp +++ b/src/aoemotebutton.cpp @@ -2,13 +2,13 @@ #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, int p_w, int p_h) : QPushButton(p_parent) { parent = p_parent; ao_app = p_ao_app; this->move(p_x, p_y); - this->resize(40, 40); + this->resize(p_w, p_h); connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); } @@ -17,15 +17,15 @@ void AOEmoteButton::set_image(QString p_image, QString p_emote_comment) { if (file_exists(p_image)) { - this->setIcon(QIcon(p_image)); - this->setIconSize(this->size()); - this->setStyleSheet("border:0px"); this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + p_image + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); } else { this->setText(p_emote_comment); - this->setStyleSheet("border-image:url(\"\")"); + this->setStyleSheet("QPushButton { border-image: url(); }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); } } diff --git a/src/aoevidencebutton.cpp b/src/aoevidencebutton.cpp index 871b4775..61847f2d 100644 --- a/src/aoevidencebutton.cpp +++ b/src/aoevidencebutton.cpp @@ -2,28 +2,27 @@ #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, int p_w, int p_h) : QPushButton(p_parent) { ao_app = p_ao_app; m_parent = p_parent; - //HELLO AND WELCOME TO HARDCODE CENTRAL, MAY I TAKE YOUR FRESH ORDER OF PAIN AND SUFFERING ui_selected = new AOImage(this, ao_app); - ui_selected->resize(70, 70); + ui_selected->resize(p_w, p_h); // ui_selected->move(p_x, p_y); ui_selected->set_image("evidence_selected"); ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents); ui_selected->hide(); ui_selector = new AOImage(this, ao_app); - ui_selector->resize(70, 70); + ui_selector->resize(p_w, p_h); // ui_selector->move(p_x - 1, p_y - 1); ui_selector->set_image("evidence_selector"); ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); ui_selector->hide(); this->move(p_x, p_y); - this->resize(70, 70); + this->resize(p_w, p_h); // this->setAcceptDrops(true); connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); @@ -32,24 +31,24 @@ AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, i void AOEvidenceButton::set_image(QString p_image) { QString image_path = ao_app->get_evidence_path(p_image); - qDebug() << image_path << p_image; if (file_exists(p_image)) { this->setText(""); - this->setIcon(QIcon(p_image)); + this->setStyleSheet("QPushButton { border-image: url(\"" + p_image + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); } else if (file_exists(image_path)) { this->setText(""); - this->setIcon(QIcon(image_path)); + this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); } else { this->setText(p_image); - this->setIcon(QIcon()); + this->setStyleSheet("QPushButton { border-image: url(); }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); } - this->setIconSize(this->size()); - this->setStyleSheet("border:0px"); } void AOEvidenceButton::set_theme_image(QString p_image) diff --git a/src/emotes.cpp b/src/emotes.cpp index a08043c9..3e968241 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -52,7 +52,7 @@ void Courtroom::refresh_emotes() int x_pos = (button_width + x_spacing) * x_mod_count; int y_pos = (button_height + y_spacing) * y_mod_count; - AOEmoteButton *f_emote = new AOEmoteButton(ui_emotes, ao_app, x_pos, y_pos); + AOEmoteButton *f_emote = new AOEmoteButton(ui_emotes, ao_app, x_pos, y_pos, button_width, button_height); ui_emote_list.append(f_emote); diff --git a/src/evidence.cpp b/src/evidence.cpp index 727f4bf6..b04a9d60 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -74,7 +74,7 @@ void Courtroom::refresh_evidence() 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, button_width, button_height); ui_evidence_list.append(f_evidence); -- cgit From 6dd0845f1c732e9c07afaaffb9163ba736a2ae25 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 20 Sep 2019 17:03:49 +0300 Subject: Better scaling algorithm for characters of variable size --- include/aocharmovie.h | 3 +++ src/aocharmovie.cpp | 23 ++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/aocharmovie.h b/include/aocharmovie.h index adfa7b88..8aed1eb8 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -73,6 +73,9 @@ private: // These are the X and Y values before they are fixed based on the sprite's width. int x = 0; int y = 0; + // These are the width and height values before they are fixed based on the sprite's width. + int f_w = 0; + int f_h = 0; int frame = 0; int max_frames = 0; diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index b795847a..89d832df 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -232,14 +232,22 @@ QPixmap AOCharMovie::get_pixmap(QImage image) else f_pixmap = QPixmap::fromImage(image); auto aspect_ratio = Qt::KeepAspectRatio; + auto transform_mode = Qt::SmoothTransformation; - 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()) - f_pixmap = f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::SmoothTransformation); + if (f_pixmap.size().width() > this->size().width() && f_pixmap.size().height() <= this->size().height()) + { + f_pixmap = f_pixmap.scaledToHeight(this->height(), transform_mode); + } + else if (f_pixmap.size().height() > this->size().height()) + { + f_pixmap = f_pixmap.scaledToWidth(this->width(), transform_mode); + } else - f_pixmap = f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation); + { + f_pixmap = f_pixmap.scaled(this->width(), this->height(), aspect_ratio, transform_mode); + } + this->move((f_w - f_pixmap.width())/2, (f_h - f_pixmap.height())/2); + this->resize(f_pixmap.size()); return f_pixmap; } @@ -253,8 +261,9 @@ void AOCharMovie::set_frame(QPixmap f_pixmap) void AOCharMovie::combo_resize(int w, int h) { QSize f_size(w, h); + f_w = w; + f_h = h; this->resize(f_size); -// m_reader->setScaledSize(f_size); } int AOCharMovie::get_frame_delay(int delay) -- cgit From 520c4f5947528d8c8b56fdc7e93428d06b77e50c Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 20 Sep 2019 17:04:44 +0300 Subject: *better-rer* character scaling algorithm --- src/aocharmovie.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 89d832df..d764d1a5 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -234,19 +234,19 @@ QPixmap AOCharMovie::get_pixmap(QImage image) auto aspect_ratio = Qt::KeepAspectRatio; auto transform_mode = Qt::SmoothTransformation; - if (f_pixmap.size().width() > this->size().width() && f_pixmap.size().height() <= this->size().height()) + if (f_pixmap.size().width() > this->size().width() || f_pixmap.size().height() > this->size().height()) { f_pixmap = f_pixmap.scaledToHeight(this->height(), transform_mode); } - else if (f_pixmap.size().height() > this->size().height()) - { - f_pixmap = f_pixmap.scaledToWidth(this->width(), transform_mode); - } +// else if (f_pixmap.size().height() > this->size().height()) +// { +// f_pixmap = f_pixmap.scaledToWidth(this->width(), transform_mode); +// } else { f_pixmap = f_pixmap.scaled(this->width(), this->height(), aspect_ratio, transform_mode); } - this->move((f_w - f_pixmap.width())/2, (f_h - f_pixmap.height())/2); + this->move((f_w - f_pixmap.width())/2, (f_pixmap.height() - f_h)); //Always center horizontally, always put at the bottom vertically this->resize(f_pixmap.size()); return f_pixmap; -- cgit From 3fd93ab34118cfb5041b1be77e50e14658627a82 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 20 Sep 2019 17:26:41 +0300 Subject: Make ui_additive_button insert a whitespace character at the start of the message when you use it (to make it so by default, the added message will have that space, but you can safely remove it if you need to) Support for aomovie to check inside the character folder for relevant stuff if p_char is provided --- src/aomovie.cpp | 19 +++++++------------ src/courtroom.cpp | 2 ++ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/aomovie.cpp b/src/aomovie.cpp index fff8014c..561f5efe 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -35,20 +35,15 @@ void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int QList pathlist; pathlist = { - ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image + "_bubble"), //Misc path - ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path - ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path - ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //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 + ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image)), //Character folder + ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image), //Misc path + ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path + ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path + ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //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 }; - //Add this at the beginning of the list - order matters. - if (p_image == "custom") - pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image))); - else - pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image + "_bubble"))); - for (QString path : pathlist) { if (file_exists(path)) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 4291468b..17977069 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1508,6 +1508,8 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() && m_chatmessage[CHAR_ID].toInt() == m_cid) { ui_ic_chat_message->clear(); + if (ui_additive->isChecked()) + ui_ic_chat_message->insert(" "); objection_state = 0; realization_state = 0; screenshake_state = 0; -- cgit From 497901e8c361326770e88e8a01daa7891b6a16e1 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 20 Sep 2019 22:08:36 +0300 Subject: Allow realizationflash, prosecution_speedlines and defense_speedlines to be changed in a similar way shouts can be changed from the character, as well as misc folder, etc. Same for chat indicator Rename themes/ name of shouts from "objection.gif" to "objection_bubble.gif" naming convention for consistency Reorganize the default theme a bit as well as to support new elements Fix the background size not being updated properly due to bad order of reload theme Set up proper tooltips for sfx dropdown, iniswap dropdown, custom objection --- base/themes/default/chat.png | Bin 1529 -> 590 bytes base/themes/default/chatbig.png | Bin 80093 -> 584 bytes base/themes/default/chatmed.png | Bin 1669 -> 579 bytes base/themes/default/courtroom_design.ini | 194 ++++++++++++++++++---------- base/themes/default/courtroom_fonts.ini | 55 +++++++- base/themes/default/courtroombackground.png | Bin 63046 -> 50139 bytes base/themes/default/holdit.gif | Bin 40518 -> 0 bytes base/themes/default/muted_old.png | Bin 5703 -> 0 bytes base/themes/default/objection.gif | Bin 44417 -> 0 bytes base/themes/default/takethat.gif | Bin 42063 -> 0 bytes src/courtroom.cpp | 40 ++++-- 11 files changed, 201 insertions(+), 88 deletions(-) delete mode 100644 base/themes/default/holdit.gif delete mode 100644 base/themes/default/muted_old.png delete mode 100644 base/themes/default/objection.gif delete mode 100644 base/themes/default/takethat.gif diff --git a/base/themes/default/chat.png b/base/themes/default/chat.png index e11f8c8a..47281a96 100644 Binary files a/base/themes/default/chat.png and b/base/themes/default/chat.png differ diff --git a/base/themes/default/chatbig.png b/base/themes/default/chatbig.png index 177dc026..ee8d9ce2 100644 Binary files a/base/themes/default/chatbig.png and b/base/themes/default/chatbig.png differ diff --git a/base/themes/default/chatmed.png b/base/themes/default/chatmed.png index d2fee4a6..9c6f87fc 100644 Binary files a/base/themes/default/chatmed.png and b/base/themes/default/chatmed.png differ diff --git a/base/themes/default/courtroom_design.ini b/base/themes/default/courtroom_design.ini index eee76251..e53eb08d 100644 --- a/base/themes/default/courtroom_design.ini +++ b/base/themes/default/courtroom_design.ini @@ -2,35 +2,14 @@ ; compress courtroombackground.png accordingly. courtroom = 0, 0, 714, 668 +; **COORDINATE SYSTEM RELATIVE TO "courtroom"** +; x/y coordinates 0,0 will start at top-left of the "courtroom" for everything below until specified otherwise. +; **** + ; IC Area. Changing 256, 192 will stretch or compress character gifs and the ; /bgs being used accordingly viewport = 0, 0, 256, 192 -; IC chatbox -chatbox = 0, 174, 256, 108 - -; IC chatbox if the current background's folder contains stand.png, -; defensedesk.png and prosecutiondesk.png -ao2_chatbox = 0, 174, 256, 108 - -; Textbox for custom IC name (the "showname") -showname = 6, 1, 256, 15 - -; IC message, positioned within the chatbox. Changing 250 affects how -; long text goes on before going onto the next line. Changing 89 affects -; how many lines you can see before the message starts scrolling, based on -; the formula of n = 25+(n-1)*16, where n is the number of lines to be -; displayed. (ie, set it to 25 for 1 line, 41 for 2, 57 for 3, 73 for 4, -; 89 for 5, 105 for 6... Less than 25 displays nothing) -message = 3, 18, 250, 89 - -; Where you type to make an IC chat message -ic_chat_message = 2, 283, 250, 23 - -; IC chat message if the current background's folder contains stand.png, -; defensedesk.png and prosecutiondesk.png -ao2_ic_chat_message = 2, 283, 250, 23 - ; IC chatlog ic_chatlog = 260, 0, 231, 319 @@ -50,14 +29,20 @@ ooc_chat_name = 492, 300, 85, 19 ; Toggle between Server and Master OOC chats ooc_toggle = 580, 300, 133, 19 +; The scrolling music name display +music_display = 490, 0, 224, 26 +; WARNING: music_name x/y coordinates relative to music_display! +music_name = 0, 0, 224, 26 + ; Where the jukebox is music_list = 490, 342, 224, 326 ; Jukebox search bar music_search = 490, 319, 100, 23 -found_song_color = 100, 255, 100 -missing_song_color = 255, 100, 100 +; Music list state colors +found_song_color = 144, 238, 144 +missing_song_color = 255, 125, 125 ; Labels and sliders for music/sfx/blips music_label = 282, 607, 41, 16 @@ -74,6 +59,7 @@ blip_slider = 326, 648, 140, 16 ; 49X, 49Y (ie. 490, 147 if you want 10 columns and 3 rows) emotes = 5, 342, 490, 98 emote_button_spacing = 9, 9 +emote_button_size = 40, 40 ; Page togglers for emotes emote_left = 5, 434, 60, 32 @@ -83,6 +69,22 @@ emote_right = 428, 434, 60, 32 ; display the full emote name or truncate it based on length emote_dropdown = 5, 470, 105, 20 +; Display the accessible iniswaps on this character (grabbed from iniswaps.ini) +iniswap_dropdown = 100, 442, 89, 20 +; The button to remove the current iniswap +iniswap_remove = 78, 442, 20, 20 + +; Display the accessible sfx on this character (grabbed from soundlist.ini). If none found, courtroom_soundlist.ini will be used. +sfx_dropdown = 220, 442, 89, 20 +; The button to remove the current iniswap +sfx_remove = 198, 442, 20, 20 + +; Display the list of overlay effects accessible +effects_dropdown = 330, 441, 89, 22 + +; The size of the icons for dropdown entries +effects_icon_size = 16, 16 + ; Hold it/Take That/Objection and the "BLING!" buttons hold_it = 10, 310, 76, 28 objection = 90, 310, 76, 28 @@ -93,7 +95,7 @@ realization = 5, 515, 42, 42 ; custom.gif and custom.wav in their folder, this button acts as another ; Objection/Take That/Hold It for that character that uses the custom animation ; and sfx. (Think Satorah! Such Insolence!, Gotcha!) -custom_objection = 340, 565, 76, 28 +custom_objection = 250, 310, 76, 28 ; Text color dropdown menu text_color = 115, 470, 80, 20 @@ -104,7 +106,10 @@ pos_dropdown = 200, 470, 80, 20 pre = 5, 490, 80, 21 ; Flip button -flip = 104, 490, 51, 21 +flip = 64, 490, 51, 21 + +; Additive button +Additive = 114, 490, 80, 21 ; Guard button guard = 200, 580, 61, 21 @@ -132,33 +137,12 @@ call_mod = 104, 637, 64, 23 ; Mute button mute_button = 150, 515, 42, 42 +; Screenshake +screenshake = 51, 515, 42, 42 + ; Where the Mute list pops up when you click Mute mute_list = 280, 469, 210, 198 -; ???? - if there was an Area button, where the area list would show up? -; area_list = 270, 494, 224, 174 - -; ???? - where a password box appears if an area is password locked? -; area_password = 266, 471, 224, 23 - -; >Evidence meme -evidence_button = 627, 322, 85, 18 -evidence_background = 0, 385, 490, 284 -evidence_name = 112, 4, 264, 19 -evidence_buttons = 28, 27, 430, 216 -evidence_button_spacing = 2, 3 -evidence_overlay = 24, 24, 439, 222 -evidence_delete = 78, 8, 70, 20 -evidence_image_name = 150, 8, 130, 20 -evidence_image_button = 280, 8, 60, 20 -evidence_x = 341, 8, 20, 20 -evidence_description = 78, 28, 281, 166 -evidence_left = 28, 0, 60, 24 -evidence_right = 400, 0, 60, 24 -evidence_present = 165, 247, 158, 41 -left_evidence_icon = 13, 13, 70, 70 -right_evidence_icon = 173, 13, 70, 70 - ; Character select widgets char_select = 0, 0, 714, 668 back_to_lobby = 5, 5, 91, 23 @@ -173,15 +157,6 @@ spectator = 317, 640, 80, 23 ; New in 2.6.0 ; ------------------------- -; The log limiter explaining label. This is simply a piece of text that -; explains what the spin box is for. -; log_limit_label = 190, 612, 50, 30 - -; The spinbox allows you to set the log limit ingame inbetween 1 and 10000, -; with the option to set it to 0 as well (which is considered 'infinite' by -; the log limiter). -; log_limit_spinbox = 168, 636, 70, 25 - ; This is an input field that allows you to change your in-character showname. ic_chat_name = 200, 534, 78, 23 @@ -228,12 +203,12 @@ pair_offset_spinbox = 280, 470, 210, 20 switch_area_music = 590, 319, 35, 23 ; These are colours for the various statuses an area can be in. -area_free_color = 54, 198, 68 -area_lfp_color = 255, 255, 0 -area_casing_color = 255, 166, 0 -area_recess_color = 255, 190, 30 -area_rp_color = 200, 52, 252 -area_gaming_color = 55, 255, 255 +area_free_color = 144, 238, 144 +area_lfp_color = 127, 255, 0 +area_casing_color = 255, 215, 0 +area_recess_color = 255, 246, 143 +area_rp_color = 135, 206, 255 +area_gaming_color = 171, 130, 255 area_locked_color = 165, 43, 43 ; These two are casing-related inputs. @@ -242,4 +217,85 @@ area_locked_color = 165, 43, 43 ; "casing_button" is an interface to help you announce a case (you have to be ; a CM first to be able to announce cases). casing = 200, 560, 80, 21 -casing_button = 173, 637, 60, 23 \ No newline at end of file +casing_button = 173, 637, 60, 23 + +; +; Chat system +; + +; IC chatbox +chatbox = 0, 178, 256, 104 + +; IC chatbox if the current background's folder contains stand.png, +; defensedesk.png and prosecutiondesk.png +ao2_chatbox = 0, 178, 256, 104 + +; **COORDINATE SYSTEM RELATIVE TO "chatbox"/"ao2_chatbox"** +; x/y coordinates 0,0 will start at top-left of the "chatbox"/"ao2_chatbox" for everything below until specified otherwise. +; **** + +; Textbox for custom IC name (the "showname"), width is the smallest size +showname = 1, 0, 46, 15 + +; The chatbox image used for smallest possible size is "chat". "chatblank" is used if the showname is whitespace-only. +; "chatmed" will be used if the showname size exceeds the width, at which point the showname will receive showname_extra_width. +; "chatbig" will be used if the showname size exceeds the "chatmed" width, at which point the showname will receive showname_extra_width again. +; Text any bigger than that will be cut off. If "chatmed" or "chatbig" are missing, showname will not be resized. +showname_extra_width = 24 + +; IC message, positioned within the chatbox. Changing 250 affects how +; long text goes on before going onto the next line. Changing 89 affects +; how many lines you can see before the message starts scrolling, based on +; Every line height is 25 if the font size is 10 and the Sans font is used. +; There's 4 pixels from X position until the symbol is displayed. +; the formula of n = 25+(n-1)*16, where n is the number of lines to be +; displayed. (ie, set it to 25 for 1 line, 41 for 2, 57 for 3, 73 for 4, +; 89 for 5, 105 for 6... Less than 25 displays nothing) +message = 10, 12, 242, 89 + +; A chat indicator alerting us the chat ticker isn't active (text is no longer being processed). +chat_arrow = 245, 84, 11, 9 + +; Where you type to make an IC chat message +ic_chat_message = 2, 283, 250, 23 + +; IC chat message if the current background's folder contains stand.png, +; defensedesk.png and prosecutiondesk.png +ao2_ic_chat_message = 2, 283, 250, 23 + +; +; Evidence system +; + +; **COORDINATE SYSTEM RELATIVE TO "viewport"** +; x/y coordinates 0,0 will start at top-left of the "viewport" for everything below until specified otherwise. +; **** +left_evidence_icon = 13, 13, 70, 70 +right_evidence_icon = 173, 13, 70, 70 + +; **COORDINATE SYSTEM RELATIVE TO "courtroom"** +; x/y coordinates 0,0 will start at top-left of the "courtroom" for everything below until specified otherwise. +; **** + +evidence_background = 0, 385, 490, 284 +; **COORDINATE SYSTEM RELATIVE TO "evidence_background"** +; x/y coordinates 0,0 will start at top-left of the "evidence_background" for everything below until specified otherwise. +; **** +evidence_buttons = 28, 27, 430, 216 +evidence_button_spacing = 2, 3 +evidence_button_size = 70, 70 +evidence_left = 28, 0, 60, 24 +evidence_right = 400, 0, 60, 24 +evidence_present = 165, 247, 158, 41 + +evidence_overlay = 24, 24, 439, 222 +; **COORDINATE SYSTEM RELATIVE TO "evidence_overlay"** +; x/y coordinates 0,0 will start at top-left of the "evidence_overlay" (which is parented to "evidence_background") for everything below until specified otherwise. +; **** +evidence_delete = 78, 8, 70, 20 +evidence_image_name = 150, 8, 130, 20 +evidence_image_button = 280, 8, 60, 20 +evidence_x = 341, 8, 20, 20 +evidence_button = 627, 322, 85, 18 +evidence_name = 112, 4, 264, 19 +evidence_description = 78, 28, 281, 166 \ No newline at end of file diff --git a/base/themes/default/courtroom_fonts.ini b/base/themes/default/courtroom_fonts.ini index 16e2f41b..1fcba764 100644 --- a/base/themes/default/courtroom_fonts.ini +++ b/base/themes/default/courtroom_fonts.ini @@ -1,11 +1,56 @@ showname = 8 +showname_font = Sans +showname_color = 255, 255, 255 +showname_bold = 0 + message = 10 +message_font = Sans +message_color = 0, 0, 0 +message_bold = 0 + ic_chatlog = 10 -ms_chatlog = 10 -server_chatlog = 9 +ic_chatlog_font = Sans +ic_chatlog_color = 255, 255, 255 +ic_chatlog_bold = 0 + +ms_chatlog = 8 +ms_chatlog_font = Sans +ms_chatlog_color = 0, 0, 0 +ms_chatlog_sender_color = 0, 0, 95 +ms_chatlog_bold = 0 + +server_chatlog = 8 +server_chatlog_font = Sans +server_chatlog_color = 0, 0, 0 +server_chatlog_sender_color = 95, 95, 0 +server_chatlog_bold = 0 + music_list = 8 +music_list_font = Sans +music_list_color = 0, 0, 0 +music_list_bold = 0 -ic_chatlog_color = 255, 255, 255 +music_name = 8 +music_name_font = Sans +music_name_color = 255, 255, 255 +music_name_bold = 0 + +area_list = 8 +area_list_font = Sans +area_list_color = 0, 0, 0 +area_list_bold = 0 + +evidence_name = 14 +evidence_name_font = Arial +evidence_name_color = 255, 128, 0 +evidence_name_bold = 1 + +evidence_image_name = 8 +evidence_image_name_font = Arial +evidence_image_name_color = 0, 0, 0 +evidence_image_name_bold = 0 -; Color for all labels and checkboxes -label_color = 255, 255, 255 +evidence_description = 10 +evidence_description_font = Times New Roman +evidence_description_color = 255, 255, 255 +evidence_description_bold = 0 \ No newline at end of file diff --git a/base/themes/default/courtroombackground.png b/base/themes/default/courtroombackground.png index 5ad8d51a..f42797ca 100644 Binary files a/base/themes/default/courtroombackground.png and b/base/themes/default/courtroombackground.png differ diff --git a/base/themes/default/holdit.gif b/base/themes/default/holdit.gif deleted file mode 100644 index 5f71ac66..00000000 Binary files a/base/themes/default/holdit.gif and /dev/null differ diff --git a/base/themes/default/muted_old.png b/base/themes/default/muted_old.png deleted file mode 100644 index f9878f1a..00000000 Binary files a/base/themes/default/muted_old.png and /dev/null differ diff --git a/base/themes/default/objection.gif b/base/themes/default/objection.gif deleted file mode 100644 index 6aae2e56..00000000 Binary files a/base/themes/default/objection.gif and /dev/null differ diff --git a/base/themes/default/takethat.gif b/base/themes/default/takethat.gif deleted file mode 100644 index dd033102..00000000 Binary files a/base/themes/default/takethat.gif and /dev/null differ diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 17977069..d58353f2 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -579,6 +579,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_music_search, "music_search"); set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); + ui_pos_dropdown->setToolTip(tr("Set your character's emote to play on your next message.")); + set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); ui_pos_dropdown->setToolTip(tr("Set your character's supplementary background.")); @@ -586,7 +588,7 @@ void Courtroom::set_widgets() ui_iniswap_dropdown->setEditable(true); ui_iniswap_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); ui_iniswap_dropdown->setToolTip(tr("Set an 'iniswap', or an alternative character folder to refer to from your current character.\n" - "This information is saved to your base/characters//iniswaps.ini")); + "Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters//iniswaps.ini")); set_size_and_pos(ui_iniswap_remove, "iniswap_remove"); ui_iniswap_remove->setText("X"); @@ -596,8 +598,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_sfx_dropdown, "sfx_dropdown"); ui_sfx_dropdown->setEditable(true); ui_sfx_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); - ui_sfx_dropdown->setToolTip(tr("Set an 'iniswap', or an alternative character folder to refer to from your current character.\n" - "This information is saved to your base/characters//iniswaps.ini")); + ui_sfx_dropdown->setToolTip(tr("Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any).\n" + "Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters//sounds.ini")); set_size_and_pos(ui_sfx_remove, "sfx_remove"); ui_sfx_remove->setText("X"); @@ -606,7 +608,9 @@ void Courtroom::set_widgets() set_size_and_pos(ui_effects_dropdown, "effects_dropdown"); ui_effects_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); - ui_effects_dropdown->setToolTip(tr("Choose an effect to play on your next spoken message.")); + ui_effects_dropdown->setToolTip(tr("Choose an effect to play on your next spoken message.\n" + "The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by\n" + "char.ini [Options] category, effects = 'miscname' where it referes to misc//effects.ini to read the effects.")); //Todo: recode this entire fucking system with these dumbass goddamn ini's why is everything so specifically coded for all these purposes //is ABSTRACT CODING not a thing now huh what the FUCK why do I gotta do this pleASE FOR THE LOVE OF GOD SPARE ME FROM THIS FRESH HELL //btw i still love coding. @@ -716,7 +720,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_custom_objection, "custom_objection"); ui_custom_objection->setText(tr("Custom Shout!")); ui_custom_objection->set_image("custom"); - ui_custom_objection->setToolTip(tr("This will display the custom character-defined animation in the viewport as soon as it is pressed.")); + ui_custom_objection->setToolTip(tr("This will display the custom character-defined animation in the viewport as soon as it is pressed.\n" + "To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.wav")); set_size_and_pos(ui_realization, "realization"); ui_realization->set_image("realization"); @@ -1551,17 +1556,17 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) switch (objection_mod) { case 1: - ui_vp_objection->play("holdit", f_char, f_custom_theme, 724); + ui_vp_objection->play("holdit_bubble", f_char, f_custom_theme, 724); objection_player->play("holdit.wav", f_char, f_custom_theme); break; case 2: - ui_vp_objection->play("objection", f_char, f_custom_theme, 724); + ui_vp_objection->play("objection_bubble", f_char, f_custom_theme, 724); objection_player->play("objection.wav", f_char, f_custom_theme); if(ao_app->objection_stop_music()) music_player->stop(); break; case 3: - ui_vp_objection->play("takethat", f_char, f_custom_theme, 724); + ui_vp_objection->play("takethat_bubble", f_char, f_custom_theme, 724); objection_player->play("takethat.wav", f_char, f_custom_theme); break; //case 4 is AO2 only @@ -1893,7 +1898,9 @@ void Courtroom::do_flash() if(!ao_app->is_shake_flash_enabled()) return; - ui_vp_effect->play("realizationflash", "", "", 60); + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_custom_theme = ao_app->get_char_shouts(f_char); + ui_vp_effect->play("realizationflash", f_char, f_custom_theme, 60); } void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char) @@ -1948,12 +1955,14 @@ void Courtroom::handle_chatmessage_3() ui_vp_sideplayer_char->hide(); ui_vp_player_char->move(0,0); + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_custom_theme = ao_app->get_char_shouts(f_char); if (side == "pro" || side == "hlp" || side == "wit") - ui_vp_speedlines->play("prosecution_speedlines"); + ui_vp_speedlines->play("prosecution_speedlines", f_char, f_custom_theme); else - ui_vp_speedlines->play("defense_speedlines"); + ui_vp_speedlines->play("defense_speedlines", f_char, f_custom_theme); } @@ -2412,7 +2421,9 @@ void Courtroom::chat_tick() anim_state = 3; ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); } - ui_vp_chat_arrow->play("chat_arrow"); //Chat stopped being processed, indicate that. + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_custom_theme = ao_app->get_char_shouts(f_char); + ui_vp_chat_arrow->play("chat_arrow", f_char, f_custom_theme); //Chat stopped being processed, indicate that. } else @@ -3988,13 +3999,14 @@ void Courtroom::on_reload_theme_clicked() { ao_app->reload_theme(); - //to update status on the background - set_background(current_background); enter_courtroom(); update_character(m_cid); anim_state = 4; text_state = 3; + + //to update status on the background + set_background(current_background); } void Courtroom::on_back_to_lobby_clicked() -- cgit From 842b829bee8b840149c0042bb7adfc3bda6eec9d Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 20 Sep 2019 22:11:37 +0300 Subject: Tweak the ambience/crosfade layer to fade in regardless of another sample being there Fix music not being looped sometimes Prevent channel less than 0 from being passed Set up a new music display element with an attached music name, it displays a scrolling text of the currently playing music Fix music packet processing issues Make SFX slider responsible for all music channels besides 0 (actual music) scrolltext.cpp code recipe was taken from https://stackoverflow.com/questions/10651514/text-scrolling-marquee-in-qlabel - thanks to leemes for that one, I only adapted it for newer C++ version and tweaked some stuff. --- include/aomusicplayer.h | 12 +++-- include/courtroom.h | 4 ++ include/scrolltext.h | 50 ++++++++++++++++++ src/aomusicplayer.cpp | 38 ++++++++++---- src/courtroom.cpp | 73 +++++++++++++++++++------- src/scrolltext.cpp | 134 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 277 insertions(+), 34 deletions(-) create mode 100644 include/scrolltext.h create mode 100644 src/scrolltext.cpp diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 8ed07710..8e0d239a 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -19,16 +19,19 @@ class AOMusicPlayer public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); virtual ~AOMusicPlayer(); - - void play(QString p_song, int channel=0, bool crossfade=false); - void stop(int channel=0); - void set_volume(int p_value, int channel=0); + void set_volume(int p_value, int channel=-1); void set_looping(bool toggle, int channel=0); + const int m_channelmax = 4; + //These have to be public for the stupid sync thing // QWORD loop_start = 0; // QWORD loop_end = 0; +public slots: + void play(QString p_song, int channel=0, bool crossfade=false); + void stop(int channel=0); + private: QWidget *m_parent; AOApplication *ao_app; @@ -36,7 +39,6 @@ private: bool m_looping = false; int m_volume = 0; - const int m_channelmax = 4; // Channel 0 = music // Channel 1 = ambience // Channel 2 = extra diff --git a/include/courtroom.h b/include/courtroom.h index d02c756d..465b8ce1 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -26,6 +26,7 @@ #include "datatypes.h" #include "debug_functions.h" #include "chatlogpiece.h" +#include "scrolltext.h" #include #include @@ -445,6 +446,9 @@ private: QListWidget *ui_area_list; QListWidget *ui_music_list; + ScrollText *ui_music_name; + AOMovie *ui_music_display; + AOButton *ui_pair_button; QListWidget *ui_pair_list; QSpinBox *ui_pair_offset_spinbox; diff --git a/include/scrolltext.h b/include/scrolltext.h new file mode 100644 index 00000000..cf791c03 --- /dev/null +++ b/include/scrolltext.h @@ -0,0 +1,50 @@ +#ifndef SCROLLTEXT_H +#define SCROLLTEXT_H + +#include +#include +#include +#include +#include + + +class ScrollText : public QWidget +{ + Q_OBJECT + Q_PROPERTY(QString text READ text WRITE setText) + Q_PROPERTY(QString separator READ separator WRITE setSeparator) + +public: + explicit ScrollText(QWidget *parent = nullptr); + +public slots: + QString text() const; + void setText(QString text); + + QString separator() const; + void setSeparator(QString separator); + + +protected: + virtual void paintEvent(QPaintEvent *); + virtual void resizeEvent(QResizeEvent *); + +private: + void updateText(); + QString _text; + QString _separator; + QStaticText staticText; + int singleTextWidth; + QSize wholeTextSize; + int leftMargin; + bool scrollEnabled; + int scrollPos; + QImage alphaChannel; + QImage buffer; + QTimer timer; + +private slots: + virtual void timer_timeout(); +}; + +#endif // SCROLLTEXT_H diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index f6bcb17a..c845948c 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -18,6 +18,8 @@ AOMusicPlayer::~AOMusicPlayer() void AOMusicPlayer::play(QString p_song, int channel, bool crossfade) { channel = channel % m_channelmax; + if (channel < 0) //wtf? + return; QString f_path = ao_app->get_music_path(p_song); // QString d_path = f_path + ".txt"; @@ -39,27 +41,33 @@ void AOMusicPlayer::play(QString p_song, int channel, bool crossfade) // } unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE; + if (m_looping) + flags |= BASS_SAMPLE_LOOP; DWORD newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); if (ao_app->get_audio_output_device() != "default") BASS_ChannelSetDevice(m_stream_list[channel], BASS_GetDevice()); - if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING && crossfade) + if (crossfade) { DWORD oldstream = m_stream_list[channel]; - - //Fade out the other sample and stop it - BASS_ChannelSlideAttribute(oldstream, BASS_ATTRIB_VOL|BASS_SLIDE_LOG, -1, 5000); - BASS_ChannelLock(oldstream, true); //Mute the new sample BASS_ChannelSetAttribute(newstream, BASS_ATTRIB_VOL, 0); - //Sync it with the new sample - BASS_ChannelSetPosition(newstream, BASS_ChannelGetPosition(oldstream, BASS_POS_BYTE), BASS_POS_BYTE); + //Crossfade time + if (BASS_ChannelIsActive(oldstream) == BASS_ACTIVE_PLAYING) + { + //Fade out the other sample and stop it + BASS_ChannelSlideAttribute(oldstream, BASS_ATTRIB_VOL|BASS_SLIDE_LOG, -1, 5000); + BASS_ChannelLock(oldstream, true); + //Sync it with the new sample + BASS_ChannelSetPosition(newstream, BASS_ChannelGetPosition(oldstream, BASS_POS_BYTE), BASS_POS_BYTE); + BASS_ChannelLock(oldstream, false); + } //Start it BASS_ChannelPlay(newstream, false); //Fade in our sample BASS_ChannelSlideAttribute(newstream, BASS_ATTRIB_VOL, static_cast(m_volume / 100.0f), 1000); - BASS_ChannelLock(oldstream, false); + m_stream_list[channel] = newstream; } else @@ -67,7 +75,7 @@ void AOMusicPlayer::play(QString p_song, int channel, bool crossfade) BASS_ChannelStop(m_stream_list[channel]); m_stream_list[channel] = newstream; BASS_ChannelPlay(m_stream_list[channel], false); - this->set_volume(m_volume); + this->set_volume(m_volume, channel); } this->set_looping(m_looping); //Have to do this here due to any crossfading-related changes, etc. @@ -82,7 +90,17 @@ void AOMusicPlayer::set_volume(int p_value, int channel) { m_volume = p_value; float volume = m_volume / 100.0f; - BASS_ChannelSetAttribute(m_stream_list[channel], BASS_ATTRIB_VOL, volume); + if (channel < 0) + { + for (int n_stream = 0 ; n_stream < m_channelmax ; ++n_stream) + { + BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); + } + } + else + { + BASS_ChannelSetAttribute(m_stream_list[channel], BASS_ATTRIB_VOL, volume); + } } //void CALLBACK loopProc(HSYNC handle, DWORD channel, DWORD data, void *user) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index d58353f2..fa35349b 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -125,6 +125,14 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_area_list->hide(); ui_music_list = new QListWidget(this); + ui_music_display = new AOMovie(this, ao_app); + ui_music_display->set_play_once(false); + ui_music_display->setAttribute(Qt::WA_TransparentForMouseEvents); + + ui_music_name = new ScrollText(ui_music_display); + ui_music_name->setText(tr("None")); + ui_music_name->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_ic_chat_name = new QLineEdit(this); ui_ic_chat_name->setFrame(false); ui_ic_chat_name->setPlaceholderText(tr("Showname")); @@ -544,6 +552,24 @@ void Courtroom::set_widgets() set_size_and_pos(ui_area_list, "music_list"); set_size_and_pos(ui_music_list, "music_list"); + set_size_and_pos(ui_music_name, "music_name"); + + ui_music_display->move(0, 0); + design_ini_result = ao_app->get_element_dimensions("music_display", "courtroom_design.ini"); + + if (design_ini_result.width < 0 || design_ini_result.height < 0) + { + qDebug() << "W: could not find \"music_name\" in courtroom_design.ini"; + ui_music_display->hide(); + } + else + { + ui_music_display->move(design_ini_result.x, design_ini_result.y); + ui_music_display->combo_resize(design_ini_result.width, design_ini_result.height); + } + + ui_music_display->play("music_display"); + if (is_ao2_bg) { set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message"); @@ -827,6 +853,7 @@ void Courtroom::set_fonts() set_font(ui_server_chatlog, "", "server_chatlog"); set_font(ui_music_list, "", "music_list"); set_font(ui_area_list, "", "area_list"); + set_font(ui_music_name, "", "music_name"); set_dropdowns(); } @@ -1081,7 +1108,12 @@ void Courtroom::enter_courtroom() list_music(); list_areas(); - music_player->set_volume(ui_music_slider->value()); + music_player->set_volume(ui_music_slider->value(), 0); //set music + //Set the ambience and other misc. music layers + for (int i = 1; i < music_player->m_channelmax; ++i) + { + music_player->set_volume(ui_sfx_slider->value(), i); + } sfx_player->set_volume(ui_sfx_slider->value()); objection_player->set_volume(ui_sfx_slider->value()); blip_player->set_volume(ui_blip_slider->value()); @@ -1145,14 +1177,12 @@ void Courtroom::list_areas() 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.prepend("[" + QString::number(n_area) + "] "); //Give it the index + i_area.append("\n "); i_area.append(arup_statuses.at(n_area)); @@ -2873,30 +2903,33 @@ void Courtroom::handle_song(QStringList *p_contents) f_song_clear = f_song_clear.left(f_song_clear.lastIndexOf(".")); int n_char = f_contents.at(1).toInt(); + bool looping = true; + int channel = 0; + bool crossfade = false; if (n_char < 0 || n_char >= char_list.size()) { - music_player->set_looping(true); int channel = 0; if (p_contents->length() > 3 && p_contents->at(3) != "-1") - music_player->set_looping(false); + looping = false; if (p_contents->length() > 4) //eyyy we want to change this song's CHANNEL huh channel = p_contents->at(4).toInt(); //let the music player handle it if it's bigger than the channel list - bool crossfade = false; if (p_contents->length() > 5) //CROSSFADE!? Are you MAD? { - qDebug() << p_contents->at(5); crossfade = p_contents->at(5) == "1"; //let the music player handle it if it's bigger than the channel list } + qDebug() << f_song << channel << p_contents->at(3) << looping; + music_player->set_looping(looping, channel); music_player->play(f_song, channel, crossfade); + if (channel == 0) + ui_music_name->setText(f_song); } else { QString str_char = char_list.at(n_char).name; QString str_show = char_list.at(n_char).name; - music_player->set_looping(true); if (p_contents->length() > 2) { @@ -2905,20 +2938,15 @@ void Courtroom::handle_song(QStringList *p_contents) str_show = p_contents->at(2); } } - if (p_contents->length() > 3) + if (p_contents->length() > 3 && p_contents->at(3) != "-1") { //I am really confused why "-1" is "loop this song" and why anything else passes as "don't loop" //(if we even have this length) but alright - if(p_contents->at(3) != "-1") - { - music_player->set_looping(false); - } + looping = false; } - int channel = 0; if (p_contents->length() > 4) //eyyy we want to change this song's CHANNEL huh channel = p_contents->at(4).toInt(); //let the music player handle it if it's bigger than the channel list - bool crossfade = false; if (p_contents->length() > 5) //CROSSFADE!? Are you MAD? crossfade = p_contents->at(5) == "1"; //let the music player handle it if it's bigger than the channel list @@ -2934,7 +2962,10 @@ void Courtroom::handle_song(QStringList *p_contents) } append_ic_text(f_song_clear, str_show, true); + music_player->set_looping(looping, channel); music_player->play(f_song, channel, crossfade); + if (channel == 0) + ui_music_name->setText(f_song); } } } @@ -3915,13 +3946,18 @@ void Courtroom::on_text_color_changed(int p_color) void Courtroom::on_music_slider_moved(int p_value) { - music_player->set_volume(p_value); + music_player->set_volume(p_value, 0); //Set volume on music layer ui_ic_chat_message->setFocus(); } void Courtroom::on_sfx_slider_moved(int p_value) { sfx_player->set_volume(p_value); + //Set the ambience and other misc. music layers + for (int i = 1; i < music_player->m_channelmax; ++i) + { + music_player->set_volume(p_value, i); + } objection_player->set_volume(p_value); ui_ic_chat_message->setFocus(); } @@ -3986,7 +4022,6 @@ 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(); diff --git a/src/scrolltext.cpp b/src/scrolltext.cpp new file mode 100644 index 00000000..6cf075d2 --- /dev/null +++ b/src/scrolltext.cpp @@ -0,0 +1,134 @@ +#include "scrolltext.h" + + +ScrollText::ScrollText(QWidget *parent) : + QWidget(parent), scrollPos(0) +{ + staticText.setTextFormat(Qt::PlainText); + +// setFixedHeight(fontMetrics().height()*2); //The theme sets this + leftMargin = height() / 3; + + setSeparator(" --- "); + + connect(&timer, SIGNAL(timeout()), this, SLOT(timer_timeout())); + timer.setInterval(50); +} + +QString ScrollText::text() const +{ + return _text; +} + +void ScrollText::setText(QString text) +{ + _text = text; + updateText(); + update(); +} + +QString ScrollText::separator() const +{ + return _separator; +} + +void ScrollText::setSeparator(QString separator) +{ + _separator = separator; + updateText(); + update(); +} + +void ScrollText::updateText() +{ + timer.stop(); + + singleTextWidth = fontMetrics().horizontalAdvance(_text); + scrollEnabled = (singleTextWidth > width() - leftMargin*2); + + if(scrollEnabled) + { + scrollPos = -64; + staticText.setText(_text + _separator); + timer.start(); + } + else + staticText.setText(_text); + + staticText.prepare(QTransform(), font()); + wholeTextSize = QSize(fontMetrics().horizontalAdvance(staticText.text()), fontMetrics().height()); +} + +void ScrollText::paintEvent(QPaintEvent*) +{ + QPainter p(this); + + if(scrollEnabled) + { + buffer.fill(qRgba(0, 0, 0, 0)); + QPainter pb(&buffer); + pb.setPen(p.pen()); + pb.setFont(p.font()); + + int x = qMin(-scrollPos, 0) + leftMargin; + while(x < width()) + { + pb.drawStaticText(QPointF(x, (height() - wholeTextSize.height()) / 2), staticText); + x += wholeTextSize.width(); + } + + //Apply Alpha Channel + pb.setCompositionMode(QPainter::CompositionMode_DestinationIn); + pb.setClipRect(width() - 15, 0, 15, height()); + pb.drawImage(0, 0, alphaChannel); + pb.setClipRect(0, 0, 15, height()); + //initial situation: don't apply alpha channel in the left half of the image at all; apply it more and more until scrollPos gets positive + if(scrollPos < 0) + pb.setOpacity(static_cast((qMax(-8, scrollPos) + 8) / 8.0)); + pb.drawImage(0, 0, alphaChannel); + + //pb.end(); + p.drawImage(0, 0, buffer); + } + else + { + p.drawStaticText(QPointF(leftMargin, (height() - wholeTextSize.height()) / 2), staticText); + } +} + +void ScrollText::resizeEvent(QResizeEvent*) +{ + //When the widget is resized, we need to update the alpha channel. + + alphaChannel = QImage(size(), QImage::Format_ARGB32_Premultiplied); + buffer = QImage(size(), QImage::Format_ARGB32_Premultiplied); + + //Create Alpha Channel: + if(width() > 64) + { + //create first scanline + QRgb* scanline1 = reinterpret_cast(alphaChannel.scanLine(0)); + for(int x = 1; x < 16; ++x) + scanline1[x - 1] = scanline1[width() - x] = qRgba(0, 0, 0, x << 4); + for(int x = 15; x < width() - 15; ++x) + scanline1[x] = qRgb(0, 0, 0); + //copy scanline to the other ones + for(int y = 1; y < height(); ++y) + memcpy(alphaChannel.scanLine(y), scanline1, static_cast(width() * 4)); + } + else + alphaChannel.fill(qRgb(0, 0, 0)); + + + //Update scrolling state + bool newScrollEnabled = (singleTextWidth > width() - leftMargin); + if(newScrollEnabled != scrollEnabled) + updateText(); +} + +void ScrollText::timer_timeout() +{ + scrollPos = (scrollPos + 2) + % wholeTextSize.width(); + update(); +} -- cgit From 2c265ebc0befebaef41c27a851d2ebff76bf0fec Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 21 Sep 2019 00:23:01 +0300 Subject: Clear the screen and display the background in the correct position when background change func is called --- include/courtroom.h | 2 +- src/courtroom.cpp | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 465b8ce1..e350db2b 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -161,7 +161,7 @@ public: void set_pair_list(); //sets desk and bg based on pos in chatmessage - void set_scene(); + void set_scene(QString f_desk_mod, QString f_side); //sets text color based on text color in chatmessage void set_text_color(); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index fa35349b..c0574619 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1000,6 +1000,14 @@ void Courtroom::set_background(QString p_background) set_size_and_pos(ui_vp_chatbox, "chatbox"); set_size_and_pos(ui_ic_chat_message, "ic_chat_message"); } + + ui_vp_speedlines->stop(); + ui_vp_player_char->stop(); + ui_vp_sideplayer_char->stop(); + ui_vp_effect->stop(); + ui_vp_message->hide(); + ui_vp_chatbox->hide(); + set_scene(ao_app->get_char_side(current_char), QString::number(ao_app->get_desk_mod(current_char, current_emote))); } void Courtroom::update_character(int p_cid) @@ -1706,7 +1714,7 @@ void Courtroom::handle_chatmessage_2() f_weight = chatsize; this->set_qfont(ui_vp_message, "", QFont(font_name, f_weight), f_color, bold); - set_scene(); + set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); set_text_color(); // Check if the message needs to be centered. @@ -1741,7 +1749,6 @@ void Courtroom::handle_chatmessage_2() 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->stop(); ui_vp_sideplayer_char->move(0,0); @@ -2738,13 +2745,11 @@ void Courtroom::play_sfx() sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name)!="0"); } -void Courtroom::set_scene() +void Courtroom::set_scene(QString f_desk_mod, QString f_side) { //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") { -- cgit From 398f37794facc239153a8c21e0630d2eb7850739 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 23 Sep 2019 15:48:35 +0300 Subject: Make music list a QTreeWidget instead for easier category searching, etc. Temporarily allow music suffix until I let the client perform a fileExists check similar to how images are handled (.mp3? play mp3, if not mp3, play .ogg, etc. etc.) --- include/courtroom.h | 6 +++-- src/courtroom.cpp | 67 +++++++++++++++++++++++++++++++++++------------------ 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index e350db2b..59e97dd3 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include #include #include @@ -444,7 +446,7 @@ private: QListWidget *ui_mute_list; QListWidget *ui_area_list; - QListWidget *ui_music_list; + QTreeWidget *ui_music_list; ScrollText *ui_music_name; AOMovie *ui_music_display; @@ -610,7 +612,7 @@ private slots: void on_ooc_return_pressed(); 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); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c0574619..0c963c86 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -123,7 +123,11 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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(1); + ui_music_list->setHeaderHidden(true); + ui_music_list->header()->setStretchLastSection(false); + ui_music_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); ui_music_display = new AOMovie(this, ao_app); ui_music_display->set_play_once(false); @@ -308,7 +312,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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_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())); @@ -1001,13 +1005,13 @@ void Courtroom::set_background(QString p_background) set_size_and_pos(ui_ic_chat_message, "ic_chat_message"); } - ui_vp_speedlines->stop(); - ui_vp_player_char->stop(); - ui_vp_sideplayer_char->stop(); - ui_vp_effect->stop(); - ui_vp_message->hide(); - ui_vp_chatbox->hide(); - set_scene(ao_app->get_char_side(current_char), QString::number(ao_app->get_desk_mod(current_char, current_emote))); +// ui_vp_speedlines->stop(); +// ui_vp_player_char->stop(); +// ui_vp_sideplayer_char->stop(); +// ui_vp_effect->stop(); +// ui_vp_message->hide(); +// ui_vp_chatbox->hide(); +// set_scene(ao_app->get_char_side(current_char), QString::number(ao_app->get_desk_mod(current_char, current_emote))); } void Courtroom::update_character(int p_cid) @@ -1142,26 +1146,43 @@ void Courtroom::list_music() 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_listname = i_song; - i_song_listname = i_song_listname.left(i_song_listname.lastIndexOf(".")); + QString i_song_listname = i_song.left(i_song.lastIndexOf(".")); - if (i_song.toLower().contains(ui_music_search->text().toLower())) - { - ui_music_list->addItem(i_song_listname); - music_row_to_number.append(n_song); + QTreeWidgetItem *treeItem; + if (i_song_listname != i_song && parent != nullptr) //not a category, parent exists + treeItem = new QTreeWidgetItem(parent); + else + treeItem = new QTreeWidgetItem(ui_music_list); + treeItem->setText(0, i_song); + music_row_to_number.append(n_song); - QString song_path = ao_app->get_music_path(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); - else - ui_music_list->item(n_listed_songs)->setBackground(missing_brush); + if (file_exists(song_path)) + treeItem->setBackground(0, found_brush); + else + treeItem->setBackground(0, missing_brush); - ++n_listed_songs; + if (i_song_listname == i_song) //Not supposed to be a song to begin with - a category? + parent = treeItem; + ++n_listed_songs; + + if (ui_music_search->text() != "") + treeItem->setHidden(true); + } + + if (ui_music_search->text() != "") + { + QList clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 0); + foreach(QTreeWidgetItem* item, clist) + { + item->setHidden(false); } + ui_music_list->expandAll(); } } @@ -3736,12 +3757,12 @@ 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())); + QString p_song = p_item->text(column); if (!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) { -- cgit From d8857aa2e48c89a5002f8511ce566df9c557598e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 24 Sep 2019 00:38:26 +0300 Subject: When the background is changed, display it in the correct position as dictated by the server packets Add a new "set pos" packet Udpate the pos dropdown according to the current pos --- include/courtroom.h | 4 ++++ src/courtroom.cpp | 52 ++++++++++++++++++++++++++++++++++++--------- src/packet_distribution.cpp | 12 +++++++++++ 3 files changed, 58 insertions(+), 10 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 59e97dd3..26018e2c 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -150,6 +150,9 @@ public: //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 local character pos/side to use. + void set_side(QString p_side); + //sets the evidence list member variable to argument void set_evidence_list(QVector &p_evi_list); @@ -412,6 +415,7 @@ private: bool server_ooc = true; QString current_background = "default"; + QString current_side = ""; AOMusicPlayer *music_player; AOSfxPlayer *sfx_player; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 0c963c86..8896335e 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1005,15 +1005,44 @@ void Courtroom::set_background(QString p_background) set_size_and_pos(ui_ic_chat_message, "ic_chat_message"); } -// ui_vp_speedlines->stop(); -// ui_vp_player_char->stop(); -// ui_vp_sideplayer_char->stop(); -// ui_vp_effect->stop(); -// ui_vp_message->hide(); -// ui_vp_chatbox->hide(); -// set_scene(ao_app->get_char_side(current_char), QString::number(ao_app->get_desk_mod(current_char, current_emote))); + ui_vp_speedlines->stop(); + ui_vp_player_char->stop(); + ui_vp_sideplayer_char->stop(); + ui_vp_effect->stop(); + ui_vp_message->hide(); + ui_vp_chatbox->hide(); + set_scene(QString::number(ao_app->get_desk_mod(current_char, current_emote)), current_side); } +void Courtroom::set_side(QString p_side) +{ + if (p_side == "") + current_side = ao_app->get_char_side(current_char); + else + current_side = p_side; + + qDebug() << current_side; + for (int i = 0; i < ui_pos_dropdown->count(); ++i) + { + QString pos = ui_pos_dropdown->itemText(i); + if (pos == current_side) + { + //Block the signals to prevent setCurrentIndex from triggering a pos change + ui_pos_dropdown->blockSignals(true); + + //Set the index on dropdown ui element to let you know what pos you're on right now + ui_pos_dropdown->setCurrentIndex(i); + + //Unblock the signals so the element can be used for setting pos again + ui_pos_dropdown->blockSignals(false); + + //alright we dun, jobs done here boyos + break; + } + } +} + + void Courtroom::update_character(int p_cid) { bool newchar = m_cid != p_cid; @@ -1052,7 +1081,9 @@ void Courtroom::update_character(int p_cid) set_sfx_dropdown(); set_effects_dropdown(); - QString side = ao_app->get_char_side(f_char); + QString side = current_side; + if (side == "") + side = ao_app->get_char_side(current_char); if (side == "jud") { @@ -1320,7 +1351,9 @@ void Courtroom::on_chat_return_pressed() QStringList packet_contents; - QString f_side = ao_app->get_char_side(current_char); + QString f_side = current_side; + if (f_side == "") + f_side = ao_app->get_char_side(current_char); QString f_desk_mod = "chat"; @@ -2946,7 +2979,6 @@ void Courtroom::handle_song(QStringList *p_contents) crossfade = p_contents->at(5) == "1"; //let the music player handle it if it's bigger than the channel list } - qDebug() << f_song << channel << p_contents->at(3) << looping; music_player->set_looping(looping, channel); music_player->play(f_song, channel, crossfade); if (channel == 0) diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index e483ef91..75598405 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -594,7 +594,19 @@ void AOApplication::server_packet_received(AOPacket *p_packet) goto end; if (courtroom_constructed) + { + if (f_contents.size() >= 2) //We have a pos included in the background packet! + w_courtroom->set_side(f_contents.at(1)); w_courtroom->set_background(f_contents.at(0)); + } + } + else if (header == "SP") + { + if (f_contents.size() < 1) + goto end; + + if (courtroom_constructed) //We were sent a "set position" packet + w_courtroom->set_side(f_contents.at(0)); } //server accepting char request(CC) packet else if (header == "PV") -- cgit From 1e4f8fc2ac9c1232563875bf83493915bfaaaa48 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 24 Sep 2019 00:59:12 +0300 Subject: Fix a bug with music search that didn't show the item's parent when it's being searched for --- src/courtroom.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 8896335e..bdd1f776 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1211,7 +1211,9 @@ void Courtroom::list_music() QList clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 0); foreach(QTreeWidgetItem* item, clist) { - item->setHidden(false); + if (item->parent() != nullptr) //So the category shows up too + item->parent()->setHidden(false); + item->setHidden(false); } ui_music_list->expandAll(); } -- cgit From 54ef2c3fe2925c165904c474fb5f821e1d577dd8 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 24 Sep 2019 01:16:21 +0300 Subject: Remove a useless theme folder --- base/themes/1.8/arrow_left.png | Bin 742 -> 0 bytes base/themes/1.8/arrow_right.png | Bin 730 -> 0 bytes base/themes/1.8/chatmed.png | Bin 505 -> 0 bytes base/themes/1.8/favorites.png | Bin 1682 -> 0 bytes base/themes/1.8/favorites_selected.png | Bin 2238 -> 0 bytes base/themes/1.8/holdit.png | Bin 1983 -> 0 bytes base/themes/1.8/holdit_selected.png | Bin 1835 -> 0 bytes base/themes/1.8/mute.png | Bin 4984 -> 0 bytes base/themes/1.8/mute_pressed.png | Bin 4725 -> 0 bytes base/themes/1.8/objection.png | Bin 2147 -> 0 bytes base/themes/1.8/objection_selected.png | Bin 1988 -> 0 bytes base/themes/1.8/publicservers.png | Bin 1836 -> 0 bytes base/themes/1.8/publicservers_selected.png | Bin 2399 -> 0 bytes base/themes/1.8/takethat.png | Bin 2057 -> 0 bytes base/themes/1.8/takethat_selected.png | Bin 1932 -> 0 bytes 15 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 base/themes/1.8/arrow_left.png delete mode 100644 base/themes/1.8/arrow_right.png delete mode 100644 base/themes/1.8/chatmed.png delete mode 100644 base/themes/1.8/favorites.png delete mode 100644 base/themes/1.8/favorites_selected.png delete mode 100644 base/themes/1.8/holdit.png delete mode 100644 base/themes/1.8/holdit_selected.png delete mode 100644 base/themes/1.8/mute.png delete mode 100644 base/themes/1.8/mute_pressed.png delete mode 100644 base/themes/1.8/objection.png delete mode 100644 base/themes/1.8/objection_selected.png delete mode 100644 base/themes/1.8/publicservers.png delete mode 100644 base/themes/1.8/publicservers_selected.png delete mode 100644 base/themes/1.8/takethat.png delete mode 100644 base/themes/1.8/takethat_selected.png diff --git a/base/themes/1.8/arrow_left.png b/base/themes/1.8/arrow_left.png deleted file mode 100644 index f1098c49..00000000 Binary files a/base/themes/1.8/arrow_left.png and /dev/null differ diff --git a/base/themes/1.8/arrow_right.png b/base/themes/1.8/arrow_right.png deleted file mode 100644 index 2b5ad70d..00000000 Binary files a/base/themes/1.8/arrow_right.png and /dev/null differ diff --git a/base/themes/1.8/chatmed.png b/base/themes/1.8/chatmed.png deleted file mode 100644 index 0c3bae1e..00000000 Binary files a/base/themes/1.8/chatmed.png and /dev/null differ diff --git a/base/themes/1.8/favorites.png b/base/themes/1.8/favorites.png deleted file mode 100644 index 0eec6114..00000000 Binary files a/base/themes/1.8/favorites.png and /dev/null differ diff --git a/base/themes/1.8/favorites_selected.png b/base/themes/1.8/favorites_selected.png deleted file mode 100644 index f6a2abf8..00000000 Binary files a/base/themes/1.8/favorites_selected.png and /dev/null differ diff --git a/base/themes/1.8/holdit.png b/base/themes/1.8/holdit.png deleted file mode 100644 index 09d1d370..00000000 Binary files a/base/themes/1.8/holdit.png and /dev/null differ diff --git a/base/themes/1.8/holdit_selected.png b/base/themes/1.8/holdit_selected.png deleted file mode 100644 index 51586e74..00000000 Binary files a/base/themes/1.8/holdit_selected.png and /dev/null differ diff --git a/base/themes/1.8/mute.png b/base/themes/1.8/mute.png deleted file mode 100644 index e64f7025..00000000 Binary files a/base/themes/1.8/mute.png and /dev/null differ diff --git a/base/themes/1.8/mute_pressed.png b/base/themes/1.8/mute_pressed.png deleted file mode 100644 index 334b4ba7..00000000 Binary files a/base/themes/1.8/mute_pressed.png and /dev/null differ diff --git a/base/themes/1.8/objection.png b/base/themes/1.8/objection.png deleted file mode 100644 index 6fbcbc2f..00000000 Binary files a/base/themes/1.8/objection.png and /dev/null differ diff --git a/base/themes/1.8/objection_selected.png b/base/themes/1.8/objection_selected.png deleted file mode 100644 index 384e4e9b..00000000 Binary files a/base/themes/1.8/objection_selected.png and /dev/null differ diff --git a/base/themes/1.8/publicservers.png b/base/themes/1.8/publicservers.png deleted file mode 100644 index 650c20cc..00000000 Binary files a/base/themes/1.8/publicservers.png and /dev/null differ diff --git a/base/themes/1.8/publicservers_selected.png b/base/themes/1.8/publicservers_selected.png deleted file mode 100644 index 308c79fb..00000000 Binary files a/base/themes/1.8/publicservers_selected.png and /dev/null differ diff --git a/base/themes/1.8/takethat.png b/base/themes/1.8/takethat.png deleted file mode 100644 index 8ff2befe..00000000 Binary files a/base/themes/1.8/takethat.png and /dev/null differ diff --git a/base/themes/1.8/takethat_selected.png b/base/themes/1.8/takethat_selected.png deleted file mode 100644 index 3fe0a8cd..00000000 Binary files a/base/themes/1.8/takethat_selected.png and /dev/null differ -- cgit From fb6c5076aa61301d13766d7d9c607fa45e630ce5 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 24 Sep 2019 04:15:06 +0300 Subject: Fix some tooltips Workaround for music list updates forcing the music list to collapse, prioritize expanding it instead. (ISSUE: does not fix the underlying problem of the music list inexplicably collapsing/expanding. Need to preserve info for that somewhere.) Fix additive chat not showing up for anyone that's not yourself (Todo: update server code to do the proper checking) --- src/courtroom.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index bdd1f776..3d131cd1 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -609,7 +609,7 @@ void Courtroom::set_widgets() set_size_and_pos(ui_music_search, "music_search"); set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); - ui_pos_dropdown->setToolTip(tr("Set your character's emote to play on your next message.")); + ui_emote_dropdown->setToolTip(tr("Set your character's emote to play on your next message.")); set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); ui_pos_dropdown->setToolTip(tr("Set your character's supplementary background.")); @@ -629,7 +629,7 @@ void Courtroom::set_widgets() ui_sfx_dropdown->setEditable(true); ui_sfx_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); ui_sfx_dropdown->setToolTip(tr("Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any).\n" - "Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters//sounds.ini")); + "Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters//soundlist.ini")); set_size_and_pos(ui_sfx_remove, "sfx_remove"); ui_sfx_remove->setText("X"); @@ -738,7 +738,7 @@ void Courtroom::set_widgets() ui_additive->setToolTip(tr("Add text to your last spoken message when checked.")); set_size_and_pos(ui_guard, "guard"); - ui_additive->setToolTip(tr("Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window.")); + ui_guard->setToolTip(tr("Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window.")); set_size_and_pos(ui_casing, "casing"); ui_casing->setToolTip(tr("Lets you receive case alerts when enabled.\n" @@ -1215,8 +1215,8 @@ void Courtroom::list_music() item->parent()->setHidden(false); item->setHidden(false); } - ui_music_list->expandAll(); } + ui_music_list->expandAll(); //Workaround, it needs to preserve the "expanded categories" due to list music being updated constantly by some servers } void Courtroom::list_areas() @@ -1603,7 +1603,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; - is_additive = false; + //Hey, our message showed up! Cool! if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() && m_chatmessage[CHAR_ID].toInt() == m_cid) { ui_ic_chat_message->clear(); @@ -1621,12 +1621,11 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_realization->set_image("realization"); ui_screenshake->set_image("screenshake"); ui_evidence_present->set_image("present_disabled"); - - - if (ao_app->additive_enabled && ui_vp_player_char->m_char == m_chatmessage[CHAR_NAME]) - is_additive = m_chatmessage[ADDITIVE].toInt() == 1; } + //Let the server handle actually checking if they're allowed to do this. + is_additive = m_chatmessage[ADDITIVE].toInt() == 1; + chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false); ic_chatlog_history.append(*temp); ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); -- cgit From 9911aeb5e6741279715f05d76c054907c58b47de Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 24 Sep 2019 13:29:08 +0300 Subject: Fix an issue with AOCharmovie hanging on frame1 animations Fix an issue with the logger screwing up the server folder name string if character ' was used --- src/aocharmovie.cpp | 10 +++++++--- src/packet_distribution.cpp | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index d764d1a5..e8dc8fc1 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -153,8 +153,12 @@ void AOCharMovie::play() { play_frame_effect(frame); if (max_frames <= 1) - return; - ticker->start(this->get_frame_delay(movie_delays[frame])); + { + play_once = true; + ticker->start(60); + } + else + ticker->start(this->get_frame_delay(movie_delays[frame])); } void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) @@ -281,7 +285,7 @@ void AOCharMovie::move(int ax, int ay) void AOCharMovie::movie_ticker() { ++frame; - if(frame == max_frames) + if(frame >= max_frames) { if(play_once) { diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 75598405..30605303 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -288,7 +288,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) send_server_packet(f_packet); //Remove any characters not accepted in folder names for the server_name here - this->log_filename = QDateTime::currentDateTime().toUTC().toString("'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|]")) + "/'ddd MMMM yyyy hh.mm.ss t'.log'"); + this->log_filename = QDateTime::currentDateTime().toUTC().toString("'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|\']")) + "/'ddd MMMM yyyy hh.mm.ss t'.log'"); this->write_to_file("Joined server " + server_name + " on address " + server_address +" on " + QDateTime::currentDateTime().toUTC().toString(), log_filename, true); QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256); hash.addData(server_address.toUtf8()); -- cgit From 7097053723bab5cb91c312abaafeb69dc07dd4ac Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 24 Sep 2019 21:24:25 +0300 Subject: Change all instances of "colour" to "color" for consistency's sake Overhaul inline colors system to properly support additive text and further expansion Add two new colors - Gray and Blank, the latter being used for IC parsing. Instead of adding text symbol by symbol, reveal more of the already-rendered text instead so that it properly anticipates words that need to be on the newline. Changed the append_ic function slightly so it appends ": " to text only after it's no longer needed. Made gray color less inconsistent with everything else --- include/aoapplication.h | 2 +- include/aotextarea.h | 2 +- include/courtroom.h | 27 +-- include/datatypes.h | 4 +- src/courtroom.cpp | 523 +++++++++++++++----------------------------- src/text_file_functions.cpp | 68 +++--- 6 files changed, 220 insertions(+), 406 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 5fb63386..fef299b2 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -242,7 +242,7 @@ public: //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. + // Returns the color 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 diff --git a/include/aotextarea.h b/include/aotextarea.h index 13b29c9e..643a8e34 100644 --- a/include/aotextarea.h +++ b/include/aotextarea.h @@ -13,7 +13,7 @@ public: AOTextArea(QWidget *p_parent = nullptr); void append_linked(QString p_message); - void append_chatmessage(QString p_name, QString p_message, QString p_colour); + void append_chatmessage(QString p_name, QString p_message, QString p_colur); void append_error(QString p_message); private: diff --git a/include/courtroom.h b/include/courtroom.h index 26018e2c..5aad1cb4 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -171,7 +171,7 @@ public: //sets text color based on text color in chatmessage void set_text_color(); - // And gets the colour, too! + // And gets the color, too! QColor get_text_color(QString color); //takes in serverD-formatted IP list as prints a converted version to server OOC @@ -202,7 +202,7 @@ public: //these are for OOC chat void append_ms_chatmessage(QString f_name, QString f_message); - void append_server_chatmessage(QString p_name, QString p_message, QString p_colour); + void append_server_chatmessage(QString p_name, QString p_message, QString p_color); //these functions handle chatmessages sequentially. //The process itself is very convoluted and merits separate documentation @@ -213,7 +213,7 @@ 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 colorize = false, int pos = -1, int default_color = WHITE); //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 @@ -259,18 +259,6 @@ private: QParallelAnimationGroup *screenshake_animation_group = new QParallelAnimationGroup; - // 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. @@ -279,14 +267,6 @@ private: int current_display_speed = 3; int message_display_speed[7] = {0, 10, 25, 40, 50, 70, 90}; - // 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; @@ -356,6 +336,7 @@ private: bool chatmessage_is_empty = false; QString previous_ic_message = ""; + QString additive_previous = ""; //char id, muted or not QMap mute_map; diff --git a/include/datatypes.h b/include/datatypes.h index 5426d981..1917482a 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -120,7 +120,9 @@ enum COLOR YELLOW, RAINBOW, PINK, - CYAN + CYAN, + GRAY, + BLANK }; #endif // DATATYPES_H diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3d131cd1..48b88648 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1266,7 +1266,7 @@ void Courtroom::list_areas() if (ao_app->arup_enabled) { - // Colouring logic here. + // Coloring logic here. ui_area_list->item(n_listed_areas)->setBackground(free_brush); if (arup_locks.at(n_area) == "LOCKED") { @@ -1301,21 +1301,21 @@ void Courtroom::append_ms_chatmessage(QString f_name, QString f_message) ui_ms_chatlog->append_chatmessage(f_name, f_message, ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini").name()); } -void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QString p_colour) +void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QString p_color) { - QString colour = "#000000"; + QString color = "#000000"; - if (p_colour == "0") - colour = ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini").name(); - if (p_colour == "1") - colour = ao_app->get_color("server_chatlog_sender_color", "courtroom_fonts.ini").name(); + if (p_color == "0") + color = ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini").name(); + if (p_color == "1") + color = ao_app->get_color("server_chatlog_sender_color", "courtroom_fonts.ini").name(); if(p_message == "Logged in as a moderator.") { ui_guard->show(); append_server_chatmessage("CLIENT", "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, color); } void Courtroom::on_chat_return_pressed() @@ -1635,7 +1635,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ic_chatlog_history.removeFirst(); } - append_ic_text(": " + m_chatmessage[MESSAGE], f_showname); + append_ic_text(m_chatmessage[MESSAGE], f_showname); previous_ic_message = f_message; @@ -2060,19 +2060,17 @@ void Courtroom::handle_chatmessage_3() int f_anim_state = 0; //BLUE is from an enum in datatypes.h - bool text_is_blue = m_chatmessage[TEXT_COLOR].toInt() == BLUE; + bool text_is_blue = m_chatmessage[TEXT_COLOR].toInt() == BLUE || m_chatmessage[TEXT_COLOR].toInt() == ORANGE; 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) @@ -2108,148 +2106,156 @@ void Courtroom::handle_chatmessage_3() } -QString Courtroom::filter_ic_text(QString p_text) +QString Courtroom::filter_ic_text(QString p_text, bool colorize, int pos, int default_color) { // 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); - } + if(p_text.startsWith("~~")) + p_text.remove(0,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 = 0; + int check_pos = 0; 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()) - { - f_character = p_text.at(trick_check_pos); + QString f_character = p_text.at(check_pos); + std::stack ic_color_stack; - // Escape character. - if (f_character == "\\" and !ic_next_is_not_special) - { - ic_next_is_not_special = true; - p_text.remove(trick_check_pos,1); - } + if (colorize) + { + ic_color_stack.push(static_cast(default_color)); + qDebug() << ic_color_stack.top(); + QString appendage = ""; + p_text.insert(check_pos, appendage); + check_pos += appendage.size(); + if (pos > -1) + pos += appendage.size(); + } - // Text speed modifier. - else if (f_character == "{" and !ic_next_is_not_special) - { - p_text.remove(trick_check_pos,1); - } - else if (f_character == "}" and !ic_next_is_not_special) - { - p_text.remove(trick_check_pos,1); - } + while (check_pos < p_text.size()) + { + f_character = p_text.at(check_pos); + bool color_update = false; - else if (f_character == "$" and !ic_next_is_not_special) + if (!ic_next_is_not_special) + { + if (f_character == "\\") { - p_text.remove(trick_check_pos,1); + ic_next_is_not_special = true; + p_text.remove(check_pos, 1); + check_pos -= 1; + pos -= 1; } - else if (f_character == "@" and !ic_next_is_not_special) + //Nothing related to colors here + else if (f_character == "{" || f_character == "}" || f_character == "@" || f_character == "$") { - p_text.remove(trick_check_pos,1); + p_text.remove(check_pos, 1); + check_pos -= 1; + pos -= 1; } - // Orange inline colourisation. - else if (f_character == "|" and !ic_next_is_not_special) + //Colors that destroy the character + else if (f_character == "`") { - if (!ic_colour_stack.empty()) + if (colorize) + { + if (!ic_color_stack.empty() && ic_color_stack.top() == GREEN && default_color != GREEN) + ic_color_stack.pop(); //Cease our coloring + else { - if (ic_colour_stack.top() == INLINE_ORANGE) - { - ic_colour_stack.pop(); - p_text.remove(trick_check_pos,1); - } - else - { - ic_colour_stack.push(INLINE_ORANGE); - p_text.remove(trick_check_pos,1); - } + ic_color_stack.push(GREEN); //Begin our coloring } + color_update = true; + } + else + p_text.remove(check_pos, 1); + } + else if (f_character == "|") + { + if (colorize) + { + if (!ic_color_stack.empty() && ic_color_stack.top() == ORANGE && default_color != ORANGE) + ic_color_stack.pop(); //Cease our coloring else { - ic_colour_stack.push(INLINE_ORANGE); - p_text.remove(trick_check_pos,1); + ic_color_stack.push(ORANGE); //Begin our coloring } + color_update = true; + } + else + p_text.remove(check_pos, 1); } - // Blue inline colourisation. - else if (f_character == "(" and !ic_next_is_not_special) + //Colors that don't destroy the character and use 2 chars for beginning/end + else if (colorize && f_character == "(") { - ic_colour_stack.push(INLINE_BLUE); - trick_check_pos++; + ic_color_stack.push(BLUE); //Begin our coloring + color_update = true; } - else if (f_character == ")" and !ic_next_is_not_special - and !ic_colour_stack.empty()) + else if (colorize && f_character == ")" && ic_color_stack.top() == BLUE) { - if (ic_colour_stack.top() == INLINE_BLUE) - { - ic_colour_stack.pop(); - trick_check_pos++; - } - else - { - ic_next_is_not_special = true; - } + ic_color_stack.pop(); //Cease our coloring + color_update = true; } - - // Grey inline colourisation. - else if (f_character == "[" and !ic_next_is_not_special) + else if (colorize && f_character == "[") { - ic_colour_stack.push(INLINE_GREY); - trick_check_pos++; + if (colorize) + ic_color_stack.push(GRAY); //Begin our coloring + color_update = true; } - else if (f_character == "]" and !ic_next_is_not_special - and !ic_colour_stack.empty()) + else if (colorize && f_character == "]" && ic_color_stack.top() == GRAY) { - if (ic_colour_stack.top() == INLINE_GREY) - { - ic_colour_stack.pop(); - trick_check_pos++; - } - else - { - ic_next_is_not_special = true; - } + if (colorize) + ic_color_stack.pop(); //Cease our coloring + color_update = true; } - // Green inline colourisation. - else if (f_character == "`" and !ic_next_is_not_special) + //Parse the newest color stack + if (!ic_next_is_not_special && color_update && (pos <= -1 || check_pos < pos)) //Only color text if we haven't reached the "invisible threshold" { - if (!ic_colour_stack.empty()) - { - if (ic_colour_stack.top() == INLINE_GREEN) - { - ic_colour_stack.pop(); - p_text.remove(trick_check_pos,1); - } - else - { - ic_colour_stack.push(INLINE_GREEN); - p_text.remove(trick_check_pos,1); - } - } - else - { - ic_colour_stack.push(INLINE_GREEN); - p_text.remove(trick_check_pos,1); - } + QString appendage = ""; + + if (!ic_color_stack.empty()) + appendage += ""; + + if (f_character == "(" || f_character == "[") //Gotta capture them in the color too + p_text.insert(check_pos, appendage); + else if (f_character == ")" || f_character == "]") + p_text.insert(check_pos+1, appendage); + else + { + p_text.remove(check_pos, 1); + p_text.insert(check_pos, appendage); + check_pos -= 1; + pos -= 1; + } + check_pos += appendage.size(); + if (pos > -1) + pos += appendage.size(); } - else + } + else + ic_next_is_not_special = false; + + //Make all chars we're not supposed to see invisible + if (pos > -1 && check_pos == pos) + { + QString appendage = ""; + if (!ic_color_stack.empty()) { - trick_check_pos++; - ic_next_is_not_special = false; + //Clean it up, we're done here + while (!ic_color_stack.empty()) + ic_color_stack.pop(); + + appendage += ""; } + ic_color_stack.push(BLANK); + appendage += ""; + p_text.insert(check_pos, appendage); + } + check_pos += 1; + } + + if (!ic_color_stack.empty()) + { + p_text.append(""); } return p_text; @@ -2292,6 +2298,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang } else { + ui_ic_chatlog->textCursor().insertText(": ", normal); ui_ic_chatlog->textCursor().insertText(p_text, normal); } @@ -2302,7 +2309,6 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang 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) @@ -2333,6 +2339,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang } else { + ui_ic_chatlog->textCursor().insertText(": ", normal); ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); } @@ -2441,7 +2448,7 @@ void Courtroom::start_chat_ticking() } set_text_color(); - rainbow_counter = 0; +// rainbow_counter = 0; if (chatmessage_is_empty) { @@ -2452,10 +2459,10 @@ void Courtroom::start_chat_ticking() // At this point, we'd do well to clear the inline colour stack. // This stops it from flowing into next messages. - while (!inline_colour_stack.empty()) - { - inline_colour_stack.pop(); - } +// while (!inline_colour_stack.empty()) +// { +// inline_colour_stack.pop(); +// } ui_vp_chatbox->show(); ui_vp_message->show(); @@ -2463,15 +2470,12 @@ void Courtroom::start_chat_ticking() if (!is_additive) { ui_vp_message->clear(); + additive_previous = ""; } 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]); @@ -2486,11 +2490,10 @@ void Courtroom::start_chat_ticking() void Courtroom::chat_tick() { - //note: this is called fairly often(every 60 ms when char is talking) + //note: this is called fairly often //do not perform heavy operations here QString f_message = m_chatmessage[MESSAGE]; - f_message.remove(0, tick_pos); // Due to our new text speed system, we always need to stop the timer now. chat_tick_timer->stop(); @@ -2498,14 +2501,7 @@ void Courtroom::chat_tick() // 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); - } - - if (f_message.size() == 0) + if (tick_pos >= f_message.size()) { text_state = 2; if (anim_state != 4) @@ -2516,239 +2512,78 @@ void Courtroom::chat_tick() QString f_char = m_chatmessage[CHAR_NAME]; QString f_custom_theme = ao_app->get_char_shouts(f_char); ui_vp_chat_arrow->play("chat_arrow", f_char, f_custom_theme); //Chat stopped being processed, indicate that. + additive_previous = additive_previous + filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt()); } else { - QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_message); + QString f_rest = f_message; + f_rest.remove(0, tick_pos); + QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); QString f_character; int f_char_length; tbf.toNextBoundary(); if (tbf.position() == -1) - f_character = f_message; + f_character = f_rest; else - f_character = f_message.left(tbf.position()); + f_character = f_rest.left(tbf.position()); f_char_length = f_character.length(); f_character = f_character.toHtmlEscaped(); - - if (f_character == " ") - ui_vp_message->insertPlainText(" "); - // Escape character. - else if (f_character == "\\" and !next_character_is_not_special) + if (!next_character_is_not_special) { - next_character_is_not_special = true; - formatting_char = true; - } - - // Text speed modifier. - else if (f_character == "{" and !next_character_is_not_special) - { - // ++, because it INCREASES delay! - current_display_speed++; - formatting_char = true; - } - else if (f_character == "}" and !next_character_is_not_special) - { - current_display_speed--; - formatting_char = true; - } - - else if (f_character == "@" and !next_character_is_not_special) - { - this->do_screenshake(); - formatting_char = true; - } - - else if (f_character == "$" and !next_character_is_not_special) - { - this->do_flash(); - formatting_char = true; - } - - // Orange inline colourisation. - else if (f_character == "|" and !next_character_is_not_special) - { - if (!inline_colour_stack.empty()) - { - if (inline_colour_stack.top() == INLINE_ORANGE) - { - inline_colour_stack.pop(); - } - else - { - inline_colour_stack.push(INLINE_ORANGE); - } - } - else - { - inline_colour_stack.push(INLINE_ORANGE); - } - formatting_char = true; - } - - // Blue inline colourisation. - else if (f_character == "(" and !next_character_is_not_special) - { - inline_colour_stack.push(INLINE_BLUE); - ui_vp_message->insertHtml("" + 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]; - QString f_emote = m_chatmessage[EMOTE]; - ui_vp_player_char->play_idle(f_char, f_emote); - } - } - else if (f_character == ")" and !next_character_is_not_special - and !inline_colour_stack.empty()) - { - if (inline_colour_stack.top() == INLINE_BLUE) - { - inline_colour_stack.pop(); - ui_vp_message->insertHtml("" + 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) - { - inline_blue_depth--; - // Here, we check if the entire message is blue. - // If it isn't, we start talking if we have completely climbed out of inline blues. - if (!entire_message_is_blue) - { - // We should only go back to talking if we're out of inline blues, not during a non. int. pre, and not on the last character. - if (inline_blue_depth == 0 and anim_state != 4 and !(tick_pos+1 >= f_message.size())) - { - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_emote = m_chatmessage[EMOTE]; - ui_vp_player_char->play_talking(f_char, f_emote); - } - } - } - } - else - { - next_character_is_not_special = true; - tick_pos -= f_char_length; - } - } - - // Grey inline colourisation. - 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) - { - inline_colour_stack.pop(); - ui_vp_message->insertHtml("" + f_character + ""); - } - else - { - next_character_is_not_special = true; - tick_pos -= f_char_length; - } - } + if (f_character == "\\") + { + next_character_is_not_special = true; + formatting_char = true; + } - // Green inline colourisation. - else if (f_character == "`" and !next_character_is_not_special) - { - if (!inline_colour_stack.empty()) - { - if (inline_colour_stack.top() == INLINE_GREEN) - { - inline_colour_stack.pop(); - formatting_char = true; - } - else - { - inline_colour_stack.push(INLINE_GREEN); - formatting_char = true; - } - } - else - { - inline_colour_stack.push(INLINE_GREEN); - formatting_char = true; - } - } - else - { - next_character_is_not_special = false; - if (!inline_colour_stack.empty()) + // Text speed modifier. + else if (f_character == "{") { - switch (inline_colour_stack.top()) { - case INLINE_ORANGE: - ui_vp_message->insertHtml("" + f_character + ""); - break; - case INLINE_BLUE: - ui_vp_message->insertHtml("" + f_character + ""); - break; - case INLINE_GREEN: - ui_vp_message->insertHtml("" + f_character + ""); - break; - case INLINE_GREY: - ui_vp_message->insertHtml("" + f_character + ""); - break; - } + // ++, because it INCREASES delay! + current_display_speed++; + formatting_char = true; } - else + else if (f_character == "}") { - if (m_chatmessage[TEXT_COLOR].toInt() == RAINBOW) - { - 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; + current_display_speed--; + formatting_char = true; + } - ui_vp_message->insertHtml("" + f_character + ""); - } - else - ui_vp_message->insertHtml(f_character); + //Screenshake. + else if (f_character == "@") + { + this->do_screenshake(); + formatting_char = true; } - if (message_is_centered) + //Flash. + else if (f_character == "$") { - ui_vp_message->setAlignment(Qt::AlignCenter); + this->do_flash(); + formatting_char = true; } - else + + //Color memes + else if (f_character == "`" || f_character == "|") { - ui_vp_message->setAlignment(Qt::AlignLeft); + formatting_char = true; } } + else + next_character_is_not_special = false; + tick_pos += f_char_length; + + //Do the colors, gradual showing, etc. in here + ui_vp_message->setHtml(additive_previous + filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt())); + + //If the text overflows, make it snap to bottom QScrollBar *scroll = ui_vp_message->verticalScrollBar(); scroll->setValue(scroll->maximum()); @@ -2773,8 +2608,6 @@ void Courtroom::chat_tick() ++blip_pos; } - tick_pos += f_char_length; - // If we had a formatting char, we shouldn't wait so long again, as it won't appear! if (formatting_char) { diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 06caf291..91782a86 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -436,42 +436,40 @@ 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; - } + switch (p_identifier.toInt()) { + case WHITE: + case GREEN: + return_color = QColor(0, 255, 0); + break; + case RED: + return_color = QColor(255, 0, 0); + break; + case ORANGE: + return_color = QColor(255, 165, 0); + break; + case BLUE: + return_color = QColor(45, 150, 255); + break; + case YELLOW: + return_color = QColor(255, 255, 0); + break; + case RAINBOW: // 6 is rainbow. + case PINK: + return_color = QColor(255, 192, 203); + break; + case CYAN: + return_color = QColor(0, 255, 255); + break; + case GRAY: + return_color = QColor(187, 187, 187); + break; + case BLANK: + return_color = QColor(0, 0, 0, 0); + break; + 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"; -- cgit From 923548c99746858846764e47fa96899e7c5ef2ab Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 25 Sep 2019 02:05:52 +0300 Subject: Hellcommit of doom and suffering Create two new helper functions - get_chat_markdown and remake read_char_ini_tag to be read_ini_tags for more general purpose Modify aolineedit to support preserving selection after unfocusing (building this for using dropdown list for setting colors), as well as remove the setReadOnly functionality and use it in signals instead Overhaul the color system to get rid of inline colors, allow full customization of colors and usage of configuration files for every facet of how a color functions (should we be talking, should we remove that markdown char, etc.) Complete overhaul of color markdowns system TODO: Make this thing not lag to hell, fix chat messages hogging the IC as the animation never ends apparently --- include/aoapplication.h | 5 +- include/aolineedit.h | 11 +- include/courtroom.h | 16 +-- include/datatypes.h | 15 -- src/aolineedit.cpp | 14 +- src/courtroom.cpp | 325 +++++++++++++++++++++++--------------------- src/evidence.cpp | 6 +- src/text_file_functions.cpp | 49 ++++--- 8 files changed, 226 insertions(+), 215 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index fef299b2..89bfaa26 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -242,6 +242,9 @@ public: //Returns the color with p_identifier from p_file QColor get_color(QString p_identifier, QString p_file); + // Returns the markdown symbol used for specified p_identifier such as colors + QString get_chat_markdown(QString p_identifier, QString p_file); + // Returns the color from the misc folder. QColor get_chat_color(QString p_identifier, QString p_chat); @@ -261,7 +264,7 @@ public: QString read_char_ini(QString p_char, QString p_search_line, QString target_tag); //Returns a QStringList of all key=value definitions on a given tag. - QStringList read_char_ini_tag(QString p_char, QString target_tag); + QStringList read_ini_tags(QString p_file, QString target_tag = ""); //Sets the char.ini p_search_line key under tag target_tag to value. void set_char_ini(QString p_char, QString value, QString p_search_line, QString target_tag); diff --git a/include/aolineedit.h b/include/aolineedit.h index ce17680d..09521729 100644 --- a/include/aolineedit.h +++ b/include/aolineedit.h @@ -11,16 +11,17 @@ class AOLineEdit : public QLineEdit public: AOLineEdit(QWidget *parent); + void preserve_selection(bool toggle) {p_selection = toggle;} + +private: + bool p_selection = false; + protected: void mouseDoubleClickEvent(QMouseEvent *e); + void focusOutEvent(QFocusEvent *ev); signals: void double_clicked(); - -private slots: - void on_enter_pressed(); - - }; #endif // AOLINEEDIT_H diff --git a/include/courtroom.h b/include/courtroom.h index 5aad1cb4..72dec046 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -168,12 +168,6 @@ public: //sets desk and bg based on pos in chatmessage void set_scene(QString f_desk_mod, QString f_side); - //sets text color based on text color in chatmessage - void set_text_color(); - - // And gets the color, 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); @@ -213,7 +207,7 @@ public: //This function filters out the common CC inline text trickery, for appending to //the IC chatlog. - QString filter_ic_text(QString p_text, bool colorize = false, int pos = -1, int default_color = WHITE); + QString filter_ic_text(QString p_text, bool colorize = false, int pos = -1, int default_color = 0); //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 @@ -360,6 +354,9 @@ private: int realization_state = 0; int screenshake_state = 0; int text_color = 0; + static const int max_colors = 12; //How many unique user colors are possible + QVector color_row_to_number; //Current color list indexes to real color references + bool is_presenting_evidence = false; QString effect = ""; @@ -440,7 +437,7 @@ private: QListWidget *ui_pair_list; QSpinBox *ui_pair_offset_spinbox; - QLineEdit *ui_ic_chat_message; + AOLineEdit *ui_ic_chat_message; QLineEdit *ui_ic_chat_name; QLineEdit *ui_ooc_chat_message; @@ -625,7 +622,7 @@ private slots: QString get_char_sfx(); int get_char_sfx_delay(); - void on_evidence_name_edited(QString text); + void on_evidence_name_edited(); void on_evidence_image_name_edited(); void on_evidence_image_button_clicked(); void on_evidence_clicked(int p_id); @@ -654,6 +651,7 @@ private slots: void on_prosecution_plus_clicked(); void on_text_color_changed(int p_color); + void set_text_color_dropdown(); void on_music_slider_moved(int p_value); void on_sfx_slider_moved(int p_value); diff --git a/include/datatypes.h b/include/datatypes.h index 1917482a..835cf8f4 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -110,19 +110,4 @@ enum CHAT_MESSAGE EFFECTS }; -enum COLOR -{ - WHITE = 0, - GREEN, - RED, - ORANGE, - BLUE, - YELLOW, - RAINBOW, - PINK, - CYAN, - GRAY, - BLANK -}; - #endif // DATATYPES_H diff --git a/src/aolineedit.cpp b/src/aolineedit.cpp index 13f87f31..e345de3b 100644 --- a/src/aolineedit.cpp +++ b/src/aolineedit.cpp @@ -2,21 +2,19 @@ AOLineEdit::AOLineEdit(QWidget *parent) : QLineEdit(parent) { - this->setReadOnly(true); - this->setFrame(false); - - connect(this, SIGNAL(returnPressed()), this, SLOT(on_enter_pressed())); } void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e) { QLineEdit::mouseDoubleClickEvent(e); - this->setReadOnly(false); double_clicked(); } - -void AOLineEdit::on_enter_pressed() +void AOLineEdit::focusOutEvent(QFocusEvent *ev) { - this->setReadOnly(true); + int start = selectionStart(); + int end = selectionEnd(); + QLineEdit::focusOutEvent(ev); + if (p_selection && start != -1 && end != -1) + this->setSelection(start, end); } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 48b88648..3ff1aa23 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -141,9 +141,10 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ic_chat_name->setFrame(false); ui_ic_chat_name->setPlaceholderText(tr("Showname")); - ui_ic_chat_message = new QLineEdit(this); + ui_ic_chat_message = new AOLineEdit(this); ui_ic_chat_message->setFrame(false); ui_ic_chat_message->setPlaceholderText(tr("Message")); + ui_ic_chat_message->preserve_selection(true); ui_muted = new AOImage(ui_ic_chat_message, ao_app); ui_muted->hide(); @@ -247,15 +248,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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); @@ -784,6 +776,7 @@ void Courtroom::set_widgets() set_size_and_pos(ui_text_color, "text_color"); ui_text_color->setToolTip(tr("Change the text color of the spoken message.")); + set_text_color_dropdown(); set_size_and_pos(ui_music_slider, "music_slider"); set_size_and_pos(ui_sfx_slider, "sfx_slider"); @@ -1513,7 +1506,7 @@ void Courtroom::on_chat_return_pressed() packet += f_emote; if (ao_app->is_frame_network_enabled()) { - QString sfx_frames = ao_app->read_char_ini_tag(current_char, f_emote.append(f_effect)).join("|"); + QString sfx_frames = ao_app->read_ini_tags(ao_app->get_character_path(current_char, "char.ini"), f_emote.append(f_effect)).join("|"); if (sfx_frames != "") packet += "|" + sfx_frames; } @@ -1770,7 +1763,6 @@ void Courtroom::handle_chatmessage_2() this->set_qfont(ui_vp_message, "", QFont(font_name, f_weight), f_color, bold); set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); - set_text_color(); // Check if the message needs to be centered. QString f_message = m_chatmessage[MESSAGE]; @@ -2058,38 +2050,6 @@ void Courtroom::handle_chatmessage_3() } - int f_anim_state = 0; - //BLUE is from an enum in datatypes.h - bool text_is_blue = m_chatmessage[TEXT_COLOR].toInt() == BLUE || m_chatmessage[TEXT_COLOR].toInt() == ORANGE; - - if (!text_is_blue && text_state == 1) - { - //talking - f_anim_state = 2; - } - else - { - //idle - f_anim_state = 3; - } - - if (f_anim_state <= anim_state) - return; - - ui_vp_player_char->stop(); - QString 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(); @@ -2115,13 +2075,13 @@ QString Courtroom::filter_ic_text(QString p_text, bool colorize, int pos, int de int check_pos = 0; bool ic_next_is_not_special = false; QString f_character = p_text.at(check_pos); - std::stack ic_color_stack; + std::stack ic_color_stack; if (colorize) { - ic_color_stack.push(static_cast(default_color)); + ic_color_stack.push(default_color); qDebug() << ic_color_stack.top(); - QString appendage = ""; + QString appendage = "get_chat_color(QString::number(ic_color_stack.top()), m_chatmessage[CHAR_NAME]).name(QColor::HexRgb) +"\">"; p_text.insert(check_pos, appendage); check_pos += appendage.size(); if (pos > -1) @@ -2151,84 +2111,91 @@ QString Courtroom::filter_ic_text(QString p_text, bool colorize, int pos, int de pos -= 1; } - //Colors that destroy the character - else if (f_character == "`") + bool is_end = false; + bool remove = false; + //Parse markdown colors + for (int c = 0; c < max_colors; ++c) { - if (colorize) + QString markdown_start = ao_app->get_chat_markdown("c" + QString::number(c) + "_start", m_chatmessage[CHAR_NAME]); + if (markdown_start.isEmpty()) //Not defined + continue; + QString markdown_end = ao_app->get_chat_markdown("c" + QString::number(c) + "_end", m_chatmessage[CHAR_NAME]); + bool markdown_remove = ao_app->get_chat_markdown("c" + QString::number(c) + "_remove", m_chatmessage[CHAR_NAME]) == "1"; + + if (markdown_end.isEmpty() || markdown_end == markdown_start) //"toggle switch" type { - if (!ic_color_stack.empty() && ic_color_stack.top() == GREEN && default_color != GREEN) - ic_color_stack.pop(); //Cease our coloring - else + if (f_character == markdown_start) { - ic_color_stack.push(GREEN); //Begin our coloring + if (colorize) + { + if (!ic_color_stack.empty() && ic_color_stack.top() == c && default_color != c) + ic_color_stack.pop(); //Cease our coloring + else + { + ic_color_stack.push(c); //Begin our coloring + } + color_update = true; + } + remove = markdown_remove; + break; //Prevent it from looping forward for whatever reason } - color_update = true; } - else - p_text.remove(check_pos, 1); - } - else if (f_character == "|") - { - if (colorize) + else if (f_character == markdown_start || (f_character == markdown_end && ic_color_stack.top() == c)) { - if (!ic_color_stack.empty() && ic_color_stack.top() == ORANGE && default_color != ORANGE) - ic_color_stack.pop(); //Cease our coloring - else + if (colorize) { - ic_color_stack.push(ORANGE); //Begin our coloring + if (f_character == markdown_start) + { + ic_color_stack.push(c); //Begin our coloring + } + else if (f_character == markdown_end) + { + ic_color_stack.pop(); //Cease our coloring + is_end = true; + } + color_update = true; } - color_update = true; + remove = markdown_remove; + break; //Prevent it from looping forward for whatever reason } - else - p_text.remove(check_pos, 1); - } - - //Colors that don't destroy the character and use 2 chars for beginning/end - else if (colorize && f_character == "(") - { - ic_color_stack.push(BLUE); //Begin our coloring - color_update = true; - } - else if (colorize && f_character == ")" && ic_color_stack.top() == BLUE) - { - ic_color_stack.pop(); //Cease our coloring - color_update = true; - } - else if (colorize && f_character == "[") - { - if (colorize) - ic_color_stack.push(GRAY); //Begin our coloring - color_update = true; } - else if (colorize && f_character == "]" && ic_color_stack.top() == GRAY) - { - if (colorize) - ic_color_stack.pop(); //Cease our coloring - color_update = true; - } - //Parse the newest color stack - if (!ic_next_is_not_special && color_update && (pos <= -1 || check_pos < pos)) //Only color text if we haven't reached the "invisible threshold" + if (color_update) { - QString appendage = ""; + if (!ic_next_is_not_special && (pos <= -1 || check_pos < pos)) //Only color text if we haven't reached the "invisible threshold" + { + QString appendage = ""; - if (!ic_color_stack.empty()) - appendage += ""; + if (!ic_color_stack.empty()) + appendage += "get_chat_color(QString::number(ic_color_stack.top()), m_chatmessage[CHAR_NAME]).name(QColor::HexRgb) +"\">"; - if (f_character == "(" || f_character == "[") //Gotta capture them in the color too - p_text.insert(check_pos, appendage); - else if (f_character == ")" || f_character == "]") - p_text.insert(check_pos+1, appendage); - else - { - p_text.remove(check_pos, 1); - p_text.insert(check_pos, appendage); - check_pos -= 1; - pos -= 1; + if (!is_end || remove) + { + if (remove) + p_text.remove(check_pos, 1); + + p_text.insert(check_pos, appendage); + + if (remove) + { + check_pos -= 1; + pos -= 1; + } + } + else + { + p_text.insert(check_pos+1, appendage); + } + check_pos += appendage.size(); + if (pos > -1) + pos += appendage.size(); } - check_pos += appendage.size(); - if (pos > -1) - pos += appendage.size(); + } + else if (remove) //Simple remove request + { + p_text.remove(check_pos, 1); + check_pos -= 1; + pos -= 1; } } else @@ -2246,8 +2213,8 @@ QString Courtroom::filter_ic_text(QString p_text, bool colorize, int pos, int de appendage += ""; } - ic_color_stack.push(BLANK); - appendage += ""; + ic_color_stack.push(-1); //Dummy colorstack push for maximum appendage + appendage += ""; p_text.insert(check_pos, appendage); } check_pos += 1; @@ -2447,9 +2414,6 @@ void Courtroom::start_chat_ticking() this->do_screenshake(); } - set_text_color(); -// rainbow_counter = 0; - if (chatmessage_is_empty) { //since the message is empty, it's technically done ticking @@ -2457,13 +2421,6 @@ void Courtroom::start_chat_ticking() 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(); ui_vp_message->show(); @@ -2486,6 +2443,22 @@ void Courtroom::start_chat_ticking() //means text is currently ticking text_state = 1; + + //If this color is talking + bool color_is_talking = ao_app->get_chat_markdown("c" + m_chatmessage[TEXT_COLOR] + "_talking", m_chatmessage[CHAR_NAME]) == "1"; + + if (color_is_talking && text_state == 1 && anim_state < 2) //Set it to talking as we're not on that already + { +// ui_vp_player_char->stop(); + ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + anim_state = 2; + } + else if (anim_state < 3) //Set it to idle as we're not on that already + { +// ui_vp_player_char->stop(); + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + anim_state = 3; + } } void Courtroom::chat_tick() @@ -2500,6 +2473,7 @@ void Courtroom::chat_tick() // Stops blips from playing when we have a formatting option. bool formatting_char = false; + bool is_talking = ao_app->get_chat_markdown("c" + m_chatmessage[TEXT_COLOR] + "_talking", m_chatmessage[CHAR_NAME]) == "1"; if (tick_pos >= f_message.size()) { @@ -2568,11 +2542,25 @@ void Courtroom::chat_tick() this->do_flash(); formatting_char = true; } - - //Color memes - else if (f_character == "`" || f_character == "|") + else { - formatting_char = true; + //Parse markdown colors + for (int c = 0; c < max_colors; ++c) + { + QString markdown_start = ao_app->get_chat_markdown("c" + QString::number(c) + "_start", m_chatmessage[CHAR_NAME]); + if (markdown_start.isEmpty()) + continue; + QString markdown_end = ao_app->get_chat_markdown("c" + QString::number(c) + "_end", m_chatmessage[CHAR_NAME]); + bool markdown_remove = ao_app->get_chat_markdown("c" + QString::number(c) + "_remove", m_chatmessage[CHAR_NAME]) == "1"; + bool color_is_talking = ao_app->get_chat_markdown("c" + QString::number(c) + "_talking", m_chatmessage[CHAR_NAME]) == "1"; + + if (markdown_remove && (f_character == markdown_start || f_character == markdown_end)) + { + formatting_char = true; + is_talking = color_is_talking; + break; + } + } } } else @@ -2591,12 +2579,12 @@ void Courtroom::chat_tick() // 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 && (f_character != ' ' || blank_blip)) @@ -2611,13 +2599,27 @@ void Courtroom::chat_tick() // If we had a formatting char, we shouldn't wait so long again, as it won't appear! if (formatting_char) { - chat_tick_timer->start(0); + chat_tick_timer->start(0); } else { - chat_tick_timer->start(message_display_speed[current_display_speed]); - } + //If this color is talking + if (is_talking && text_state == 1 && anim_state < 2) //Set it to talking as we're not on that already + { +// ui_vp_player_char->stop(); + ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + anim_state = 2; + } + else if (anim_state < 3) //Set it to idle as we're not on that already + { +// ui_vp_player_char->stop(); + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + anim_state = 3; + } + //Continue ticking + chat_tick_timer->start(message_display_speed[current_display_speed]); + } } } @@ -2722,30 +2724,6 @@ void Courtroom::set_scene(QString f_desk_mod, QString f_side) } } -void Courtroom::set_text_color() -{ - QColor textcolor = ao_app->get_chat_color(m_chatmessage[TEXT_COLOR], ao_app->get_chat(m_chatmessage[CHAR_NAME])); - - ui_vp_message->setTextBackgroundColor(QColor(0,0,0,0)); - ui_vp_message->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) -{ - return ao_app->get_chat_color(color, ao_app->get_chat(m_chatmessage[CHAR_NAME])); -} - void Courtroom::set_ip_list(QString p_list) { QString f_list = p_list.replace("|", ":").replace("*", "\n"); @@ -3830,9 +3808,44 @@ void Courtroom::on_prosecution_plus_clicked() ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%")); } +void Courtroom::set_text_color_dropdown() +{ + ui_text_color->clear(); + color_row_to_number.clear(); + + //Set the default color 0 + QString c0_name = ao_app->get_chat_markdown("c0_name", current_char); + if (c0_name.isEmpty()) + c0_name = tr("Default"); + ui_text_color->addItem(c0_name); + color_row_to_number.append(0); + + //Set the rest of the colors + for (int c = 1; c < max_colors; ++c) + { + QString color_name = ao_app->get_chat_markdown("c" + QString::number(c) + "_name", current_char); + if (color_name.isEmpty()) //Not defined + continue; + ui_text_color->addItem(color_name); + color_row_to_number.append(c); + } +} + void Courtroom::on_text_color_changed(int p_color) { - text_color = p_color; + if (ui_ic_chat_message->selectionStart() != -1) //We have a selection! + { + qDebug() << "Setting color to selection" << ui_ic_chat_message->selectionStart() << ui_ic_chat_message->selectionEnd(); + ui_ic_chat_message->end(false); + ui_text_color->setCurrentIndex(0); + } + else + { + if (p_color != -1 && p_color < color_row_to_number.size()) + text_color = color_row_to_number.at(p_color); + else + text_color = 0; + } ui_ic_chat_message->setFocus(); } diff --git a/src/evidence.cpp b/src/evidence.cpp index b04a9d60..dfbc675f 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -26,7 +26,7 @@ void Courtroom::initialize_evidence() ui_evidence_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: white;"); - connect(ui_evidence_name, SIGNAL(textEdited(QString)), this, SLOT(on_evidence_name_edited(QString))); + connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited())); connect(ui_evidence_name, SIGNAL(double_clicked()), this, SLOT(on_evidence_name_double_clicked())); connect(ui_evidence_left, SIGNAL(clicked()), this, SLOT(on_evidence_left_clicked())); connect(ui_evidence_right, SIGNAL(clicked()), this, SLOT(on_evidence_right_clicked())); @@ -179,8 +179,9 @@ void Courtroom::set_evidence_page() } } -void Courtroom::on_evidence_name_edited(QString text) +void Courtroom::on_evidence_name_edited() { + ui_evidence_name->setReadOnly(true); if (current_evidence >= local_evidence_list.size()) return; @@ -206,6 +207,7 @@ void Courtroom::on_evidence_name_double_clicked() void Courtroom::on_evidence_image_name_edited() { + ui_evidence_image_name->setReadOnly(true); if (current_evidence >= local_evidence_list.size()) return; diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 91782a86..b9764343 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -432,48 +432,57 @@ QString AOApplication::get_tagged_stylesheet(QString target_tag, QString p_file) return f_text; } +QString AOApplication::get_chat_markdown(QString p_identifier, QString p_chat) +{ + 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); + + return f_result; +} + QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) { QColor return_color(255, 255, 255); switch (p_identifier.toInt()) { - case WHITE: - case GREEN: + case 0: //White + return_color = QColor(255, 255, 255); + break; + case 1: //Green return_color = QColor(0, 255, 0); break; - case RED: + case 2: //Red return_color = QColor(255, 0, 0); break; - case ORANGE: + case 3: //Orange return_color = QColor(255, 165, 0); break; - case BLUE: + case 4: //Blue return_color = QColor(45, 150, 255); break; - case YELLOW: + case 5: //Yellow return_color = QColor(255, 255, 0); break; - case RAINBOW: // 6 is rainbow. - case PINK: + case 6: //Pink return_color = QColor(255, 192, 203); break; - case CYAN: + case 7: //Cyan return_color = QColor(0, 255, 255); break; - case GRAY: + case 8: //Grey return_color = QColor(187, 187, 187); break; - case BLANK: - return_color = QColor(0, 0, 0, 0); - break; 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); + QString f_result = read_design_ini("c" + p_identifier, design_ini_path); if (f_result == "") { @@ -567,18 +576,20 @@ void AOApplication::set_char_ini(QString p_char, QString value, QString p_search } //returns all the values of target_tag -QStringList AOApplication::read_char_ini_tag(QString p_char, QString target_tag) +QStringList AOApplication::read_ini_tags(QString p_path, QString target_tag) { QStringList r_values; - QSettings settings(get_character_path(p_char, "char.ini"), QSettings::IniFormat); - settings.beginGroup(target_tag); + QSettings settings(p_path, QSettings::IniFormat); + if (!target_tag.isEmpty()) + settings.beginGroup(target_tag); QStringList keys = settings.allKeys(); foreach (QString key, keys) { QString value = settings.value(key).toString(); r_values << key + "=" + value; } - settings.endGroup(); + if (!settings.group().isEmpty()) + settings.endGroup(); return r_values; } -- cgit From a028b8496e6684f89efc3b8bf7946fb5901faa99 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 25 Sep 2019 03:39:32 +0300 Subject: Fix objections botching up single frame preanims, etc. --- src/aocharmovie.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index e8dc8fc1..5294b23c 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -154,8 +154,8 @@ void AOCharMovie::play() play_frame_effect(frame); if (max_frames <= 1) { - play_once = true; - ticker->start(60); + if (play_once) + ticker->start(60); } else ticker->start(this->get_frame_delay(movie_delays[frame])); @@ -316,6 +316,7 @@ void AOCharMovie::movie_ticker() void AOCharMovie::preanim_done() { + ticker->stop(); preanim_timer->stop(); done(); } -- cgit From b67f083506803c3cf075e8872cacb329b063e8b3 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 25 Sep 2019 03:40:44 +0300 Subject: Optimize color markdown stuff properly by creating lists and preloading things --- include/courtroom.h | 25 ++++++++++++-- src/courtroom.cpp | 95 ++++++++++++++++++++++++++++++----------------------- 2 files changed, 76 insertions(+), 44 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 72dec046..d6bf4512 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -354,8 +354,29 @@ private: int realization_state = 0; int screenshake_state = 0; int text_color = 0; - static const int max_colors = 12; //How many unique user colors are possible - QVector color_row_to_number; //Current color list indexes to real color references + + //How many unique user colors are possible + static const int max_colors = 12; + + //Text Color-related optimization: + //Current color list indexes to real color references + QVector color_row_to_number; + + //List of associated RGB colors for this color index + QVector color_rgb_list; + + //List of markdown start characters, their index is tied to the color index + QStringList color_markdown_start_list; + + //List of markdown end characters, their index is tied to the color index + QStringList color_markdown_end_list; + + //Whether or not we're supposed to remove this char during parsing + QVector color_markdown_remove_list; + + //Whether or not this color allows us to play the talking animation + QVector color_markdown_talking_list; + //Text Color-related optimization END bool is_presenting_evidence = false; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3ff1aa23..2ae611a1 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1014,7 +1014,6 @@ void Courtroom::set_side(QString p_side) else current_side = p_side; - qDebug() << current_side; for (int i = 0; i < ui_pos_dropdown->count(); ++i) { QString pos = ui_pos_dropdown->itemText(i); @@ -2050,6 +2049,22 @@ void Courtroom::handle_chatmessage_3() } + //If this color is talking + bool color_is_talking = ao_app->get_chat_markdown("c" + m_chatmessage[TEXT_COLOR] + "_talking", m_chatmessage[CHAR_NAME]) == "1"; + + if (color_is_talking && text_state == 1 && anim_state < 2) //Set it to talking as we're not on that already + { + ui_vp_player_char->stop(); + ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + anim_state = 2; + } + else if (anim_state < 3) //Set it to idle as we're not on that already + { + ui_vp_player_char->stop(); + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + anim_state = 3; + } + QString f_message = m_chatmessage[MESSAGE]; QStringList call_words = ao_app->get_call_words(); @@ -2080,8 +2095,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool colorize, int pos, int de if (colorize) { ic_color_stack.push(default_color); - qDebug() << ic_color_stack.top(); - QString appendage = "get_chat_color(QString::number(ic_color_stack.top()), m_chatmessage[CHAR_NAME]).name(QColor::HexRgb) +"\">"; + QString appendage = ""; p_text.insert(check_pos, appendage); check_pos += appendage.size(); if (pos > -1) @@ -2116,11 +2130,13 @@ QString Courtroom::filter_ic_text(QString p_text, bool colorize, int pos, int de //Parse markdown colors for (int c = 0; c < max_colors; ++c) { - QString markdown_start = ao_app->get_chat_markdown("c" + QString::number(c) + "_start", m_chatmessage[CHAR_NAME]); + //Clear the stored optimization information + QString markdown_start = color_markdown_start_list.at(c); + QString markdown_end = color_markdown_end_list.at(c); + bool markdown_remove = color_markdown_remove_list.at(c); +// bool is_talking = color_markdown_talking_list.at(c); if (markdown_start.isEmpty()) //Not defined continue; - QString markdown_end = ao_app->get_chat_markdown("c" + QString::number(c) + "_end", m_chatmessage[CHAR_NAME]); - bool markdown_remove = ao_app->get_chat_markdown("c" + QString::number(c) + "_remove", m_chatmessage[CHAR_NAME]) == "1"; if (markdown_end.isEmpty() || markdown_end == markdown_start) //"toggle switch" type { @@ -2167,7 +2183,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool colorize, int pos, int de QString appendage = ""; if (!ic_color_stack.empty()) - appendage += "get_chat_color(QString::number(ic_color_stack.top()), m_chatmessage[CHAR_NAME]).name(QColor::HexRgb) +"\">"; + appendage += ""; if (!is_end || remove) { @@ -2317,7 +2333,6 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang 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) @@ -2395,7 +2410,6 @@ void Courtroom::start_chat_ticking() if (m_chatmessage[EFFECTS] != "") { QStringList fx_list = m_chatmessage[EFFECTS].split("|"); -// qDebug() << m_chatmessage[EFFECTS] << fx_list; QString fx = fx_list[0]; QString fx_sound; if (fx_list.length() > 1) @@ -2443,22 +2457,6 @@ void Courtroom::start_chat_ticking() //means text is currently ticking text_state = 1; - - //If this color is talking - bool color_is_talking = ao_app->get_chat_markdown("c" + m_chatmessage[TEXT_COLOR] + "_talking", m_chatmessage[CHAR_NAME]) == "1"; - - if (color_is_talking && text_state == 1 && anim_state < 2) //Set it to talking as we're not on that already - { -// ui_vp_player_char->stop(); - ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - anim_state = 2; - } - else if (anim_state < 3) //Set it to idle as we're not on that already - { -// ui_vp_player_char->stop(); - ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - anim_state = 3; - } } void Courtroom::chat_tick() @@ -2473,7 +2471,7 @@ void Courtroom::chat_tick() // Stops blips from playing when we have a formatting option. bool formatting_char = false; - bool is_talking = ao_app->get_chat_markdown("c" + m_chatmessage[TEXT_COLOR] + "_talking", m_chatmessage[CHAR_NAME]) == "1"; + bool is_talking = color_markdown_talking_list.at(m_chatmessage[TEXT_COLOR].toInt()); if (tick_pos >= f_message.size()) { @@ -2487,8 +2485,8 @@ void Courtroom::chat_tick() QString f_custom_theme = ao_app->get_char_shouts(f_char); ui_vp_chat_arrow->play("chat_arrow", f_char, f_custom_theme); //Chat stopped being processed, indicate that. additive_previous = additive_previous + filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt()); + return; } - else { QString f_rest = f_message; @@ -2547,12 +2545,14 @@ void Courtroom::chat_tick() //Parse markdown colors for (int c = 0; c < max_colors; ++c) { - QString markdown_start = ao_app->get_chat_markdown("c" + QString::number(c) + "_start", m_chatmessage[CHAR_NAME]); + //Clear the stored optimization information +// color_rgb_list.at(c); + QString markdown_start = color_markdown_start_list.at(c); + QString markdown_end = color_markdown_end_list.at(c); + bool markdown_remove = color_markdown_remove_list.at(c); + bool color_is_talking = color_markdown_talking_list.at(c); if (markdown_start.isEmpty()) continue; - QString markdown_end = ao_app->get_chat_markdown("c" + QString::number(c) + "_end", m_chatmessage[CHAR_NAME]); - bool markdown_remove = ao_app->get_chat_markdown("c" + QString::number(c) + "_remove", m_chatmessage[CHAR_NAME]) == "1"; - bool color_is_talking = ao_app->get_chat_markdown("c" + QString::number(c) + "_talking", m_chatmessage[CHAR_NAME]) == "1"; if (markdown_remove && (f_character == markdown_start || f_character == markdown_end)) { @@ -2606,13 +2606,13 @@ void Courtroom::chat_tick() //If this color is talking if (is_talking && text_state == 1 && anim_state < 2) //Set it to talking as we're not on that already { -// ui_vp_player_char->stop(); + ui_vp_player_char->stop(); ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); anim_state = 2; } else if (anim_state < 3) //Set it to idle as we're not on that already { -// ui_vp_player_char->stop(); + ui_vp_player_char->stop(); ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); anim_state = 3; } @@ -3810,22 +3810,33 @@ void Courtroom::on_prosecution_plus_clicked() void Courtroom::set_text_color_dropdown() { + //Clear the lists ui_text_color->clear(); color_row_to_number.clear(); - //Set the default color 0 - QString c0_name = ao_app->get_chat_markdown("c0_name", current_char); - if (c0_name.isEmpty()) - c0_name = tr("Default"); - ui_text_color->addItem(c0_name); - color_row_to_number.append(0); + //Clear the stored optimization information + color_rgb_list.clear(); + color_markdown_start_list.clear(); + color_markdown_end_list.clear(); + color_markdown_remove_list.clear(); + color_markdown_talking_list.clear(); - //Set the rest of the colors - for (int c = 1; c < max_colors; ++c) + //Update markdown colors. TODO: make a loading function that only loads the config file once instead of several times + for (int c = 0; c < max_colors; ++c) { + color_rgb_list.append(ao_app->get_chat_color(QString::number(c), current_char)); + color_markdown_start_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_start", current_char)); + color_markdown_end_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_end", current_char)); + color_markdown_remove_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_remove", current_char) == "1"); + color_markdown_talking_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_talking", current_char) == "1"); + QString color_name = ao_app->get_chat_markdown("c" + QString::number(c) + "_name", current_char); if (color_name.isEmpty()) //Not defined - continue; + { + if (c > 0) + continue; + color_name = tr("Default"); + } ui_text_color->addItem(color_name); color_row_to_number.append(c); } -- cgit From 0649884d3c9ceeef5515d621e9867dfc08df59ba Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 25 Sep 2019 04:45:45 +0300 Subject: Fix issue with ao line edit not correctly preserving selection Resolve a segfault with text formatting Implement ability to color text inline by selecting text and using the color dropdown TODO: allow html characters to be used for coloring text, oof --- src/aolineedit.cpp | 6 +++--- src/courtroom.cpp | 25 ++++++++++++++++++++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/aolineedit.cpp b/src/aolineedit.cpp index e345de3b..56b571fe 100644 --- a/src/aolineedit.cpp +++ b/src/aolineedit.cpp @@ -13,8 +13,8 @@ void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e) void AOLineEdit::focusOutEvent(QFocusEvent *ev) { int start = selectionStart(); - int end = selectionEnd(); + int len = selectionLength(); QLineEdit::focusOutEvent(ev); - if (p_selection && start != -1 && end != -1) - this->setSelection(start, end); + if (p_selection && start != -1 && len != -1) + this->setSelection(start, len); } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 2ae611a1..75ce54db 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2156,7 +2156,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool colorize, int pos, int de break; //Prevent it from looping forward for whatever reason } } - else if (f_character == markdown_start || (f_character == markdown_end && ic_color_stack.top() == c)) + else if (f_character == markdown_start || (f_character == markdown_end && !ic_color_stack.empty() && ic_color_stack.top() == c)) { if (colorize) { @@ -2547,8 +2547,8 @@ void Courtroom::chat_tick() { //Clear the stored optimization information // color_rgb_list.at(c); - QString markdown_start = color_markdown_start_list.at(c); - QString markdown_end = color_markdown_end_list.at(c); + QString markdown_start = color_markdown_start_list.at(c).toHtmlEscaped(); + QString markdown_end = color_markdown_end_list.at(c).toHtmlEscaped(); bool markdown_remove = color_markdown_remove_list.at(c); bool color_is_talking = color_markdown_talking_list.at(c); if (markdown_start.isEmpty()) @@ -3846,8 +3846,23 @@ void Courtroom::on_text_color_changed(int p_color) { if (ui_ic_chat_message->selectionStart() != -1) //We have a selection! { - qDebug() << "Setting color to selection" << ui_ic_chat_message->selectionStart() << ui_ic_chat_message->selectionEnd(); - ui_ic_chat_message->end(false); + int c = color_row_to_number.at(p_color); + QString markdown_start = color_markdown_start_list.at(c); + if (markdown_start.isEmpty()) + { + qDebug() << "W: Color list dropdown selected a non-existent markdown start character"; + return; + } + QString markdown_end = color_markdown_end_list.at(c); + if (markdown_end.isEmpty()) + markdown_end = markdown_start; + int start = ui_ic_chat_message->selectionStart(); + int end = ui_ic_chat_message->selectionEnd()+1; + ui_ic_chat_message->setCursorPosition(start); + ui_ic_chat_message->insert(markdown_start); + ui_ic_chat_message->setCursorPosition(end); + ui_ic_chat_message->insert(markdown_end); +// ui_ic_chat_message->end(false); ui_text_color->setCurrentIndex(0); } else -- cgit From c38061a9904e9992d53f7cdf2ab9bf6e789cf0de Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 25 Sep 2019 04:58:38 +0300 Subject: help me jesus HTML gotta be like escaped n shit --- src/courtroom.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 75ce54db..ace957ad 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2102,6 +2102,8 @@ QString Courtroom::filter_ic_text(QString p_text, bool colorize, int pos, int de pos += appendage.size(); } + //Current issue: does not properly escape html stuff. + //Solution: probably parse p_text and export into a different string separately, perform some mumbo jumbo to properly adjust string indexes. while (check_pos < p_text.size()) { f_character = p_text.at(check_pos); -- cgit From a3d1d5bf9d195969cf9a1cd55b59316dd262ab0b Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 27 Sep 2019 15:11:46 +0300 Subject: i did it i did the thing Final overhaul of filter_ic_text Fix spoken colors not being actually spoken Fix a message of ()()()() spamming idle/talking animations (instead it just does the idle animation until you feed it an actual character) Prevent spamming of play_idle and play_talking on the fastest text speed Properly escape html and construct a message that works with characters &, <, >, ", etc. for filter_ic_text Turn whitespace into html entities to prevent html from eating it up (alternative/better solution would be to erase excessive whitespace entirely but yaknow, some niche applications, whatever) Fix filter_ic_text not displaying the best string it could in ic logs (strip html, display newlines as \n, etc.) Scroll the scrollbar of the message box correctly according to some real wacky magic stuff I'm doing here. Let's hope there's no situations where it desyncs from the actual text. --- include/courtroom.h | 7 +- src/courtroom.cpp | 464 ++++++++++++++++++++++++++++++---------------------- 2 files changed, 270 insertions(+), 201 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index d6bf4512..476fd118 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -291,8 +291,10 @@ private: //int chat_tick_interval = 60; //which tick position(character in chat message) we are at int tick_pos = 0; + //the actual document tick pos we gotta worry about for making the text scroll better + int real_tick_pos = 0; //used to determine how often blips sound - int blip_pos = 0; + int blip_ticker = 0; int blip_rate = 1; int rainbow_counter = 0; bool rainbow_appended = false; @@ -342,6 +344,9 @@ private: //state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle, 4 = noniterrupting preanim int anim_state = 3; + //whether or not current color is a talking one + bool color_is_talking = true; + //state of text ticking, 0 = not yet ticking, 1 = ticking in progress, 2 = ticking done int text_state = 2; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ace957ad..327f4de6 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -145,6 +145,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ic_chat_message->setFrame(false); ui_ic_chat_message->setPlaceholderText(tr("Message")); ui_ic_chat_message->preserve_selection(true); + //todo: filter out \n from showing up as that commonly breaks the chatlog and can be spammed to hell ui_muted = new AOImage(ui_ic_chat_message, ao_app); ui_muted->hide(); @@ -1593,10 +1594,12 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) chat_tick_timer->stop(); ui_vp_evidence_display->reset(); + m_chatmessage[MESSAGE].remove("\n"); //Remove undesired newline chars + chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; //Hey, our message showed up! Cool! - if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() && m_chatmessage[CHAR_ID].toInt() == m_cid) + if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text().remove("\n") && m_chatmessage[CHAR_ID].toInt() == m_cid) { ui_ic_chat_message->clear(); if (ui_additive->isChecked()) @@ -2050,7 +2053,7 @@ void Courtroom::handle_chatmessage_3() } //If this color is talking - bool color_is_talking = ao_app->get_chat_markdown("c" + m_chatmessage[TEXT_COLOR] + "_talking", m_chatmessage[CHAR_NAME]) == "1"; + color_is_talking = color_markdown_talking_list.at(m_chatmessage[TEXT_COLOR].toInt()); if (color_is_talking && text_state == 1 && anim_state < 2) //Set it to talking as we're not on that already { @@ -2081,150 +2084,185 @@ void Courtroom::handle_chatmessage_3() } -QString Courtroom::filter_ic_text(QString p_text, bool colorize, int pos, int default_color) +QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int default_color) { // Get rid of centering. if(p_text.startsWith("~~")) p_text.remove(0,2); + p_text.remove("\n"); //Undesired newline chars, probably from copy-pasting it from a doc or something. + + QString p_text_escaped; + int check_pos = 0; + int check_pos_escaped = 0; bool ic_next_is_not_special = false; - QString f_character = p_text.at(check_pos); std::stack ic_color_stack; - if (colorize) + if (html) { ic_color_stack.push(default_color); QString appendage = ""; - p_text.insert(check_pos, appendage); - check_pos += appendage.size(); - if (pos > -1) - pos += appendage.size(); + p_text_escaped.insert(check_pos_escaped, appendage); + check_pos_escaped += appendage.size(); } //Current issue: does not properly escape html stuff. //Solution: probably parse p_text and export into a different string separately, perform some mumbo jumbo to properly adjust string indexes. while (check_pos < p_text.size()) { - f_character = p_text.at(check_pos); + QString f_rest = p_text.right(p_text.size() - check_pos); + QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); + QString f_character; + int f_char_length; + + tbf.toNextBoundary(); + + if (tbf.position() == -1) + f_character = f_rest; + else + f_character = f_rest.left(tbf.position()); + +// if (f_character == "&") //oh shit it's probably an escaped html +// { +// //Skip escaped chars like you would graphemes +// QRegularExpression re("&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});", QRegularExpression::CaseInsensitiveOption); +// QRegularExpressionMatch match = re.match(f_rest); +// if (match.hasMatch()) //OH SHIT IT IS, PANIC, PANIC +// { +// f_character = match.captured(0); //Phew, we solved the big problem here. +// } +// } + + f_character = f_character.toHtmlEscaped(); + + if (f_character == " " && html) //Whitespace, woah + f_character = " "; //Turn it into an HTML entity + f_char_length = f_character.length(); + bool color_update = false; + bool is_end = false; + bool skip = false; if (!ic_next_is_not_special) { if (f_character == "\\") { ic_next_is_not_special = true; - p_text.remove(check_pos, 1); - check_pos -= 1; - pos -= 1; + skip = true; } - //Nothing related to colors here else if (f_character == "{" || f_character == "}" || f_character == "@" || f_character == "$") { - p_text.remove(check_pos, 1); - check_pos -= 1; - pos -= 1; + skip = true; } - - bool is_end = false; - bool remove = false; //Parse markdown colors - for (int c = 0; c < max_colors; ++c) + else { - //Clear the stored optimization information - QString markdown_start = color_markdown_start_list.at(c); - QString markdown_end = color_markdown_end_list.at(c); - bool markdown_remove = color_markdown_remove_list.at(c); -// bool is_talking = color_markdown_talking_list.at(c); - if (markdown_start.isEmpty()) //Not defined - continue; - - if (markdown_end.isEmpty() || markdown_end == markdown_start) //"toggle switch" type + for (int c = 0; c < max_colors; ++c) { - if (f_character == markdown_start) + //Clear the stored optimization information + QString markdown_start = color_markdown_start_list.at(c).toHtmlEscaped(); + QString markdown_end = color_markdown_end_list.at(c).toHtmlEscaped(); + bool markdown_remove = color_markdown_remove_list.at(c); + if (markdown_start.isEmpty()) //Not defined + continue; + + if (markdown_end.isEmpty() || markdown_end == markdown_start) //"toggle switch" type { - if (colorize) + if (f_character == markdown_start) { - if (!ic_color_stack.empty() && ic_color_stack.top() == c && default_color != c) - ic_color_stack.pop(); //Cease our coloring - else + if (html) { - ic_color_stack.push(c); //Begin our coloring + if (!ic_color_stack.empty() && ic_color_stack.top() == c && default_color != c) + { + ic_color_stack.pop(); //Cease our coloring + is_end = true; + } + else + { + ic_color_stack.push(c); //Begin our coloring + } + color_update = true; } - color_update = true; + skip = markdown_remove; + break; //Prevent it from looping forward for whatever reason } - remove = markdown_remove; - break; //Prevent it from looping forward for whatever reason } - } - else if (f_character == markdown_start || (f_character == markdown_end && !ic_color_stack.empty() && ic_color_stack.top() == c)) - { - if (colorize) + else if (f_character == markdown_start || (f_character == markdown_end && !ic_color_stack.empty() && ic_color_stack.top() == c)) { - if (f_character == markdown_start) + if (html) { - ic_color_stack.push(c); //Begin our coloring - } - else if (f_character == markdown_end) - { - ic_color_stack.pop(); //Cease our coloring - is_end = true; + if (f_character == markdown_end) + { + ic_color_stack.pop(); //Cease our coloring + is_end = true; + } + else if (f_character == markdown_start) + { + ic_color_stack.push(c); //Begin our coloring + } + color_update = true; } - color_update = true; + skip = markdown_remove; + break; //Prevent it from looping forward for whatever reason } - remove = markdown_remove; - break; //Prevent it from looping forward for whatever reason } - } - //Parse the newest color stack - if (color_update) - { - if (!ic_next_is_not_special && (pos <= -1 || check_pos < pos)) //Only color text if we haven't reached the "invisible threshold" + //Parse the newest color stack + if (color_update && (target_pos <= -1 || check_pos < target_pos)) { - QString appendage = ""; - - if (!ic_color_stack.empty()) - appendage += ""; - - if (!is_end || remove) + if (!ic_next_is_not_special) { - if (remove) - p_text.remove(check_pos, 1); + QString appendage = ""; - p_text.insert(check_pos, appendage); + if (!ic_color_stack.empty()) + appendage += ""; - if (remove) + if (is_end && !skip) { - check_pos -= 1; - pos -= 1; + p_text_escaped.insert(check_pos_escaped, f_character); //Add that char right now + check_pos_escaped += f_char_length; //So the closing char is captured too + skip = true; } + p_text_escaped.insert(check_pos_escaped, appendage); + check_pos_escaped += appendage.size(); } - else - { - p_text.insert(check_pos+1, appendage); - } - check_pos += appendage.size(); - if (pos > -1) - pos += appendage.size(); } } - else if (remove) //Simple remove request - { - p_text.remove(check_pos, 1); - check_pos -= 1; - pos -= 1; - } } else + { + if (f_character == "n") // \n, that's a line break son + { + QString appendage = "
"; + if (!html) + { + //actual newline commented out +// appendage = "\n"; +// size = 1; //yeah guess what \n is a "single character" apparently + appendage = "\\n "; //visual representation of a newline + } + p_text_escaped.insert(check_pos_escaped, appendage); + check_pos_escaped += appendage.size(); + skip = true; + } + ic_next_is_not_special = false; + } //Make all chars we're not supposed to see invisible - if (pos > -1 && check_pos == pos) + if (target_pos > -1 && check_pos == target_pos) { QString appendage = ""; if (!ic_color_stack.empty()) { + if (!is_end) //Was our last coloring char ending the color stack or nah + { + //God forgive me for my transgressions but I have refactored this whole thing about 25 times and having to refactor it + //again to more elegantly support this will finally make me go insane. + color_is_talking = color_markdown_talking_list.at(ic_color_stack.top()); + } + //Clean it up, we're done here while (!ic_color_stack.empty()) ic_color_stack.pop(); @@ -2233,17 +2271,23 @@ QString Courtroom::filter_ic_text(QString p_text, bool colorize, int pos, int de } ic_color_stack.push(-1); //Dummy colorstack push for maximum
appendage appendage += ""; - p_text.insert(check_pos, appendage); + p_text_escaped.insert(check_pos_escaped, appendage); + check_pos_escaped += appendage.size(); + } + if (!skip) + { + p_text_escaped.insert(check_pos_escaped, f_character); + check_pos_escaped += f_char_length; } check_pos += 1; } if (!ic_color_stack.empty()) { - p_text.append(""); + p_text_escaped.append("
"); } - return p_text; + return p_text_escaped; } void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchange) @@ -2258,7 +2302,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); if (!is_songchange) - p_text = filter_ic_text(p_text); + p_text = filter_ic_text(p_text, false); if (log_goes_downwards) { @@ -2443,11 +2487,12 @@ void Courtroom::start_chat_ticking() if (!is_additive) { ui_vp_message->clear(); + real_tick_pos = 0; additive_previous = ""; } tick_pos = 0; - blip_pos = 0; + blip_ticker = 0; // At the start of every new message, we set the text speed to the default. current_display_speed = 3; @@ -2471,14 +2516,10 @@ void Courtroom::chat_tick() // Due to our new text speed system, we always need to stop the timer now. chat_tick_timer->stop(); - // Stops blips from playing when we have a formatting option. - bool formatting_char = false; - bool is_talking = color_markdown_talking_list.at(m_chatmessage[TEXT_COLOR].toInt()); - if (tick_pos >= f_message.size()) { text_state = 2; - if (anim_state != 4) + if (anim_state < 3) { anim_state = 3; ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); @@ -2487,141 +2528,164 @@ void Courtroom::chat_tick() QString f_custom_theme = ao_app->get_char_shouts(f_char); ui_vp_chat_arrow->play("chat_arrow", f_char, f_custom_theme); //Chat stopped being processed, indicate that. additive_previous = additive_previous + filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt()); + real_tick_pos = ui_vp_message->toPlainText().size(); + + QScrollBar *scroll = ui_vp_message->verticalScrollBar(); + scroll->setValue(scroll->maximum()); return; } - else - { - QString f_rest = f_message; - f_rest.remove(0, tick_pos); - QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); - QString f_character; - int f_char_length; - tbf.toNextBoundary(); + // Stops blips from playing when we have a formatting option. + bool formatting_char = false; - if (tbf.position() == -1) - f_character = f_rest; - else - f_character = f_rest.left(tbf.position()); + QString f_rest = f_message; + f_rest.remove(0, tick_pos); + QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); + QString f_character; + int f_char_length; - f_char_length = f_character.length(); - f_character = f_character.toHtmlEscaped(); + tbf.toNextBoundary(); + + if (tbf.position() == -1) + f_character = f_rest; + else + f_character = f_rest.left(tbf.position()); - // Escape character. - if (!next_character_is_not_special) + f_char_length = f_character.length(); + + // Escape character. + if (!next_character_is_not_special) + { + if (f_character == "\\") { - if (f_character == "\\") - { - next_character_is_not_special = true; - formatting_char = true; - } + next_character_is_not_special = true; + formatting_char = true; + } - // Text speed modifier. - else if (f_character == "{") - { - // ++, because it INCREASES delay! - current_display_speed++; - formatting_char = true; - } - else if (f_character == "}") - { - current_display_speed--; - formatting_char = true; - } + // Text speed modifier. + else if (f_character == "{") + { + // ++, because it INCREASES delay! + current_display_speed++; + formatting_char = true; + } + else if (f_character == "}") + { + current_display_speed--; + formatting_char = true; + } - //Screenshake. - else if (f_character == "@") - { - this->do_screenshake(); - formatting_char = true; - } + //Screenshake. + else if (f_character == "@") + { + this->do_screenshake(); + formatting_char = true; + } - //Flash. - else if (f_character == "$") - { - this->do_flash(); - formatting_char = true; - } - else + //Flash. + else if (f_character == "$") + { + this->do_flash(); + formatting_char = true; + } + else + { + //Parse markdown colors + for (int c = 0; c < max_colors; ++c) { - //Parse markdown colors - for (int c = 0; c < max_colors; ++c) - { - //Clear the stored optimization information -// color_rgb_list.at(c); - QString markdown_start = color_markdown_start_list.at(c).toHtmlEscaped(); - QString markdown_end = color_markdown_end_list.at(c).toHtmlEscaped(); - bool markdown_remove = color_markdown_remove_list.at(c); - bool color_is_talking = color_markdown_talking_list.at(c); - if (markdown_start.isEmpty()) - continue; + QString markdown_start = color_markdown_start_list.at(c); + QString markdown_end = color_markdown_end_list.at(c); + bool markdown_remove = color_markdown_remove_list.at(c); + if (markdown_start.isEmpty()) + continue; - if (markdown_remove && (f_character == markdown_start || f_character == markdown_end)) - { + if (f_character == markdown_start || f_character == markdown_end) + { + if (markdown_remove) formatting_char = true; - is_talking = color_is_talking; - break; - } + break; } } } - else - next_character_is_not_special = false; + } + else + { + if (f_character == "n") + formatting_char = true; //it's a newline + next_character_is_not_special = false; + } - tick_pos += f_char_length; + tick_pos += f_char_length; - //Do the colors, gradual showing, etc. in here - ui_vp_message->setHtml(additive_previous + filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt())); + //Do the colors, gradual showing, etc. in here + ui_vp_message->setHtml(additive_previous + filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt())); - //If the text overflows, make it snap to bottom - QScrollBar *scroll = ui_vp_message->verticalScrollBar(); - scroll->setValue(scroll->maximum()); + if (!formatting_char || f_character == "n") //NEWLINES (\n) COUNT AS A SINGLE CHARACTER. + { + //Make the cursor follow the message + QTextCursor cursor = ui_vp_message->textCursor(); + cursor.setPosition(real_tick_pos); + ui_vp_message->setTextCursor(cursor); + real_tick_pos += f_char_length; + } + ui_vp_message->ensureCursorVisible(); - // 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; - } +// //Grab the currently displayed chars +// f_rest = f_message.left(tick_pos); +// f_rest.replace("\\n", "\n"); - if (current_display_speed > 6) - { - current_display_speed = 6; - } +// QFontMetrics fm = fontMetrics(); +// QRect bounding_rect = fm.boundingRect(QRect(0,0,ui_vp_message->width(),ui_vp_message->height()), Qt::TextWordWrap, f_rest); + +// //If the text overflows, make it snap to bottom +// if (bounding_rect.height() > ui_vp_message->height()) +// { + +// QScrollBar *scroll = ui_vp_message->verticalScrollBar(); +// scroll->value(); +// scroll->setValue(scroll->maximum()); +// } - if (!formatting_char && (f_character != ' ' || blank_blip)) + // Keep the speed at bay. + if (current_display_speed < 0) + current_display_speed = 0; + else if (current_display_speed > 6) + current_display_speed = 6; + + //Blip player and real tick pos ticker + if (!formatting_char && (f_character != ' ' || blank_blip)) + { + if (blip_ticker % blip_rate == 0) { - if (blip_pos % blip_rate == 0) - { - blip_player->blip_tick(); - } - ++blip_pos; + blip_player->blip_tick(); } + ++blip_ticker; + } - // If we had a formatting char, we shouldn't wait so long again, as it won't appear! - if (formatting_char) + // If we had a formatting char, we shouldn't wait so long again, as it won't appear! + // Additionally, if the message_display_speed length is too short for us to do anything (play animations, etc.) then skip the trouble and don't bother. + if (formatting_char || message_display_speed[current_display_speed] <= 0) + { + chat_tick_timer->start(0); + } + else + { + //If this color is talking + if (color_is_talking && anim_state != 2 && anim_state < 4) //Set it to talking as we're not on that already (though we have to avoid interrupting a non-interrupted preanim) { - chat_tick_timer->start(0); + ui_vp_player_char->stop(); + ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + anim_state = 2; } - else + else if (!color_is_talking && anim_state < 3 && anim_state != 3) //Set it to idle as we're not on that already { - //If this color is talking - if (is_talking && text_state == 1 && anim_state < 2) //Set it to talking as we're not on that already - { - ui_vp_player_char->stop(); - ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - anim_state = 2; - } - else if (anim_state < 3) //Set it to idle as we're not on that already - { - ui_vp_player_char->stop(); - ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - anim_state = 3; - } - - //Continue ticking - chat_tick_timer->start(message_display_speed[current_display_speed]); + ui_vp_player_char->stop(); + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + anim_state = 3; } + + //Continue ticking + chat_tick_timer->start(message_display_speed[current_display_speed]); } } -- cgit From 1a3d3281a79856a19339292a281e5480f4825756 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 27 Sep 2019 15:12:09 +0300 Subject: Display the first character of the ic message right away instead of having a delay --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 327f4de6..5ffef459 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2496,7 +2496,7 @@ 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]); + chat_tick_timer->start(0); //Display the first char right away QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]); -- cgit From 3c27988423cb1d9f16aa6429c8f8f17febfdd734 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 27 Sep 2019 15:48:35 +0300 Subject: Fix ic chatlogs displaying escaped html --- src/courtroom.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 5ffef459..dba7167a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2134,7 +2134,8 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int // } // } - f_character = f_character.toHtmlEscaped(); + if (html) + f_character = f_character.toHtmlEscaped(); if (f_character == " " && html) //Whitespace, woah f_character = " "; //Turn it into an HTML entity @@ -2162,8 +2163,13 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int for (int c = 0; c < max_colors; ++c) { //Clear the stored optimization information - QString markdown_start = color_markdown_start_list.at(c).toHtmlEscaped(); - QString markdown_end = color_markdown_end_list.at(c).toHtmlEscaped(); + QString markdown_start = color_markdown_start_list.at(c); + QString markdown_end = color_markdown_end_list.at(c); + if (html) + { + markdown_start = markdown_start.toHtmlEscaped(); + markdown_end = markdown_end.toHtmlEscaped(); + } bool markdown_remove = color_markdown_remove_list.at(c); if (markdown_start.isEmpty()) //Not defined continue; -- cgit From 8c9275c497bbd868ee133dfad73bb1dd12519b41 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 27 Sep 2019 15:52:51 +0300 Subject: Add cute color icons to color dropdown ui Fix current_side not using the character's preferred one after changing character Add cool tool tip describing how to do cool select+color thing Fix chatlogpiece not appending ": " in the log files --- src/chatlogpiece.cpp | 2 ++ src/courtroom.cpp | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/chatlogpiece.cpp b/src/chatlogpiece.cpp index eb7c188a..dafc3542 100644 --- a/src/chatlogpiece.cpp +++ b/src/chatlogpiece.cpp @@ -69,6 +69,8 @@ QString chatlogpiece::get_full() full.append(")"); if (p_is_song) full.append(" has played a song: "); + else + full.append(": "); full.append(get_message()); return full; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index dba7167a..e5185eb1 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -776,7 +776,8 @@ void Courtroom::set_widgets() ui_prosecution_minus->setToolTip(tr("Decrease the health bar.")); set_size_and_pos(ui_text_color, "text_color"); - ui_text_color->setToolTip(tr("Change the text color of the spoken message.")); + ui_text_color->setToolTip(tr("Change the text color of the spoken message.\n" + "You can also select a part of your currently typed message and use the dropdown to change its color!")); set_text_color_dropdown(); set_size_and_pos(ui_music_slider, "music_slider"); @@ -1059,6 +1060,7 @@ void Courtroom::update_character(int p_cid) } current_char = f_char; + current_side = ""; current_emote_page = 0; current_emote = 0; @@ -1621,7 +1623,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) //Let the server handle actually checking if they're allowed to do this. is_additive = m_chatmessage[ADDITIVE].toInt() == 1; - chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false); + chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, m_chatmessage[MESSAGE], false); ic_chatlog_history.append(*temp); ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); @@ -3896,7 +3898,8 @@ void Courtroom::set_text_color_dropdown() //Update markdown colors. TODO: make a loading function that only loads the config file once instead of several times for (int c = 0; c < max_colors; ++c) { - color_rgb_list.append(ao_app->get_chat_color(QString::number(c), current_char)); + QColor color = ao_app->get_chat_color(QString::number(c), current_char); + color_rgb_list.append(color); color_markdown_start_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_start", current_char)); color_markdown_end_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_end", current_char)); color_markdown_remove_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_remove", current_char) == "1"); @@ -3910,6 +3913,9 @@ void Courtroom::set_text_color_dropdown() color_name = tr("Default"); } ui_text_color->addItem(color_name); + QPixmap pixmap(16,16); + pixmap.fill(color); + ui_text_color->setItemIcon(ui_text_color->count() - 1, QIcon(pixmap)); color_row_to_number.append(c); } } -- cgit From d3a58770d3b923d488b5df090c8e98edf5bf0b2b Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 28 Sep 2019 20:22:38 +0300 Subject: Overhaul the evidence system: You can now press the checkmark to save evidence. The checkmark only appears when your edited evidence differs from evidence on the server. You will now be alerted if you try to exit out of the evidence with unsaved changes (pressing "X") Fix double-clicking on image name not doing anything You will now be alerted if the evidence changed as you were editing it Add tooltips Make an evidence_close function that can be referred to from multiple places --- base/themes/default/courtroom_design.ini | 5 +- include/courtroom.h | 10 +- src/courtroom.cpp | 35 ----- src/evidence.cpp | 244 +++++++++++++++++++++++++------ 4 files changed, 210 insertions(+), 84 deletions(-) diff --git a/base/themes/default/courtroom_design.ini b/base/themes/default/courtroom_design.ini index e53eb08d..b9a27a36 100644 --- a/base/themes/default/courtroom_design.ini +++ b/base/themes/default/courtroom_design.ini @@ -293,9 +293,10 @@ evidence_overlay = 24, 24, 439, 222 ; x/y coordinates 0,0 will start at top-left of the "evidence_overlay" (which is parented to "evidence_background") for everything below until specified otherwise. ; **** evidence_delete = 78, 8, 70, 20 -evidence_image_name = 150, 8, 130, 20 -evidence_image_button = 280, 8, 60, 20 +evidence_image_name = 150, 8, 109, 20 +evidence_image_button = 259, 8, 60, 20 evidence_x = 341, 8, 20, 20 +evidence_ok = 320, 8, 20, 20 evidence_button = 627, 322, 85, 18 evidence_name = 112, 4, 264, 19 evidence_description = 78, 28, 281, 166 \ No newline at end of file diff --git a/include/courtroom.h b/include/courtroom.h index 476fd118..0fc56fe9 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -554,6 +555,7 @@ private: AOLineEdit *ui_evidence_image_name; AOButton *ui_evidence_image_button; AOButton *ui_evidence_x; + AOButton *ui_evidence_ok; AOTextEdit *ui_evidence_description; AOImage *ui_char_select_background; @@ -707,11 +709,17 @@ private slots: void on_showname_enable_clicked(); void on_evidence_name_double_clicked(); + void on_evidence_image_name_double_clicked(); void on_evidence_button_clicked(); void on_evidence_delete_clicked(); void on_evidence_x_clicked(); - void on_evidence_description_edited(); + void on_evidence_ok_clicked(); + + void on_evidence_edited(); + + void evidence_close(); + bool compare_evidence_changed(evi_type evi_a, evi_type evi_b); void on_back_to_lobby_clicked(); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index e5185eb1..428d98ce 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -784,41 +784,6 @@ void Courtroom::set_widgets() set_size_and_pos(ui_sfx_slider, "sfx_slider"); set_size_and_pos(ui_blip_slider, "blip_slider"); - set_size_and_pos(ui_evidence_button, "evidence_button"); - ui_evidence_button->set_image("evidencebutton"); - ui_evidence_button->setToolTip(tr("Bring up the Evidence screen.")); - - set_size_and_pos(ui_evidence, "evidence_background"); - ui_evidence->set_image("evidencebackground"); - - 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"); - - set_size_and_pos(ui_evidence_right, "evidence_right"); - ui_evidence_right->set_image("arrow_right"); - - set_size_and_pos(ui_evidence_present, "evidence_present"); - ui_evidence_present->set_image("present_disabled"); - - set_size_and_pos(ui_evidence_overlay, "evidence_overlay"); - ui_evidence_overlay->set_image("evidenceoverlay"); - - set_size_and_pos(ui_evidence_delete, "evidence_delete"); - ui_evidence_delete->set_image("deleteevidence"); - - 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"); - - set_size_and_pos(ui_evidence_description, "evidence_description"); - ui_selector->set_image("char_selector"); ui_selector->hide(); diff --git a/src/evidence.cpp b/src/evidence.cpp index dfbc675f..6ee2b8e5 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -7,24 +7,32 @@ void Courtroom::initialize_evidence() //ui_evidence_name = new QLabel(ui_evidence); ui_evidence_name = new AOLineEdit(ui_evidence); ui_evidence_name->setAlignment(Qt::AlignCenter); + ui_evidence_name->setFrame(false); ui_evidence_buttons = new QWidget(ui_evidence); ui_evidence_left = new AOButton(ui_evidence, ao_app); ui_evidence_right = new AOButton(ui_evidence, ao_app); ui_evidence_present = new AOButton(ui_evidence, ao_app); + ui_evidence_present->setToolTip(tr("Present this piece of evidence to everyone on your next spoken message")); ui_evidence_overlay = new AOImage(ui_evidence, ao_app); ui_evidence_delete = new AOButton(ui_evidence_overlay, ao_app); + ui_evidence_delete->setToolTip(tr("Destroy this piece of evidence")); ui_evidence_image_name = new AOLineEdit(ui_evidence_overlay); ui_evidence_image_button = new AOButton(ui_evidence_overlay, ao_app); ui_evidence_image_button->setText(tr("Choose...")); ui_evidence_x = new AOButton(ui_evidence_overlay, ao_app); + ui_evidence_x->setToolTip(tr("Close the evidence display/editing overlay")); + ui_evidence_ok = new AOButton(ui_evidence_overlay, ao_app); + ui_evidence_ok->setToolTip(tr("Save any changes made to this piece of evidence")); ui_evidence_description = new AOTextEdit(ui_evidence_overlay); ui_evidence_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "color: white;"); + ui_evidence_description->setFrameStyle(QFrame::NoFrame); + ui_evidence_description->setToolTip("Double-click to edit. Press [X] to update your changes."); connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited())); connect(ui_evidence_name, SIGNAL(double_clicked()), this, SLOT(on_evidence_name_double_clicked())); @@ -33,9 +41,14 @@ void Courtroom::initialize_evidence() 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_name, SIGNAL(double_clicked()), this, SLOT(on_evidence_image_name_double_clicked())); 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_description, SIGNAL(textChanged()), this, SLOT(on_evidence_description_edited())); + connect(ui_evidence_ok, SIGNAL(clicked()), this, SLOT(on_evidence_ok_clicked())); + + connect(ui_evidence_name, SIGNAL(textChanged(QString)), this, SLOT(on_evidence_edited())); + connect(ui_evidence_image_name, SIGNAL(textChanged(QString)), this, SLOT(on_evidence_edited())); + connect(ui_evidence_description, SIGNAL(textChanged()), this, SLOT(on_evidence_edited())); ui_evidence->hide(); } @@ -50,9 +63,44 @@ void Courtroom::refresh_evidence() qDeleteAll(ui_evidence_list.begin(), ui_evidence_list.end()); ui_evidence_list.clear(); + set_size_and_pos(ui_evidence_button, "evidence_button"); + ui_evidence_button->set_image("evidencebutton"); + ui_evidence_button->setToolTip(tr("Bring up the Evidence screen.")); + set_size_and_pos(ui_evidence, "evidence_background"); + ui_evidence->set_image("evidencebackground"); + + 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"); + + set_size_and_pos(ui_evidence_right, "evidence_right"); + ui_evidence_right->set_image("arrow_right"); + + set_size_and_pos(ui_evidence_present, "evidence_present"); + ui_evidence_present->set_image("present"); + + set_size_and_pos(ui_evidence_overlay, "evidence_overlay"); + ui_evidence_overlay->set_image("evidenceoverlay"); + + set_size_and_pos(ui_evidence_delete, "evidence_delete"); + ui_evidence_delete->set_image("deleteevidence"); + + 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"); + + set_size_and_pos(ui_evidence_ok, "evidence_ok"); + ui_evidence_ok->set_image("evidenceok"); + + set_size_and_pos(ui_evidence_description, "evidence_description"); + QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", "courtroom_design.ini"); QPoint p_point = ao_app->get_button_spacing("evidence_button_size", "courtroom_design.ini"); @@ -96,6 +144,7 @@ void Courtroom::refresh_evidence() void Courtroom::set_evidence_list(QVector &p_evi_list) { + QVector old_list = local_evidence_list; local_evidence_list.clear(); local_evidence_list = p_evi_list; @@ -105,13 +154,38 @@ void Courtroom::set_evidence_list(QVector &p_evi_list) { if (current_evidence >= local_evidence_list.size()) { - on_evidence_x_clicked(); + evidence_close(); ui_evidence_name->setText(""); } - else + else if (ui_evidence_description->isReadOnly()) //We haven't double clicked to edit it or anything { on_evidence_double_clicked(current_evidence); } + //Todo: make a function that compares two pieces of evidence for any differences + else if (compare_evidence_changed(old_list.at(current_evidence), local_evidence_list.at(current_evidence))) + { + QMessageBox *msgBox = new QMessageBox; + + msgBox->setText("The piece of evidence you've been editing has changed."); + msgBox->setInformativeText("Do you wish to keep your changes?"); + msgBox->setDetailedText("Name: " + local_evidence_list.at(current_evidence).name + "\nImage: " + local_evidence_list.at(current_evidence).image + "\nDescription:\n" + local_evidence_list.at(current_evidence).description); + msgBox->setStandardButtons(QMessageBox::Yes | QMessageBox::No); + msgBox->setDefaultButton(QMessageBox::No); + //msgBox->setWindowModality(Qt::NonModal); + int ret = msgBox->exec(); + switch (ret) { + case QMessageBox::Yes: + // "Keep changes" + break; + case QMessageBox::No: + // "Discard changes and keep theirs" + on_evidence_double_clicked(current_evidence); + break; + default: + // should never be reached + break; + } + } } } @@ -185,24 +259,34 @@ void Courtroom::on_evidence_name_edited() if (current_evidence >= local_evidence_list.size()) return; - QStringList f_contents; +// Prefer pressing [X] to update the evidence. +// QStringList f_contents; - evi_type f_evi = local_evidence_list.at(current_evidence); +// evi_type f_evi = local_evidence_list.at(current_evidence); - f_contents.append(QString::number(current_evidence)); - f_contents.append(ui_evidence_name->text()); - f_contents.append(f_evi.description); - f_contents.append(f_evi.image); +// f_contents.append(QString::number(current_evidence)); +// f_contents.append(ui_evidence_name->text()); +// f_contents.append(f_evi.description); +// f_contents.append(f_evi.image); - ao_app->send_server_packet(new AOPacket("EE", f_contents)); +// ao_app->send_server_packet(new AOPacket("EE", f_contents)); } void Courtroom::on_evidence_name_double_clicked() { if (ui_evidence_overlay->isVisible()) + { ui_evidence_name->setReadOnly(false); + } else + { ui_evidence_name->setReadOnly(true); + } +} + +void Courtroom::on_evidence_image_name_double_clicked() +{ + ui_evidence_image_name->setReadOnly(false); } void Courtroom::on_evidence_image_name_edited() @@ -211,16 +295,16 @@ void Courtroom::on_evidence_image_name_edited() if (current_evidence >= local_evidence_list.size()) return; - QStringList f_contents; +// QStringList f_contents; - evi_type f_evi = local_evidence_list.at(current_evidence); +// evi_type f_evi = local_evidence_list.at(current_evidence); - f_contents.append(QString::number(current_evidence)); - f_contents.append(f_evi.name); - f_contents.append(f_evi.description); - f_contents.append(ui_evidence_image_name->text()); +// f_contents.append(QString::number(current_evidence)); +// f_contents.append(f_evi.name); +// f_contents.append(f_evi.description); +// f_contents.append(ui_evidence_image_name->text()); - ao_app->send_server_packet(new AOPacket("EE", f_contents)); +// ao_app->send_server_packet(new AOPacket("EE", f_contents)); } void Courtroom::on_evidence_image_button_clicked() @@ -284,23 +368,22 @@ void Courtroom::on_evidence_double_clicked(int p_id) evi_type f_evi = local_evidence_list.at(f_real_id); - QTextCursor cursor = ui_evidence_description->textCursor(); - int pos = cursor.position(); - - //ISSUE: Undo/redo history is completely inaccessible. :( - ui_evidence_description->blockSignals(true); - ui_evidence_description->setPlainText(f_evi.description); - ui_evidence_description->blockSignals(false); - - cursor.setPosition(pos); //Reset the cursor position back in place - ui_evidence_description->setTextCursor(cursor); + ui_evidence_description->clear(); + ui_evidence_description->appendPlainText(f_evi.description); + ui_evidence_description->setReadOnly(true); + ui_evidence_description->setToolTip("Double-click to edit..."); - ui_evidence_image_name->setText(f_evi.image); ui_evidence_name->setText(f_evi.name); + ui_evidence_name->setReadOnly(true); + ui_evidence_name->setToolTip("Double-click to edit..."); + ui_evidence_image_name->setText(f_evi.image); + ui_evidence_image_name->setReadOnly(true); + ui_evidence_image_name->setToolTip("Double-click to edit..."); ui_evidence_overlay->show(); + ui_evidence_ok->hide(); -// ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_hover(int p_id, bool p_state) @@ -342,9 +425,9 @@ void Courtroom::on_evidence_right_clicked() void Courtroom::on_evidence_present_clicked() { if (is_presenting_evidence) - ui_evidence_present->set_image("present_disabled"); - else ui_evidence_present->set_image("present"); + else + ui_evidence_present->set_image("present_disabled"); is_presenting_evidence = !is_presenting_evidence; @@ -353,10 +436,7 @@ void Courtroom::on_evidence_present_clicked() void Courtroom::on_evidence_delete_clicked() { - ui_evidence_description->setReadOnly(true); - ui_evidence_name->setReadOnly(true); - ui_evidence_overlay->hide(); - + evidence_close(); ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%")); current_evidence = 0; @@ -366,22 +446,94 @@ void Courtroom::on_evidence_delete_clicked() void Courtroom::on_evidence_x_clicked() { + if (current_evidence >= local_evidence_list.size()) //Should never happen but you never know. + return; + + evi_type fake_evidence; + fake_evidence.name = ui_evidence_name->text(); + fake_evidence.description = ui_evidence_description->toPlainText(); + fake_evidence.image = ui_evidence_image_name->text(); + if (!compare_evidence_changed(fake_evidence, local_evidence_list.at(current_evidence))) + { + evidence_close(); + return; + } + QMessageBox *msgBox = new QMessageBox; + msgBox->setText("Evidence has been modified."); + msgBox->setInformativeText("Do you want to save your changes?"); + msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); + msgBox->setDefaultButton(QMessageBox::Save); + int ret = msgBox->exec(); + switch (ret) { + case QMessageBox::Save: + evidence_close(); + on_evidence_ok_clicked(); + break; + case QMessageBox::Discard: + evidence_close(); + break; + case QMessageBox::Cancel: + // Cancel was clicked, do nothing + break; + default: + // should never be reached + break; + } +} + +void Courtroom::on_evidence_ok_clicked() +{ + ui_evidence_name->setReadOnly(true); ui_evidence_description->setReadOnly(true); + ui_evidence_image_name->setReadOnly(true); + if (current_evidence < local_evidence_list.size()) + { + evi_type f_evi = local_evidence_list.at(current_evidence); + + QStringList f_contents; + f_contents.append(QString::number(current_evidence)); + f_contents.append(ui_evidence_name->text()); + f_contents.append(ui_evidence_description->toPlainText()); + f_contents.append(ui_evidence_image_name->text()); + + ao_app->send_server_packet(new AOPacket("EE", f_contents)); + +// QMessageBox *msgBox = new QMessageBox; + +// msgBox->setText("You succesfully saved your changes."); +// msgBox->setStandardButtons(QMessageBox::Ok); +// msgBox->setDefaultButton(QMessageBox::Ok); +// msgBox->exec(); + } +} + +void Courtroom::on_evidence_edited() +{ + if (current_evidence >= local_evidence_list.size()) //Should never happen but you never know. + return; + evi_type fake_evidence; + fake_evidence.name = ui_evidence_name->text(); + fake_evidence.description = ui_evidence_description->toPlainText(); + fake_evidence.image = ui_evidence_image_name->text(); + if (compare_evidence_changed(fake_evidence, local_evidence_list.at(current_evidence))) + ui_evidence_ok->show(); + else + ui_evidence_ok->hide(); +} + +void Courtroom::evidence_close() +{ + ui_evidence_description->setReadOnly(true); + ui_evidence_description->setToolTip(""); ui_evidence_name->setReadOnly(true); + ui_evidence_name->setToolTip(""); + ui_evidence_image_name->setReadOnly(true); + ui_evidence_image_name->setToolTip(""); ui_evidence_overlay->hide(); ui_ic_chat_message->setFocus(); } -void Courtroom::on_evidence_description_edited() +bool Courtroom::compare_evidence_changed(evi_type evi_a, evi_type evi_b) { - QStringList f_contents; - - evi_type f_evi = local_evidence_list.at(current_evidence); - - f_contents.append(QString::number(current_evidence)); - f_contents.append(f_evi.name); - f_contents.append(ui_evidence_description->toPlainText()); - f_contents.append(f_evi.image); - - ao_app->send_server_packet(new AOPacket("EE", f_contents)); + return evi_a.name != evi_b.name || evi_a.image != evi_b.image || evi_a.description != evi_b.description; } -- cgit From 709ebb7e1872394731c2edb282a1ce73fdc353f9 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 28 Sep 2019 20:43:19 +0300 Subject: Fix AOEvidenceDisplay not respecting the size of the viewport properly and breaking if a static image was used for evidence appearance Fix an issue with chat message being resized before the chat box is in reload theme --- include/aoevidencedisplay.h | 7 ++++--- src/aoevidencedisplay.cpp | 45 +++++++++++++++------------------------------ src/courtroom.cpp | 22 +++++++++++----------- 3 files changed, 30 insertions(+), 44 deletions(-) diff --git a/include/aoevidencedisplay.h b/include/aoevidencedisplay.h index 13ca00d5..93455c09 100644 --- a/include/aoevidencedisplay.h +++ b/include/aoevidencedisplay.h @@ -3,9 +3,9 @@ #include "aoapplication.h" #include "aosfxplayer.h" +#include "aomovie.h" #include -#include #include class AOEvidenceDisplay : public QLabel @@ -18,15 +18,16 @@ public: void show_evidence(QString p_evidence_image, bool is_left_side, int p_volume); QLabel* get_evidence_icon(); void reset(); + void combo_resize(int w, int h); private: AOApplication *ao_app; - QMovie *evidence_movie; + AOMovie *evidence_movie; QLabel *evidence_icon; AOSfxPlayer *sfx_player; private slots: - void frame_change(int p_frame); + void show_done(); }; #endif // AOEVIDENCEDISPLAY_H diff --git a/src/aoevidencedisplay.cpp b/src/aoevidencedisplay.cpp index 3fde05aa..fef072ba 100644 --- a/src/aoevidencedisplay.cpp +++ b/src/aoevidencedisplay.cpp @@ -7,12 +7,12 @@ AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) { ao_app = p_ao_app; - - evidence_movie = new QMovie(this); evidence_icon = new QLabel(this); sfx_player = new AOSfxPlayer(this, ao_app); - connect(evidence_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); + evidence_movie = new AOMovie(this, ao_app); + + connect(evidence_movie, SIGNAL(done()), this, SLOT(show_done())); } void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_side, int p_volume) @@ -47,36 +47,10 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid evidence_icon->setPixmap(f_pixmap.scaled(evidence_icon->width(), evidence_icon->height(), Qt::IgnoreAspectRatio)); - QString f_default_gif_path = ao_app->get_image_suffix(ao_app->get_default_theme_path(gif_name)); - QString f_gif_path = ao_app->get_image_suffix(ao_app->get_theme_path(gif_name)); - - if (file_exists(f_gif_path)) - final_gif_path = f_gif_path; - else - final_gif_path = f_default_gif_path; - - evidence_movie->setFileName(final_gif_path); - - this->setMovie(evidence_movie); - - evidence_movie->start(); + evidence_movie->play(gif_name); sfx_player->play(ao_app->get_sfx("evidence_present")); } -void AOEvidenceDisplay::frame_change(int p_frame) -{ - if (p_frame == (evidence_movie->frameCount() - 1)) - { - //we need this or else the last frame wont show - delay(evidence_movie->nextFrameDelay()); - - evidence_movie->stop(); - this->clear(); - - evidence_icon->show(); - } -} - void AOEvidenceDisplay::reset() { sfx_player->stop(); @@ -85,9 +59,20 @@ void AOEvidenceDisplay::reset() this->clear(); } +void AOEvidenceDisplay::show_done() +{ + evidence_icon->show(); +} + QLabel* AOEvidenceDisplay::get_evidence_icon() { return evidence_icon; } +void AOEvidenceDisplay::combo_resize(int w, int h) +{ + QSize f_size(w, h); + this->resize(f_size); + evidence_movie->combo_resize(w, h); +} diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 428d98ce..6ea98f12 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -490,16 +490,7 @@ void Courtroom::set_widgets() 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"); - //We detached the text as parent from the chatbox so it doesn't get affected by the screenshake. - ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y()); - ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); -// ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" -// "color: white"); + ui_vp_evidence_display->combo_resize(ui_viewport->width(), ui_viewport->height()); ui_vp_chat_arrow->move(0, 0); pos_size_type design_ini_result = ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini"); @@ -586,6 +577,15 @@ void Courtroom::set_widgets() ui_vp_chatbox->set_image("chatblank"); ui_vp_chatbox->hide(); + set_size_and_pos(ui_vp_showname, "showname"); + + set_size_and_pos(ui_vp_message, "message"); + //We detached the text as parent from the chatbox so it doesn't get affected by the screenshake. + ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y()); + ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); +// ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" +// "color: white"); + ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); ui_muted->set_image("muted"); ui_muted->setToolTip(tr("Oops, you're muted!")); @@ -1582,7 +1582,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_custom_objection->set_image("custom"); ui_realization->set_image("realization"); ui_screenshake->set_image("screenshake"); - ui_evidence_present->set_image("present_disabled"); + ui_evidence_present->set_image("present"); } //Let the server handle actually checking if they're allowed to do this. -- cgit From b0f11e53dff7187a147f01da2d8da5bf392cd38d Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 28 Sep 2019 22:00:16 +0300 Subject: Strip out QRandomGenerator because it's "too new" of a module (linux build does not compile with it) Add QPluginLoader checks for qapng and qwebp --- include/courtroom.h | 2 +- src/courtroom.cpp | 4 +++- src/main.cpp | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 0fc56fe9..866a75f0 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -55,7 +55,7 @@ #include #include #include -#include +//#include #include diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 6ea98f12..20f7daec 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -44,6 +44,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() } #endif + qsrand(static_cast(QDateTime::currentMSecsSinceEpoch() / 1000)); + keepalive_timer = new QTimer(this); keepalive_timer->start(60000); @@ -1933,7 +1935,7 @@ void Courtroom::do_screenshake() for (int frame=0; frame < maxframes; frame++) { double fraction = double(frame*frequency)/duration; - quint32 rng = QRandomGenerator::global()->generate(); + int rng = qrand();//QRandomGenerator::global()->generate(); int rand_x = int(rng) % max_x; int rand_y = int(rng+100) % max_y; screenshake_animation->setKeyValueAt(fraction, QPoint(pos_default.x() + rand_x, pos_default.y() + rand_y)); diff --git a/src/main.cpp b/src/main.cpp index 6c7b1513..04b9df55 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,6 +22,14 @@ int main(int argc, char *argv[]) QSettings *configini = main_app.configini; + QPluginLoader apngPlugin("imageformats/qapng"); + if (!apngPlugin.load()) + qCritical() << "QApng plugin could not be loaded"; + + QPluginLoader webpPlugin("imageformats/qwebp"); + if (!webpPlugin.load()) + qCritical() << "QWebp plugin could not be loaded"; + QString p_language = configini->value("language", QLocale::system().name()).toString(); if (p_language == " " || p_language == "") p_language = QLocale::system().name(); -- cgit From 30c02221d282cb4d340aa38334f89e4825fa39d0 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 29 Sep 2019 03:26:16 +0300 Subject: Make the client select a default font that resembles classic AA font the most (cleartype off, MS Sans) Create a better method to replace trailing whitespace with proper HTML representation Don't bother rendering the string character-by-character to prevent any latency happening with instant text speed --- src/aolineedit.cpp | 2 +- src/courtroom.cpp | 143 ++++++++++++++++++++------------------------ src/main.cpp | 4 +- src/text_file_functions.cpp | 2 +- 4 files changed, 69 insertions(+), 82 deletions(-) diff --git a/src/aolineedit.cpp b/src/aolineedit.cpp index 56b571fe..1c141c33 100644 --- a/src/aolineedit.cpp +++ b/src/aolineedit.cpp @@ -13,7 +13,7 @@ void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e) void AOLineEdit::focusOutEvent(QFocusEvent *ev) { int start = selectionStart(); - int len = selectionLength(); + int len = selectionEnd() - start; //We're not using selectionLength because Linux build doesn't run qt5.10 QLineEdit::focusOutEvent(ev); if (p_selection && start != -1 && len != -1) this->setSelection(start, len); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 20f7daec..e0b19483 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1,5 +1,6 @@ #include "courtroom.h" + Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() { ao_app = p_ao_app; @@ -147,6 +148,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ic_chat_message->setFrame(false); ui_ic_chat_message->setPlaceholderText(tr("Message")); ui_ic_chat_message->preserve_selection(true); +// ui_ic_chat_message->setValidator(new QRegExpValidator(QRegExp("^\\S+(?: \\S+)*$"), ui_ic_chat_message)); //todo: filter out \n from showing up as that commonly breaks the chatlog and can be spammed to hell ui_muted = new AOImage(ui_ic_chat_message, ao_app); @@ -585,19 +587,15 @@ void Courtroom::set_widgets() //We detached the text as parent from the chatbox so it doesn't get affected by the screenshake. ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y()); ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); -// ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" -// "color: white"); ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); ui_muted->set_image("muted"); ui_muted->setToolTip(tr("Oops, you're muted!")); set_size_and_pos(ui_ooc_chat_message, "ooc_chat_message"); - ui_ooc_chat_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); ui_ooc_chat_message->setToolTip(tr("Type your message to display in the server chat here.")); set_size_and_pos(ui_ooc_chat_name, "ooc_chat_name"); - ui_ooc_chat_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); ui_ooc_chat_name->setToolTip(tr("Set your name to display in the server chat.")); //set_size_and_pos(ui_area_password, "area_password"); @@ -832,12 +830,21 @@ void Courtroom::set_font(QWidget *widget, QString class_name, QString p_identifi QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? - this->set_qfont(widget, class_name, QFont(font_name, f_weight), f_color, bold); + + QFont font; + if (font_name.isEmpty()) + { + font = QFont(font_name, f_weight); + font.setStyleHint(QFont::SansSerif, QFont::NoAntialias); + } + else + font = QFont(font_name, f_weight); + this->set_qfont(widget, class_name, font, f_color, bold); } void Courtroom::set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color, bool bold) { - if(class_name == "") + if(class_name.isEmpty()) class_name = widget->metaObject()->className(); widget->setFont(font); @@ -1563,7 +1570,10 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) chat_tick_timer->stop(); ui_vp_evidence_display->reset(); - m_chatmessage[MESSAGE].remove("\n"); //Remove undesired newline chars + //Remove undesired newline chars + m_chatmessage[MESSAGE].remove("\n"); + //Replace all trailing whitespace with a single space and remove all whitespace at the end of the string. + //m_chatmessage[MESSAGE] = m_chatmessage[MESSAGE].replace(QRegularExpression("^\\s+(?=\\s)|\\s+$|\\s+(?=\\s)"), ""); chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; @@ -1735,25 +1745,6 @@ void Courtroom::handle_chatmessage_2() set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); - // 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) @@ -2055,12 +2046,6 @@ void Courtroom::handle_chatmessage_3() QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int default_color) { - // Get rid of centering. - if(p_text.startsWith("~~")) - p_text.remove(0,2); - - p_text.remove("\n"); //Undesired newline chars, probably from copy-pasting it from a doc or something. - QString p_text_escaped; int check_pos = 0; @@ -2106,8 +2091,6 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int if (html) f_character = f_character.toHtmlEscaped(); - if (f_character == " " && html) //Whitespace, woah - f_character = " "; //Turn it into an HTML entity f_char_length = f_character.length(); bool color_update = false; @@ -2262,6 +2245,14 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int p_text_escaped.append("
"); } + if (html) + { + //Example: https://regex101.com/r/oL4nM9/37 - this replaces excessive/trailing/etc. whitespace with non-breaking space. + //I WOULD use white-space: pre; stylesheet tag, but for whataver reason it doesn't work no matter where I try it. + //If somoene else can get that piece of HTML memery to work, please do. + p_text_escaped.replace(QRegularExpression("^\\s|(?<=\\s)\\s"), " "); + } + return p_text_escaped; } @@ -2591,60 +2582,57 @@ void Courtroom::chat_tick() } tick_pos += f_char_length; - - //Do the colors, gradual showing, etc. in here - ui_vp_message->setHtml(additive_previous + filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt())); - - if (!formatting_char || f_character == "n") //NEWLINES (\n) COUNT AS A SINGLE CHARACTER. + if (formatting_char || (message_display_speed[current_display_speed] <= 0 && tick_pos < f_message.size())) { - //Make the cursor follow the message - QTextCursor cursor = ui_vp_message->textCursor(); - cursor.setPosition(real_tick_pos); - ui_vp_message->setTextCursor(cursor); - real_tick_pos += f_char_length; + chat_tick_timer->start(0); //Don't bother rendering anything out as we're doing the SPEED. (there's latency otherwise) } - ui_vp_message->ensureCursorVisible(); + else + { + //Do the colors, gradual showing, etc. in here + ui_vp_message->setHtml(additive_previous + filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt())); + + if (!formatting_char || f_character == "n") //NEWLINES (\n) COUNT AS A SINGLE CHARACTER. + { + //Make the cursor follow the message + QTextCursor cursor = ui_vp_message->textCursor(); + cursor.setPosition(real_tick_pos); + ui_vp_message->setTextCursor(cursor); + real_tick_pos += f_char_length; + } + ui_vp_message->ensureCursorVisible(); -// //Grab the currently displayed chars -// f_rest = f_message.left(tick_pos); -// f_rest.replace("\\n", "\n"); + // //Grab the currently displayed chars + // f_rest = f_message.left(tick_pos); + // f_rest.replace("\\n", "\n"); -// QFontMetrics fm = fontMetrics(); -// QRect bounding_rect = fm.boundingRect(QRect(0,0,ui_vp_message->width(),ui_vp_message->height()), Qt::TextWordWrap, f_rest); + // QFontMetrics fm = fontMetrics(); + // QRect bounding_rect = fm.boundingRect(QRect(0,0,ui_vp_message->width(),ui_vp_message->height()), Qt::TextWordWrap, f_rest); -// //If the text overflows, make it snap to bottom -// if (bounding_rect.height() > ui_vp_message->height()) -// { + // //If the text overflows, make it snap to bottom + // if (bounding_rect.height() > ui_vp_message->height()) + // { -// QScrollBar *scroll = ui_vp_message->verticalScrollBar(); -// scroll->value(); -// scroll->setValue(scroll->maximum()); -// } + // QScrollBar *scroll = ui_vp_message->verticalScrollBar(); + // scroll->value(); + // scroll->setValue(scroll->maximum()); + // } - // Keep the speed at bay. - if (current_display_speed < 0) - current_display_speed = 0; - else if (current_display_speed > 6) - current_display_speed = 6; + // Keep the speed at bay. + if (current_display_speed < 0) + current_display_speed = 0; + else if (current_display_speed > 6) + current_display_speed = 6; - //Blip player and real tick pos ticker - if (!formatting_char && (f_character != ' ' || blank_blip)) - { - if (blip_ticker % blip_rate == 0) + //Blip player and real tick pos ticker + if (!formatting_char && (f_character != ' ' || blank_blip)) { - blip_player->blip_tick(); + if (blip_ticker % blip_rate == 0) + { + blip_player->blip_tick(); + } + ++blip_ticker; } - ++blip_ticker; - } - // If we had a formatting char, we shouldn't wait so long again, as it won't appear! - // Additionally, if the message_display_speed length is too short for us to do anything (play animations, etc.) then skip the trouble and don't bother. - if (formatting_char || message_display_speed[current_display_speed] <= 0) - { - chat_tick_timer->start(0); - } - else - { //If this color is talking if (color_is_talking && anim_state != 2 && anim_state < 4) //Set it to talking as we're not on that already (though we have to avoid interrupting a non-interrupted preanim) { @@ -2658,7 +2646,6 @@ void Courtroom::chat_tick() ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); anim_state = 3; } - //Continue ticking chat_tick_timer->start(message_display_speed[current_display_speed]); } diff --git a/src/main.cpp b/src/main.cpp index 04b9df55..8d3f53b1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,11 +22,11 @@ int main(int argc, char *argv[]) QSettings *configini = main_app.configini; - QPluginLoader apngPlugin("imageformats/qapng"); + QPluginLoader apngPlugin("qapng"); if (!apngPlugin.load()) qCritical() << "QApng plugin could not be loaded"; - QPluginLoader webpPlugin("imageformats/qwebp"); + QPluginLoader webpPlugin("qwebp"); if (!webpPlugin.load()) qCritical() << "QWebp plugin could not be loaded"; diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index b9764343..2b86a1e1 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -315,7 +315,7 @@ QString AOApplication::get_font_name(QString p_identifier, QString p_file) { f_result = read_design_ini(p_identifier, default_path); if (f_result == "") - return "Sans"; + return ""; } return f_result; } -- cgit From d5cbb085db9cc61ddc007217d1217c343307322e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 29 Sep 2019 03:27:36 +0300 Subject: Update Bass.dll headers to newer version Remove a bunch of comments Add lqapng and lqwebp to try and get apng and webp support to fuckin load already --- Attorney_Online.pro | 2 ++ include/aomusicplayer.h | 2 -- include/bass.h | 20 +++++++++++++++----- src/courtroom.cpp | 16 ---------------- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index b7476190..36b87d29 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -15,6 +15,8 @@ HEADERS += $$files($$PWD/include/*.h) LIBS += -L$$PWD/lib +LIBS += -lqapng +LIBS += -lqwebp DEFINES += DISCORD diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 8e0d239a..9ce74852 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -44,8 +44,6 @@ private: // Channel 2 = extra // Channel 3 = extra HSTREAM m_stream_list[4]; - -// HSYNC loop_sync; }; #elif defined(QTAUDIO) class AOMusicPlayer diff --git a/include/bass.h b/include/bass.h index 1c50903c..388d4068 100644 --- a/include/bass.h +++ b/include/bass.h @@ -1,6 +1,6 @@ /* BASS 2.4 C/C++ header file - Copyright (c) 1999-2018 Un4seen Developments Ltd. + Copyright (c) 1999-2019 Un4seen Developments Ltd. See the BASS.CHM file for more detailed documentation */ @@ -117,6 +117,7 @@ typedef DWORD HPLUGIN; // Plugin handle #define BASS_CONFIG_VERIFY 23 #define BASS_CONFIG_UPDATETHREADS 24 #define BASS_CONFIG_DEV_BUFFER 27 +#define BASS_CONFIG_REC_LOOPBACK 28 #define BASS_CONFIG_VISTA_TRUEPOS 30 #define BASS_CONFIG_IOS_MIXAUDIO 34 #define BASS_CONFIG_DEV_DEFAULT 36 @@ -141,11 +142,14 @@ typedef DWORD HPLUGIN; // Plugin handle #define BASS_CONFIG_AM_DISABLE 58 #define BASS_CONFIG_NET_PLAYLIST_DEPTH 59 #define BASS_CONFIG_NET_PREBUF_WAIT 60 +#define BASS_CONFIG_WASAPI_PERSIST 65 +#define BASS_CONFIG_REC_WASAPI 66 // BASS_SetConfigPtr options #define BASS_CONFIG_NET_AGENT 16 #define BASS_CONFIG_NET_PROXY 17 #define BASS_CONFIG_IOS_NOTIFY 46 +#define BASS_CONFIG_LIBSSL 64 // BASS_Init flags #define BASS_DEVICE_8BITS 1 // 8 bit @@ -507,6 +511,7 @@ RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end the st #define STREAMPROC_DUMMY (STREAMPROC*)0 // "dummy" stream #define STREAMPROC_PUSH (STREAMPROC*)-1 // push stream #define STREAMPROC_DEVICE (STREAMPROC*)-2 // device mix stream +#define STREAMPROC_DEVICE_3D (STREAMPROC*)-3 // device 3D mix stream // BASS_StreamCreateFileUser file systems #define STREAMFILE_NOBUFFER 0 @@ -561,6 +566,8 @@ user : The 'user' parameter value given when calling BASS_StreamCreateURL */ #define BASS_SYNC_MUSICINST 1 #define BASS_SYNC_MUSICFX 3 #define BASS_SYNC_OGG_CHANGE 12 +#define BASS_SYNC_DEV_FAIL 14 +#define BASS_SYNC_DEV_FORMAT 15 #define BASS_SYNC_MIXTIME 0x40000000 // flag: sync at mixtime, else at playtime #define BASS_SYNC_ONETIME 0x80000000 // flag: sync only once, else continuously @@ -593,10 +600,11 @@ user : The 'user' parameter value given when calling BASS_RecordStart RETURN : TRUE = continue recording, FALSE = stop */ // BASS_ChannelIsActive return values -#define BASS_ACTIVE_STOPPED 0 -#define BASS_ACTIVE_PLAYING 1 -#define BASS_ACTIVE_STALLED 2 -#define BASS_ACTIVE_PAUSED 3 +#define BASS_ACTIVE_STOPPED 0 +#define BASS_ACTIVE_PLAYING 1 +#define BASS_ACTIVE_STALLED 2 +#define BASS_ACTIVE_PAUSED 3 +#define BASS_ACTIVE_PAUSED_DEVICE 4 // Channel attributes #define BASS_ATTRIB_FREQ 1 @@ -641,6 +649,7 @@ RETURN : TRUE = continue recording, FALSE = stop */ #define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window #define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias #define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data +#define BASS_DATA_FFT_NYQUIST 0x100 // FFT flag: return extra Nyquist value // BASS_ChannelGetLevelEx flags #define BASS_LEVEL_MONO 1 @@ -1006,6 +1015,7 @@ float BASSDEF(BASS_GetCPU)(); BOOL BASSDEF(BASS_Start)(); BOOL BASSDEF(BASS_Stop)(); BOOL BASSDEF(BASS_Pause)(); +BOOL BASSDEF(BASS_IsStarted)(); BOOL BASSDEF(BASS_SetVolume)(float volume); float BASSDEF(BASS_GetVolume)(); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index e0b19483..58104280 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2601,22 +2601,6 @@ void Courtroom::chat_tick() } ui_vp_message->ensureCursorVisible(); - // //Grab the currently displayed chars - // f_rest = f_message.left(tick_pos); - // f_rest.replace("\\n", "\n"); - - // QFontMetrics fm = fontMetrics(); - // QRect bounding_rect = fm.boundingRect(QRect(0,0,ui_vp_message->width(),ui_vp_message->height()), Qt::TextWordWrap, f_rest); - - // //If the text overflows, make it snap to bottom - // if (bounding_rect.height() > ui_vp_message->height()) - // { - - // QScrollBar *scroll = ui_vp_message->verticalScrollBar(); - // scroll->value(); - // scroll->setValue(scroll->maximum()); - // } - // Keep the speed at bay. if (current_display_speed < 0) current_display_speed = 0; -- cgit From adc3cbfe5b1d047910816d51e39bd427fae68708 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 29 Sep 2019 03:42:58 +0300 Subject: MMMYEAH THIS BIT REQUIRES ME TO UPDATE THE ACTUAL DOCKERFILE. --- Attorney_Online.pro | 2 -- 1 file changed, 2 deletions(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 36b87d29..b7476190 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -15,8 +15,6 @@ HEADERS += $$files($$PWD/include/*.h) LIBS += -L$$PWD/lib -LIBS += -lqapng -LIBS += -lqwebp DEFINES += DISCORD -- cgit From 1f72205716bae72a482521d0bf9336aad42cb418 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 29 Sep 2019 04:43:28 +0300 Subject: Mysterious super-similar-to-AA font, please don't elude me. --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 58104280..ea1ebeae 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -834,7 +834,7 @@ void Courtroom::set_font(QWidget *widget, QString class_name, QString p_identifi QFont font; if (font_name.isEmpty()) { - font = QFont(font_name, f_weight); + font = QFont("Arial", f_weight); font.setStyleHint(QFont::SansSerif, QFont::NoAntialias); } else -- cgit From 9bf41a714b6a46559bba23ea4fa4e0ad432d6997 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 29 Sep 2019 16:51:37 +0300 Subject: Bump up version numbers to 2.8.0 --- Attorney_Online.pro | 2 +- include/aoapplication.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index b7476190..5daf73ff 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -3,7 +3,7 @@ QT += core gui widgets network TARGET = Attorney_Online TEMPLATE = app -VERSION = 2.6.2.0 +VERSION = 2.8.0.0 INCLUDEPATH += $$PWD/include DESTDIR = $$PWD/bin diff --git a/include/aoapplication.h b/include/aoapplication.h index 89bfaa26..af1433f8 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -392,8 +392,8 @@ public: private: const int RELEASE = 2; - const int MAJOR_VERSION = 6; - const int MINOR_VERSION = 2; + const int MAJOR_VERSION = 8; + const int MINOR_VERSION = 0; QString current_theme = "default"; -- cgit From 4f738bfe34695db745d251e9461823b8835de201 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 1 Oct 2019 01:07:03 +0300 Subject: Fix some read_file errors on effect loading Make FM packet only fetch music, and new FA packet to fetch areas (this way you don't have to reload the entire music list just to get new areas) Fix a possible segfault with emote lists if emote list size is bad Hide casing button if server doesn't support casing Hide the remove buttons by default for iniswaps and sfx list so they're not clickable when they shouldn't be Prevent background from being displayed unless the server asked us to Fix some redundancy surrounding current_side Rework music list so list_music doesn't care about search bar and the hiding is actually done in the search function Implement text centering, rightening and justifying Fix text scrolling meme that happened with \n and skipped chars Fix the pos dropdown not actually caring if you selected jur and sea pos. Fix the pos dropdown sending like a million packets when scrolled through. Prevent characters from being incorrectly resized if a different-scaled character speaks Fix character select screen letting you choose characters that the server doesn't want us to be --- include/courtroom.h | 2 +- src/aocharmovie.cpp | 17 +--- src/charselect.cpp | 4 +- src/courtroom.cpp | 202 +++++++++++++++++++++++++++++++------------- src/emotes.cpp | 2 +- src/packet_distribution.cpp | 46 ++++------ src/text_file_functions.cpp | 18 ++-- 7 files changed, 179 insertions(+), 112 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 866a75f0..c680de06 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -149,7 +149,7 @@ public: 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); + void set_background(QString p_background, bool display=false); //sets the local character pos/side to use. void set_side(QString p_side); diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 5294b23c..96e84d49 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -235,23 +235,12 @@ QPixmap AOCharMovie::get_pixmap(QImage image) f_pixmap = QPixmap::fromImage(image.mirrored(true, false)); else f_pixmap = QPixmap::fromImage(image); - auto aspect_ratio = Qt::KeepAspectRatio; +// auto aspect_ratio = Qt::KeepAspectRatio; auto transform_mode = Qt::SmoothTransformation; - if (f_pixmap.size().width() > this->size().width() || f_pixmap.size().height() > this->size().height()) - { - f_pixmap = f_pixmap.scaledToHeight(this->height(), transform_mode); - } -// else if (f_pixmap.size().height() > this->size().height()) -// { -// f_pixmap = f_pixmap.scaledToWidth(this->width(), transform_mode); -// } - else - { - f_pixmap = f_pixmap.scaled(this->width(), this->height(), aspect_ratio, transform_mode); - } - this->move((f_w - f_pixmap.width())/2, (f_pixmap.height() - f_h)); //Always center horizontally, always put at the bottom vertically + f_pixmap = f_pixmap.scaledToHeight(f_h, transform_mode); this->resize(f_pixmap.size()); + this->move((f_w - f_pixmap.width())/2, (f_h - f_pixmap.height())); //Always center horizontally, always put at the bottom vertically return f_pixmap; } diff --git a/src/charselect.cpp b/src/charselect.cpp index 972a17a3..6739a1e3 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -134,7 +134,9 @@ void Courtroom::char_clicked(int n_char) 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() + "#%")); } - update_character(n_char); + else + update_character(n_char); + enter_courtroom(); ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ea1ebeae..544e3409 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -295,13 +295,13 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pos_dropdown_changed(int))); - connect(ui_iniswap_dropdown, SIGNAL(activated(int)), this, SLOT(on_iniswap_dropdown_changed(int))); + connect(ui_iniswap_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_iniswap_dropdown_changed(int))); connect(ui_iniswap_remove, SIGNAL(clicked()), this, SLOT(on_iniswap_remove_clicked())); - connect(ui_sfx_dropdown, SIGNAL(activated(int)), this, SLOT(on_sfx_dropdown_changed(int))); + connect(ui_sfx_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sfx_dropdown_changed(int))); connect(ui_sfx_remove, SIGNAL(clicked()), this, SLOT(on_sfx_remove_clicked())); - connect(ui_effects_dropdown, SIGNAL(activated(int)), this, SLOT(on_effects_dropdown_changed(int))); + connect(ui_effects_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_effects_dropdown_changed(int))); connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); @@ -460,10 +460,12 @@ void Courtroom::set_widgets() if (ao_app->casing_alerts_enabled) { ui_announce_casing->show(); + ui_casing->show(); } else { ui_announce_casing->hide(); + ui_casing->hide(); } // We also show the non-server-dependent client additions. @@ -617,6 +619,7 @@ void Courtroom::set_widgets() ui_iniswap_remove->setText("X"); ui_iniswap_remove->set_image("evidencex"); ui_iniswap_remove->setToolTip(tr("Remove the currently selected iniswap from the list and return to the original character folder.")); + ui_iniswap_remove->hide(); set_size_and_pos(ui_sfx_dropdown, "sfx_dropdown"); ui_sfx_dropdown->setEditable(true); @@ -628,6 +631,7 @@ void Courtroom::set_widgets() ui_sfx_remove->setText("X"); ui_sfx_remove->set_image("evidencex"); ui_sfx_remove->setToolTip(tr("Remove the currently selected iniswap from the list and return to the original character folder.")); + ui_sfx_remove->hide(); set_size_and_pos(ui_effects_dropdown, "effects_dropdown"); ui_effects_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); @@ -805,7 +809,6 @@ void Courtroom::set_widgets() ui_spectator->setToolTip(tr("Become a spectator. You won't be able to interact with the in-character screen.")); refresh_evidence(); - refresh_emotes(); } void Courtroom::set_fonts() @@ -954,7 +957,7 @@ void Courtroom::done_received() ui_spectator->show(); } -void Courtroom::set_background(QString p_background) +void Courtroom::set_background(QString p_background, bool display) { ui_vp_testimony->stop(); current_background = p_background; @@ -974,13 +977,16 @@ void Courtroom::set_background(QString p_background) set_size_and_pos(ui_ic_chat_message, "ic_chat_message"); } - ui_vp_speedlines->stop(); - ui_vp_player_char->stop(); - ui_vp_sideplayer_char->stop(); - ui_vp_effect->stop(); - ui_vp_message->hide(); - ui_vp_chatbox->hide(); - set_scene(QString::number(ao_app->get_desk_mod(current_char, current_emote)), current_side); + if (display) + { + ui_vp_speedlines->stop(); + ui_vp_player_char->stop(); + ui_vp_sideplayer_char->stop(); + ui_vp_effect->stop(); + ui_vp_message->hide(); + ui_vp_chatbox->hide(); + set_scene(QString::number(ao_app->get_desk_mod(current_char, current_emote)), current_side); + } } void Courtroom::set_side(QString p_side) @@ -1034,7 +1040,7 @@ void Courtroom::update_character(int p_cid) } current_char = f_char; - current_side = ""; + current_side = ao_app->get_char_side(current_char); current_emote_page = 0; current_emote = 0; @@ -1044,17 +1050,18 @@ void Courtroom::update_character(int p_cid) else ui_emotes->show(); + refresh_emotes(); set_emote_page(); set_emote_dropdown(); set_sfx_dropdown(); set_effects_dropdown(); - QString side = current_side; - if (side == "") - side = ao_app->get_char_side(current_char); + qDebug() << "update_character called"; + if (newchar) //Avoid infinite loop of death and suffering + set_iniswap_dropdown(); - if (side == "jud") + if (current_side == "jud") { ui_witness_testimony->show(); ui_cross_examination->show(); @@ -1088,9 +1095,6 @@ void Courtroom::update_character(int p_cid) ui_char_select_background->hide(); ui_ic_chat_message->setEnabled(m_cid != -1); ui_ic_chat_message->setFocus(); - - if (newchar) - set_iniswap_dropdown(); } void Courtroom::enter_courtroom() @@ -1134,6 +1138,7 @@ void Courtroom::enter_courtroom() //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); } +//Todo: multithread this due to some servers having large as hell music list void Courtroom::list_music() { ui_music_list->clear(); @@ -1170,24 +1175,12 @@ void Courtroom::list_music() if (i_song_listname == i_song) //Not supposed to be a song to begin with - a category? parent = treeItem; ++n_listed_songs; - - if (ui_music_search->text() != "") - treeItem->setHidden(true); } - if (ui_music_search->text() != "") - { - QList clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 0); - foreach(QTreeWidgetItem* item, clist) - { - if (item->parent() != nullptr) //So the category shows up too - item->parent()->setHidden(false); - item->setHidden(false); - } - } - ui_music_list->expandAll(); //Workaround, it needs to preserve the "expanded categories" due to list music being updated constantly by some servers + ui_music_list->expandAll(); //Needs to somehow remember which categories were expanded/collapsed if the music list didn't change since last time } +//Todo: multithread this due to some servers having large as hell area list void Courtroom::list_areas() { ui_area_list->clear(); @@ -1322,9 +1315,8 @@ void Courtroom::on_chat_return_pressed() QStringList packet_contents; - QString f_side = current_side; - if (f_side == "") - f_side = ao_app->get_char_side(current_char); + if (current_side == "") + current_side = ao_app->get_char_side(current_char); QString f_desk_mod = "chat"; @@ -1345,7 +1337,7 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(ui_ic_chat_message->text()); - packet_contents.append(f_side); + packet_contents.append(current_side); packet_contents.append(get_char_sfx()); @@ -1500,7 +1492,9 @@ void Courtroom::on_chat_return_pressed() { QString fx_sound = ao_app->get_effect_sound(effect, current_char); packet_contents.append(effect + "|" + fx_sound); + ui_effects_dropdown->blockSignals(true); ui_effects_dropdown->setCurrentIndex(0); + ui_effects_dropdown->blockSignals(false); effect = ""; } @@ -2053,10 +2047,36 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int bool ic_next_is_not_special = false; std::stack ic_color_stack; + //Text alignment shenanigans. Could make a dropdown for this later, too! + QString align; + if (p_text.trimmed().startsWith("~~")) + { + p_text.remove(p_text.indexOf("~~"), 2); + target_pos -= 2; + align = "center"; + } + else if (p_text.trimmed().startsWith("~>")) + { + p_text.remove(p_text.indexOf("~>"), 2); + target_pos -= 2; + align = "right"; + } + else if (p_text.trimmed().startsWith("<>")) + { + p_text.remove(p_text.indexOf("<>"), 2); + target_pos -= 2; + align = "justify"; + } + + //If html is enabled, prepare this text to be all ready for it. if (html) { ic_color_stack.push(default_color); QString appendage = ""; + + if (!align.isEmpty()) + appendage.prepend("
"); + p_text_escaped.insert(check_pos_escaped, appendage); check_pos_escaped += appendage.size(); } @@ -2240,7 +2260,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int check_pos += 1; } - if (!ic_color_stack.empty()) + if (!ic_color_stack.empty() && html) { p_text_escaped.append(""); } @@ -2251,6 +2271,8 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int //I WOULD use white-space: pre; stylesheet tag, but for whataver reason it doesn't work no matter where I try it. //If somoene else can get that piece of HTML memery to work, please do. p_text_escaped.replace(QRegularExpression("^\\s|(?<=\\s)\\s"), " "); + if (!align.isEmpty()) + p_text_escaped.append("
"); } return p_text_escaped; @@ -2495,9 +2517,6 @@ void Courtroom::chat_tick() ui_vp_chat_arrow->play("chat_arrow", f_char, f_custom_theme); //Chat stopped being processed, indicate that. additive_previous = additive_previous + filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt()); real_tick_pos = ui_vp_message->toPlainText().size(); - - QScrollBar *scroll = ui_vp_message->verticalScrollBar(); - scroll->setValue(scroll->maximum()); return; } @@ -2505,6 +2524,29 @@ void Courtroom::chat_tick() bool formatting_char = false; QString f_rest = f_message; + + //Alignment characters + if (tick_pos < 2) + { + if (f_rest.startsWith("~~")) + { + tick_pos = f_rest.indexOf("~~"); + f_rest.remove(tick_pos, 2); + tick_pos += 2; + } + else if (f_rest.startsWith("~>")) + { + tick_pos = f_rest.indexOf("~>"); + f_rest.remove(tick_pos, 2); + tick_pos += 2; + } + else if (f_rest.startsWith("<>")) + { + tick_pos = f_rest.indexOf("<>"); + f_rest.remove(tick_pos, 2); + tick_pos += 2; + } + } f_rest.remove(0, tick_pos); QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); QString f_character; @@ -2518,6 +2560,7 @@ void Courtroom::chat_tick() f_character = f_rest.left(tbf.position()); f_char_length = f_character.length(); + tick_pos += f_char_length; // Escape character. if (!next_character_is_not_special) @@ -2581,24 +2624,25 @@ void Courtroom::chat_tick() next_character_is_not_special = false; } - tick_pos += f_char_length; if (formatting_char || (message_display_speed[current_display_speed] <= 0 && tick_pos < f_message.size())) { chat_tick_timer->start(0); //Don't bother rendering anything out as we're doing the SPEED. (there's latency otherwise) + if (!formatting_char || f_character == "n") + real_tick_pos += f_char_length; //Adjust the tick position for the scrollbar convenience } else { //Do the colors, gradual showing, etc. in here ui_vp_message->setHtml(additive_previous + filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt())); - if (!formatting_char || f_character == "n") //NEWLINES (\n) COUNT AS A SINGLE CHARACTER. - { - //Make the cursor follow the message - QTextCursor cursor = ui_vp_message->textCursor(); - cursor.setPosition(real_tick_pos); - ui_vp_message->setTextCursor(cursor); - real_tick_pos += f_char_length; - } + //This should always be done AFTER setHtml. Scroll the chat window with the text. + + //Make the cursor follow the message + QTextCursor cursor = ui_vp_message->textCursor(); + cursor.setPosition(real_tick_pos); + ui_vp_message->setTextCursor(cursor); + real_tick_pos += f_char_length; + ui_vp_message->ensureCursorVisible(); // Keep the speed at bay. @@ -3256,11 +3300,27 @@ void Courtroom::on_ooc_toggle_clicked() } } +//Todo: multithread this due to some servers having large as hell music list void Courtroom::on_music_search_edited(QString p_text) { - //preventing compiler warnings - p_text += "a"; - list_music(); + // Iterate through all QTreeWidgetItem items + QTreeWidgetItemIterator it(ui_music_list); + while (*it) + { + (*it)->setHidden(p_text != ""); + ++it; + } + + if (p_text != "") + { + QList clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 0); + foreach(QTreeWidgetItem* item, clist) + { + if (item->parent() != nullptr) //So the category shows up too + item->parent()->setHidden(false); + item->setHidden(false); + } + } list_areas(); } @@ -3268,7 +3328,7 @@ void Courtroom::on_pos_dropdown_changed(int p_index) { ui_ic_chat_message->setFocus(); - if (p_index < 0 || p_index > 5) + if (p_index < 0 || p_index > 7) return; toggle_judge_buttons(false); @@ -3296,18 +3356,27 @@ void Courtroom::on_pos_dropdown_changed(int p_index) 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() == "") + if (f_pos == "") return; - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/pos " + f_pos + "#%")); + //YEAH SENDING LIKE 20 PACKETS IF THE USER SCROLLS THROUGH, GREAT IDEA + //how about this instead + set_side(f_pos); } void Courtroom::set_iniswap_dropdown() { + ui_iniswap_dropdown->blockSignals(true); ui_iniswap_dropdown->clear(); if (m_cid == -1) { @@ -3338,6 +3407,7 @@ void Courtroom::set_iniswap_dropdown() break; } } + ui_iniswap_dropdown->blockSignals(false); } void Courtroom::on_iniswap_dropdown_changed(int p_index) @@ -3354,7 +3424,9 @@ void Courtroom::on_iniswap_dropdown_changed(int p_index) swaplist.append(entry); } ao_app->write_to_file(swaplist.join("\n"), ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")); + ui_iniswap_dropdown->blockSignals(true); ui_iniswap_dropdown->setCurrentIndex(p_index); + ui_iniswap_dropdown->blockSignals(false); update_character(m_cid); if (p_index != 0) ui_iniswap_remove->show(); @@ -3364,6 +3436,11 @@ void Courtroom::on_iniswap_dropdown_changed(int p_index) void Courtroom::on_iniswap_remove_clicked() { + if (ui_iniswap_dropdown->count() <= 0) + { + ui_iniswap_remove->hide(); //We're not supposed to see it. Do this or the client will crash + return; + } if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) != char_list.at(m_cid).name) { ui_iniswap_dropdown->removeItem(ui_iniswap_dropdown->currentIndex()); @@ -3374,6 +3451,7 @@ void Courtroom::on_iniswap_remove_clicked() void Courtroom::set_sfx_dropdown() { + ui_sfx_dropdown->blockSignals(true); ui_sfx_dropdown->clear(); if (m_cid == -1) { @@ -3404,6 +3482,7 @@ void Courtroom::set_sfx_dropdown() ui_sfx_dropdown->addItems(soundlist); ui_sfx_dropdown->setCurrentIndex(0); ui_sfx_remove->hide(); + ui_sfx_dropdown->blockSignals(false); } void Courtroom::on_sfx_dropdown_changed(int p_index) @@ -3427,7 +3506,9 @@ void Courtroom::on_sfx_dropdown_changed(int p_index) if (defaultlist.size() > 0 && defaultlist.toSet().subtract(soundlist.toSet()).size() > 0) //There's a difference from the default configuration ao_app->write_to_file(soundlist.join("\n"), ao_app->get_character_path(current_char, "soundlist.ini")); //Create a new sound list + ui_sfx_dropdown->blockSignals(true); ui_sfx_dropdown->setCurrentIndex(p_index); + ui_sfx_dropdown->blockSignals(false); if (p_index != 0) ui_sfx_remove->show(); else @@ -3436,6 +3517,11 @@ void Courtroom::on_sfx_dropdown_changed(int p_index) void Courtroom::on_sfx_remove_clicked() { + if (ui_sfx_dropdown->count() <= 0) + { + ui_sfx_remove->hide(); //We're not supposed to see it. Do this or the client will crash + return; + } if (ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()) != "Default") { ui_sfx_dropdown->removeItem(ui_sfx_dropdown->currentIndex()); @@ -3445,6 +3531,7 @@ void Courtroom::on_sfx_remove_clicked() void Courtroom::set_effects_dropdown() { + ui_effects_dropdown->blockSignals(true); ui_effects_dropdown->clear(); if (m_cid == -1) { @@ -3488,6 +3575,7 @@ void Courtroom::set_effects_dropdown() } ui_effects_dropdown->setCurrentIndex(0); + ui_effects_dropdown->blockSignals(false); } void Courtroom::on_effects_dropdown_changed(int p_index) diff --git a/src/emotes.cpp b/src/emotes.cpp index 3e968241..58e85948 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -107,7 +107,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 < ui_emote_list.size(); ++n_emote) { int n_real_emote = n_emote + current_emote_page * max_emotes_on_page; AOEmoteButton *f_emote = ui_emote_list.at(n_emote); diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 30605303..097d2512 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -531,46 +531,32 @@ void AOApplication::server_packet_received(AOPacket *p_packet) send_server_packet(new AOPacket("RD#%")); } - else if (header == "FM") + else if (header == "FM") //Fetch music ONLY { if (!courtroom_constructed) goto end; w_courtroom->clear_music(); - w_courtroom->clear_areas(); - - bool musics_time = false; - int areas = 0; for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element) { - if (musics_time) - { - w_courtroom->append_music(f_contents.at(n_element)); - } - else - { - if (f_contents.at(n_element).endsWith(".wav") || - f_contents.at(n_element).endsWith(".mp3") || - f_contents.at(n_element).endsWith(".mp4") || - f_contents.at(n_element).endsWith(".ogg") || - f_contents.at(n_element).endsWith(".opus")) - { - musics_time = true; - w_courtroom->fix_last_area(); - w_courtroom->append_music(f_contents.at(n_element)); - areas--; -// qDebug() << "wtf!!" << f_contents.at(n_element); - } - else - { - w_courtroom->append_area(f_contents.at(n_element)); - areas++; - } - } + w_courtroom->append_music(f_contents.at(n_element)); } w_courtroom->list_music(); + } + else if (header == "FA") //Fetch areas ONLY + { + if (!courtroom_constructed) + goto end; + + w_courtroom->clear_areas(); + + for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element) + { + w_courtroom->append_area(f_contents.at(n_element)); + } + w_courtroom->list_areas(); } else if (header == "DONE") @@ -597,7 +583,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) { if (f_contents.size() >= 2) //We have a pos included in the background packet! w_courtroom->set_side(f_contents.at(1)); - w_courtroom->set_background(f_contents.at(0)); + w_courtroom->set_background(f_contents.at(0), f_contents.size() >= 2); } } else if (header == "SP") diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 2b86a1e1..35e42b4f 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -831,18 +831,19 @@ QStringList AOApplication::get_theme_effects() QString p_path = get_theme_path("effects/effects.ini"); QString default_path = get_default_theme_path("effects/effects.ini"); + QStringList effects; if (!file_exists(p_path)) { p_path = default_path; + if (!file_exists(p_path)) + return effects; } - QStringList lines = read_file(p_path).split("\n"); - QStringList effects; + QStringList lines = read_file(p_path).split("\n"); foreach (QString effect, lines) { effect = effect.split("=")[0].trimmed(); - qDebug() << effect; - if (effect != "" && !effects.contains(effect)) + if (!effect.isEmpty() && !effects.contains(effect)) effects.append(effect); } return effects; @@ -853,14 +854,15 @@ QStringList AOApplication::get_effects(QString p_char) QString p_effect = read_char_ini(p_char, "effects", "Options"); QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; - QStringList lines = read_file(p_path).split("\n"); - QStringList effects = get_theme_effects(); + if (!file_exists(p_path)) + return effects; + + QStringList lines = read_file(p_path).split("\n"); foreach (QString effect, lines) { effect = effect.split("=")[0].trimmed(); - qDebug() << effect; - if (effect != "" && !effects.contains(effect)) + if (!effect.isEmpty() && !effects.contains(effect)) effects.append(effect); } -- cgit From 0eccf1ba2285bfc2ffe812cd0a2cdee778053171 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 1 Oct 2019 01:38:38 +0300 Subject: Make screenshakes work with preanim delays --- src/courtroom.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 544e3409..ce26b233 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2457,7 +2457,8 @@ void Courtroom::start_chat_ticking() sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); } - if (m_chatmessage[SCREENSHAKE] == "1") + int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); //text meme bonanza + if ((emote_mod == 0 || emote_mod == 5) && m_chatmessage[SCREENSHAKE] == "1") { this->do_screenshake(); } @@ -2682,7 +2683,10 @@ void Courtroom::chat_tick() void Courtroom::play_sfx() { QString sfx_name = m_chatmessage[SFX_NAME]; - + if (m_chatmessage[SCREENSHAKE] == "1") //Screenshake dependant on preanim sfx delay meme + { + this->do_screenshake(); + } if (sfx_name == "1") return; -- cgit From 292c425c7895afcd8a545afa40dffefea803aabc Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 1 Oct 2019 04:58:57 +0300 Subject: Fix music volume being weird due to m_volume being shared by ambience and music at the same time Fix version= being wrong --- Attorney_Online.pro | 2 +- include/aomusicplayer.h | 2 +- src/aomusicplayer.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 5daf73ff..5d3eda01 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -3,7 +3,7 @@ QT += core gui widgets network TARGET = Attorney_Online TEMPLATE = app -VERSION = 2.8.0.0 +VERSION = 2.8.0.2 INCLUDEPATH += $$PWD/include DESTDIR = $$PWD/bin diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 9ce74852..15014afc 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -37,7 +37,7 @@ private: AOApplication *ao_app; bool m_looping = false; - int m_volume = 0; + int m_volume[4] = {0, 0, 0, 0}; // Channel 0 = music // Channel 1 = ambience diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index c845948c..b44e2e27 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -66,7 +66,7 @@ void AOMusicPlayer::play(QString p_song, int channel, bool crossfade) //Start it BASS_ChannelPlay(newstream, false); //Fade in our sample - BASS_ChannelSlideAttribute(newstream, BASS_ATTRIB_VOL, static_cast(m_volume / 100.0f), 1000); + BASS_ChannelSlideAttribute(newstream, BASS_ATTRIB_VOL, static_cast(m_volume[channel] / 100.0f), 1000); m_stream_list[channel] = newstream; } @@ -75,7 +75,7 @@ void AOMusicPlayer::play(QString p_song, int channel, bool crossfade) BASS_ChannelStop(m_stream_list[channel]); m_stream_list[channel] = newstream; BASS_ChannelPlay(m_stream_list[channel], false); - this->set_volume(m_volume, channel); + this->set_volume(m_volume[channel], channel); } this->set_looping(m_looping); //Have to do this here due to any crossfading-related changes, etc. @@ -88,8 +88,8 @@ void AOMusicPlayer::stop(int channel) void AOMusicPlayer::set_volume(int p_value, int channel) { - m_volume = p_value; - float volume = m_volume / 100.0f; + m_volume[channel] = p_value; + float volume = m_volume[channel] / 100.0f; if (channel < 0) { for (int n_stream = 0 ; n_stream < m_channelmax ; ++n_stream) -- cgit From 4c23e159350eeb3d74faf7e814f2874787e02565 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 2 Oct 2019 01:20:00 +0300 Subject: Rewrite pairing character ordering logic to instead operate based on a user-accessible drpodown menu (it's a dropdown for the future when there's more options) Fix current charmovie breaking offsets Make pairing offsets applicable even without a pairing partner, making it a generic offset Fix the chat message hardcoding max colors to 8 (when it should be max_colors) Come up with a way to convey the ordering information without creating an extra new packet in a cool way (backwards compatibility AND less clutter!) More info on the evidence_x and evidence_ok tooltips Don't mute music when you switch to CSS anymore --- include/courtroom.h | 8 ++- src/aocharmovie.cpp | 2 +- src/courtroom.cpp | 152 ++++++++++++++++++++-------------------------------- src/evidence.cpp | 5 +- 4 files changed, 69 insertions(+), 98 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index c680de06..aeef3caa 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -266,7 +266,10 @@ private: int other_charid = -1; // The offset this user has given if they want to appear alongside someone. - int offset_with_pair = 0; + int char_offset = 0; + + // 0 = in front, 1 = behind + int pair_order = 0; QVector char_list; QVector evidence_list; @@ -464,6 +467,8 @@ private: QListWidget *ui_pair_list; QSpinBox *ui_pair_offset_spinbox; + QComboBox *ui_pair_order_dropdown; + AOLineEdit *ui_ic_chat_message; QLineEdit *ui_ic_chat_name; @@ -672,6 +677,7 @@ private slots: void on_mute_clicked(); void on_pair_clicked(); + void on_pair_order_dropdown_changed(int p_index); void on_defense_minus_clicked(); void on_defense_plus_clicked(); diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 96e84d49..6f6c3a17 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -240,7 +240,7 @@ QPixmap AOCharMovie::get_pixmap(QImage image) f_pixmap = f_pixmap.scaledToHeight(f_h, transform_mode); this->resize(f_pixmap.size()); - this->move((f_w - f_pixmap.width())/2, (f_h - f_pixmap.height())); //Always center horizontally, always put at the bottom vertically + this->move(x + (f_w - f_pixmap.width())/2, y + (f_h - f_pixmap.height())); //Always center horizontally, always put at the bottom vertically return f_pixmap; } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ce26b233..978fbbe3 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -272,6 +272,11 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_pair_offset_spinbox = new QSpinBox(this); ui_pair_offset_spinbox->setRange(-100,100); ui_pair_offset_spinbox->setSuffix(tr("% offset")); + + ui_pair_order_dropdown = new QComboBox(this); + ui_pair_order_dropdown->addItem("To front"); + ui_pair_order_dropdown->addItem("To behind"); + ui_pair_button = new AOButton(this, ao_app); ui_evidence_button = new AOButton(this, ao_app); @@ -360,6 +365,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_pair_button, SIGNAL(clicked()), this, SLOT(on_pair_clicked())); connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_pair_list_clicked(QModelIndex))); connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_pair_offset_changed(int))); + connect(ui_pair_order_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pair_order_dropdown_changed(int))); connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked())); @@ -536,9 +542,15 @@ void Courtroom::set_widgets() set_size_and_pos(ui_pair_list, "pair_list"); ui_pair_list->hide(); ui_pair_list->setToolTip(tr("Select a character you wish to pair with.")); + set_size_and_pos(ui_pair_offset_spinbox, "pair_offset_spinbox"); ui_pair_offset_spinbox->hide(); ui_pair_offset_spinbox->setToolTip(tr("Change the percentage offset of your character's position from the center of the screen.")); + + ui_pair_order_dropdown->hide(); + set_size_and_pos(ui_pair_order_dropdown, "pair_order_dropdown"); + ui_pair_offset_spinbox->setToolTip(tr("Change the order of appearance for your character.")); + set_size_and_pos(ui_pair_button, "pair_button"); ui_pair_button->set_image("pair_button"); ui_pair_button->setToolTip(tr("Display the list of characters to pair with.")); @@ -1411,7 +1423,7 @@ void Courtroom::on_chat_return_pressed() if (text_color < 0) f_text_color = "0"; - else if (text_color > 8) + else if (text_color > max_colors) f_text_color = "0"; else f_text_color = QString::number(text_color); @@ -1435,14 +1447,17 @@ void Courtroom::on_chat_return_pressed() // 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)); + QString packet = QString::number(other_charid); + if (ao_app->effects_enabled) //Only servers with effects enabled will support pair reordering + packet += "^" + QString::number(pair_order); + packet_contents.append(packet); } else { packet_contents.append("-1"); - packet_contents.append("0"); } + //Send the offset as it's gonna be used regardless + packet_contents.append(QString::number(char_offset)); // Finally, we send over if we want our pres to not interrupt. if (ui_pre_non_interrupt->isChecked() && ui_pre->isChecked()) @@ -1751,16 +1766,14 @@ void Courtroom::handle_chatmessage_2() // Making the second character appear. if (m_chatmessage[OTHER_CHARID].isEmpty()) { - // If there is no second character, hide 'em, and center the first. + // If there is no second character, hide 'em ui_vp_sideplayer_char->stop(); 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); + int got_other_charid = m_chatmessage[OTHER_CHARID].split("^")[0].toInt(&ok); if (ok) { if (got_other_charid > -1) @@ -1768,91 +1781,27 @@ void Courtroom::handle_chatmessage_2() // 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->stackUnder(ui_vp_player_char); - } - else - { - ui_vp_player_char->stackUnder(ui_vp_sideplayer_char); - } - } - 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); + int other_offset = m_chatmessage[OTHER_OFFSET].toInt(); + ui_vp_sideplayer_char->move(ui_viewport->width() * other_offset / 100, 0); + qDebug() << "other offset" << other_offset; - // Finally, we reorder them based on who is more to the right. - if (hor2_offset >= hor_offset) - { - ui_vp_sideplayer_char->stackUnder(ui_vp_player_char); - } - else - { - ui_vp_player_char->stackUnder(ui_vp_sideplayer_char); - } - } - else + QStringList args = m_chatmessage[OTHER_CHARID].split("^"); + if (args.size() > 1) //This ugly workaround is so we don't make an extra packet just for this purpose. Rewrite pairing when? { - // 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->stackUnder(ui_vp_player_char); - } - else - { - ui_vp_player_char->stackUnder(ui_vp_sideplayer_char); + //Change the order of appearance based on the pair order variable + int order = args.at(1).toInt(); + switch (order) { + case 0: + ui_vp_sideplayer_char->stackUnder(ui_vp_player_char); + break; + case 1: + ui_vp_player_char->stackUnder(ui_vp_sideplayer_char); + break; + default: + break; } } + // 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); @@ -1866,11 +1815,19 @@ void Courtroom::handle_chatmessage_2() // really is no second character, hide 'em, and center the first. ui_vp_sideplayer_char->hide(); ui_vp_sideplayer_char->move(0,0); - - ui_vp_player_char->move(0,0); } } } + //Set ourselves according to SELF_OFFSET + + bool ok; + int self_offset = m_chatmessage[SELF_OFFSET].toInt(&ok); + if (ok) + ui_vp_player_char->move(ui_viewport->width() * self_offset / 100, 0); + else + ui_vp_player_char->move(0, 0); + + qDebug() << "offset OK" << ok << "offset value" << self_offset; switch (emote_mod) { case 1: case 2: case 6: @@ -3077,7 +3034,7 @@ void Courtroom::on_ooc_return_pressed() { if (off >= -100 && off <= 100) { - offset_with_pair = off; + char_offset = off; QString msg = tr("You have set your offset to "); msg.append(QString::number(off)); msg.append("%."); @@ -3852,6 +3809,7 @@ void Courtroom::on_mute_clicked() ui_mute_list->show(); ui_pair_list->hide(); ui_pair_offset_spinbox->hide(); + ui_pair_order_dropdown->hide(); ui_pair_button->set_image("pair_button"); ui_mute->set_image("mute_pressed"); } @@ -3868,6 +3826,7 @@ void Courtroom::on_pair_clicked() { ui_pair_list->show(); ui_pair_offset_spinbox->show(); + ui_pair_order_dropdown->show(); ui_mute_list->hide(); ui_mute->set_image("mute"); ui_pair_button->set_image("pair_button_pressed"); @@ -3876,10 +3835,16 @@ void Courtroom::on_pair_clicked() { ui_pair_list->hide(); ui_pair_offset_spinbox->hide(); + ui_pair_order_dropdown->hide(); ui_pair_button->set_image("pair_button"); } } +void Courtroom::on_pair_order_dropdown_changed(int p_index) +{ + pair_order = p_index; +} + void Courtroom::on_defense_minus_clicked() { int f_state = defense_bar_state - 1; @@ -4014,7 +3979,7 @@ void Courtroom::on_log_limit_changed(int value) void Courtroom::on_pair_offset_changed(int value) { - offset_with_pair = value; + char_offset = value; } void Courtroom::on_witness_testimony_clicked() @@ -4059,7 +4024,6 @@ void Courtroom::on_guilty_clicked() void Courtroom::on_change_character_clicked() { - music_player->set_volume(0); sfx_player->set_volume(0); blip_player->set_volume(0); diff --git a/src/evidence.cpp b/src/evidence.cpp index 6ee2b8e5..58f31811 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -24,9 +24,10 @@ void Courtroom::initialize_evidence() ui_evidence_image_button = new AOButton(ui_evidence_overlay, ao_app); ui_evidence_image_button->setText(tr("Choose...")); ui_evidence_x = new AOButton(ui_evidence_overlay, ao_app); - ui_evidence_x->setToolTip(tr("Close the evidence display/editing overlay")); + ui_evidence_x->setToolTip(tr("Close the evidence display/editing overlay.\n" + "You will be prompted if there's any unsaved changes.")); ui_evidence_ok = new AOButton(ui_evidence_overlay, ao_app); - ui_evidence_ok->setToolTip(tr("Save any changes made to this piece of evidence")); + ui_evidence_ok->setToolTip(tr("Save any changes made to this piece of evidence and send them to server.")); ui_evidence_description = new AOTextEdit(ui_evidence_overlay); ui_evidence_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);" -- cgit From e3ddc41cc8362fc17e803708826293d389413fc7 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 2 Oct 2019 20:28:42 +0300 Subject: Add rightclick context menus to sfx dropdown, iniswap dropdown and effects dropdown to open the ini's and respective folders try to fix settings menu (I failed) --- include/courtroom.h | 12 ++++++ src/aooptionsdialog.cpp | 4 +- src/courtroom.cpp | 108 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 1 deletion(-) diff --git a/include/courtroom.h b/include/courtroom.h index aeef3caa..86a4ea79 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -55,6 +55,8 @@ #include #include #include +#include +#include //#include #include @@ -628,6 +630,9 @@ private slots: void on_music_search_edited(QString p_text); void on_music_list_double_clicked(QTreeWidgetItem *p_item, int column); + void on_music_list_context_menu_requested(const QPoint &pos); + void music_list_expand_all(); + void music_list_collapse_all(); void on_area_list_double_clicked(QModelIndex p_model); void select_emote(int p_id); @@ -642,13 +647,20 @@ private slots: void on_iniswap_dropdown_changed(int p_index); void set_iniswap_dropdown(); + void on_iniswap_context_menu_requested(const QPoint &pos); + void on_iniswap_edit_requested(); void on_iniswap_remove_clicked(); void on_sfx_dropdown_changed(int p_index); void set_sfx_dropdown(); + void on_sfx_context_menu_requested(const QPoint &pos); + void on_sfx_edit_requested(); void on_sfx_remove_clicked(); void set_effects_dropdown(); + void on_effects_context_menu_requested(const QPoint &pos); + void on_effects_edit_requested(); + void on_character_effects_edit_requested(); void on_effects_dropdown_changed(int p_index); bool effects_dropdown_find_and_set(QString effect); diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index b9267821..37694e4e 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -12,7 +12,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_settings_buttons = new QDialogButtonBox(this); - QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Maximum); + QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(ui_settings_buttons->sizePolicy().hasHeightForWidth()); @@ -36,6 +36,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi // Let's add the tabs one by one. // First, we'll start with 'Gameplay'. ui_gameplay_tab = new QWidget(); + ui_gameplay_tab->setSizePolicy(sizePolicy1); ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay")); ui_form_layout_widget = new QWidget(ui_gameplay_tab); ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 211)); @@ -45,6 +46,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi 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->setSpacing(2); int row = 0; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 978fbbe3..cc5965cc 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -131,6 +131,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_music_list->setHeaderHidden(true); ui_music_list->header()->setStretchLastSection(false); ui_music_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui_music_list->setContextMenuPolicy(Qt::CustomContextMenu); ui_music_display = new AOMovie(this, ao_app); ui_music_display->set_play_once(false); @@ -182,12 +183,15 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_pos_dropdown->addItem("sea"); ui_iniswap_dropdown = new QComboBox(this); + ui_iniswap_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); ui_iniswap_remove = new AOButton(this, ao_app); ui_sfx_dropdown = new QComboBox(this); + ui_sfx_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); ui_sfx_remove = new AOButton(this, ao_app); ui_effects_dropdown = new QComboBox(this); + ui_effects_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); ui_defense_bar = new AOImage(this, ao_app); ui_prosecution_bar = new AOImage(this, ao_app); @@ -301,12 +305,15 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pos_dropdown_changed(int))); connect(ui_iniswap_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_iniswap_dropdown_changed(int))); + connect(ui_iniswap_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_iniswap_context_menu_requested(QPoint))); connect(ui_iniswap_remove, SIGNAL(clicked()), this, SLOT(on_iniswap_remove_clicked())); connect(ui_sfx_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sfx_dropdown_changed(int))); + connect(ui_sfx_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_sfx_context_menu_requested(QPoint))); connect(ui_sfx_remove, SIGNAL(clicked()), this, SLOT(on_sfx_remove_clicked())); connect(ui_effects_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_effects_dropdown_changed(int))); + connect(ui_effects_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_effects_context_menu_requested(QPoint))); connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); @@ -315,6 +322,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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_music_list, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_music_list_context_menu_requested(QPoint))); 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())); @@ -3395,6 +3403,25 @@ void Courtroom::on_iniswap_dropdown_changed(int p_index) ui_iniswap_remove->hide(); } +void Courtroom::on_iniswap_context_menu_requested(const QPoint &pos) +{ + QMenu *menu = ui_iniswap_dropdown->lineEdit()->createStandardContextMenu(); + + menu->addSeparator(); + if (file_exists(ao_app->get_character_path(current_char, "char.ini"))) + menu->addAction(QString("Edit " + current_char + "/char.ini"), this, SLOT(on_iniswap_edit_requested())); + if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) != char_list.at(m_cid).name) + menu->addAction(QString("Remove " + current_char), this, SLOT(on_iniswap_remove_clicked())); + menu->popup(ui_iniswap_dropdown->mapToGlobal(pos)); +} +void Courtroom::on_iniswap_edit_requested() +{ + QString p_path = ao_app->get_character_path(current_char, "char.ini"); + if (!file_exists(p_path)) + return; + QDesktopServices::openUrl(QUrl(p_path)); +} + void Courtroom::on_iniswap_remove_clicked() { if (ui_iniswap_dropdown->count() <= 0) @@ -3476,6 +3503,37 @@ void Courtroom::on_sfx_dropdown_changed(int p_index) ui_sfx_remove->hide(); } +void Courtroom::on_sfx_context_menu_requested(const QPoint &pos) +{ + QMenu *menu = ui_sfx_dropdown->lineEdit()->createStandardContextMenu(); + + menu->addSeparator(); + if (file_exists(ao_app->get_character_path(current_char, "soundlist.ini"))) + menu->addAction(QString("Edit " + current_char + "/soundlist.ini"), this, SLOT(on_sfx_edit_requested())); + else + menu->addAction(QString("Edit theme's character_soundlist.ini"), this, SLOT(on_sfx_edit_requested())); + if (ui_sfx_dropdown->currentIndex() != 0) + menu->addAction(QString("Remove " + ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex())), this, SLOT(on_sfx_remove_clicked())); + menu->popup(ui_sfx_dropdown->mapToGlobal(pos)); +} +void Courtroom::on_sfx_edit_requested() +{ + QString p_path = ao_app->get_character_path(current_char, "soundlist.ini"); + if (!file_exists(p_path)) + { + p_path = ao_app->get_theme_path("character_soundlist.ini"); + if (!file_exists(p_path)) + { + p_path = ao_app->get_default_theme_path("character_soundlist.ini"); + if (!file_exists(p_path)) + { + return; + } + } + } + QDesktopServices::openUrl(QUrl(p_path)); +} + void Courtroom::on_sfx_remove_clicked() { if (ui_sfx_dropdown->count() <= 0) @@ -3539,6 +3597,38 @@ void Courtroom::set_effects_dropdown() ui_effects_dropdown->blockSignals(false); } +void Courtroom::on_effects_context_menu_requested(const QPoint &pos) +{ + QMenu *menu = new QMenu(); + + if (!ao_app->read_char_ini(current_char, "effects", "Options").isEmpty()) + menu->addAction(QString("Open misc/" + ao_app->read_char_ini(current_char, "effects", "Options") + " folder"), this, SLOT(on_character_effects_edit_requested())); + menu->addAction(QString("Open theme's effects folder"), this, SLOT(on_effects_edit_requested())); + menu->popup(ui_effects_dropdown->mapToGlobal(pos)); +} +void Courtroom::on_effects_edit_requested() +{ + QString p_path = ao_app->get_theme_path("effects/"); + if (!dir_exists(p_path)) + { + p_path = ao_app->get_default_theme_path("effects/"); + if (!dir_exists(p_path)) + { + return; + } + } + QDesktopServices::openUrl(QUrl(p_path)); +} +void Courtroom::on_character_effects_edit_requested() +{ + QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); + QString p_path = ao_app->get_base_path() + "misc/" + p_effect + "/"; + if (!dir_exists(p_path)) + return; + + QDesktopServices::openUrl(QUrl(p_path)); +} + void Courtroom::on_effects_dropdown_changed(int p_index) { effect = ui_effects_dropdown->itemText(p_index); @@ -3679,6 +3769,24 @@ void Courtroom::on_music_list_double_clicked(QTreeWidgetItem *p_item, int column } } +void Courtroom::on_music_list_context_menu_requested(const QPoint &pos) +{ + QMenu *menu = new QMenu(); + + menu->addAction(QString("Expand All Categories"), this, SLOT(music_list_expand_all())); + menu->addAction(QString("Collapse All Categories"), this, SLOT(music_list_collapse_all())); + // menu->addSeparator(); + menu->popup(ui_music_list->mapToGlobal(pos)); +} +void Courtroom::music_list_expand_all() +{ + ui_music_list->expandAll(); +} +void Courtroom::music_list_collapse_all() +{ + ui_music_list->collapseAll(); +} + void Courtroom::on_area_list_double_clicked(QModelIndex p_model) { QString p_area = area_list.at(area_row_to_number.at(p_model.row())); -- cgit From 6f5b3d24621bc938c246daffd7ab47afa095c4c2 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 3 Oct 2019 01:00:15 +0300 Subject: Add support for backgrounds outside of predefined positions, grabbing the overlay from X_overlay.png/.gif/.webp/etc. --- src/courtroom.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index cc5965cc..794242f3 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2715,6 +2715,12 @@ void Courtroom::set_scene(QString f_desk_mod, QString f_side) f_desk_image = "estrado"; } + if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path(f_side)))) //Unique pos path + { + f_background = f_side; + f_desk_image = f_side + "_overlay"; + } + 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); -- cgit From 829604e8089736945e8121cd134c3c3fcbf28291 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 3 Oct 2019 15:44:18 +0300 Subject: Positional evidence implemented. Click a button to change between private/global evidence list. There's also a button to transfer evidence to global/private, context sensitive. TODO: Save/load private evidence list --- include/courtroom.h | 10 +++ src/evidence.cpp | 205 +++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 172 insertions(+), 43 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 86a4ea79..9f3b659b 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -411,6 +411,11 @@ private: int max_emotes_on_page = 10; QVector local_evidence_list; + QVector private_evidence_list; + QVector global_evidence_list; + + //false = use private_evidence_list + bool current_evidence_global = true; int current_evidence_page = 0; int current_evidence = 0; @@ -563,6 +568,8 @@ private: AOButton *ui_evidence_image_button; AOButton *ui_evidence_x; AOButton *ui_evidence_ok; + AOButton *ui_evidence_switch; + AOButton *ui_evidence_transfer; AOTextEdit *ui_evidence_description; AOImage *ui_char_select_background; @@ -733,10 +740,13 @@ private slots: void on_evidence_delete_clicked(); void on_evidence_x_clicked(); void on_evidence_ok_clicked(); + void on_evidence_switch_clicked(); + void on_evidence_transfer_clicked(); void on_evidence_edited(); void evidence_close(); + void evidence_switch(bool global); bool compare_evidence_changed(evi_type evi_a, evi_type evi_b); void on_back_to_lobby_clicked(); diff --git a/src/evidence.cpp b/src/evidence.cpp index 58f31811..82e496dd 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -16,6 +16,9 @@ void Courtroom::initialize_evidence() ui_evidence_present = new AOButton(ui_evidence, ao_app); ui_evidence_present->setToolTip(tr("Present this piece of evidence to everyone on your next spoken message")); + ui_evidence_switch = new AOButton(ui_evidence, ao_app); + ui_evidence_transfer = new AOButton(ui_evidence, ao_app); + ui_evidence_overlay = new AOImage(ui_evidence, ao_app); ui_evidence_delete = new AOButton(ui_evidence_overlay, ao_app); @@ -40,6 +43,9 @@ void Courtroom::initialize_evidence() 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_switch, SIGNAL(clicked()), this, SLOT(on_evidence_switch_clicked())); + connect(ui_evidence_transfer, SIGNAL(clicked()), this, SLOT(on_evidence_transfer_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_name, SIGNAL(double_clicked()), this, SLOT(on_evidence_image_name_double_clicked())); @@ -65,11 +71,14 @@ void Courtroom::refresh_evidence() ui_evidence_list.clear(); set_size_and_pos(ui_evidence_button, "evidence_button"); - ui_evidence_button->set_image("evidencebutton"); + ui_evidence_button->set_image("evidence_button"); ui_evidence_button->setToolTip(tr("Bring up the Evidence screen.")); set_size_and_pos(ui_evidence, "evidence_background"); - ui_evidence->set_image("evidencebackground"); + if (current_evidence_global) + ui_evidence->set_image("evidence_background"); + else + ui_evidence->set_image("evidence_background_private"); set_size_and_pos(ui_evidence_name, "evidence_name"); @@ -85,20 +94,47 @@ void Courtroom::refresh_evidence() ui_evidence_present->set_image("present"); set_size_and_pos(ui_evidence_overlay, "evidence_overlay"); - ui_evidence_overlay->set_image("evidenceoverlay"); + if (current_evidence_global) + ui_evidence_overlay->set_image("evidence_overlay"); + else + ui_evidence_overlay->set_image("evidence_overlay_private"); set_size_and_pos(ui_evidence_delete, "evidence_delete"); - ui_evidence_delete->set_image("deleteevidence"); + ui_evidence_delete->set_image("evidence_delete"); 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"); + ui_evidence_x->set_image("evidence_x"); set_size_and_pos(ui_evidence_ok, "evidence_ok"); - ui_evidence_ok->set_image("evidenceok"); + ui_evidence_ok->set_image("evidence_ok"); + + set_size_and_pos(ui_evidence_switch, "evidence_switch"); + if (current_evidence_global) + { + ui_evidence_switch->set_image("evidence_global"); + ui_evidence_switch->setToolTip(tr("Switch evidence to private inventory.")); + } + else + { + ui_evidence_switch->set_image("evidence_private"); + ui_evidence_switch->setToolTip(tr("Switch evidence to global inventory.")); + } + + set_size_and_pos(ui_evidence_transfer, "evidence_transfer"); + if (current_evidence_global) + { + ui_evidence_transfer->set_image("evidence_transfer"); + ui_evidence_transfer->setToolTip(tr("Transfer evidence to private inventory.")); + } + else + { + ui_evidence_transfer->set_image("evidence_transfer_private"); + ui_evidence_transfer->setToolTip(tr("Transfer evidence to global inventory.")); + } set_size_and_pos(ui_evidence_description, "evidence_description"); @@ -145,6 +181,10 @@ void Courtroom::refresh_evidence() void Courtroom::set_evidence_list(QVector &p_evi_list) { + global_evidence_list = p_evi_list; + if (!current_evidence_global) + return; //We're on private evidence editing, wait for user to do their thing + QVector old_list = local_evidence_list; local_evidence_list.clear(); local_evidence_list = p_evi_list; @@ -171,7 +211,7 @@ void Courtroom::set_evidence_list(QVector &p_evi_list) msgBox->setInformativeText("Do you wish to keep your changes?"); msgBox->setDetailedText("Name: " + local_evidence_list.at(current_evidence).name + "\nImage: " + local_evidence_list.at(current_evidence).image + "\nDescription:\n" + local_evidence_list.at(current_evidence).description); msgBox->setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msgBox->setDefaultButton(QMessageBox::No); + msgBox->setDefaultButton(QMessageBox::LastButton); //msgBox->setWindowModality(Qt::NonModal); int ret = msgBox->exec(); switch (ret) { @@ -259,18 +299,6 @@ void Courtroom::on_evidence_name_edited() ui_evidence_name->setReadOnly(true); if (current_evidence >= local_evidence_list.size()) return; - -// Prefer pressing [X] to update the evidence. -// QStringList f_contents; - -// evi_type f_evi = local_evidence_list.at(current_evidence); - -// f_contents.append(QString::number(current_evidence)); -// f_contents.append(ui_evidence_name->text()); -// f_contents.append(f_evi.description); -// f_contents.append(f_evi.image); - -// ao_app->send_server_packet(new AOPacket("EE", f_contents)); } void Courtroom::on_evidence_name_double_clicked() @@ -295,17 +323,6 @@ void Courtroom::on_evidence_image_name_edited() ui_evidence_image_name->setReadOnly(true); if (current_evidence >= local_evidence_list.size()) return; - -// QStringList f_contents; - -// evi_type f_evi = local_evidence_list.at(current_evidence); - -// f_contents.append(QString::number(current_evidence)); -// f_contents.append(f_evi.name); -// f_contents.append(f_evi.description); -// f_contents.append(ui_evidence_image_name->text()); - -// ao_app->send_server_packet(new AOPacket("EE", f_contents)); } void Courtroom::on_evidence_image_button_clicked() @@ -339,7 +356,19 @@ void Courtroom::on_evidence_clicked(int p_id) if (f_real_id == local_evidence_list.size()) { - ao_app->send_server_packet(new AOPacket("PE###empty.png#%")); + if (current_evidence_global) + ao_app->send_server_packet(new AOPacket("PE###empty.png#%")); + else + { + evi_type f_evi; + f_evi.name = ""; + f_evi.description = ""; + f_evi.image = "empty.png"; + + local_evidence_list.append(f_evi); + private_evidence_list = local_evidence_list; + set_evidence_page(); + } return; } else if (f_real_id > local_evidence_list.size()) @@ -425,6 +454,12 @@ void Courtroom::on_evidence_right_clicked() void Courtroom::on_evidence_present_clicked() { + if (!current_evidence_global) + { + ui_evidence_present->hide(); + is_presenting_evidence = false; + return; //otherwise we get force-disconnected + } if (is_presenting_evidence) ui_evidence_present->set_image("present"); else @@ -438,7 +473,14 @@ void Courtroom::on_evidence_present_clicked() void Courtroom::on_evidence_delete_clicked() { evidence_close(); - ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%")); + if (current_evidence_global) + ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%")); + else + { + local_evidence_list.remove(current_evidence); + private_evidence_list = local_evidence_list; + set_evidence_page(); + } current_evidence = 0; @@ -490,22 +532,80 @@ void Courtroom::on_evidence_ok_clicked() if (current_evidence < local_evidence_list.size()) { evi_type f_evi = local_evidence_list.at(current_evidence); + if (current_evidence_global) + { + QStringList f_contents; + f_contents.append(QString::number(current_evidence)); + f_contents.append(ui_evidence_name->text()); + f_contents.append(ui_evidence_description->toPlainText()); + f_contents.append(ui_evidence_image_name->text()); - QStringList f_contents; - f_contents.append(QString::number(current_evidence)); - f_contents.append(ui_evidence_name->text()); - f_contents.append(ui_evidence_description->toPlainText()); - f_contents.append(ui_evidence_image_name->text()); + ao_app->send_server_packet(new AOPacket("EE", f_contents)); + } + else + { + f_evi.name = ui_evidence_name->text(); + f_evi.description = ui_evidence_description->toPlainText(); + f_evi.image = ui_evidence_image_name->text(); + local_evidence_list.replace(current_evidence, f_evi); + private_evidence_list = local_evidence_list; + ui_evidence_ok->hide(); + set_evidence_page(); + } + } +} + +void Courtroom::on_evidence_switch_clicked() +{ + evidence_close(); + evidence_switch(!current_evidence_global); + if (current_evidence_global) + { + ui_evidence_switch->set_image("evidence_global"); + ui_evidence->set_image("evidence_background"); + ui_evidence_overlay->set_image("evidence_overlay"); + ui_evidence_transfer->set_image("evidence_transfer"); + ui_evidence_transfer->setToolTip(tr("Transfer evidence to private inventory.")); + ui_evidence_switch->setToolTip(tr("Current evidence is global. Click to switch to private.")); + } + else + { + ui_evidence_switch->set_image("evidence_private"); + ui_evidence->set_image("evidence_background_private"); + ui_evidence_overlay->set_image("evidence_overlay_private"); + ui_evidence_transfer->set_image("evidence_transfer_private"); + ui_evidence_transfer->setToolTip(tr("Transfer evidence to global inventory.")); + ui_evidence_switch->setToolTip(tr("Current evidence is private. Click to switch to global.")); + } +} - ao_app->send_server_packet(new AOPacket("EE", f_contents)); +void Courtroom::on_evidence_transfer_clicked() +{ + if (current_evidence >= local_evidence_list.size()) + return; + + if (!current_evidence_global) //Transfer private evidence to global + { + evi_type f_evi = local_evidence_list.at(current_evidence); -// QMessageBox *msgBox = new QMessageBox; + QStringList f_contents; + f_contents.append(f_evi.name); + f_contents.append(f_evi.description); + f_contents.append(f_evi.image); -// msgBox->setText("You succesfully saved your changes."); -// msgBox->setStandardButtons(QMessageBox::Ok); -// msgBox->setDefaultButton(QMessageBox::Ok); -// msgBox->exec(); + ao_app->send_server_packet(new AOPacket("PE", f_contents)); + } + else //Transfer global evidence to private + { + evi_type f_evi = local_evidence_list.at(current_evidence); + private_evidence_list.append(f_evi); } + + QMessageBox *msgBox = new QMessageBox; + msgBox->setText("Evidence has been transferred."); + msgBox->setStandardButtons(QMessageBox::Ok); + msgBox->setDefaultButton(QMessageBox::Ok); + msgBox->exec(); } void Courtroom::on_evidence_edited() @@ -534,6 +634,25 @@ void Courtroom::evidence_close() ui_ic_chat_message->setFocus(); } +void Courtroom::evidence_switch(bool global) +{ + current_evidence_global = global; + is_presenting_evidence = false; + ui_evidence_present->set_image("present"); + local_evidence_list.clear(); + if (current_evidence_global) + { + local_evidence_list = global_evidence_list; + ui_evidence_present->show(); + } + else + { + local_evidence_list = private_evidence_list; + ui_evidence_present->hide(); + } + set_evidence_page(); +} + bool Courtroom::compare_evidence_changed(evi_type evi_a, evi_type evi_b) { return evi_a.name != evi_b.name || evi_a.image != evi_b.image || evi_a.description != evi_b.description; -- cgit From bdef10ace5e99ebd0ae09d0821cc2557b07defdd Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 3 Oct 2019 17:01:41 +0300 Subject: Remove /rainbow as clientside slash commands are cursed. I shall purge all clientside slash command memery soon... Fix /save_case iterating from last to first instead of first to last Implement private evidence saving/loading to and from an .ini file --- include/courtroom.h | 4 +++ src/courtroom.cpp | 10 +------ src/evidence.cpp | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 88 insertions(+), 10 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 9f3b659b..f72e106a 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -570,6 +570,8 @@ private: AOButton *ui_evidence_ok; AOButton *ui_evidence_switch; AOButton *ui_evidence_transfer; + AOButton *ui_evidence_save; + AOButton *ui_evidence_load; AOTextEdit *ui_evidence_description; AOImage *ui_char_select_background; @@ -747,6 +749,8 @@ private slots: void evidence_close(); void evidence_switch(bool global); + void on_evidence_save_clicked(); + void on_evidence_load_clicked(); bool compare_evidence_changed(evi_type evi_a, evi_type evi_b); void on_back_to_lobby_clicked(); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 794242f3..e715c795 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2993,14 +2993,6 @@ void Courtroom::on_ooc_return_pressed() toggle_judge_buttons(false); } } - 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(); @@ -3221,7 +3213,7 @@ void Courtroom::on_ooc_return_pressed() casefile.setValue("doc", ""); casefile.setValue("status",command[2]); casefile.sync(); - for(int i = local_evidence_list.size() - 1; i >= 0; i--) + for(int i = 0; i < local_evidence_list.size(); i++) { QString clean_evidence_dsc = local_evidence_list[i].description.replace(QRegularExpression("..."), ""); clean_evidence_dsc = clean_evidence_dsc.replace(clean_evidence_dsc.lastIndexOf(">"), 1, ""); diff --git a/src/evidence.cpp b/src/evidence.cpp index 82e496dd..77044c90 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -19,6 +19,11 @@ void Courtroom::initialize_evidence() ui_evidence_switch = new AOButton(ui_evidence, ao_app); ui_evidence_transfer = new AOButton(ui_evidence, ao_app); + ui_evidence_save = new AOButton(ui_evidence, ao_app); + ui_evidence_save->setToolTip(tr("Save evidence to an .ini file.")); + ui_evidence_load = new AOButton(ui_evidence, ao_app); + ui_evidence_save->setToolTip(tr("Load evidence from an .ini file.")); + ui_evidence_overlay = new AOImage(ui_evidence, ao_app); ui_evidence_delete = new AOButton(ui_evidence_overlay, ao_app); @@ -45,6 +50,8 @@ void Courtroom::initialize_evidence() connect(ui_evidence_present, SIGNAL(clicked()), this, SLOT(on_evidence_present_clicked())); connect(ui_evidence_switch, SIGNAL(clicked()), this, SLOT(on_evidence_switch_clicked())); connect(ui_evidence_transfer, SIGNAL(clicked()), this, SLOT(on_evidence_transfer_clicked())); + connect(ui_evidence_save, SIGNAL(clicked()), this, SLOT(on_evidence_save_clicked())); + connect(ui_evidence_load, SIGNAL(clicked()), this, SLOT(on_evidence_load_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())); @@ -136,6 +143,20 @@ void Courtroom::refresh_evidence() ui_evidence_transfer->setToolTip(tr("Transfer evidence to global inventory.")); } + set_size_and_pos(ui_evidence_save, "evidence_save"); + ui_evidence_save->set_image("evidence_save"); + if (current_evidence_global) + ui_evidence_save->hide(); + else + ui_evidence_save->show(); + + set_size_and_pos(ui_evidence_load, "evidence_load"); + ui_evidence_load->set_image("evidence_load"); + if (current_evidence_global) + ui_evidence_load->hide(); + else + ui_evidence_load->show(); + set_size_and_pos(ui_evidence_description, "evidence_description"); QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", "courtroom_design.ini"); @@ -584,6 +605,7 @@ void Courtroom::on_evidence_transfer_clicked() if (current_evidence >= local_evidence_list.size()) return; + QString name; if (!current_evidence_global) //Transfer private evidence to global { evi_type f_evi = local_evidence_list.at(current_evidence); @@ -593,16 +615,18 @@ void Courtroom::on_evidence_transfer_clicked() f_contents.append(f_evi.description); f_contents.append(f_evi.image); + name = f_evi.name; ao_app->send_server_packet(new AOPacket("PE", f_contents)); } else //Transfer global evidence to private { evi_type f_evi = local_evidence_list.at(current_evidence); + name = f_evi.name; private_evidence_list.append(f_evi); } QMessageBox *msgBox = new QMessageBox; - msgBox->setText("Evidence has been transferred."); + msgBox->setText("\"" + name + "\" has been transferred."); msgBox->setStandardButtons(QMessageBox::Ok); msgBox->setDefaultButton(QMessageBox::Ok); msgBox->exec(); @@ -644,12 +668,70 @@ void Courtroom::evidence_switch(bool global) { local_evidence_list = global_evidence_list; ui_evidence_present->show(); + ui_evidence_save->hide(); + ui_evidence_load->hide(); } else { local_evidence_list = private_evidence_list; ui_evidence_present->hide(); + ui_evidence_save->show(); + ui_evidence_load->show(); + } + set_evidence_page(); +} + +void Courtroom::on_evidence_save_clicked() +{ + if (current_evidence_global) + return; //Don't allow saving/loading operations when in global inventory mode for now + + QString p_path = QFileDialog::getSaveFileName(this, tr("Save Inventory"), "base/inventories/", tr("Ini Files (*.ini)")); + if (p_path.isEmpty()) + return; + + evidence_close(); + ui_evidence_name->setText(""); + + QSettings inventory(p_path, QSettings::IniFormat); + inventory.clear(); + for(int i = 0; i < local_evidence_list.size(); i++) + { + inventory.beginGroup(QString::number(i)); + inventory.setValue("name",local_evidence_list[i].name); + inventory.setValue("description",local_evidence_list[i].description); + inventory.setValue("image",local_evidence_list[i].image); + inventory.endGroup(); + } + inventory.sync(); +} + +void Courtroom::on_evidence_load_clicked() +{ + if (current_evidence_global) + return; //Don't allow saving/loading operations when in global inventory mode for now + + QString p_path = QFileDialog::getOpenFileName(this, tr("Open Inventory"), "base/inventories/", tr("Ini Files (*.ini)")); + if (p_path.isEmpty()) + return; + + evidence_close(); + ui_evidence_name->setText(""); + + QSettings inventory(p_path, QSettings::IniFormat); + local_evidence_list.clear(); + foreach (QString evi, inventory.childGroups()) + { + if (evi == "General") + continue; + + evi_type f_evi; + f_evi.name = inventory.value(evi + "/name", "UNKNOWN").value(); + f_evi.description = inventory.value(evi + "/description", "UNKNOWN").value(); + f_evi.image = inventory.value(evi + "/image", "UNKNOWN.png").value(); + local_evidence_list.append(f_evi); } + private_evidence_list = local_evidence_list; set_evidence_page(); } -- cgit From cfc3312840ed9053dd1a8a292f3d0c1f818dc3a7 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 3 Oct 2019 17:13:23 +0300 Subject: Inject wholesome --- src/lobby.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lobby.cpp b/src/lobby.cpp index 79f18e52..4ca4f491 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -339,10 +339,18 @@ void Lobby::on_about_clicked() "https://github.com/AttorneyOnline/AO2-Client" "

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

2.8 Major Release development:
" + "Crystalwarrior, Iamgoofball" + "

2.8 Quality Assurance:
" + "WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry," + "CedricDewitt, Chewable Tablets, Fantos, Futugaze," + "Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy," + "GreenBowers, Robotic Overlord, Veritas, Gin-Gi" "

Special thanks:
" "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), " "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " - "Noevain, Cronnicossy") + "Noevain, Cronnicossy, the AO2 community, server hosts, game masters," + "case makers, content creators and players!") .arg(ao_app->get_version_string()); QMessageBox::about(this, "About", msg); } -- cgit From 9451822e0929643f638b3c79d4fd646df98b567a Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 3 Oct 2019 23:17:21 +0300 Subject: Fix move func making characters slowly move to the left every frame on animated chars which are sized differently from viewport Add a new get_qfont function Fix message box font being different from every other font due to incorrect font loading scheme Fix ui_evidence_save and ui_evidence_load tooltips being wrong --- include/courtroom.h | 3 +++ src/aocharmovie.cpp | 2 +- src/courtroom.cpp | 30 ++++++++++++++++++------------ src/evidence.cpp | 2 +- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index f72e106a..e8004154 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -127,6 +127,9 @@ public: //sets font size based on theme ini files void set_font(QWidget *widget, QString class_name, QString p_identifier); + //Get the properly constructed font + QFont get_qfont(QString font_name, int f_pointsize); + //actual operation of setting the font on a widget void set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color = Qt::black, bool bold = false); diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 6f6c3a17..f8dc8d2b 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -240,7 +240,7 @@ QPixmap AOCharMovie::get_pixmap(QImage image) f_pixmap = f_pixmap.scaledToHeight(f_h, transform_mode); this->resize(f_pixmap.size()); - this->move(x + (f_w - f_pixmap.width())/2, y + (f_h - f_pixmap.height())); //Always center horizontally, always put at the bottom vertically + QLabel::move(x + (f_w - f_pixmap.width())/2, y + (f_h - f_pixmap.height())); //Always center horizontally, always put at the bottom vertically return f_pixmap; } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index e715c795..ee744a87 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -606,6 +606,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_vp_showname, "showname"); set_size_and_pos(ui_vp_message, "message"); + ui_vp_message->hide(); + //We detached the text as parent from the chatbox so it doesn't get affected by the screenshake. ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y()); ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); @@ -848,37 +850,40 @@ void Courtroom::set_fonts() void Courtroom::set_font(QWidget *widget, QString class_name, QString p_identifier) { QString design_file = "courtroom_fonts.ini"; - int f_weight = ao_app->get_font_size(p_identifier, design_file); + int f_pointsize = ao_app->get_font_size(p_identifier, design_file); QString font_name = ao_app->get_font_name(p_identifier + "_font", design_file); QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? + this->set_qfont(widget, class_name, get_qfont(font_name, f_pointsize), f_color, bold); +} + +QFont Courtroom::get_qfont(QString font_name, int f_pointsize) +{ QFont font; if (font_name.isEmpty()) { - font = QFont("Arial", f_weight); + font = QFont("Arial", f_pointsize); font.setStyleHint(QFont::SansSerif, QFont::NoAntialias); } else - font = QFont(font_name, f_weight); - this->set_qfont(widget, class_name, font, f_color, bold); + font = QFont(font_name, f_pointsize); + return font; } void Courtroom::set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color, bool bold) { if(class_name.isEmpty()) class_name = widget->metaObject()->className(); - widget->setFont(font); - QString is_bold = ""; - if(bold) is_bold = "font: bold;"; + font.setBold(bold); + widget->setFont(font); 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);\n" + is_bold + "}"; + QString::number(f_color.blue()) + ", 255);}"; widget->setStyleSheet(style_sheet_string); } @@ -1745,8 +1750,9 @@ void Courtroom::handle_chatmessage_2() ui_vp_message->hide(); ui_vp_chatbox->hide(); + //todo: put this in its own function or update QString design_file = "courtroom_fonts.ini"; - int f_weight = ao_app->get_font_size("message", design_file); + int f_pointsize = ao_app->get_font_size("message", design_file); QString font_name = ao_app->get_font_name("message_font", design_file); QColor f_color = ao_app->get_color("message_color", design_file); bool bold = ao_app->get_font_size("message_bold", design_file) == 1; // is the font bold or not? @@ -1757,8 +1763,8 @@ void Courtroom::handle_chatmessage_2() int chatsize = ao_app->get_chat_size(m_chatmessage[CHAR_NAME]); if (chatsize != -1) - f_weight = chatsize; - this->set_qfont(ui_vp_message, "", QFont(font_name, f_weight), f_color, bold); + f_pointsize = chatsize; + this->set_qfont(ui_vp_message, "", get_qfont(font_name, f_pointsize), f_color, bold); set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); diff --git a/src/evidence.cpp b/src/evidence.cpp index 77044c90..0cee435a 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -22,7 +22,7 @@ void Courtroom::initialize_evidence() ui_evidence_save = new AOButton(ui_evidence, ao_app); ui_evidence_save->setToolTip(tr("Save evidence to an .ini file.")); ui_evidence_load = new AOButton(ui_evidence, ao_app); - ui_evidence_save->setToolTip(tr("Load evidence from an .ini file.")); + ui_evidence_load->setToolTip(tr("Load evidence from an .ini file.")); ui_evidence_overlay = new AOImage(ui_evidence, ao_app); -- cgit From 65332f209c9344e1d3f643ebca32a23dd6f31bdf Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 4 Oct 2019 14:41:33 +0300 Subject: fucking hell it's not accurate and doesn't match the absolute quality when it's played back in audacity jesus christ will the torture ever end --- include/aomusicplayer.h | 5 ++-- src/aomusicplayer.cpp | 80 +++++++++++++++++++++++++++++-------------------- 2 files changed, 50 insertions(+), 35 deletions(-) diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 15014afc..1a91d8f4 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -25,8 +25,8 @@ public: const int m_channelmax = 4; //These have to be public for the stupid sync thing -// QWORD loop_start = 0; -// QWORD loop_end = 0; + QWORD loop_start = 0; + QWORD loop_end = 0; public slots: void play(QString p_song, int channel=0, bool crossfade=false); @@ -44,6 +44,7 @@ private: // Channel 2 = extra // Channel 3 = extra HSTREAM m_stream_list[4]; + HSYNC loop_sync[4]; }; #elif defined(QTAUDIO) class AOMusicPlayer diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index b44e2e27..8fe6d15d 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -21,24 +21,6 @@ void AOMusicPlayer::play(QString p_song, int channel, bool crossfade) if (channel < 0) //wtf? return; QString f_path = ao_app->get_music_path(p_song); -// QString d_path = f_path + ".txt"; - -// if (file_exists(d_path)) //Contains loop/etc. information file -// { -// QStringList lines = ao_app->read_file(d_path).split("\n"); -// foreach (QString line, lines) -// { -// QStringList args = line.split("="); -// if (args.size() < 2) -// continue; -// QString arg = args[0].trimmed(); -// if (arg == "loop_start") -// loop_start = args[1].trimmed().toUInt(); -// else if (arg == "loop_end") -// loop_end = args[1].trimmed().toUInt(); -// } -// qDebug() << "Found data file for song" << p_song << loop_start << loop_end; -// } unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE; if (m_looping) @@ -48,6 +30,34 @@ void AOMusicPlayer::play(QString p_song, int channel, bool crossfade) if (ao_app->get_audio_output_device() != "default") BASS_ChannelSetDevice(m_stream_list[channel], BASS_GetDevice()); + QString d_path = f_path + ".txt"; + + loop_start = 0; + loop_end = 0; + if (m_looping && file_exists(d_path)) //Contains loop/etc. information file + { + QStringList lines = ao_app->read_file(d_path).split("\n"); + foreach (QString line, lines) + { + QStringList args = line.split("="); + if (args.size() < 2) + continue; + QString arg = args[0].trimmed(); + + float sample_rate; + BASS_ChannelGetAttribute(newstream, BASS_ATTRIB_FREQ, &sample_rate); + qDebug() << sample_rate << args[1].trimmed(); + + if (arg == "loop_start") + loop_start = BASS_ChannelSeconds2Bytes(newstream, args[1].trimmed().toDouble() / static_cast(sample_rate)); + else if (arg == "loop_length") + loop_end = loop_start + BASS_ChannelSeconds2Bytes(newstream, args[1].trimmed().toDouble() / static_cast(sample_rate)); + else if (arg == "loop_end") + loop_end = BASS_ChannelSeconds2Bytes(newstream, args[1].trimmed().toDouble() / static_cast(sample_rate)); + } + qDebug() << "Found data file for song" << p_song << "length" << BASS_ChannelGetLength(newstream, BASS_POS_BYTE) << "loop start" << loop_start << "loop end" << loop_end; + } + if (crossfade) { DWORD oldstream = m_stream_list[channel]; @@ -103,28 +113,32 @@ void AOMusicPlayer::set_volume(int p_value, int channel) } } -//void CALLBACK loopProc(HSYNC handle, DWORD channel, DWORD data, void *user) -//{ -// AOMusicPlayer *self= static_cast(user); -// qDebug() << BASS_ChannelGetPosition(channel, BASS_POS_BYTE); -// BASS_ChannelSetPosition(channel, self->loop_start, BASS_POS_BYTE); -//} +void CALLBACK loopProc(HSYNC handle, DWORD channel, DWORD data, void *user) +{ + AOMusicPlayer *self= static_cast(user); + qDebug() << BASS_ChannelGetPosition(channel, BASS_POS_BYTE); + BASS_ChannelSetPosition(channel, self->loop_start, BASS_POS_BYTE); +} void AOMusicPlayer::set_looping(bool toggle, int channel) { m_looping = toggle; - if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) + qDebug() << "looping" << m_looping; + if (m_looping == false && BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) { - if (m_looping == false) - BASS_ChannelFlags(m_stream_list[channel], 0, BASS_SAMPLE_LOOP); // remove the LOOP flag -// BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync); + BASS_ChannelFlags(m_stream_list[channel], 0, BASS_SAMPLE_LOOP); // remove the LOOP flag + BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]); } - else + else if (m_looping == true) { - if (m_looping == true) - BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag -// if (loop_end > 0 && loop_end < BASS_ChannelGetLength(m_stream_list[channel], BASS_POS_BYTE)) -// loop_sync = BASS_ChannelSetSync(m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end, loopProc, this); + BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag + BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]); + qDebug() << loop_end; + if (loop_end > 0) + { + loop_sync[channel] = BASS_ChannelSetSync(m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end, loopProc, this); + qDebug() << "Started loop sync"; + } } } #elif defined(QTAUDIO) -- cgit From bc8158cc96dd36a18ba18b0271331463cd81c497 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 5 Oct 2019 16:47:59 +0300 Subject: Meme fix to <>, ~~ and ~> parsing (does not fully solve the issue but at least hides it from the user) Allow ascii characters to be used for color dropdown symbols --- src/courtroom.cpp | 15 ++++++++++++--- src/text_file_functions.cpp | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ee744a87..e368a32a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2023,19 +2023,28 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int if (p_text.trimmed().startsWith("~~")) { p_text.remove(p_text.indexOf("~~"), 2); - target_pos -= 2; + if (target_pos != -1) + { + target_pos = qMax(0, target_pos - 2); + } align = "center"; } else if (p_text.trimmed().startsWith("~>")) { p_text.remove(p_text.indexOf("~>"), 2); - target_pos -= 2; + if (target_pos != -1) + { + target_pos = qMax(0, target_pos - 2); + } align = "right"; } else if (p_text.trimmed().startsWith("<>")) { p_text.remove(p_text.indexOf("<>"), 2); - target_pos -= 2; + if (target_pos != -1) + { + target_pos = qMax(0, target_pos - 2); + } align = "justify"; } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 35e42b4f..204de69f 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -441,7 +441,7 @@ QString AOApplication::get_chat_markdown(QString p_identifier, QString p_chat) if (f_result == "") f_result = read_design_ini(p_identifier, default_path); - return f_result; + return f_result.toLatin1(); } QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) -- cgit From 9f543f9ef7109340142134124e8bda6c9f750a18 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 5 Oct 2019 20:32:19 +0300 Subject: I HAVE CONQUERED BASS HELL BEHOLD, LOOP_START AND LOOP_END MUSIC POINTS! It reads the songname.mp3.txt file, looking for loop_start, loop_length and loop_end in samples MUSIC EFFECTS SYSTEM THAT CAN ***COMMUNICATE WITH THE SERVER***, WOAHHHHHHHHH! RIGHT-CLICK CONTEXT MENUS TO ENABLE/DISABLE SPECIFIC MUSIC EFFECTS MUSIC EFFECTS ENUMS Fix an issue with music looping --- include/aomusicplayer.h | 2 +- include/courtroom.h | 6 ++++ include/datatypes.h | 7 ++++ src/aomusicplayer.cpp | 93 +++++++++++++++++++++++++++++-------------------- src/courtroom.cpp | 78 +++++++++++++++++++++++++++++++---------- 5 files changed, 130 insertions(+), 56 deletions(-) diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 1a91d8f4..52c97c3e 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -29,7 +29,7 @@ public: QWORD loop_end = 0; public slots: - void play(QString p_song, int channel=0, bool crossfade=false); + void play(QString p_song, int channel=0, bool loop=false, int effect_flags=0); void stop(int channel=0); private: diff --git a/include/courtroom.h b/include/courtroom.h index e8004154..4b6ccc36 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -396,6 +396,9 @@ private: QString effect = ""; + //Music effect flags we want to send to server when we play music + int music_flags = 0; + int defense_bar_state = 0; int prosecution_bar_state = 0; @@ -643,6 +646,9 @@ private slots: void on_music_search_edited(QString p_text); void on_music_list_double_clicked(QTreeWidgetItem *p_item, int column); void on_music_list_context_menu_requested(const QPoint &pos); + void music_fade_out(bool toggle); + void music_fade_in(bool toggle); + void music_synchronize(bool toggle); void music_list_expand_all(); void music_list_collapse_all(); void on_area_list_double_clicked(QModelIndex p_model); diff --git a/include/datatypes.h b/include/datatypes.h index 835cf8f4..921f6135 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -110,4 +110,11 @@ enum CHAT_MESSAGE EFFECTS }; +enum MUSIC_EFFECT +{ + FADE_IN = 1, + FADE_OUT = 2, + SYNC_POS = 4 +}; + #endif // DATATYPES_H diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 8fe6d15d..49cf089c 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -15,7 +15,7 @@ AOMusicPlayer::~AOMusicPlayer() } } -void AOMusicPlayer::play(QString p_song, int channel, bool crossfade) +void AOMusicPlayer::play(QString p_song, int channel, bool loop, int effect_flags) { channel = channel % m_channelmax; if (channel < 0) //wtf? @@ -23,8 +23,9 @@ void AOMusicPlayer::play(QString p_song, int channel, bool crossfade) QString f_path = ao_app->get_music_path(p_song); unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE; - if (m_looping) + if (loop) flags |= BASS_SAMPLE_LOOP; + DWORD newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); if (ao_app->get_audio_output_device() != "default") @@ -33,8 +34,8 @@ void AOMusicPlayer::play(QString p_song, int channel, bool crossfade) QString d_path = f_path + ".txt"; loop_start = 0; - loop_end = 0; - if (m_looping && file_exists(d_path)) //Contains loop/etc. information file + loop_end = BASS_ChannelGetLength(newstream, BASS_POS_BYTE); + if (loop && file_exists(d_path)) //Contains loop/etc. information file { QStringList lines = ao_app->read_file(d_path).split("\n"); foreach (QString line, lines) @@ -46,49 +47,60 @@ void AOMusicPlayer::play(QString p_song, int channel, bool crossfade) float sample_rate; BASS_ChannelGetAttribute(newstream, BASS_ATTRIB_FREQ, &sample_rate); - qDebug() << sample_rate << args[1].trimmed(); + //Grab number of bytes for sample size + int sample_size = 16/8; + + //number of channels (stereo/mono) + int num_channels = 2; + + //Calculate the bytes for loop_start/loop_end to use with the sync proc + QWORD bytes = static_cast(args[1].trimmed().toFloat() * sample_size * num_channels); if (arg == "loop_start") - loop_start = BASS_ChannelSeconds2Bytes(newstream, args[1].trimmed().toDouble() / static_cast(sample_rate)); + loop_start = bytes; else if (arg == "loop_length") - loop_end = loop_start + BASS_ChannelSeconds2Bytes(newstream, args[1].trimmed().toDouble() / static_cast(sample_rate)); + loop_end = loop_start + bytes; else if (arg == "loop_end") - loop_end = BASS_ChannelSeconds2Bytes(newstream, args[1].trimmed().toDouble() / static_cast(sample_rate)); + loop_end = bytes; } qDebug() << "Found data file for song" << p_song << "length" << BASS_ChannelGetLength(newstream, BASS_POS_BYTE) << "loop start" << loop_start << "loop end" << loop_end; } - if (crossfade) + if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING) { DWORD oldstream = m_stream_list[channel]; - //Mute the new sample - BASS_ChannelSetAttribute(newstream, BASS_ATTRIB_VOL, 0); - //Crossfade time - if (BASS_ChannelIsActive(oldstream) == BASS_ACTIVE_PLAYING) + + if (effect_flags & SYNC_POS) { - //Fade out the other sample and stop it - BASS_ChannelSlideAttribute(oldstream, BASS_ATTRIB_VOL|BASS_SLIDE_LOG, -1, 5000); BASS_ChannelLock(oldstream, true); //Sync it with the new sample BASS_ChannelSetPosition(newstream, BASS_ChannelGetPosition(oldstream, BASS_POS_BYTE), BASS_POS_BYTE); BASS_ChannelLock(oldstream, false); } - //Start it - BASS_ChannelPlay(newstream, false); - //Fade in our sample - BASS_ChannelSlideAttribute(newstream, BASS_ATTRIB_VOL, static_cast(m_volume[channel] / 100.0f), 1000); - m_stream_list[channel] = newstream; + if (effect_flags & FADE_OUT) + { + //Fade out the other sample and stop it (due to -1) + BASS_ChannelSlideAttribute(oldstream, BASS_ATTRIB_VOL|BASS_SLIDE_LOG, -1, 4000); + } + else + BASS_ChannelStop(oldstream); //Stop the sample since we don't need it anymore } else - { BASS_ChannelStop(m_stream_list[channel]); - m_stream_list[channel] = newstream; - BASS_ChannelPlay(m_stream_list[channel], false); - this->set_volume(m_volume[channel], channel); + + m_stream_list[channel] = newstream; + BASS_ChannelPlay(m_stream_list[channel], false); + if (effect_flags & FADE_IN) + { + //Fade in our sample + BASS_ChannelSetAttribute(newstream, BASS_ATTRIB_VOL, 0); + BASS_ChannelSlideAttribute(newstream, BASS_ATTRIB_VOL, static_cast(m_volume[channel] / 100.0f), 1000); } + else + this->set_volume(m_volume[channel], channel); - this->set_looping(m_looping); //Have to do this here due to any crossfading-related changes, etc. + this->set_looping(loop); //Have to do this here due to any crossfading-related changes, etc. } void AOMusicPlayer::stop(int channel) @@ -115,29 +127,36 @@ void AOMusicPlayer::set_volume(int p_value, int channel) void CALLBACK loopProc(HSYNC handle, DWORD channel, DWORD data, void *user) { - AOMusicPlayer *self= static_cast(user); - qDebug() << BASS_ChannelGetPosition(channel, BASS_POS_BYTE); - BASS_ChannelSetPosition(channel, self->loop_start, BASS_POS_BYTE); + QWORD loop_start = *(static_cast(user)); + BASS_ChannelLock(channel, true); + BASS_ChannelSetPosition(channel, loop_start, BASS_POS_BYTE); + BASS_ChannelLock(channel, false); } void AOMusicPlayer::set_looping(bool toggle, int channel) { m_looping = toggle; - qDebug() << "looping" << m_looping; - if (m_looping == false && BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) + if (!m_looping) { - BASS_ChannelFlags(m_stream_list[channel], 0, BASS_SAMPLE_LOOP); // remove the LOOP flag + if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) + BASS_ChannelFlags(m_stream_list[channel], 0, BASS_SAMPLE_LOOP); // remove the LOOP flag BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]); + loop_sync[channel] = 0; } - else if (m_looping == true) + else { BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag - BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]); - qDebug() << loop_end; - if (loop_end > 0) + if (loop_sync[channel] != 0) + { + BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]); //remove the sync + loop_sync[channel] = 0; + } + if (loop_start > 0) { - loop_sync[channel] = BASS_ChannelSetSync(m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end, loopProc, this); - qDebug() << "Started loop sync"; + if (loop_end == 0) + loop_end = BASS_ChannelGetLength(m_stream_list[channel], BASS_POS_BYTE); + if (loop_end > 0) //Don't loop zero length songs even if we're asked to + loop_sync[channel] = BASS_ChannelSetSync(m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end, loopProc, &loop_start); } } } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ee744a87..129c4bfa 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2813,7 +2813,7 @@ void Courtroom::handle_song(QStringList *p_contents) bool looping = true; int channel = 0; - bool crossfade = false; + int effect_flags = 0; if (n_char < 0 || n_char >= char_list.size()) { int channel = 0; @@ -2823,13 +2823,12 @@ void Courtroom::handle_song(QStringList *p_contents) if (p_contents->length() > 4) //eyyy we want to change this song's CHANNEL huh channel = p_contents->at(4).toInt(); //let the music player handle it if it's bigger than the channel list - if (p_contents->length() > 5) //CROSSFADE!? Are you MAD? + if (p_contents->length() > 5) //Flags provided to us by server such as Fade In, Fade Out, Sync Pos etc. { - crossfade = p_contents->at(5) == "1"; //let the music player handle it if it's bigger than the channel list + effect_flags = p_contents->at(5).toInt(); } - music_player->set_looping(looping, channel); - music_player->play(f_song, channel, crossfade); + music_player->play(f_song, channel, looping, effect_flags); if (channel == 0) ui_music_name->setText(f_song); } @@ -2854,8 +2853,10 @@ void Courtroom::handle_song(QStringList *p_contents) if (p_contents->length() > 4) //eyyy we want to change this song's CHANNEL huh channel = p_contents->at(4).toInt(); //let the music player handle it if it's bigger than the channel list - if (p_contents->length() > 5) //CROSSFADE!? Are you MAD? - crossfade = p_contents->at(5) == "1"; //let the music player handle it if it's bigger than the channel list + if (p_contents->length() > 5) //Flags provided to us by server such as Fade In, Fade Out, Sync Pos etc. + { + effect_flags = p_contents->at(5).toInt(); + } if (!mute_map.value(n_char)) { @@ -2869,8 +2870,8 @@ void Courtroom::handle_song(QStringList *p_contents) } append_ic_text(f_song_clear, str_show, true); - music_player->set_looping(looping, channel); - music_player->play(f_song, channel, crossfade); + + music_player->play(f_song, channel, looping, effect_flags); if (channel == 0) ui_music_name->setText(f_song); } @@ -3763,14 +3764,14 @@ void Courtroom::on_music_list_double_clicked(QTreeWidgetItem *p_item, int column 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); - } + QStringList packet_contents; + packet_contents.append(p_song); + packet_contents.append(QString::number(m_cid)); + if ((!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) || ao_app->effects_enabled) + packet_contents.append(ui_ic_chat_name->text()); + if (ao_app->effects_enabled) + packet_contents.append(QString::number(music_flags)); + ao_app->send_server_packet(new AOPacket("MC", packet_contents), false); } void Courtroom::on_music_list_context_menu_requested(const QPoint &pos) @@ -3779,9 +3780,50 @@ void Courtroom::on_music_list_context_menu_requested(const QPoint &pos) menu->addAction(QString("Expand All Categories"), this, SLOT(music_list_expand_all())); menu->addAction(QString("Collapse All Categories"), this, SLOT(music_list_collapse_all())); - // menu->addSeparator(); + menu->addSeparator(); + + menu->addAction(new QAction("Fade Out Previous", this)); + menu->actions().back()->setCheckable(true); + menu->actions().back()->setChecked(music_flags & FADE_OUT); + connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_fade_out(bool))); + + menu->addAction(new QAction("Fade In", this)); + menu->actions().back()->setCheckable(true); + menu->actions().back()->setChecked(music_flags & FADE_IN); + connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_fade_in(bool))); + + menu->addAction(new QAction("Synchronize", this)); + menu->actions().back()->setCheckable(true); + menu->actions().back()->setChecked(music_flags & SYNC_POS); + connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_synchronize(bool))); + menu->popup(ui_music_list->mapToGlobal(pos)); } + +void Courtroom::music_fade_out(bool toggle) +{ + if (toggle) + music_flags |= FADE_OUT; + else + music_flags &= ~FADE_OUT; +} + +void Courtroom::music_fade_in(bool toggle) +{ + if (toggle) + music_flags |= FADE_IN; + else + music_flags &= ~FADE_IN; +} + +void Courtroom::music_synchronize(bool toggle) +{ + if (toggle) + music_flags |= SYNC_POS; + else + music_flags &= ~SYNC_POS; +} + void Courtroom::music_list_expand_all() { ui_music_list->expandAll(); -- cgit From 8ab5a3a6b27376fb7e417ce760cbd7bf827a1138 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 5 Oct 2019 22:50:39 +0300 Subject: version 3 --- Attorney_Online.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 5d3eda01..e1145504 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -3,7 +3,7 @@ QT += core gui widgets network TARGET = Attorney_Online TEMPLATE = app -VERSION = 2.8.0.2 +VERSION = 2.8.0.3 INCLUDEPATH += $$PWD/include DESTDIR = $$PWD/bin -- cgit From 85f33e13c70a523df6554f0983e84777266563e4 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 6 Oct 2019 13:27:11 +0300 Subject: Fix some edge cases where the AOChar qlabel is moved around in weird ways (reload theme still puts qlabel at 0,0 without centering) Fix a full message of speed 0 not properly displaying itself --- src/aocharmovie.cpp | 3 +-- src/courtroom.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index f8dc8d2b..b05d7f64 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -240,7 +240,6 @@ QPixmap AOCharMovie::get_pixmap(QImage image) f_pixmap = f_pixmap.scaledToHeight(f_h, transform_mode); this->resize(f_pixmap.size()); - QLabel::move(x + (f_w - f_pixmap.width())/2, y + (f_h - f_pixmap.height())); //Always center horizontally, always put at the bottom vertically return f_pixmap; } @@ -248,7 +247,7 @@ QPixmap AOCharMovie::get_pixmap(QImage image) void AOCharMovie::set_frame(QPixmap f_pixmap) { this->setPixmap(f_pixmap); - QLabel::move(x + (this->width() - this->pixmap()->width())/2, y); + QLabel::move(x + (f_w - f_pixmap.width())/2, y + (f_h - f_pixmap.height())); //Always center horizontally, always put at the bottom vertically } void AOCharMovie::combo_resize(int w, int h) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 0cf5a32c..1145b349 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2605,7 +2605,7 @@ void Courtroom::chat_tick() next_character_is_not_special = false; } - if (formatting_char || (message_display_speed[current_display_speed] <= 0 && tick_pos < f_message.size())) + if ((message_display_speed[current_display_speed] <= 0 && tick_pos < f_message.size()-1) || formatting_char) { chat_tick_timer->start(0); //Don't bother rendering anything out as we're doing the SPEED. (there's latency otherwise) if (!formatting_char || f_character == "n") -- cgit From 91eeffb959fb59545d89116e67312e83468e0af1 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 6 Oct 2019 13:47:36 +0300 Subject: Courtroom Fonts can now have the "sharpness" setting (pixelated/no anti alias) --- include/courtroom.h | 2 +- src/courtroom.cpp | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 4b6ccc36..590fa0f9 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -128,7 +128,7 @@ public: void set_font(QWidget *widget, QString class_name, QString p_identifier); //Get the properly constructed font - QFont get_qfont(QString font_name, int f_pointsize); + QFont get_qfont(QString font_name, int f_pointsize, bool antialias=true); //actual operation of setting the font on a widget void set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color = Qt::black, bool bold = false); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 1145b349..34233f91 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -854,20 +854,23 @@ void Courtroom::set_font(QWidget *widget, QString class_name, QString p_identifi QString font_name = ao_app->get_font_name(p_identifier + "_font", design_file); QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? + bool antialias = ao_app->get_font_size(p_identifier + "_sharp", design_file) != 1; // is the font anti-aliased or not? - this->set_qfont(widget, class_name, get_qfont(font_name, f_pointsize), f_color, bold); + this->set_qfont(widget, class_name, get_qfont(font_name, f_pointsize, antialias), f_color, bold); } -QFont Courtroom::get_qfont(QString font_name, int f_pointsize) +QFont Courtroom::get_qfont(QString font_name, int f_pointsize, bool antialias) { QFont font; if (font_name.isEmpty()) - { - font = QFont("Arial", f_pointsize); - font.setStyleHint(QFont::SansSerif, QFont::NoAntialias); - } - else - font = QFont(font_name, f_pointsize); + font_name = "Arial"; + + QFont::StyleStrategy style_strategy = QFont::PreferDefault; + if (!antialias) + style_strategy = QFont::NoAntialias; + + font = QFont(font_name, f_pointsize); + font.setStyleHint(QFont::SansSerif, style_strategy); return font; } @@ -1756,6 +1759,7 @@ void Courtroom::handle_chatmessage_2() QString font_name = ao_app->get_font_name("message_font", design_file); QColor f_color = ao_app->get_color("message_color", design_file); bool bold = ao_app->get_font_size("message_bold", design_file) == 1; // is the font bold or not? + bool antialias = ao_app->get_font_size("message_sharp", design_file) != 1; // is the font anti-aliased or not? QString chatfont = ao_app->get_chat_font(m_chatmessage[CHAR_NAME]); if (chatfont != "") @@ -1764,7 +1768,7 @@ void Courtroom::handle_chatmessage_2() int chatsize = ao_app->get_chat_size(m_chatmessage[CHAR_NAME]); if (chatsize != -1) f_pointsize = chatsize; - this->set_qfont(ui_vp_message, "", get_qfont(font_name, f_pointsize), f_color, bold); + this->set_qfont(ui_vp_message, "", get_qfont(font_name, f_pointsize, antialias), f_color, bold); set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); -- cgit From ec02078b4d0596ebf69b11f2599b06d68d748b7f Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 6 Oct 2019 23:23:52 +0300 Subject: Fix music display not displaying a stripped down version of the song name --- src/courtroom.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 34233f91..ed7e3e5c 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2820,8 +2820,7 @@ void Courtroom::handle_song(QStringList *p_contents) return; QString f_song = f_contents.at(0); - QString f_song_clear = f_song; - f_song_clear = f_song_clear.left(f_song_clear.lastIndexOf(".")); + QString f_song_clear = f_song.left(f_song.lastIndexOf(".")).right(f_song.lastIndexOf("/")); int n_char = f_contents.at(1).toInt(); bool looping = true; @@ -2843,7 +2842,7 @@ void Courtroom::handle_song(QStringList *p_contents) music_player->play(f_song, channel, looping, effect_flags); if (channel == 0) - ui_music_name->setText(f_song); + ui_music_name->setText(f_song_clear); } else { @@ -2886,7 +2885,7 @@ void Courtroom::handle_song(QStringList *p_contents) music_player->play(f_song, channel, looping, effect_flags); if (channel == 0) - ui_music_name->setText(f_song); + ui_music_name->setText(f_song_clear); } } } -- cgit From 990f653e4a063a684b5d5584c7454c36a1036a85 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 8 Oct 2019 01:35:10 +0300 Subject: Allow -1 charid messages to be sent (system/server messages) UNTESTED --- src/courtroom.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ed7e3e5c..7d2f183f 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1561,20 +1561,20 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) int f_char_id = m_chatmessage[CHAR_ID].toInt(); - if (f_char_id < 0 || f_char_id >= char_list.size()) + 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()) + if (f_char_id > 0 && (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())) { - f_showname = ao_app->get_showname(char_list.at(f_char_id).name); + f_showname = ao_app->get_showname(char_list.at(f_char_id).name); } else { - f_showname = m_chatmessage[SHOWNAME]; + f_showname = m_chatmessage[SHOWNAME]; } if(f_showname.trimmed().isEmpty()) //Pure whitespace showname, get outta here. @@ -1583,9 +1583,14 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n'; - if (f_message == previous_ic_message) + if (f_char_id >= 0 && f_message == previous_ic_message) //Not a system message return; + if (f_char_id <= -1) + previous_ic_message = ""; //System messages don't care about repeating themselves + else + previous_ic_message = f_message; + //Stop the chat arrow from animating ui_vp_chat_arrow->stop(); @@ -1597,8 +1602,6 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) //Remove undesired newline chars m_chatmessage[MESSAGE].remove("\n"); - //Replace all trailing whitespace with a single space and remove all whitespace at the end of the string. - //m_chatmessage[MESSAGE] = m_chatmessage[MESSAGE].replace(QRegularExpression("^\\s+(?=\\s)|\\s+$|\\s+(?=\\s)"), ""); chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; @@ -1625,7 +1628,11 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) //Let the server handle actually checking if they're allowed to do this. is_additive = m_chatmessage[ADDITIVE].toInt() == 1; - chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, m_chatmessage[MESSAGE], false); + QString f_charname = ""; + if (f_char_id >= 0) + f_charname = ao_app->get_showname(char_list.at(f_char_id).name); + + chatlogpiece* temp = new chatlogpiece(f_charname, f_showname, m_chatmessage[MESSAGE], false); ic_chatlog_history.append(*temp); ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); @@ -1636,8 +1643,6 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) append_ic_text(m_chatmessage[MESSAGE], f_showname); - previous_ic_message = f_message; - int objection_mod = m_chatmessage[OBJECTION_MOD].toInt(); QString f_char = m_chatmessage[CHAR_NAME]; QString f_custom_theme = ao_app->get_char_shouts(f_char); @@ -1701,9 +1706,10 @@ void Courtroom::handle_chatmessage_2() else ui_vp_player_char->network_strings.clear(); - if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) + int f_charid = m_chatmessage[CHAR_ID].toInt(); + if (f_charid >= 0 && (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())) { - QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; + QString real_name = char_list.at(f_charid).name; QString f_showname = ao_app->get_showname(real_name); @@ -1845,7 +1851,6 @@ void Courtroom::handle_chatmessage_2() else ui_vp_player_char->move(0, 0); - qDebug() << "offset OK" << ok << "offset value" << self_offset; switch (emote_mod) { case 1: case 2: case 6: -- cgit From 330aa9755095cd4f12f028452d268c50311d3710 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 12 Oct 2019 01:43:48 +0300 Subject: Properly handle "true song name" even with folders/categories and file formats (paving way for folder-categorized music lists set up by servers) Prevent BG's from falling back on default BG path (this isn't really user-convenient and causes more trouble than its worth, e.g. stands appearing on BG's that dont' want stands to appear) Implement Case Cafe's method of categorization for (a) and (b) emotes --- src/aocharmovie.cpp | 1 + src/aoscene.cpp | 22 ++++++++++++++++++---- src/courtroom.cpp | 11 ++++++++--- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index b05d7f64..9bbb8761 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -28,6 +28,7 @@ void AOCharMovie::load_image(QString p_char, QString p_emote, QString emote_pref QList pathlist; pathlist = { ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)), //Default path + ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + "/" + p_emote)),//Path check if it's categorized into a folder ao_app->get_character_path(p_char, p_emote + ".png"), //Non-animated path if emote_prefix fails ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Theme placeholder path ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")), //Default theme placeholder path diff --git a/src/aoscene.cpp b/src/aoscene.cpp index c9314258..527d25db 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -13,8 +13,15 @@ AOScene::AOScene(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) void AOScene::set_image(QString p_image) { 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 + if (!file_exists(background_path)) //If image is missing, clear current image + { + //background_path = ao_app->get_image_suffix(ao_app->get_default_background_path(p_image)); //Default path + this->clear(); + this->setMovie(nullptr); + + m_movie->stop(); + return; + } if (file_exists(background_path) && background_path == last_image) return; @@ -46,8 +53,15 @@ void AOScene::set_legacy_desk(QString 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 + if (!file_exists(desk_path)) //If image is missing, clear current image + { + //desk_path = ao_app->get_image_suffix(ao_app->get_default_background_path(p_image)); //Default path + this->clear(); + this->setMovie(nullptr); + + m_movie->stop(); + return; + } if (file_exists(desk_path) && desk_path == last_image) return; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 7d2f183f..42927918 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -127,7 +127,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_area_list = new QListWidget(this); ui_area_list->hide(); ui_music_list = new QTreeWidget(this); - ui_music_list->setColumnCount(1); + ui_music_list->setColumnCount(2); + ui_music_list->hideColumn(1); ui_music_list->setHeaderHidden(true); ui_music_list->header()->setStretchLastSection(false); ui_music_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); @@ -1184,13 +1185,15 @@ void Courtroom::list_music() { 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) //not a category, parent exists treeItem = new QTreeWidgetItem(parent); else treeItem = new QTreeWidgetItem(ui_music_list); - treeItem->setText(0, i_song); + treeItem->setText(0, i_song_listname); + treeItem->setText(1, i_song); music_row_to_number.append(n_song); QString song_path = ao_app->get_music_path(i_song); @@ -2825,7 +2828,8 @@ void Courtroom::handle_song(QStringList *p_contents) return; QString f_song = f_contents.at(0); - QString f_song_clear = f_song.left(f_song.lastIndexOf(".")).right(f_song.lastIndexOf("/")); + QString f_song_clear = f_song.left(f_song.lastIndexOf(".")); + f_song_clear = f_song_clear.right(f_song_clear.length() - (f_song_clear.lastIndexOf("/") + 1)); int n_char = f_contents.at(1).toInt(); bool looping = true; @@ -3779,6 +3783,7 @@ void Courtroom::on_music_list_double_clicked(QTreeWidgetItem *p_item, int column if (is_muted) return; + column = 1; //Column 1 is always the metadata (which we want) QString p_song = p_item->text(column); QStringList packet_contents; -- cgit From a9a0f65ddb351797d8805b28fe18b1e5114dd708 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 12 Oct 2019 17:57:18 +0300 Subject: Allow area list to contain metadata (as well as categories for future expansion) Fix backwards compatibility breaking when you join a server that doesn't support effects after previously joining a server that does --- include/courtroom.h | 8 ++------ src/courtroom.cpp | 49 ++++++++++++++++++++++++++++----------------- src/packet_distribution.cpp | 1 + 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 590fa0f9..ea841229 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -288,10 +288,6 @@ private: 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; @@ -470,7 +466,7 @@ private: AOTextArea *ui_server_chatlog; QListWidget *ui_mute_list; - QListWidget *ui_area_list; + QTreeWidget *ui_area_list; QTreeWidget *ui_music_list; ScrollText *ui_music_name; @@ -651,7 +647,7 @@ private slots: void music_synchronize(bool toggle); void music_list_expand_all(); void music_list_collapse_all(); - void on_area_list_double_clicked(QModelIndex p_model); + void on_area_list_double_clicked(QTreeWidgetItem *p_item, int column); void select_emote(int p_id); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 42927918..5a7f0d24 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -124,8 +124,14 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_server_chatlog->setReadOnly(true); ui_server_chatlog->setOpenExternalLinks(true); - ui_area_list = new QListWidget(this); + ui_area_list = new QTreeWidget(this); + ui_area_list->setColumnCount(2); + ui_area_list->hideColumn(1); + ui_area_list->setHeaderHidden(true); + ui_area_list->header()->setStretchLastSection(false); + ui_area_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); ui_area_list->hide(); + ui_music_list = new QTreeWidget(this); ui_music_list->setColumnCount(2); ui_music_list->hideColumn(1); @@ -324,7 +330,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_music_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(on_music_list_double_clicked(QTreeWidgetItem*, int))); connect(ui_music_list, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_music_list_context_menu_requested(QPoint))); - connect(ui_area_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_area_list_double_clicked(QModelIndex))); + + connect(ui_area_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(on_area_list_double_clicked(QTreeWidgetItem*, int))); connect(ui_hold_it, SIGNAL(clicked()), this, SLOT(on_hold_it_clicked())); connect(ui_objection, SIGNAL(clicked()), this, SLOT(on_objection_clicked())); @@ -565,7 +572,10 @@ void Courtroom::set_widgets() ui_pair_button->setToolTip(tr("Display the list of characters to pair with.")); set_size_and_pos(ui_area_list, "music_list"); + ui_area_list->header()->setMinimumSectionSize(ui_area_list->width()); + set_size_and_pos(ui_music_list, "music_list"); + ui_music_list->header()->setMinimumSectionSize(ui_music_list->width()); set_size_and_pos(ui_music_name, "music_name"); @@ -1171,7 +1181,6 @@ void Courtroom::enter_courtroom() void Courtroom::list_music() { ui_music_list->clear(); - music_row_to_number.clear(); QString f_file = "courtroom_design.ini"; @@ -1194,7 +1203,6 @@ void Courtroom::list_music() treeItem = new QTreeWidgetItem(ui_music_list); treeItem->setText(0, i_song_listname); treeItem->setText(1, i_song); - music_row_to_number.append(n_song); QString song_path = ao_app->get_music_path(i_song); @@ -1215,7 +1223,6 @@ void Courtroom::list_music() void Courtroom::list_areas() { ui_area_list->clear(); - area_row_to_number.clear(); QString f_file = "courtroom_design.ini"; @@ -1254,34 +1261,35 @@ void Courtroom::list_areas() if (i_area.toLower().contains(ui_music_search->text().toLower())) { - ui_area_list->addItem(i_area); - area_row_to_number.append(n_area); + QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_area_list); + treeItem->setText(0, i_area); + treeItem->setText(1, QString::number(n_area)); if (ao_app->arup_enabled) { // Coloring logic here. - ui_area_list->item(n_listed_areas)->setBackground(free_brush); + treeItem->setBackground(0, free_brush); if (arup_locks.at(n_area) == "LOCKED") { - ui_area_list->item(n_listed_areas)->setBackground(locked_brush); + treeItem->setBackground(0, locked_brush); } else { if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") - ui_area_list->item(n_listed_areas)->setBackground(lfp_brush); + treeItem->setBackground(0, lfp_brush); else if (arup_statuses.at(n_area) == "CASING") - ui_area_list->item(n_listed_areas)->setBackground(casing_brush); + treeItem->setBackground(0, casing_brush); else if (arup_statuses.at(n_area) == "RECESS") - ui_area_list->item(n_listed_areas)->setBackground(recess_brush); + treeItem->setBackground(0, recess_brush); else if (arup_statuses.at(n_area) == "RP") - ui_area_list->item(n_listed_areas)->setBackground(rp_brush); + treeItem->setBackground(0, rp_brush); else if (arup_statuses.at(n_area) == "GAMING") - ui_area_list->item(n_listed_areas)->setBackground(gaming_brush); + treeItem->setBackground(0, gaming_brush); } } else { - ui_area_list->item(n_listed_areas)->setBackground(free_brush); + treeItem->setBackground(0, free_brush); } ++n_listed_areas; @@ -3855,10 +3863,15 @@ void Courtroom::music_list_collapse_all() ui_music_list->collapseAll(); } -void Courtroom::on_area_list_double_clicked(QModelIndex p_model) +void Courtroom::on_area_list_double_clicked(QTreeWidgetItem *p_item, int column) { - 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); + column = 0; //Column 0 is the area name, column 1 is the metadata + QString p_area = p_item->text(column); + + QStringList packet_contents; + packet_contents.append(p_area); + packet_contents.append(QString::number(m_cid)); + ao_app->send_server_packet(new AOPacket("MC", packet_contents), false); } void Courtroom::on_hold_it_clicked() diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 097d2512..20a07a62 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -151,6 +151,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) modcall_reason_enabled = false; looping_sfx_support_enabled = false; additive_enabled = false; + effects_enabled = false; //workaround for tsuserver4 if (f_contents.at(0) == "NOENCRYPT") -- cgit From 1cc5b5b4412f225181567b0849ea7ba111fe6f90 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 12 Oct 2019 17:58:17 +0300 Subject: Version 4 --- Attorney_Online.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index e1145504..4890d808 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -3,7 +3,7 @@ QT += core gui widgets network TARGET = Attorney_Online TEMPLATE = app -VERSION = 2.8.0.3 +VERSION = 2.8.0.4 INCLUDEPATH += $$PWD/include DESTDIR = $$PWD/bin -- cgit From 6d7a6d7398dcb74550e7722c4b1436f42d00123c Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 13 Oct 2019 02:51:07 +0300 Subject: Fix an issue with "missing desk" not properly replacing last_image (making everyone's desk break from pos hld to def/wit/pro) --- src/aoscene.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 527d25db..6ada5ee5 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -15,11 +15,11 @@ void AOScene::set_image(QString p_image) QString background_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); if (!file_exists(background_path)) //If image is missing, clear current image { - //background_path = ao_app->get_image_suffix(ao_app->get_default_background_path(p_image)); //Default path this->clear(); this->setMovie(nullptr); m_movie->stop(); + last_image = ""; return; } @@ -55,11 +55,11 @@ void AOScene::set_legacy_desk(QString p_image) QString desk_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); if (!file_exists(desk_path)) //If image is missing, clear current image { - //desk_path = ao_app->get_image_suffix(ao_app->get_default_background_path(p_image)); //Default path this->clear(); this->setMovie(nullptr); m_movie->stop(); + last_image = ""; return; } -- cgit From 3605f223d2f8bf0548f9a9802b470fdbc4d71ba3 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 20 Oct 2019 01:44:54 +0300 Subject: Fix input bg's not being transparent FIx chat_tick_timer not stopping when you receive a bg --- src/courtroom.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 5a7f0d24..7cb5cf39 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -628,13 +628,14 @@ void Courtroom::set_widgets() ui_muted->setToolTip(tr("Oops, you're muted!")); set_size_and_pos(ui_ooc_chat_message, "ooc_chat_message"); - ui_ooc_chat_message->setToolTip(tr("Type your message to display in the server chat here.")); + 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->setToolTip(tr("Set your name to display in the server chat.")); + 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"); + ui_music_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); ui_emote_dropdown->setToolTip(tr("Set your character's emote to play on your next message.")); @@ -1020,10 +1021,13 @@ void Courtroom::set_background(QString p_background, bool display) { ui_vp_speedlines->stop(); ui_vp_player_char->stop(); + ui_vp_sideplayer_char->stop(); ui_vp_effect->stop(); ui_vp_message->hide(); ui_vp_chatbox->hide(); + + chat_tick_timer->stop(); set_scene(QString::number(ao_app->get_desk_mod(current_char, current_emote)), current_side); } } -- cgit From 7d73347618719dc7b8bf0312ba5c782995c95e9f Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 20 Oct 2019 17:59:38 +0300 Subject: Version 2.8.0.5 Add Killing Fever Online icon (mac icon not updated yet) --- Attorney_Online.pro | 2 +- include/lobby.h | 2 +- resource/logo.ico | Bin 99678 -> 99678 bytes resource/logo.png | Bin 29302 -> 22609 bytes resource/logo_ao2.ico | Bin 0 -> 99678 bytes resource/logo_ao2.png | Bin 0 -> 29302 bytes src/lobby.cpp | 1 - 7 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 resource/logo_ao2.ico create mode 100644 resource/logo_ao2.png diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 4890d808..6061cd95 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -3,7 +3,7 @@ QT += core gui widgets network TARGET = Attorney_Online TEMPLATE = app -VERSION = 2.8.0.4 +VERSION = 2.8.0.5 INCLUDEPATH += $$PWD/include DESTDIR = $$PWD/bin diff --git a/include/lobby.h b/include/lobby.h index e0cd03da..f0c4227c 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -32,7 +32,7 @@ public: void append_chatmessage(QString f_name, QString f_message); void append_error(QString f_message); void set_player_count(int players_online, int max_players); - void set_stylesheet(QWidget *widget, QString target_tag); + void set_stylesheet(QWidget *widget); void set_stylesheets(); void set_fonts(); void set_font(QWidget *widget, QString p_identifier); diff --git a/resource/logo.ico b/resource/logo.ico index b40e7866..3c68adff 100644 Binary files a/resource/logo.ico and b/resource/logo.ico differ diff --git a/resource/logo.png b/resource/logo.png index f53fe30c..d8001233 100644 Binary files a/resource/logo.png and b/resource/logo.png differ diff --git a/resource/logo_ao2.ico b/resource/logo_ao2.ico new file mode 100644 index 00000000..b40e7866 Binary files /dev/null and b/resource/logo_ao2.ico differ diff --git a/resource/logo_ao2.png b/resource/logo_ao2.png new file mode 100644 index 00000000..f53fe30c Binary files /dev/null and b/resource/logo_ao2.png differ diff --git a/src/lobby.cpp b/src/lobby.cpp index 4ca4f491..7c61aa7e 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -140,7 +140,6 @@ void Lobby::set_widgets() set_size_and_pos(ui_loading_text, "loading_label"); - //WHY IS THIS FONT HARDCODED, WHAT IS WRONG WITH YOU ui_loading_text->setFont(QFont("Arial", 20, QFont::Bold)); ui_loading_text->setReadOnly(true); ui_loading_text->setAlignment(Qt::AlignCenter); -- cgit From 3595fd11e60fd07a2a6802150f4dff60cf6669fc Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 20 Oct 2019 18:35:28 +0300 Subject: oops --- include/lobby.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/lobby.h b/include/lobby.h index f0c4227c..e0cd03da 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -32,7 +32,7 @@ public: void append_chatmessage(QString f_name, QString f_message); void append_error(QString f_message); void set_player_count(int players_online, int max_players); - void set_stylesheet(QWidget *widget); + void set_stylesheet(QWidget *widget, QString target_tag); void set_stylesheets(); void set_fonts(); void set_font(QWidget *widget, QString p_identifier); -- cgit From 52921b51a41e44da3a5b17156845793251f0763e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 22 Oct 2019 18:05:39 +0300 Subject: Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0416e4a3..0cc2450b 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,8 @@ Modifications copyright (c) 2017-2018 oldmud0 Case Café additions copyright (c) 2018 Cerapter +Killing Fever Online additions copyright (c) 2019 Crystalwarrior + ### Qt This project uses Qt 5, which is licensed under the [GNU Lesser General Public License](https://www.gnu.org/licenses/lgpl-3.0.txt) with [certain licensing restrictions and exceptions](https://www.qt.io/qt-licensing-terms/). To comply with licensing requirements for static linking, object code is available if you would like to relink with an alternative version of Qt, and the source code for Qt may be found at https://github.com/qt/qtbase, http://code.qt.io/cgit/, or at https://qt.io. -- cgit From 39777f6d137539b0e4300f06af18da2b4348fd89 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 22 Oct 2019 18:06:43 +0300 Subject: Update README.md --- README.md | 171 +------------------------------------------------------------- 1 file changed, 1 insertion(+), 170 deletions(-) diff --git a/README.md b/README.md index 0cc2450b..cea1bfb7 100644 --- a/README.md +++ b/README.md @@ -4,176 +4,7 @@ ## Introduction for beginners -You may already be familiar with roleplaying in forums, Roll20, and/or [AAO](http://aaonline.fr/) (the online casemaker). In this sense, Attorney Online is nothing more than a medium - an animated chatroom client - that allows cases to be played out as if it were an Ace Attorney game. - -Not unlike other roleplaying games, cases can last an absurd amount of time (between 4 to 6 hours) and generally follow a roleplaying format directed by a case sheet. - -An implied expectation for fast typing and real-time communication may seem daunting at first, but due to the number of people in the courtroom, things get hectic very quickly even with only a few people talking. Therefore, you should not feel pressured to talk constantly: only when you have the attention of the court (or when you have an objection to make) should you feel the need to speak. - -It is recommended, but not strictly necessary, to have played an Ace Attorney game before creating your own case. You should also try to spectate or take part in a community case in order to get a grasp of how cases are done in practice. - ---- - -## Basic features - -### In-character chat - -Type in a message in the gray box under the viewport, select an emote, and press Enter. - -### Emotes - -An emote represents a set of animations played while the character is speaking and idle. Some emotes also contain a preanimation, which is played before the text is said by the character. - -### Interjections (shouts) - -Select an interjection to toggle it. When you send a message, it will interrupt all other dialogue and interject with your message. - -### Out-of-character chat - -This is a general-purpose chat isolated within areas to discuss matters without interrupting cases. You must enter a name before chatting. - -### Music list - -Double-click a track to play it. Some servers automatically loop the track. Green tracks are available locally; red tracks are not. - -### Areas - -Servers have multiple areas to hold multiple cases simultaneously. Double-click an area in the music list to switch to it. (The reason that -areas are in the music list is a historical one.) - -### Judge controls - -The judge can set health bars and play the Witness Testimony, Cross Examination, Guilty, and Not Guilty animations. - -### Mod calls - -Calling a mod notifies moderators currently in the server of an incident. (Mod call reasons require 2.6+ server-side support.) Logged-in moderators can toggle the Guard option to be notified of mod calls. - -### Muting - -Click on a character in the mute list to ignore any in-character chat from the specified character. - -### Positions - -All characters have a default position within the courtroom, but they can nonetheless be changed within the interface. - -Available positions: - -- `def` - Defense -- `pro` - Prosecution -- `hld` - Helper defense -- `hlp` - Helper prosecution -- `jud` - Judge -- `wit` - Witness -- `jur` - Juror (2.6+) -- `sea` - Seance (2.6+) - -## Advanced features - -### Markup language - -2.6.0 introduces a markup language for in-character chat. It does not require server-side support. - -#### Color - -Wrapping text with these characters will set the text inside of them to the associated color. - -- `(` and `)` (parentheses) - blue -- \` (backtick) - green -- `|` (vertical bar) - orange -- `[` and `]` (square brackets) - grey - -#### Speed - -Type `{` to slow down the text a bit, and `}` to speed it up. This takes effect after the character has been typed, so the text may take up different speeds at different points. Both of these can be stacked up to three times, and even against each other. - -Example: -``` -Hello there! This text goes at normal speed.} Now, it's a bit faster!{ Now, it's back to normal.}}} Now it goes at maximum speed! {{Now it's only a little bit faster than normal. -``` - -#### Position - -If you begin a message with `~~` (two tildes), the two tildes are removed and the message is centered. - -### Pairing (2.6+) - -If two players are in the same position and select each other's characters using the in-game pair list (or with `/pair [id]`), they will appear alongside each other. You can set the offset of your character using the provided spinbox (or with `/offset [percentage]`). - -### Non-interrupting preanimations (2.6+) - -When checked, this will force text to immediately begin displaying without waiting for the preanimation to finish. - -### Custom IC names (shownames) (2.6+) - -You can set a custom in-character name using the provided text box. An option in the interface (or `/force_nonint_pres`) is also present to disable custom IC names for other players to prevent impersonation. - -### Extended area support (2.6+) - -Areas can be listed by clicking the A/M button (or `/switch_am`). The statuses of such areas are displayed (and updated automatically) if the server has 2.6+ support. - ---- - -## Upgrade guide for 2.6 - -2.6 inherits features from the Case Café custom client and server. Old themes and servers will still work, but they will not expose the new additions to players. - -### Server - -2.6 support has only been developed for tsuserver3. serverD is currently not equipped at all for such support. - -- Apply the new code changes. -- In `areas.yaml`: - - You may add `shouts_allowed` to any of the areas to enable / disable shouts (and judge buttons, and realisation). By default, it's `shouts_allowed: true`. - - You may add `jukebox` to any of the areas to enable the jukebox in there, but you can also use `/jukebox_toggle` in game as a mod to do the same thing. By default, it's `jukebox: false`. - - You may add `showname_changes_allowed` to any of the areas to allow custom shownames used in there. If it's forbidden, players can't send messages or change music as long as they have a custom name set. By default, it's `showname_changes_allowed: false`. - - You may add `abbreviation` to override the server-generated abbreviation of the area. Instead of area numbers, this server-pack uses area abbreviations in server messages for easier understanding (but still uses area IDs in commands, of course). No default here, but here is an example: `abbreviation: SIN` gives the area the abbreviation of 'SIN'. - - You may add `noninterrupting_pres` to force users to use non-interrupting pres only. 2.6 users will see the pres play as the text goes; pre-2.6 users will not see pres at all. The default is `noninterrupting_pres: false`. - -### Client themes - -- You'll need the following, additional images: - - `notguilty.gif` - Not Guilty verdict animation - - `guilty.gif` - Guilty verdict animation - - `notguilty.png` - Not Guilty button - - `guilty.png` - Guilty button - - `pair_button.png` - Pair button - - `pair_button_pressed.png` - Pair button (selected) -- In your `courtroom_sounds.ini`: - - Add a sound effect for `not_guilty`, for example: `not_guilty = sfx-notguilty.wav`. - - Add a sound effect for `guilty`, for example: `guilty = sfx-guilty.wav`. - - Add a sound effect for the case alerts. They work similarly to modcall alerts, or callword alerts. For example: `case_call = sfx-triplegavel-soj.wav`. -- In your `courtroom_design.ini`, place the following new UI elements as desired: - - `log_limit_label`, which is a simple text that explains what the spinbox with the numbers is. Needs an X, Y, width, height number. - - `log_limit_spinbox`, which is the spinbox for the log limit, allowing you to set the size of the log limit in-game. Needs the same stuff as above. - - `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. - - `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. - - `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. - - `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`. - - `area_recess_color` determines the colour of the area if its status is `RECESS`. - - `area_rp_color` determines the colour of the area if its status is `RP`. - - `area_gaming_color` determines the colour of the area if its status is `GAMING`. - - `area_locked_color` determines the colour of the area if it is locked, regardless of status. - - `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'!) - +Rerfer to the Wiki for information. --- ## Compiling -- cgit From f0a0f6bc1ac527d31c4f97ce57e2579985445e56 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 22 Oct 2019 18:07:21 +0300 Subject: Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index cea1bfb7..0b0da92d 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,8 @@ # Attorney Online [Attorney Online](https://aceattorneyonline.com) is an online version of the world-renowned courtroom drama simulator that allows you to create and play out cases in an off-the-cuff format. +Refer to the Wiki for more information. -## Introduction for beginners - -Rerfer to the Wiki for information. --- ## Compiling -- cgit From bef368e98651fa01e743728a2a88783fdfab74ac Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 23 Oct 2019 05:08:20 +0300 Subject: Allow gender (blip sounds) that don't use sfx-blip naming convention Fix "prezoom" packet being ignored Allow char.ini's to indicate a zoom w/ preanimation by using emote_mod=4 ((ALL OF THESE ARE UNTESTED - TESTING NEEDED!)) --- include/aocharmovie.h | 2 +- src/courtroom.cpp | 8 ++++---- src/emotes.cpp | 2 +- src/packet_distribution.cpp | 2 ++ src/text_file_functions.cpp | 6 ++++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/aocharmovie.h b/include/aocharmovie.h index 8aed1eb8..15fa7cf4 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -67,7 +67,7 @@ private: QElapsedTimer actual_time; - //it will forever be a mystery who thought this time_mod system would ever be a good idea with precision-based emotes + //Usually used to turn seconds into milliseconds such as for [Time] tag in char.ini const int time_mod = 60; // These are the X and Y values before they are fixed based on the sprite's width. diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 7cb5cf39..fec354a0 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1391,7 +1391,7 @@ void Courtroom::on_chat_return_pressed() { if (ui_pre->isChecked()) { - if (f_emote_mod == 5) + if (f_emote_mod == 4 || f_emote_mod == 5) f_emote_mod = 6; else f_emote_mod = 2; @@ -1957,7 +1957,7 @@ void Courtroom::play_char_sfx(QString sfx_name) { sfx_player->play(ao_app->get_sfx_suffix(sfx_name)); if(ao_app->get_looping_sfx()) - sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name)!="0"); + sfx_player->set_looping(ao_app->get_sfx_looping(current_char, QString::number(current_emote))!="0"); } void Courtroom::handle_chatmessage_3() @@ -2396,7 +2396,7 @@ void Courtroom::play_preanim(bool noninterrupting) //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; + int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * time_mod; int preanim_duration; @@ -2493,7 +2493,7 @@ void Courtroom::start_chat_ticking() QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]); - blip_player->set_blips(ao_app->get_sfx_suffix("sfx-blip" + f_gender)); + blip_player->set_blips(ao_app->get_sfx_suffix(f_gender)); //means text is currently ticking text_state = 1; diff --git a/src/emotes.cpp b/src/emotes.cpp index 58e85948..de53169e 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -159,7 +159,7 @@ void Courtroom::select_emote(int p_id) { ui_pre->setChecked(!ui_pre->isChecked()); } - else if (emote_mod == 1) + else if (emote_mod == 1 || emote_mod == 4) ui_pre->setChecked(true); else ui_pre->setChecked(false); diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 20a07a62..8c74b768 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -192,6 +192,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet) { if (f_packet.contains("yellowtext",Qt::CaseInsensitive)) yellow_text_enabled = true; + if (f_packet.contains("prezoom",Qt::CaseInsensitive)) + prezoom_enabled = true; if (f_packet.contains("flipping",Qt::CaseInsensitive)) flipping_enabled = true; if (f_packet.contains("customobjections",Qt::CaseInsensitive)) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 204de69f..f38bbb5e 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -628,8 +628,10 @@ 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; + return "sfx-blipmale"; + if (!file_exists(get_sfx(f_result))) + f_result = "sfx-blip" + f_result; + return f_result; } QString AOApplication::get_chat(QString p_char) -- cgit From 773a61f3d4ce2284b2d5d753b5c696f7bd44a531 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 4 Nov 2019 15:32:01 +0300 Subject: Make the music search bar search in music metadata instead of just the displayed name (aka the filepath) Make sfx player able to play sfx without the file extension provided Allow blipsounds to seek in blips/ folder to allow better categorization, as well as direct sound references add get_emote_blip for detecting the blipsound used by an emote. Currently unused. Less strict/hardcoded custom objection detection system Allow system (charid -1) messages, and don't do the same message detection on blankposting Allow objection, hold it, take that and custom sound players to detect sounds that are not exclusively .wav --- include/aoapplication.h | 3 ++ src/aosfxplayer.cpp | 3 ++ src/courtroom.cpp | 39 ++++++++++++------------- src/text_file_functions.cpp | 69 ++++++++++++++++++++++++++------------------- 4 files changed, 64 insertions(+), 50 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index af1433f8..8dd48c6a 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -335,6 +335,9 @@ public: //Returns the sfx of p_char's p_emote QString get_sfx_name(QString p_char, int p_emote); + //Returns the blipsound of p_char's p_emote + QString get_emote_blip(QString p_char, int p_emote); + //Returns if the sfx is defined as looping in char.ini QString get_sfx_looping(QString p_char, QString p_sfx); diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index ca2b3930..cc019725 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -56,6 +56,9 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, int channel else f_path = sound_path; + if (!file_exists(f_path)) + f_path = ao_app->get_sfx_suffix(f_path); //If we're not given a sound file with .wav/.ogg/.opus already there, let's do this thing + m_stream_list[channel] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); set_volume_internal(m_volume); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index fec354a0..30c391f0 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -782,7 +782,7 @@ void Courtroom::set_widgets() ui_custom_objection->setText(tr("Custom Shout!")); ui_custom_objection->set_image("custom"); ui_custom_objection->setToolTip(tr("This will display the custom character-defined animation in the viewport as soon as it is pressed.\n" - "To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.wav")); + "To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect")); set_size_and_pos(ui_realization, "realization"); ui_realization->set_image("realization"); @@ -1002,9 +1002,10 @@ void Courtroom::set_background(QString p_background, bool display) ui_vp_testimony->stop(); current_background = p_background; - is_ao2_bg = file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("defensedesk"))) && - file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("prosecutiondesk"))) && - file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("stand"))); + is_ao2_bg = true; +// file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("defensedesk"))) && +// file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("prosecutiondesk"))) && +// file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("stand"))); if (is_ao2_bg) { @@ -1127,10 +1128,7 @@ void Courtroom::update_character(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 && file_exists(ao_app->get_image_suffix(ao_app->get_character_path(current_char, "custom")))) ui_custom_objection->show(); else ui_custom_objection->hide(); @@ -1597,8 +1595,11 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n'; + //Remove undesired newline chars + m_chatmessage[MESSAGE].remove("\n"); + chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; - if (f_char_id >= 0 && f_message == previous_ic_message) //Not a system message + if (f_char_id >= 0 && !chatmessage_is_empty && f_message == previous_ic_message) //Not a system message return; if (f_char_id <= -1) @@ -1615,11 +1616,6 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) chat_tick_timer->stop(); ui_vp_evidence_display->reset(); - //Remove undesired newline chars - m_chatmessage[MESSAGE].remove("\n"); - - chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; - //Hey, our message showed up! Cool! if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text().remove("\n") && m_chatmessage[CHAR_ID].toInt() == m_cid) { @@ -1669,22 +1665,22 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) { case 1: ui_vp_objection->play("holdit_bubble", f_char, f_custom_theme, 724); - objection_player->play("holdit.wav", f_char, f_custom_theme); + objection_player->play("holdit", f_char, f_custom_theme); break; case 2: ui_vp_objection->play("objection_bubble", f_char, f_custom_theme, 724); - objection_player->play("objection.wav", f_char, f_custom_theme); + objection_player->play("objection", f_char, f_custom_theme); if(ao_app->objection_stop_music()) music_player->stop(); break; case 3: ui_vp_objection->play("takethat_bubble", f_char, f_custom_theme, 724); - objection_player->play("takethat.wav", f_char, f_custom_theme); + objection_player->play("takethat", f_char, f_custom_theme); break; //case 4 is AO2 only case 4: ui_vp_objection->play("custom", f_char, f_custom_theme, 724); - objection_player->play("custom.wav", f_char, f_custom_theme); + objection_player->play("custom", f_char, f_custom_theme); break; default: qDebug() << "W: Logic error in objection switch statement!"; @@ -2493,7 +2489,7 @@ void Courtroom::start_chat_ticking() QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]); - blip_player->set_blips(ao_app->get_sfx_suffix(f_gender)); + blip_player->set_blips(f_gender); //means text is currently ticking text_state = 1; @@ -2518,7 +2514,7 @@ void Courtroom::chat_tick() ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); } QString f_char = m_chatmessage[CHAR_NAME]; - QString f_custom_theme = ao_app->get_char_shouts(f_char); + QString f_custom_theme = ao_app->get_chat(f_char); ui_vp_chat_arrow->play("chat_arrow", f_char, f_custom_theme); //Chat stopped being processed, indicate that. additive_previous = additive_previous + filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt()); real_tick_pos = ui_vp_message->toPlainText().size(); @@ -3320,7 +3316,8 @@ void Courtroom::on_music_search_edited(QString p_text) if (p_text != "") { - QList clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 0); + //Search in metadata + QList clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1); foreach(QTreeWidgetItem* item, clist) { if (item->parent() != nullptr) //So the category shows up too diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index f38bbb5e..da14413b 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -527,16 +527,15 @@ QString AOApplication::get_sfx(QString p_identifier) QString AOApplication::get_sfx_suffix(QString sound_to_check) { - QString mp3_check = get_sounds_path(sound_to_check + ".mp3"); - QString opus_check = get_sounds_path(sound_to_check + ".opus"); - if (file_exists(opus_check)) - { + sound_to_check = get_sounds_path(sound_to_check); + if (file_exists(sound_to_check + ".opus")) return sound_to_check + ".opus"; - } - else if (file_exists(mp3_check)) - { + if (file_exists(sound_to_check + ".ogg")) + return sound_to_check + ".ogg"; + if (file_exists(sound_to_check + ".mp3")) return sound_to_check + ".mp3"; - } + if (file_exists(sound_to_check + ".mp4")) + return sound_to_check + ".mp4"; return sound_to_check + ".wav"; } @@ -599,7 +598,7 @@ QString AOApplication::get_char_name(QString p_char) if (f_result == "") return p_char; - else return f_result; + return f_result; } QString AOApplication::get_showname(QString p_char) @@ -611,7 +610,7 @@ QString AOApplication::get_showname(QString p_char) return ""; if (f_result == "") return p_char; - else return f_result; + return f_result; } QString AOApplication::get_char_side(QString p_char) @@ -620,7 +619,7 @@ QString AOApplication::get_char_side(QString p_char) if (f_result == "") return "wit"; - else return f_result; + return f_result; } QString AOApplication::get_gender(QString p_char) @@ -629,8 +628,14 @@ QString AOApplication::get_gender(QString p_char) if (f_result == "") return "sfx-blipmale"; - if (!file_exists(get_sfx(f_result))) - f_result = "sfx-blip" + f_result; + + if (!file_exists(get_sfx_suffix(get_sfx(f_result)))) + { + if (file_exists(get_sfx_suffix(get_sfx("blips/" + f_result)))) + return "blips/" + f_result; //Return the cool kids variant + + return "sfx-blip" + f_result; //Return legacy variant + } return f_result; } @@ -663,7 +668,7 @@ 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; + return f_result; } int AOApplication::get_preanim_duration(QString p_char, QString p_emote) @@ -672,7 +677,7 @@ int AOApplication::get_preanim_duration(QString p_char, QString p_emote) if (f_result == "") return -1; - else return f_result.toInt(); + return f_result.toInt(); } int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote) @@ -681,7 +686,7 @@ int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote) if (f_result == "") return -1; - else return f_result.toInt(); + return f_result.toInt(); } int AOApplication::get_emote_number(QString p_char) @@ -690,7 +695,7 @@ int AOApplication::get_emote_number(QString p_char) if (f_result == "") return 0; - else return f_result.toInt(); + return f_result.toInt(); } QString AOApplication::get_emote_comment(QString p_char, int p_emote) @@ -704,7 +709,7 @@ QString AOApplication::get_emote_comment(QString p_char, int p_emote) qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; return "normal"; } - else return result_contents.at(0); + return result_contents.at(0); } QString AOApplication::get_pre_emote(QString p_char, int p_emote) @@ -718,7 +723,7 @@ QString AOApplication::get_pre_emote(QString p_char, int p_emote) qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; return ""; } - else return result_contents.at(1); + return result_contents.at(1); } QString AOApplication::get_emote(QString p_char, int p_emote) @@ -732,7 +737,7 @@ QString AOApplication::get_emote(QString p_char, int p_emote) qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; return "normal"; } - else return result_contents.at(2); + return result_contents.at(2); } int AOApplication::get_emote_mod(QString p_char, int p_emote) @@ -746,7 +751,7 @@ int AOApplication::get_emote_mod(QString p_char, int p_emote) qDebug() << "W: misformatted char.ini: " << p_char << ", " << QString::number(p_emote); return 0; } - else return result_contents.at(3).toInt(); + return result_contents.at(3).toInt(); } int AOApplication::get_desk_mod(QString p_char, int p_emote) @@ -762,7 +767,7 @@ int AOApplication::get_desk_mod(QString p_char, int p_emote) if (string_result == "") return -1; - else return string_result.toInt(); + return string_result.toInt(); } QString AOApplication::get_sfx_name(QString p_char, int p_emote) @@ -771,7 +776,13 @@ QString AOApplication::get_sfx_name(QString p_char, int p_emote) if (f_result == "") return "1"; - else return f_result; + return f_result; +} + +QString AOApplication::get_emote_blip(QString p_char, int p_emote) +{ + QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundB"); + return f_result; } int AOApplication::get_sfx_delay(QString p_char, int p_emote) @@ -780,7 +791,7 @@ int AOApplication::get_sfx_delay(QString p_char, int p_emote) if (f_result == "") return 1; - else return f_result.toInt(); + return f_result.toInt(); } QString AOApplication::get_sfx_looping(QString p_char, QString p_sfx) @@ -789,7 +800,7 @@ QString AOApplication::get_sfx_looping(QString p_char, QString p_sfx) if (f_result == "") return "0"; - else return f_result; + return f_result; } QString AOApplication::get_sfx_frame(QString p_char, QString p_emote, int n_frame) @@ -798,7 +809,7 @@ QString AOApplication::get_sfx_frame(QString p_char, QString p_emote, int n_fram if (f_result == "") return ""; - else return f_result; + return f_result; } QString AOApplication::get_screenshake_frame(QString p_char, QString p_emote, int n_frame) @@ -807,7 +818,7 @@ QString AOApplication::get_screenshake_frame(QString p_char, QString p_emote, in if (f_result == "") return ""; - else return f_result; + return f_result; } QString AOApplication::get_flash_frame(QString p_char, QString p_emote, int n_frame) @@ -816,7 +827,7 @@ QString AOApplication::get_flash_frame(QString p_char, QString p_emote, int n_fr if (f_result == "") return ""; - else return f_result; + return f_result; } int AOApplication::get_text_delay(QString p_char, QString p_emote) @@ -825,7 +836,7 @@ int AOApplication::get_text_delay(QString p_char, QString p_emote) if (f_result == "") return -1; - else return f_result.toInt(); + return f_result.toInt(); } QStringList AOApplication::get_theme_effects() -- cgit From 963e32109503fe7bb83c5a4111913e1d489db608 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 4 Nov 2019 15:38:54 +0300 Subject: If def/pro/jud/hld/hlp are missing, put the character in pos wit instead of showing broken bg. --- src/courtroom.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 30c391f0..2efa34cb 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2701,7 +2701,7 @@ void Courtroom::set_scene(QString f_desk_mod, QString f_side) QString f_background = "witnessempty"; QString f_desk_image = "stand"; - if (f_side == "def") + if (f_side == "def" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("defenseempty")))) { f_background = "defenseempty"; if (is_ao2_bg) @@ -2709,7 +2709,7 @@ void Courtroom::set_scene(QString f_desk_mod, QString f_side) else f_desk_image = "bancodefensa"; } - else if (f_side == "pro") + else if (f_side == "pro" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("prosecutorempty")))) { f_background = "prosecutorempty"; if (is_ao2_bg) @@ -2717,17 +2717,17 @@ void Courtroom::set_scene(QString f_desk_mod, QString f_side) else f_desk_image = "bancoacusacion"; } - else if (f_side == "jud") + else if (f_side == "jud" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("judgestand")))) { f_background = "judgestand"; f_desk_image = "judgedesk"; } - else if (f_side == "hld") + else if (f_side == "hld" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("helperstand")))) { f_background = "helperstand"; f_desk_image = "helperdesk"; } - else if (f_side == "hlp") + else if (f_side == "hlp" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("prohelperstand")))) { f_background = "prohelperstand"; f_desk_image = "prohelperdesk"; -- cgit From a49c4a503bcdfd09b9bbda3552e1598a4d147f40 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 4 Nov 2019 16:10:54 +0300 Subject: add .opus support --- Attorney_Online.pro | 2 +- include/aoblipplayer.h | 1 + include/aomusicplayer.h | 1 + include/aosfxplayer.h | 1 + include/bassopus.h | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ src/aoblipplayer.cpp | 7 +++++-- src/aomusicplayer.cpp | 6 +++++- src/aosfxplayer.cpp | 5 ++++- 8 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 include/bassopus.h diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 6061cd95..ab61a55b 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -13,7 +13,6 @@ MOC_DIR = $$PWD/build SOURCES += $$files($$PWD/src/*.cpp) HEADERS += $$files($$PWD/include/*.h) - LIBS += -L$$PWD/lib DEFINES += DISCORD @@ -26,6 +25,7 @@ DEFINES += BASSAUDIO contains(DEFINES, BASSAUDIO) { LIBS += -lbass +LIBS += -lbassopus } #DEFINES += QTAUDIO diff --git a/include/aoblipplayer.h b/include/aoblipplayer.h index 9a428371..a848e806 100644 --- a/include/aoblipplayer.h +++ b/include/aoblipplayer.h @@ -3,6 +3,7 @@ #if defined(BASSAUDIO) #include "bass.h" +#include "bassopus.h" #elif defined(QTAUDIO) #include #endif diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 52c97c3e..1a535828 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -4,6 +4,7 @@ #if defined(BASSAUDIO) #include "bass.h" +#include "bassopus.h" #elif defined(QTAUDIO) #include #endif diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h index 112e3ec6..3ae8bdf1 100644 --- a/include/aosfxplayer.h +++ b/include/aosfxplayer.h @@ -3,6 +3,7 @@ #if defined(BASSAUDIO) #include "bass.h" +#include "bassopus.h" #elif defined(QTAUDIO) #include #endif diff --git a/include/bassopus.h b/include/bassopus.h new file mode 100644 index 00000000..4e48124f --- /dev/null +++ b/include/bassopus.h @@ -0,0 +1,52 @@ +/* + BASSOPUS 2.4 C/C++ header file + Copyright (c) 2012-2015 Un4seen Developments Ltd. + + See the BASSOPUS.CHM file for more detailed documentation +*/ + +#ifndef BASSOPUS_H +#define BASSOPUS_H + +#include "bass.h" + +#if BASSVERSION!=0x204 +#error conflicting BASS and BASSOPUS versions +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef BASSOPUSDEF +#define BASSOPUSDEF(f) WINAPI f +#endif + +// BASS_CHANNELINFO type +#define BASS_CTYPE_STREAM_OPUS 0x11200 + +// Additional attributes +#define BASS_ATTRIB_OPUS_ORIGFREQ 0x13000 +#define BASS_ATTRIB_OPUS_GAIN 0x13001 + +HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags); +HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user); +HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *procs, void *user); + +#ifdef __cplusplus +} + +#if defined(_WIN32) && !defined(NOBASSOVERLOADS) +static inline HSTREAM BASS_OPUS_StreamCreateFile(BOOL mem, const WCHAR *file, QWORD offset, QWORD length, DWORD flags) +{ + return BASS_OPUS_StreamCreateFile(mem, (const void*)file, offset, length, flags|BASS_UNICODE); +} + +static inline HSTREAM BASS_OPUS_StreamCreateURL(const WCHAR *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user) +{ + return BASS_OPUS_StreamCreateURL((const char*)url, offset, flags|BASS_UNICODE, proc, user); +} +#endif +#endif + +#endif diff --git a/src/aoblipplayer.cpp b/src/aoblipplayer.cpp index 5f4dc6cc..4c7bf7b0 100644 --- a/src/aoblipplayer.cpp +++ b/src/aoblipplayer.cpp @@ -15,7 +15,10 @@ void AOBlipPlayer::set_blips(QString p_sfx) { BASS_StreamFree(m_stream_list[n_stream]); - m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); + if (f_path.endsWith(".opus")) + m_stream_list[n_stream] = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); + else + m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); } set_volume_internal(m_volume); @@ -46,7 +49,7 @@ void AOBlipPlayer::set_volume(qreal p_value) void AOBlipPlayer::set_volume_internal(qreal p_value) { - float volume = p_value; + float volume = static_cast(p_value); for (int n_stream = 0 ; n_stream < 5 ; ++n_stream) { diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 49cf089c..9a96b3eb 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -26,7 +26,11 @@ void AOMusicPlayer::play(QString p_song, int channel, bool loop, int effect_flag if (loop) flags |= BASS_SAMPLE_LOOP; - DWORD newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); + DWORD newstream; + if (f_path.endsWith(".opus")) + newstream = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); + else + newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); if (ao_app->get_audio_output_device() != "default") BASS_ChannelSetDevice(m_stream_list[channel], BASS_GetDevice()); diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index cc019725..98496eaa 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -59,7 +59,10 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, int channel if (!file_exists(f_path)) f_path = ao_app->get_sfx_suffix(f_path); //If we're not given a sound file with .wav/.ogg/.opus already there, let's do this thing - m_stream_list[channel] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + if (f_path.endsWith(".opus")) + m_stream_list[channel] = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + else + m_stream_list[channel] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); set_volume_internal(m_volume); -- cgit From d40292125710e2e6698ffad7f4a7d7dcc41eace6 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 4 Nov 2019 16:31:42 +0300 Subject: Fix screenshaking only shaking down right --- src/courtroom.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 2efa34cb..4eb12879 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1912,8 +1912,9 @@ void Courtroom::do_screenshake() { double fraction = double(frame*frequency)/duration; int rng = qrand();//QRandomGenerator::global()->generate(); - int rand_x = int(rng) % max_x; - int rand_y = int(rng+100) % max_y; + int rand_x = max_x - (int(rng) % (max_x*2)); + int rand_y = max_y - (int(rng+100) % (max_y*2)); + qDebug() << rand_x << rand_y; screenshake_animation->setKeyValueAt(fraction, QPoint(pos_default.x() + rand_x, pos_default.y() + rand_y)); } screenshake_animation->setEndValue(pos_default); @@ -2456,13 +2457,6 @@ void Courtroom::start_chat_ticking() this->do_flash(); sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); } - - int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); //text meme bonanza - if ((emote_mod == 0 || emote_mod == 5) && m_chatmessage[SCREENSHAKE] == "1") - { - this->do_screenshake(); - } - if (chatmessage_is_empty) { //since the message is empty, it's technically done ticking @@ -2491,6 +2485,12 @@ void Courtroom::start_chat_ticking() blip_player->set_blips(f_gender); + int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); //text meme bonanza + if ((emote_mod == 0 || emote_mod == 5) && m_chatmessage[SCREENSHAKE] == "1") + { + this->do_screenshake(); + } + //means text is currently ticking text_state = 1; } -- cgit From 9939637dda8cf09fc4e1620378fc5ac5de8885f6 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 4 Nov 2019 17:13:52 +0300 Subject: Fix the sound bonanza so they actually play sfx player and blip player now both account for extension-less sound paths and also correctly handle paths that do provide the extension. --- src/aoblipplayer.cpp | 2 +- src/aosfxplayer.cpp | 9 +++------ src/courtroom.cpp | 8 +++----- src/text_file_functions.cpp | 9 ++++++--- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/aoblipplayer.cpp b/src/aoblipplayer.cpp index 4c7bf7b0..008ff16a 100644 --- a/src/aoblipplayer.cpp +++ b/src/aoblipplayer.cpp @@ -9,7 +9,7 @@ AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app) void AOBlipPlayer::set_blips(QString p_sfx) { - QString f_path = ao_app->get_sounds_path(p_sfx); + QString f_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx)); for (int n_stream = 0 ; n_stream < 5 ; ++n_stream) { diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index 98496eaa..9fa3026f 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -40,12 +40,12 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, int channel QString misc_path = ""; QString char_path = ""; - QString sound_path = ao_app->get_sounds_path(p_sfx); + QString sound_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx)); if (shout != "") - misc_path = ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx; + misc_path = ao_app->get_sfx_suffix(ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx); if (p_char != "") - char_path = ao_app->get_character_path(p_char, p_sfx); + char_path = ao_app->get_sfx_suffix(ao_app->get_character_path(p_char, p_sfx)); QString f_path; @@ -56,9 +56,6 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, int channel else f_path = sound_path; - if (!file_exists(f_path)) - f_path = ao_app->get_sfx_suffix(f_path); //If we're not given a sound file with .wav/.ogg/.opus already there, let's do this thing - if (f_path.endsWith(".opus")) m_stream_list[channel] = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); else diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 4eb12879..08acc5e8 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1818,7 +1818,6 @@ void Courtroom::handle_chatmessage_2() int other_offset = m_chatmessage[OTHER_OFFSET].toInt(); ui_vp_sideplayer_char->move(ui_viewport->width() * other_offset / 100, 0); - qDebug() << "other offset" << other_offset; QStringList args = m_chatmessage[OTHER_CHARID].split("^"); if (args.size() > 1) //This ugly workaround is so we don't make an extra packet just for this purpose. Rewrite pairing when? @@ -1914,7 +1913,6 @@ void Courtroom::do_screenshake() int rng = qrand();//QRandomGenerator::global()->generate(); int rand_x = max_x - (int(rng) % (max_x*2)); int rand_y = max_y - (int(rng+100) % (max_y*2)); - qDebug() << rand_x << rand_y; screenshake_animation->setKeyValueAt(fraction, QPoint(pos_default.x() + rand_x, pos_default.y() + rand_y)); } screenshake_animation->setEndValue(pos_default); @@ -1947,12 +1945,12 @@ void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char) ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping. Static effects will linger. ui_vp_effect->play(effect); // It will set_play_once to true if the filepath provided is not designed to loop more than once if (fx_sound != "") - sfx_player->play(ao_app->get_sfx_suffix(fx_sound)); + sfx_player->play(fx_sound); } void Courtroom::play_char_sfx(QString sfx_name) { - sfx_player->play(ao_app->get_sfx_suffix(sfx_name)); + sfx_player->play(sfx_name); if(ao_app->get_looping_sfx()) sfx_player->set_looping(ao_app->get_sfx_looping(current_char, QString::number(current_emote))!="0"); } @@ -2690,7 +2688,7 @@ void Courtroom::play_sfx() if (sfx_name == "1") return; - sfx_player->play(ao_app->get_sfx_suffix(sfx_name)); + sfx_player->play(sfx_name); if(ao_app->get_looping_sfx()) sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name)!="0"); } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index da14413b..41b20f3a 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -527,7 +527,8 @@ QString AOApplication::get_sfx(QString p_identifier) QString AOApplication::get_sfx_suffix(QString sound_to_check) { - sound_to_check = get_sounds_path(sound_to_check); + if (sound_to_check.contains(".")) //We have what we could call a file extension + return sound_to_check; if (file_exists(sound_to_check + ".opus")) return sound_to_check + ".opus"; if (file_exists(sound_to_check + ".ogg")) @@ -541,6 +542,8 @@ QString AOApplication::get_sfx_suffix(QString sound_to_check) QString AOApplication::get_image_suffix(QString path_to_check) { + if (path_to_check.contains(".")) //We have what we could call a file extension + return path_to_check; if (file_exists(path_to_check + ".webp")) return path_to_check + ".webp"; if (file_exists(path_to_check + ".apng")) @@ -629,9 +632,9 @@ QString AOApplication::get_gender(QString p_char) if (f_result == "") return "sfx-blipmale"; - if (!file_exists(get_sfx_suffix(get_sfx(f_result)))) + if (!file_exists(get_sfx_suffix(get_sounds_path(f_result)))) { - if (file_exists(get_sfx_suffix(get_sfx("blips/" + f_result)))) + if (file_exists(get_sfx_suffix(get_sounds_path("blips/" + f_result)))) return "blips/" + f_result; //Return the cool kids variant return "sfx-blip" + f_result; //Return legacy variant -- cgit From 886ec26e2095bdcb18a05b57cb7c302be0d906c6 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 4 Nov 2019 17:14:46 +0300 Subject: "temporarily" simplify code by stripping long since botched and unused AO1 backwards compatibility --- src/courtroom.cpp | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 08acc5e8..db48e512 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2702,18 +2702,12 @@ void Courtroom::set_scene(QString f_desk_mod, QString f_side) if (f_side == "def" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("defenseempty")))) { f_background = "defenseempty"; - if (is_ao2_bg) - f_desk_image = "defensedesk"; - else - f_desk_image = "bancodefensa"; + f_desk_image = "defensedesk"; } else if (f_side == "pro" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("prosecutorempty")))) { f_background = "prosecutorempty"; - if (is_ao2_bg) - f_desk_image = "prosecutiondesk"; - else - f_desk_image = "bancoacusacion"; + f_desk_image = "prosecutiondesk"; } else if (f_side == "jud" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("judgestand")))) { @@ -2740,13 +2734,6 @@ void Courtroom::set_scene(QString f_desk_mod, QString f_side) f_background = "seancestand"; f_desk_image = "seancedesk"; } - else - { - if (is_ao2_bg) - f_desk_image = "stand"; - else - f_desk_image = "estrado"; - } if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path(f_side)))) //Unique pos path { @@ -2766,26 +2753,11 @@ void Courtroom::set_scene(QString f_desk_mod, QString f_side) ui_vp_desk->hide(); ui_vp_legacy_desk->hide(); } - else if (is_ao2_bg || (f_side == "jud" || - f_side == "hld" || - f_side == "hlp")) + else { 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_ip_list(QString p_list) -- cgit From 34848c4eaf8df62719045889a55be4c9ac2419a8 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 18 Nov 2019 20:27:37 +0300 Subject: Fix a bug where user would be unable to speak if the BG changed when someone else was speaking Make it so blip sounds are accessed in base/sounds/blips/* if such a path exists --- src/courtroom.cpp | 7 +++++++ src/text_file_functions.cpp | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index db48e512..1a1fd9ed 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1028,7 +1028,14 @@ void Courtroom::set_background(QString p_background, bool display) ui_vp_message->hide(); ui_vp_chatbox->hide(); + //Stop the chat arrow from animating + ui_vp_chat_arrow->stop(); + + text_state = 0; + anim_state = 0; + ui_vp_objection->stop(); chat_tick_timer->stop(); + ui_vp_evidence_display->reset(); set_scene(QString::number(ao_app->get_desk_mod(current_char, current_emote)), current_side); } } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 41b20f3a..783c83b9 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -634,8 +634,8 @@ QString AOApplication::get_gender(QString p_char) if (!file_exists(get_sfx_suffix(get_sounds_path(f_result)))) { - if (file_exists(get_sfx_suffix(get_sounds_path("blips/" + f_result)))) - return "blips/" + f_result; //Return the cool kids variant + if (file_exists(get_sfx_suffix(get_sounds_path("../blips/" + f_result)))) + return "../blips/" + f_result; //Return the cool kids variant return "sfx-blip" + f_result; //Return legacy variant } -- cgit From 159f073514e2f60fd2229f21f7a536ffaddecfc2 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 21 Nov 2019 00:23:35 +0300 Subject: Set version to 2.8.1 woop woop --- Attorney_Online.pro | 2 +- include/aoapplication.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index ab61a55b..97eaf51e 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -3,7 +3,7 @@ QT += core gui widgets network TARGET = Attorney_Online TEMPLATE = app -VERSION = 2.8.0.5 +VERSION = 2.8.1.0 INCLUDEPATH += $$PWD/include DESTDIR = $$PWD/bin diff --git a/include/aoapplication.h b/include/aoapplication.h index 8dd48c6a..fe1a5b75 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -396,7 +396,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 8; - const int MINOR_VERSION = 0; + const int MINOR_VERSION = 1; QString current_theme = "default"; -- cgit From 07763c5ac0914d1255c4b28b29f14825ac810282 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 22 Nov 2019 00:31:17 +0300 Subject: actually fix the chat instead of breaking it --- src/courtroom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 1a1fd9ed..0695fe7c 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1031,8 +1031,8 @@ void Courtroom::set_background(QString p_background, bool display) //Stop the chat arrow from animating ui_vp_chat_arrow->stop(); - text_state = 0; - anim_state = 0; + text_state = 2; + anim_state = 3; ui_vp_objection->stop(); chat_tick_timer->stop(); ui_vp_evidence_display->reset(); -- cgit From eb014a97785db4a196d41fb38ee61612a54e0f6e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 5 Dec 2019 22:46:26 +0300 Subject: Add a message delay modifier when punctuation is reached to simulate Ace Attorney 1 chat parsing (replicating the effect where characters would make a short pause, as if saying the line out loud) TODO: Make this a configurable thing --- include/courtroom.h | 6 ++++++ src/courtroom.cpp | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/courtroom.h b/include/courtroom.h index ea841229..6bca28e4 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -332,6 +332,12 @@ private: //the amount of time non-animated witness testimony/cross-examination images stay onscreen for in ms const int wtce_stay_time = 1500; + //characters we consider punctuation + const QString punctuation_chars = ".,?!:;"; + + //amount by which we multiply the delay when we parse punctuation chars + const int punctuation_modifier = 3; + static const int chatmessage_size = 30; QString m_chatmessage[chatmessage_size]; bool chatmessage_is_empty = false; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 0695fe7c..f4f513a2 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2638,6 +2638,7 @@ void Courtroom::chat_tick() } else { + int msg_delay = message_display_speed[current_display_speed]; //Do the colors, gradual showing, etc. in here ui_vp_message->setHtml(additive_previous + filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt())); @@ -2667,6 +2668,12 @@ void Courtroom::chat_tick() ++blip_ticker; } + //Punctuation delayer + if (punctuation_chars.contains(f_character)) + { + msg_delay *= punctuation_modifier; + } + //If this color is talking if (color_is_talking && anim_state != 2 && anim_state < 4) //Set it to talking as we're not on that already (though we have to avoid interrupting a non-interrupted preanim) { @@ -2681,7 +2688,7 @@ void Courtroom::chat_tick() anim_state = 3; } //Continue ticking - chat_tick_timer->start(message_display_speed[current_display_speed]); + chat_tick_timer->start(msg_delay); } } -- cgit From d7e1ebeb0cd149036eeafb6452499667f7f876ff Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 6 Dec 2019 16:50:46 +0300 Subject: Update readme with wiki link --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b0da92d..cccd9853 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # Attorney Online [Attorney Online](https://aceattorneyonline.com) is an online version of the world-renowned courtroom drama simulator that allows you to create and play out cases in an off-the-cuff format. -Refer to the Wiki for more information. + +## [Refer to the Wiki](https://github.com/Crystalwarrior/KFO-Client/wiki) for more information. --- -- cgit From 819d0911715065dc0d908964888a57a3f7164180 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 27 Dec 2019 01:04:48 +0300 Subject: UGH I BROKE BACKWARDS COMPATIBILITY NOW I'M SCRAMBLING TO FIX IT --- src/courtroom.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index f4f513a2..12673ef9 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3850,12 +3850,11 @@ void Courtroom::music_list_collapse_all() void Courtroom::on_area_list_double_clicked(QTreeWidgetItem *p_item, int column) { - column = 0; //Column 0 is the area name, column 1 is the metadata - QString p_area = p_item->text(column); - + int p_area = ui_area_list->indexOfTopLevelItem(p_item); QStringList packet_contents; - packet_contents.append(p_area); + packet_contents.append(QString::number(p_area)); packet_contents.append(QString::number(m_cid)); + qDebug() << packet_contents; ao_app->send_server_packet(new AOPacket("MC", packet_contents), false); } -- cgit From 7518ed8a00f57f2b850a00004d1699b4b939f79a Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 27 Dec 2019 01:20:15 +0300 Subject: excuse me what the fuck --- src/courtroom.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 12673ef9..6faebe99 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1272,7 +1272,7 @@ void Courtroom::list_areas() { QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_area_list); treeItem->setText(0, i_area); - treeItem->setText(1, QString::number(n_area)); + treeItem->setText(1, area_list.at(n_area)); if (ao_app->arup_enabled) { @@ -3850,9 +3850,11 @@ void Courtroom::music_list_collapse_all() void Courtroom::on_area_list_double_clicked(QTreeWidgetItem *p_item, int column) { - int p_area = ui_area_list->indexOfTopLevelItem(p_item); + column = 1; //The metadata + QString p_area = p_item->text(1); + QStringList packet_contents; - packet_contents.append(QString::number(p_area)); + packet_contents.append(p_area); packet_contents.append(QString::number(m_cid)); qDebug() << packet_contents; ao_app->send_server_packet(new AOPacket("MC", packet_contents), false); -- cgit From 59e8a72a50433e54817a5684be229d3a43bd508e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 28 Dec 2019 05:47:33 +0300 Subject: Allow colors in server chatlogs --- src/courtroom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 6faebe99..b2482ada 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2296,7 +2296,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); if (!is_songchange) - p_text = filter_ic_text(p_text, false); + p_text = filter_ic_text(p_text, true, -1, m_chatmessage[TEXT_COLOR].toInt()); if (log_goes_downwards) { @@ -2322,7 +2322,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang else { ui_ic_chatlog->textCursor().insertText(": ", normal); - ui_ic_chatlog->textCursor().insertText(p_text, normal); + ui_ic_chatlog->textCursor().insertHtml(p_text); } // If we got too many blocks in the current log, delete some from the top. -- cgit From 8791109c6609e9b188b74f3b879501081312dab8 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 3 Jan 2020 22:34:22 +0300 Subject: Remove borders for chatlogs --- src/courtroom.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index b2482ada..937cfc52 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -547,10 +547,13 @@ void Courtroom::set_widgets() ui_vp_objection->combo_resize(ui_viewport->width(), ui_viewport->height()); set_size_and_pos(ui_ic_chatlog, "ic_chatlog"); + ui_ic_chatlog->setFrameShape(QFrame::NoFrame); set_size_and_pos(ui_ms_chatlog, "ms_chatlog"); + ui_ms_chatlog->setFrameShape(QFrame::NoFrame); set_size_and_pos(ui_server_chatlog, "server_chatlog"); + ui_server_chatlog->setFrameShape(QFrame::NoFrame); set_size_and_pos(ui_mute_list, "mute_list"); ui_mute_list->hide(); -- cgit From f30013f7f9d9ecb840948b99663e8b1e81a6971c Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 15 Jan 2020 16:06:27 +0300 Subject: i am REtArd Fixed a major bug that crashed the clients on chatting + broke a lot of assets because of a single `.` boi anywhere in the filepath. --- src/aocharmovie.cpp | 3 +++ src/text_file_functions.cpp | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 9bbb8761..0ce5c868 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -50,6 +50,9 @@ void AOCharMovie::load_image(QString p_char, QString p_emote, QString emote_pref movie_delays.clear(); movie_effects.clear(); + if (!file_exists(emote_path)) + return; + m_reader->setFileName(emote_path); QPixmap f_pixmap = this->get_pixmap(m_reader->read()); int f_delay = m_reader->nextImageDelay(); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 783c83b9..2c9d5e9b 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -527,7 +527,7 @@ QString AOApplication::get_sfx(QString p_identifier) QString AOApplication::get_sfx_suffix(QString sound_to_check) { - if (sound_to_check.contains(".")) //We have what we could call a file extension + if (file_exists(sound_to_check)) return sound_to_check; if (file_exists(sound_to_check + ".opus")) return sound_to_check + ".opus"; @@ -542,7 +542,7 @@ QString AOApplication::get_sfx_suffix(QString sound_to_check) QString AOApplication::get_image_suffix(QString path_to_check) { - if (path_to_check.contains(".")) //We have what we could call a file extension + if (file_exists(path_to_check)) return path_to_check; if (file_exists(path_to_check + ".webp")) return path_to_check + ".webp"; -- cgit From 6138bb107b5ab4d882e9ceb75e1394c2b8ec82a3 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 15 Jan 2020 16:42:44 +0300 Subject: Separate screenshake options button from effects options button Add a color logging option button Update version to 2.8.2 --- Attorney_Online.pro | 2 +- include/aoapplication.h | 14 +++++++++++--- include/aooptionsdialog.h | 9 +++++++-- src/aooptionsdialog.cpp | 45 ++++++++++++++++++++++++++++++++++++--------- src/courtroom.cpp | 17 ++++++++++------- src/text_file_functions.cpp | 16 ++++++++++++++-- 6 files changed, 79 insertions(+), 24 deletions(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 97eaf51e..cb6727f8 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -3,7 +3,7 @@ QT += core gui widgets network TARGET = Attorney_Online TEMPLATE = app -VERSION = 2.8.1.0 +VERSION = 2.8.2.0 INCLUDEPATH += $$PWD/include DESTDIR = $$PWD/bin diff --git a/include/aoapplication.h b/include/aoapplication.h index fe1a5b75..0ab6831b 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -172,14 +172,22 @@ public: // from the config.ini. bool is_discord_enabled(); - // Returns the value of whether shaking and flashing should be enabled. + // Returns the value of whether shaking should be enabled. // from the config.ini. - bool is_shake_flash_enabled(); + bool is_shake_enabled(); + + // Returns the value of whether effects should be enabled. + // from the config.ini. + bool is_effects_enabled(); // Returns the value of whether frame-specific effects defined in char.ini should be sent/received over the network. // from the config.ini. bool is_frame_network_enabled(); + // Returns the value of whether colored ic log should be a thing. + // from the config.ini. + bool is_colorlog_enabled(); + // Returns the value of the maximum amount of lines the IC chatlog // may contain, from config.ini. int get_max_log_size(); @@ -396,7 +404,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 8; - const int MINOR_VERSION = 1; + const int MINOR_VERSION = 2; QString current_theme = "default"; diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 51984106..9e34e651 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -65,11 +65,16 @@ private: QLabel *ui_language_label; QComboBox *ui_language_combobox; - QLabel *ui_epilepsy_lbl; - QCheckBox *ui_epilepsy_cb; + QLabel *ui_shake_lbl; + QCheckBox *ui_shake_cb; + QLabel *ui_effects_lbl; + QCheckBox *ui_effects_cb; QLabel *ui_framenetwork_lbl; QCheckBox *ui_framenetwork_cb; + QLabel *ui_colorlog_lbl; + QCheckBox *ui_colorlog_cb; + QWidget *ui_callwords_tab; QWidget *ui_callwords_widget; QVBoxLayout *ui_callwords_layout; diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 37694e4e..ad1042f5 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -195,16 +195,28 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_language_combobox); row += 1; - 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_shake_lbl = new QLabel(ui_form_layout_widget); + ui_shake_lbl->setText(tr("Allow Screenshake:")); + ui_shake_lbl->setToolTip(tr("Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures.")); - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_epilepsy_lbl); + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_shake_lbl); - ui_epilepsy_cb = new QCheckBox(ui_form_layout_widget); - ui_epilepsy_cb->setChecked(ao_app->is_shake_flash_enabled()); + ui_shake_cb = new QCheckBox(ui_form_layout_widget); + ui_shake_cb->setChecked(ao_app->is_shake_enabled()); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_epilepsy_cb); + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_shake_cb); + + row += 1; + ui_effects_lbl = new QLabel(ui_form_layout_widget); + ui_effects_lbl->setText(tr("Allow Effects:")); + ui_effects_lbl->setToolTip(tr("Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_effects_lbl); + + ui_effects_cb = new QCheckBox(ui_form_layout_widget); + ui_effects_cb->setChecked(ao_app->is_effects_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_effects_cb); row += 1; ui_framenetwork_lbl = new QLabel(ui_form_layout_widget); @@ -214,10 +226,22 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_framenetwork_lbl); ui_framenetwork_cb = new QCheckBox(ui_form_layout_widget); - ui_framenetwork_cb->setChecked(ao_app->is_shake_flash_enabled()); + ui_framenetwork_cb->setChecked(ao_app->is_frame_network_enabled()); ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_framenetwork_cb); + row += 1; + ui_colorlog_lbl = new QLabel(ui_form_layout_widget); + ui_colorlog_lbl->setText(tr("Colors in IC Log:")); + ui_colorlog_lbl->setToolTip(tr("Use the markup colors in the server IC chatlog.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_colorlog_lbl); + + ui_colorlog_cb = new QCheckBox(ui_form_layout_widget); + ui_colorlog_cb->setChecked(ao_app->is_colorlog_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_colorlog_cb); + QScrollArea *scroll = new QScrollArea; scroll->setWidget(ui_form_layout_widget); ui_gameplay_tab->setLayout(new QVBoxLayout); @@ -571,8 +595,11 @@ void AOOptionsDialog::save_pressed() configini->setValue("master", ui_ms_textbox->text()); configini->setValue("discord", ui_discord_cb->isChecked()); configini->setValue("language", ui_language_combobox->currentText().left(2)); - configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked()); + configini->setValue("shake", ui_shake_cb->isChecked()); + configini->setValue("effects", ui_effects_cb->isChecked()); configini->setValue("framenetwork", ui_framenetwork_cb->isChecked()); + configini->setValue("colorlog", ui_colorlog_cb->isChecked()); + QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 937cfc52..283611f3 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1889,7 +1889,7 @@ void Courtroom::handle_chatmessage_2() void Courtroom::do_screenshake() { - if(!ao_app->is_shake_flash_enabled()) + if(!ao_app->is_shake_enabled()) return; //This way, the animation is reset in such a way that last played screenshake would return to its "final frame" properly. @@ -1935,7 +1935,7 @@ void Courtroom::do_screenshake() void Courtroom::do_flash() { - if(!ao_app->is_shake_flash_enabled()) + if(!ao_app->is_effects_enabled()) return; QString f_char = m_chatmessage[CHAR_NAME]; @@ -1945,17 +1945,20 @@ void Courtroom::do_flash() void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char) { - if(!ao_app->is_shake_flash_enabled()) - return; QString effect = ao_app->get_effect(fx_name, p_char); if (effect == "") return; - ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping. Static effects will linger. - ui_vp_effect->play(effect); // It will set_play_once to true if the filepath provided is not designed to loop more than once if (fx_sound != "") sfx_player->play(fx_sound); + + //Only check if effects are disabled after playing the sound if it exists + if(!ao_app->is_effects_enabled()) + return; + + ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping. Static effects will linger. + ui_vp_effect->play(effect); // It will set_play_once to true if the filepath provided is not designed to loop more than once } void Courtroom::play_char_sfx(QString sfx_name) @@ -2299,7 +2302,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); if (!is_songchange) - p_text = filter_ic_text(p_text, true, -1, m_chatmessage[TEXT_COLOR].toInt()); + p_text = filter_ic_text(p_text, ao_app->is_colorlog_enabled(), -1, m_chatmessage[TEXT_COLOR].toInt()); if (log_goes_downwards) { diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 2c9d5e9b..bb5d7dea 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -960,9 +960,15 @@ bool AOApplication::is_discord_enabled() return result.startsWith("true"); } -bool AOApplication::is_shake_flash_enabled() +bool AOApplication::is_shake_enabled() { - QString result = configini->value("shakeandflash", "true").value(); + QString result = configini->value("shake", "true").value(); + return result.startsWith("true"); +} + +bool AOApplication::is_effects_enabled() +{ + QString result = configini->value("effects", "true").value(); return result.startsWith("true"); } @@ -972,6 +978,12 @@ bool AOApplication::is_frame_network_enabled() return result.startsWith("true"); } +bool AOApplication::is_colorlog_enabled() +{ + QString result = configini->value("colorlog", "true").value(); + return result.startsWith("true"); +} + bool AOApplication::get_casing_enabled() { QString result = configini->value("casing_enabled", "false").value(); -- cgit From 43c4e3e9d703a0b7d48b634d6970906dcb5709b2 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 17 Jan 2020 18:41:27 +0300 Subject: Network effects folder so you don't need to modify your own char.ini to see custom effects --- include/aoapplication.h | 2 +- include/courtroom.h | 2 +- src/courtroom.cpp | 19 ++++++++++++++----- src/text_file_functions.cpp | 7 +++++-- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 0ab6831b..9f110874 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -317,7 +317,7 @@ public: QStringList get_effects(QString p_char); //t - QString get_effect(QString effect, QString p_char); + QString get_effect(QString effect, QString p_char, QString p_folder); //Return the effect sound associated with the fx_name in the misc/effects//sounds.ini, or theme/effects/sounds.ini. QString get_effect_sound(QString fx_name, QString p_char); diff --git a/include/courtroom.h b/include/courtroom.h index 6bca28e4..d2044172 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -625,7 +625,7 @@ public slots: void preanim_done(); void do_screenshake(); void do_flash(); - void do_effect(QString fx_path, QString fx_sound, QString p_char); + void do_effect(QString fx_path, QString fx_sound, QString p_char, QString p_folder); void play_char_sfx(QString sfx_name); void mod_called(QString p_ip); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 283611f3..81e043ef 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1,4 +1,4 @@ -#include "courtroom.h" +#include "courtroom.h" Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() @@ -1545,7 +1545,8 @@ void Courtroom::on_chat_return_pressed() if (ao_app->effects_enabled) { QString fx_sound = ao_app->get_effect_sound(effect, current_char); - packet_contents.append(effect + "|" + fx_sound); + QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); + packet_contents.append(effect + "|" + p_effect + "|" + fx_sound); ui_effects_dropdown->blockSignals(true); ui_effects_dropdown->setCurrentIndex(0); ui_effects_dropdown->blockSignals(false); @@ -1943,10 +1944,10 @@ void Courtroom::do_flash() ui_vp_effect->play("realizationflash", f_char, f_custom_theme, 60); } -void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char) +void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char, QString p_folder) { - QString effect = ao_app->get_effect(fx_name, p_char); + QString effect = ao_app->get_effect(fx_name, p_char, p_folder); if (effect == "") return; @@ -2458,10 +2459,18 @@ void Courtroom::start_chat_ticking() QStringList fx_list = m_chatmessage[EFFECTS].split("|"); QString fx = fx_list[0]; QString fx_sound; + QString fx_folder; + if (fx_list.length() > 1) fx_sound = fx_list[1]; - this->do_effect(fx, fx_sound, m_chatmessage[CHAR_NAME]); + if (fx_list.length() > 2) + { + fx_folder = fx_list[1]; + fx_sound = fx_list[2]; + } + + this->do_effect(fx, fx_sound, m_chatmessage[CHAR_NAME], fx_folder); } else if (m_chatmessage[REALIZATION] == "1") { diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index bb5d7dea..49bf61f7 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -885,9 +885,12 @@ QStringList AOApplication::get_effects(QString p_char) return effects; } -QString AOApplication::get_effect(QString effect, QString p_char) +QString AOApplication::get_effect(QString effect, QString p_char, QString p_folder) { - QString p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_effect = p_folder; + if (p_folder == "") + p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_path = get_image_suffix(get_base_path() + "misc/" + p_effect + "/" + effect); QString design_ini_path = get_image_suffix(get_theme_path("effects/" + effect)); QString default_path = get_image_suffix(get_default_theme_path("effects/" + effect)); -- cgit From 9df7b9648ae1bd694f99fa6748eee547752b6c9c Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 20 Feb 2020 00:32:37 +0300 Subject: Remove QtApng dependency --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index cccd9853..4dc6956a 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ The traditional route is by undergoing the [AO2 Rite of Passage](https://gist.gi ### Dependencies -- [QtApng](https://github.com/Skycoder42/QtApng) - [BASS](http://un4seen.com) (proprietary, but will become optional in the future; see #35) - [Discord Rich Presence](https://github.com/discordapp/discord-rpc) -- cgit From a4e448576b43b9cf4f984253abb3daf7296aa154 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 24 Feb 2020 22:20:43 +0300 Subject: Make pos dropdown more abstract and actually useful by letting servers send only pos you can actually access. Pos dropdown system also reads the actual bg folder of the current BG to see all the created pos. --- include/courtroom.h | 6 ++++ src/courtroom.cpp | 79 +++++++++++++++++++++------------------------ src/packet_distribution.cpp | 9 ++++++ 3 files changed, 51 insertions(+), 43 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index d2044172..417d4557 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -159,6 +159,9 @@ public: //sets the local character pos/side to use. void set_side(QString p_side); + //sets the pos dropdown + void set_pos_dropdown(QStringList pos_dropdowns); + //sets the evidence list member variable to argument void set_evidence_list(QVector &p_evi_list); @@ -394,6 +397,9 @@ private: QVector color_markdown_talking_list; //Text Color-related optimization END + //List of all currently available pos + QStringList pos_dropdown_list; + bool is_presenting_evidence = false; QString effect = ""; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 81e043ef..ea6f1659 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -180,14 +180,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() initialize_emotes(); 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_iniswap_dropdown = new QComboBox(this); ui_iniswap_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); @@ -1005,10 +997,32 @@ void Courtroom::set_background(QString p_background, bool display) ui_vp_testimony->stop(); current_background = p_background; + //welcome to hardcode central may I take your order of regularly scheduled CBT + QMap default_pos; + default_pos["defenseempty"] = "def"; + default_pos["helperstand"] = "hld"; + default_pos["prosecutorempty"] = "pro"; + default_pos["prohelperstand"] = "hlp"; + default_pos["witnessempty"] = "wit"; + default_pos["judgestand"] = "jud"; + default_pos["jurystand"] = "jur"; + default_pos["seancestand"] = "sea"; + + //Populate the dropdown list with all pos that exist on this bg + QStringList pos_list = {}; + for (QString key : default_pos.keys()) + { + if (file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path(key)))) + { + pos_list.append(default_pos[key]); + } + } + + //TODO: search through extra/custom pos and add them to the pos dropdown as well + + set_pos_dropdown(pos_list); + is_ao2_bg = true; -// file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("defensedesk"))) && -// file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("prosecutiondesk"))) && -// file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path("stand"))); if (is_ao2_bg) { @@ -1070,6 +1084,13 @@ void Courtroom::set_side(QString p_side) } } +void Courtroom::set_pos_dropdown(QStringList pos_dropdowns) +{ + pos_dropdown_list = pos_dropdowns; + ui_pos_dropdown->clear(); + ui_pos_dropdown->addItems(pos_dropdown_list); + qDebug() << pos_dropdown_list; +} void Courtroom::update_character(int p_cid) { @@ -3336,42 +3357,14 @@ void Courtroom::on_pos_dropdown_changed(int p_index) 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 = ""; - } + QString f_pos = ui_pos_dropdown->itemText(p_index); if (f_pos == "") return; + if (f_pos == "jud") + toggle_judge_buttons(true); + //YEAH SENDING LIKE 20 PACKETS IF THE USER SCROLLS THROUGH, GREAT IDEA //how about this instead set_side(f_pos); diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 8c74b768..23050836 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -595,7 +595,16 @@ void AOApplication::server_packet_received(AOPacket *p_packet) goto end; if (courtroom_constructed) //We were sent a "set position" packet + { w_courtroom->set_side(f_contents.at(0)); + } + } + else if (header == "SD") //Send pos dropdown + { + if (f_contents.size() < 1) + goto end; + + w_courtroom->set_pos_dropdown(f_contents.at(0).split("*")); } //server accepting char request(CC) packet else if (header == "PV") -- cgit From 39f9d1043e7f362275a189d71066ca642753f86f Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 5 Mar 2020 21:23:42 +0300 Subject: Add sorting by name for lobby --- include/lobby.h | 9 ++++--- src/lobby.cpp | 75 ++++++++++++++++++++++++++++++++++++--------------------- 2 files changed, 52 insertions(+), 32 deletions(-) diff --git a/include/lobby.h b/include/lobby.h index e0cd03da..4b95fb2f 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -64,7 +65,7 @@ private: QLabel *ui_version; AOButton *ui_about; - QListWidget *ui_server_list; + QTreeWidget *ui_server_list; QLabel *ui_player_count; AOTextArea *ui_description; @@ -79,7 +80,7 @@ private: QProgressBar *ui_progress_bar; AOButton *ui_cancel; - QModelIndex last_model; + int last_index; void set_size_and_pos(QWidget *p_widget, QString p_identifier); @@ -94,8 +95,8 @@ private slots: void on_connect_pressed(); void on_connect_released(); void on_about_clicked(); - void on_server_list_clicked(QModelIndex p_model); - void on_server_list_doubleclicked(QModelIndex p_model); + void on_server_list_clicked(QTreeWidgetItem* p_item, int column); + void on_server_list_doubleclicked(QTreeWidgetItem* p_item, int column); void on_chatfield_return_pressed(); }; diff --git a/src/lobby.cpp b/src/lobby.cpp index 7c61aa7e..22033372 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -20,7 +20,11 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() 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_server_list = new QTreeWidget(this); + ui_server_list->setHeaderLabels({"#", "Name"});//, "Players"}); + ui_server_list->hideColumn(0); + ui_player_count = new QLabel(this); ui_description = new AOTextArea(this); ui_description->setOpenExternalLinks(true); @@ -47,8 +51,8 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() 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_server_list, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(on_server_list_clicked(QTreeWidgetItem*, int))); + connect(ui_server_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(on_server_list_doubleclicked(QTreeWidgetItem*, int))); connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed())); connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled())); @@ -252,7 +256,7 @@ QString Lobby::get_chatlog() int Lobby::get_selected_server() { - return ui_server_list->currentRow(); + return ui_server_list->currentItem()->text(0).toInt(); } void Lobby::set_loading_value(int p_value) @@ -310,7 +314,7 @@ void Lobby::on_add_to_fav_released() if (!public_servers_selected) return; - ao_app->add_favorite_server(ui_server_list->currentRow()); + ao_app->add_favorite_server(get_selected_server()); } void Lobby::on_connect_pressed() @@ -355,32 +359,33 @@ void Lobby::on_about_clicked() } //clicked on an item in the serverlist -void Lobby::on_server_list_clicked(QModelIndex p_model) +void Lobby::on_server_list_clicked(QTreeWidgetItem* p_item, int column) { - if (p_model != last_model) + column = 0; + if (p_item->text(column).toInt() != last_index) { - server_type f_server; - last_model = p_model; - int n_server = p_model.row(); + server_type f_server; + int n_server = p_item->text(column).toInt(); + last_index = n_server; - if (n_server < 0) - return; + if (n_server < 0) + return; - if (public_servers_selected) - { - QVector f_server_list = ao_app->get_server_list(); + if (public_servers_selected) + { + QVector f_server_list = ao_app->get_server_list(); - if (n_server >= f_server_list.size()) - return; + 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 = f_server_list.at(n_server); + } + else + { + if (n_server >= ao_app->get_favorite_list().size()) + return; - f_server = ao_app->get_favorite_list().at(p_model.row()); + f_server = ao_app->get_favorite_list().at(n_server); } ui_description->clear(); @@ -398,9 +403,9 @@ void Lobby::on_server_list_clicked(QModelIndex p_model) } //doubleclicked on an item in the serverlist so we'll connect right away -void Lobby::on_server_list_doubleclicked(QModelIndex p_model) +void Lobby::on_server_list_doubleclicked(QTreeWidgetItem* p_item, int column) { - on_server_list_clicked(p_model); + on_server_list_clicked(p_item, column); on_connect_released(); } @@ -427,22 +432,36 @@ void Lobby::list_servers() ui_favorites->set_image("favorites"); ui_public_servers->set_image("publicservers_selected"); + ui_server_list->setSortingEnabled(false); ui_server_list->clear(); + int i = 0; for (server_type i_server : ao_app->get_server_list()) { - ui_server_list->addItem(i_server.name); + QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); + treeItem->setText(0, QString::number(i)); + treeItem->setText(1, i_server.name); +// treeItem->setText(2, "-"); + i++; } + ui_server_list->setSortingEnabled(true); } void Lobby::list_favorites() { + ui_server_list->setSortingEnabled(false); ui_server_list->clear(); + int i = 0; for (server_type i_server : ao_app->get_favorite_list()) { - ui_server_list->addItem(i_server.name); + QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); + treeItem->setText(0, QString(i)); + treeItem->setText(1, i_server.name); +// treeItem->setText(2, "-"); + i++; } + ui_server_list->setSortingEnabled(true); } void Lobby::append_chatmessage(QString f_name, QString f_message) -- cgit From ee9de222ad9c1c4ebf2e6a1acc2cf5d2fc9dd77c Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 6 Mar 2020 01:14:05 +0300 Subject: Fix a bug where you couldn't join servers from your favorites list Make column 0 the area index instead so that the areas take the full width of the treewidget --- src/courtroom.cpp | 20 ++++++++++---------- src/lobby.cpp | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ea6f1659..3b0d0f54 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -126,7 +126,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_area_list = new QTreeWidget(this); ui_area_list->setColumnCount(2); - ui_area_list->hideColumn(1); + ui_area_list->hideColumn(0); ui_area_list->setHeaderHidden(true); ui_area_list->header()->setStretchLastSection(false); ui_area_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); @@ -1295,8 +1295,8 @@ void Courtroom::list_areas() if (i_area.toLower().contains(ui_music_search->text().toLower())) { QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_area_list); - treeItem->setText(0, i_area); - treeItem->setText(1, area_list.at(n_area)); + treeItem->setText(0, area_list.at(n_area)); + treeItem->setText(1, i_area); if (ao_app->arup_enabled) { @@ -1304,25 +1304,25 @@ void Courtroom::list_areas() treeItem->setBackground(0, free_brush); if (arup_locks.at(n_area) == "LOCKED") { - treeItem->setBackground(0, locked_brush); + treeItem->setBackground(1, locked_brush); } else { if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") - treeItem->setBackground(0, lfp_brush); + treeItem->setBackground(1, lfp_brush); else if (arup_statuses.at(n_area) == "CASING") - treeItem->setBackground(0, casing_brush); + treeItem->setBackground(1, casing_brush); else if (arup_statuses.at(n_area) == "RECESS") - treeItem->setBackground(0, recess_brush); + treeItem->setBackground(1, recess_brush); else if (arup_statuses.at(n_area) == "RP") - treeItem->setBackground(0, rp_brush); + treeItem->setBackground(1, rp_brush); else if (arup_statuses.at(n_area) == "GAMING") - treeItem->setBackground(0, gaming_brush); + treeItem->setBackground(1, gaming_brush); } } else { - treeItem->setBackground(0, free_brush); + treeItem->setBackground(1, free_brush); } ++n_listed_areas; diff --git a/src/lobby.cpp b/src/lobby.cpp index 22033372..8c672456 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -456,7 +456,7 @@ void Lobby::list_favorites() for (server_type i_server : ao_app->get_favorite_list()) { QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); - treeItem->setText(0, QString(i)); + treeItem->setText(0, QString::number(i)); treeItem->setText(1, i_server.name); // treeItem->setText(2, "-"); i++; -- cgit From e4b90d36a90e4601df23b5634aa5ad123d8f6424 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 6 Mar 2020 23:29:26 +0300 Subject: Fix the rightclick options for editing files not working --- src/courtroom.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3b0d0f54..f22c8536 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3446,7 +3446,7 @@ void Courtroom::on_iniswap_edit_requested() QString p_path = ao_app->get_character_path(current_char, "char.ini"); if (!file_exists(p_path)) return; - QDesktopServices::openUrl(QUrl(p_path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); } void Courtroom::on_iniswap_remove_clicked() @@ -3558,7 +3558,7 @@ void Courtroom::on_sfx_edit_requested() } } } - QDesktopServices::openUrl(QUrl(p_path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); } void Courtroom::on_sfx_remove_clicked() @@ -3644,7 +3644,7 @@ void Courtroom::on_effects_edit_requested() return; } } - QDesktopServices::openUrl(QUrl(p_path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); } void Courtroom::on_character_effects_edit_requested() { @@ -3653,7 +3653,7 @@ void Courtroom::on_character_effects_edit_requested() if (!dir_exists(p_path)) return; - QDesktopServices::openUrl(QUrl(p_path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); } void Courtroom::on_effects_dropdown_changed(int p_index) -- cgit From 9b8f60061aebae849f5325189d5baf36db0c8c99 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 8 Mar 2020 17:40:52 +0300 Subject: The Crispy:tm: update Make it so BG's and Characters will not be blurred when rescaled TODO: Make Qmovies ditch anti-aliasing during scaling as well Only apply crispy scaling if the size is 2x of the previous size or something --- src/aocharmovie.cpp | 4 +++- src/aoscene.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 0ce5c868..6cdcab2c 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -240,7 +240,9 @@ QPixmap AOCharMovie::get_pixmap(QImage image) else f_pixmap = QPixmap::fromImage(image); // auto aspect_ratio = Qt::KeepAspectRatio; - auto transform_mode = Qt::SmoothTransformation; + auto transform_mode = Qt::FastTransformation; +// if () +// transform_mode = Qt::SmoothTransformation; f_pixmap = f_pixmap.scaledToHeight(f_h, transform_mode); this->resize(f_pixmap.size()); diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 6ada5ee5..32e5c350 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -36,7 +36,7 @@ void AOScene::set_image(QString p_image) m_movie->setFileName(background_path); m_movie->setScaledSize(QSize(w, h)); - if (m_movie->isValid()) + if (m_movie->isValid() && m_movie->frameCount() > 1) { this->setMovie(m_movie); m_movie->start(); @@ -85,7 +85,7 @@ void AOScene::set_legacy_desk(QString p_image) m_movie->setScaledSize(QSize(vp_width, final_h)); - if (m_movie->isValid()) + if (m_movie->isValid() && m_movie->frameCount() > 1) { this->setMovie(m_movie); m_movie->start(); -- cgit From ce3269cc36485e44a85778b0d93b6bfc26f95eb1 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Mar 2020 00:47:39 +0300 Subject: Only use anti-aliasing when sprites are being downscaled, otherwise preserve crispyness:tm: --- src/aocharmovie.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 6cdcab2c..7bbdc1bc 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -241,8 +241,8 @@ QPixmap AOCharMovie::get_pixmap(QImage image) f_pixmap = QPixmap::fromImage(image); // auto aspect_ratio = Qt::KeepAspectRatio; auto transform_mode = Qt::FastTransformation; -// if () -// transform_mode = Qt::SmoothTransformation; + if (f_pixmap.height() > f_h) //We are downscaling, use anti-aliasing. + transform_mode = Qt::SmoothTransformation; f_pixmap = f_pixmap.scaledToHeight(f_h, transform_mode); this->resize(f_pixmap.size()); -- cgit From 7aa24bf50158b3a93c17c56e1371b72389238185 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Mar 2020 18:09:56 +0300 Subject: Add a search bar for server list Add options for sticky sounds, sticky effects and sticky preanims Optimize the search for areas and music (previously, area search also searched for music in the background, causing lag with huge music lists) --- include/aoapplication.h | 12 +++++ include/aooptionsdialog.h | 9 ++++ include/lobby.h | 2 + src/aooptionsdialog.cpp | 43 ++++++++++++++- src/courtroom.cpp | 125 ++++++++++++++++++++++++++++---------------- src/emotes.cpp | 11 ++-- src/lobby.cpp | 35 ++++++++++++- src/text_file_functions.cpp | 18 +++++++ 8 files changed, 204 insertions(+), 51 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 9f110874..3ed70463 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -188,6 +188,18 @@ public: // from the config.ini. bool is_colorlog_enabled(); + // Returns the value of whether sticky sounds should be a thing. + // from the config.ini. + bool is_stickysounds_enabled(); + + // Returns the value of whether sticky effects should be a thing. + // from the config.ini. + bool is_stickyeffects_enabled(); + + // Returns the value of whether sticky preanims should be a thing. + // from the config.ini. + bool is_stickypres_enabled(); + // Returns the value of the maximum amount of lines the IC chatlog // may contain, from config.ini. int get_max_log_size(); diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 9e34e651..4a63ca35 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -75,6 +75,15 @@ private: QLabel *ui_colorlog_lbl; QCheckBox *ui_colorlog_cb; + QLabel *ui_stickysounds_lbl; + QCheckBox *ui_stickysounds_cb; + + QLabel *ui_stickyeffects_lbl; + QCheckBox *ui_stickyeffects_cb; + + QLabel *ui_stickypres_lbl; + QCheckBox *ui_stickypres_cb; + QWidget *ui_callwords_tab; QWidget *ui_callwords_widget; QVBoxLayout *ui_callwords_layout; diff --git a/include/lobby.h b/include/lobby.h index 4b95fb2f..10a7c1d5 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -66,6 +66,7 @@ private: AOButton *ui_about; QTreeWidget *ui_server_list; + QLineEdit *ui_server_search; QLabel *ui_player_count; AOTextArea *ui_description; @@ -97,6 +98,7 @@ private slots: void on_about_clicked(); void on_server_list_clicked(QTreeWidgetItem* p_item, int column); void on_server_list_doubleclicked(QTreeWidgetItem* p_item, int column); + void on_server_search_edited(QString p_text); void on_chatfield_return_pressed(); }; diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index ad1042f5..cfaaa20f 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -12,7 +12,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_settings_buttons = new QDialogButtonBox(this); - QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding); + QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(ui_settings_buttons->sizePolicy().hasHeightForWidth()); @@ -39,7 +39,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_tab->setSizePolicy(sizePolicy1); ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay")); ui_form_layout_widget = new QWidget(ui_gameplay_tab); - ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 211)); + ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 361)); ui_form_layout_widget->setSizePolicy(sizePolicy1); ui_gameplay_form = new QFormLayout(ui_form_layout_widget); @@ -242,6 +242,42 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_colorlog_cb); + row += 1; + ui_stickysounds_lbl = new QLabel(ui_form_layout_widget); + ui_stickysounds_lbl->setText(tr("Sticky Sounds:")); + ui_stickysounds_lbl->setToolTip(tr("Turn this on to prevent the sound dropdown from clearing the sound after playing it.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickysounds_lbl); + + ui_stickysounds_cb = new QCheckBox(ui_form_layout_widget); + ui_stickysounds_cb->setChecked(ao_app->is_stickysounds_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickysounds_cb); + + row += 1; + ui_stickyeffects_lbl = new QLabel(ui_form_layout_widget); + ui_stickyeffects_lbl->setText(tr("Sticky Effects:")); + ui_stickyeffects_lbl->setToolTip(tr("Turn this on to prevent the effects dropdown from clearing the effect after playing it.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickyeffects_lbl); + + ui_stickyeffects_cb = new QCheckBox(ui_form_layout_widget); + ui_stickyeffects_cb->setChecked(ao_app->is_stickyeffects_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickyeffects_cb); + + row += 1; + ui_stickypres_lbl = new QLabel(ui_form_layout_widget); + ui_stickypres_lbl->setText(tr("Sticky Preanims:")); + ui_stickypres_lbl->setToolTip(tr("Turn this on to prevent preanimation checkbox from clearing after playing the emote.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickypres_lbl); + + ui_stickypres_cb = new QCheckBox(ui_form_layout_widget); + ui_stickypres_cb->setChecked(ao_app->is_stickypres_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickypres_cb); + QScrollArea *scroll = new QScrollArea; scroll->setWidget(ui_form_layout_widget); ui_gameplay_tab->setLayout(new QVBoxLayout); @@ -599,6 +635,9 @@ void AOOptionsDialog::save_pressed() configini->setValue("effects", ui_effects_cb->isChecked()); configini->setValue("framenetwork", ui_framenetwork_cb->isChecked()); configini->setValue("colorlog", ui_colorlog_cb->isChecked()); + configini->setValue("stickysounds", ui_stickysounds_cb->isChecked()); + configini->setValue("stickyeffects", ui_stickyeffects_cb->isChecked()); + configini->setValue("stickypres", ui_stickypres_cb->isChecked()); QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index f22c8536..d35ba70d 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1214,6 +1214,7 @@ void Courtroom::enter_courtroom() void Courtroom::list_music() { ui_music_list->clear(); + ui_music_search->setText(""); QString f_file = "courtroom_design.ini"; @@ -1256,6 +1257,7 @@ void Courtroom::list_music() void Courtroom::list_areas() { ui_area_list->clear(); + ui_music_search->setText(""); QString f_file = "courtroom_design.ini"; @@ -1292,41 +1294,38 @@ void Courtroom::list_areas() i_area.append(arup_locks.at(n_area)); } - if (i_area.toLower().contains(ui_music_search->text().toLower())) - { - QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_area_list); - treeItem->setText(0, area_list.at(n_area)); - treeItem->setText(1, i_area); + QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_area_list); + treeItem->setText(0, area_list.at(n_area)); + treeItem->setText(1, i_area); - if (ao_app->arup_enabled) + if (ao_app->arup_enabled) + { + // Coloring logic here. + treeItem->setBackground(0, free_brush); + if (arup_locks.at(n_area) == "LOCKED") { - // Coloring logic here. - treeItem->setBackground(0, free_brush); - if (arup_locks.at(n_area) == "LOCKED") - { - treeItem->setBackground(1, locked_brush); - } - else - { - if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") - treeItem->setBackground(1, lfp_brush); - else if (arup_statuses.at(n_area) == "CASING") - treeItem->setBackground(1, casing_brush); - else if (arup_statuses.at(n_area) == "RECESS") - treeItem->setBackground(1, recess_brush); - else if (arup_statuses.at(n_area) == "RP") - treeItem->setBackground(1, rp_brush); - else if (arup_statuses.at(n_area) == "GAMING") - treeItem->setBackground(1, gaming_brush); - } + treeItem->setBackground(1, locked_brush); } else { - treeItem->setBackground(1, free_brush); + if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") + treeItem->setBackground(1, lfp_brush); + else if (arup_statuses.at(n_area) == "CASING") + treeItem->setBackground(1, casing_brush); + else if (arup_statuses.at(n_area) == "RECESS") + treeItem->setBackground(1, recess_brush); + else if (arup_statuses.at(n_area) == "RP") + treeItem->setBackground(1, rp_brush); + else if (arup_statuses.at(n_area) == "GAMING") + treeItem->setBackground(1, gaming_brush); } - - ++n_listed_areas; } + else + { + treeItem->setBackground(1, free_brush); + } + + ++n_listed_areas; } } @@ -1412,6 +1411,13 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(current_side); packet_contents.append(get_char_sfx()); + if (ui_pre->isChecked() && !ao_app->is_stickysounds_enabled()) + { + ui_sfx_dropdown->blockSignals(true); + ui_sfx_dropdown->setCurrentIndex(0); + ui_sfx_dropdown->blockSignals(false); + ui_sfx_remove->hide(); + } int f_emote_mod = ao_app->get_emote_mod(current_char, current_emote); @@ -1568,10 +1574,13 @@ void Courtroom::on_chat_return_pressed() QString fx_sound = ao_app->get_effect_sound(effect, current_char); QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); packet_contents.append(effect + "|" + p_effect + "|" + fx_sound); - ui_effects_dropdown->blockSignals(true); - ui_effects_dropdown->setCurrentIndex(0); - ui_effects_dropdown->blockSignals(false); - effect = ""; + if (!ao_app->is_stickyeffects_enabled()) + { + ui_effects_dropdown->blockSignals(true); + ui_effects_dropdown->setCurrentIndex(0); + ui_effects_dropdown->blockSignals(false); + effect = ""; + } } ao_app->send_server_packet(new AOPacket("MS", packet_contents)); @@ -1658,7 +1667,8 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) realization_state = 0; screenshake_state = 0; is_presenting_evidence = false; - ui_pre->setChecked(false); + if (!ao_app->is_stickypres_enabled()) + ui_pre->setChecked(false); ui_hold_it->set_image("holdit"); ui_objection->set_image("objection"); ui_take_that->set_image("takethat"); @@ -3327,25 +3337,52 @@ void Courtroom::on_ooc_toggle_clicked() void Courtroom::on_music_search_edited(QString p_text) { // Iterate through all QTreeWidgetItem items - QTreeWidgetItemIterator it(ui_music_list); - while (*it) + if (!ui_music_list->isHidden()) { - (*it)->setHidden(p_text != ""); - ++it; + QTreeWidgetItemIterator it(ui_music_list); + while (*it) + { + (*it)->setHidden(p_text != ""); + ++it; + } + } + + if (!ui_area_list->isHidden()) + { + QTreeWidgetItemIterator ait(ui_area_list); + while (*ait) + { + (*ait)->setHidden(p_text != ""); + ++ait; + } } if (p_text != "") { - //Search in metadata - QList clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1); - foreach(QTreeWidgetItem* item, clist) + if (!ui_music_list->isHidden()) { - if (item->parent() != nullptr) //So the category shows up too - item->parent()->setHidden(false); - item->setHidden(false); + //Search in metadata + QList clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1); + foreach(QTreeWidgetItem* item, clist) + { + if (item->parent() != nullptr) //So the category shows up too + item->parent()->setHidden(false); + item->setHidden(false); + } + } + + if (!ui_area_list->isHidden()) + { + //Search in metadata + QList alist = ui_area_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1); + foreach(QTreeWidgetItem* item, alist) + { + if (item->parent() != nullptr) //So the category shows up too + item->parent()->setHidden(false); + item->setHidden(false); + } } } - list_areas(); } void Courtroom::on_pos_dropdown_changed(int p_index) diff --git a/src/emotes.cpp b/src/emotes.cpp index de53169e..1484784e 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -159,10 +159,13 @@ void Courtroom::select_emote(int p_id) { ui_pre->setChecked(!ui_pre->isChecked()); } - else if (emote_mod == 1 || emote_mod == 4) - ui_pre->setChecked(true); - else - ui_pre->setChecked(false); + else if (!ao_app->is_stickypres_enabled()) + { + if (emote_mod == 1 || emote_mod == 4) + ui_pre->setChecked(true); + else + ui_pre->setChecked(false); + } ui_emote_dropdown->setCurrentIndex(current_emote); diff --git a/src/lobby.cpp b/src/lobby.cpp index 8c672456..caa09158 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -25,6 +25,10 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() ui_server_list->setHeaderLabels({"#", "Name"});//, "Players"}); ui_server_list->hideColumn(0); + ui_server_search = new QLineEdit(this); + ui_server_search->setFrame(false); + ui_server_search->setPlaceholderText(tr("Search")); + ui_player_count = new QLabel(this); ui_description = new AOTextArea(this); ui_description->setOpenExternalLinks(true); @@ -53,6 +57,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() connect(ui_about, SIGNAL(clicked()), this, SLOT(on_about_clicked())); connect(ui_server_list, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(on_server_list_clicked(QTreeWidgetItem*, int))); connect(ui_server_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(on_server_list_doubleclicked(QTreeWidgetItem*, int))); + connect(ui_server_search, SIGNAL(textChanged(QString)), this, SLOT(on_server_search_edited(QString))); connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed())); connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled())); @@ -116,6 +121,9 @@ void Lobby::set_widgets() ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "font: bold;"); + set_size_and_pos(ui_server_search, "server_search"); + ui_server_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); + set_size_and_pos(ui_player_count, "player_count"); ui_player_count->setText(tr("Offline")); ui_player_count->setStyleSheet("font: bold;" @@ -409,6 +417,30 @@ void Lobby::on_server_list_doubleclicked(QTreeWidgetItem* p_item, int column) on_connect_released(); } +void Lobby::on_server_search_edited(QString p_text) +{ + // Iterate through all QTreeWidgetItem items + QTreeWidgetItemIterator it(ui_server_list); + while (*it) + { + (*it)->setHidden(p_text != ""); + ++it; + } + + if (p_text != "") + { + //Search in metadata + QList clist = ui_server_list->findItems(ui_server_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1); + foreach(QTreeWidgetItem* item, clist) + { + if (item->parent() != nullptr) //So the category shows up too + item->parent()->setHidden(false); + item->setHidden(false); + } + } +} + + void Lobby::on_chatfield_return_pressed() { //no you can't send empty messages @@ -435,13 +467,14 @@ void Lobby::list_servers() ui_server_list->setSortingEnabled(false); ui_server_list->clear(); + ui_server_search->setText(""); + int i = 0; for (server_type i_server : ao_app->get_server_list()) { QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); treeItem->setText(0, QString::number(i)); treeItem->setText(1, i_server.name); -// treeItem->setText(2, "-"); i++; } ui_server_list->setSortingEnabled(true); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 49bf61f7..432f61a0 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -987,6 +987,24 @@ bool AOApplication::is_colorlog_enabled() return result.startsWith("true"); } +bool AOApplication::is_stickysounds_enabled() +{ + QString result = configini->value("stickysounds", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::is_stickyeffects_enabled() +{ + QString result = configini->value("stickyeffects", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::is_stickypres_enabled() +{ + QString result = configini->value("stickypres", "false").value(); + return result.startsWith("true"); +} + bool AOApplication::get_casing_enabled() { QString result = configini->value("casing_enabled", "false").value(); -- cgit From 4c8bf57268c09c298edc3f3695e4a2ede84643ac Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Mar 2020 18:34:51 +0300 Subject: VERSION 2.8.3 BABYYYYYYYY Add "KFO" to version display in lobby so it's even clearer this is a custom client Add a settings button to the Lobby screen --- Attorney_Online.pro | 2 +- include/aoapplication.h | 2 +- include/lobby.h | 3 +++ src/aoapplication.cpp | 2 +- src/lobby.cpp | 12 ++++++++++++ 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index cb6727f8..81a3304e 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -3,7 +3,7 @@ QT += core gui widgets network TARGET = Attorney_Online TEMPLATE = app -VERSION = 2.8.2.0 +VERSION = 2.8.3.0 INCLUDEPATH += $$PWD/include DESTDIR = $$PWD/bin diff --git a/include/aoapplication.h b/include/aoapplication.h index 3ed70463..8b520bc4 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -416,7 +416,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 8; - const int MINOR_VERSION = 2; + const int MINOR_VERSION = 3; QString current_theme = "default"; diff --git a/include/lobby.h b/include/lobby.h index 10a7c1d5..a969f865 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -65,6 +65,8 @@ private: QLabel *ui_version; AOButton *ui_about; + AOButton *ui_settings; + QTreeWidget *ui_server_list; QLineEdit *ui_server_search; @@ -96,6 +98,7 @@ private slots: void on_connect_pressed(); void on_connect_released(); void on_about_clicked(); + void on_settings_clicked(); void on_server_list_clicked(QTreeWidgetItem* p_item, int column); void on_server_list_doubleclicked(QTreeWidgetItem* p_item, int column); void on_server_search_edited(QString p_text); diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 6213acd6..9c3d1cd0 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -93,7 +93,7 @@ void AOApplication::destruct_courtroom() QString AOApplication::get_version_string() { - return + return "KFO" + QString::number(RELEASE) + "." + QString::number(MAJOR_VERSION) + "." + QString::number(MINOR_VERSION); diff --git a/src/lobby.cpp b/src/lobby.cpp index caa09158..1c355a5e 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -20,6 +20,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() ui_connect = new AOButton(this, ao_app); ui_version = new QLabel(this); ui_about = new AOButton(this, ao_app); + ui_settings = new AOButton(this, ao_app); ui_server_list = new QTreeWidget(this); ui_server_list->setHeaderLabels({"#", "Name"});//, "Players"}); @@ -55,6 +56,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() 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_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked())); connect(ui_server_list, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(on_server_list_clicked(QTreeWidgetItem*, int))); connect(ui_server_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(on_server_list_doubleclicked(QTreeWidgetItem*, int))); connect(ui_server_search, SIGNAL(textChanged(QString)), this, SLOT(on_server_search_edited(QString))); @@ -117,6 +119,11 @@ void Lobby::set_widgets() set_size_and_pos(ui_about, "about"); ui_about->set_image("about"); + set_size_and_pos(ui_settings, "settings"); + ui_settings->setText(tr("Settings")); + ui_settings->set_image("settings"); + ui_settings->setToolTip(tr("Allows you to change various aspects of the client.")); + set_size_and_pos(ui_server_list, "server_list"); ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "font: bold;"); @@ -366,6 +373,11 @@ void Lobby::on_about_clicked() QMessageBox::about(this, "About", msg); } +void Lobby::on_settings_clicked() +{ + ao_app->call_settings_menu(); +} + //clicked on an item in the serverlist void Lobby::on_server_list_clicked(QTreeWidgetItem* p_item, int column) { -- cgit From 71967d44fd4a7d8955524045d174847e985c7a15 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Mar 2020 19:20:26 +0300 Subject: Keep verison string as-is and only update the actual VERSION display as for some weird ass reason doing it this way won't let you join KFO server --- src/aoapplication.cpp | 2 +- src/lobby.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 9c3d1cd0..6213acd6 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -93,7 +93,7 @@ void AOApplication::destruct_courtroom() QString AOApplication::get_version_string() { - return "KFO" + + return QString::number(RELEASE) + "." + QString::number(MAJOR_VERSION) + "." + QString::number(MINOR_VERSION); diff --git a/src/lobby.cpp b/src/lobby.cpp index 1c355a5e..19bb4c66 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -114,7 +114,7 @@ void Lobby::set_widgets() ui_connect->set_image("connect"); set_size_and_pos(ui_version, "version"); - ui_version->setText(tr("Version: %1").arg(ao_app->get_version_string())); + ui_version->setText(tr("Version: KFO%1").arg(ao_app->get_version_string())); set_size_and_pos(ui_about, "about"); ui_about->set_image("about"); -- cgit From 825042b32ce9f7d672ee0ba33b1f7b2e759df14c Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 22 Mar 2020 22:26:46 +0300 Subject: Fix a really obscure bug breaking custom realization sound effects (realization=thing) char.ini definition not starting from base/sounds/general folder --- src/text_file_functions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 432f61a0..c3948123 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -936,7 +936,7 @@ QString AOApplication::get_custom_realization(QString p_char) if (f_result == "") return get_sfx("realization"); - else return get_sfx_suffix(f_result); + else return get_sfx_suffix(get_sounds_path(f_result)); } bool AOApplication::get_blank_blip() -- cgit From f668d70ac5e5ed7dff8ddb4508e2b8adfcba7d66 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 25 Mar 2020 00:42:20 +0300 Subject: Change @ and $ to \s and \f standing for s[hake] and f[lash]. This is done because @ is used very often to refer to people, and $ is used to indicate cash money. --- src/courtroom.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index d35ba70d..8cf5751e 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2169,7 +2169,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int skip = true; } //Nothing related to colors here - else if (f_character == "{" || f_character == "}" || f_character == "@" || f_character == "$") + else if (f_character == "{" || f_character == "}") //|| f_character == "@" || f_character == "$") { skip = true; } @@ -2268,6 +2268,8 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int check_pos_escaped += appendage.size(); skip = true; } + if (f_character == "s" || f_character == "f") // screenshake/flash + skip = true; ic_next_is_not_special = false; } @@ -2636,19 +2638,6 @@ void Courtroom::chat_tick() formatting_char = true; } - //Screenshake. - else if (f_character == "@") - { - this->do_screenshake(); - formatting_char = true; - } - - //Flash. - else if (f_character == "$") - { - this->do_flash(); - formatting_char = true; - } else { //Parse markdown colors @@ -2673,13 +2662,23 @@ void Courtroom::chat_tick() { if (f_character == "n") formatting_char = true; //it's a newline + if (f_character == "s") //Screenshake. + { + this->do_screenshake(); + formatting_char = true; + } + if (f_character == "f")//Flash. + { + this->do_flash(); + formatting_char = true; + } next_character_is_not_special = false; } if ((message_display_speed[current_display_speed] <= 0 && tick_pos < f_message.size()-1) || formatting_char) { chat_tick_timer->start(0); //Don't bother rendering anything out as we're doing the SPEED. (there's latency otherwise) - if (!formatting_char || f_character == "n") + if (!formatting_char || f_character == "n" || f_character == "f" || f_character == "s") real_tick_pos += f_char_length; //Adjust the tick position for the scrollbar convenience } else -- cgit From 1634db78641526ddb88f844a46b1bdc615a89e59 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 26 Mar 2020 14:41:56 +0300 Subject: Make backgrounds preserve aspect ratio when used with different aspect ratio themes (e.g. a 16:9 theme would not stretch a 4:3 bg and instead have a letterboxing effect. A 4:3 theme using a 16:9 BG will not stretch the BG but instead center it, making it look like the BG is 4:3 all along.) --- include/aoscene.h | 11 +++++++++++ src/aoscene.cpp | 39 ++++++++++++++++++++++++++++++++------- src/courtroom.cpp | 4 ++-- 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/include/aoscene.h b/include/aoscene.h index ddbefe08..46d8c3b8 100644 --- a/include/aoscene.h +++ b/include/aoscene.h @@ -17,12 +17,23 @@ public: void set_image(QString p_image); void set_legacy_desk(QString p_image); + //Move the label itself around + void move(int ax, int ay); + + //This is somewhat pointless now as there's no "QMovie" object to resize, aka no "combo" to speak of + void combo_resize(int w, int h); private: QWidget *m_parent; QMovie *m_movie; AOApplication *ao_app; QString last_image; + // These are the X and Y values before they are fixed based on the sprite's width. + int x = 0; + int y = 0; + // These are the width and height values before they are fixed based on the sprite's width. + int f_w = 0; + int f_h = 0; }; #endif // AOSCENE_H diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 32e5c350..45eadd54 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -26,25 +26,35 @@ void AOScene::set_image(QString p_image) if (file_exists(background_path) && background_path == last_image) return; - int w = this->width(); - int h = this->height(); - this->clear(); this->setMovie(nullptr); m_movie->stop(); m_movie->setFileName(background_path); - m_movie->setScaledSize(QSize(w, h)); if (m_movie->isValid() && m_movie->frameCount() > 1) { + float scale_factor = f_h / m_movie->frameRect().height(); + //preserve aspect ratio + int n_w = static_cast(static_cast(m_movie->frameRect().width()) * scale_factor); + int n_h = static_cast(static_cast(m_movie->frameRect().height()) * scale_factor); + m_movie->setScaledSize(QSize(n_w, n_h)); + this->resize(m_movie->scaledSize()); this->setMovie(m_movie); + QLabel::move(x + (f_w - n_w)/2, y + (f_h - n_h)); //Always center horizontally, always put at the bottom vertically m_movie->start(); } else { QPixmap background(background_path); - this->setPixmap(background.scaled(w, h)); + auto transform_mode = Qt::FastTransformation; + if (background.height() > f_h) //We are downscaling, use anti-aliasing. + transform_mode = Qt::SmoothTransformation; + + background = background.scaledToHeight(f_h, transform_mode); + this->resize(background.size()); + this->setPixmap(background); + QLabel::move(x + (f_w - background.width())/2, y + (f_h - background.height())/2); //Always center horizontally, always center vertically } last_image = background_path; } @@ -92,8 +102,23 @@ void AOScene::set_legacy_desk(QString p_image) } else { - this->resize(vp_width, final_h); - this->setPixmap(f_desk.scaled(vp_width, final_h)); + this->resize(vp_width, final_h); + this->setPixmap(f_desk.scaled(vp_width, final_h)); } last_image = desk_path; } + +void AOScene::combo_resize(int w, int h) +{ + QSize f_size(w, h); + f_w = w; + f_h = h; + this->resize(f_size); +} + +void AOScene::move(int ax, int ay) +{ + x = ax; + y = ay; + QLabel::move(x, y); +} diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 8cf5751e..dbe53236 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -487,7 +487,7 @@ void Courtroom::set_widgets() ui_settings->show(); ui_vp_background->move(0, 0); - ui_vp_background->resize(ui_viewport->width(), ui_viewport->height()); + ui_vp_background->combo_resize(ui_viewport->width(), ui_viewport->height()); ui_vp_speedlines->move(0, 0); ui_vp_speedlines->combo_resize(ui_viewport->width(), ui_viewport->height()); @@ -500,7 +500,7 @@ void Courtroom::set_widgets() //the AO2 desk element ui_vp_desk->move(0, 0); - ui_vp_desk->resize(ui_viewport->width(), ui_viewport->height()); + ui_vp_desk->combo_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() -- cgit From 614522bc0c8683ca367c5195f1e3c8121b65ce64 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 27 Mar 2020 15:48:16 +0300 Subject: Quality of Life improvements Fix a bug where IC view received focus as soon as you receive the BG image update (it made navigating using /area commands a pain in the ass) Make music search behave better and not reset when server sends us music list update (todo: remember which elements were/weren't expanded) --- src/courtroom.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index dbe53236..f7571304 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1214,7 +1214,7 @@ void Courtroom::enter_courtroom() void Courtroom::list_music() { ui_music_list->clear(); - ui_music_search->setText(""); +// ui_music_search->setText(""); QString f_file = "courtroom_design.ini"; @@ -1251,13 +1251,17 @@ void Courtroom::list_music() } ui_music_list->expandAll(); //Needs to somehow remember which categories were expanded/collapsed if the music list didn't change since last time + if (ui_music_search->text() != "") + { + on_music_search_edited(ui_music_search->text()); + } } //Todo: multithread this due to some servers having large as hell area list void Courtroom::list_areas() { ui_area_list->clear(); - ui_music_search->setText(""); +// ui_music_search->setText(""); QString f_file = "courtroom_design.ini"; @@ -1327,6 +1331,11 @@ void Courtroom::list_areas() ++n_listed_areas; } + + if (ui_music_search->text() != "") + { + on_music_search_edited(ui_music_search->text()); + } } void Courtroom::append_ms_chatmessage(QString f_name, QString f_message) @@ -3386,8 +3395,6 @@ void Courtroom::on_music_search_edited(QString p_text) void Courtroom::on_pos_dropdown_changed(int p_index) { - ui_ic_chat_message->setFocus(); - if (p_index < 0 || p_index > 7) return; @@ -4399,6 +4406,8 @@ void Courtroom::on_evidence_button_clicked() void Courtroom::on_switch_area_music_clicked() { + ui_music_search->setText(""); + on_music_search_edited(ui_music_search->text()); if (ui_area_list->isHidden()) { ui_area_list->show(); -- cgit From 4aa1ae62e1561363db07a81dc92861fb00988a4b Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 28 Mar 2020 19:29:46 +0300 Subject: Fix wrong pos being shown when entering area due to index signal being called in the wrong place --- src/courtroom.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index f7571304..17d1f0bb 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1086,9 +1086,14 @@ void Courtroom::set_side(QString p_side) void Courtroom::set_pos_dropdown(QStringList pos_dropdowns) { + //Block the signals to prevent setCurrentIndex from triggering a pos change + ui_pos_dropdown->blockSignals(true); pos_dropdown_list = pos_dropdowns; ui_pos_dropdown->clear(); ui_pos_dropdown->addItems(pos_dropdown_list); + //Unblock the signals so the element can be used for setting pos again + ui_pos_dropdown->blockSignals(false); + qDebug() << pos_dropdown_list; } -- cgit From 7fb19ae7bdfc57fb7123edbe25d109b66173ab06 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 31 Mar 2020 14:24:48 +0300 Subject: Fix aomovie resizing algorithm for BG's crashing the client because I fucked up, lol --- src/aoscene.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 45eadd54..575a27df 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -34,14 +34,16 @@ void AOScene::set_image(QString p_image) if (m_movie->isValid() && m_movie->frameCount() > 1) { - float scale_factor = f_h / m_movie->frameRect().height(); + m_movie->jumpToNextFrame(); + float scale_factor = static_cast(f_h) / static_cast(m_movie->frameRect().height()); //preserve aspect ratio - int n_w = static_cast(static_cast(m_movie->frameRect().width()) * scale_factor); - int n_h = static_cast(static_cast(m_movie->frameRect().height()) * scale_factor); + int n_w = static_cast(m_movie->frameRect().width() * scale_factor); + int n_h = static_cast(m_movie->frameRect().height() * scale_factor); + m_movie->setScaledSize(QSize(n_w, n_h)); this->resize(m_movie->scaledSize()); this->setMovie(m_movie); - QLabel::move(x + (f_w - n_w)/2, y + (f_h - n_h)); //Always center horizontally, always put at the bottom vertically + QLabel::move(x + (f_w - n_w)/2, y + (f_h - n_h)/2); //Center m_movie->start(); } else -- cgit From 2e89f0d1997fb00aeab5e73962ca42489f1706af Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 31 Mar 2020 14:26:16 +0300 Subject: Change the ultra-tiny-minor version so people can right-click for details and tell me which version they're using during qa-testing --- Attorney_Online.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 81a3304e..951d701d 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -3,7 +3,7 @@ QT += core gui widgets network TARGET = Attorney_Online TEMPLATE = app -VERSION = 2.8.3.0 +VERSION = 2.8.3.1 INCLUDEPATH += $$PWD/include DESTDIR = $$PWD/bin -- cgit From feaf04a5c48bb647d12408645f69e1ed49c9df15 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 31 Mar 2020 17:03:41 +0300 Subject: Fix custom chatboxes not working at all --- src/courtroom.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 17d1f0bb..6763300f 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1803,6 +1803,7 @@ void Courtroom::handle_chatmessage_2() if (chatbox != "") { chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat"; + ui_vp_chatbox->set_chatbox(chatbox_path); } pos_size_type default_width = ao_app->get_element_dimensions("showname", "courtroom_design.ini"); -- cgit From 7816c8ab234e185e5eb3410761aee3ca60e0f354 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 31 Mar 2020 17:09:00 +0300 Subject: Add legacy fallback for "chatbox.png" name if chat.png doesn't exist --- src/courtroom.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 6763300f..d310a0a5 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1793,7 +1793,8 @@ void Courtroom::handle_chatmessage_2() } else //Aw yeah dude do some showname resizing magic { - ui_vp_chatbox->set_image("chat"); + if (!ui_vp_chatbox->set_image("chat")) + ui_vp_chatbox->set_image("chatbox"); QFontMetrics fm(ui_vp_showname->font()); int fm_width=fm.horizontalAdvance(ui_vp_showname->text()); @@ -1803,7 +1804,8 @@ void Courtroom::handle_chatmessage_2() if (chatbox != "") { chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat"; - ui_vp_chatbox->set_chatbox(chatbox_path); + if (!ui_vp_chatbox->set_chatbox(chatbox_path)) + ui_vp_chatbox->set_chatbox(chatbox_path + "box"); } pos_size_type default_width = ao_app->get_element_dimensions("showname", "courtroom_design.ini"); -- cgit From 8007b1d1b95d476821a6b2616c09824e54911ea9 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 31 Mar 2020 18:12:15 +0300 Subject: Add courtroom_design.ini partial parsing for misc/ folder (only chat_arrow and showname atm) Initialize chat arrow n stuff this is still pretty gay because you can't ignore size and set pos or something like that --- include/aoapplication.h | 4 ++-- src/courtroom.cpp | 16 ++++++++++++++-- src/text_file_functions.cpp | 26 ++++++++++++++++++-------- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 8b520bc4..e44f2d3c 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -248,10 +248,10 @@ public: 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); + pos_size_type get_element_dimensions(QString p_identifier, QString p_file, QString p_char=""); //Returns the value to you - QString get_design_element(QString p_identifier, QString p_file); + QString get_design_element(QString p_identifier, QString p_file, QString p_char=""); //Returns the name of the font with p_identifier from p_file QString get_font_name(QString p_identifier, QString p_file); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index d310a0a5..c7f19364 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1806,10 +1806,22 @@ void Courtroom::handle_chatmessage_2() chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat"; if (!ui_vp_chatbox->set_chatbox(chatbox_path)) ui_vp_chatbox->set_chatbox(chatbox_path + "box"); + + pos_size_type design_ini_result = ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); + if (design_ini_result.width < 0 || design_ini_result.height < 0) + { + qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; + ui_vp_chat_arrow->hide(); + } + else + { + ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); + ui_vp_chat_arrow->combo_resize(design_ini_result.width, design_ini_result.height); + } } - pos_size_type default_width = ao_app->get_element_dimensions("showname", "courtroom_design.ini"); - int extra_width = ao_app->get_design_element("showname_extra_width", "courtroom_design.ini").toInt(); + pos_size_type default_width = ao_app->get_element_dimensions("showname", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); + int extra_width = ao_app->get_design_element("showname_extra_width", "courtroom_design.ini", m_chatmessage[CHAR_NAME]).toInt(); if(extra_width > 0) { diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index c3948123..d9867094 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -264,11 +264,12 @@ QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file) return return_value; } -pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QString p_file) +pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QString p_file, QString p_char) { + QString char_ini_path = get_base_path() + "misc/" + get_chat(p_char) + "/" + 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); + QString f_result = read_design_ini(p_identifier, char_ini_path); pos_size_type return_value; @@ -279,10 +280,14 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QStrin if (f_result == "") { - f_result = read_design_ini(p_identifier, default_path); - + f_result = read_design_ini(p_identifier, design_ini_path); if (f_result == "") - return return_value; + { + f_result = read_design_ini(p_identifier, default_path); + + if (f_result == "") + return return_value; + } } QStringList sub_line_elements = f_result.split(","); @@ -297,13 +302,18 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QStrin return return_value; } -QString AOApplication::get_design_element(QString p_identifier, QString p_file) +QString AOApplication::get_design_element(QString p_identifier, QString p_file, QString p_char) { + QString char_ini_path = get_base_path() + "misc/" + get_chat(p_char) + "/" + 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); + QString f_result = read_design_ini(p_identifier, char_ini_path); if (f_result == "") - f_result = read_design_ini(p_identifier, default_path); + { + f_result = read_design_ini(p_identifier, design_ini_path); + if (f_result == "") + f_result = read_design_ini(p_identifier, default_path); + } return f_result; } QString AOApplication::get_font_name(QString p_identifier, QString p_file) -- cgit From c49c9cdd777c7df38594aa444a1aee8c8f9cf09c Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 1 Apr 2020 19:48:58 +0300 Subject: Fix weird behavior with area list and arup system + wrong column being used for 'metadata' --- src/courtroom.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c7f19364..26648372 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1310,7 +1310,7 @@ void Courtroom::list_areas() if (ao_app->arup_enabled) { // Coloring logic here. - treeItem->setBackground(0, free_brush); + treeItem->setBackground(1, free_brush); if (arup_locks.at(n_area) == "LOCKED") { treeItem->setBackground(1, locked_brush); @@ -3921,8 +3921,8 @@ void Courtroom::music_list_collapse_all() void Courtroom::on_area_list_double_clicked(QTreeWidgetItem *p_item, int column) { - column = 1; //The metadata - QString p_area = p_item->text(1); + column = 0; //The metadata + QString p_area = p_item->text(0); QStringList packet_contents; packet_contents.append(p_area); -- cgit From 71ebdac1c1ac560d00a6d1f75ef9a45c5bc50b41 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 1 Apr 2020 20:01:00 +0300 Subject: Fix collapse all rightclick option being annoying in its behavior. Now it's *smart*! --- src/courtroom.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 26648372..d5dd6565 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3917,6 +3917,10 @@ void Courtroom::music_list_expand_all() void Courtroom::music_list_collapse_all() { ui_music_list->collapseAll(); + QTreeWidgetItem *current = ui_music_list->selectedItems()[0]; + if (current->parent() != nullptr) + current = current->parent(); + ui_music_list->setCurrentItem(current); } void Courtroom::on_area_list_double_clicked(QTreeWidgetItem *p_item, int column) -- cgit From e0ae7c0eb5f91d7852cdeb06d6eaaca6ddd21f62 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 2 Apr 2020 23:10:54 +0300 Subject: Fix evidence display viewport element being a FUCKING JACKASS --- src/aoevidencedisplay.cpp | 13 ++++++------- src/courtroom.cpp | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/aoevidencedisplay.cpp b/src/aoevidencedisplay.cpp index fef072ba..904568ab 100644 --- a/src/aoevidencedisplay.cpp +++ b/src/aoevidencedisplay.cpp @@ -21,10 +21,6 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid sfx_player->set_volume(p_volume); - QString f_evidence_path = ao_app->get_evidence_path(p_evidence_image); - - QPixmap f_pixmap(f_evidence_path); - QString final_gif_path; QString gif_name; QString icon_identifier; @@ -40,12 +36,15 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid gif_name = "evidence_appear_right"; } + QString f_evidence_path = ao_app->get_evidence_path(p_evidence_image); + QPixmap f_pixmap(f_evidence_path); + pos_size_type icon_dimensions = ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini"); + f_pixmap = f_pixmap.scaled(icon_dimensions.width, icon_dimensions.height); + evidence_icon->setPixmap(f_pixmap); + evidence_icon->resize(f_pixmap.size()); 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_movie->play(gif_name); sfx_player->play(ao_app->get_sfx("evidence_present")); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index d5dd6565..f16b8281 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -85,7 +85,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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_evidence_display = new AOEvidenceDisplay(ui_viewport, ao_app); ui_vp_chatbox = new AOImage(this, ao_app); ui_vp_showname = new QLabel(ui_vp_chatbox); -- cgit From dfac0652c8eb9bd48ceea7ae755e9c2f7e5cb1a2 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 13 Apr 2020 17:16:26 +0300 Subject: Add possibility for custom use text besides just "played music" Implemented "presented evidence" message --- include/courtroom.h | 2 +- src/courtroom.cpp | 33 ++++++++++++++++++++++++--------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 417d4557..c1bd0a64 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -221,7 +221,7 @@ public: //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 = "", QString action = ""); //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 diff --git a/src/courtroom.cpp b/src/courtroom.cpp index f16b8281..40d17e4a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2036,13 +2036,28 @@ void Courtroom::handle_chatmessage_3() int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt(); QString f_side = m_chatmessage[SIDE]; + QString f_showname; + int f_char_id = m_chatmessage[CHAR_ID].toInt(); + if (f_char_id > 0 && (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]; + } + if(f_showname.trimmed().isEmpty()) //Pure whitespace showname, get outta here. + f_showname = m_chatmessage[CHAR_NAME]; + 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; + QString f_name = local_evidence_list.at(f_evi_id - 1).name; //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()); + append_ic_text(f_name, f_showname, "has presented evidence"); } int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); @@ -2353,7 +2368,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int return p_text_escaped; } -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, QString p_action) { QTextCharFormat bold; QTextCharFormat normal; @@ -2364,7 +2379,7 @@ 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) + if (p_action == "") p_text = filter_ic_text(p_text, ao_app->is_colorlog_enabled(), -1, m_chatmessage[TEXT_COLOR].toInt()); if (log_goes_downwards) @@ -2383,9 +2398,9 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); } - if (is_songchange) + if (p_action != "") { - ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); + ui_ic_chatlog->textCursor().insertText(" " + p_action + ": ", normal); ui_ic_chatlog->textCursor().insertText(p_text + ".", italics); } else @@ -2424,9 +2439,9 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang ui_ic_chatlog->textCursor().insertText(p_name, bold); - if (is_songchange) + if (p_action != "") { - ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); + ui_ic_chatlog->textCursor().insertText(" " + p_action + ": ", normal); ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics); } else @@ -2956,7 +2971,7 @@ void Courtroom::handle_song(QStringList *p_contents) ic_chatlog_history.removeFirst(); } - append_ic_text(f_song_clear, str_show, true); + append_ic_text(f_song_clear, str_show, "has played a song"); music_player->play(f_song, channel, looping, effect_flags); if (channel == 0) @@ -4399,14 +4414,14 @@ void Courtroom::on_showname_enable_clicked() if (ui_showname_enable->isChecked()) { if (item.is_song()) - append_ic_text(item.get_message(), item.get_showname(), true); + append_ic_text(item.get_message(), item.get_showname(), "has played a song"); else append_ic_text(item.get_message(), item.get_showname()); } else { if (item.is_song()) - append_ic_text(item.get_message(), item.get_name(), true); + append_ic_text(item.get_message(), item.get_name(), "has played a song"); else append_ic_text(item.get_message(), item.get_name()); } -- cgit From 4af7bc5fffd784195385712ab6ddf476d5ae1a2f Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Tue, 19 May 2020 18:49:29 -0500 Subject: Fix broken APNG (#153) * Remove explicit APNG check * Update aocharmovie.h --- include/aocharmovie.h | 1 - src/aocharmovie.cpp | 8 ++------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/include/aocharmovie.h b/include/aocharmovie.h index 6db490b9..f62820b9 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -65,7 +65,6 @@ private: bool m_flipped = false; bool play_once = true; - bool apng = false; signals: void done(); diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 4252923a..35d9b031 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -19,8 +19,6 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) 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 = @@ -35,10 +33,8 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) 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; - } else if (file_exists(original_path)) gif_path = original_path; else if (file_exists(alt_path)) @@ -184,7 +180,7 @@ void AOCharMovie::movie_ticker() if (m_movie->frameCount() == 0) { return; } - else if (!apng) { + else { ticker->start(m_movie->nextFrameDelay()); } } -- cgit From 8c0bb87f09898314cbbaeb222c0bacc641ff5af2 Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Wed, 20 May 2020 00:22:48 -0500 Subject: specify encoding for qsettings calls --- src/text_file_functions.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 779765d7..f2bec87f 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -167,6 +167,7 @@ QString AOApplication::read_design_ini(QString p_identifier, QString p_design_path) { QSettings settings(p_design_path, QSettings::IniFormat); + settings.setIniCodec("UTF-8"); QVariant value = settings.value(p_identifier); if (value.isNull()) // Since the value wasn't found, maybe it uses the proper // config system @@ -450,6 +451,7 @@ QString AOApplication::read_char_ini(QString p_char, QString p_search_line, { QSettings settings(get_character_path(p_char, "char.ini"), QSettings::IniFormat); + settings.setIniCodec("UTF-8"); settings.beginGroup(target_tag); QString value = settings.value(p_search_line).toString(); settings.endGroup(); -- cgit From d89a4370a753f6e1da22349866b1b00f638884a6 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Thu, 21 May 2020 14:22:51 -0500 Subject: Update CI pipeline for release --- .gitlab-ci.yml | 36 ++++++++++++++++++++++++++++++++---- scripts/wasabi_program.sh | 2 +- scripts/windows/Dockerfile | 11 +++++++++-- 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bc156198..e9685de0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -83,6 +83,9 @@ build windows i686: - git submodule init - git submodule update + # Print versions + - /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake --version + # Extract BASS - mkdir bass - cd bass @@ -94,6 +97,17 @@ build windows i686: - cp bassopus.dll ../lib - cd .. + # Extract QtApng + # - mkdir qtapng + # - cd qtapng + # - curl -L https://github.com/Skycoder42/QtApng/releases/download/1.1.2-2/qtapng_mingw73_32_5.13.0.zip -o apng.zip + # - unzip apng.zip + # - mkdir ../lib/imageformats + # - cp mingw73_32/plugins/imageformats/qapng.dll ../lib/imageformats/ + # - cd .. + + - ls lib + # Build - /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake "DEFINES += DISCORD BASSAUDIO" - make -j4 @@ -165,6 +179,8 @@ deploy windows i686: # Platform-specific - cp -a ../lib/*.dll . + - mkdir imageformats + - 'cp -a ../lib/imageformats/*.dll imageformats/ || :' - cp -a ../bin/Attorney_Online.exe . # Zipping @@ -197,11 +213,17 @@ publish linux x86_64: - deploy linux x86_64 when: manual script: + - apt-get update + - apt-get install --no-install-recommends -y git nodejs npm awscli + - cd scripts + - npm install + - cd .. + - cd zip - - ../scripts/wasabi.sh + - ../scripts/wasabi_program.sh variables: MANIFEST: program_linux_x86_64.json - ARTIFACT_SUFFIX: _linux_x64.tar.xz + ARTIFACT_SUFFIX: linux_x64.tar.xz publish windows i686: image: ubuntu @@ -210,8 +232,14 @@ publish windows i686: - deploy windows i686 when: manual script: + - apt-get update + - apt-get install --no-install-recommends -y git nodejs npm awscli + - cd scripts + - npm install + - cd .. + - cd zip - - ../scripts/wasabi.sh + - ../scripts/wasabi_program.sh variables: MANIFEST: program_winnt_i386.json - ARTIFACT_SUFFIX: _windows_x86.zip + ARTIFACT_SUFFIX: windows_x86.zip diff --git a/scripts/wasabi_program.sh b/scripts/wasabi_program.sh index 41e2e352..37feac6e 100755 --- a/scripts/wasabi_program.sh +++ b/scripts/wasabi_program.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Updates the specified program manifest to a new archive and version # and uploads the new archive and manifest to S3/Wasabi. # diff --git a/scripts/windows/Dockerfile b/scripts/windows/Dockerfile index f4f1a836..b9a12d66 100644 --- a/scripts/windows/Dockerfile +++ b/scripts/windows/Dockerfile @@ -10,5 +10,12 @@ RUN /opt/mxe/usr/bin/${TARGET_SPEC}-cmake .. -DCMAKE_INSTALL_PREFIX=/opt/mxe/usr RUN /opt/mxe/usr/bin/${TARGET_SPEC}-cmake --build . --config Release --target install WORKDIR ../.. -# NOTE: Do not build QtApng statically! libpng contains a self-test entry point that -# takes precedence for some reason over the final build's entry point. +# Build QtApng statically +RUN git clone https://github.com/Skycoder42/QtApng +WORKDIR QtApng +# libpng contains a self-test entry point that takes precedence for some reason +# over the final build's entry point. +RUN sed -i "s/^main(/libpng_main(/g" src/3rdparty/libpng/src/pngtest.c +RUN /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake +RUN make && make install +WORKDIR .. \ No newline at end of file -- cgit From c8e12558cdd3fd0769b81679ad09edf1f29b780f Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 22 May 2020 01:18:24 +0300 Subject: Clang-ify the code with this styling using Visual Studio Code: { BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Stroustrup, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4, NamespaceIndentation: All } (this is the Visual Studio preset with only "BreakBeforeBraces" changed from Allman to Stroustrup) --- include/aoapplication.h | 561 ++-- include/aoblipplayer.h | 40 +- include/aobutton.h | 15 +- include/aocaseannouncerdialog.h | 41 +- include/aocharbutton.h | 37 +- include/aocharmovie.h | 144 +- include/aoemotebutton.h | 27 +- include/aoevidencebutton.h | 43 +- include/aoevidencedisplay.h | 29 +- include/aoimage.h | 19 +- include/aolineedit.h | 17 +- include/aomovie.h | 29 +- include/aomusicplayer.h | 79 +- include/aooptionsdialog.h | 5 +- include/aopacket.h | 31 +- include/aoscene.h | 44 +- include/aosfxplayer.h | 50 +- include/aotextarea.h | 21 +- include/aotextedit.h | 14 +- include/bass.h | 1542 +++++---- include/bassopus.h | 12 +- include/chatlogpiece.h | 35 +- include/courtroom.h | 1127 ++++--- include/datatypes.h | 178 +- include/debug_functions.h | 2 +- include/discord-rpc.h | 48 +- include/discord_register.h | 24 +- include/discord_rich_presence.h | 42 +- include/discord_rpc.h | 52 +- include/encryption_functions.h | 6 +- include/file_functions.h | 2 +- include/hex_functions.h | 11 +- include/lobby.h | 139 +- include/misc_functions.h | 2 +- include/networkmanager.h | 73 +- include/scrolltext.h | 11 +- include/text_file_functions.h | 8 +- src/aoapplication.cpp | 182 +- src/aoblipplayer.cpp | 95 +- src/aobutton.cpp | 34 +- src/aocaseannouncerdialog.cpp | 108 +- src/aocharbutton.cpp | 118 +- src/aocharmovie.cpp | 393 ++- src/aoemotebutton.cpp | 40 +- src/aoevidencebutton.cpp | 127 +- src/aoevidencedisplay.cpp | 79 +- src/aoimage.cpp | 51 +- src/aolineedit.cpp | 14 +- src/aomovie.cpp | 109 +- src/aomusicplayer.cpp | 262 +- src/aooptionsdialog.cpp | 61 +- src/aopacket.cpp | 75 +- src/aoscene.cpp | 176 +- src/aosfxplayer.cpp | 190 +- src/aotextarea.cpp | 67 +- src/aotextedit.cpp | 11 +- src/charselect.cpp | 282 +- src/chatlogpiece.cpp | 68 +- src/courtroom.cpp | 6805 +++++++++++++++++++-------------------- src/debug_functions.cpp | 24 +- src/discord_rich_presence.cpp | 252 +- src/emotes.cpp | 224 +- src/encryption_functions.cpp | 73 +- src/evidence.cpp | 1064 +++--- src/file_functions.cpp | 15 +- src/hardware_functions.cpp | 75 +- src/hex_functions.cpp | 27 +- src/lobby.cpp | 649 ++-- src/main.cpp | 10 +- src/misc_functions.cpp | 6 +- src/networkmanager.cpp | 292 +- src/packet_distribution.cpp | 1251 ++++--- src/path_functions.cpp | 126 +- src/scrolltext.cpp | 43 +- src/text_file_functions.cpp | 979 +++--- 75 files changed, 9161 insertions(+), 9856 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index e44f2d3c..ff75e4d1 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -6,23 +6,23 @@ #include "discord_rich_presence.h" #include -#include #include #include +#include #include -#include #include +#include #include #include #include -#include -#include #include #include +#include +#include #ifdef QTAUDIO #include #endif @@ -31,404 +31,403 @@ class NetworkManager; class Lobby; class Courtroom; -class AOApplication : public QApplication -{ - Q_OBJECT +class AOApplication : public QApplication { + Q_OBJECT public: - AOApplication(int &argc, char **argv); - ~AOApplication(); + AOApplication(int &argc, char **argv); + ~AOApplication(); - NetworkManager *net_manager; - Lobby *w_lobby; - Courtroom *w_courtroom; - AttorneyOnline::Discord *discord; + NetworkManager *net_manager; + Lobby *w_lobby; + Courtroom *w_courtroom; + AttorneyOnline::Discord *discord; - bool lobby_constructed = false; - bool courtroom_constructed = false; + bool lobby_constructed = false; + bool courtroom_constructed = false; - void construct_lobby(); - void destruct_lobby(); + void construct_lobby(); + void destruct_lobby(); - void construct_courtroom(); - void destruct_courtroom(); + void construct_courtroom(); + void destruct_courtroom(); - void ms_packet_received(AOPacket *p_packet); - void server_packet_received(AOPacket *p_packet); + 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 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); + void call_settings_menu(); + void call_announce_menu(Courtroom *court); - /////////////////server metadata////////////////// + /////////////////server metadata////////////////// - unsigned int s_decryptor = 5; - bool encryption_needed = true; + 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; - bool additive_enabled = false; - bool effects_enabled = false; + 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; + bool additive_enabled = false; + bool effects_enabled = false; - ///////////////loading info/////////////////// + ///////////////loading info/////////////////// - //player number, it's hardly used but might be needed for some old servers - int s_pv = 0; + //player number, it's hardly used but might be needed for some old servers + int s_pv = 0; - QString server_software = ""; + 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 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; - bool courtroom_loaded = false; + bool courtroom_loaded = false; - //////////////////versioning/////////////// + //////////////////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(); + 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_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;} + void set_server_list(); + QVector &get_server_list() { return server_list; } - //reads the theme from config.ini and sets it accordingly - void reload_theme(); + //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(); + //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); + //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 + ////// Functions for reading and writing files ////// + // Implementations file_functions.cpp - // Instead of reinventing the wheel, we'll use a QSettings class. - QSettings *configini; + // 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(); + //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 value of ooc_name in config.ini + QString get_ooc_name(); - //Returns the blip rate from config.ini (once per X symbols) - int read_blip_rate(); + //Returns the blip rate from config.ini (once per X symbols) + int read_blip_rate(); - //Returns true if blank blips is enabled in config.ini and false otherwise - bool get_blank_blip(); + //Returns true if 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 looping sound effects are enabled in the config.ini + bool get_looping_sfx(); - //Returns true if stop music on objection is enabled in the config.ini - bool objection_stop_music(); + //Returns true if stop music on objection is enabled in the config.ini + bool objection_stop_music(); - //Returns the value of default_music in config.ini - int get_default_music(); + //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_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 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 Discord should be enabled on startup + // from the config.ini. + bool is_discord_enabled(); - // Returns the value of whether shaking should be enabled. - // from the config.ini. - bool is_shake_enabled(); + // Returns the value of whether shaking should be enabled. + // from the config.ini. + bool is_shake_enabled(); - // Returns the value of whether effects should be enabled. - // from the config.ini. - bool is_effects_enabled(); + // Returns the value of whether effects should be enabled. + // from the config.ini. + bool is_effects_enabled(); - // Returns the value of whether frame-specific effects defined in char.ini should be sent/received over the network. - // from the config.ini. - bool is_frame_network_enabled(); + // Returns the value of whether frame-specific effects defined in char.ini should be sent/received over the network. + // from the config.ini. + bool is_frame_network_enabled(); - // Returns the value of whether colored ic log should be a thing. - // from the config.ini. - bool is_colorlog_enabled(); + // Returns the value of whether colored ic log should be a thing. + // from the config.ini. + bool is_colorlog_enabled(); - // Returns the value of whether sticky sounds should be a thing. - // from the config.ini. - bool is_stickysounds_enabled(); + // Returns the value of whether sticky sounds should be a thing. + // from the config.ini. + bool is_stickysounds_enabled(); - // Returns the value of whether sticky effects should be a thing. - // from the config.ini. - bool is_stickyeffects_enabled(); + // Returns the value of whether sticky effects should be a thing. + // from the config.ini. + bool is_stickyeffects_enabled(); - // Returns the value of whether sticky preanims should be a thing. - // from the config.ini. - bool is_stickypres_enabled(); + // Returns the value of whether sticky preanims should be a thing. + // from the config.ini. + bool is_stickypres_enabled(); - // Returns the value of the maximum amount of lines the IC chatlog - // may contain, from config.ini. - int get_max_log_size(); + // Returns the value of the maximum amount of lines the IC chatlog + // may contain, from config.ini. + int get_max_log_size(); - // Returns whether the log should go upwards (new behaviour) - // or downwards (vanilla behaviour). - bool get_log_goes_downwards(); + // 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 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 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 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(); + //Returns the list of words in callwords.ini + QStringList get_call_words(); - //returns all of the file's lines in a QStringList - QStringList get_list_file(QString p_file); + //returns all of the file's lines in a QStringList + QStringList get_list_file(QString p_file); - //Process a file and return its text as a QString - QString read_file(QString filename); + //Process a file and return its text as a QString + QString read_file(QString filename); - //Write text to file. make_dir would auto-create the directory if it doesn't exist. - bool write_to_file(QString p_text, QString p_file, bool make_dir = false); + //Write text to file. make_dir would auto-create the directory if it doesn't exist. + bool write_to_file(QString p_text, QString p_file, bool make_dir = false); - //Append text to the end of the file. make_dir would auto-create the directory if it doesn't exist. - bool append_to_file(QString p_text, QString p_file, bool make_dir = false); + //Append text to the end of the file. make_dir would auto-create the directory if it doesn't exist. + bool append_to_file(QString p_text, QString p_file, bool make_dir = false); - //Appends the argument string to serverlist.txt - void write_to_serverlist_txt(QString p_line); + //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 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 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 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, QString p_char=""); + //Returns the dimensions of widget with specified identifier from p_file + pos_size_type get_element_dimensions(QString p_identifier, QString p_file, QString p_char = ""); - //Returns the value to you - QString get_design_element(QString p_identifier, QString p_file, QString p_char=""); + //Returns the value to you + QString get_design_element(QString p_identifier, QString p_file, QString p_char = ""); - //Returns the name of the font with p_identifier from p_file - QString get_font_name(QString p_identifier, QString p_file); + //Returns the name of the font with p_identifier from p_file + QString get_font_name(QString p_identifier, QString p_file); - //Returns the value of font_size with p_identifier from p_file - int get_font_size(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 color with p_identifier from p_file + QColor get_color(QString p_identifier, QString p_file); - // Returns the markdown symbol used for specified p_identifier such as colors - QString get_chat_markdown(QString p_identifier, QString p_file); + // Returns the markdown symbol used for specified p_identifier such as colors + QString get_chat_markdown(QString p_identifier, QString p_file); - // Returns the color from the misc folder. - QColor get_chat_color(QString p_identifier, QString p_chat); + // Returns the color 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); + //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 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, WEBP? If not, GIF? If not, fall back to PNG. - QString get_image_suffix(QString path_to_check); + // Can we use APNG for this? If not, WEBP? If not, GIF? If not, fall back to PNG. + QString get_image_suffix(QString path_to_check); - // If this image is static and non-animated, return the supported static image formats. Currently only PNG. - QString get_static_image_suffix(QString path_to_check); + // If this image is static and non-animated, return the supported static image formats. Currently only PNG. + QString get_static_image_suffix(QString path_to_check); - //Returns the value of p_search_line within target_tag and terminator_tag - QString read_char_ini(QString p_char, QString p_search_line, QString target_tag); + //Returns the value of p_search_line within target_tag and terminator_tag + QString read_char_ini(QString p_char, QString p_search_line, QString target_tag); - //Returns a QStringList of all key=value definitions on a given tag. - QStringList read_ini_tags(QString p_file, QString target_tag = ""); + //Returns a QStringList of all key=value definitions on a given tag. + QStringList read_ini_tags(QString p_file, QString target_tag = ""); - //Sets the char.ini p_search_line key under tag target_tag to value. - void set_char_ini(QString p_char, QString value, QString p_search_line, QString target_tag); + //Sets the char.ini p_search_line key under tag target_tag to value. + void set_char_ini(QString p_char, QString value, QString p_search_line, QString target_tag); - //Returns the text between target_tag and terminator_tag in p_file - QString get_stylesheet(QString p_file); + //Returns the text between target_tag and terminator_tag in p_file + QString get_stylesheet(QString p_file); - //Returns the text between target_tag and terminator_tag in p_file - QString get_tagged_stylesheet(QString target_tag, QString p_file); + //Returns the text between target_tag and terminator_tag in p_file + QString get_tagged_stylesheet(QString target_tag, QString p_file); - //Returns the side of the p_char character from that characters ini file - QString get_char_side(QString p_char); + //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 showname from the ini of p_char + QString get_showname(QString p_char); - //Returns the value of chat image from the specific p_char's ini file - QString get_chat(QString p_char); + //Returns the value of chat image from the specific p_char's ini file + QString get_chat(QString p_char); - //Returns the value of chat font from the specific p_char's ini file - QString get_chat_font(QString p_char); + //Returns the value of chat font from the specific p_char's ini file + QString get_chat_font(QString p_char); - //Returns the value of chat font size from the specific p_char's ini file - int get_chat_size(QString p_char); + //Returns the value of chat font size from the specific p_char's ini file + int get_chat_size(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 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); + //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); + //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); + //Not in use + int get_text_delay(QString p_char, QString p_emote); - //Get the effects folder referenced by the char.ini, read it and return the list of filenames in a string - QStringList get_theme_effects(); + //Get the effects folder referenced by the char.ini, read it and return the list of filenames in a string + QStringList get_theme_effects(); - //Get the theme's effects folder, read it and return the list of filenames in a string - QStringList get_effects(QString p_char); + //Get the theme's effects folder, read it and return the list of filenames in a string + QStringList get_effects(QString p_char); - //t - QString get_effect(QString effect, QString p_char, QString p_folder); + //t + QString get_effect(QString effect, QString p_char, QString p_folder); - //Return the effect sound associated with the fx_name in the misc/effects//sounds.ini, or theme/effects/sounds.ini. - QString get_effect_sound(QString fx_name, QString p_char); + //Return the effect sound associated with the fx_name in the misc/effects//sounds.ini, or theme/effects/sounds.ini. + QString get_effect_sound(QString fx_name, QString p_char); - // Returns the custom realisation used by the character. - QString get_custom_realization(QString p_char); + // 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 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 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 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 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 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 the sfx of p_char's p_emote + QString get_sfx_name(QString p_char, int p_emote); - //Returns the blipsound of p_char's p_emote - QString get_emote_blip(QString p_char, int p_emote); + //Returns the blipsound of p_char's p_emote + QString get_emote_blip(QString p_char, int p_emote); - //Returns if the sfx is defined as looping in char.ini - QString get_sfx_looping(QString p_char, QString p_sfx); + //Returns if the sfx is defined as looping in char.ini + QString get_sfx_looping(QString p_char, QString p_sfx); - //Returns if an emote has a frame specific SFX for it - QString get_sfx_frame(QString p_char, QString p_emote, int n_frame); + //Returns if an emote has a frame specific SFX for it + QString get_sfx_frame(QString p_char, QString p_emote, int n_frame); - //Returns if an emote has a frame specific SFX for it - QString get_flash_frame(QString p_char, QString p_emote, int n_frame); + //Returns if an emote has a frame specific SFX for it + QString get_flash_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 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); + //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 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 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); + //Returns p_char's gender + QString get_gender(QString p_char); - // ====== - // These are all casing-related settings. - // ====== + // ====== + // These are all casing-related settings. + // ====== - // Returns if the user has casing alerts enabled. - bool get_casing_enabled(); + // 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(); + // 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 prosecution. + bool get_casing_prosecution_enabled(); - // Same for judge. - bool get_casing_judge_enabled(); + // Same for judge. + bool get_casing_judge_enabled(); - // Same for juror. - bool get_casing_juror_enabled(); + // Same for juror. + bool get_casing_juror_enabled(); - // Same for steno. - bool get_casing_steno_enabled(); + // Same for steno. + bool get_casing_steno_enabled(); - // Same for CM. - bool get_casing_cm_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 the message for the CM for casing alerts. + QString get_casing_can_host_cases(); - //The file name of the log file in base/logs. - QString log_filename; + //The file name of the log file in base/logs. + QString log_filename; private: - const int RELEASE = 2; - const int MAJOR_VERSION = 8; - const int MINOR_VERSION = 3; + const int RELEASE = 2; + const int MAJOR_VERSION = 8; + const int MINOR_VERSION = 3; - QString current_theme = "default"; + QString current_theme = "default"; - QVector server_list; - QVector favorite_list; + QVector server_list; + QVector favorite_list; private slots: - void ms_connect_finished(bool connected, bool will_retry); + void ms_connect_finished(bool connected, bool will_retry); public slots: - void server_disconnected(); - void loading_cancelled(); + void server_disconnected(); + void loading_cancelled(); }; #endif // AOAPPLICATION_H diff --git a/include/aoblipplayer.h b/include/aoblipplayer.h index a848e806..db6dfce6 100644 --- a/include/aoblipplayer.h +++ b/include/aoblipplayer.h @@ -10,38 +10,36 @@ #include "aoapplication.h" +#include +#include #include #include -#include -#include - -class AOBlipPlayer -{ +class AOBlipPlayer { public: - AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app); + AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app); - void set_blips(QString p_sfx); - void blip_tick(); - void set_volume(qreal p_volume); + void set_blips(QString p_sfx); + void blip_tick(); + void set_volume(qreal p_volume); - int m_cycle = 0; + int m_cycle = 0; private: - const int max_blip_ms = 60; + const int max_blip_ms = 60; - QWidget *m_parent; - AOApplication *ao_app; - qreal m_volume; - QElapsedTimer delay; + QWidget *m_parent; + AOApplication *ao_app; + qreal m_volume; + QElapsedTimer delay; - void set_volume_internal(qreal p_volume); + void set_volume_internal(qreal p_volume); - #if defined(BASSAUDIO) - HSTREAM m_stream_list[5]; - #elif defined(QTAUDIO) - QSoundEffect m_blips; - #endif +#if defined(BASSAUDIO) + HSTREAM m_stream_list[5]; +#elif defined(QTAUDIO) + QSoundEffect m_blips; +#endif }; #endif // AOBLIPPLAYER_H diff --git a/include/aobutton.h b/include/aobutton.h index 4b7209ae..598d2c0d 100644 --- a/include/aobutton.h +++ b/include/aobutton.h @@ -3,20 +3,19 @@ #include "aoapplication.h" -#include #include +#include -class AOButton : public QPushButton -{ - Q_OBJECT +class AOButton : public QPushButton { + Q_OBJECT public: - AOButton(QWidget *parent, AOApplication *p_ao_app); - ~AOButton(); + AOButton(QWidget *parent, AOApplication *p_ao_app); + ~AOButton(); - AOApplication *ao_app; + AOApplication *ao_app; - void set_image(QString p_image); + void set_image(QString p_image); }; #endif // AOBUTTON_H diff --git a/include/aocaseannouncerdialog.h b/include/aocaseannouncerdialog.h index a238c3f2..930fa414 100644 --- a/include/aocaseannouncerdialog.h +++ b/include/aocaseannouncerdialog.h @@ -4,42 +4,41 @@ #include "aoapplication.h" #include "courtroom.h" -#include #include -#include -#include #include +#include +#include #include #include +#include -class AOCaseAnnouncerDialog : public QDialog -{ - Q_OBJECT +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; - Courtroom *court; + AOApplication *ao_app; + Courtroom *court; - QDialogButtonBox *ui_announcer_buttons; + QDialogButtonBox *ui_announcer_buttons; - QVBoxLayout *ui_vbox_layout; - QFormLayout *ui_form_layout; + QVBoxLayout *ui_vbox_layout; + QFormLayout *ui_form_layout; - QLabel *ui_case_title_label; - QLineEdit *ui_case_title_textbox; + QLabel *ui_case_title_label; + QLineEdit *ui_case_title_textbox; - QCheckBox *ui_defense_needed; - QCheckBox *ui_prosecutor_needed; - QCheckBox *ui_judge_needed; - QCheckBox *ui_juror_needed; - QCheckBox *ui_steno_needed; + QCheckBox *ui_defense_needed; + QCheckBox *ui_prosecutor_needed; + QCheckBox *ui_judge_needed; + QCheckBox *ui_juror_needed; + QCheckBox *ui_steno_needed; public slots: - void ok_pressed(); - void cancel_pressed(); + void ok_pressed(); + void cancel_pressed(); }; #endif // AOCASEANNOUNCERDIALOG_H diff --git a/include/aocharbutton.h b/include/aocharbutton.h index f372cdf8..a5367924 100644 --- a/include/aocharbutton.h +++ b/include/aocharbutton.h @@ -4,41 +4,40 @@ #include "aoapplication.h" #include "aoimage.h" +#include #include #include #include -#include -class AOCharButton : public QPushButton -{ - Q_OBJECT +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; + AOApplication *ao_app; - void refresh(); - void reset(); - void set_taken(bool is_taken); - void set_passworded(); + void refresh(); + void reset(); + void set_taken(bool is_taken); + void set_passworded(); - void apply_taken_image(); + void apply_taken_image(); - void set_image(QString p_character); + void set_image(QString p_character); private: - bool taken; + bool taken; - QWidget *m_parent; + QWidget *m_parent; - AOImage *ui_taken; - AOImage *ui_passworded; - AOImage *ui_selector; + AOImage *ui_taken; + AOImage *ui_passworded; + AOImage *ui_selector; protected: - void enterEvent(QEvent *e); - void leaveEvent(QEvent *e); + void enterEvent(QEvent *e); + void leaveEvent(QEvent *e); }; #endif // AOCHARBUTTON_H diff --git a/include/aocharmovie.h b/include/aocharmovie.h index 15fa7cf4..2a185dd2 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -1,120 +1,118 @@ #ifndef AOCHARMOVIE_H #define AOCHARMOVIE_H +#include +#include #include #include #include -#include -#include -#include class AOApplication; -class AOCharMovie : public QLabel -{ - Q_OBJECT +class AOCharMovie : public QLabel { + Q_OBJECT public: - AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app); + AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app); - //Play a hat.gif - style preanimation - void play_pre(QString p_char, QString p_emote, int duration); + //Play a hat.gif - style preanimation + void play_pre(QString p_char, QString p_emote, int duration); - //Play a (b)normal.gif - style animation (talking) - void play_talking(QString p_char, QString p_emote); + //Play a (b)normal.gif - style animation (talking) + void play_talking(QString p_char, QString p_emote); - //Play an (a)normal.gif - style animation (not talking) - void play_idle(QString p_char, QString p_emote); + //Play an (a)normal.gif - style animation (not talking) + void play_idle(QString p_char, QString p_emote); - //Stop the movie, clearing the image - void stop(); + //Stop the movie, clearing the image + void stop(); - //Set the m_flipped variable to true/false - void set_flipped(bool p_flipped) {m_flipped = p_flipped;} + //Set the m_flipped variable to true/false + void set_flipped(bool p_flipped) { m_flipped = p_flipped; } - //Set the movie's playback speed (between 10% and 1000%) - void set_speed(int modifier) {speed = qMax(10, qMin(modifier, 1000));} + //Set the movie's playback speed (between 10% and 1000%) + void set_speed(int modifier) { speed = qMax(10, qMin(modifier, 1000)); } - //Move the label itself around - void move(int ax, int ay); + //Move the label itself around + void move(int ax, int ay); - //This is somewhat pointless now as there's no "QMovie" object to resize, aka no "combo" to speak of - void combo_resize(int w, int h); + //This is somewhat pointless now as there's no "QMovie" object to resize, aka no "combo" to speak of + void combo_resize(int w, int h); - //Return the frame delay adjusted for speed - int get_frame_delay(int delay); + //Return the frame delay adjusted for speed + int get_frame_delay(int delay); - QStringList network_strings; + QStringList network_strings; - QString m_char; - QString m_emote; + QString m_char; + QString m_emote; private: - AOApplication *ao_app; + AOApplication *ao_app; - QVector movie_frames; - QVector movie_delays; + QVector movie_frames; + QVector movie_delays; - //Effects such as sfx, screenshakes and realization flashes are stored in here. - //QString entry format: "sfx^[sfx_name]", "shake", "flash". - //The program uses the QVector index as reference. - QVector> movie_effects; + //Effects such as sfx, screenshakes and realization flashes are stored in here. + //QString entry format: "sfx^[sfx_name]", "shake", "flash". + //The program uses the QVector index as reference. + QVector> movie_effects; - QTimer *preanim_timer; - QTimer *ticker; - QString last_path; - QImageReader *m_reader = new QImageReader(); + QTimer *preanim_timer; + QTimer *ticker; + QString last_path; + QImageReader *m_reader = new QImageReader(); - QElapsedTimer actual_time; + QElapsedTimer actual_time; - //Usually used to turn seconds into milliseconds such as for [Time] tag in char.ini - const int time_mod = 60; + //Usually used to turn seconds into milliseconds such as for [Time] tag in char.ini + const int time_mod = 60; - // These are the X and Y values before they are fixed based on the sprite's width. - int x = 0; - int y = 0; - // These are the width and height values before they are fixed based on the sprite's width. - int f_w = 0; - int f_h = 0; + // These are the X and Y values before they are fixed based on the sprite's width. + int x = 0; + int y = 0; + // These are the width and height values before they are fixed based on the sprite's width. + int f_w = 0; + int f_h = 0; - int frame = 0; - int max_frames = 0; + int frame = 0; + int max_frames = 0; - int speed = 100; + int speed = 100; - bool m_flipped = false; - bool play_once = true; + bool m_flipped = false; + bool play_once = true; - //Set the movie's image to provided paths, preparing for playback. - void load_image(QString p_char, QString p_emote, QString emote_prefix); + //Set the movie's image to provided paths, preparing for playback. + void load_image(QString p_char, QString p_emote, QString emote_prefix); - //Start playback of the movie (if animated). - void play(); + //Start playback of the movie (if animated). + void play(); - //Play a frame-specific effect, if there's any defined for that specific frame. - void play_frame_effect(int frame); + //Play a frame-specific effect, if there's any defined for that specific frame. + void play_frame_effect(int frame); - //Retreive a pixmap adjused for mirroring/aspect ratio shenanigans from a provided QImage - QPixmap get_pixmap(QImage image); + //Retreive a pixmap adjused for mirroring/aspect ratio shenanigans from a provided QImage + QPixmap get_pixmap(QImage image); - //Set the movie's frame to provided pixmap - void set_frame(QPixmap f_pixmap); + //Set the movie's frame to provided pixmap + void set_frame(QPixmap f_pixmap); - //Initialize the frame-specific effects from the char.ini - void load_effects(); + //Initialize the frame-specific effects from the char.ini + void load_effects(); - //Initialize the frame-specific effects from the provided network_strings, this is only initialized if network_strings has size more than 0. - void load_network_effects(); + //Initialize the frame-specific effects from the provided network_strings, this is only initialized if network_strings has size more than 0. + void load_network_effects(); signals: - void done(); - void shake(); - void flash(); - void play_sfx(QString sfx); + void done(); + void shake(); + void flash(); + void play_sfx(QString sfx); private slots: - void preanim_done(); - void movie_ticker(); + void preanim_done(); + void movie_ticker(); }; #endif // AOCHARMOVIE_H diff --git a/include/aoemotebutton.h b/include/aoemotebutton.h index a13688bb..8674bb08 100644 --- a/include/aoemotebutton.h +++ b/include/aoemotebutton.h @@ -3,33 +3,32 @@ #include "aoapplication.h" -#include #include +#include -class AOEmoteButton : public QPushButton -{ - Q_OBJECT +class AOEmoteButton : public QPushButton { + Q_OBJECT public: - AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, int p_w, int p_h); + AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, int p_w, int p_h); - void set_image(QString p_image, QString p_emote_comment); - void set_char_image(QString p_char, int p_emote, QString suffix); + void set_image(QString p_image, QString p_emote_comment); + void set_char_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; - AOApplication *ao_app; + QWidget *parent; + AOApplication *ao_app; - int m_id = 0; + int m_id = 0; signals: - void emote_clicked(int p_id); + void emote_clicked(int p_id); private slots: - void on_clicked(); + void on_clicked(); }; #endif // AOEMOTEBUTTON_H diff --git a/include/aoevidencebutton.h b/include/aoevidencebutton.h index 53fa11ff..2ac6860b 100644 --- a/include/aoevidencebutton.h +++ b/include/aoevidencebutton.h @@ -4,48 +4,47 @@ #include "aoapplication.h" #include "aoimage.h" +#include #include #include -#include -class AOEvidenceButton : public QPushButton -{ - Q_OBJECT +class AOEvidenceButton : public QPushButton { + Q_OBJECT public: - AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, int p_w, int p_h); + AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, int p_w, int p_h); - 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_image(QString p_image); + void set_theme_image(QString p_image); + void set_id(int p_id) { m_id = p_id; } - void set_selected(bool p_selected); + void set_selected(bool p_selected); private: - AOApplication *ao_app; - QWidget *m_parent; + AOApplication *ao_app; + QWidget *m_parent; - AOImage *ui_selected; - AOImage *ui_selector; + AOImage *ui_selected; + AOImage *ui_selector; - int m_id = 0; + int m_id = 0; protected: - void enterEvent(QEvent *e); - void leaveEvent(QEvent *e); - void mouseDoubleClickEvent(QMouseEvent *e); - /* + void enterEvent(QEvent *e); + void leaveEvent(QEvent *e); + void mouseDoubleClickEvent(QMouseEvent *e); + /* void dragLeaveEvent(QMouseEvent *e); void dragEnterEvent(QMouseEvent *e); */ signals: - void evidence_clicked(int p_id); - void evidence_double_clicked(int p_id); - void on_hover(int p_id, bool p_state); + void evidence_clicked(int p_id); + void evidence_double_clicked(int p_id); + void on_hover(int p_id, bool p_state); private slots: - void on_clicked(); + void on_clicked(); }; #endif // AOEVIDENCEBUTTON_H diff --git a/include/aoevidencedisplay.h b/include/aoevidencedisplay.h index 93455c09..0315ffcf 100644 --- a/include/aoevidencedisplay.h +++ b/include/aoevidencedisplay.h @@ -2,32 +2,31 @@ #define AOEVIDENCEDISPLAY_H #include "aoapplication.h" -#include "aosfxplayer.h" #include "aomovie.h" +#include "aosfxplayer.h" -#include #include +#include -class AOEvidenceDisplay : public QLabel -{ - Q_OBJECT +class AOEvidenceDisplay : public QLabel { + Q_OBJECT public: - AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app); + 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(); - void reset(); - void combo_resize(int w, int h); + void show_evidence(QString p_evidence_image, bool is_left_side, int p_volume); + QLabel *get_evidence_icon(); + void reset(); + void combo_resize(int w, int h); private: - AOApplication *ao_app; - AOMovie *evidence_movie; - QLabel *evidence_icon; - AOSfxPlayer *sfx_player; + AOApplication *ao_app; + AOMovie *evidence_movie; + QLabel *evidence_icon; + AOSfxPlayer *sfx_player; private slots: - void show_done(); + void show_done(); }; #endif // AOEVIDENCEDISPLAY_H diff --git a/include/aoimage.h b/include/aoimage.h index 25c8e068..a6960de6 100644 --- a/include/aoimage.h +++ b/include/aoimage.h @@ -5,21 +5,20 @@ #include "aoapplication.h" -#include #include +#include -class AOImage : public QLabel -{ +class AOImage : public QLabel { public: - AOImage(QWidget *parent, AOApplication *p_ao_app); - ~AOImage(); + AOImage(QWidget *parent, AOApplication *p_ao_app); + ~AOImage(); - QWidget *m_parent; - AOApplication *ao_app; + QWidget *m_parent; + AOApplication *ao_app; - bool set_image(QString p_image); - bool set_chatbox(QString p_path); - void set_size_and_pos(QString identifier); + bool set_image(QString p_image); + bool set_chatbox(QString p_path); + void set_size_and_pos(QString identifier); }; #endif // AOIMAGE_H diff --git a/include/aolineedit.h b/include/aolineedit.h index 09521729..06206a95 100644 --- a/include/aolineedit.h +++ b/include/aolineedit.h @@ -4,24 +4,23 @@ #include #include -class AOLineEdit : public QLineEdit -{ - Q_OBJECT +class AOLineEdit : public QLineEdit { + Q_OBJECT public: - AOLineEdit(QWidget *parent); + AOLineEdit(QWidget *parent); - void preserve_selection(bool toggle) {p_selection = toggle;} + void preserve_selection(bool toggle) { p_selection = toggle; } private: - bool p_selection = false; + bool p_selection = false; protected: - void mouseDoubleClickEvent(QMouseEvent *e); - void focusOutEvent(QFocusEvent *ev); + void mouseDoubleClickEvent(QMouseEvent *e); + void focusOutEvent(QFocusEvent *ev); signals: - void double_clicked(); + void double_clicked(); }; #endif // AOLINEEDIT_H diff --git a/include/aomovie.h b/include/aomovie.h index ec286199..8d604423 100644 --- a/include/aomovie.h +++ b/include/aomovie.h @@ -7,30 +7,29 @@ class Courtroom; class AOApplication; -class AOMovie : public QLabel -{ - Q_OBJECT +class AOMovie : public QLabel { + Q_OBJECT public: - AOMovie(QWidget *p_parent, AOApplication *p_ao_app); + AOMovie(QWidget *p_parent, AOApplication *p_ao_app); - void set_play_once(bool p_play_once); - void play(QString p_image, QString p_char = "", QString p_custom_theme = "", int default_duration = 0); - void combo_resize(int w, int h); - void stop(); + void set_play_once(bool p_play_once); + void play(QString p_image, 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; + QMovie *m_movie; + AOApplication *ao_app; + QTimer *timer; + bool play_once = true; signals: - void done(); + void done(); private slots: - void frame_change(int n_frame); - void timer_done(); + void frame_change(int n_frame); + void timer_done(); }; #endif // AOMOVIE_H diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 1a535828..d28a3ed6 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -10,73 +10,70 @@ #endif #include "aoapplication.h" +#include #include #include -#include #if defined(BASSAUDIO) -class AOMusicPlayer -{ +class AOMusicPlayer { public: - AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - virtual ~AOMusicPlayer(); - void set_volume(int p_value, int channel=-1); - void set_looping(bool toggle, int channel=0); + AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); + virtual ~AOMusicPlayer(); + void set_volume(int p_value, int channel = -1); + void set_looping(bool toggle, int channel = 0); - const int m_channelmax = 4; + const int m_channelmax = 4; - //These have to be public for the stupid sync thing - QWORD loop_start = 0; - QWORD loop_end = 0; + //These have to be public for the stupid sync thing + QWORD loop_start = 0; + QWORD loop_end = 0; public slots: - void play(QString p_song, int channel=0, bool loop=false, int effect_flags=0); - void stop(int channel=0); + void play(QString p_song, int channel = 0, bool loop = false, int effect_flags = 0); + void stop(int channel = 0); private: - QWidget *m_parent; - AOApplication *ao_app; + QWidget *m_parent; + AOApplication *ao_app; - bool m_looping = false; - int m_volume[4] = {0, 0, 0, 0}; + bool m_looping = false; + int m_volume[4] = {0, 0, 0, 0}; - // Channel 0 = music - // Channel 1 = ambience - // Channel 2 = extra - // Channel 3 = extra - HSTREAM m_stream_list[4]; - HSYNC loop_sync[4]; + // Channel 0 = music + // Channel 1 = ambience + // Channel 2 = extra + // Channel 3 = extra + HSTREAM m_stream_list[4]; + HSYNC loop_sync[4]; }; #elif defined(QTAUDIO) -class AOMusicPlayer -{ +class AOMusicPlayer { public: - AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - ~AOMusicPlayer(); + AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); + ~AOMusicPlayer(); - void play(QString p_song); - void set_volume(int p_value); + void play(QString p_song); + void set_volume(int p_value); private: - QMediaPlayer m_player; - QWidget *m_parent; - AOApplication *ao_app; + QMediaPlayer m_player; + QWidget *m_parent; + AOApplication *ao_app; - int m_volume = 0; + int m_volume = 0; }; #else -class AOMusicPlayer -{ +class AOMusicPlayer { public: - AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - ~AOMusicPlayer(); + AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); + ~AOMusicPlayer(); - void play(QString p_song); - void set_volume(int p_value); + void play(QString p_song); + void set_volume(int p_value); private: - QWidget *m_parent; - AOApplication *ao_app; + QWidget *m_parent; + AOApplication *ao_app; }; #endif diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 4a63ca35..f9c369d2 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -21,17 +21,16 @@ #include #include #include +#include #include #include #include #include -#include #include #include -class AOOptionsDialog: public QDialog -{ +class AOOptionsDialog : public QDialog { Q_OBJECT public: explicit AOOptionsDialog(QWidget *parent = nullptr, AOApplication *p_ao_app = nullptr); diff --git a/include/aopacket.h b/include/aopacket.h index 21f6e0f4..4133fd56 100644 --- a/include/aopacket.h +++ b/include/aopacket.h @@ -1,32 +1,31 @@ #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(); + 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 to_string(); + QString get_header() { return m_header; } + QStringList &get_contents() { return m_contents; } + QString to_string(); - void encrypt_header(unsigned int p_key); - void decrypt_header(unsigned int p_key); + void encrypt_header(unsigned int p_key); + void decrypt_header(unsigned int p_key); - void net_encode(); - void net_decode(); + void net_encode(); + void net_decode(); private: - bool encrypted = false; + bool encrypted = false; - QString m_header; - QStringList m_contents; + QString m_header; + QStringList m_contents; }; #endif // AOPACKET_H diff --git a/include/aoscene.h b/include/aoscene.h index 46d8c3b8..3093b0fb 100644 --- a/include/aoscene.h +++ b/include/aoscene.h @@ -1,39 +1,39 @@ #ifndef AOSCENE_H #define AOSCENE_H -#include #include +#include #include class Courtroom; class AOApplication; -class AOScene : public QLabel -{ - Q_OBJECT +class AOScene : public QLabel { + Q_OBJECT public: - explicit AOScene(QWidget *parent, AOApplication *p_ao_app); + explicit AOScene(QWidget *parent, AOApplication *p_ao_app); + + void set_image(QString p_image); + void set_legacy_desk(QString p_image); - void set_image(QString p_image); - void set_legacy_desk(QString p_image); + //Move the label itself around + void move(int ax, int ay); - //Move the label itself around - void move(int ax, int ay); + //This is somewhat pointless now as there's no "QMovie" object to resize, aka no "combo" to speak of + void combo_resize(int w, int h); - //This is somewhat pointless now as there's no "QMovie" object to resize, aka no "combo" to speak of - void combo_resize(int w, int h); private: - QWidget *m_parent; - QMovie *m_movie; - AOApplication *ao_app; - QString last_image; - - // These are the X and Y values before they are fixed based on the sprite's width. - int x = 0; - int y = 0; - // These are the width and height values before they are fixed based on the sprite's width. - int f_w = 0; - int f_h = 0; + QWidget *m_parent; + QMovie *m_movie; + AOApplication *ao_app; + QString last_image; + + // These are the X and Y values before they are fixed based on the sprite's width. + int x = 0; + int y = 0; + // These are the width and height values before they are fixed based on the sprite's width. + int f_w = 0; + int f_h = 0; }; #endif // AOSCENE_H diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h index 3ae8bdf1..4488aa6a 100644 --- a/include/aosfxplayer.h +++ b/include/aosfxplayer.h @@ -10,36 +10,36 @@ #include "aoapplication.h" +#include #include #include -#include -class AOSfxPlayer -{ +class AOSfxPlayer { public: - AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app); - - void clear(); - void loop_clear(); - void play(QString p_sfx, QString p_char = "", QString shout = "", int channel=-1); - void stop(int channel=-1); - void set_volume(qreal p_volume); - void set_looping(bool toggle, int channel=-1); - int m_channel = 0; + AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app); + + void clear(); + void loop_clear(); + void play(QString p_sfx, QString p_char = "", QString shout = "", int channel = -1); + void stop(int channel = -1); + void set_volume(qreal p_volume); + void set_looping(bool toggle, int channel = -1); + int m_channel = 0; + private: - QWidget *m_parent; - AOApplication *ao_app; - qreal m_volume = 0; - - bool m_looping = true; - void set_volume_internal(qreal p_volume); - - #if defined(BASSAUDIO) - const int m_channelmax = 5; - HSTREAM m_stream_list[5]; - #elif defined(QTAUDIO) - QSoundEffect m_sfx; - #endif + QWidget *m_parent; + AOApplication *ao_app; + qreal m_volume = 0; + + bool m_looping = true; + void set_volume_internal(qreal p_volume); + +#if defined(BASSAUDIO) + const int m_channelmax = 5; + HSTREAM m_stream_list[5]; +#elif defined(QTAUDIO) + QSoundEffect m_sfx; +#endif }; #endif // AOSFXPLAYER_H diff --git a/include/aotextarea.h b/include/aotextarea.h index 643a8e34..8bf5199b 100644 --- a/include/aotextarea.h +++ b/include/aotextarea.h @@ -1,25 +1,24 @@ #ifndef AOTEXTAREA_H #define AOTEXTAREA_H -#include +#include +#include #include +#include #include -#include -#include -class AOTextArea : public QTextBrowser -{ +class AOTextArea : public QTextBrowser { public: - AOTextArea(QWidget *p_parent = nullptr); + AOTextArea(QWidget *p_parent = nullptr); - void append_linked(QString p_message); - void append_chatmessage(QString p_name, QString p_message, QString p_colur); - void append_error(QString p_message); + void append_linked(QString p_message); + void append_chatmessage(QString p_name, QString p_message, QString p_colur); + void append_error(QString p_message); private: - const QRegExp url_parser_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b"); + const QRegExp url_parser_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b"); - void auto_scroll(QTextCursor old_cursor, int scrollbar_value, bool is_scrolled_down); + void auto_scroll(QTextCursor old_cursor, int scrollbar_value, bool is_scrolled_down); }; #endif // AOTEXTAREA_H diff --git a/include/aotextedit.h b/include/aotextedit.h index 85909c6e..eb2c356d 100644 --- a/include/aotextedit.h +++ b/include/aotextedit.h @@ -3,21 +3,19 @@ #include -class AOTextEdit : public QPlainTextEdit -{ - Q_OBJECT +class AOTextEdit : public QPlainTextEdit { + Q_OBJECT public: - AOTextEdit(QWidget *parent); + AOTextEdit(QWidget *parent); protected: - void mouseDoubleClickEvent(QMouseEvent *e); + void mouseDoubleClickEvent(QMouseEvent *e); signals: - void double_clicked(); + void double_clicked(); private slots: - void on_enter_pressed(); - + void on_enter_pressed(); }; #endif // AOTEXTEDIT_H diff --git a/include/bass.h b/include/bass.h index 388d4068..4180a371 100644 --- a/include/bass.h +++ b/include/bass.h @@ -27,19 +27,19 @@ typedef int BOOL; #define FALSE 0 #endif #define LOBYTE(a) (BYTE)(a) -#define HIBYTE(a) (BYTE)((a)>>8) +#define HIBYTE(a) (BYTE)((a) >> 8) #define LOWORD(a) (WORD)(a) -#define HIWORD(a) (WORD)((a)>>16) -#define MAKEWORD(a,b) (WORD)(((a)&0xff)|((b)<<8)) -#define MAKELONG(a,b) (DWORD)(((a)&0xffff)|((b)<<16)) +#define HIWORD(a) (WORD)((a) >> 16) +#define MAKEWORD(a, b) (WORD)(((a)&0xff) | ((b) << 8)) +#define MAKELONG(a, b) (DWORD)(((a)&0xffff) | ((b) << 16)) #endif #ifdef __cplusplus extern "C" { #endif -#define BASSVERSION 0x204 // API version -#define BASSVERSIONTEXT "2.4" +#define BASSVERSION 0x204 // API version +#define BASSVERSIONTEXT "2.4" #ifndef BASSDEF #define BASSDEF(f) WINAPI f @@ -47,397 +47,396 @@ extern "C" { #define NOBASSOVERLOADS #endif -typedef DWORD HMUSIC; // MOD music handle -typedef DWORD HSAMPLE; // sample handle -typedef DWORD HCHANNEL; // playing sample's channel handle -typedef DWORD HSTREAM; // sample stream handle -typedef DWORD HRECORD; // recording handle -typedef DWORD HSYNC; // synchronizer handle -typedef DWORD HDSP; // DSP handle -typedef DWORD HFX; // DX8 effect handle -typedef DWORD HPLUGIN; // Plugin handle +typedef DWORD HMUSIC; // MOD music handle +typedef DWORD HSAMPLE; // sample handle +typedef DWORD HCHANNEL; // playing sample's channel handle +typedef DWORD HSTREAM; // sample stream handle +typedef DWORD HRECORD; // recording handle +typedef DWORD HSYNC; // synchronizer handle +typedef DWORD HDSP; // DSP handle +typedef DWORD HFX; // DX8 effect handle +typedef DWORD HPLUGIN; // Plugin handle // Error codes returned by BASS_ErrorGetCode -#define BASS_OK 0 // all is OK -#define BASS_ERROR_MEM 1 // memory error -#define BASS_ERROR_FILEOPEN 2 // can't open the file -#define BASS_ERROR_DRIVER 3 // can't find a free/valid driver -#define BASS_ERROR_BUFLOST 4 // the sample buffer was lost -#define BASS_ERROR_HANDLE 5 // invalid handle -#define BASS_ERROR_FORMAT 6 // unsupported sample format -#define BASS_ERROR_POSITION 7 // invalid position -#define BASS_ERROR_INIT 8 // BASS_Init has not been successfully called -#define BASS_ERROR_START 9 // BASS_Start has not been successfully called -#define BASS_ERROR_SSL 10 // SSL/HTTPS support isn't available -#define BASS_ERROR_ALREADY 14 // already initialized/paused/whatever -#define BASS_ERROR_NOCHAN 18 // can't get a free channel -#define BASS_ERROR_ILLTYPE 19 // an illegal type was specified -#define BASS_ERROR_ILLPARAM 20 // an illegal parameter was specified -#define BASS_ERROR_NO3D 21 // no 3D support -#define BASS_ERROR_NOEAX 22 // no EAX support -#define BASS_ERROR_DEVICE 23 // illegal device number -#define BASS_ERROR_NOPLAY 24 // not playing -#define BASS_ERROR_FREQ 25 // illegal sample rate -#define BASS_ERROR_NOTFILE 27 // the stream is not a file stream -#define BASS_ERROR_NOHW 29 // no hardware voices available -#define BASS_ERROR_EMPTY 31 // the MOD music has no sequence data -#define BASS_ERROR_NONET 32 // no internet connection could be opened -#define BASS_ERROR_CREATE 33 // couldn't create the file -#define BASS_ERROR_NOFX 34 // effects are not available -#define BASS_ERROR_NOTAVAIL 37 // requested data/action is not available -#define BASS_ERROR_DECODE 38 // the channel is/isn't a "decoding channel" -#define BASS_ERROR_DX 39 // a sufficient DirectX version is not installed -#define BASS_ERROR_TIMEOUT 40 // connection timedout -#define BASS_ERROR_FILEFORM 41 // unsupported file format -#define BASS_ERROR_SPEAKER 42 // unavailable speaker -#define BASS_ERROR_VERSION 43 // invalid BASS version (used by add-ons) -#define BASS_ERROR_CODEC 44 // codec is not available/supported -#define BASS_ERROR_ENDED 45 // the channel/file has ended -#define BASS_ERROR_BUSY 46 // the device is busy -#define BASS_ERROR_UNKNOWN -1 // some other mystery problem +#define BASS_OK 0 // all is OK +#define BASS_ERROR_MEM 1 // memory error +#define BASS_ERROR_FILEOPEN 2 // can't open the file +#define BASS_ERROR_DRIVER 3 // can't find a free/valid driver +#define BASS_ERROR_BUFLOST 4 // the sample buffer was lost +#define BASS_ERROR_HANDLE 5 // invalid handle +#define BASS_ERROR_FORMAT 6 // unsupported sample format +#define BASS_ERROR_POSITION 7 // invalid position +#define BASS_ERROR_INIT 8 // BASS_Init has not been successfully called +#define BASS_ERROR_START 9 // BASS_Start has not been successfully called +#define BASS_ERROR_SSL 10 // SSL/HTTPS support isn't available +#define BASS_ERROR_ALREADY 14 // already initialized/paused/whatever +#define BASS_ERROR_NOCHAN 18 // can't get a free channel +#define BASS_ERROR_ILLTYPE 19 // an illegal type was specified +#define BASS_ERROR_ILLPARAM 20 // an illegal parameter was specified +#define BASS_ERROR_NO3D 21 // no 3D support +#define BASS_ERROR_NOEAX 22 // no EAX support +#define BASS_ERROR_DEVICE 23 // illegal device number +#define BASS_ERROR_NOPLAY 24 // not playing +#define BASS_ERROR_FREQ 25 // illegal sample rate +#define BASS_ERROR_NOTFILE 27 // the stream is not a file stream +#define BASS_ERROR_NOHW 29 // no hardware voices available +#define BASS_ERROR_EMPTY 31 // the MOD music has no sequence data +#define BASS_ERROR_NONET 32 // no internet connection could be opened +#define BASS_ERROR_CREATE 33 // couldn't create the file +#define BASS_ERROR_NOFX 34 // effects are not available +#define BASS_ERROR_NOTAVAIL 37 // requested data/action is not available +#define BASS_ERROR_DECODE 38 // the channel is/isn't a "decoding channel" +#define BASS_ERROR_DX 39 // a sufficient DirectX version is not installed +#define BASS_ERROR_TIMEOUT 40 // connection timedout +#define BASS_ERROR_FILEFORM 41 // unsupported file format +#define BASS_ERROR_SPEAKER 42 // unavailable speaker +#define BASS_ERROR_VERSION 43 // invalid BASS version (used by add-ons) +#define BASS_ERROR_CODEC 44 // codec is not available/supported +#define BASS_ERROR_ENDED 45 // the channel/file has ended +#define BASS_ERROR_BUSY 46 // the device is busy +#define BASS_ERROR_UNKNOWN -1 // some other mystery problem // BASS_SetConfig options -#define BASS_CONFIG_BUFFER 0 -#define BASS_CONFIG_UPDATEPERIOD 1 -#define BASS_CONFIG_GVOL_SAMPLE 4 -#define BASS_CONFIG_GVOL_STREAM 5 -#define BASS_CONFIG_GVOL_MUSIC 6 -#define BASS_CONFIG_CURVE_VOL 7 -#define BASS_CONFIG_CURVE_PAN 8 -#define BASS_CONFIG_FLOATDSP 9 -#define BASS_CONFIG_3DALGORITHM 10 -#define BASS_CONFIG_NET_TIMEOUT 11 -#define BASS_CONFIG_NET_BUFFER 12 -#define BASS_CONFIG_PAUSE_NOPLAY 13 -#define BASS_CONFIG_NET_PREBUF 15 -#define BASS_CONFIG_NET_PASSIVE 18 -#define BASS_CONFIG_REC_BUFFER 19 -#define BASS_CONFIG_NET_PLAYLIST 21 -#define BASS_CONFIG_MUSIC_VIRTUAL 22 -#define BASS_CONFIG_VERIFY 23 -#define BASS_CONFIG_UPDATETHREADS 24 -#define BASS_CONFIG_DEV_BUFFER 27 -#define BASS_CONFIG_REC_LOOPBACK 28 -#define BASS_CONFIG_VISTA_TRUEPOS 30 -#define BASS_CONFIG_IOS_MIXAUDIO 34 -#define BASS_CONFIG_DEV_DEFAULT 36 -#define BASS_CONFIG_NET_READTIMEOUT 37 -#define BASS_CONFIG_VISTA_SPEAKERS 38 -#define BASS_CONFIG_IOS_SPEAKER 39 -#define BASS_CONFIG_MF_DISABLE 40 -#define BASS_CONFIG_HANDLES 41 -#define BASS_CONFIG_UNICODE 42 -#define BASS_CONFIG_SRC 43 -#define BASS_CONFIG_SRC_SAMPLE 44 -#define BASS_CONFIG_ASYNCFILE_BUFFER 45 -#define BASS_CONFIG_OGG_PRESCAN 47 -#define BASS_CONFIG_MF_VIDEO 48 -#define BASS_CONFIG_AIRPLAY 49 -#define BASS_CONFIG_DEV_NONSTOP 50 -#define BASS_CONFIG_IOS_NOCATEGORY 51 -#define BASS_CONFIG_VERIFY_NET 52 -#define BASS_CONFIG_DEV_PERIOD 53 -#define BASS_CONFIG_FLOAT 54 -#define BASS_CONFIG_NET_SEEK 56 -#define BASS_CONFIG_AM_DISABLE 58 -#define BASS_CONFIG_NET_PLAYLIST_DEPTH 59 -#define BASS_CONFIG_NET_PREBUF_WAIT 60 -#define BASS_CONFIG_WASAPI_PERSIST 65 -#define BASS_CONFIG_REC_WASAPI 66 +#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_REC_LOOPBACK 28 +#define BASS_CONFIG_VISTA_TRUEPOS 30 +#define BASS_CONFIG_IOS_MIXAUDIO 34 +#define BASS_CONFIG_DEV_DEFAULT 36 +#define BASS_CONFIG_NET_READTIMEOUT 37 +#define BASS_CONFIG_VISTA_SPEAKERS 38 +#define BASS_CONFIG_IOS_SPEAKER 39 +#define BASS_CONFIG_MF_DISABLE 40 +#define BASS_CONFIG_HANDLES 41 +#define BASS_CONFIG_UNICODE 42 +#define BASS_CONFIG_SRC 43 +#define BASS_CONFIG_SRC_SAMPLE 44 +#define BASS_CONFIG_ASYNCFILE_BUFFER 45 +#define BASS_CONFIG_OGG_PRESCAN 47 +#define BASS_CONFIG_MF_VIDEO 48 +#define BASS_CONFIG_AIRPLAY 49 +#define BASS_CONFIG_DEV_NONSTOP 50 +#define BASS_CONFIG_IOS_NOCATEGORY 51 +#define BASS_CONFIG_VERIFY_NET 52 +#define BASS_CONFIG_DEV_PERIOD 53 +#define BASS_CONFIG_FLOAT 54 +#define BASS_CONFIG_NET_SEEK 56 +#define BASS_CONFIG_AM_DISABLE 58 +#define BASS_CONFIG_NET_PLAYLIST_DEPTH 59 +#define BASS_CONFIG_NET_PREBUF_WAIT 60 +#define BASS_CONFIG_WASAPI_PERSIST 65 +#define BASS_CONFIG_REC_WASAPI 66 // BASS_SetConfigPtr options -#define BASS_CONFIG_NET_AGENT 16 -#define BASS_CONFIG_NET_PROXY 17 -#define BASS_CONFIG_IOS_NOTIFY 46 -#define BASS_CONFIG_LIBSSL 64 +#define BASS_CONFIG_NET_AGENT 16 +#define BASS_CONFIG_NET_PROXY 17 +#define BASS_CONFIG_IOS_NOTIFY 46 +#define BASS_CONFIG_LIBSSL 64 // BASS_Init flags -#define BASS_DEVICE_8BITS 1 // 8 bit -#define BASS_DEVICE_MONO 2 // mono -#define BASS_DEVICE_3D 4 // enable 3D functionality -#define BASS_DEVICE_16BITS 8 // limit output to 16 bit -#define BASS_DEVICE_LATENCY 0x100 // calculate device latency (BASS_INFO struct) -#define BASS_DEVICE_CPSPEAKERS 0x400 // detect speakers via Windows control panel -#define BASS_DEVICE_SPEAKERS 0x800 // force enabling of speaker assignment -#define BASS_DEVICE_NOSPEAKER 0x1000 // ignore speaker arrangement -#define BASS_DEVICE_DMIX 0x2000 // use ALSA "dmix" plugin -#define BASS_DEVICE_FREQ 0x4000 // set device sample rate -#define BASS_DEVICE_STEREO 0x8000 // limit output to stereo -#define BASS_DEVICE_HOG 0x10000 // hog/exclusive mode -#define BASS_DEVICE_AUDIOTRACK 0x20000 // use AudioTrack output -#define BASS_DEVICE_DSOUND 0x40000 // use DirectSound output +#define BASS_DEVICE_8BITS 1 // 8 bit +#define BASS_DEVICE_MONO 2 // mono +#define BASS_DEVICE_3D 4 // enable 3D functionality +#define BASS_DEVICE_16BITS 8 // limit output to 16 bit +#define BASS_DEVICE_LATENCY 0x100 // calculate device latency (BASS_INFO struct) +#define BASS_DEVICE_CPSPEAKERS 0x400 // detect speakers via Windows control panel +#define BASS_DEVICE_SPEAKERS 0x800 // force enabling of speaker assignment +#define BASS_DEVICE_NOSPEAKER 0x1000 // ignore speaker arrangement +#define BASS_DEVICE_DMIX 0x2000 // use ALSA "dmix" plugin +#define BASS_DEVICE_FREQ 0x4000 // set device sample rate +#define BASS_DEVICE_STEREO 0x8000 // limit output to stereo +#define BASS_DEVICE_HOG 0x10000 // hog/exclusive mode +#define BASS_DEVICE_AUDIOTRACK 0x20000 // use AudioTrack output +#define BASS_DEVICE_DSOUND 0x40000 // use DirectSound output // DirectSound interfaces (for use with BASS_GetDSoundObject) -#define BASS_OBJECT_DS 1 // IDirectSound -#define BASS_OBJECT_DS3DL 2 // IDirectSound3DListener +#define BASS_OBJECT_DS 1 // IDirectSound +#define BASS_OBJECT_DS3DL 2 // IDirectSound3DListener // Device info structure typedef struct { -#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) - const wchar_t *name; // description - const wchar_t *driver; // driver +#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) + const wchar_t *name; // description + const wchar_t *driver; // driver #else - const char *name; // description - const char *driver; // driver + const char *name; // description + const char *driver; // driver #endif - DWORD flags; + DWORD flags; } BASS_DEVICEINFO; // BASS_DEVICEINFO flags -#define BASS_DEVICE_ENABLED 1 -#define BASS_DEVICE_DEFAULT 2 -#define BASS_DEVICE_INIT 4 -#define BASS_DEVICE_LOOPBACK 8 - -#define BASS_DEVICE_TYPE_MASK 0xff000000 -#define BASS_DEVICE_TYPE_NETWORK 0x01000000 -#define BASS_DEVICE_TYPE_SPEAKERS 0x02000000 -#define BASS_DEVICE_TYPE_LINE 0x03000000 -#define BASS_DEVICE_TYPE_HEADPHONES 0x04000000 -#define BASS_DEVICE_TYPE_MICROPHONE 0x05000000 -#define BASS_DEVICE_TYPE_HEADSET 0x06000000 -#define BASS_DEVICE_TYPE_HANDSET 0x07000000 -#define BASS_DEVICE_TYPE_DIGITAL 0x08000000 -#define BASS_DEVICE_TYPE_SPDIF 0x09000000 -#define BASS_DEVICE_TYPE_HDMI 0x0a000000 -#define BASS_DEVICE_TYPE_DISPLAYPORT 0x40000000 - -// BASS_GetDeviceInfo flags -#define BASS_DEVICES_AIRPLAY 0x1000000 - +#define BASS_DEVICE_ENABLED 1 +#define BASS_DEVICE_DEFAULT 2 +#define BASS_DEVICE_INIT 4 +#define BASS_DEVICE_LOOPBACK 8 + +#define BASS_DEVICE_TYPE_MASK 0xff000000 +#define BASS_DEVICE_TYPE_NETWORK 0x01000000 +#define BASS_DEVICE_TYPE_SPEAKERS 0x02000000 +#define BASS_DEVICE_TYPE_LINE 0x03000000 +#define BASS_DEVICE_TYPE_HEADPHONES 0x04000000 +#define BASS_DEVICE_TYPE_MICROPHONE 0x05000000 +#define BASS_DEVICE_TYPE_HEADSET 0x06000000 +#define BASS_DEVICE_TYPE_HANDSET 0x07000000 +#define BASS_DEVICE_TYPE_DIGITAL 0x08000000 +#define BASS_DEVICE_TYPE_SPDIF 0x09000000 +#define BASS_DEVICE_TYPE_HDMI 0x0a000000 +#define BASS_DEVICE_TYPE_DISPLAYPORT 0x40000000 + +// BASS_GetDeviceInfo flags +#define BASS_DEVICES_AIRPLAY 0x1000000 + typedef struct { - DWORD flags; // device capabilities (DSCAPS_xxx flags) - DWORD hwsize; // size of total device hardware memory - DWORD hwfree; // size of free device hardware memory - DWORD freesam; // number of free sample slots in the hardware - DWORD free3d; // number of free 3D sample slots in the hardware - DWORD minrate; // min sample rate supported by the hardware - DWORD maxrate; // max sample rate supported by the hardware - BOOL eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used) - DWORD minbuf; // recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY) - DWORD dsver; // DirectSound version - DWORD latency; // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY) - DWORD initflags; // BASS_Init "flags" parameter - DWORD speakers; // number of speakers available - DWORD freq; // current output rate + DWORD flags; // device capabilities (DSCAPS_xxx flags) + DWORD hwsize; // size of total device hardware memory + DWORD hwfree; // size of free device hardware memory + DWORD freesam; // number of free sample slots in the hardware + DWORD free3d; // number of free 3D sample slots in the hardware + DWORD minrate; // min sample rate supported by the hardware + DWORD maxrate; // max sample rate supported by the hardware + BOOL eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used) + DWORD minbuf; // recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY) + DWORD dsver; // DirectSound version + DWORD latency; // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY) + DWORD initflags; // BASS_Init "flags" parameter + DWORD speakers; // number of speakers available + DWORD freq; // current output rate } BASS_INFO; // BASS_INFO flags (from DSOUND.H) -#define DSCAPS_CONTINUOUSRATE 0x00000010 // supports all sample rates between min/maxrate -#define DSCAPS_EMULDRIVER 0x00000020 // device does NOT have hardware DirectSound support -#define DSCAPS_CERTIFIED 0x00000040 // device driver has been certified by Microsoft -#define DSCAPS_SECONDARYMONO 0x00000100 // mono -#define DSCAPS_SECONDARYSTEREO 0x00000200 // stereo -#define DSCAPS_SECONDARY8BIT 0x00000400 // 8 bit -#define DSCAPS_SECONDARY16BIT 0x00000800 // 16 bit +#define DSCAPS_CONTINUOUSRATE 0x00000010 // supports all sample rates between min/maxrate +#define DSCAPS_EMULDRIVER 0x00000020 // device does NOT have hardware DirectSound support +#define DSCAPS_CERTIFIED 0x00000040 // device driver has been certified by Microsoft +#define DSCAPS_SECONDARYMONO 0x00000100 // mono +#define DSCAPS_SECONDARYSTEREO 0x00000200 // stereo +#define DSCAPS_SECONDARY8BIT 0x00000400 // 8 bit +#define DSCAPS_SECONDARY16BIT 0x00000800 // 16 bit // Recording device info structure typedef struct { - DWORD flags; // device capabilities (DSCCAPS_xxx flags) - DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags) - DWORD inputs; // number of inputs - BOOL singlein; // TRUE = only 1 input can be set at a time - DWORD freq; // current input rate + DWORD flags; // device capabilities (DSCCAPS_xxx flags) + DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags) + DWORD inputs; // number of inputs + BOOL singlein; // TRUE = only 1 input can be set at a time + DWORD freq; // current input rate } BASS_RECORDINFO; // BASS_RECORDINFO flags (from DSOUND.H) -#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER // device does NOT have hardware DirectSound recording support -#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED // device driver has been certified by Microsoft +#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER // device does NOT have hardware DirectSound recording support +#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED // device driver has been certified by Microsoft // defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H) #ifndef WAVE_FORMAT_1M08 -#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */ -#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */ -#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */ -#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */ -#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */ -#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */ -#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */ -#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */ -#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */ -#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */ -#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */ -#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */ +#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */ +#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */ +#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */ +#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */ +#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */ +#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */ +#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */ +#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */ +#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */ +#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */ +#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */ +#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */ #endif // Sample info structure typedef struct { - DWORD freq; // default playback rate - float volume; // default volume (0-1) - float pan; // default pan (-1=left, 0=middle, 1=right) - DWORD flags; // BASS_SAMPLE_xxx flags - DWORD length; // length (in bytes) - DWORD max; // maximum simultaneous playbacks - DWORD origres; // original resolution - DWORD chans; // number of channels - DWORD mingap; // minimum gap (ms) between creating channels - DWORD mode3d; // BASS_3DMODE_xxx mode - float mindist; // minimum distance - float maxdist; // maximum distance - DWORD iangle; // angle of inside projection cone - DWORD oangle; // angle of outside projection cone - float outvol; // delta-volume outside the projection cone - DWORD vam; // voice allocation/management flags (BASS_VAM_xxx) - DWORD priority; // priority (0=lowest, 0xffffffff=highest) + DWORD freq; // default playback rate + float volume; // default volume (0-1) + float pan; // default pan (-1=left, 0=middle, 1=right) + DWORD flags; // BASS_SAMPLE_xxx flags + DWORD length; // length (in bytes) + DWORD max; // maximum simultaneous playbacks + DWORD origres; // original resolution + DWORD chans; // number of channels + DWORD mingap; // minimum gap (ms) between creating channels + DWORD mode3d; // BASS_3DMODE_xxx mode + float mindist; // minimum distance + float maxdist; // maximum distance + DWORD iangle; // angle of inside projection cone + DWORD oangle; // angle of outside projection cone + float outvol; // delta-volume outside the projection cone + DWORD vam; // voice allocation/management flags (BASS_VAM_xxx) + DWORD priority; // priority (0=lowest, 0xffffffff=highest) } BASS_SAMPLE; -#define BASS_SAMPLE_8BITS 1 // 8 bit -#define BASS_SAMPLE_FLOAT 256 // 32 bit floating-point -#define BASS_SAMPLE_MONO 2 // mono -#define BASS_SAMPLE_LOOP 4 // looped -#define BASS_SAMPLE_3D 8 // 3D functionality -#define BASS_SAMPLE_SOFTWARE 16 // not using hardware mixing -#define BASS_SAMPLE_MUTEMAX 32 // mute at max distance (3D only) -#define BASS_SAMPLE_VAM 64 // DX7 voice allocation & management -#define BASS_SAMPLE_FX 128 // old implementation of DX8 effects -#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume -#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing -#define BASS_SAMPLE_OVER_DIST 0x30000 // override furthest from listener (3D only) - -#define BASS_STREAM_PRESCAN 0x20000 // enable pin-point seeking/length (MP3/MP2/MP1) -#define BASS_STREAM_AUTOFREE 0x40000 // automatically free the stream when it stop/ends -#define BASS_STREAM_RESTRATE 0x80000 // restrict the download rate of internet file streams -#define BASS_STREAM_BLOCK 0x100000 // download/play internet file stream in small blocks -#define BASS_STREAM_DECODE 0x200000 // don't play the stream, only decode (BASS_ChannelGetData) -#define BASS_STREAM_STATUS 0x800000 // give server status info (HTTP/ICY tags) in DOWNLOADPROC - -#define BASS_MP3_IGNOREDELAY 0x200 // ignore LAME/Xing/VBRI/iTunes delay & padding info -#define BASS_MP3_SETPOS BASS_STREAM_PRESCAN - -#define BASS_MUSIC_FLOAT BASS_SAMPLE_FLOAT -#define BASS_MUSIC_MONO BASS_SAMPLE_MONO -#define BASS_MUSIC_LOOP BASS_SAMPLE_LOOP -#define BASS_MUSIC_3D BASS_SAMPLE_3D -#define BASS_MUSIC_FX BASS_SAMPLE_FX -#define BASS_MUSIC_AUTOFREE BASS_STREAM_AUTOFREE -#define BASS_MUSIC_DECODE BASS_STREAM_DECODE -#define BASS_MUSIC_PRESCAN BASS_STREAM_PRESCAN // calculate playback length -#define BASS_MUSIC_CALCLEN BASS_MUSIC_PRESCAN -#define BASS_MUSIC_RAMP 0x200 // normal ramping -#define BASS_MUSIC_RAMPS 0x400 // sensitive ramping -#define BASS_MUSIC_SURROUND 0x800 // surround sound -#define BASS_MUSIC_SURROUND2 0x1000 // surround sound (mode 2) -#define BASS_MUSIC_FT2PAN 0x2000 // apply FastTracker 2 panning to XM files -#define BASS_MUSIC_FT2MOD 0x2000 // play .MOD as FastTracker 2 does -#define BASS_MUSIC_PT1MOD 0x4000 // play .MOD as ProTracker 1 does -#define BASS_MUSIC_NONINTER 0x10000 // non-interpolated sample mixing -#define BASS_MUSIC_SINCINTER 0x800000 // sinc interpolated sample mixing -#define BASS_MUSIC_POSRESET 0x8000 // stop all notes when moving position -#define BASS_MUSIC_POSRESETEX 0x400000 // stop all notes and reset bmp/etc when moving position -#define BASS_MUSIC_STOPBACK 0x80000 // stop the music on a backwards jump effect -#define BASS_MUSIC_NOSAMPLE 0x100000 // don't load the samples +#define BASS_SAMPLE_8BITS 1 // 8 bit +#define BASS_SAMPLE_FLOAT 256 // 32 bit floating-point +#define BASS_SAMPLE_MONO 2 // mono +#define BASS_SAMPLE_LOOP 4 // looped +#define BASS_SAMPLE_3D 8 // 3D functionality +#define BASS_SAMPLE_SOFTWARE 16 // not using hardware mixing +#define BASS_SAMPLE_MUTEMAX 32 // mute at max distance (3D only) +#define BASS_SAMPLE_VAM 64 // DX7 voice allocation & management +#define BASS_SAMPLE_FX 128 // old implementation of DX8 effects +#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume +#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing +#define BASS_SAMPLE_OVER_DIST 0x30000 // override furthest from listener (3D only) + +#define BASS_STREAM_PRESCAN 0x20000 // enable pin-point seeking/length (MP3/MP2/MP1) +#define BASS_STREAM_AUTOFREE 0x40000 // automatically free the stream when it stop/ends +#define BASS_STREAM_RESTRATE 0x80000 // restrict the download rate of internet file streams +#define BASS_STREAM_BLOCK 0x100000 // download/play internet file stream in small blocks +#define BASS_STREAM_DECODE 0x200000 // don't play the stream, only decode (BASS_ChannelGetData) +#define BASS_STREAM_STATUS 0x800000 // give server status info (HTTP/ICY tags) in DOWNLOADPROC + +#define BASS_MP3_IGNOREDELAY 0x200 // ignore LAME/Xing/VBRI/iTunes delay & padding info +#define BASS_MP3_SETPOS BASS_STREAM_PRESCAN + +#define BASS_MUSIC_FLOAT BASS_SAMPLE_FLOAT +#define BASS_MUSIC_MONO BASS_SAMPLE_MONO +#define BASS_MUSIC_LOOP BASS_SAMPLE_LOOP +#define BASS_MUSIC_3D BASS_SAMPLE_3D +#define BASS_MUSIC_FX BASS_SAMPLE_FX +#define BASS_MUSIC_AUTOFREE BASS_STREAM_AUTOFREE +#define BASS_MUSIC_DECODE BASS_STREAM_DECODE +#define BASS_MUSIC_PRESCAN BASS_STREAM_PRESCAN // calculate playback length +#define BASS_MUSIC_CALCLEN BASS_MUSIC_PRESCAN +#define BASS_MUSIC_RAMP 0x200 // normal ramping +#define BASS_MUSIC_RAMPS 0x400 // sensitive ramping +#define BASS_MUSIC_SURROUND 0x800 // surround sound +#define BASS_MUSIC_SURROUND2 0x1000 // surround sound (mode 2) +#define BASS_MUSIC_FT2PAN 0x2000 // apply FastTracker 2 panning to XM files +#define BASS_MUSIC_FT2MOD 0x2000 // play .MOD as FastTracker 2 does +#define BASS_MUSIC_PT1MOD 0x4000 // play .MOD as ProTracker 1 does +#define BASS_MUSIC_NONINTER 0x10000 // non-interpolated sample mixing +#define BASS_MUSIC_SINCINTER 0x800000 // sinc interpolated sample mixing +#define BASS_MUSIC_POSRESET 0x8000 // stop all notes when moving position +#define BASS_MUSIC_POSRESETEX 0x400000 // stop all notes and reset bmp/etc when moving position +#define BASS_MUSIC_STOPBACK 0x80000 // stop the music on a backwards jump effect +#define BASS_MUSIC_NOSAMPLE 0x100000 // don't load the samples // Speaker assignment flags -#define BASS_SPEAKER_FRONT 0x1000000 // front speakers -#define BASS_SPEAKER_REAR 0x2000000 // rear/side speakers -#define BASS_SPEAKER_CENLFE 0x3000000 // center & LFE speakers (5.1) -#define BASS_SPEAKER_REAR2 0x4000000 // rear center speakers (7.1) -#define BASS_SPEAKER_N(n) ((n)<<24) // n'th pair of speakers (max 15) -#define BASS_SPEAKER_LEFT 0x10000000 // modifier: left -#define BASS_SPEAKER_RIGHT 0x20000000 // modifier: right -#define BASS_SPEAKER_FRONTLEFT BASS_SPEAKER_FRONT|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_FRONTRIGHT BASS_SPEAKER_FRONT|BASS_SPEAKER_RIGHT -#define BASS_SPEAKER_REARLEFT BASS_SPEAKER_REAR|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_REARRIGHT BASS_SPEAKER_REAR|BASS_SPEAKER_RIGHT -#define BASS_SPEAKER_CENTER BASS_SPEAKER_CENLFE|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_LFE BASS_SPEAKER_CENLFE|BASS_SPEAKER_RIGHT -#define BASS_SPEAKER_REAR2LEFT BASS_SPEAKER_REAR2|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_REAR2RIGHT BASS_SPEAKER_REAR2|BASS_SPEAKER_RIGHT - -#define BASS_ASYNCFILE 0x40000000 -#define BASS_UNICODE 0x80000000 - -#define BASS_RECORD_PAUSE 0x8000 // start recording paused -#define BASS_RECORD_ECHOCANCEL 0x2000 -#define BASS_RECORD_AGC 0x4000 +#define BASS_SPEAKER_FRONT 0x1000000 // front speakers +#define BASS_SPEAKER_REAR 0x2000000 // rear/side speakers +#define BASS_SPEAKER_CENLFE 0x3000000 // center & LFE speakers (5.1) +#define BASS_SPEAKER_REAR2 0x4000000 // rear center speakers (7.1) +#define BASS_SPEAKER_N(n) ((n) << 24) // n'th pair of speakers (max 15) +#define BASS_SPEAKER_LEFT 0x10000000 // modifier: left +#define BASS_SPEAKER_RIGHT 0x20000000 // modifier: right +#define BASS_SPEAKER_FRONTLEFT BASS_SPEAKER_FRONT | BASS_SPEAKER_LEFT +#define BASS_SPEAKER_FRONTRIGHT BASS_SPEAKER_FRONT | BASS_SPEAKER_RIGHT +#define BASS_SPEAKER_REARLEFT BASS_SPEAKER_REAR | BASS_SPEAKER_LEFT +#define BASS_SPEAKER_REARRIGHT BASS_SPEAKER_REAR | BASS_SPEAKER_RIGHT +#define BASS_SPEAKER_CENTER BASS_SPEAKER_CENLFE | BASS_SPEAKER_LEFT +#define BASS_SPEAKER_LFE BASS_SPEAKER_CENLFE | BASS_SPEAKER_RIGHT +#define BASS_SPEAKER_REAR2LEFT BASS_SPEAKER_REAR2 | BASS_SPEAKER_LEFT +#define BASS_SPEAKER_REAR2RIGHT BASS_SPEAKER_REAR2 | BASS_SPEAKER_RIGHT + +#define BASS_ASYNCFILE 0x40000000 +#define BASS_UNICODE 0x80000000 + +#define BASS_RECORD_PAUSE 0x8000 // start recording paused +#define BASS_RECORD_ECHOCANCEL 0x2000 +#define BASS_RECORD_AGC 0x4000 // DX7 voice allocation & management flags -#define BASS_VAM_HARDWARE 1 -#define BASS_VAM_SOFTWARE 2 -#define BASS_VAM_TERM_TIME 4 -#define BASS_VAM_TERM_DIST 8 -#define BASS_VAM_TERM_PRIO 16 +#define BASS_VAM_HARDWARE 1 +#define BASS_VAM_SOFTWARE 2 +#define BASS_VAM_TERM_TIME 4 +#define BASS_VAM_TERM_DIST 8 +#define BASS_VAM_TERM_PRIO 16 // Channel info structure typedef struct { - DWORD freq; // default playback rate - DWORD chans; // channels - DWORD flags; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags - DWORD ctype; // type of channel - DWORD origres; // original resolution - HPLUGIN plugin; // plugin - HSAMPLE sample; // sample - const char *filename; // filename + DWORD freq; // default playback rate + DWORD chans; // channels + DWORD flags; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags + DWORD ctype; // type of channel + DWORD origres; // original resolution + HPLUGIN plugin; // plugin + HSAMPLE sample; // sample + const char *filename; // filename } BASS_CHANNELINFO; -#define BASS_ORIGRES_FLOAT 0x10000 +#define BASS_ORIGRES_FLOAT 0x10000 // BASS_CHANNELINFO types -#define BASS_CTYPE_SAMPLE 1 -#define BASS_CTYPE_RECORD 2 -#define BASS_CTYPE_STREAM 0x10000 -#define BASS_CTYPE_STREAM_OGG 0x10002 -#define BASS_CTYPE_STREAM_MP1 0x10003 -#define BASS_CTYPE_STREAM_MP2 0x10004 -#define BASS_CTYPE_STREAM_MP3 0x10005 -#define BASS_CTYPE_STREAM_AIFF 0x10006 -#define BASS_CTYPE_STREAM_CA 0x10007 -#define BASS_CTYPE_STREAM_MF 0x10008 -#define BASS_CTYPE_STREAM_AM 0x10009 -#define BASS_CTYPE_STREAM_DUMMY 0x18000 -#define BASS_CTYPE_STREAM_DEVICE 0x18001 -#define BASS_CTYPE_STREAM_WAV 0x40000 // WAVE flag, LOWORD=codec -#define BASS_CTYPE_STREAM_WAV_PCM 0x50001 -#define BASS_CTYPE_STREAM_WAV_FLOAT 0x50003 -#define BASS_CTYPE_MUSIC_MOD 0x20000 -#define BASS_CTYPE_MUSIC_MTM 0x20001 -#define BASS_CTYPE_MUSIC_S3M 0x20002 -#define BASS_CTYPE_MUSIC_XM 0x20003 -#define BASS_CTYPE_MUSIC_IT 0x20004 -#define BASS_CTYPE_MUSIC_MO3 0x00100 // MO3 flag +#define BASS_CTYPE_SAMPLE 1 +#define BASS_CTYPE_RECORD 2 +#define BASS_CTYPE_STREAM 0x10000 +#define BASS_CTYPE_STREAM_OGG 0x10002 +#define BASS_CTYPE_STREAM_MP1 0x10003 +#define BASS_CTYPE_STREAM_MP2 0x10004 +#define BASS_CTYPE_STREAM_MP3 0x10005 +#define BASS_CTYPE_STREAM_AIFF 0x10006 +#define BASS_CTYPE_STREAM_CA 0x10007 +#define BASS_CTYPE_STREAM_MF 0x10008 +#define BASS_CTYPE_STREAM_AM 0x10009 +#define BASS_CTYPE_STREAM_DUMMY 0x18000 +#define BASS_CTYPE_STREAM_DEVICE 0x18001 +#define BASS_CTYPE_STREAM_WAV 0x40000 // WAVE flag, LOWORD=codec +#define BASS_CTYPE_STREAM_WAV_PCM 0x50001 +#define BASS_CTYPE_STREAM_WAV_FLOAT 0x50003 +#define BASS_CTYPE_MUSIC_MOD 0x20000 +#define BASS_CTYPE_MUSIC_MTM 0x20001 +#define BASS_CTYPE_MUSIC_S3M 0x20002 +#define BASS_CTYPE_MUSIC_XM 0x20003 +#define BASS_CTYPE_MUSIC_IT 0x20004 +#define BASS_CTYPE_MUSIC_MO3 0x00100 // MO3 flag typedef struct { - DWORD ctype; // channel type -#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) - const wchar_t *name; // format description - const wchar_t *exts; // file extension filter (*.ext1;*.ext2;etc...) + DWORD ctype; // channel type +#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) + const wchar_t *name; // format description + const wchar_t *exts; // file extension filter (*.ext1;*.ext2;etc...) #else - const char *name; // format description - const char *exts; // file extension filter (*.ext1;*.ext2;etc...) + const char *name; // format description + const char *exts; // file extension filter (*.ext1;*.ext2;etc...) #endif } BASS_PLUGINFORM; typedef struct { - DWORD version; // version (same form as BASS_GetVersion) - DWORD formatc; // number of formats - const BASS_PLUGINFORM *formats; // the array of formats + DWORD version; // version (same form as BASS_GetVersion) + DWORD formatc; // number of formats + const BASS_PLUGINFORM *formats; // the array of formats } BASS_PLUGININFO; // 3D vector (for 3D positions/velocities/orientations) typedef struct BASS_3DVECTOR { #ifdef __cplusplus - BASS_3DVECTOR() {}; - BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {}; + BASS_3DVECTOR(){}; + BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z){}; #endif - float x; // +=right, -=left - float y; // +=up, -=down - float z; // +=front, -=behind + float x; // +=right, -=left + float y; // +=up, -=down + float z; // +=front, -=behind } BASS_3DVECTOR; // 3D channel modes -#define BASS_3DMODE_NORMAL 0 // normal 3D processing -#define BASS_3DMODE_RELATIVE 1 // position is relative to the listener -#define BASS_3DMODE_OFF 2 // no 3D processing +#define BASS_3DMODE_NORMAL 0 // normal 3D processing +#define BASS_3DMODE_RELATIVE 1 // position is relative to the listener +#define BASS_3DMODE_OFF 2 // no 3D processing // software 3D mixing algorithms (used with BASS_CONFIG_3DALGORITHM) -#define BASS_3DALG_DEFAULT 0 -#define BASS_3DALG_OFF 1 -#define BASS_3DALG_FULL 2 -#define BASS_3DALG_LIGHT 3 +#define BASS_3DALG_DEFAULT 0 +#define BASS_3DALG_OFF 1 +#define BASS_3DALG_FULL 2 +#define BASS_3DALG_LIGHT 3 // EAX environments, use with BASS_SetEAXParameters -enum -{ +enum { EAX_ENVIRONMENT_GENERIC, EAX_ENVIRONMENT_PADDEDCELL, EAX_ENVIRONMENT_ROOM, @@ -465,38 +464,38 @@ enum EAX_ENVIRONMENT_DIZZY, EAX_ENVIRONMENT_PSYCHOTIC, - EAX_ENVIRONMENT_COUNT // total number of environments + 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); +#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 @@ -505,73 +504,73 @@ length : Number of bytes to write user : The 'user' parameter value given when calling BASS_StreamCreate RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end the stream. */ -#define BASS_STREAMPROC_END 0x80000000 // end of user stream flag +#define BASS_STREAMPROC_END 0x80000000 // end of user stream flag // special STREAMPROCs -#define STREAMPROC_DUMMY (STREAMPROC*)0 // "dummy" stream -#define STREAMPROC_PUSH (STREAMPROC*)-1 // push stream -#define STREAMPROC_DEVICE (STREAMPROC*)-2 // device mix stream -#define STREAMPROC_DEVICE_3D (STREAMPROC*)-3 // device 3D mix stream +#define STREAMPROC_DUMMY (STREAMPROC *)0 // "dummy" stream +#define STREAMPROC_PUSH (STREAMPROC *)-1 // push stream +#define STREAMPROC_DEVICE (STREAMPROC *)-2 // device mix stream +#define STREAMPROC_DEVICE_3D (STREAMPROC *)-3 // device 3D mix stream // BASS_StreamCreateFileUser file systems -#define STREAMFILE_NOBUFFER 0 -#define STREAMFILE_BUFFER 1 -#define STREAMFILE_BUFFERPUSH 2 +#define STREAMFILE_NOBUFFER 0 +#define STREAMFILE_BUFFER 1 +#define STREAMFILE_BUFFERPUSH 2 // User file stream callback functions -typedef void (CALLBACK FILECLOSEPROC)(void *user); -typedef QWORD (CALLBACK FILELENPROC)(void *user); -typedef DWORD (CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user); -typedef BOOL (CALLBACK FILESEEKPROC)(QWORD offset, void *user); +typedef void(CALLBACK FILECLOSEPROC)(void *user); +typedef QWORD(CALLBACK FILELENPROC)(void *user); +typedef DWORD(CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user); +typedef BOOL(CALLBACK FILESEEKPROC)(QWORD offset, void *user); typedef struct { - FILECLOSEPROC *close; - FILELENPROC *length; - FILEREADPROC *read; - FILESEEKPROC *seek; + FILECLOSEPROC *close; + FILELENPROC *length; + FILEREADPROC *read; + FILESEEKPROC *seek; } BASS_FILEPROCS; // BASS_StreamPutFileData options -#define BASS_FILEDATA_END 0 // end & close the file +#define BASS_FILEDATA_END 0 // end & close the file // BASS_StreamGetFilePosition modes -#define BASS_FILEPOS_CURRENT 0 -#define BASS_FILEPOS_DECODE BASS_FILEPOS_CURRENT -#define BASS_FILEPOS_DOWNLOAD 1 -#define BASS_FILEPOS_END 2 -#define BASS_FILEPOS_START 3 -#define BASS_FILEPOS_CONNECTED 4 -#define BASS_FILEPOS_BUFFER 5 -#define BASS_FILEPOS_SOCKET 6 -#define BASS_FILEPOS_ASYNCBUF 7 -#define BASS_FILEPOS_SIZE 8 -#define BASS_FILEPOS_BUFFERING 9 - -typedef void (CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, void *user); +#define BASS_FILEPOS_CURRENT 0 +#define BASS_FILEPOS_DECODE BASS_FILEPOS_CURRENT +#define BASS_FILEPOS_DOWNLOAD 1 +#define BASS_FILEPOS_END 2 +#define BASS_FILEPOS_START 3 +#define BASS_FILEPOS_CONNECTED 4 +#define BASS_FILEPOS_BUFFER 5 +#define BASS_FILEPOS_SOCKET 6 +#define BASS_FILEPOS_ASYNCBUF 7 +#define BASS_FILEPOS_SIZE 8 +#define BASS_FILEPOS_BUFFERING 9 + +typedef void(CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, void *user); /* Internet stream download callback function. buffer : Buffer containing the downloaded data... NULL=end of download length : Number of bytes in the buffer user : The 'user' parameter value given when calling BASS_StreamCreateURL */ // BASS_ChannelSetSync types -#define BASS_SYNC_POS 0 -#define BASS_SYNC_END 2 -#define BASS_SYNC_META 4 -#define BASS_SYNC_SLIDE 5 -#define BASS_SYNC_STALL 6 -#define BASS_SYNC_DOWNLOAD 7 -#define BASS_SYNC_FREE 8 -#define BASS_SYNC_SETPOS 11 -#define BASS_SYNC_MUSICPOS 10 -#define BASS_SYNC_MUSICINST 1 -#define BASS_SYNC_MUSICFX 3 -#define BASS_SYNC_OGG_CHANGE 12 -#define BASS_SYNC_DEV_FAIL 14 -#define BASS_SYNC_DEV_FORMAT 15 -#define BASS_SYNC_MIXTIME 0x40000000 // flag: sync at mixtime, else at playtime -#define BASS_SYNC_ONETIME 0x80000000 // flag: sync only once, else continuously - -typedef void (CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, void *user); +#define BASS_SYNC_POS 0 +#define BASS_SYNC_END 2 +#define BASS_SYNC_META 4 +#define BASS_SYNC_SLIDE 5 +#define BASS_SYNC_STALL 6 +#define BASS_SYNC_DOWNLOAD 7 +#define BASS_SYNC_FREE 8 +#define BASS_SYNC_SETPOS 11 +#define BASS_SYNC_MUSICPOS 10 +#define BASS_SYNC_MUSICINST 1 +#define BASS_SYNC_MUSICFX 3 +#define BASS_SYNC_OGG_CHANGE 12 +#define BASS_SYNC_DEV_FAIL 14 +#define BASS_SYNC_DEV_FORMAT 15 +#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 @@ -581,7 +580,7 @@ channel: Channel that the sync occured in data : Additional data associated with the sync's occurance user : The 'user' parameter given when calling BASS_ChannelSetSync */ -typedef void (CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user); +typedef void(CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user); /* DSP callback function. NOTE: A DSP function should obviously be as quick as possible... other DSP functions, streams and MOD musics can not be processed until it's finished. @@ -591,7 +590,7 @@ buffer : Buffer to apply the DSP to length : Number of bytes in the buffer user : The 'user' parameter given when calling BASS_ChannelSetDSP */ -typedef BOOL (CALLBACK RECORDPROC)(HRECORD handle, const void *buffer, DWORD length, void *user); +typedef BOOL(CALLBACK RECORDPROC)(HRECORD handle, const void *buffer, DWORD length, void *user); /* Recording callback function. handle : The recording handle buffer : Buffer containing the recorded sample data @@ -600,396 +599,395 @@ user : The 'user' parameter value given when calling BASS_RecordStart RETURN : TRUE = continue recording, FALSE = stop */ // BASS_ChannelIsActive return values -#define BASS_ACTIVE_STOPPED 0 -#define BASS_ACTIVE_PLAYING 1 -#define BASS_ACTIVE_STALLED 2 -#define BASS_ACTIVE_PAUSED 3 -#define BASS_ACTIVE_PAUSED_DEVICE 4 +#define BASS_ACTIVE_STOPPED 0 +#define BASS_ACTIVE_PLAYING 1 +#define BASS_ACTIVE_STALLED 2 +#define BASS_ACTIVE_PAUSED 3 +#define BASS_ACTIVE_PAUSED_DEVICE 4 // Channel attributes -#define BASS_ATTRIB_FREQ 1 -#define BASS_ATTRIB_VOL 2 -#define BASS_ATTRIB_PAN 3 -#define BASS_ATTRIB_EAXMIX 4 -#define BASS_ATTRIB_NOBUFFER 5 -#define BASS_ATTRIB_VBR 6 -#define BASS_ATTRIB_CPU 7 -#define BASS_ATTRIB_SRC 8 -#define BASS_ATTRIB_NET_RESUME 9 -#define BASS_ATTRIB_SCANINFO 10 -#define BASS_ATTRIB_NORAMP 11 -#define BASS_ATTRIB_BITRATE 12 -#define BASS_ATTRIB_BUFFER 13 -#define BASS_ATTRIB_MUSIC_AMPLIFY 0x100 -#define BASS_ATTRIB_MUSIC_PANSEP 0x101 -#define BASS_ATTRIB_MUSIC_PSCALER 0x102 -#define BASS_ATTRIB_MUSIC_BPM 0x103 -#define BASS_ATTRIB_MUSIC_SPEED 0x104 +#define BASS_ATTRIB_FREQ 1 +#define BASS_ATTRIB_VOL 2 +#define BASS_ATTRIB_PAN 3 +#define BASS_ATTRIB_EAXMIX 4 +#define BASS_ATTRIB_NOBUFFER 5 +#define BASS_ATTRIB_VBR 6 +#define BASS_ATTRIB_CPU 7 +#define BASS_ATTRIB_SRC 8 +#define BASS_ATTRIB_NET_RESUME 9 +#define BASS_ATTRIB_SCANINFO 10 +#define BASS_ATTRIB_NORAMP 11 +#define BASS_ATTRIB_BITRATE 12 +#define BASS_ATTRIB_BUFFER 13 +#define BASS_ATTRIB_MUSIC_AMPLIFY 0x100 +#define BASS_ATTRIB_MUSIC_PANSEP 0x101 +#define BASS_ATTRIB_MUSIC_PSCALER 0x102 +#define BASS_ATTRIB_MUSIC_BPM 0x103 +#define BASS_ATTRIB_MUSIC_SPEED 0x104 #define BASS_ATTRIB_MUSIC_VOL_GLOBAL 0x105 -#define BASS_ATTRIB_MUSIC_ACTIVE 0x106 -#define BASS_ATTRIB_MUSIC_VOL_CHAN 0x200 // + channel # -#define BASS_ATTRIB_MUSIC_VOL_INST 0x300 // + instrument # +#define BASS_ATTRIB_MUSIC_ACTIVE 0x106 +#define BASS_ATTRIB_MUSIC_VOL_CHAN 0x200 // + channel # +#define BASS_ATTRIB_MUSIC_VOL_INST 0x300 // + instrument # // BASS_ChannelSlideAttribute flags -#define BASS_SLIDE_LOG 0x1000000 +#define BASS_SLIDE_LOG 0x1000000 // BASS_ChannelGetData flags -#define BASS_DATA_AVAILABLE 0 // query how much data is buffered -#define BASS_DATA_FIXED 0x20000000 // flag: return 8.24 fixed-point data -#define BASS_DATA_FLOAT 0x40000000 // flag: return floating-point sample data -#define BASS_DATA_FFT256 0x80000000 // 256 sample FFT -#define BASS_DATA_FFT512 0x80000001 // 512 FFT -#define BASS_DATA_FFT1024 0x80000002 // 1024 FFT -#define BASS_DATA_FFT2048 0x80000003 // 2048 FFT -#define BASS_DATA_FFT4096 0x80000004 // 4096 FFT -#define BASS_DATA_FFT8192 0x80000005 // 8192 FFT -#define BASS_DATA_FFT16384 0x80000006 // 16384 FFT -#define BASS_DATA_FFT32768 0x80000007 // 32768 FFT -#define BASS_DATA_FFT_INDIVIDUAL 0x10 // FFT flag: FFT for each channel, else all combined -#define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window -#define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias -#define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data -#define BASS_DATA_FFT_NYQUIST 0x100 // FFT flag: return extra Nyquist value +#define BASS_DATA_AVAILABLE 0 // query how much data is buffered +#define BASS_DATA_FIXED 0x20000000 // flag: return 8.24 fixed-point data +#define BASS_DATA_FLOAT 0x40000000 // flag: return floating-point sample data +#define BASS_DATA_FFT256 0x80000000 // 256 sample FFT +#define BASS_DATA_FFT512 0x80000001 // 512 FFT +#define BASS_DATA_FFT1024 0x80000002 // 1024 FFT +#define BASS_DATA_FFT2048 0x80000003 // 2048 FFT +#define BASS_DATA_FFT4096 0x80000004 // 4096 FFT +#define BASS_DATA_FFT8192 0x80000005 // 8192 FFT +#define BASS_DATA_FFT16384 0x80000006 // 16384 FFT +#define BASS_DATA_FFT32768 0x80000007 // 32768 FFT +#define BASS_DATA_FFT_INDIVIDUAL 0x10 // FFT flag: FFT for each channel, else all combined +#define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window +#define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias +#define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data +#define BASS_DATA_FFT_NYQUIST 0x100 // FFT flag: return extra Nyquist value // BASS_ChannelGetLevelEx flags -#define BASS_LEVEL_MONO 1 -#define BASS_LEVEL_STEREO 2 -#define BASS_LEVEL_RMS 4 -#define BASS_LEVEL_VOLPAN 8 +#define BASS_LEVEL_MONO 1 +#define BASS_LEVEL_STEREO 2 +#define BASS_LEVEL_RMS 4 +#define BASS_LEVEL_VOLPAN 8 // BASS_ChannelGetTags types : what's returned -#define BASS_TAG_ID3 0 // ID3v1 tags : TAG_ID3 structure -#define BASS_TAG_ID3V2 1 // ID3v2 tags : variable length block -#define BASS_TAG_OGG 2 // OGG comments : series of null-terminated UTF-8 strings -#define BASS_TAG_HTTP 3 // HTTP headers : series of null-terminated ANSI strings -#define BASS_TAG_ICY 4 // ICY headers : series of null-terminated ANSI strings -#define BASS_TAG_META 5 // ICY metadata : ANSI string -#define BASS_TAG_APE 6 // APE tags : series of null-terminated UTF-8 strings -#define BASS_TAG_MP4 7 // MP4/iTunes metadata : series of null-terminated UTF-8 strings -#define BASS_TAG_WMA 8 // WMA tags : series of null-terminated UTF-8 strings -#define BASS_TAG_VENDOR 9 // OGG encoder : UTF-8 string -#define BASS_TAG_LYRICS3 10 // Lyric3v2 tag : ASCII string -#define BASS_TAG_CA_CODEC 11 // CoreAudio codec info : TAG_CA_CODEC structure -#define BASS_TAG_MF 13 // Media Foundation tags : series of null-terminated UTF-8 strings -#define BASS_TAG_WAVEFORMAT 14 // WAVE format : WAVEFORMATEEX structure -#define BASS_TAG_AM_MIME 15 // Android Media MIME type : ASCII string -#define BASS_TAG_AM_NAME 16 // Android Media codec name : ASCII string -#define BASS_TAG_RIFF_INFO 0x100 // RIFF "INFO" tags : series of null-terminated ANSI strings -#define BASS_TAG_RIFF_BEXT 0x101 // RIFF/BWF "bext" tags : TAG_BEXT structure -#define BASS_TAG_RIFF_CART 0x102 // RIFF/BWF "cart" tags : TAG_CART structure -#define BASS_TAG_RIFF_DISP 0x103 // RIFF "DISP" text tag : ANSI string -#define BASS_TAG_RIFF_CUE 0x104 // RIFF "cue " chunk : TAG_CUE structure -#define BASS_TAG_RIFF_SMPL 0x105 // RIFF "smpl" chunk : TAG_SMPL structure -#define BASS_TAG_APE_BINARY 0x1000 // + index #, binary APE tag : TAG_APE_BINARY structure -#define BASS_TAG_MUSIC_NAME 0x10000 // MOD music name : ANSI string -#define BASS_TAG_MUSIC_MESSAGE 0x10001 // MOD message : ANSI string -#define BASS_TAG_MUSIC_ORDERS 0x10002 // MOD order list : BYTE array of pattern numbers -#define BASS_TAG_MUSIC_AUTH 0x10003 // MOD author : UTF-8 string -#define BASS_TAG_MUSIC_INST 0x10100 // + instrument #, MOD instrument name : ANSI string -#define BASS_TAG_MUSIC_SAMPLE 0x10300 // + sample #, MOD sample name : ANSI string - +#define BASS_TAG_ID3 0 // ID3v1 tags : TAG_ID3 structure +#define BASS_TAG_ID3V2 1 // ID3v2 tags : variable length block +#define BASS_TAG_OGG 2 // OGG comments : series of null-terminated UTF-8 strings +#define BASS_TAG_HTTP 3 // HTTP headers : series of null-terminated ANSI strings +#define BASS_TAG_ICY 4 // ICY headers : series of null-terminated ANSI strings +#define BASS_TAG_META 5 // ICY metadata : ANSI string +#define BASS_TAG_APE 6 // APE tags : series of null-terminated UTF-8 strings +#define BASS_TAG_MP4 7 // MP4/iTunes metadata : series of null-terminated UTF-8 strings +#define BASS_TAG_WMA 8 // WMA tags : series of null-terminated UTF-8 strings +#define BASS_TAG_VENDOR 9 // OGG encoder : UTF-8 string +#define BASS_TAG_LYRICS3 10 // Lyric3v2 tag : ASCII string +#define BASS_TAG_CA_CODEC 11 // CoreAudio codec info : TAG_CA_CODEC structure +#define BASS_TAG_MF 13 // Media Foundation tags : series of null-terminated UTF-8 strings +#define BASS_TAG_WAVEFORMAT 14 // WAVE format : WAVEFORMATEEX structure +#define BASS_TAG_AM_MIME 15 // Android Media MIME type : ASCII string +#define BASS_TAG_AM_NAME 16 // Android Media codec name : ASCII string +#define BASS_TAG_RIFF_INFO 0x100 // RIFF "INFO" tags : series of null-terminated ANSI strings +#define BASS_TAG_RIFF_BEXT 0x101 // RIFF/BWF "bext" tags : TAG_BEXT structure +#define BASS_TAG_RIFF_CART 0x102 // RIFF/BWF "cart" tags : TAG_CART structure +#define BASS_TAG_RIFF_DISP 0x103 // RIFF "DISP" text tag : ANSI string +#define BASS_TAG_RIFF_CUE 0x104 // RIFF "cue " chunk : TAG_CUE structure +#define BASS_TAG_RIFF_SMPL 0x105 // RIFF "smpl" chunk : TAG_SMPL structure +#define BASS_TAG_APE_BINARY 0x1000 // + index #, binary APE tag : TAG_APE_BINARY structure +#define BASS_TAG_MUSIC_NAME 0x10000 // MOD music name : ANSI string +#define BASS_TAG_MUSIC_MESSAGE 0x10001 // MOD message : ANSI string +#define BASS_TAG_MUSIC_ORDERS 0x10002 // MOD order list : BYTE array of pattern numbers +#define BASS_TAG_MUSIC_AUTH 0x10003 // MOD author : UTF-8 string +#define BASS_TAG_MUSIC_INST 0x10100 // + instrument #, MOD instrument name : ANSI string +#define BASS_TAG_MUSIC_SAMPLE 0x10300 // + sample #, MOD sample name : ANSI string + // ID3v1 tag structure typedef struct { - char id[3]; - char title[30]; - char artist[30]; - char album[30]; - char year[4]; - char comment[30]; - BYTE genre; + char id[3]; + char title[30]; + char artist[30]; + char album[30]; + char year[4]; + char comment[30]; + BYTE genre; } TAG_ID3; - + // Binary APE tag structure -typedef struct { - const char *key; - const void *data; - DWORD length; -} TAG_APE_BINARY; - -// BWF "bext" tag structure +typedef struct { + const char *key; + const void *data; + DWORD length; +} TAG_APE_BINARY; + +// BWF "bext" tag structure #ifdef _MSC_VER #pragma warning(push) -#pragma warning(disable:4200) +#pragma warning(disable : 4200) #endif -#pragma pack(push,1) +#pragma pack(push, 1) typedef struct { - char Description[256]; // description - char Originator[32]; // name of the originator - char OriginatorReference[32]; // reference of the originator - char OriginationDate[10]; // date of creation (yyyy-mm-dd) - char OriginationTime[8]; // time of creation (hh-mm-ss) - QWORD TimeReference; // first sample count since midnight (little-endian) - WORD Version; // BWF version (little-endian) - BYTE UMID[64]; // SMPTE UMID - BYTE Reserved[190]; -#if defined(__GNUC__) && __GNUC__<3 - char CodingHistory[0]; // history -#elif 1 // change to 0 if compiler fails the following line - char CodingHistory[]; // history + char Description[256]; // description + char Originator[32]; // name of the originator + char OriginatorReference[32]; // reference of the originator + char OriginationDate[10]; // date of creation (yyyy-mm-dd) + char OriginationTime[8]; // time of creation (hh-mm-ss) + QWORD TimeReference; // first sample count since midnight (little-endian) + WORD Version; // BWF version (little-endian) + BYTE UMID[64]; // SMPTE UMID + BYTE Reserved[190]; +#if defined(__GNUC__) && __GNUC__ < 3 + char CodingHistory[0]; // history +#elif 1 // change to 0 if compiler fails the following line + char CodingHistory[]; // history #else - char CodingHistory[1]; // history + char CodingHistory[1]; // history #endif } TAG_BEXT; -#pragma pack(pop) - -// BWF "cart" tag structures -typedef struct -{ - DWORD dwUsage; // FOURCC timer usage ID - DWORD dwValue; // timer value in samples from head -} TAG_CART_TIMER; - -typedef struct -{ - char Version[4]; // version of the data structure - char Title[64]; // title of cart audio sequence - char Artist[64]; // artist or creator name - char CutID[64]; // cut number identification - char ClientID[64]; // client identification - char Category[64]; // category ID, PSA, NEWS, etc - char Classification[64]; // classification or auxiliary key - char OutCue[64]; // out cue text - char StartDate[10]; // yyyy-mm-dd - char StartTime[8]; // hh:mm:ss - char EndDate[10]; // yyyy-mm-dd - char EndTime[8]; // hh:mm:ss - char ProducerAppID[64]; // name of vendor or application - char ProducerAppVersion[64]; // version of producer application - char UserDef[64]; // user defined text - DWORD dwLevelReference; // sample value for 0 dB reference - TAG_CART_TIMER PostTimer[8]; // 8 time markers after head - char Reserved[276]; - char URL[1024]; // uniform resource locator -#if defined(__GNUC__) && __GNUC__<3 - char TagText[0]; // free form text for scripts or tags -#elif 1 // change to 0 if compiler fails the following line - char TagText[]; // free form text for scripts or tags -#else - char TagText[1]; // free form text for scripts or tags -#endif -} TAG_CART; - -// RIFF "cue " tag structures -typedef struct -{ - DWORD dwName; - DWORD dwPosition; - DWORD fccChunk; - DWORD dwChunkStart; - DWORD dwBlockStart; - DWORD dwSampleOffset; -} TAG_CUE_POINT; - -typedef struct -{ - DWORD dwCuePoints; -#if defined(__GNUC__) && __GNUC__<3 - TAG_CUE_POINT CuePoints[0]; -#elif 1 // change to 0 if compiler fails the following line - TAG_CUE_POINT CuePoints[]; -#else - TAG_CUE_POINT CuePoints[1]; -#endif -} TAG_CUE; - -// RIFF "smpl" tag structures -typedef struct -{ - DWORD dwIdentifier; - DWORD dwType; - DWORD dwStart; - DWORD dwEnd; - DWORD dwFraction; - DWORD dwPlayCount; -} TAG_SMPL_LOOP; - -typedef struct -{ - DWORD dwManufacturer; - DWORD dwProduct; - DWORD dwSamplePeriod; - DWORD dwMIDIUnityNote; - DWORD dwMIDIPitchFraction; - DWORD dwSMPTEFormat; - DWORD dwSMPTEOffset; - DWORD cSampleLoops; - DWORD cbSamplerData; -#if defined(__GNUC__) && __GNUC__<3 - TAG_SMPL_LOOP SampleLoops[0]; -#elif 1 // change to 0 if compiler fails the following line - TAG_SMPL_LOOP SampleLoops[]; -#else - TAG_SMPL_LOOP SampleLoops[1]; -#endif -} TAG_SMPL; -#ifdef _MSC_VER -#pragma warning(pop) -#endif - +#pragma pack(pop) + +// BWF "cart" tag structures +typedef struct +{ + DWORD dwUsage; // FOURCC timer usage ID + DWORD dwValue; // timer value in samples from head +} TAG_CART_TIMER; + +typedef struct +{ + char Version[4]; // version of the data structure + char Title[64]; // title of cart audio sequence + char Artist[64]; // artist or creator name + char CutID[64]; // cut number identification + char ClientID[64]; // client identification + char Category[64]; // category ID, PSA, NEWS, etc + char Classification[64]; // classification or auxiliary key + char OutCue[64]; // out cue text + char StartDate[10]; // yyyy-mm-dd + char StartTime[8]; // hh:mm:ss + char EndDate[10]; // yyyy-mm-dd + char EndTime[8]; // hh:mm:ss + char ProducerAppID[64]; // name of vendor or application + char ProducerAppVersion[64]; // version of producer application + char UserDef[64]; // user defined text + DWORD dwLevelReference; // sample value for 0 dB reference + TAG_CART_TIMER PostTimer[8]; // 8 time markers after head + char Reserved[276]; + char URL[1024]; // uniform resource locator +#if defined(__GNUC__) && __GNUC__ < 3 + char TagText[0]; // free form text for scripts or tags +#elif 1 // change to 0 if compiler fails the following line + char TagText[]; // free form text for scripts or tags +#else + char TagText[1]; // free form text for scripts or tags +#endif +} TAG_CART; + +// RIFF "cue " tag structures +typedef struct +{ + DWORD dwName; + DWORD dwPosition; + DWORD fccChunk; + DWORD dwChunkStart; + DWORD dwBlockStart; + DWORD dwSampleOffset; +} TAG_CUE_POINT; + +typedef struct +{ + DWORD dwCuePoints; +#if defined(__GNUC__) && __GNUC__ < 3 + TAG_CUE_POINT CuePoints[0]; +#elif 1 // change to 0 if compiler fails the following line + TAG_CUE_POINT CuePoints[]; +#else + TAG_CUE_POINT CuePoints[1]; +#endif +} TAG_CUE; + +// RIFF "smpl" tag structures +typedef struct +{ + DWORD dwIdentifier; + DWORD dwType; + DWORD dwStart; + DWORD dwEnd; + DWORD dwFraction; + DWORD dwPlayCount; +} TAG_SMPL_LOOP; + +typedef struct +{ + DWORD dwManufacturer; + DWORD dwProduct; + DWORD dwSamplePeriod; + DWORD dwMIDIUnityNote; + DWORD dwMIDIPitchFraction; + DWORD dwSMPTEFormat; + DWORD dwSMPTEOffset; + DWORD cSampleLoops; + DWORD cbSamplerData; +#if defined(__GNUC__) && __GNUC__ < 3 + TAG_SMPL_LOOP SampleLoops[0]; +#elif 1 // change to 0 if compiler fails the following line + TAG_SMPL_LOOP SampleLoops[]; +#else + TAG_SMPL_LOOP SampleLoops[1]; +#endif +} TAG_SMPL; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + // CoreAudio codec info structure typedef struct { - DWORD ftype; // file format - DWORD atype; // audio format - const char *name; // description + DWORD ftype; // file format + DWORD atype; // audio format + const char *name; // description } TAG_CA_CODEC; -#ifndef _WAVEFORMATEX_ -#define _WAVEFORMATEX_ -#pragma pack(push,1) -typedef struct tWAVEFORMATEX -{ - WORD wFormatTag; - WORD nChannels; - DWORD nSamplesPerSec; - DWORD nAvgBytesPerSec; - WORD nBlockAlign; - WORD wBitsPerSample; - WORD cbSize; -} WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX; -typedef const WAVEFORMATEX *LPCWAVEFORMATEX; -#pragma pack(pop) -#endif - +#ifndef _WAVEFORMATEX_ +#define _WAVEFORMATEX_ +#pragma pack(push, 1) +typedef struct tWAVEFORMATEX { + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; + WORD wBitsPerSample; + WORD cbSize; +} WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX; +typedef const WAVEFORMATEX *LPCWAVEFORMATEX; +#pragma pack(pop) +#endif + // BASS_ChannelGetLength/GetPosition/SetPosition modes -#define BASS_POS_BYTE 0 // byte position -#define BASS_POS_MUSIC_ORDER 1 // order.row position, MAKELONG(order,row) -#define BASS_POS_OGG 3 // OGG bitstream number -#define BASS_POS_RESET 0x2000000 // flag: reset user file buffers -#define BASS_POS_RELATIVE 0x4000000 // flag: seek relative to the current position -#define BASS_POS_INEXACT 0x8000000 // flag: allow seeking to inexact position -#define BASS_POS_DECODE 0x10000000 // flag: get the decoding (not playing) position -#define BASS_POS_DECODETO 0x20000000 // flag: decode to the position instead of seeking -#define BASS_POS_SCAN 0x40000000 // flag: scan to the position +#define BASS_POS_BYTE 0 // byte position +#define BASS_POS_MUSIC_ORDER 1 // order.row position, MAKELONG(order,row) +#define BASS_POS_OGG 3 // OGG bitstream number +#define BASS_POS_RESET 0x2000000 // flag: reset user file buffers +#define BASS_POS_RELATIVE 0x4000000 // flag: seek relative to the current position +#define BASS_POS_INEXACT 0x8000000 // flag: allow seeking to inexact position +#define BASS_POS_DECODE 0x10000000 // flag: get the decoding (not playing) position +#define BASS_POS_DECODETO 0x20000000 // flag: decode to the position instead of seeking +#define BASS_POS_SCAN 0x40000000 // flag: scan to the position // BASS_ChannelSetDevice/GetDevice option -#define BASS_NODEVICE 0x20000 +#define BASS_NODEVICE 0x20000 // BASS_RecordSetInput flags -#define BASS_INPUT_OFF 0x10000 -#define BASS_INPUT_ON 0x20000 - -#define BASS_INPUT_TYPE_MASK 0xff000000 -#define BASS_INPUT_TYPE_UNDEF 0x00000000 -#define BASS_INPUT_TYPE_DIGITAL 0x01000000 -#define BASS_INPUT_TYPE_LINE 0x02000000 -#define BASS_INPUT_TYPE_MIC 0x03000000 -#define BASS_INPUT_TYPE_SYNTH 0x04000000 -#define BASS_INPUT_TYPE_CD 0x05000000 -#define BASS_INPUT_TYPE_PHONE 0x06000000 -#define BASS_INPUT_TYPE_SPEAKER 0x07000000 -#define BASS_INPUT_TYPE_WAVE 0x08000000 -#define BASS_INPUT_TYPE_AUX 0x09000000 -#define BASS_INPUT_TYPE_ANALOG 0x0a000000 +#define BASS_INPUT_OFF 0x10000 +#define BASS_INPUT_ON 0x20000 + +#define BASS_INPUT_TYPE_MASK 0xff000000 +#define BASS_INPUT_TYPE_UNDEF 0x00000000 +#define BASS_INPUT_TYPE_DIGITAL 0x01000000 +#define BASS_INPUT_TYPE_LINE 0x02000000 +#define BASS_INPUT_TYPE_MIC 0x03000000 +#define BASS_INPUT_TYPE_SYNTH 0x04000000 +#define BASS_INPUT_TYPE_CD 0x05000000 +#define BASS_INPUT_TYPE_PHONE 0x06000000 +#define BASS_INPUT_TYPE_SPEAKER 0x07000000 +#define BASS_INPUT_TYPE_WAVE 0x08000000 +#define BASS_INPUT_TYPE_AUX 0x09000000 +#define BASS_INPUT_TYPE_ANALOG 0x0a000000 // BASS_ChannelSetFX effect types -#define BASS_FX_DX8_CHORUS 0 -#define BASS_FX_DX8_COMPRESSOR 1 -#define BASS_FX_DX8_DISTORTION 2 -#define BASS_FX_DX8_ECHO 3 -#define BASS_FX_DX8_FLANGER 4 -#define BASS_FX_DX8_GARGLE 5 -#define BASS_FX_DX8_I3DL2REVERB 6 -#define BASS_FX_DX8_PARAMEQ 7 -#define BASS_FX_DX8_REVERB 8 -#define BASS_FX_VOLUME 9 +#define BASS_FX_DX8_CHORUS 0 +#define BASS_FX_DX8_COMPRESSOR 1 +#define BASS_FX_DX8_DISTORTION 2 +#define BASS_FX_DX8_ECHO 3 +#define BASS_FX_DX8_FLANGER 4 +#define BASS_FX_DX8_GARGLE 5 +#define BASS_FX_DX8_I3DL2REVERB 6 +#define BASS_FX_DX8_PARAMEQ 7 +#define BASS_FX_DX8_REVERB 8 +#define BASS_FX_VOLUME 9 typedef struct { - float fWetDryMix; - float fDepth; - float fFeedback; - float fFrequency; - DWORD lWaveform; // 0=triangle, 1=sine - float fDelay; - DWORD lPhase; // BASS_DX8_PHASE_xxx + float fWetDryMix; + float fDepth; + float fFeedback; + float fFrequency; + DWORD lWaveform; // 0=triangle, 1=sine + float fDelay; + DWORD lPhase; // BASS_DX8_PHASE_xxx } BASS_DX8_CHORUS; typedef struct { - float fGain; - float fAttack; - float fRelease; - float fThreshold; - float fRatio; - float fPredelay; + float fGain; + float fAttack; + float fRelease; + float fThreshold; + float fRatio; + float fPredelay; } BASS_DX8_COMPRESSOR; typedef struct { - float fGain; - float fEdge; - float fPostEQCenterFrequency; - float fPostEQBandwidth; - float fPreLowpassCutoff; + float fGain; + float fEdge; + float fPostEQCenterFrequency; + float fPostEQBandwidth; + float fPreLowpassCutoff; } BASS_DX8_DISTORTION; typedef struct { - float fWetDryMix; - float fFeedback; - float fLeftDelay; - float fRightDelay; - BOOL lPanDelay; + float fWetDryMix; + float fFeedback; + float fLeftDelay; + float fRightDelay; + BOOL lPanDelay; } BASS_DX8_ECHO; typedef struct { - float fWetDryMix; - float fDepth; - float fFeedback; - float fFrequency; - DWORD lWaveform; // 0=triangle, 1=sine - float fDelay; - DWORD lPhase; // BASS_DX8_PHASE_xxx + float fWetDryMix; + float fDepth; + float fFeedback; + float fFrequency; + DWORD lWaveform; // 0=triangle, 1=sine + float fDelay; + DWORD lPhase; // BASS_DX8_PHASE_xxx } BASS_DX8_FLANGER; typedef struct { - DWORD dwRateHz; // Rate of modulation in hz - DWORD dwWaveShape; // 0=triangle, 1=square + DWORD dwRateHz; // Rate of modulation in hz + DWORD dwWaveShape; // 0=triangle, 1=square } BASS_DX8_GARGLE; typedef struct { - int lRoom; // [-10000, 0] default: -1000 mB - int lRoomHF; // [-10000, 0] default: 0 mB - float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0 - float flDecayTime; // [0.1, 20.0] default: 1.49s - float flDecayHFRatio; // [0.1, 2.0] default: 0.83 - int lReflections; // [-10000, 1000] default: -2602 mB - float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s - int lReverb; // [-10000, 2000] default: 200 mB - float flReverbDelay; // [0.0, 0.1] default: 0.011 s - float flDiffusion; // [0.0, 100.0] default: 100.0 % - float flDensity; // [0.0, 100.0] default: 100.0 % - float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz + int lRoom; // [-10000, 0] default: -1000 mB + int lRoomHF; // [-10000, 0] default: 0 mB + float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0 + float flDecayTime; // [0.1, 20.0] default: 1.49s + float flDecayHFRatio; // [0.1, 2.0] default: 0.83 + int lReflections; // [-10000, 1000] default: -2602 mB + float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s + int lReverb; // [-10000, 2000] default: 200 mB + float flReverbDelay; // [0.0, 0.1] default: 0.011 s + float flDiffusion; // [0.0, 100.0] default: 100.0 % + float flDensity; // [0.0, 100.0] default: 100.0 % + float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz } BASS_DX8_I3DL2REVERB; typedef struct { - float fCenter; - float fBandwidth; - float fGain; + float fCenter; + float fBandwidth; + float fGain; } BASS_DX8_PARAMEQ; typedef struct { - float fInGain; // [-96.0,0.0] default: 0.0 dB - float fReverbMix; // [-96.0,0.0] default: 0.0 db - float fReverbTime; // [0.001,3000.0] default: 1000.0 ms - float fHighFreqRTRatio; // [0.001,0.999] default: 0.001 + float fInGain; // [-96.0,0.0] default: 0.0 dB + float fReverbMix; // [-96.0,0.0] default: 0.0 db + float fReverbTime; // [0.001,3000.0] default: 1000.0 ms + float fHighFreqRTRatio; // [0.001,0.999] default: 0.001 } BASS_DX8_REVERB; -#define BASS_DX8_PHASE_NEG_180 0 -#define BASS_DX8_PHASE_NEG_90 1 -#define BASS_DX8_PHASE_ZERO 2 -#define BASS_DX8_PHASE_90 3 -#define BASS_DX8_PHASE_180 4 - +#define BASS_DX8_PHASE_NEG_180 0 +#define BASS_DX8_PHASE_NEG_90 1 +#define BASS_DX8_PHASE_ZERO 2 +#define BASS_DX8_PHASE_90 3 +#define BASS_DX8_PHASE_180 4 + typedef struct { - float fTarget; - float fCurrent; - float fTime; - DWORD lCurve; + float fTarget; + float fCurrent; + float fTime; + DWORD lCurve; } BASS_FX_VOLUME_PARAM; - -typedef void (CALLBACK IOSNOTIFYPROC)(DWORD status); -/* iOS notification callback function. -status : The notification (BASS_IOSNOTIFY_xxx) */ - -#define BASS_IOSNOTIFY_INTERRUPT 1 // interruption started -#define BASS_IOSNOTIFY_INTERRUPT_END 2 // interruption ended + +typedef void(CALLBACK IOSNOTIFYPROC)(DWORD status); +/* iOS notification callback function. +status : The notification (BASS_IOSNOTIFY_xxx) */ + +#define BASS_IOSNOTIFY_INTERRUPT 1 // interruption started +#define BASS_IOSNOTIFY_INTERRUPT_END 2 // interruption ended BOOL BASSDEF(BASS_SetConfig)(DWORD option, DWORD value); DWORD BASSDEF(BASS_GetConfig)(DWORD option); @@ -998,7 +996,7 @@ 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) +#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); @@ -1006,7 +1004,7 @@ BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, void *win, void *ds BOOL BASSDEF(BASS_SetDevice)(DWORD device); DWORD BASSDEF(BASS_GetDevice)(); BOOL BASSDEF(BASS_Free)(); -#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) +#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) void *BASSDEF(BASS_GetDSoundObject)(DWORD object); #endif BOOL BASSDEF(BASS_GetInfo)(BASS_INFO *info); @@ -1028,7 +1026,7 @@ 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) +#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 @@ -1094,7 +1092,7 @@ QWORD BASSDEF(BASS_ChannelGetLength)(DWORD handle, DWORD mode); BOOL BASSDEF(BASS_ChannelSetPosition)(DWORD handle, QWORD pos, DWORD mode); QWORD BASSDEF(BASS_ChannelGetPosition)(DWORD handle, DWORD mode); DWORD BASSDEF(BASS_ChannelGetLevel)(DWORD handle); -BOOL BASSDEF(BASS_ChannelGetLevelEx)(DWORD handle, float *levels, float length, DWORD flags); +BOOL BASSDEF(BASS_ChannelGetLevelEx)(DWORD handle, float *levels, float length, DWORD flags); DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length); HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param, SYNCPROC *proc, void *user); BOOL BASSDEF(BASS_ChannelRemoveSync)(DWORD handle, HSYNC sync); @@ -1109,41 +1107,41 @@ BOOL BASSDEF(BASS_FXSetParameters)(HFX handle, const void *params); BOOL BASSDEF(BASS_FXGetParameters)(HFX handle, void *params); BOOL BASSDEF(BASS_FXReset)(HFX handle); BOOL BASSDEF(BASS_FXSetPriority)(HFX handle, int priority); - + #ifdef __cplusplus } - -#if defined(_WIN32) && !defined(NOBASSOVERLOADS) -static inline HPLUGIN BASS_PluginLoad(const WCHAR *file, DWORD flags) -{ - return BASS_PluginLoad((const char*)file, flags|BASS_UNICODE); -} - -static inline HMUSIC BASS_MusicLoad(BOOL mem, const WCHAR *file, QWORD offset, DWORD length, DWORD flags, DWORD freq) -{ - return BASS_MusicLoad(mem, (const void*)file, offset, length, flags|BASS_UNICODE, freq); -} - -static inline HSAMPLE BASS_SampleLoad(BOOL mem, const WCHAR *file, QWORD offset, DWORD length, DWORD max, DWORD flags) -{ - return BASS_SampleLoad(mem, (const void*)file, offset, length, max, flags|BASS_UNICODE); -} - -static inline HSTREAM BASS_StreamCreateFile(BOOL mem, const WCHAR *file, QWORD offset, QWORD length, DWORD flags) -{ - return BASS_StreamCreateFile(mem, (const void*)file, offset, length, flags|BASS_UNICODE); -} - -static inline HSTREAM BASS_StreamCreateURL(const WCHAR *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user) -{ - return BASS_StreamCreateURL((const char*)url, offset, flags|BASS_UNICODE, proc, user); -} - -static inline BOOL BASS_SetConfigPtr(DWORD option, const WCHAR *value) -{ - return BASS_SetConfigPtr(option|BASS_UNICODE, (const void*)value); -} -#endif + +#if defined(_WIN32) && !defined(NOBASSOVERLOADS) +static inline HPLUGIN BASS_PluginLoad(const WCHAR *file, DWORD flags) +{ + return BASS_PluginLoad((const char *)file, flags | BASS_UNICODE); +} + +static inline HMUSIC BASS_MusicLoad(BOOL mem, const WCHAR *file, QWORD offset, DWORD length, DWORD flags, DWORD freq) +{ + return BASS_MusicLoad(mem, (const void *)file, offset, length, flags | BASS_UNICODE, freq); +} + +static inline HSAMPLE BASS_SampleLoad(BOOL mem, const WCHAR *file, QWORD offset, DWORD length, DWORD max, DWORD flags) +{ + return BASS_SampleLoad(mem, (const void *)file, offset, length, max, flags | BASS_UNICODE); +} + +static inline HSTREAM BASS_StreamCreateFile(BOOL mem, const WCHAR *file, QWORD offset, QWORD length, DWORD flags) +{ + return BASS_StreamCreateFile(mem, (const void *)file, offset, length, flags | BASS_UNICODE); +} + +static inline HSTREAM BASS_StreamCreateURL(const WCHAR *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user) +{ + return BASS_StreamCreateURL((const char *)url, offset, flags | BASS_UNICODE, proc, user); +} + +static inline BOOL BASS_SetConfigPtr(DWORD option, const WCHAR *value) +{ + return BASS_SetConfigPtr(option | BASS_UNICODE, (const void *)value); +} +#endif #endif #endif diff --git a/include/bassopus.h b/include/bassopus.h index 4e48124f..757ff70c 100644 --- a/include/bassopus.h +++ b/include/bassopus.h @@ -10,7 +10,7 @@ #include "bass.h" -#if BASSVERSION!=0x204 +#if BASSVERSION != 0x204 #error conflicting BASS and BASSOPUS versions #endif @@ -23,11 +23,11 @@ extern "C" { #endif // BASS_CHANNELINFO type -#define BASS_CTYPE_STREAM_OPUS 0x11200 +#define BASS_CTYPE_STREAM_OPUS 0x11200 // Additional attributes -#define BASS_ATTRIB_OPUS_ORIGFREQ 0x13000 -#define BASS_ATTRIB_OPUS_GAIN 0x13001 +#define BASS_ATTRIB_OPUS_ORIGFREQ 0x13000 +#define BASS_ATTRIB_OPUS_GAIN 0x13001 HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags); HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user); @@ -39,12 +39,12 @@ HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFileUser)(DWORD system, DWORD flags, c #if defined(_WIN32) && !defined(NOBASSOVERLOADS) static inline HSTREAM BASS_OPUS_StreamCreateFile(BOOL mem, const WCHAR *file, QWORD offset, QWORD length, DWORD flags) { - return BASS_OPUS_StreamCreateFile(mem, (const void*)file, offset, length, flags|BASS_UNICODE); + return BASS_OPUS_StreamCreateFile(mem, (const void *)file, offset, length, flags | BASS_UNICODE); } static inline HSTREAM BASS_OPUS_StreamCreateURL(const WCHAR *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user) { - return BASS_OPUS_StreamCreateURL((const char*)url, offset, flags|BASS_UNICODE, proc, user); + return BASS_OPUS_StreamCreateURL((const char *)url, offset, flags | BASS_UNICODE, proc, user); } #endif #endif diff --git a/include/chatlogpiece.h b/include/chatlogpiece.h index 303c2351..c2d32b24 100644 --- a/include/chatlogpiece.h +++ b/include/chatlogpiece.h @@ -1,31 +1,30 @@ #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, bool p_song); - 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); + chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime); - QString get_name(); - QString get_showname(); - QString get_message(); - bool is_song(); - QDateTime get_datetime(); - QString get_datetime_as_string(); + QString get_name(); + QString get_showname(); + QString get_message(); + bool is_song(); + QDateTime get_datetime(); + QString get_datetime_as_string(); - QString get_full(); + QString get_full(); private: - QString name; - QString showname; - QString message; - QDateTime datetime; - bool p_is_song; + QString name; + QString showname; + QString message; + QDateTime datetime; + bool p_is_song; }; #endif // CHATLOGPIECE_H diff --git a/include/courtroom.h b/include/courtroom.h index c1bd0a64..c3c6b87e 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -1,792 +1,785 @@ #ifndef COURTROOM_H #define COURTROOM_H -#include "aoimage.h" +#include "aoapplication.h" +#include "aoblipplayer.h" #include "aobutton.h" #include "aocharbutton.h" +#include "aocharmovie.h" #include "aoemotebutton.h" -#include "aopacket.h" -#include "aoscene.h" +#include "aoevidencebutton.h" +#include "aoevidencedisplay.h" +#include "aoimage.h" +#include "aolineedit.h" #include "aomovie.h" -#include "aocharmovie.h" #include "aomusicplayer.h" #include "aooptionsdialog.h" +#include "aopacket.h" +#include "aoscene.h" #include "aosfxplayer.h" -#include "aoblipplayer.h" -#include "aoevidencebutton.h" #include "aotextarea.h" -#include "aolineedit.h" #include "aotextedit.h" -#include "aoevidencedisplay.h" -#include "datatypes.h" -#include "aoapplication.h" -#include "lobby.h" -#include "hardware_functions.h" -#include "file_functions.h" +#include "chatlogpiece.h" #include "datatypes.h" #include "debug_functions.h" -#include "chatlogpiece.h" +#include "file_functions.h" +#include "hardware_functions.h" +#include "lobby.h" #include "scrolltext.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 -#include #include -#include +#include +#include +#include +#include +#include +#include +#include //#include #include class AOApplication; -class Courtroom : public QMainWindow -{ - Q_OBJECT +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 fix_last_area() - { - if (area_list.size() > 0) - { - QString malplaced = area_list.last(); - area_list.removeLast(); - append_music(malplaced); - } - } - - 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) + 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 fix_last_area() { - if (arup_statuses.size() > place) - arup_statuses[place] = value; + if (area_list.size() > 0) { + QString malplaced = area_list.last(); + area_list.removeLast(); + append_music(malplaced); + } } - else if (type == 2) + + void arup_append(int players, QString status, QString cm, QString locked) { - if (arup_cms.size() > place) - arup_cms[place] = value; + arup_players.append(players); + arup_statuses.append(status); + arup_cms.append(cm); + arup_locks.append(locked); } - else if (type == 3) + + void arup_modify(int type, int place, QString value) { - if (arup_locks.size() > place) - arup_locks[place] = 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(); } - list_areas(); - } - void character_loading_finished(); + void character_loading_finished(); - //sets position of widgets based on theme ini files - void set_widgets(); + //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 class_name, QString p_identifier); + //sets font size based on theme ini files + void set_font(QWidget *widget, QString class_name, QString p_identifier); - //Get the properly constructed font - QFont get_qfont(QString font_name, int f_pointsize, bool antialias=true); + //Get the properly constructed font + QFont get_qfont(QString font_name, int f_pointsize, bool antialias = true); - //actual operation of setting the font on a widget - void set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color = Qt::black, bool bold = false); + //actual operation of setting the font on a widget + void set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color = Qt::black, bool bold = false); - //helper function that calls above function on the relevant widgets - void set_fonts(); + //helper function that calls above function on the relevant widgets + void set_fonts(); - //sets dropdown menu stylesheet - void set_dropdown(QWidget *widget); + //sets dropdown menu stylesheet + void set_dropdown(QWidget *widget); - //helper funciton that call above function on the relevant widgets - void set_dropdowns(); + //helper funciton that call above function on the relevant widgets + void set_dropdowns(); - void set_window_title(QString p_title); + 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); + //reads theme inis and sets size and pos based on the identifier + void set_size_and_pos(QWidget *p_widget, QString p_identifier); - //reads theme inis and returns the size and pos as defined by it - QPoint get_theme_pos(QString p_identifier); + //reads theme inis and returns the size and pos as defined by it + 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 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, bool display=false); + //sets the current background to argument. also does some checks to see if it's a legacy bg + void set_background(QString p_background, bool display = false); - //sets the local character pos/side to use. - void set_side(QString p_side); + //sets the local character pos/side to use. + void set_side(QString p_side); - //sets the pos dropdown - void set_pos_dropdown(QStringList pos_dropdowns); + //sets the pos dropdown + void set_pos_dropdown(QStringList pos_dropdowns); - //sets the evidence list member variable to argument - void set_evidence_list(QVector &p_evi_list); + //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(); + //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 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 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(QString f_desk_mod, QString f_side); + //sets desk and bg based on pos in chatmessage + void set_scene(QString f_desk_mod, QString f_side); - //takes in serverD-formatted IP list as prints a converted version to server OOC - //admittedly poorly named - void set_ip_list(QString p_list); + //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); + //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); + //send a message that the player is banned and quits the server + void set_ban(int p_cid); - //cid = character id, returns the cid of the currently selected character - int get_cid() {return m_cid;} - QString get_current_char() {return current_char;} - QString get_current_background() {return current_background;} + //cid = character id, returns the cid of the currently selected character + int get_cid() { return m_cid; } + QString get_current_char() { return current_char; } + QString get_current_background() { return current_background; } - //updates character to p_cid and updates necessary ui elements - void update_character(int p_cid); + //updates character to p_cid and updates necessary ui elements + void update_character(int p_cid); - //properly sets up some varibles: resets user state - void enter_courtroom(); + //properly sets up some varibles: resets user state + void enter_courtroom(); - //helper function that populates ui_music_list with the contents of music_list - void list_music(); - void list_areas(); + //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_color); + //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_color); - //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(); + //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 colorize = false, int pos = -1, int default_color = 0); + //This function filters out the common CC inline text trickery, for appending to + //the IC chatlog. + QString filter_ic_text(QString p_text, bool colorize = false, int pos = -1, int default_color = 0); - //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 = "", QString action = ""); + //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 = "", QString action = ""); - //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); + //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); + void play_preanim(bool noninterrupting); - //plays the witness testimony or cross examination animation based on argument - void handle_wtce(QString p_wtce, int variant); + //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); + //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); + //Toggles the judge buttons, whether they should appear or not. + void toggle_judge_buttons(bool is_on); - void announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno); + void announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno); - void check_connection_received(); + void check_connection_received(); - ~Courtroom(); + ~Courtroom(); private: - AOApplication *ao_app; + AOApplication *ao_app; - int m_courtroom_width = 714; - int m_courtroom_height = 668; + int m_courtroom_width = 714; + int m_courtroom_height = 668; - int m_viewport_x = 0; - int m_viewport_y = 0; + int m_viewport_x = 0; + int m_viewport_y = 0; - int m_viewport_width = 256; - int m_viewport_height = 192; + int m_viewport_width = 256; + int m_viewport_height = 192; - bool first_message_sent = false; - int maximumMessages = 0; + bool first_message_sent = false; + int maximumMessages = 0; - QParallelAnimationGroup *screenshake_animation_group = new QParallelAnimationGroup; + QParallelAnimationGroup *screenshake_animation_group = new QParallelAnimationGroup; - bool next_character_is_not_special = false; // If true, write the - // next character as it is. + bool next_character_is_not_special = false; // If true, write the + // next character as it is. - bool message_is_centered = false; + bool message_is_centered = false; - int current_display_speed = 3; - int message_display_speed[7] = {0, 10, 25, 40, 50, 70, 90}; + int current_display_speed = 3; + int message_display_speed[7] = {0, 10, 25, 40, 50, 70, 90}; - // The character ID of the character this user wants to appear alongside with. - int other_charid = -1; + // 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 char_offset = 0; + // The offset this user has given if they want to appear alongside someone. + int char_offset = 0; - // 0 = in front, 1 = behind - int pair_order = 0; + // 0 = in front, 1 = behind + int pair_order = 0; - QVector char_list; - QVector evidence_list; - QVector music_list; - QVector area_list; + QVector char_list; + QVector evidence_list; + QVector music_list; + QVector area_list; - QVector arup_players; - QVector arup_statuses; - QVector arup_cms; - QVector arup_locks; + QVector arup_players; + QVector arup_statuses; + QVector arup_cms; + QVector arup_locks; - QVector ic_chatlog_history; + QVector ic_chatlog_history; - //triggers ping_server() every 60 seconds - QTimer *keepalive_timer; + //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; - //the actual document tick pos we gotta worry about for making the text scroll better - int real_tick_pos = 0; - //used to determine how often blips sound - int blip_ticker = 0; - int blip_rate = 1; - int rainbow_counter = 0; - bool rainbow_appended = false; - bool blank_blip = false; + //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; + //the actual document tick pos we gotta worry about for making the text scroll better + int real_tick_pos = 0; + //used to determine how often blips sound + int blip_ticker = 0; + int blip_rate = 1; + int rainbow_counter = 0; + bool rainbow_appended = false; + bool blank_blip = false; - //Whether or not is this message additive to the previous one - bool is_additive = false; + //Whether or not is this message additive to the previous one + bool is_additive = false; - // Used for getting the current maximum blocks allowed in the IC chatlog. - int log_maximum_blocks = 0; + // 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; + // True, if the log should go downwards. + bool log_goes_downwards = false; - //delay before chat messages starts ticking - QTimer *text_delay_timer; + //delay before chat messages starts ticking + QTimer *text_delay_timer; - //delay before sfx plays - QTimer *sfx_delay_timer; + //delay before sfx plays + QTimer *sfx_delay_timer; - //every time point in char.inis times this equals the final time - const int time_mod = 40; + //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 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 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; + //the amount of time non-animated witness testimony/cross-examination images stay onscreen for in ms + const int wtce_stay_time = 1500; - //characters we consider punctuation - const QString punctuation_chars = ".,?!:;"; + //characters we consider punctuation + const QString punctuation_chars = ".,?!:;"; - //amount by which we multiply the delay when we parse punctuation chars - const int punctuation_modifier = 3; + //amount by which we multiply the delay when we parse punctuation chars + const int punctuation_modifier = 3; - static const int chatmessage_size = 30; - QString m_chatmessage[chatmessage_size]; - bool chatmessage_is_empty = false; + static const int chatmessage_size = 30; + QString m_chatmessage[chatmessage_size]; + bool chatmessage_is_empty = false; - QString previous_ic_message = ""; - QString additive_previous = ""; + QString previous_ic_message = ""; + QString additive_previous = ""; - //char id, muted or not - QMap mute_map; + //char id, muted or not + QMap mute_map; - //QVector muted_cids; + //QVector muted_cids; - bool is_muted = false; + bool is_muted = false; - //state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle, 4 = noniterrupting preanim - int anim_state = 3; + //state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle, 4 = noniterrupting preanim + int anim_state = 3; - //whether or not current color is a talking one - bool color_is_talking = true; + //whether or not current color is a talking one + bool color_is_talking = true; - //state of text ticking, 0 = not yet ticking, 1 = ticking in progress, 2 = ticking done - int text_state = 2; + //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 - int m_cid = -1; - //cid and this may differ in cases of ini-editing - QString current_char = ""; + //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 current_char = ""; - int objection_state = 0; - int realization_state = 0; - int screenshake_state = 0; - int text_color = 0; + int objection_state = 0; + int realization_state = 0; + int screenshake_state = 0; + int text_color = 0; - //How many unique user colors are possible - static const int max_colors = 12; + //How many unique user colors are possible + static const int max_colors = 12; - //Text Color-related optimization: - //Current color list indexes to real color references - QVector color_row_to_number; + //Text Color-related optimization: + //Current color list indexes to real color references + QVector color_row_to_number; - //List of associated RGB colors for this color index - QVector color_rgb_list; + //List of associated RGB colors for this color index + QVector color_rgb_list; - //List of markdown start characters, their index is tied to the color index - QStringList color_markdown_start_list; + //List of markdown start characters, their index is tied to the color index + QStringList color_markdown_start_list; - //List of markdown end characters, their index is tied to the color index - QStringList color_markdown_end_list; + //List of markdown end characters, their index is tied to the color index + QStringList color_markdown_end_list; - //Whether or not we're supposed to remove this char during parsing - QVector color_markdown_remove_list; + //Whether or not we're supposed to remove this char during parsing + QVector color_markdown_remove_list; - //Whether or not this color allows us to play the talking animation - QVector color_markdown_talking_list; - //Text Color-related optimization END + //Whether or not this color allows us to play the talking animation + QVector color_markdown_talking_list; + //Text Color-related optimization END - //List of all currently available pos - QStringList pos_dropdown_list; + //List of all currently available pos + QStringList pos_dropdown_list; - bool is_presenting_evidence = false; + bool is_presenting_evidence = false; - QString effect = ""; + QString effect = ""; - //Music effect flags we want to send to server when we play music - int music_flags = 0; + //Music effect flags we want to send to server when we play music + int music_flags = 0; - int defense_bar_state = 0; - int prosecution_bar_state = 0; + 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; + 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; + const int button_width = 60; + const int button_height = 60; - int current_emote_page = 0; - int current_emote = 0; - int emote_columns = 5; - int emote_rows = 2; - int max_emotes_on_page = 10; + int current_emote_page = 0; + int current_emote = 0; + int emote_columns = 5; + int emote_rows = 2; + int max_emotes_on_page = 10; - QVector local_evidence_list; - QVector private_evidence_list; - QVector global_evidence_list; + QVector local_evidence_list; + QVector private_evidence_list; + QVector global_evidence_list; - //false = use private_evidence_list - bool current_evidence_global = true; + //false = use private_evidence_list + bool current_evidence_global = true; - int current_evidence_page = 0; - int current_evidence = 0; - int evidence_columns = 6; - int evidence_rows = 3; - int max_evidence_on_page = 18; + 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; + //is set to true if the bg folder contains defensedesk.png, prosecutiondesk.png and stand.png + bool is_ao2_bg = false; - //whether the ooc chat is server or master chat, true is server - bool server_ooc = true; + //whether the ooc chat is server or master chat, true is server + bool server_ooc = true; - QString current_background = "default"; - QString current_side = ""; + QString current_background = "default"; + QString current_side = ""; - AOMusicPlayer *music_player; - AOSfxPlayer *sfx_player; - AOSfxPlayer *objection_player; - AOBlipPlayer *blip_player; + AOMusicPlayer *music_player; + AOSfxPlayer *sfx_player; + AOSfxPlayer *objection_player; + AOBlipPlayer *blip_player; - AOSfxPlayer *modcall_player; + AOSfxPlayer *modcall_player; - AOImage *ui_background; + 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; - AOMovie *ui_vp_chat_arrow; - QTextEdit *ui_vp_message; - AOMovie *ui_vp_effect; - AOMovie *ui_vp_testimony; - AOMovie *ui_vp_wtce; - AOMovie *ui_vp_objection; + 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; + AOMovie *ui_vp_chat_arrow; + QTextEdit *ui_vp_message; + AOMovie *ui_vp_effect; + AOMovie *ui_vp_testimony; + AOMovie *ui_vp_wtce; + AOMovie *ui_vp_objection; - QTextEdit *ui_ic_chatlog; + QTextEdit *ui_ic_chatlog; - AOTextArea *ui_ms_chatlog; - AOTextArea *ui_server_chatlog; + AOTextArea *ui_ms_chatlog; + AOTextArea *ui_server_chatlog; - QListWidget *ui_mute_list; - QTreeWidget *ui_area_list; - QTreeWidget *ui_music_list; + QListWidget *ui_mute_list; + QTreeWidget *ui_area_list; + QTreeWidget *ui_music_list; - ScrollText *ui_music_name; - AOMovie *ui_music_display; + ScrollText *ui_music_name; + AOMovie *ui_music_display; - AOButton *ui_pair_button; - QListWidget *ui_pair_list; - QSpinBox *ui_pair_offset_spinbox; + AOButton *ui_pair_button; + QListWidget *ui_pair_list; + QSpinBox *ui_pair_offset_spinbox; - QComboBox *ui_pair_order_dropdown; + QComboBox *ui_pair_order_dropdown; - AOLineEdit *ui_ic_chat_message; - QLineEdit *ui_ic_chat_name; + AOLineEdit *ui_ic_chat_message; + QLineEdit *ui_ic_chat_name; - QLineEdit *ui_ooc_chat_message; - QLineEdit *ui_ooc_chat_name; + QLineEdit *ui_ooc_chat_message; + QLineEdit *ui_ooc_chat_name; - //QLineEdit *ui_area_password; - QLineEdit *ui_music_search; + //QLineEdit *ui_area_password; + QLineEdit *ui_music_search; - QWidget *ui_emotes; - QVector ui_emote_list; - AOButton *ui_emote_left; - AOButton *ui_emote_right; + QWidget *ui_emotes; + QVector ui_emote_list; + AOButton *ui_emote_left; + AOButton *ui_emote_right; - QComboBox *ui_emote_dropdown; - QComboBox *ui_pos_dropdown; + QComboBox *ui_emote_dropdown; + QComboBox *ui_pos_dropdown; - QComboBox *ui_iniswap_dropdown; - AOButton *ui_iniswap_remove; + QComboBox *ui_iniswap_dropdown; + AOButton *ui_iniswap_remove; - QComboBox *ui_sfx_dropdown; - AOButton *ui_sfx_remove; + QComboBox *ui_sfx_dropdown; + AOButton *ui_sfx_remove; - QComboBox *ui_effects_dropdown; + QComboBox *ui_effects_dropdown; - AOImage *ui_defense_bar; - AOImage *ui_prosecution_bar; + AOImage *ui_defense_bar; + AOImage *ui_prosecution_bar; - QLabel *ui_music_label; - QLabel *ui_sfx_label; - QLabel *ui_blip_label; + 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_hold_it; + AOButton *ui_objection; + AOButton *ui_take_that; - AOButton *ui_ooc_toggle; + AOButton *ui_ooc_toggle; - AOButton *ui_witness_testimony; - AOButton *ui_cross_examination; - AOButton *ui_guilty; - AOButton *ui_not_guilty; + 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; + 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_additive; - QCheckBox *ui_guard; - QCheckBox *ui_casing; + QCheckBox *ui_pre; + QCheckBox *ui_flip; + QCheckBox *ui_additive; + QCheckBox *ui_guard; + QCheckBox *ui_casing; - QCheckBox *ui_pre_non_interrupt; - QCheckBox *ui_showname_enable; + QCheckBox *ui_pre_non_interrupt; + QCheckBox *ui_showname_enable; - AOButton *ui_custom_objection; - AOButton *ui_realization; - AOButton *ui_screenshake; - AOButton *ui_mute; - - AOButton *ui_defense_plus; - AOButton *ui_defense_minus; - - AOButton *ui_prosecution_plus; - AOButton *ui_prosecution_minus; + AOButton *ui_custom_objection; + AOButton *ui_realization; + AOButton *ui_screenshake; + AOButton *ui_mute; + + AOButton *ui_defense_plus; + AOButton *ui_defense_minus; + + AOButton *ui_prosecution_plus; + AOButton *ui_prosecution_minus; - QComboBox *ui_text_color; + QComboBox *ui_text_color; - QSlider *ui_music_slider; - QSlider *ui_sfx_slider; - QSlider *ui_blip_slider; + QSlider *ui_music_slider; + QSlider *ui_sfx_slider; + QSlider *ui_blip_slider; - AOImage *ui_muted; + AOImage *ui_muted; - 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; - AOButton *ui_evidence_ok; - AOButton *ui_evidence_switch; - AOButton *ui_evidence_transfer; - AOButton *ui_evidence_save; - AOButton *ui_evidence_load; - AOTextEdit *ui_evidence_description; + 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; + AOButton *ui_evidence_ok; + AOButton *ui_evidence_switch; + AOButton *ui_evidence_transfer; + AOButton *ui_evidence_save; + AOButton *ui_evidence_load; + AOTextEdit *ui_evidence_description; - AOImage *ui_char_select_background; + AOImage *ui_char_select_background; - //abstract widget to hold char buttons - QWidget *ui_char_buttons; + //abstract widget to hold char buttons + QWidget *ui_char_buttons; - QVector ui_char_button_list; - QVector ui_char_button_list_filtered; - AOImage *ui_selector; + QVector ui_char_button_list; + QVector ui_char_button_list_filtered; + AOImage *ui_selector; - AOButton *ui_back_to_lobby; + AOButton *ui_back_to_lobby; - QLineEdit *ui_char_password; + QLineEdit *ui_char_password; - AOButton *ui_char_select_left; - AOButton *ui_char_select_right; + AOButton *ui_char_select_left; + AOButton *ui_char_select_right; - AOButton *ui_spectator; + AOButton *ui_spectator; - QLineEdit *ui_char_search; - QCheckBox *ui_char_passworded; - QCheckBox *ui_char_taken; + QLineEdit *ui_char_search; + QCheckBox *ui_char_passworded; + QCheckBox *ui_char_taken; - void construct_char_select(); - void set_char_select(); - void set_char_select_page(); - void char_clicked(int n_char); - void put_button_in_place(int starting, int chars_on_this_page); - void filter_character_list(); - - void initialize_emotes(); - void refresh_emotes(); - void set_emote_page(); - void set_emote_dropdown(); - - void initialize_evidence(); - void refresh_evidence(); - void set_evidence_page(); + void construct_char_select(); + void set_char_select(); + void set_char_select_page(); + void char_clicked(int n_char); + void put_button_in_place(int starting, int chars_on_this_page); + void filter_character_list(); + + void initialize_emotes(); + void refresh_emotes(); + void set_emote_page(); + void set_emote_dropdown(); + + void initialize_evidence(); + void refresh_evidence(); + void set_evidence_page(); public slots: - void objection_done(); - void preanim_done(); - void do_screenshake(); - void do_flash(); - void do_effect(QString fx_path, QString fx_sound, QString p_char, QString p_folder); - void play_char_sfx(QString sfx_name); + void objection_done(); + void preanim_done(); + void do_screenshake(); + void do_flash(); + void do_effect(QString fx_path, QString fx_sound, QString p_char, QString p_folder); + void play_char_sfx(QString sfx_name); - void mod_called(QString p_ip); + void mod_called(QString p_ip); - void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno); + void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno); private slots: - void start_chat_ticking(); - void play_sfx(); + void start_chat_ticking(); + void play_sfx(); - void chat_tick(); + void chat_tick(); - void on_mute_list_clicked(QModelIndex p_index); - void on_pair_list_clicked(QModelIndex p_index); + void on_mute_list_clicked(QModelIndex p_index); + void on_pair_list_clicked(QModelIndex p_index); - void on_chat_return_pressed(); + void on_chat_return_pressed(); - void on_ooc_return_pressed(); + void on_ooc_return_pressed(); - void on_music_search_edited(QString p_text); - void on_music_list_double_clicked(QTreeWidgetItem *p_item, int column); - void on_music_list_context_menu_requested(const QPoint &pos); - void music_fade_out(bool toggle); - void music_fade_in(bool toggle); - void music_synchronize(bool toggle); - void music_list_expand_all(); - void music_list_collapse_all(); - void on_area_list_double_clicked(QTreeWidgetItem *p_item, int column); + void on_music_search_edited(QString p_text); + void on_music_list_double_clicked(QTreeWidgetItem *p_item, int column); + void on_music_list_context_menu_requested(const QPoint &pos); + void music_fade_out(bool toggle); + void music_fade_in(bool toggle); + void music_synchronize(bool toggle); + void music_list_expand_all(); + void music_list_collapse_all(); + void on_area_list_double_clicked(QTreeWidgetItem *p_item, int column); - void select_emote(int p_id); + void select_emote(int p_id); - void on_emote_clicked(int p_id); + void on_emote_clicked(int p_id); - void on_emote_left_clicked(); - void on_emote_right_clicked(); + 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_emote_dropdown_changed(int p_index); + void on_pos_dropdown_changed(int p_index); - void on_iniswap_dropdown_changed(int p_index); - void set_iniswap_dropdown(); - void on_iniswap_context_menu_requested(const QPoint &pos); - void on_iniswap_edit_requested(); - void on_iniswap_remove_clicked(); + void on_iniswap_dropdown_changed(int p_index); + void set_iniswap_dropdown(); + void on_iniswap_context_menu_requested(const QPoint &pos); + void on_iniswap_edit_requested(); + void on_iniswap_remove_clicked(); - void on_sfx_dropdown_changed(int p_index); - void set_sfx_dropdown(); - void on_sfx_context_menu_requested(const QPoint &pos); - void on_sfx_edit_requested(); - void on_sfx_remove_clicked(); + void on_sfx_dropdown_changed(int p_index); + void set_sfx_dropdown(); + void on_sfx_context_menu_requested(const QPoint &pos); + void on_sfx_edit_requested(); + void on_sfx_remove_clicked(); - void set_effects_dropdown(); - void on_effects_context_menu_requested(const QPoint &pos); - void on_effects_edit_requested(); - void on_character_effects_edit_requested(); - void on_effects_dropdown_changed(int p_index); - bool effects_dropdown_find_and_set(QString effect); + void set_effects_dropdown(); + void on_effects_context_menu_requested(const QPoint &pos); + void on_effects_edit_requested(); + void on_character_effects_edit_requested(); + void on_effects_dropdown_changed(int p_index); + bool effects_dropdown_find_and_set(QString effect); - QString get_char_sfx(); - int get_char_sfx_delay(); + QString get_char_sfx(); + int get_char_sfx_delay(); - 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_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_hover(int p_id, bool p_state); - void on_evidence_left_clicked(); - void on_evidence_right_clicked(); - void on_evidence_present_clicked(); + 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 on_hold_it_clicked(); + void on_objection_clicked(); + void on_take_that_clicked(); + void on_custom_objection_clicked(); - void on_realization_clicked(); - void on_screenshake_clicked(); + void on_realization_clicked(); + void on_screenshake_clicked(); - void on_mute_clicked(); - void on_pair_clicked(); - void on_pair_order_dropdown_changed(int p_index); + void on_mute_clicked(); + void on_pair_clicked(); + void on_pair_order_dropdown_changed(int p_index); - void on_defense_minus_clicked(); - void on_defense_plus_clicked(); - void on_prosecution_minus_clicked(); - void on_prosecution_plus_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 set_text_color_dropdown(); + void on_text_color_changed(int p_color); + void set_text_color_dropdown(); - 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_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_log_limit_changed(int value); + void on_pair_offset_changed(int value); - void on_ooc_toggle_clicked(); + 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_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_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_additive_clicked(); - void on_guard_clicked(); + void on_pre_clicked(); + void on_flip_clicked(); + void on_additive_clicked(); + void on_guard_clicked(); - void on_showname_enable_clicked(); + void on_showname_enable_clicked(); - void on_evidence_name_double_clicked(); - void on_evidence_image_name_double_clicked(); - void on_evidence_button_clicked(); + void on_evidence_name_double_clicked(); + void on_evidence_image_name_double_clicked(); + void on_evidence_button_clicked(); - void on_evidence_delete_clicked(); - void on_evidence_x_clicked(); - void on_evidence_ok_clicked(); - void on_evidence_switch_clicked(); - void on_evidence_transfer_clicked(); + void on_evidence_delete_clicked(); + void on_evidence_x_clicked(); + void on_evidence_ok_clicked(); + void on_evidence_switch_clicked(); + void on_evidence_transfer_clicked(); - void on_evidence_edited(); + void on_evidence_edited(); - void evidence_close(); - void evidence_switch(bool global); - void on_evidence_save_clicked(); - void on_evidence_load_clicked(); - bool compare_evidence_changed(evi_type evi_a, evi_type evi_b); + void evidence_close(); + void evidence_switch(bool global); + void on_evidence_save_clicked(); + void on_evidence_load_clicked(); + bool compare_evidence_changed(evi_type evi_a, evi_type evi_b); - void on_back_to_lobby_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_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 on_spectator_clicked(); - void on_switch_area_music_clicked(); + void on_switch_area_music_clicked(); - void on_casing_clicked(); + void on_casing_clicked(); - void ping_server(); + void ping_server(); - void load_bass_opus_plugin(); + void load_bass_opus_plugin(); }; #endif // COURTROOM_H diff --git a/include/datatypes.h b/include/datatypes.h index 921f6135..715bb3e0 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -3,118 +3,108 @@ #include -struct server_type -{ - QString name; - QString desc; - QString ip; - int port; +struct server_type { + QString name; + QString desc; + QString ip; + int port; }; -struct emote_type -{ - QString comment; - QString preanim; - QString anim; - int mod; - QString sfx_name; - int sfx_delay; - int sfx_duration; +struct emote_type { + QString comment; + QString preanim; + QString anim; + int mod; + QString sfx_name; + int sfx_delay; + int sfx_duration; }; -struct char_type -{ - QString name; - QString description; - QString evidence_string; - bool taken; +struct char_type { + QString name; + QString description; + QString evidence_string; + bool taken; }; -struct evi_type -{ - QString name; - QString description; - QString image; +struct evi_type { + QString name; + QString description; + QString image; }; -struct chatmessage_type -{ - QString message; - QString character; - QString side; - QString sfx_name; - QString pre_emote; - QString emote; - int emote_modifier; - int objection_modifier; - int realization; - int text_color; - int evidence; - int cid; - int sfx_delay; - int flip; +struct chatmessage_type { + QString message; + QString character; + QString side; + QString sfx_name; + QString pre_emote; + QString emote; + int emote_modifier; + int objection_modifier; + int realization; + int text_color; + int evidence; + int cid; + int sfx_delay; + int flip; }; -struct area_type -{ - QString name; - QString background; - bool passworded; +struct area_type { + QString name; + QString background; + bool passworded; }; -struct pos_type -{ - int x; - int y; +struct pos_type { + int x; + int y; }; -struct pos_size_type -{ - int x = 0; - int y = 0; - int width = 0; - int height = 0; +struct pos_size_type { + int x = 0; + int y = 0; + int width = 0; + int height = 0; }; -enum CHAT_MESSAGE -{ - DESK_MOD = 0, - PRE_EMOTE, - CHAR_NAME, - EMOTE, - MESSAGE, - SIDE, - SFX_NAME, - EMOTE_MOD, - CHAR_ID, - SFX_DELAY, - OBJECTION_MOD, - EVIDENCE_ID, - FLIP, - REALIZATION, - TEXT_COLOR, - SHOWNAME, - OTHER_CHARID, - OTHER_NAME, - OTHER_EMOTE, - SELF_OFFSET, - OTHER_OFFSET, - OTHER_FLIP, - NONINTERRUPTING_PRE, - LOOPING_SFX, - SCREENSHAKE, - FRAME_SCREENSHAKE, - FRAME_REALIZATION, - FRAME_SFX, - ADDITIVE, - EFFECTS +enum CHAT_MESSAGE { + DESK_MOD = 0, + PRE_EMOTE, + CHAR_NAME, + EMOTE, + MESSAGE, + SIDE, + SFX_NAME, + EMOTE_MOD, + CHAR_ID, + SFX_DELAY, + OBJECTION_MOD, + EVIDENCE_ID, + FLIP, + REALIZATION, + TEXT_COLOR, + SHOWNAME, + OTHER_CHARID, + OTHER_NAME, + OTHER_EMOTE, + SELF_OFFSET, + OTHER_OFFSET, + OTHER_FLIP, + NONINTERRUPTING_PRE, + LOOPING_SFX, + SCREENSHAKE, + FRAME_SCREENSHAKE, + FRAME_REALIZATION, + FRAME_SFX, + ADDITIVE, + EFFECTS }; -enum MUSIC_EFFECT -{ - FADE_IN = 1, - FADE_OUT = 2, - SYNC_POS = 4 +enum MUSIC_EFFECT { + FADE_IN = 1, + FADE_OUT = 2, + SYNC_POS = 4 }; #endif // DATATYPES_H diff --git a/include/debug_functions.h b/include/debug_functions.h index 160274cc..383431ab 100644 --- a/include/debug_functions.h +++ b/include/debug_functions.h @@ -1,8 +1,8 @@ #ifndef DEBUG_FUNCTIONS_H #define DEBUG_FUNCTIONS_H -#include #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 feb874b2..24885430 100644 --- a/include/discord-rpc.h +++ b/include/discord-rpc.h @@ -24,47 +24,47 @@ extern "C" { #endif typedef struct DiscordRichPresence { - const char* state; /* max 128 bytes */ - const char* details; /* max 128 bytes */ + 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 */ + 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 */ + 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 (*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 */ @@ -75,10 +75,10 @@ DISCORD_EXPORT void Discord_RunCallbacks(void); DISCORD_EXPORT void Discord_UpdateConnection(void); #endif -DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence); +DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence); DISCORD_EXPORT void Discord_ClearPresence(void); -DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply); +DISCORD_EXPORT void Discord_Respond(const char *userid, /* DISCORD_REPLY_ */ int reply); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/discord_register.h b/include/discord_register.h index 4c16b68a..71e856a5 100644 --- a/include/discord_register.h +++ b/include/discord_register.h @@ -1,25 +1,25 @@ #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 4115b516..1949d248 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,23 +16,23 @@ namespace AttorneyOnline { -class Discord -{ - Q_DECLARE_TR_FUNCTIONS(Discord) - -private: - const char* APPLICATION_ID = "399779271737868288"; - std::string server_name, server_id; - int64_t timestamp; -public: - Discord(); - ~Discord(); - - void state_lobby(); - void state_server(std::string name, std::string server_id); - void state_character(std::string name); - void state_spectate(); -}; - -} + class Discord { + Q_DECLARE_TR_FUNCTIONS(Discord) + + private: + const char *APPLICATION_ID = "399779271737868288"; + std::string server_name, server_id; + int64_t timestamp; + + public: + Discord(); + ~Discord(); + + void state_lobby(); + void state_server(std::string name, std::string server_id); + void state_character(std::string name); + void state_spectate(); + }; + +} // namespace AttorneyOnline #endif // DISCORD_RICH_PRESENCE_H diff --git a/include/discord_rpc.h b/include/discord_rpc.h index 3e1441e0..737f2f66 100644 --- a/include/discord_rpc.h +++ b/include/discord_rpc.h @@ -24,47 +24,47 @@ extern "C" { #endif typedef struct DiscordRichPresence { - const char* state; /* max 128 bytes */ - const char* details; /* max 128 bytes */ + 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 */ + 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 */ + 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 */ @@ -75,12 +75,12 @@ DISCORD_EXPORT void Discord_RunCallbacks(void); DISCORD_EXPORT void Discord_UpdateConnection(void); #endif -DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence); +DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence); DISCORD_EXPORT void Discord_ClearPresence(void); -DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply); +DISCORD_EXPORT void Discord_Respond(const char *userid, /* DISCORD_REPLY_ */ int reply); -DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers* handlers); +DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers *handlers); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/encryption_functions.h b/include/encryption_functions.h index dc67d122..b70e8e65 100644 --- a/include/encryption_functions.h +++ b/include/encryption_functions.h @@ -3,11 +3,11 @@ #include +#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 6937ed8a..8bb2e5f6 100644 --- a/include/file_functions.h +++ b/include/file_functions.h @@ -1,8 +1,8 @@ #ifndef FILE_FUNCTIONS_H #define FILE_FUNCTIONS_H -#include #include +#include #include bool file_exists(QString file_path); diff --git a/include/hex_functions.h b/include/hex_functions.h index 285f096a..429bdb14 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 diff --git a/include/lobby.h b/include/lobby.h index a969f865..7b978d32 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -1,108 +1,107 @@ #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 #include +#include #include #include class AOApplication; -class Lobby : public QMainWindow -{ - Q_OBJECT +class Lobby : public QMainWindow { + Q_OBJECT public: - Lobby(AOApplication *p_ao_app); - - void set_widgets(); - void list_servers(); - void list_favorites(); - void append_chatmessage(QString f_name, QString f_message); - void append_error(QString f_message); - void set_player_count(int players_online, int max_players); - void set_stylesheet(QWidget *widget, QString target_tag); - void set_stylesheets(); - void set_fonts(); - void set_font(QWidget *widget, QString p_identifier); - void set_loading_text(QString p_text); - void show_loading_overlay(){ui_loading_background->show();} - void hide_loading_overlay(){ui_loading_background->hide();} - QString get_chatlog(); - int get_selected_server(); - void enable_connect_button(); - - void set_loading_value(int p_value); - - bool public_servers_selected = true; - - ~Lobby(); + Lobby(AOApplication *p_ao_app); + + void set_widgets(); + void list_servers(); + void list_favorites(); + void append_chatmessage(QString f_name, QString f_message); + void append_error(QString f_message); + void set_player_count(int players_online, int max_players); + void set_stylesheet(QWidget *widget, QString target_tag); + void set_stylesheets(); + void set_fonts(); + void set_font(QWidget *widget, QString p_identifier); + void set_loading_text(QString p_text); + void show_loading_overlay() { ui_loading_background->show(); } + void hide_loading_overlay() { ui_loading_background->hide(); } + QString get_chatlog(); + int get_selected_server(); + void enable_connect_button(); + + void set_loading_value(int p_value); + + bool public_servers_selected = true; + + ~Lobby(); private: - AOApplication *ao_app; + AOApplication *ao_app; - AOImage *ui_background; + AOImage *ui_background; - AOButton *ui_public_servers; - AOButton *ui_favorites; + AOButton *ui_public_servers; + AOButton *ui_favorites; - AOButton *ui_refresh; - AOButton *ui_add_to_fav; - AOButton *ui_connect; + AOButton *ui_refresh; + AOButton *ui_add_to_fav; + AOButton *ui_connect; - QLabel *ui_version; - AOButton *ui_about; + QLabel *ui_version; + AOButton *ui_about; - AOButton *ui_settings; + AOButton *ui_settings; - QTreeWidget *ui_server_list; - QLineEdit *ui_server_search; + QTreeWidget *ui_server_list; + QLineEdit *ui_server_search; - QLabel *ui_player_count; - AOTextArea *ui_description; + QLabel *ui_player_count; + AOTextArea *ui_description; - AOTextArea *ui_chatbox; + AOTextArea *ui_chatbox; - QLineEdit *ui_chatname; - QLineEdit *ui_chatmessage; + QLineEdit *ui_chatname; + QLineEdit *ui_chatmessage; - AOImage *ui_loading_background; - QTextEdit *ui_loading_text; - QProgressBar *ui_progress_bar; - AOButton *ui_cancel; + AOImage *ui_loading_background; + QTextEdit *ui_loading_text; + QProgressBar *ui_progress_bar; + AOButton *ui_cancel; - int last_index; + int last_index; - void set_size_and_pos(QWidget *p_widget, QString p_identifier); + void set_size_and_pos(QWidget *p_widget, QString p_identifier); private slots: - void on_public_servers_clicked(); - void on_favorites_clicked(); - - void on_refresh_pressed(); - void on_refresh_released(); - void on_add_to_fav_pressed(); - void on_add_to_fav_released(); - void on_connect_pressed(); - void on_connect_released(); - void on_about_clicked(); - void on_settings_clicked(); - void on_server_list_clicked(QTreeWidgetItem* p_item, int column); - void on_server_list_doubleclicked(QTreeWidgetItem* p_item, int column); - void on_server_search_edited(QString p_text); - void on_chatfield_return_pressed(); + void on_public_servers_clicked(); + void on_favorites_clicked(); + + void on_refresh_pressed(); + void on_refresh_released(); + void on_add_to_fav_pressed(); + void on_add_to_fav_released(); + void on_connect_pressed(); + void on_connect_released(); + void on_about_clicked(); + void on_settings_clicked(); + void on_server_list_clicked(QTreeWidgetItem *p_item, int column); + void on_server_list_doubleclicked(QTreeWidgetItem *p_item, int column); + void on_server_search_edited(QString p_text); + void on_chatfield_return_pressed(); }; #endif // LOBBY_H diff --git a/include/misc_functions.h b/include/misc_functions.h index 026c6353..5287bee8 100644 --- a/include/misc_functions.h +++ b/include/misc_functions.h @@ -1,8 +1,8 @@ #ifndef MISC_FUNCTIONS_H #define MISC_FUNCTIONS_H -#include #include +#include void delay(int p_milliseconds); diff --git a/include/networkmanager.h b/include/networkmanager.h index 08b10db8..4d9d401d 100644 --- a/include/networkmanager.h +++ b/include/networkmanager.h @@ -14,71 +14,70 @@ #undef MS_FAILOVER_SUPPORTED #endif -#include "aopacket.h" #include "aoapplication.h" +#include "aopacket.h" -#include #include +#include #include #include #include -class NetworkManager : public QObject -{ - Q_OBJECT +class NetworkManager : public QObject { + Q_OBJECT public: - NetworkManager(AOApplication *parent); - ~NetworkManager(); + NetworkManager(AOApplication *parent); + ~NetworkManager(); - AOApplication *ao_app; - QTcpSocket *ms_socket; - QTcpSocket *server_socket; - QDnsLookup *ms_dns; - QTimer *ms_reconnect_timer; + AOApplication *ao_app; + QTcpSocket *ms_socket; + QTcpSocket *server_socket; + QDnsLookup *ms_dns; + QTimer *ms_reconnect_timer; - const QString ms_srv_hostname = "_aoms._tcp.aceattorneyonline.com"; + const QString ms_srv_hostname = "_aoms._tcp.aceattorneyonline.com"; #ifdef LOCAL_MS - QString ms_nosrv_hostname = "localhost"; + QString ms_nosrv_hostname = "localhost"; #else - QString ms_nosrv_hostname = "master.aceattorneyonline.com"; + QString ms_nosrv_hostname = "master.aceattorneyonline.com"; #endif - const quint16 ms_port = 27016; - const int timeout_milliseconds = 2000; + const quint16 ms_port = 27016; + const int timeout_milliseconds = 2000; - // in seconds - const int ms_reconnect_delay = 7; + // in seconds + const int ms_reconnect_delay = 7; - bool ms_partial_packet = false; - QString ms_temp_packet = ""; + bool ms_partial_packet = false; + QString ms_temp_packet = ""; - bool partial_packet = false; - QString temp_packet = ""; + bool partial_packet = false; + QString temp_packet = ""; - unsigned int s_decryptor = 5; + unsigned int s_decryptor = 5; - void connect_to_master(); - void connect_to_master_nosrv(); - void connect_to_server(server_type p_server); + void connect_to_master(); + void connect_to_master_nosrv(); + void connect_to_server(server_type p_server); public slots: - void ship_ms_packet(QString p_packet); - void ship_server_packet(QString p_packet); + void ship_ms_packet(QString p_packet); + void ship_server_packet(QString p_packet); signals: - void ms_connect_finished(bool success, bool will_retry); + void ms_connect_finished(bool success, bool will_retry); private: - void perform_srv_lookup(); + void perform_srv_lookup(); private slots: - void on_srv_lookup(); - void handle_ms_packet(); - void handle_server_packet(); - void on_ms_nosrv_connect_success(); - void on_ms_socket_error(QAbstractSocket::SocketError error); - void retry_ms_connect(); + void on_srv_lookup(); + void handle_ms_packet(); + void handle_server_packet(); + void on_ms_nosrv_connect_success(); + void on_ms_socket_error(QAbstractSocket::SocketError error); + void retry_ms_connect(); }; #endif // NETWORKMANAGER_H diff --git a/include/scrolltext.h b/include/scrolltext.h index cf791c03..1455762f 100644 --- a/include/scrolltext.h +++ b/include/scrolltext.h @@ -1,15 +1,13 @@ #ifndef SCROLLTEXT_H #define SCROLLTEXT_H -#include +#include +#include #include #include -#include -#include - +#include -class ScrollText : public QWidget -{ +class ScrollText : public QWidget { Q_OBJECT Q_PROPERTY(QString text READ text WRITE setText) Q_PROPERTY(QString separator READ separator WRITE setSeparator) @@ -24,7 +22,6 @@ public slots: QString separator() const; void setSeparator(QString separator); - protected: virtual void paintEvent(QPaintEvent *); virtual void resizeEvent(QResizeEvent *); diff --git a/include/text_file_functions.h b/include/text_file_functions.h index 119f38e2..1da4d925 100644 --- a/include/text_file_functions.h +++ b/include/text_file_functions.h @@ -3,11 +3,11 @@ #include "aoapplication.h" #include "file_functions.h" -#include -#include -#include -#include #include +#include #include +#include +#include +#include #endif // TEXT_FILE_FUNCTIONS_H diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 6213acd6..4d2bb31d 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -1,176 +1,166 @@ #include "aoapplication.h" -#include "lobby.h" #include "courtroom.h" -#include "networkmanager.h" #include "debug_functions.h" +#include "lobby.h" +#include "networkmanager.h" -#include "aooptionsdialog.h" #include "aocaseannouncerdialog.h" +#include "aooptionsdialog.h" AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv) { - // Create the QSettings class that points to the config.ini. - configini = new QSettings(get_base_path() + "config.ini", QSettings::IniFormat); + // Create the QSettings class that points to the config.ini. + configini = new QSettings(get_base_path() + "config.ini", QSettings::IniFormat); - net_manager = new NetworkManager(this); - discord = new AttorneyOnline::Discord(); - QObject::connect(net_manager, SIGNAL(ms_connect_finished(bool, bool)), - SLOT(ms_connect_finished(bool, bool))); + net_manager = new NetworkManager(this); + discord = new AttorneyOnline::Discord(); + QObject::connect(net_manager, SIGNAL(ms_connect_finished(bool, bool)), + SLOT(ms_connect_finished(bool, bool))); } AOApplication::~AOApplication() { - destruct_lobby(); - destruct_courtroom(); - delete discord; + destruct_lobby(); + destruct_courtroom(); + delete discord; } void AOApplication::construct_lobby() { - if (lobby_constructed) - { - qDebug() << "W: lobby was attempted constructed when it already exists"; - return; - } + if (lobby_constructed) { + qDebug() << "W: lobby was attempted constructed when it already exists"; + return; + } - w_lobby = new Lobby(this); - lobby_constructed = true; + w_lobby = new Lobby(this); + lobby_constructed = true; - QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width()-w_lobby->width()) / 2; - int y = (geometry.height()-w_lobby->height()) / 2; - w_lobby->move(x, y); + QRect geometry = QGuiApplication::primaryScreen()->geometry(); + 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()) - discord->state_lobby(); + if (is_discord_enabled()) + discord->state_lobby(); - w_lobby->show(); + w_lobby->show(); } void AOApplication::destruct_lobby() { - if(!lobby_constructed) - { - qDebug() << "W: lobby was attempted destructed when it did not exist"; - return; - } + if (!lobby_constructed) { + qDebug() << "W: lobby was attempted destructed when it did not exist"; + return; + } - delete w_lobby; - w_lobby = nullptr; - lobby_constructed = false; + delete w_lobby; + w_lobby = nullptr; + lobby_constructed = false; } void AOApplication::construct_courtroom() { - if (courtroom_constructed) - { - qDebug() << "W: courtroom was attempted constructed when it already exists"; - return; - } + if (courtroom_constructed) { + qDebug() << "W: courtroom was attempted constructed when it already exists"; + return; + } - w_courtroom = new Courtroom(this); - courtroom_constructed = true; + w_courtroom = new Courtroom(this); + courtroom_constructed = true; - QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width()-w_courtroom->width()) / 2; - int y = (geometry.height()-w_courtroom->height()) / 2; - w_courtroom->move(x, y); + QRect geometry = QGuiApplication::primaryScreen()->geometry(); + 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) - { - qDebug() << "W: courtroom was attempted destructed when it did not exist"; - return; - } + if (!courtroom_constructed) { + qDebug() << "W: courtroom was attempted destructed when it did not exist"; + return; + } - delete w_courtroom; - w_courtroom = nullptr; - courtroom_constructed = false; + delete w_courtroom; + w_courtroom = nullptr; + courtroom_constructed = false; } 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(); + current_theme = read_theme(); } void AOApplication::set_favorite_list() { - favorite_list = read_serverlist_txt(); + favorite_list = read_serverlist_txt(); } QString AOApplication::get_current_char() { - if (courtroom_constructed) - return w_courtroom->get_current_char(); - else - return ""; + if (courtroom_constructed) + return w_courtroom->get_current_char(); + else + return ""; } void AOApplication::add_favorite_server(int p_server) { - if (p_server < 0 || p_server >= server_list.size()) - return; + if (p_server < 0 || p_server >= server_list.size()) + return; - server_type fav_server = server_list.at(p_server); + server_type fav_server = server_list.at(p_server); - QString str_port = QString::number(fav_server.port); + QString str_port = QString::number(fav_server.port); - QString server_line = fav_server.ip + ":" + str_port + ":" + fav_server.name; + QString server_line = fav_server.ip + ":" + str_port + ":" + fav_server.name; - write_to_serverlist_txt(server_line); + write_to_serverlist_txt(server_line); } void AOApplication::server_disconnected() { - if (courtroom_constructed) - { - call_notice(tr("Disconnected from server.")); - construct_lobby(); - destruct_courtroom(); - } + if (courtroom_constructed) { + call_notice(tr("Disconnected from server.")); + construct_lobby(); + destruct_courtroom(); + } } void AOApplication::loading_cancelled() { - destruct_courtroom(); + destruct_courtroom(); - w_lobby->hide_loading_overlay(); + w_lobby->hide_loading_overlay(); } void AOApplication::ms_connect_finished(bool connected, bool will_retry) { - if (connected) - { - AOPacket *f_packet = new AOPacket("ALL#%"); - send_ms_packet(f_packet); - } - 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))); + if (connected) { + AOPacket *f_packet = new AOPacket("ALL#%"); + send_ms_packet(f_packet); } - 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.")); + 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))); + } + 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.")); + } } - } } void AOApplication::call_settings_menu() diff --git a/src/aoblipplayer.cpp b/src/aoblipplayer.cpp index 008ff16a..957fd559 100644 --- a/src/aoblipplayer.cpp +++ b/src/aoblipplayer.cpp @@ -3,122 +3,115 @@ #if defined(BASSAUDIO) //Using bass.dll for the blips AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } void AOBlipPlayer::set_blips(QString p_sfx) { - QString f_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx)); + QString f_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx)); - for (int n_stream = 0 ; n_stream < 5 ; ++n_stream) - { - BASS_StreamFree(m_stream_list[n_stream]); + for (int n_stream = 0; n_stream < 5; ++n_stream) { + BASS_StreamFree(m_stream_list[n_stream]); - if (f_path.endsWith(".opus")) - m_stream_list[n_stream] = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); - else - m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); - } + if (f_path.endsWith(".opus")) + m_stream_list[n_stream] = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); + else + m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); + } - set_volume_internal(m_volume); + set_volume_internal(m_volume); } void AOBlipPlayer::blip_tick() { - if (delay.isValid() && delay.elapsed() < max_blip_ms) - return; + if (delay.isValid() && delay.elapsed() < max_blip_ms) + return; - delay.start(); - int f_cycle = m_cycle++; + delay.start(); + int f_cycle = m_cycle++; - if (m_cycle == 5) - m_cycle = 0; + if (m_cycle == 5) + m_cycle = 0; - HSTREAM f_stream = m_stream_list[f_cycle]; - if (ao_app->get_audio_output_device() != "default") - BASS_ChannelSetDevice(f_stream, BASS_GetDevice()); - BASS_ChannelPlay(f_stream, false); + HSTREAM f_stream = m_stream_list[f_cycle]; + if (ao_app->get_audio_output_device() != "default") + BASS_ChannelSetDevice(f_stream, BASS_GetDevice()); + BASS_ChannelPlay(f_stream, false); } void AOBlipPlayer::set_volume(qreal p_value) { - m_volume = p_value / 100; - set_volume_internal(m_volume); + m_volume = p_value / 100; + set_volume_internal(m_volume); } void AOBlipPlayer::set_volume_internal(qreal p_value) { - float volume = static_cast(p_value); + float volume = static_cast(p_value); - for (int n_stream = 0 ; n_stream < 5 ; ++n_stream) - { - BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); - } + 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 AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } void AOBlipPlayer::set_blips(QString p_sfx) { - QString f_path = ao_app->get_sounds_path(p_sfx); + QString f_path = ao_app->get_sounds_path(p_sfx); - for (int n_stream = 0 ; n_stream < 5 ; ++n_stream) - { - m_blips.setSource(QUrl::fromLocalFile(f_path)); - } + for (int n_stream = 0; n_stream < 5; ++n_stream) { + m_blips.setSource(QUrl::fromLocalFile(f_path)); + } - set_volume_internal(m_volume); + set_volume_internal(m_volume); } void AOBlipPlayer::blip_tick() { - int f_cycle = m_cycle++; + int f_cycle = m_cycle++; - if (m_cycle == 5) - m_cycle = 0; + if (m_cycle == 5) + m_cycle = 0; - m_blips.play(); + m_blips.play(); } void AOBlipPlayer::set_volume(qreal p_value) { - m_volume = p_value / 100; - set_volume_internal(m_volume); + m_volume = p_value / 100; + set_volume_internal(m_volume); } void AOBlipPlayer::set_volume_internal(qreal p_value) { - m_blips.setVolume(m_volume); + 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; + m_parent = parent; + ao_app = p_ao_app; } void AOBlipPlayer::set_blips(QString p_sfx) { - } void AOBlipPlayer::blip_tick() { - } void AOBlipPlayer::set_volume(qreal p_value) { - } void AOBlipPlayer::set_volume_internal(qreal p_value) { - } #endif diff --git a/src/aobutton.cpp b/src/aobutton.cpp index 9efe13d0..05dedc16 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -5,32 +5,28 @@ AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) : QPushButton(parent) { - ao_app = p_ao_app; + ao_app = p_ao_app; } AOButton::~AOButton() { - } void AOButton::set_image(QString p_image) { - QString image_path = ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); - QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); + QString image_path = ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); + QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); - if (file_exists(image_path)) - { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } - else if (file_exists(default_image_path)) - { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + default_image_path + "\"); }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } - else - return; + if (file_exists(image_path)) { + this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); + } + else if (file_exists(default_image_path)) { + this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + default_image_path + "\"); }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); + } + else + return; } - diff --git a/src/aocaseannouncerdialog.cpp b/src/aocaseannouncerdialog.cpp index 5b82b64f..3063aa8a 100644 --- a/src/aocaseannouncerdialog.cpp +++ b/src/aocaseannouncerdialog.cpp @@ -1,82 +1,82 @@ #include "aocaseannouncerdialog.h" AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_ao_app, Courtroom *p_court) - : QDialog(parent) + : QDialog(parent) { - ao_app = p_ao_app; - court = p_court; + ao_app = p_ao_app; + court = p_court; - setWindowTitle(tr("Case Announcer")); - resize(405, 235); + setWindowTitle(tr("Case Announcer")); + resize(405, 235); - ui_announcer_buttons = new QDialogButtonBox(this); + ui_announcer_buttons = new QDialogButtonBox(this); - QSizePolicy sizepolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - sizepolicy.setHorizontalStretch(0); - sizepolicy.setVerticalStretch(0); - 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); + QSizePolicy sizepolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + sizepolicy.setHorizontalStretch(0); + sizepolicy.setVerticalStretch(0); + 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); - 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); + setUpdatesEnabled(false); - ui_vbox_layout = new QVBoxLayout(this); + 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->setContentsMargins(6, 6, 6, 6); + 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->setContentsMargins(6, 6, 6, 6); - ui_vbox_layout->addItem(ui_form_layout); - ui_vbox_layout->addWidget(ui_announcer_buttons); + ui_vbox_layout->addItem(ui_form_layout); + ui_vbox_layout->addWidget(ui_announcer_buttons); - ui_case_title_label = new QLabel(this); - ui_case_title_label->setText(tr("Case title:")); + ui_case_title_label = new QLabel(this); + ui_case_title_label->setText(tr("Case title:")); - ui_form_layout->setWidget(0, QFormLayout::LabelRole, ui_case_title_label); + ui_form_layout->setWidget(0, QFormLayout::LabelRole, ui_case_title_label); - ui_case_title_textbox = new QLineEdit(this); - ui_case_title_textbox->setMaxLength(50); + ui_case_title_textbox = new QLineEdit(this); + ui_case_title_textbox->setMaxLength(50); - ui_form_layout->setWidget(0, QFormLayout::FieldRole, ui_case_title_textbox); + ui_form_layout->setWidget(0, QFormLayout::FieldRole, ui_case_title_textbox); - ui_defense_needed = new QCheckBox(this); - ui_defense_needed->setText(tr("Defense needed")); - ui_prosecutor_needed = new QCheckBox(this); - ui_prosecutor_needed->setText(tr("Prosecution needed")); - ui_judge_needed = new QCheckBox(this); - ui_judge_needed->setText(tr("Judge needed")); - ui_juror_needed = new QCheckBox(this); - ui_juror_needed->setText(tr("Jurors needed")); - ui_steno_needed = new QCheckBox(this); - ui_steno_needed->setText(tr("Stenographer needed")); + ui_defense_needed = new QCheckBox(this); + ui_defense_needed->setText(tr("Defense needed")); + ui_prosecutor_needed = new QCheckBox(this); + ui_prosecutor_needed->setText(tr("Prosecution needed")); + ui_judge_needed = new QCheckBox(this); + ui_judge_needed->setText(tr("Judge needed")); + ui_juror_needed = new QCheckBox(this); + ui_juror_needed->setText(tr("Jurors needed")); + ui_steno_needed = new QCheckBox(this); + ui_steno_needed->setText(tr("Stenographer needed")); - ui_form_layout->setWidget(1, QFormLayout::FieldRole, ui_defense_needed); - ui_form_layout->setWidget(2, QFormLayout::FieldRole, ui_prosecutor_needed); - ui_form_layout->setWidget(3, QFormLayout::FieldRole, ui_judge_needed); - ui_form_layout->setWidget(4, QFormLayout::FieldRole, ui_juror_needed); - ui_form_layout->setWidget(5, QFormLayout::FieldRole, ui_steno_needed); + ui_form_layout->setWidget(1, QFormLayout::FieldRole, ui_defense_needed); + ui_form_layout->setWidget(2, QFormLayout::FieldRole, ui_prosecutor_needed); + ui_form_layout->setWidget(3, QFormLayout::FieldRole, ui_judge_needed); + ui_form_layout->setWidget(4, QFormLayout::FieldRole, ui_juror_needed); + ui_form_layout->setWidget(5, QFormLayout::FieldRole, ui_steno_needed); - setUpdatesEnabled(true); + setUpdatesEnabled(true); } 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()); - - done(0); + court->announce_case(ui_case_title_textbox->text(), + ui_defense_needed->isChecked(), + ui_prosecutor_needed->isChecked(), + ui_judge_needed->isChecked(), + ui_juror_needed->isChecked(), + ui_steno_needed->isChecked()); + + done(0); } void AOCaseAnnouncerDialog::cancel_pressed() { - done(0); + done(0); } diff --git a/src/aocharbutton.cpp b/src/aocharbutton.cpp index 6acad70b..d8c337d9 100644 --- a/src/aocharbutton.cpp +++ b/src/aocharbutton.cpp @@ -4,98 +4,92 @@ AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, bool is_taken) : QPushButton(parent) { - m_parent = parent; + m_parent = parent; - ao_app = p_ao_app; + ao_app = p_ao_app; - taken = is_taken; + taken = is_taken; - this->resize(60, 60); - this->move(x_pos, y_pos); + this->resize(60, 60); + this->move(x_pos, y_pos); - ui_taken = new AOImage(this, ao_app); - ui_taken->resize(60, 60); - ui_taken->set_image("char_taken"); - ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_taken->hide(); - - ui_passworded = new AOImage(this, ao_app); - ui_passworded->resize(60, 60); - ui_passworded->set_image("char_passworded"); - ui_passworded->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_passworded->hide(); + ui_taken = new AOImage(this, ao_app); + ui_taken->resize(60, 60); + ui_taken->set_image("char_taken"); + ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_taken->hide(); - ui_selector = new AOImage(parent, ao_app); - ui_selector->resize(62, 62); - ui_selector->move(x_pos - 1, y_pos - 1); - ui_selector->set_image("char_selector"); - ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_selector->hide(); + ui_passworded = new AOImage(this, ao_app); + ui_passworded->resize(60, 60); + ui_passworded->set_image("char_passworded"); + ui_passworded->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_passworded->hide(); + + ui_selector = new AOImage(parent, ao_app); + ui_selector->resize(62, 62); + ui_selector->move(x_pos - 1, y_pos - 1); + ui_selector->set_image("char_selector"); + ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_selector->hide(); } void AOCharButton::reset() { - ui_taken->hide(); - ui_passworded->hide(); - ui_selector->hide(); + ui_taken->hide(); + ui_passworded->hide(); + ui_selector->hide(); } void AOCharButton::set_taken(bool is_taken) { - taken = is_taken; + taken = is_taken; } void AOCharButton::apply_taken_image() { - if (taken) - { - ui_taken->move(0,0); - ui_taken->show(); - } - else - { - ui_taken->hide(); - } + if (taken) { + ui_taken->move(0, 0); + ui_taken->show(); + } + else { + ui_taken->hide(); + } } void AOCharButton::set_passworded() { - ui_passworded->show(); + ui_passworded->show(); } void AOCharButton::set_image(QString p_character) { - QString image_path = ao_app->get_static_image_suffix(ao_app->get_character_path(p_character, "char_icon")); - - this->setText(""); - - if (file_exists(image_path)) - { - this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } - else - { - this->setStyleSheet("QPushButton { border-image: url(); }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - this->setText(p_character); - } + QString image_path = ao_app->get_static_image_suffix(ao_app->get_character_path(p_character, "char_icon")); + + this->setText(""); + + if (file_exists(image_path)) { + this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); + } + else { + this->setStyleSheet("QPushButton { border-image: url(); }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); + 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(); - ui_selector->show(); + ui_selector->move(this->x() - 1, this->y() - 1); + ui_selector->raise(); + ui_selector->show(); - setFlat(false); - QPushButton::enterEvent(e); + setFlat(false); + QPushButton::enterEvent(e); } -void AOCharButton::leaveEvent(QEvent * e) +void AOCharButton::leaveEvent(QEvent *e) { - ui_selector->hide(); - QPushButton::leaveEvent(e); + ui_selector->hide(); + QPushButton::leaveEvent(e); } - - diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 7bbdc1bc..29632757 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -1,248 +1,230 @@ #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) { - ao_app = p_ao_app; - preanim_timer = new QTimer(this); - preanim_timer->setSingleShot(true); + ao_app = p_ao_app; + preanim_timer = new QTimer(this); + preanim_timer->setSingleShot(true); - ticker = new QTimer(this); - ticker->setTimerType(Qt::PreciseTimer); - ticker->setSingleShot(false); - connect(ticker, SIGNAL(timeout()), this, SLOT(movie_ticker())); + ticker = new QTimer(this); + ticker->setTimerType(Qt::PreciseTimer); + ticker->setSingleShot(false); + connect(ticker, SIGNAL(timeout()), this, SLOT(movie_ticker())); -// connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); - connect(preanim_timer, SIGNAL(timeout()), this, SLOT(preanim_done())); + // connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); + connect(preanim_timer, SIGNAL(timeout()), this, SLOT(preanim_done())); } void AOCharMovie::load_image(QString p_char, QString p_emote, QString emote_prefix) { #ifdef DEBUG_CHARMOVIE - actual_time.restart(); + actual_time.restart(); #endif - QString emote_path; - QList pathlist; - pathlist = { - ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)), //Default path - ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + "/" + p_emote)),//Path check if it's categorized into a folder - ao_app->get_character_path(p_char, p_emote + ".png"), //Non-animated path if emote_prefix fails - ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Theme placeholder path - ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")), //Default theme placeholder path - }; - - for (QString path : pathlist) - { - if (file_exists(path)) - { - emote_path = path; - break; - } - } - - this->clear(); - ticker->stop(); - preanim_timer->stop(); - movie_frames.clear(); - movie_delays.clear(); - movie_effects.clear(); - - if (!file_exists(emote_path)) - return; - - m_reader->setFileName(emote_path); - QPixmap f_pixmap = this->get_pixmap(m_reader->read()); - int f_delay = m_reader->nextImageDelay(); - - frame = 0; - max_frames = m_reader->imageCount(); - - this->set_frame(f_pixmap); - this->show(); - if (max_frames > 1) - { - movie_frames.append(f_pixmap); - movie_delays.append(f_delay); - } - - m_char = p_char; - m_emote = emote_prefix + p_emote; - - if (network_strings.size() > 0) //our FX overwritten by networked ones - this->load_network_effects(); - else //Use default ini FX - this->load_effects(); + QString emote_path; + QList pathlist; + pathlist = { + ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)), //Default path + ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + "/" + p_emote)), //Path check if it's categorized into a folder + ao_app->get_character_path(p_char, p_emote + ".png"), //Non-animated path if emote_prefix fails + ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Theme placeholder path + ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")), //Default theme placeholder path + }; + + for (QString path : pathlist) { + if (file_exists(path)) { + emote_path = path; + break; + } + } + + this->clear(); + ticker->stop(); + preanim_timer->stop(); + movie_frames.clear(); + movie_delays.clear(); + movie_effects.clear(); + + if (!file_exists(emote_path)) + return; + + m_reader->setFileName(emote_path); + QPixmap f_pixmap = this->get_pixmap(m_reader->read()); + int f_delay = m_reader->nextImageDelay(); + + frame = 0; + max_frames = m_reader->imageCount(); + + this->set_frame(f_pixmap); + this->show(); + if (max_frames > 1) { + movie_frames.append(f_pixmap); + movie_delays.append(f_delay); + } + + m_char = p_char; + m_emote = emote_prefix + p_emote; + + if (network_strings.size() > 0) //our FX overwritten by networked ones + this->load_network_effects(); + else //Use default ini FX + this->load_effects(); #ifdef DEBUG_CHARMOVIE - qDebug() << max_frames << "Setting image to " << emote_path << "Time taken to process image:" << actual_time.elapsed(); + qDebug() << max_frames << "Setting image to " << emote_path << "Time taken to process image:" << actual_time.elapsed(); - actual_time.restart(); + actual_time.restart(); #endif } void AOCharMovie::load_effects() { - movie_effects.clear(); - movie_effects.resize(max_frames); - for (int e_frame = 0; e_frame < max_frames; ++e_frame) - { - QString effect = ao_app->get_screenshake_frame(m_char, m_emote, e_frame); - if (effect != "") - { - movie_effects[e_frame].append("shake"); - } + movie_effects.clear(); + movie_effects.resize(max_frames); + for (int e_frame = 0; e_frame < max_frames; ++e_frame) { + QString effect = ao_app->get_screenshake_frame(m_char, m_emote, e_frame); + if (effect != "") { + movie_effects[e_frame].append("shake"); + } - effect = ao_app->get_flash_frame(m_char, m_emote, e_frame); - if (effect != "") - { - movie_effects[e_frame].append("flash"); - } + effect = ao_app->get_flash_frame(m_char, m_emote, e_frame); + if (effect != "") { + movie_effects[e_frame].append("flash"); + } - effect = ao_app->get_sfx_frame(m_char, m_emote, e_frame); - if (effect != "") - { - movie_effects[e_frame].append("sfx^"+effect); + effect = ao_app->get_sfx_frame(m_char, m_emote, e_frame); + if (effect != "") { + movie_effects[e_frame].append("sfx^" + effect); + } } - } } void AOCharMovie::load_network_effects() { - movie_effects.clear(); - movie_effects.resize(max_frames); - //Order is important!!! - QStringList effects_list = {"shake", "flash", "sfx^"}; - - //Determines which list is smaller - effects_list or network_strings - and uses it as basis for the loop. - //This way, incomplete network_strings would still be parsed, and excess/unaccounted for networked information is omitted. - int effects_size = qMin(effects_list.size(), network_strings.size()); - - for (int i = 0; i < effects_size; ++i) - { - QString netstring = network_strings.at(i); - QStringList emote_splits = netstring.split("^"); - foreach (QString emote, emote_splits) - { - QStringList parsed = emote.split("|"); - if (parsed.size() <= 0 || parsed.at(0) != m_emote) - continue; - foreach (QString frame_data, parsed) - { - QStringList frame_split = frame_data.split("="); - if (frame_split.size() <= 1) //We might still be hanging at the emote itself (entry 0). - continue; - int f_frame = frame_split.at(0).toInt(); - if (f_frame >= max_frames) - { - qDebug() << "Warning: out of bounds" << effects_list[i] << "frame" << f_frame << "out of" << max_frames << "for" << m_char << m_emote; - continue; - } - QString f_data = frame_split.at(1); - if (f_data != "") - { - QString effect = effects_list[i]; - if (effect == "sfx^") //Currently the only frame result that feeds us data, let's yank it in. - effect += f_data; - qDebug() << effect << f_data << "frame" << f_frame << "for" << m_char << m_emote; - movie_effects[f_frame].append(effect); + movie_effects.clear(); + movie_effects.resize(max_frames); + //Order is important!!! + QStringList effects_list = {"shake", "flash", "sfx^"}; + + //Determines which list is smaller - effects_list or network_strings - and uses it as basis for the loop. + //This way, incomplete network_strings would still be parsed, and excess/unaccounted for networked information is omitted. + int effects_size = qMin(effects_list.size(), network_strings.size()); + + for (int i = 0; i < effects_size; ++i) { + QString netstring = network_strings.at(i); + QStringList emote_splits = netstring.split("^"); + foreach (QString emote, emote_splits) { + QStringList parsed = emote.split("|"); + if (parsed.size() <= 0 || parsed.at(0) != m_emote) + continue; + foreach (QString frame_data, parsed) { + QStringList frame_split = frame_data.split("="); + if (frame_split.size() <= 1) //We might still be hanging at the emote itself (entry 0). + continue; + int f_frame = frame_split.at(0).toInt(); + if (f_frame >= max_frames) { + qDebug() << "Warning: out of bounds" << effects_list[i] << "frame" << f_frame << "out of" << max_frames << "for" << m_char << m_emote; + continue; + } + QString f_data = frame_split.at(1); + if (f_data != "") { + QString effect = effects_list[i]; + if (effect == "sfx^") //Currently the only frame result that feeds us data, let's yank it in. + effect += f_data; + qDebug() << effect << f_data << "frame" << f_frame << "for" << m_char << m_emote; + movie_effects[f_frame].append(effect); + } + } } - } } - } } void AOCharMovie::play() { - play_frame_effect(frame); - if (max_frames <= 1) - { - if (play_once) - ticker->start(60); - } - else - ticker->start(this->get_frame_delay(movie_delays[frame])); + play_frame_effect(frame); + if (max_frames <= 1) { + if (play_once) + ticker->start(60); + } + else + ticker->start(this->get_frame_delay(movie_delays[frame])); } void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) { - load_image(p_char, p_emote, ""); - //As much as I'd like to screw around with [Time] durations modifying the animation speed, I don't think I can reliably do that, - //not without looping through all frames in the image at least - which causes lag. So for now it simply ends the preanimation early instead. - play_once = true; - if (duration > 0) //It's -1 if there's no definition in [Time] for it. In which case, it will let the animation run out in full. Duration 0 does the same. - preanim_timer->start(duration * time_mod); //This timer will not fire if the animation finishes earlier than that - play(); + load_image(p_char, p_emote, ""); + //As much as I'd like to screw around with [Time] durations modifying the animation speed, I don't think I can reliably do that, + //not without looping through all frames in the image at least - which causes lag. So for now it simply ends the preanimation early instead. + play_once = true; + if (duration > 0) //It's -1 if there's no definition in [Time] for it. In which case, it will let the animation run out in full. Duration 0 does the same. + preanim_timer->start(duration * time_mod); //This timer will not fire if the animation finishes earlier than that + play(); } void AOCharMovie::play_talking(QString p_char, QString p_emote) { - play_once = false; - load_image(p_char, p_emote, "(b)"); - play(); + play_once = false; + load_image(p_char, p_emote, "(b)"); + play(); } void AOCharMovie::play_idle(QString p_char, QString p_emote) { - play_once = false; - load_image(p_char, p_emote, "(a)"); - play(); + play_once = false; + load_image(p_char, p_emote, "(a)"); + play(); } void AOCharMovie::play_frame_effect(int frame) { - if(frame < max_frames) - { - foreach (QString effect, movie_effects[frame]) - { - if(effect == "shake") - { - shake(); + if (frame < max_frames) { + foreach (QString effect, movie_effects[frame]) { + if (effect == "shake") { + shake(); #ifdef DEBUG_CHARMOVIE - qDebug() << "Attempting to play shake on frame" << frame; + qDebug() << "Attempting to play shake on frame" << frame; #endif - } + } - if(effect == "flash") - { - flash(); + if (effect == "flash") { + flash(); #ifdef DEBUG_CHARMOVIE - qDebug() << "Attempting to play flash on frame" << frame; + qDebug() << "Attempting to play flash on frame" << frame; #endif - } + } - if(effect.startsWith("sfx^")) - { - QString sfx = effect.section("^", 1); - play_sfx(sfx); + if (effect.startsWith("sfx^")) { + QString sfx = effect.section("^", 1); + play_sfx(sfx); #ifdef DEBUG_CHARMOVIE - qDebug() << "Attempting to play sfx" << sfx << "on frame" << frame; + qDebug() << "Attempting to play sfx" << sfx << "on frame" << frame; #endif - } + } + } } - } } 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 - ticker->stop(); - preanim_timer->stop(); - this->hide(); + //for all intents and purposes, stopping is the same as hiding. at no point do we want a frozen gif to display + ticker->stop(); + preanim_timer->stop(); + this->hide(); } QPixmap AOCharMovie::get_pixmap(QImage image) { QPixmap f_pixmap; - if(m_flipped) + if (m_flipped) f_pixmap = QPixmap::fromImage(image.mirrored(true, false)); else f_pixmap = QPixmap::fromImage(image); -// auto aspect_ratio = Qt::KeepAspectRatio; + // auto aspect_ratio = Qt::KeepAspectRatio; auto transform_mode = Qt::FastTransformation; if (f_pixmap.height() > f_h) //We are downscaling, use anti-aliasing. - transform_mode = Qt::SmoothTransformation; + transform_mode = Qt::SmoothTransformation; f_pixmap = f_pixmap.scaledToHeight(f_h, transform_mode); this->resize(f_pixmap.size()); @@ -253,64 +235,61 @@ QPixmap AOCharMovie::get_pixmap(QImage image) void AOCharMovie::set_frame(QPixmap f_pixmap) { this->setPixmap(f_pixmap); - QLabel::move(x + (f_w - f_pixmap.width())/2, y + (f_h - f_pixmap.height())); //Always center horizontally, always put at the bottom vertically + QLabel::move(x + (f_w - f_pixmap.width()) / 2, y + (f_h - f_pixmap.height())); //Always center horizontally, always put at the bottom vertically } void AOCharMovie::combo_resize(int w, int h) { - QSize f_size(w, h); - f_w = w; - f_h = h; - this->resize(f_size); + QSize f_size(w, h); + f_w = w; + f_h = h; + this->resize(f_size); } int AOCharMovie::get_frame_delay(int delay) { - return static_cast(double(delay) * double(speed/100)); + return static_cast(double(delay) * double(speed / 100)); } void AOCharMovie::move(int ax, int ay) { - x = ax; - y = ay; - QLabel::move(x, y); + x = ax; + y = ay; + QLabel::move(x, y); } void AOCharMovie::movie_ticker() { - ++frame; - if(frame >= max_frames) - { - if(play_once) - { - preanim_done(); - return; + ++frame; + if (frame >= max_frames) { + if (play_once) { + preanim_done(); + return; + } + else + frame = 0; + } + // qint64 difference = elapsed - movie_delays[frame]; + if (frame >= movie_frames.size()) { + m_reader->jumpToImage(frame); + movie_frames.resize(frame + 1); + movie_frames[frame] = this->get_pixmap(m_reader->read()); + movie_delays.resize(frame + 1); + movie_delays[frame] = m_reader->nextImageDelay(); } - else - frame = 0; - } -// qint64 difference = elapsed - movie_delays[frame]; - if(frame >= movie_frames.size()) - { - m_reader->jumpToImage(frame); - movie_frames.resize(frame + 1); - movie_frames[frame] = this->get_pixmap(m_reader->read()); - movie_delays.resize(frame + 1); - movie_delays[frame] = m_reader->nextImageDelay(); - } #ifdef DEBUG_CHARMOVIE - qDebug() << frame << movie_delays[frame] << "actual time taken from last frame:" << actual_time.restart(); + qDebug() << frame << movie_delays[frame] << "actual time taken from last frame:" << actual_time.restart(); #endif - this->set_frame(movie_frames[frame]); - play_frame_effect(frame); - ticker->setInterval(this->get_frame_delay(movie_delays[frame])); + this->set_frame(movie_frames[frame]); + play_frame_effect(frame); + ticker->setInterval(this->get_frame_delay(movie_delays[frame])); } void AOCharMovie::preanim_done() { - ticker->stop(); - preanim_timer->stop(); - done(); + ticker->stop(); + preanim_timer->stop(); + done(); } diff --git a/src/aoemotebutton.cpp b/src/aoemotebutton.cpp index e42bb73c..991451f8 100644 --- a/src/aoemotebutton.cpp +++ b/src/aoemotebutton.cpp @@ -4,40 +4,38 @@ AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, int p_w, int p_h) : QPushButton(p_parent) { - parent = p_parent; - ao_app = p_ao_app; + parent = p_parent; + ao_app = p_ao_app; - this->move(p_x, p_y); - this->resize(p_w, p_h); + this->move(p_x, p_y); + this->resize(p_w, p_h); - connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); + connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); } void AOEmoteButton::set_image(QString p_image, QString p_emote_comment) { - if (file_exists(p_image)) - { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + p_image + "\") 0 0 0 0 stretch stretch; }" - "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); - } - else - { - this->setText(p_emote_comment); - this->setStyleSheet("QPushButton { border-image: url(); }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } + if (file_exists(p_image)) { + this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + p_image + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); + } + else { + this->setText(p_emote_comment); + this->setStyleSheet("QPushButton { border-image: url(); }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); + } } void AOEmoteButton::set_char_image(QString p_char, int p_emote, QString suffix) { - QString emotion_number = QString::number(p_emote + 1); - QString image_path = ao_app->get_static_image_suffix(ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix)); + QString emotion_number = QString::number(p_emote + 1); + QString image_path = ao_app->get_static_image_suffix(ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix)); - this->set_image(image_path, ao_app->get_emote_comment(p_char, p_emote)); + this->set_image(image_path, ao_app->get_emote_comment(p_char, p_emote)); } void AOEmoteButton::on_clicked() { - emote_clicked(m_id); + emote_clicked(m_id); } diff --git a/src/aoevidencebutton.cpp b/src/aoevidencebutton.cpp index 61847f2d..596374b2 100644 --- a/src/aoevidencebutton.cpp +++ b/src/aoevidencebutton.cpp @@ -4,85 +4,82 @@ AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, int p_w, int p_h) : QPushButton(p_parent) { - ao_app = p_ao_app; - m_parent = p_parent; - - ui_selected = new AOImage(this, ao_app); - ui_selected->resize(p_w, p_h); -// ui_selected->move(p_x, p_y); - ui_selected->set_image("evidence_selected"); - ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_selected->hide(); - - ui_selector = new AOImage(this, ao_app); - ui_selector->resize(p_w, p_h); -// ui_selector->move(p_x - 1, p_y - 1); - ui_selector->set_image("evidence_selector"); - ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_selector->hide(); - - this->move(p_x, p_y); - this->resize(p_w, p_h); -// this->setAcceptDrops(true); - - connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); + ao_app = p_ao_app; + m_parent = p_parent; + + ui_selected = new AOImage(this, ao_app); + ui_selected->resize(p_w, p_h); + // ui_selected->move(p_x, p_y); + ui_selected->set_image("evidence_selected"); + ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_selected->hide(); + + ui_selector = new AOImage(this, ao_app); + ui_selector->resize(p_w, p_h); + // ui_selector->move(p_x - 1, p_y - 1); + ui_selector->set_image("evidence_selector"); + ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_selector->hide(); + + this->move(p_x, p_y); + this->resize(p_w, p_h); + // this->setAcceptDrops(true); + + connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); } void AOEvidenceButton::set_image(QString p_image) { - QString image_path = ao_app->get_evidence_path(p_image); - if (file_exists(p_image)) - { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + p_image + "\") 0 0 0 0 stretch stretch; }" - "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); - } - else if (file_exists(image_path)) - { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" - "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); - } - else - { - this->setText(p_image); - this->setStyleSheet("QPushButton { border-image: url(); }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } + QString image_path = ao_app->get_evidence_path(p_image); + if (file_exists(p_image)) { + this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + p_image + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); + } + else if (file_exists(image_path)) { + this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); + } + else { + this->setText(p_image); + this->setStyleSheet("QPushButton { border-image: url(); }" + "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); + } } void AOEvidenceButton::set_theme_image(QString p_image) { - QString theme_image_path = ao_app->get_theme_path(p_image); - QString default_image_path = ao_app->get_default_theme_path(p_image); + QString theme_image_path = ao_app->get_theme_path(p_image); + QString default_image_path = ao_app->get_default_theme_path(p_image); - QString final_image_path; + QString final_image_path; - if (file_exists(theme_image_path)) - final_image_path = theme_image_path; - else - final_image_path = default_image_path; + if (file_exists(theme_image_path)) + final_image_path = theme_image_path; + else + final_image_path = default_image_path; - this->set_image(final_image_path); + this->set_image(final_image_path); } void AOEvidenceButton::set_selected(bool p_selected) { - if (p_selected) - ui_selected->show(); - else - ui_selected->hide(); + if (p_selected) + ui_selected->show(); + else + ui_selected->hide(); } void AOEvidenceButton::on_clicked() { - evidence_clicked(m_id); + evidence_clicked(m_id); } void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e) { - QPushButton::mouseDoubleClickEvent(e); - evidence_double_clicked(m_id); + QPushButton::mouseDoubleClickEvent(e); + evidence_double_clicked(m_id); } /* @@ -101,20 +98,20 @@ void AOEvidenceButton::dragEnterEvent(QMouseEvent *e) } */ -void AOEvidenceButton::enterEvent(QEvent * e) +void AOEvidenceButton::enterEvent(QEvent *e) { - ui_selector->show(); + ui_selector->show(); - on_hover(m_id, true); + on_hover(m_id, true); - setFlat(false); - QPushButton::enterEvent(e); + setFlat(false); + QPushButton::enterEvent(e); } -void AOEvidenceButton::leaveEvent(QEvent * e) +void AOEvidenceButton::leaveEvent(QEvent *e) { - ui_selector->hide(); + ui_selector->hide(); - on_hover(m_id, false); - QPushButton::leaveEvent(e); + on_hover(m_id, false); + QPushButton::leaveEvent(e); } diff --git a/src/aoevidencedisplay.cpp b/src/aoevidencedisplay.cpp index 904568ab..22f57205 100644 --- a/src/aoevidencedisplay.cpp +++ b/src/aoevidencedisplay.cpp @@ -1,77 +1,74 @@ #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) { - ao_app = p_ao_app; - evidence_icon = new QLabel(this); - sfx_player = new AOSfxPlayer(this, ao_app); + ao_app = p_ao_app; + evidence_icon = new QLabel(this); + sfx_player = new AOSfxPlayer(this, ao_app); - evidence_movie = new AOMovie(this, ao_app); + evidence_movie = new AOMovie(this, ao_app); - connect(evidence_movie, SIGNAL(done()), this, SLOT(show_done())); + connect(evidence_movie, SIGNAL(done()), this, SLOT(show_done())); } void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_side, int p_volume) { - this->reset(); + this->reset(); - sfx_player->set_volume(p_volume); + sfx_player->set_volume(p_volume); - QString final_gif_path; - QString gif_name; - QString icon_identifier; + QString final_gif_path; + QString gif_name; + QString icon_identifier; - if (is_left_side) - { - icon_identifier = "left_evidence_icon"; - gif_name = "evidence_appear_left"; - } - else - { - icon_identifier = "right_evidence_icon"; - gif_name = "evidence_appear_right"; - } + if (is_left_side) { + icon_identifier = "left_evidence_icon"; + gif_name = "evidence_appear_left"; + } + else { + icon_identifier = "right_evidence_icon"; + gif_name = "evidence_appear_right"; + } - QString f_evidence_path = ao_app->get_evidence_path(p_evidence_image); - QPixmap f_pixmap(f_evidence_path); + QString f_evidence_path = ao_app->get_evidence_path(p_evidence_image); + QPixmap f_pixmap(f_evidence_path); - 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"); - f_pixmap = f_pixmap.scaled(icon_dimensions.width, icon_dimensions.height); - evidence_icon->setPixmap(f_pixmap); - evidence_icon->resize(f_pixmap.size()); - evidence_icon->move(icon_dimensions.x, icon_dimensions.y); + f_pixmap = f_pixmap.scaled(icon_dimensions.width, icon_dimensions.height); + evidence_icon->setPixmap(f_pixmap); + evidence_icon->resize(f_pixmap.size()); + evidence_icon->move(icon_dimensions.x, icon_dimensions.y); - evidence_movie->play(gif_name); - sfx_player->play(ao_app->get_sfx("evidence_present")); + evidence_movie->play(gif_name); + sfx_player->play(ao_app->get_sfx("evidence_present")); } void AOEvidenceDisplay::reset() { - sfx_player->stop(); - evidence_movie->stop(); - evidence_icon->hide(); - this->clear(); + sfx_player->stop(); + evidence_movie->stop(); + evidence_icon->hide(); + this->clear(); } void AOEvidenceDisplay::show_done() { - evidence_icon->show(); + evidence_icon->show(); } -QLabel* AOEvidenceDisplay::get_evidence_icon() +QLabel *AOEvidenceDisplay::get_evidence_icon() { - return evidence_icon; + return evidence_icon; } void AOEvidenceDisplay::combo_resize(int w, int h) { - QSize f_size(w, h); - this->resize(f_size); - evidence_movie->combo_resize(w, h); + QSize f_size(w, h); + this->resize(f_size); + evidence_movie->combo_resize(w, h); } - diff --git a/src/aoimage.cpp b/src/aoimage.cpp index 17c2ea61..e1c01e55 100644 --- a/src/aoimage.cpp +++ b/src/aoimage.cpp @@ -4,49 +4,46 @@ AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } AOImage::~AOImage() { - } bool AOImage::set_image(QString p_image) { - QString theme_image_path = ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); - QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); + QString theme_image_path = ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); + QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); - QString final_image_path; + QString final_image_path; - if (file_exists(theme_image_path)) - final_image_path = theme_image_path; - else if (file_exists(default_image_path)) - final_image_path = default_image_path; - else - { - qDebug() << "Warning: Image" << p_image << "not found! Can't set!"; - return false; - } + if (file_exists(theme_image_path)) + final_image_path = theme_image_path; + else if (file_exists(default_image_path)) + final_image_path = default_image_path; + else { + qDebug() << "Warning: Image" << p_image << "not found! Can't set!"; + return false; + } - QPixmap f_pixmap(final_image_path); + QPixmap f_pixmap(final_image_path); - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); - return true; + this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + return true; } bool AOImage::set_chatbox(QString p_path) { - p_path = ao_app->get_static_image_suffix(p_path); - if (!file_exists(p_path)) - { - qDebug() << "Warning: Chatbox" << p_path << "not found! Can't set!"; - return false; - } + p_path = ao_app->get_static_image_suffix(p_path); + if (!file_exists(p_path)) { + qDebug() << "Warning: Chatbox" << p_path << "not found! Can't set!"; + return false; + } - QPixmap f_pixmap(p_path); + QPixmap f_pixmap(p_path); - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); - return true; + this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + return true; } diff --git a/src/aolineedit.cpp b/src/aolineedit.cpp index 1c141c33..ce851a0d 100644 --- a/src/aolineedit.cpp +++ b/src/aolineedit.cpp @@ -6,15 +6,15 @@ AOLineEdit::AOLineEdit(QWidget *parent) : QLineEdit(parent) void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e) { - QLineEdit::mouseDoubleClickEvent(e); + QLineEdit::mouseDoubleClickEvent(e); - double_clicked(); + double_clicked(); } void AOLineEdit::focusOutEvent(QFocusEvent *ev) { - int start = selectionStart(); - int len = selectionEnd() - start; //We're not using selectionLength because Linux build doesn't run qt5.10 - QLineEdit::focusOutEvent(ev); - if (p_selection && start != -1 && len != -1) - this->setSelection(start, len); + int start = selectionStart(); + int len = selectionEnd() - start; //We're not using selectionLength because Linux build doesn't run qt5.10 + QLineEdit::focusOutEvent(ev); + if (p_selection && start != -1 && len != -1) + this->setSelection(start, len); } diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 561f5efe..7e3bbae0 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -1,96 +1,93 @@ #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) { - ao_app = p_ao_app; + ao_app = p_ao_app; - m_movie = new QMovie(); + m_movie = new QMovie(); - this->setMovie(m_movie); + this->setMovie(m_movie); - timer = new QTimer(this); - timer->setTimerType(Qt::PreciseTimer); - timer->setSingleShot(true); + 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())); + 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; + play_once = p_play_once; } void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int duration) { - m_movie->stop(); - - QString shout_path = p_image; - if (!file_exists(p_image)) - { - QList pathlist; - - pathlist = { - ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image)), //Character folder - ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image), //Misc path - ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path - ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path - ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //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->stop(); + + QString shout_path = p_image; + if (!file_exists(p_image)) { + QList pathlist; + + pathlist = { + ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image)), //Character folder + ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image), //Misc path + ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path + ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path + ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //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); + m_movie->setFileName(shout_path); - if (m_movie->loopCount() == 0) - play_once = true; + if (m_movie->loopCount() == 0) + play_once = true; - this->show(); - m_movie->start(); - if (m_movie->frameCount() == 0 && duration > 0) - timer->start(duration); + this->show(); + m_movie->start(); + if (m_movie->frameCount() == 0 && duration > 0) + timer->start(duration); } void AOMovie::stop() { - m_movie->stop(); - this->hide(); + 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()); + //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(); - //signal connected to courtroom object, let it figure out what to do - done(); + this->stop(); + //signal connected to courtroom object, let it figure out what to do + done(); } void AOMovie::combo_resize(int w, int h) { - QSize f_size(w, h); - this->resize(f_size); - m_movie->setScaledSize(f_size); + 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 9a96b3eb..77222e1d 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -3,108 +3,102 @@ #ifdef BASSAUDIO AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } AOMusicPlayer::~AOMusicPlayer() { - for (int n_stream = 0 ; n_stream < m_channelmax ; ++n_stream) - { - BASS_ChannelStop(m_stream_list[n_stream]); - } + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + BASS_ChannelStop(m_stream_list[n_stream]); + } } void AOMusicPlayer::play(QString p_song, int channel, bool loop, int effect_flags) { - channel = channel % m_channelmax; - if (channel < 0) //wtf? - return; - QString f_path = ao_app->get_music_path(p_song); - - unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE; - if (loop) - flags |= BASS_SAMPLE_LOOP; - - DWORD newstream; - if (f_path.endsWith(".opus")) - newstream = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); - else - newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); - - if (ao_app->get_audio_output_device() != "default") - BASS_ChannelSetDevice(m_stream_list[channel], BASS_GetDevice()); - - QString d_path = f_path + ".txt"; - - loop_start = 0; - loop_end = BASS_ChannelGetLength(newstream, BASS_POS_BYTE); - if (loop && file_exists(d_path)) //Contains loop/etc. information file - { - QStringList lines = ao_app->read_file(d_path).split("\n"); - foreach (QString line, lines) - { - QStringList args = line.split("="); - if (args.size() < 2) - continue; - QString arg = args[0].trimmed(); - - float sample_rate; - BASS_ChannelGetAttribute(newstream, BASS_ATTRIB_FREQ, &sample_rate); - - //Grab number of bytes for sample size - int sample_size = 16/8; - - //number of channels (stereo/mono) - int num_channels = 2; - - //Calculate the bytes for loop_start/loop_end to use with the sync proc - QWORD bytes = static_cast(args[1].trimmed().toFloat() * sample_size * num_channels); - if (arg == "loop_start") - loop_start = bytes; - else if (arg == "loop_length") - loop_end = loop_start + bytes; - else if (arg == "loop_end") - loop_end = bytes; - } - qDebug() << "Found data file for song" << p_song << "length" << BASS_ChannelGetLength(newstream, BASS_POS_BYTE) << "loop start" << loop_start << "loop end" << loop_end; - } + channel = channel % m_channelmax; + if (channel < 0) //wtf? + return; + QString f_path = ao_app->get_music_path(p_song); + + unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE; + if (loop) + flags |= BASS_SAMPLE_LOOP; + + DWORD newstream; + if (f_path.endsWith(".opus")) + newstream = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); + else + newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); - if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING) - { - DWORD oldstream = m_stream_list[channel]; + if (ao_app->get_audio_output_device() != "default") + BASS_ChannelSetDevice(m_stream_list[channel], BASS_GetDevice()); - if (effect_flags & SYNC_POS) + QString d_path = f_path + ".txt"; + + loop_start = 0; + loop_end = BASS_ChannelGetLength(newstream, BASS_POS_BYTE); + if (loop && file_exists(d_path)) //Contains loop/etc. information file { - BASS_ChannelLock(oldstream, true); - //Sync it with the new sample - BASS_ChannelSetPosition(newstream, BASS_ChannelGetPosition(oldstream, BASS_POS_BYTE), BASS_POS_BYTE); - BASS_ChannelLock(oldstream, false); + QStringList lines = ao_app->read_file(d_path).split("\n"); + foreach (QString line, lines) { + QStringList args = line.split("="); + if (args.size() < 2) + continue; + QString arg = args[0].trimmed(); + + float sample_rate; + BASS_ChannelGetAttribute(newstream, BASS_ATTRIB_FREQ, &sample_rate); + + //Grab number of bytes for sample size + int sample_size = 16 / 8; + + //number of channels (stereo/mono) + int num_channels = 2; + + //Calculate the bytes for loop_start/loop_end to use with the sync proc + QWORD bytes = static_cast(args[1].trimmed().toFloat() * sample_size * num_channels); + if (arg == "loop_start") + loop_start = bytes; + else if (arg == "loop_length") + loop_end = loop_start + bytes; + else if (arg == "loop_end") + loop_end = bytes; + } + qDebug() << "Found data file for song" << p_song << "length" << BASS_ChannelGetLength(newstream, BASS_POS_BYTE) << "loop start" << loop_start << "loop end" << loop_end; } - if (effect_flags & FADE_OUT) - { - //Fade out the other sample and stop it (due to -1) - BASS_ChannelSlideAttribute(oldstream, BASS_ATTRIB_VOL|BASS_SLIDE_LOG, -1, 4000); + if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING) { + DWORD oldstream = m_stream_list[channel]; + + if (effect_flags & SYNC_POS) { + BASS_ChannelLock(oldstream, true); + //Sync it with the new sample + BASS_ChannelSetPosition(newstream, BASS_ChannelGetPosition(oldstream, BASS_POS_BYTE), BASS_POS_BYTE); + BASS_ChannelLock(oldstream, false); + } + + if (effect_flags & FADE_OUT) { + //Fade out the other sample and stop it (due to -1) + BASS_ChannelSlideAttribute(oldstream, BASS_ATTRIB_VOL | BASS_SLIDE_LOG, -1, 4000); + } + else + BASS_ChannelStop(oldstream); //Stop the sample since we don't need it anymore } else - BASS_ChannelStop(oldstream); //Stop the sample since we don't need it anymore - } - else - BASS_ChannelStop(m_stream_list[channel]); + BASS_ChannelStop(m_stream_list[channel]); + + m_stream_list[channel] = newstream; + BASS_ChannelPlay(m_stream_list[channel], false); + if (effect_flags & FADE_IN) { + //Fade in our sample + BASS_ChannelSetAttribute(newstream, BASS_ATTRIB_VOL, 0); + BASS_ChannelSlideAttribute(newstream, BASS_ATTRIB_VOL, static_cast(m_volume[channel] / 100.0f), 1000); + } + else + this->set_volume(m_volume[channel], channel); - m_stream_list[channel] = newstream; - BASS_ChannelPlay(m_stream_list[channel], false); - if (effect_flags & FADE_IN) - { - //Fade in our sample - BASS_ChannelSetAttribute(newstream, BASS_ATTRIB_VOL, 0); - BASS_ChannelSlideAttribute(newstream, BASS_ATTRIB_VOL, static_cast(m_volume[channel] / 100.0f), 1000); - } - else - this->set_volume(m_volume[channel], channel); - - this->set_looping(loop); //Have to do this here due to any crossfading-related changes, etc. + this->set_looping(loop); //Have to do this here due to any crossfading-related changes, etc. } void AOMusicPlayer::stop(int channel) @@ -114,105 +108,95 @@ void AOMusicPlayer::stop(int channel) void AOMusicPlayer::set_volume(int p_value, int channel) { - m_volume[channel] = p_value; - float volume = m_volume[channel] / 100.0f; - if (channel < 0) - { - for (int n_stream = 0 ; n_stream < m_channelmax ; ++n_stream) - { - BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); + m_volume[channel] = p_value; + float volume = m_volume[channel] / 100.0f; + if (channel < 0) { + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); + } + } + else { + BASS_ChannelSetAttribute(m_stream_list[channel], BASS_ATTRIB_VOL, volume); } - } - else - { - BASS_ChannelSetAttribute(m_stream_list[channel], BASS_ATTRIB_VOL, volume); - } } void CALLBACK loopProc(HSYNC handle, DWORD channel, DWORD data, void *user) { - QWORD loop_start = *(static_cast(user)); - BASS_ChannelLock(channel, true); - BASS_ChannelSetPosition(channel, loop_start, BASS_POS_BYTE); - BASS_ChannelLock(channel, false); + QWORD loop_start = *(static_cast(user)); + BASS_ChannelLock(channel, true); + BASS_ChannelSetPosition(channel, loop_start, BASS_POS_BYTE); + BASS_ChannelLock(channel, false); } void AOMusicPlayer::set_looping(bool toggle, int channel) { - m_looping = toggle; - if (!m_looping) - { - if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) - BASS_ChannelFlags(m_stream_list[channel], 0, BASS_SAMPLE_LOOP); // remove the LOOP flag - BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]); - loop_sync[channel] = 0; - } - else - { - BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag - if (loop_sync[channel] != 0) - { - BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]); //remove the sync - loop_sync[channel] = 0; + m_looping = toggle; + if (!m_looping) { + if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) + BASS_ChannelFlags(m_stream_list[channel], 0, BASS_SAMPLE_LOOP); // remove the LOOP flag + BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]); + loop_sync[channel] = 0; } - if (loop_start > 0) - { - if (loop_end == 0) - loop_end = BASS_ChannelGetLength(m_stream_list[channel], BASS_POS_BYTE); - if (loop_end > 0) //Don't loop zero length songs even if we're asked to - loop_sync[channel] = BASS_ChannelSetSync(m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end, loopProc, &loop_start); + else { + BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag + if (loop_sync[channel] != 0) { + BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]); //remove the sync + loop_sync[channel] = 0; + } + if (loop_start > 0) { + if (loop_end == 0) + loop_end = BASS_ChannelGetLength(m_stream_list[channel], BASS_POS_BYTE); + if (loop_end > 0) //Don't loop zero length songs even if we're asked to + loop_sync[channel] = BASS_ChannelSetSync(m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end, loopProc, &loop_start); + } } - } } #elif defined(QTAUDIO) AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } AOMusicPlayer::~AOMusicPlayer() { - m_player.stop(); + m_player.stop(); } void AOMusicPlayer::play(QString p_song) { - m_player.stop(); + m_player.stop(); - QString f_path = ao_app->get_music_path(p_song); + QString f_path = ao_app->get_music_path(p_song); - m_player.setMedia(QUrl::fromLocalFile(f_path)); + m_player.setMedia(QUrl::fromLocalFile(f_path)); - this->set_volume(m_volume); + this->set_volume(m_volume); - m_player.play(); + m_player.play(); } void AOMusicPlayer::set_volume(int p_value) { - m_volume = p_value; - m_player.setVolume(m_volume); + m_volume = p_value; + m_player.setVolume(m_volume); } #else AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } AOMusicPlayer::~AOMusicPlayer() { - } void AOMusicPlayer::play(QString p_song) { - } void AOMusicPlayer::set_volume(int p_value) { - } #endif diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index cfaaa20f..06df7a56 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -43,8 +43,8 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_form_layout_widget->setSizePolicy(sizePolicy1); 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->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->setSpacing(2); @@ -61,13 +61,12 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi // 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()) - { + 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_theme_combobox->setCurrentIndex(ui_theme_combobox->count() - 1); } ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_theme_combobox); @@ -158,7 +157,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_ms_lbl); - QSettings* configini = ao_app->configini; + QSettings *configini = ao_app->configini; ui_ms_textbox = new QLineEdit(ui_form_layout_widget); ui_ms_textbox->setText(configini->value("master", "").value()); @@ -292,7 +291,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi 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_layout->setContentsMargins(0, 0, 0, 0); ui_callwords_textbox = new QPlainTextEdit(ui_callwords_widget); QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); @@ -323,8 +322,8 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi 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->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); row = 0; @@ -338,28 +337,24 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi // Let's fill out the combobox with the available audio devices. Or don't if there is no audio int a = 0; - if (needs_default_audiodev()) - { + if (needs_default_audiodev()) { ui_audio_device_combobox->addItem("default"); - } - #ifdef BASSAUDIO +#ifdef BASSAUDIO BASS_DEVICEINFO info; - for (a = 0; BASS_GetDeviceInfo(a, &info); a++) - { + for (a = 0; BASS_GetDeviceInfo(a, &info); a++) { ui_audio_device_combobox->addItem(info.name); if (p_ao_app->get_audio_output_device() == info.name) - ui_audio_device_combobox->setCurrentIndex(ui_audio_device_combobox->count()-1); + ui_audio_device_combobox->setCurrentIndex(ui_audio_device_combobox->count() - 1); } - #elif defined QTAUDIO - foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) - { +#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); + ui_audio_device_combobox->setCurrentIndex(ui_audio_device_combobox->count() - 1); } - #endif +#endif ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_audio_device_combobox); row += 1; @@ -429,7 +424,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate()); ui_bliprate_spinbox->setMinimum(1); ui_bliprate_spinbox->setToolTip(tr("Play a blip sound \"once per every X symbols\", where " - "X is the blip rate.")); + "X is the blip rate.")); ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_bliprate_spinbox); @@ -475,11 +470,11 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi ui_settings_tabs->addTab(ui_casing_tab, tr("Casing")); ui_casing_widget = new QWidget(ui_casing_tab); - ui_casing_widget->setGeometry(QRect(10,10, 361, 211)); + ui_casing_widget->setGeometry(QRect(10, 10, 361, 211)); ui_casing_layout = new QFormLayout(ui_casing_widget); - ui_casing_layout->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); - ui_casing_layout->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); + ui_casing_layout->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); row = 0; @@ -487,9 +482,9 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi 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.")); + 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->setText(tr("This server does not support case alerts.")); ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory.")); ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_supported_lbl); @@ -621,7 +616,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi void AOOptionsDialog::save_pressed() { // Save everything into the config.ini. - QSettings* configini = ao_app->configini; + QSettings *configini = ao_app->configini; configini->setValue("theme", ui_theme_combobox->currentText()); configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked()); @@ -639,11 +634,9 @@ void AOOptionsDialog::save_pressed() configini->setValue("stickyeffects", ui_stickyeffects_cb->isChecked()); configini->setValue("stickypres", ui_stickypres_cb->isChecked()); + QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); - QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); - - if (callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) - { + if (callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) { QTextStream out(callwordsini); out << ui_callwords_textbox->toPlainText(); callwordsini->close(); @@ -676,12 +669,12 @@ void AOOptionsDialog::discard_pressed() done(0); } -#if (defined (_WIN32) || defined (_WIN64)) +#if (defined(_WIN32) || defined(_WIN64)) bool AOOptionsDialog::needs_default_audiodev() { return true; } -#elif (defined (LINUX) || defined (__linux__)) +#elif (defined(LINUX) || defined(__linux__)) bool AOOptionsDialog::needs_default_audiodev() { return false; diff --git a/src/aopacket.cpp b/src/aopacket.cpp index b957efea..457cc65c 100644 --- a/src/aopacket.cpp +++ b/src/aopacket.cpp @@ -4,80 +4,73 @@ AOPacket::AOPacket(QString p_packet_string) { - QStringList packet_contents = p_packet_string.split("#"); + QStringList packet_contents = p_packet_string.split("#"); - m_header = packet_contents.at(0); + m_header = packet_contents.at(0); - for(int n_string = 1 ; n_string < packet_contents.size() - 1 ; ++n_string) - { - m_contents.append(packet_contents.at(n_string)); - } + for (int n_string = 1; n_string < packet_contents.size() - 1; ++n_string) { + m_contents.append(packet_contents.at(n_string)); + } } AOPacket::AOPacket(QString p_header, QStringList &p_contents) { - m_header = p_header; - m_contents = p_contents; + m_header = p_header; + m_contents = p_contents; } AOPacket::~AOPacket() { - } QString AOPacket::to_string() { - QString f_string = m_header; - - for (QString i_string : m_contents) - { - f_string += ("#" + i_string); - } + QString f_string = m_header; - f_string += "#%"; + for (QString i_string : m_contents) { + f_string += ("#" + i_string); + } + f_string += "#%"; - if (encrypted) - return "#" + f_string; - else - return f_string; + if (encrypted) + return "#" + f_string; + else + return f_string; } void AOPacket::encrypt_header(unsigned int p_key) { - m_header = fanta_encrypt(m_header, p_key); + m_header = fanta_encrypt(m_header, p_key); - encrypted = true; + encrypted = true; } void AOPacket::decrypt_header(unsigned int p_key) { - m_header = fanta_decrypt(m_header, p_key); + m_header = fanta_decrypt(m_header, p_key); - encrypted = false; + encrypted = false; } void AOPacket::net_encode() { - 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("&", ""); - - m_contents.removeAt(n_element); - m_contents.insert(n_element, f_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("&", ""); + + m_contents.removeAt(n_element); + m_contents.insert(n_element, f_element); + } } void AOPacket::net_decode() { - 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("", "&"); - - m_contents.removeAt(n_element); - m_contents.insert(n_element, f_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("", "&"); + m_contents.removeAt(n_element); + m_contents.insert(n_element, f_element); + } +} diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 575a27df..64f741a4 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -4,123 +4,119 @@ 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 = ""; + 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_image_suffix(ao_app->get_background_path(p_image)); - if (!file_exists(background_path)) //If image is missing, clear current image - { + QString background_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); + if (!file_exists(background_path)) //If image is missing, clear current image + { + this->clear(); + this->setMovie(nullptr); + + m_movie->stop(); + last_image = ""; + return; + } + + if (file_exists(background_path) && background_path == last_image) + return; + this->clear(); this->setMovie(nullptr); m_movie->stop(); - last_image = ""; - return; - } - - if (file_exists(background_path) && background_path == last_image) - return; - - this->clear(); - this->setMovie(nullptr); - - m_movie->stop(); - m_movie->setFileName(background_path); - - if (m_movie->isValid() && m_movie->frameCount() > 1) - { - m_movie->jumpToNextFrame(); - float scale_factor = static_cast(f_h) / static_cast(m_movie->frameRect().height()); - //preserve aspect ratio - int n_w = static_cast(m_movie->frameRect().width() * scale_factor); - int n_h = static_cast(m_movie->frameRect().height() * scale_factor); - - m_movie->setScaledSize(QSize(n_w, n_h)); - this->resize(m_movie->scaledSize()); - this->setMovie(m_movie); - QLabel::move(x + (f_w - n_w)/2, y + (f_h - n_h)/2); //Center - m_movie->start(); - } - else - { - QPixmap background(background_path); - auto transform_mode = Qt::FastTransformation; - if (background.height() > f_h) //We are downscaling, use anti-aliasing. - transform_mode = Qt::SmoothTransformation; - - background = background.scaledToHeight(f_h, transform_mode); - this->resize(background.size()); - this->setPixmap(background); - QLabel::move(x + (f_w - background.width())/2, y + (f_h - background.height())/2); //Always center horizontally, always center vertically - } - last_image = background_path; + m_movie->setFileName(background_path); + + if (m_movie->isValid() && m_movie->frameCount() > 1) { + m_movie->jumpToNextFrame(); + float scale_factor = static_cast(f_h) / static_cast(m_movie->frameRect().height()); + //preserve aspect ratio + int n_w = static_cast(m_movie->frameRect().width() * scale_factor); + int n_h = static_cast(m_movie->frameRect().height() * scale_factor); + + m_movie->setScaledSize(QSize(n_w, n_h)); + this->resize(m_movie->scaledSize()); + this->setMovie(m_movie); + QLabel::move(x + (f_w - n_w) / 2, y + (f_h - n_h) / 2); //Center + m_movie->start(); + } + else { + QPixmap background(background_path); + auto transform_mode = Qt::FastTransformation; + if (background.height() > f_h) //We are downscaling, use anti-aliasing. + transform_mode = Qt::SmoothTransformation; + + background = background.scaledToHeight(f_h, transform_mode); + this->resize(background.size()); + this->setPixmap(background); + QLabel::move(x + (f_w - background.width()) / 2, y + (f_h - background.height()) / 2); //Always center horizontally, always center vertically + } + last_image = background_path; } void AOScene::set_legacy_desk(QString p_image) { - QString desk_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); - if (!file_exists(desk_path)) //If image is missing, clear current image - { - this->clear(); - this->setMovie(nullptr); - - m_movie->stop(); - last_image = ""; - return; - } - - if (file_exists(desk_path) && desk_path == last_image) - return; + QString desk_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); + if (!file_exists(desk_path)) //If image is missing, clear current image + { + this->clear(); + this->setMovie(nullptr); - QPixmap f_desk(desk_path); + m_movie->stop(); + last_image = ""; + return; + } - //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(); + if (file_exists(desk_path) && desk_path == last_image) + return; - double h_modifier = vp_height / 192; + QPixmap f_desk(desk_path); - int final_h = static_cast(h_modifier * f_desk.height()); + //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(); - this->clear(); - this->setMovie(nullptr); + double h_modifier = vp_height / 192; - m_movie->stop(); - m_movie->setFileName(desk_path); + int final_h = static_cast(h_modifier * f_desk.height()); - m_movie->setScaledSize(QSize(vp_width, final_h)); + this->clear(); + this->setMovie(nullptr); - if (m_movie->isValid() && m_movie->frameCount() > 1) - { - 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; + m_movie->stop(); + m_movie->setFileName(desk_path); + + m_movie->setScaledSize(QSize(vp_width, final_h)); + + if (m_movie->isValid() && m_movie->frameCount() > 1) { + 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; } void AOScene::combo_resize(int w, int h) { - QSize f_size(w, h); - f_w = w; - f_h = h; - this->resize(f_size); + QSize f_size(w, h); + f_w = w; + f_h = h; + this->resize(f_size); } void AOScene::move(int ax, int ay) { - x = ax; - y = ay; - QLabel::move(x, y); + x = ax; + y = ay; + QLabel::move(x, y); } diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index 9fa3026f..4b375a46 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -4,190 +4,178 @@ #if defined(BASSAUDIO) //Using bass.dll for sfx AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } void AOSfxPlayer::clear() { - for (int n_stream = 0 ; n_stream < m_channelmax ; ++n_stream) - { - BASS_ChannelStop(m_stream_list[n_stream]); - } - set_volume_internal(m_volume); + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + BASS_ChannelStop(m_stream_list[n_stream]); + } + set_volume_internal(m_volume); } void AOSfxPlayer::loop_clear() { - for (int n_stream = 0 ; n_stream < m_channelmax ; ++n_stream) - { - if((BASS_ChannelFlags(m_stream_list[n_stream], 0, 0)&BASS_SAMPLE_LOOP)) - BASS_ChannelStop(m_stream_list[n_stream]); - } - set_volume_internal(m_volume); + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + if ((BASS_ChannelFlags(m_stream_list[n_stream], 0, 0) & BASS_SAMPLE_LOOP)) + BASS_ChannelStop(m_stream_list[n_stream]); + } + set_volume_internal(m_volume); } void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, int channel) { - if (channel == -1) - { - if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING) - m_channel = (m_channel + 1) % m_channelmax; - channel = m_channel; - } + if (channel == -1) { + if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING) + m_channel = (m_channel + 1) % m_channelmax; + channel = m_channel; + } + + BASS_ChannelStop(m_stream_list[channel]); - BASS_ChannelStop(m_stream_list[channel]); - - QString misc_path = ""; - QString char_path = ""; - QString sound_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx)); + QString misc_path = ""; + QString char_path = ""; + QString sound_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx)); - if (shout != "") - misc_path = ao_app->get_sfx_suffix(ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx); - if (p_char != "") - char_path = ao_app->get_sfx_suffix(ao_app->get_character_path(p_char, p_sfx)); + if (shout != "") + misc_path = ao_app->get_sfx_suffix(ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx); + if (p_char != "") + char_path = ao_app->get_sfx_suffix(ao_app->get_character_path(p_char, p_sfx)); - QString f_path; + QString f_path; - if (file_exists(char_path)) - f_path = char_path; - else if (file_exists(misc_path)) - f_path = misc_path; - else - f_path = sound_path; + if (file_exists(char_path)) + f_path = char_path; + else if (file_exists(misc_path)) + f_path = misc_path; + else + f_path = sound_path; - if (f_path.endsWith(".opus")) - m_stream_list[channel] = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); - else - m_stream_list[channel] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + if (f_path.endsWith(".opus")) + m_stream_list[channel] = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + else + m_stream_list[channel] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); - set_volume_internal(m_volume); + set_volume_internal(m_volume); - if (ao_app->get_audio_output_device() != "default") - BASS_ChannelSetDevice(m_stream_list[m_channel], BASS_GetDevice()); - BASS_ChannelPlay(m_stream_list[m_channel], false); + if (ao_app->get_audio_output_device() != "default") + BASS_ChannelSetDevice(m_stream_list[m_channel], BASS_GetDevice()); + BASS_ChannelPlay(m_stream_list[m_channel], false); } void AOSfxPlayer::stop(int channel) { - if (channel == -1) - { - channel = m_channel; - } - BASS_ChannelStop(m_stream_list[channel]); + if (channel == -1) { + channel = m_channel; + } + BASS_ChannelStop(m_stream_list[channel]); } void AOSfxPlayer::set_volume(qreal p_value) { - m_volume = p_value / 100; - set_volume_internal(m_volume); + m_volume = p_value / 100; + set_volume_internal(m_volume); } void AOSfxPlayer::set_volume_internal(qreal p_value) { float volume = static_cast(p_value); - for (int n_stream = 0 ; n_stream < m_channelmax ; ++n_stream) - { - BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); } } void AOSfxPlayer::set_looping(bool toggle, int channel) { - if (channel == -1) - { - channel = m_channel; - } - m_looping = toggle; - if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) - { - if (m_looping == false) - BASS_ChannelFlags(m_stream_list[channel], 0, BASS_SAMPLE_LOOP); // remove the LOOP flag - } - else - { - if (m_looping == true) - BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag - } + if (channel == -1) { + channel = m_channel; + } + m_looping = toggle; + if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) { + if (m_looping == false) + BASS_ChannelFlags(m_stream_list[channel], 0, BASS_SAMPLE_LOOP); // remove the LOOP flag + } + else { + if (m_looping == true) + BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag + } } #elif defined(QTAUDIO) //Using Qt's QSoundEffect class AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) { - m_sfx.stop(); + m_sfx.stop(); - QString misc_path = ""; - QString char_path = ""; - QString sound_path = ao_app->get_sounds_path(p_sfx); + QString misc_path = ""; + QString char_path = ""; + QString sound_path = ao_app->get_sounds_path(p_sfx); - if (shout != "") - misc_path = ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx; - if (p_char != "") - char_path = ao_app->get_character_path(p_char, p_sfx); + if (shout != "") + misc_path = ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx; + if (p_char != "") + char_path = ao_app->get_character_path(p_char, p_sfx); - QString f_path; + QString f_path; - if (file_exists(char_path)) - f_path = char_path; - else if (file_exists(misc_path)) - f_path = misc_path; - else - f_path = sound_path; + if (file_exists(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 - { - m_sfx.setSource(QUrl::fromLocalFile(f_path)); + if (file_exists(f_path)) //if its missing, it will glitch out + { + 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::stop() { - m_sfx.stop(); + m_sfx.stop(); } void AOSfxPlayer::set_volume(qreal p_value) { - m_volume = p_value/100; - set_volume_internal(m_volume); + m_volume = p_value / 100; + set_volume_internal(m_volume); } void AOSfxPlayer::set_volume_internal(qreal p_value) { - m_sfx.setVolume(m_volume); + m_sfx.setVolume(m_volume); } #else AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) { - } void AOSfxPlayer::stop() { - } void AOSfxPlayer::set_volume(qreal p_value) { - } void AOSfxPlayer::set_volume_internal(qreal p_value) { - } #endif diff --git a/src/aotextarea.cpp b/src/aotextarea.cpp index a34bb1a6..524f3283 100644 --- a/src/aotextarea.cpp +++ b/src/aotextarea.cpp @@ -2,65 +2,62 @@ AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) { - } void AOTextArea::append_linked(QString p_message) { - QString result = p_message.toHtmlEscaped().replace("\n", "
").replace(url_parser_regex, "\\1" ); - this->insertHtml(result); + QString result = p_message.toHtmlEscaped().replace("\n", "
").replace(url_parser_regex, "\\1"); + this->insertHtml(result); } void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p_colour) { - const QTextCursor old_cursor = this->textCursor(); - const int old_scrollbar_value = this->verticalScrollBar()->value(); - const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum(); + const QTextCursor old_cursor = this->textCursor(); + const int old_scrollbar_value = this->verticalScrollBar()->value(); + const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum(); - this->moveCursor(QTextCursor::End); + this->moveCursor(QTextCursor::End); - this->append(""); - this->insertHtml("" + p_name.toHtmlEscaped() + ": "); + this->append(""); + this->insertHtml("" + p_name.toHtmlEscaped() + ": "); - //cheap workarounds ahoy - p_message += " "; - QString result = p_message.toHtmlEscaped().replace("\n", "
").replace(url_parser_regex, "\\1" ); + //cheap workarounds ahoy + p_message += " "; + QString result = p_message.toHtmlEscaped().replace("\n", "
").replace(url_parser_regex, "\\1"); - this->insertHtml(result); + this->insertHtml(result); - this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down); + this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down); } 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 QTextCursor old_cursor = this->textCursor(); + const int old_scrollbar_value = this->verticalScrollBar()->value(); + const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum(); - this->moveCursor(QTextCursor::End); + this->moveCursor(QTextCursor::End); - this->append(""); + this->append(""); - p_message += " "; - QString result = p_message.replace("\n", "
").replace(url_parser_regex, "\\1" ); + p_message += " "; + QString result = p_message.replace("\n", "
").replace(url_parser_regex, "\\1"); - this->insertHtml("" + result + ""); + this->insertHtml("" + result + ""); - this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down); + 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) { - 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()); - } + 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()); + } } diff --git a/src/aotextedit.cpp b/src/aotextedit.cpp index 30e48b73..0dc5cb4f 100644 --- a/src/aotextedit.cpp +++ b/src/aotextedit.cpp @@ -2,20 +2,19 @@ AOTextEdit::AOTextEdit(QWidget *parent) : QPlainTextEdit(parent) { - this->setReadOnly(true); + 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) { - QPlainTextEdit::mouseDoubleClickEvent(e); + QPlainTextEdit::mouseDoubleClickEvent(e); - this->setReadOnly(false); + this->setReadOnly(false); } void AOTextEdit::on_enter_pressed() { - this->setReadOnly(true); + this->setReadOnly(true); } - diff --git a/src/charselect.cpp b/src/charselect.cpp index 6739a1e3..65758690 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -1,145 +1,139 @@ #include "courtroom.h" #include "lobby.h" -#include "file_functions.h" #include "debug_functions.h" +#include "file_functions.h" #include "hardware_functions.h" void Courtroom::construct_char_select() { - ui_char_select_background = new AOImage(this, ao_app); + ui_char_select_background = new AOImage(this, ao_app); - ui_char_buttons = new QWidget(ui_char_select_background); + ui_char_buttons = new QWidget(ui_char_select_background); - ui_selector = new AOImage(ui_char_select_background, ao_app); - ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_selector->resize(62, 62); + ui_selector = new AOImage(ui_char_select_background, ao_app); + ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_selector->resize(62, 62); - ui_back_to_lobby = new AOButton(ui_char_select_background, ao_app); + ui_back_to_lobby = new AOButton(ui_char_select_background, ao_app); - ui_char_password = new QLineEdit(ui_char_select_background); - ui_char_password->setPlaceholderText(tr("Password")); + ui_char_password = new QLineEdit(ui_char_select_background); + ui_char_password->setPlaceholderText(tr("Password")); - ui_char_select_left = new AOButton(ui_char_select_background, ao_app); - ui_char_select_right = new AOButton(ui_char_select_background, ao_app); + ui_char_select_left = new AOButton(ui_char_select_background, ao_app); + ui_char_select_right = new AOButton(ui_char_select_background, ao_app); - ui_spectator = new AOButton(ui_char_select_background, ao_app); - ui_spectator->setText(tr("Spectator")); + ui_spectator = new AOButton(ui_char_select_background, ao_app); + ui_spectator->setText(tr("Spectator")); - ui_char_search = new QLineEdit(ui_char_select_background); - ui_char_search->setPlaceholderText(tr("Search")); - ui_char_search->setFocus(); - set_size_and_pos(ui_char_search, "char_search"); + ui_char_search = new QLineEdit(ui_char_select_background); + ui_char_search->setPlaceholderText(tr("Search")); + ui_char_search->setFocus(); + set_size_and_pos(ui_char_search, "char_search"); - ui_char_passworded = new QCheckBox(ui_char_select_background); - ui_char_passworded->setText(tr("Passworded")); - set_size_and_pos(ui_char_passworded, "char_passworded"); + ui_char_passworded = new QCheckBox(ui_char_select_background); + ui_char_passworded->setText(tr("Passworded")); + set_size_and_pos(ui_char_passworded, "char_passworded"); - ui_char_taken = new QCheckBox(ui_char_select_background); - ui_char_taken->setText(tr("Taken")); - set_size_and_pos(ui_char_taken, "char_taken"); + ui_char_taken = new QCheckBox(ui_char_select_background); + ui_char_taken->setText(tr("Taken")); + set_size_and_pos(ui_char_taken, "char_taken"); - ui_char_taken->setChecked(true); - ui_char_passworded->setChecked(true); + ui_char_taken->setChecked(true); + ui_char_passworded->setChecked(true); - set_size_and_pos(ui_char_buttons, "char_buttons"); + set_size_and_pos(ui_char_buttons, "char_buttons"); - connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked())); + connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked())); - connect(ui_char_select_left, SIGNAL(clicked()), this, SLOT(on_char_select_left_clicked())); - connect(ui_char_select_right, SIGNAL(clicked()), this, SLOT(on_char_select_right_clicked())); + connect(ui_char_select_left, SIGNAL(clicked()), this, SLOT(on_char_select_left_clicked())); + connect(ui_char_select_right, SIGNAL(clicked()), this, SLOT(on_char_select_right_clicked())); - connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked())); + connect(ui_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"; + 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 char_select width or height in courtroom_design.ini!"; - this->resize(714, 668); - } - else - this->resize(f_charselect.width, f_charselect.height); + if (f_charselect.width < 0 || f_charselect.height < 0) { + qDebug() << "W: did not find char_select width or height in courtroom_design.ini!"; + this->resize(714, 668); + } + else + this->resize(f_charselect.width, f_charselect.height); - ui_char_select_background->resize(f_charselect.width, f_charselect.height); - ui_char_select_background->set_image("charselect_background"); + ui_char_select_background->resize(f_charselect.width, f_charselect.height); + ui_char_select_background->set_image("charselect_background"); - filter_character_list(); + filter_character_list(); - ui_char_search->setFocus(); + ui_char_search->setFocus(); } void Courtroom::set_char_select_page() { - ui_char_select_background->show(); + ui_char_select_background->show(); - ui_char_select_left->hide(); - ui_char_select_right->hide(); + ui_char_select_left->hide(); + ui_char_select_right->hide(); - for (AOCharButton *i_button : ui_char_button_list) - { - i_button->reset(); - i_button->hide(); - i_button->move(0,0); - } + for (AOCharButton *i_button : ui_char_button_list) { + i_button->reset(); + i_button->hide(); + i_button->move(0, 0); + } - int total_pages = ui_char_button_list_filtered.size() / max_chars_on_page; - int chars_on_page = 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) - { - ++total_pages; - //i. e. not on the last page - if (total_pages > current_char_page + 1) - chars_on_page = max_chars_on_page; + if (ui_char_button_list_filtered.size() % max_chars_on_page != 0) { + ++total_pages; + //i. e. not on the last page + if (total_pages > current_char_page + 1) + chars_on_page = max_chars_on_page; + else + chars_on_page = ui_char_button_list_filtered.size() % max_chars_on_page; + } else - chars_on_page = ui_char_button_list_filtered.size() % max_chars_on_page; + chars_on_page = max_chars_on_page; - } - else - chars_on_page = max_chars_on_page; - - if (total_pages > current_char_page + 1) - ui_char_select_right->show(); + if (total_pages > current_char_page + 1) + ui_char_select_right->show(); - if (current_char_page > 0) - ui_char_select_left->show(); + if (current_char_page > 0) + ui_char_select_left->show(); - put_button_in_place(current_char_page * max_chars_on_page, chars_on_page); + put_button_in_place(current_char_page * max_chars_on_page, chars_on_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; + qDebug() << "char_ini_path" << char_ini_path; - if (!file_exists(char_ini_path)) - { - call_notice("Could not find " + char_ini_path); - return; - } + if (!file_exists(char_ini_path)) { + call_notice("Could not find " + char_ini_path); + return; + } - if (n_char != m_cid) - { - 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 - update_character(n_char); + if (n_char != m_cid) { + 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 + update_character(n_char); - enter_courtroom(); + enter_courtroom(); - ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); + ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); } void Courtroom::put_button_in_place(int starting, int chars_on_this_page) @@ -161,22 +155,20 @@ void Courtroom::put_button_in_place(int starting, int chars_on_this_page) 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; - - 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; - - if (x_mod_count == char_columns) - { - ++y_mod_count; - x_mod_count = 0; - } + 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(); + + ++x_mod_count; + + if (x_mod_count == char_columns) { + ++y_mod_count; + x_mod_count = 0; + } } } @@ -184,9 +176,8 @@ 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) { + if (ui_char_button_list.size() > 0) { + foreach (AOCharButton *item, ui_char_button_list) { delete item; } ui_char_button_list.clear(); @@ -195,28 +186,26 @@ void Courtroom::character_loading_finished() // First, we'll make all the character buttons in the very beginning. // We also hide them all, so they can't be accidentally clicked. // Later on, we'll be revealing buttons as we need them. - for (int n = 0; n < char_list.size(); n++) - { - AOCharButton* char_button = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); - char_button->reset(); - char_button->hide(); - char_button->set_image(char_list.at(n).name); - ui_char_button_list.append(char_button); - - connect(char_button, &AOCharButton::clicked, [this, n](){ - this->char_clicked(n); - }); - - // This part here serves as a way of showing to the player that the game is still running, it is - // just loading the pictures of the characters. - if (ao_app->lobby_constructed) - { - ao_app->generated_chars++; - int total_loading_size = ao_app->char_list_size * 2 + ao_app->evidence_list_size + ao_app->music_list_size; - int loading_value = int(((ao_app->loaded_chars + ao_app->generated_chars + ao_app->loaded_music + ao_app->loaded_evidence) / static_cast(total_loading_size)) * 100); - ao_app->w_lobby->set_loading_value(loading_value); - ao_app->w_lobby->set_loading_text(tr("Generating chars:\n%1/%2").arg(QString::number(ao_app->generated_chars)).arg(QString::number(ao_app->char_list_size))); - } + for (int n = 0; n < char_list.size(); n++) { + AOCharButton *char_button = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); + char_button->reset(); + char_button->hide(); + char_button->set_image(char_list.at(n).name); + ui_char_button_list.append(char_button); + + connect(char_button, &AOCharButton::clicked, [this, n]() { + this->char_clicked(n); + }); + + // This part here serves as a way of showing to the player that the game is still running, it is + // just loading the pictures of the characters. + if (ao_app->lobby_constructed) { + ao_app->generated_chars++; + int total_loading_size = ao_app->char_list_size * 2 + ao_app->evidence_list_size + ao_app->music_list_size; + int loading_value = int(((ao_app->loaded_chars + ao_app->generated_chars + ao_app->loaded_music + ao_app->loaded_evidence) / static_cast(total_loading_size)) * 100); + ao_app->w_lobby->set_loading_value(loading_value); + ao_app->w_lobby->set_loading_text(tr("Generating chars:\n%1/%2").arg(QString::number(ao_app->generated_chars)).arg(QString::number(ao_app->char_list_size))); + } } filter_character_list(); @@ -225,28 +214,27 @@ void Courtroom::character_loading_finished() void Courtroom::filter_character_list() { ui_char_button_list_filtered.clear(); - for (int i = 0; i < char_list.size(); i++) - { - AOCharButton* current_char = ui_char_button_list.at(i); + for (int i = 0; i < char_list.size(); i++) { + AOCharButton *current_char = ui_char_button_list.at(i); - // It seems passwording characters is unimplemented yet? - // Until then, this will stay here, I suppose. - //if (ui_char_passworded->isChecked() && character_is_passworded??) - // continue; + // It seems passwording characters is unimplemented yet? + // Until then, this will stay here, I suppose. + //if (ui_char_passworded->isChecked() && character_is_passworded??) + // continue; - if (!ui_char_taken->isChecked() && char_list.at(i).taken) - continue; + if (!ui_char_taken->isChecked() && char_list.at(i).taken) + continue; - if (!char_list.at(i).name.contains(ui_char_search->text(), Qt::CaseInsensitive)) - continue; + if (!char_list.at(i).name.contains(ui_char_search->text(), Qt::CaseInsensitive)) + continue; - // We only really need to update the fact that a character is taken - // for the buttons that actually appear. - // You'd also update the passwordedness and etc. here later. - current_char->reset(); - current_char->set_taken(char_list.at(i).taken); + // We only really need to update the fact that a character is taken + // for the buttons that actually appear. + // You'd also update the passwordedness and etc. here later. + current_char->reset(); + current_char->set_taken(char_list.at(i).taken); - ui_char_button_list_filtered.append(current_char); + ui_char_button_list_filtered.append(current_char); } current_char_page = 0; diff --git a/src/chatlogpiece.cpp b/src/chatlogpiece.cpp index dafc3542..b0113de2 100644 --- a/src/chatlogpiece.cpp +++ b/src/chatlogpiece.cpp @@ -2,76 +2,76 @@ chatlogpiece::chatlogpiece() { - name = "UNKNOWN"; - showname = "UNKNOWN"; - message = "UNKNOWN"; - p_is_song = false; - datetime = QDateTime::currentDateTime().toUTC(); + name = "UNKNOWN"; + showname = "UNKNOWN"; + message = "UNKNOWN"; + p_is_song = false; + datetime = QDateTime::currentDateTime().toUTC(); } chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song) { - name = p_name; - showname = p_showname; - message = p_message; - p_is_song = p_song; - datetime = QDateTime::currentDateTime().toUTC(); + name = p_name; + showname = p_showname; + message = p_message; + p_is_song = p_song; + datetime = QDateTime::currentDateTime().toUTC(); } chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime) { - name = p_name; - showname = p_showname; - message = p_message; - p_is_song = p_song; - datetime = p_datetime.toUTC(); + name = p_name; + showname = p_showname; + message = p_message; + p_is_song = p_song; + datetime = p_datetime.toUTC(); } QString chatlogpiece::get_name() { - return name; + return name; } QString chatlogpiece::get_showname() { - return showname; + return showname; } QString chatlogpiece::get_message() { - return message; + return message; } QDateTime chatlogpiece::get_datetime() { - return datetime; + return datetime; } bool chatlogpiece::is_song() { - return p_is_song; + return p_is_song; } QString chatlogpiece::get_datetime_as_string() { - return datetime.toString(); + return datetime.toString(); } QString chatlogpiece::get_full() { - QString full = "["; + QString full = "["; - full.append(get_datetime_as_string()); - full.append("] "); - full.append(get_showname()); - full.append(" ("); - full.append(get_name()); - full.append(")"); - if (p_is_song) - full.append(" has played a song: "); - else - full.append(": "); - full.append(get_message()); + full.append(get_datetime_as_string()); + full.append("] "); + full.append(get_showname()); + full.append(" ("); + full.append(get_name()); + full.append(")"); + if (p_is_song) + full.append(" has played a song: "); + else + full.append(": "); + full.append(get_message()); - return full; + return full; } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 40d17e4a..4c240fed 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1,4372 +1,4070 @@ #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 - - qsrand(static_cast(QDateTime::currentMSecsSinceEpoch() / 1000)); - - 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); - - 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); - - 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_sideplayer_char = new AOCharMovie(ui_viewport, ao_app); - 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(ui_viewport, ao_app); - - ui_vp_chatbox = new AOImage(this, ao_app); - ui_vp_showname = new QLabel(ui_vp_chatbox); - ui_vp_showname->setAlignment(Qt::AlignHCenter); - ui_vp_chat_arrow = new AOMovie(ui_vp_chatbox, ao_app); - ui_vp_chat_arrow->set_play_once(false); - - ui_vp_message = new QTextEdit(this); - 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_testimony->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_vp_effect = new AOMovie(this, ao_app); - ui_vp_effect->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_vp_wtce = new AOMovie(this, ao_app); - ui_vp_wtce->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_vp_objection = new AOMovie(this, ao_app); - ui_vp_objection->setAttribute(Qt::WA_TransparentForMouseEvents); - - 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 QTreeWidget(this); - ui_area_list->setColumnCount(2); - ui_area_list->hideColumn(0); - ui_area_list->setHeaderHidden(true); - ui_area_list->header()->setStretchLastSection(false); - ui_area_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - ui_area_list->hide(); - - ui_music_list = new QTreeWidget(this); - ui_music_list->setColumnCount(2); - ui_music_list->hideColumn(1); - ui_music_list->setHeaderHidden(true); - ui_music_list->header()->setStretchLastSection(false); - ui_music_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - ui_music_list->setContextMenuPolicy(Qt::CustomContextMenu); - - ui_music_display = new AOMovie(this, ao_app); - ui_music_display->set_play_once(false); - ui_music_display->setAttribute(Qt::WA_TransparentForMouseEvents); - - ui_music_name = new ScrollText(ui_music_display); - ui_music_name->setText(tr("None")); - ui_music_name->setAttribute(Qt::WA_TransparentForMouseEvents); - - 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 AOLineEdit(this); - ui_ic_chat_message->setFrame(false); - ui_ic_chat_message->setPlaceholderText(tr("Message")); - ui_ic_chat_message->preserve_selection(true); -// ui_ic_chat_message->setValidator(new QRegExpValidator(QRegExp("^\\S+(?: \\S+)*$"), ui_ic_chat_message)); - //todo: filter out \n from showing up as that commonly breaks the chatlog and can be spammed to hell - - 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_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_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")); - - initialize_emotes(); - - ui_pos_dropdown = new QComboBox(this); - - ui_iniswap_dropdown = new QComboBox(this); - ui_iniswap_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); - ui_iniswap_remove = new AOButton(this, ao_app); - - ui_sfx_dropdown = new QComboBox(this); - ui_sfx_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); - ui_sfx_remove = new AOButton(this, ao_app); - - ui_effects_dropdown = new QComboBox(this); - ui_effects_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); - - 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); + 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 + + qsrand(static_cast(QDateTime::currentMSecsSinceEpoch() / 1000)); + + 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); + + 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); + + 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_sideplayer_char = new AOCharMovie(ui_viewport, ao_app); + 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(ui_viewport, ao_app); + + ui_vp_chatbox = new AOImage(this, ao_app); + ui_vp_showname = new QLabel(ui_vp_chatbox); + ui_vp_showname->setAlignment(Qt::AlignHCenter); + ui_vp_chat_arrow = new AOMovie(ui_vp_chatbox, ao_app); + ui_vp_chat_arrow->set_play_once(false); + + ui_vp_message = new QTextEdit(this); + 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_testimony->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_vp_effect = new AOMovie(this, ao_app); + ui_vp_effect->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_vp_wtce = new AOMovie(this, ao_app); + ui_vp_wtce->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_vp_objection = new AOMovie(this, ao_app); + ui_vp_objection->setAttribute(Qt::WA_TransparentForMouseEvents); + + 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 QTreeWidget(this); + ui_area_list->setColumnCount(2); + ui_area_list->hideColumn(0); + ui_area_list->setHeaderHidden(true); + ui_area_list->header()->setStretchLastSection(false); + ui_area_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui_area_list->hide(); + + ui_music_list = new QTreeWidget(this); + ui_music_list->setColumnCount(2); + ui_music_list->hideColumn(1); + ui_music_list->setHeaderHidden(true); + ui_music_list->header()->setStretchLastSection(false); + ui_music_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui_music_list->setContextMenuPolicy(Qt::CustomContextMenu); + + ui_music_display = new AOMovie(this, ao_app); + ui_music_display->set_play_once(false); + ui_music_display->setAttribute(Qt::WA_TransparentForMouseEvents); + + ui_music_name = new ScrollText(ui_music_display); + ui_music_name->setText(tr("None")); + ui_music_name->setAttribute(Qt::WA_TransparentForMouseEvents); + + 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 AOLineEdit(this); + ui_ic_chat_message->setFrame(false); + ui_ic_chat_message->setPlaceholderText(tr("Message")); + ui_ic_chat_message->preserve_selection(true); + // ui_ic_chat_message->setValidator(new QRegExpValidator(QRegExp("^\\S+(?: \\S+)*$"), ui_ic_chat_message)); + //todo: filter out \n from showing up as that commonly breaks the chatlog and can be spammed to hell + + 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_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_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")); + + initialize_emotes(); + + ui_pos_dropdown = new QComboBox(this); + + ui_iniswap_dropdown = new QComboBox(this); + ui_iniswap_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); + ui_iniswap_remove = new AOButton(this, ao_app); - ui_hold_it = new AOButton(this, ao_app); - ui_objection = new AOButton(this, ao_app); - ui_take_that = new AOButton(this, ao_app); + ui_sfx_dropdown = new QComboBox(this); + ui_sfx_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); + ui_sfx_remove = 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_effects_dropdown = new QComboBox(this); + ui_effects_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); - 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_defense_bar = new AOImage(this, ao_app); + ui_prosecution_bar = new AOImage(this, ao_app); - ui_pre = new QCheckBox(this); - ui_pre->setText(tr("Pre")); + ui_music_label = new QLabel(this); + ui_sfx_label = new QLabel(this); + ui_blip_label = new QLabel(this); - ui_flip = new QCheckBox(this); - ui_flip->setText(tr("Flip")); - ui_flip->hide(); + ui_hold_it = new AOButton(this, ao_app); + ui_objection = new AOButton(this, ao_app); + ui_take_that = new AOButton(this, ao_app); - ui_guard = new QCheckBox(this); - ui_guard->setText(tr("Guard")); - ui_guard->hide(); + 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_additive = new QCheckBox(this); - ui_additive->setText(tr("Additive")); - ui_additive->hide(); + 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_casing = new QCheckBox(this); - ui_casing->setChecked(ao_app->get_casing_enabled()); - ui_casing->setText(tr("Casing")); - ui_casing->hide(); + ui_pre = new QCheckBox(this); + ui_pre->setText(tr("Pre")); - ui_showname_enable = new QCheckBox(this); - ui_showname_enable->setChecked(ao_app->get_showname_enabled_by_default()); - ui_showname_enable->setText(tr("Shownames")); + ui_flip = new QCheckBox(this); + ui_flip->setText(tr("Flip")); + ui_flip->hide(); + + ui_guard = new QCheckBox(this); + ui_guard->setText(tr("Guard")); + ui_guard->hide(); + + ui_additive = new QCheckBox(this); + ui_additive->setText(tr("Additive")); + ui_additive->hide(); - ui_pre_non_interrupt = new QCheckBox(this); - ui_pre_non_interrupt->setText(tr("No Interrupt")); - ui_pre_non_interrupt->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_realization = new AOButton(this, ao_app); - ui_screenshake = new AOButton(this, ao_app); - ui_mute = new AOButton(this, ao_app); + ui_custom_objection = new AOButton(this, ao_app); + 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_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_prosecution_plus = new AOButton(this, ao_app); + ui_prosecution_minus = new AOButton(this, ao_app); - ui_text_color = new QComboBox(this); + ui_text_color = new QComboBox(this); - ui_music_slider = new QSlider(Qt::Horizontal, this); - ui_music_slider->setRange(0, 100); - ui_music_slider->setValue(ao_app->get_default_music()); + 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_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_blip_slider = new QSlider(Qt::Horizontal, this); + ui_blip_slider->setRange(0, 100); + ui_blip_slider->setValue(ao_app->get_default_blip()); - ui_mute_list = new QListWidget(this); + 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_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_order_dropdown = new QComboBox(this); - ui_pair_order_dropdown->addItem("To front"); - ui_pair_order_dropdown->addItem("To behind"); + ui_pair_order_dropdown = new QComboBox(this); + ui_pair_order_dropdown->addItem("To front"); + ui_pair_order_dropdown->addItem("To behind"); - ui_pair_button = new AOButton(this, ao_app); + ui_pair_button = new AOButton(this, ao_app); - ui_evidence_button = new AOButton(this, ao_app); + ui_evidence_button = new AOButton(this, ao_app); - initialize_evidence(); + initialize_evidence(); - construct_char_select(); + construct_char_select(); - connect(keepalive_timer, SIGNAL(timeout()), this, SLOT(ping_server())); + 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(ui_vp_player_char, SIGNAL(shake()), this, SLOT(do_screenshake())); - connect(ui_vp_player_char, SIGNAL(flash()), this, SLOT(do_flash())); - connect(ui_vp_player_char, SIGNAL(play_sfx(QString)), this, SLOT(play_char_sfx(QString))); + connect(ui_vp_objection, SIGNAL(done()), this, SLOT(objection_done())); + connect(ui_vp_player_char, SIGNAL(done()), this, SLOT(preanim_done())); + connect(ui_vp_player_char, SIGNAL(shake()), this, SLOT(do_screenshake())); + connect(ui_vp_player_char, SIGNAL(flash()), this, SLOT(do_flash())); + connect(ui_vp_player_char, SIGNAL(play_sfx(QString)), this, SLOT(play_char_sfx(QString))); - connect(text_delay_timer, SIGNAL(timeout()), this, SLOT(start_chat_ticking())); - connect(sfx_delay_timer, SIGNAL(timeout()), this, SLOT(play_sfx())); + 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(chat_tick_timer, SIGNAL(timeout()), this, SLOT(chat_tick())); - connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pos_dropdown_changed(int))); + connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pos_dropdown_changed(int))); - connect(ui_iniswap_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_iniswap_dropdown_changed(int))); - connect(ui_iniswap_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_iniswap_context_menu_requested(QPoint))); - connect(ui_iniswap_remove, SIGNAL(clicked()), this, SLOT(on_iniswap_remove_clicked())); + connect(ui_iniswap_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_iniswap_dropdown_changed(int))); + connect(ui_iniswap_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_iniswap_context_menu_requested(QPoint))); + connect(ui_iniswap_remove, SIGNAL(clicked()), this, SLOT(on_iniswap_remove_clicked())); - connect(ui_sfx_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sfx_dropdown_changed(int))); - connect(ui_sfx_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_sfx_context_menu_requested(QPoint))); - connect(ui_sfx_remove, SIGNAL(clicked()), this, SLOT(on_sfx_remove_clicked())); + connect(ui_sfx_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sfx_dropdown_changed(int))); + connect(ui_sfx_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_sfx_context_menu_requested(QPoint))); + connect(ui_sfx_remove, SIGNAL(clicked()), this, SLOT(on_sfx_remove_clicked())); - connect(ui_effects_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_effects_dropdown_changed(int))); - connect(ui_effects_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_effects_context_menu_requested(QPoint))); + connect(ui_effects_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_effects_dropdown_changed(int))); + connect(ui_effects_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_effects_context_menu_requested(QPoint))); - connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); + connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); - connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, SLOT(on_chat_return_pressed())); + connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, SLOT(on_chat_return_pressed())); - connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, SLOT(on_ooc_return_pressed())); + connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, SLOT(on_ooc_return_pressed())); - connect(ui_music_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(on_music_list_double_clicked(QTreeWidgetItem*, int))); - connect(ui_music_list, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_music_list_context_menu_requested(QPoint))); + connect(ui_music_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(on_music_list_double_clicked(QTreeWidgetItem *, int))); + connect(ui_music_list, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_music_list_context_menu_requested(QPoint))); - connect(ui_area_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(on_area_list_double_clicked(QTreeWidgetItem*, int))); + connect(ui_area_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(on_area_list_double_clicked(QTreeWidgetItem *, int))); - 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_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_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_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_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_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_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_ooc_toggle, SIGNAL(clicked()), this, SLOT(on_ooc_toggle_clicked())); + 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_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_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_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_additive, SIGNAL(clicked()), this, SLOT(on_additive_clicked())); - connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked())); - connect(ui_casing, SIGNAL(clicked()), this, SLOT(on_casing_clicked())); + connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked())); + connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked())); + connect(ui_additive, SIGNAL(clicked()), this, SLOT(on_additive_clicked())); + connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked())); + connect(ui_casing, SIGNAL(clicked()), this, SLOT(on_casing_clicked())); - connect(ui_showname_enable, SIGNAL(clicked()), this, SLOT(on_showname_enable_clicked())); + connect(ui_showname_enable, SIGNAL(clicked()), this, SLOT(on_showname_enable_clicked())); - connect(ui_pair_button, SIGNAL(clicked()), this, SLOT(on_pair_clicked())); - connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_pair_list_clicked(QModelIndex))); - connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_pair_offset_changed(int))); - connect(ui_pair_order_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pair_order_dropdown_changed(int))); + connect(ui_pair_button, SIGNAL(clicked()), this, SLOT(on_pair_clicked())); + connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_pair_list_clicked(QModelIndex))); + connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_pair_offset_changed(int))); + connect(ui_pair_order_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pair_order_dropdown_changed(int))); - connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked())); + connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked())); - set_widgets(); + set_widgets(); - set_char_select(); + set_char_select(); } void Courtroom::set_mute_list() { - mute_map.clear(); + 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); - } + //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; + QStringList sorted_mute_list; - for (char_type i_char : char_list) - sorted_mute_list.append(i_char.name); + for (char_type i_char : char_list) + sorted_mute_list.append(i_char.name); - sorted_mute_list.sort(); + sorted_mute_list.sort(); - for (QString i_name : sorted_mute_list) - { - //mute_map.insert(i_name, false); - ui_mute_list->addItem(i_name); - } + 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; + QStringList sorted_pair_list; - for (char_type i_char : char_list) - sorted_pair_list.append(i_char.name); + for (char_type i_char : char_list) + sorted_pair_list.append(i_char.name); - sorted_pair_list.sort(); + sorted_pair_list.sort(); - for (QString i_name : sorted_pair_list) - { - ui_pair_list->addItem(i_name); - } + 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(); + blip_rate = ao_app->read_blip_rate(); + blank_blip = ao_app->get_blank_blip(); - QString filename = "courtroom_design.ini"; + QString filename = "courtroom_design.ini"; - pos_size_type f_courtroom = ao_app->get_element_dimensions("courtroom", filename); + pos_size_type f_courtroom = ao_app->get_element_dimensions("courtroom", filename); - if (f_courtroom.width < 0 || f_courtroom.height < 0) - { - qDebug() << "W: did not find courtroom width or height in " << 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(714, 668); + } + else { + m_courtroom_width = f_courtroom.width; + m_courtroom_height = f_courtroom.height; - this->resize(f_courtroom.width, f_courtroom.height); - } + this->resize(f_courtroom.width, f_courtroom.height); + } - set_fonts(); + set_fonts(); - ui_background->move(0, 0); - ui_background->resize(m_courtroom_width, m_courtroom_height); - ui_background->set_image("courtroombackground"); + ui_background->move(0, 0); + ui_background->resize(m_courtroom_width, m_courtroom_height); + ui_background->set_image("courtroombackground"); - set_size_and_pos(ui_viewport, "viewport"); + 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(); - ui_casing->show(); - } - else - { - ui_announce_casing->hide(); - ui_casing->hide(); - } + // 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(); + ui_casing->show(); + } + else { + ui_announce_casing->hide(); + ui_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_vp_background->move(0, 0); + ui_vp_background->combo_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->combo_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->combo_resize(ui_viewport->width(), ui_viewport->height()); + + ui_vp_chat_arrow->move(0, 0); + pos_size_type design_ini_result = ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini"); - // 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(); + if (design_ini_result.width < 0 || design_ini_result.height < 0) { + qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; + ui_vp_chat_arrow->hide(); + } + else { + ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); + ui_vp_chat_arrow->combo_resize(design_ini_result.width, design_ini_result.height); + } + + ui_vp_testimony->move(ui_viewport->x(), ui_viewport->y()); + ui_vp_testimony->combo_resize(ui_viewport->width(), ui_viewport->height()); + + ui_vp_effect->move(ui_viewport->x(), ui_viewport->y()); + ui_vp_effect->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"); + ui_ic_chatlog->setFrameShape(QFrame::NoFrame); + + set_size_and_pos(ui_ms_chatlog, "ms_chatlog"); + ui_ms_chatlog->setFrameShape(QFrame::NoFrame); + + set_size_and_pos(ui_server_chatlog, "server_chatlog"); + ui_server_chatlog->setFrameShape(QFrame::NoFrame); + + 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(); + ui_pair_list->setToolTip(tr("Select a character you wish to pair with.")); + + set_size_and_pos(ui_pair_offset_spinbox, "pair_offset_spinbox"); + ui_pair_offset_spinbox->hide(); + ui_pair_offset_spinbox->setToolTip(tr("Change the percentage offset of your character's position from the center of the screen.")); + + ui_pair_order_dropdown->hide(); + set_size_and_pos(ui_pair_order_dropdown, "pair_order_dropdown"); + ui_pair_offset_spinbox->setToolTip(tr("Change the order of appearance for your character.")); + + set_size_and_pos(ui_pair_button, "pair_button"); + ui_pair_button->set_image("pair_button"); + ui_pair_button->setToolTip(tr("Display the list of characters to pair with.")); + + set_size_and_pos(ui_area_list, "music_list"); + ui_area_list->header()->setMinimumSectionSize(ui_area_list->width()); - ui_vp_background->move(0, 0); - ui_vp_background->combo_resize(ui_viewport->width(), ui_viewport->height()); + set_size_and_pos(ui_music_list, "music_list"); + ui_music_list->header()->setMinimumSectionSize(ui_music_list->width()); - ui_vp_speedlines->move(0, 0); - ui_vp_speedlines->combo_resize(ui_viewport->width(), ui_viewport->height()); + set_size_and_pos(ui_music_name, "music_name"); - ui_vp_player_char->move(0, 0); - ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height()); + ui_music_display->move(0, 0); + design_ini_result = ao_app->get_element_dimensions("music_display", "courtroom_design.ini"); - ui_vp_sideplayer_char->move(0, 0); - ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), ui_viewport->height()); + if (design_ini_result.width < 0 || design_ini_result.height < 0) { + qDebug() << "W: could not find \"music_name\" in courtroom_design.ini"; + ui_music_display->hide(); + } + else { + ui_music_display->move(design_ini_result.x, design_ini_result.y); + ui_music_display->combo_resize(design_ini_result.width, design_ini_result.height); + } - //the AO2 desk element - ui_vp_desk->move(0, 0); - ui_vp_desk->combo_resize(ui_viewport->width(), ui_viewport->height()); + ui_music_display->play("music_display"); - //the size of the ui_vp_legacy_desk element relies on various factors and is set in set_scene() + 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"); + } - 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_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_evidence_display->move(0, 0); - ui_vp_evidence_display->combo_resize(ui_viewport->width(), ui_viewport->height()); + ui_vp_chatbox->set_image("chatblank"); + ui_vp_chatbox->hide(); - ui_vp_chat_arrow->move(0, 0); - pos_size_type design_ini_result = ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini"); + set_size_and_pos(ui_vp_showname, "showname"); - if (design_ini_result.width < 0 || design_ini_result.height < 0) - { - qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; - ui_vp_chat_arrow->hide(); - } - else - { - ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); - ui_vp_chat_arrow->combo_resize(design_ini_result.width, design_ini_result.height); - } + set_size_and_pos(ui_vp_message, "message"); + ui_vp_message->hide(); - ui_vp_testimony->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_testimony->combo_resize(ui_viewport->width(), ui_viewport->height()); + //We detached the text as parent from the chatbox so it doesn't get affected by the screenshake. + ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y()); + ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); - ui_vp_effect->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_effect->combo_resize(ui_viewport->width(), ui_viewport->height()); + ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); + ui_muted->set_image("muted"); + ui_muted->setToolTip(tr("Oops, you're muted!")); - ui_vp_wtce->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_wtce->combo_resize(ui_viewport->width(), ui_viewport->height()); + set_size_and_pos(ui_ooc_chat_message, "ooc_chat_message"); + ui_ooc_chat_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); - 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_ooc_chat_name, "ooc_chat_name"); + ui_ooc_chat_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); - set_size_and_pos(ui_ic_chatlog, "ic_chatlog"); - ui_ic_chatlog->setFrameShape(QFrame::NoFrame); + //set_size_and_pos(ui_area_password, "area_password"); + set_size_and_pos(ui_music_search, "music_search"); + ui_music_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); - set_size_and_pos(ui_ms_chatlog, "ms_chatlog"); - ui_ms_chatlog->setFrameShape(QFrame::NoFrame); + set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); + ui_emote_dropdown->setToolTip(tr("Set your character's emote to play on your next message.")); - set_size_and_pos(ui_server_chatlog, "server_chatlog"); - ui_server_chatlog->setFrameShape(QFrame::NoFrame); + set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); + ui_pos_dropdown->setToolTip(tr("Set your character's supplementary background.")); - set_size_and_pos(ui_mute_list, "mute_list"); - ui_mute_list->hide(); + set_size_and_pos(ui_iniswap_dropdown, "iniswap_dropdown"); + ui_iniswap_dropdown->setEditable(true); + ui_iniswap_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); + ui_iniswap_dropdown->setToolTip(tr("Set an 'iniswap', or an alternative character folder to refer to from your current character.\n" + "Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters//iniswaps.ini")); - set_size_and_pos(ui_pair_list, "pair_list"); - ui_pair_list->hide(); - ui_pair_list->setToolTip(tr("Select a character you wish to pair with.")); + set_size_and_pos(ui_iniswap_remove, "iniswap_remove"); + ui_iniswap_remove->setText("X"); + ui_iniswap_remove->set_image("evidencex"); + ui_iniswap_remove->setToolTip(tr("Remove the currently selected iniswap from the list and return to the original character folder.")); + ui_iniswap_remove->hide(); - set_size_and_pos(ui_pair_offset_spinbox, "pair_offset_spinbox"); - ui_pair_offset_spinbox->hide(); - ui_pair_offset_spinbox->setToolTip(tr("Change the percentage offset of your character's position from the center of the screen.")); + set_size_and_pos(ui_sfx_dropdown, "sfx_dropdown"); + ui_sfx_dropdown->setEditable(true); + ui_sfx_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); + ui_sfx_dropdown->setToolTip(tr("Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any).\n" + "Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters//soundlist.ini")); - ui_pair_order_dropdown->hide(); - set_size_and_pos(ui_pair_order_dropdown, "pair_order_dropdown"); - ui_pair_offset_spinbox->setToolTip(tr("Change the order of appearance for your character.")); + set_size_and_pos(ui_sfx_remove, "sfx_remove"); + ui_sfx_remove->setText("X"); + ui_sfx_remove->set_image("evidencex"); + ui_sfx_remove->setToolTip(tr("Remove the currently selected iniswap from the list and return to the original character folder.")); + ui_sfx_remove->hide(); - set_size_and_pos(ui_pair_button, "pair_button"); - ui_pair_button->set_image("pair_button"); - ui_pair_button->setToolTip(tr("Display the list of characters to pair with.")); + set_size_and_pos(ui_effects_dropdown, "effects_dropdown"); + ui_effects_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); + ui_effects_dropdown->setToolTip(tr("Choose an effect to play on your next spoken message.\n" + "The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by\n" + "char.ini [Options] category, effects = 'miscname' where it referes to misc//effects.ini to read the effects.")); + //Todo: recode this entire fucking system with these dumbass goddamn ini's why is everything so specifically coded for all these purposes + //is ABSTRACT CODING not a thing now huh what the FUCK why do I gotta do this pleASE FOR THE LOVE OF GOD SPARE ME FROM THIS FRESH HELL + //btw i still love coding. + QPoint p_point = ao_app->get_button_spacing("effects_icon_size", filename); + ui_effects_dropdown->setIconSize(QSize(p_point.x(), p_point.y())); + + set_size_and_pos(ui_defense_bar, "defense_bar"); + ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state)); + + set_size_and_pos(ui_prosecution_bar, "prosecution_bar"); + ui_prosecution_bar->set_image("prosecutionbar" + QString::number(prosecution_bar_state)); + + 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_hold_it, "hold_it"); + ui_hold_it->setText(tr("Hold It!")); + ui_hold_it->setToolTip(tr("When this is turned on, your next in-character message will be a shout!")); + ui_hold_it->set_image("holdit"); - set_size_and_pos(ui_area_list, "music_list"); - ui_area_list->header()->setMinimumSectionSize(ui_area_list->width()); - - set_size_and_pos(ui_music_list, "music_list"); - ui_music_list->header()->setMinimumSectionSize(ui_music_list->width()); - - set_size_and_pos(ui_music_name, "music_name"); - - ui_music_display->move(0, 0); - design_ini_result = ao_app->get_element_dimensions("music_display", "courtroom_design.ini"); - - if (design_ini_result.width < 0 || design_ini_result.height < 0) - { - qDebug() << "W: could not find \"music_name\" in courtroom_design.ini"; - ui_music_display->hide(); - } - else - { - ui_music_display->move(design_ini_result.x, design_ini_result.y); - ui_music_display->combo_resize(design_ini_result.width, design_ini_result.height); - } - - ui_music_display->play("music_display"); - - 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("chatblank"); - ui_vp_chatbox->hide(); - - set_size_and_pos(ui_vp_showname, "showname"); - - set_size_and_pos(ui_vp_message, "message"); - ui_vp_message->hide(); - - //We detached the text as parent from the chatbox so it doesn't get affected by the screenshake. - ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y()); - ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); - - ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); - ui_muted->set_image("muted"); - ui_muted->setToolTip(tr("Oops, you're muted!")); - - 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"); - ui_music_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); - - set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); - ui_emote_dropdown->setToolTip(tr("Set your character's emote to play on your next message.")); - - set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); - ui_pos_dropdown->setToolTip(tr("Set your character's supplementary background.")); - - set_size_and_pos(ui_iniswap_dropdown, "iniswap_dropdown"); - ui_iniswap_dropdown->setEditable(true); - ui_iniswap_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); - ui_iniswap_dropdown->setToolTip(tr("Set an 'iniswap', or an alternative character folder to refer to from your current character.\n" - "Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters//iniswaps.ini")); - - set_size_and_pos(ui_iniswap_remove, "iniswap_remove"); - ui_iniswap_remove->setText("X"); - ui_iniswap_remove->set_image("evidencex"); - ui_iniswap_remove->setToolTip(tr("Remove the currently selected iniswap from the list and return to the original character folder.")); - ui_iniswap_remove->hide(); - - set_size_and_pos(ui_sfx_dropdown, "sfx_dropdown"); - ui_sfx_dropdown->setEditable(true); - ui_sfx_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); - ui_sfx_dropdown->setToolTip(tr("Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any).\n" - "Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters//soundlist.ini")); - - set_size_and_pos(ui_sfx_remove, "sfx_remove"); - ui_sfx_remove->setText("X"); - ui_sfx_remove->set_image("evidencex"); - ui_sfx_remove->setToolTip(tr("Remove the currently selected iniswap from the list and return to the original character folder.")); - ui_sfx_remove->hide(); - - set_size_and_pos(ui_effects_dropdown, "effects_dropdown"); - ui_effects_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); - ui_effects_dropdown->setToolTip(tr("Choose an effect to play on your next spoken message.\n" - "The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by\n" - "char.ini [Options] category, effects = 'miscname' where it referes to misc//effects.ini to read the effects.")); - //Todo: recode this entire fucking system with these dumbass goddamn ini's why is everything so specifically coded for all these purposes - //is ABSTRACT CODING not a thing now huh what the FUCK why do I gotta do this pleASE FOR THE LOVE OF GOD SPARE ME FROM THIS FRESH HELL - //btw i still love coding. - QPoint p_point = ao_app->get_button_spacing("effects_icon_size", filename); - ui_effects_dropdown->setIconSize(QSize(p_point.x(), p_point.y())); - - set_size_and_pos(ui_defense_bar, "defense_bar"); - ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state)); - - set_size_and_pos(ui_prosecution_bar, "prosecution_bar"); - ui_prosecution_bar->set_image("prosecutionbar" + QString::number(prosecution_bar_state)); - - 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_hold_it, "hold_it"); - ui_hold_it->setText(tr("Hold It!")); - ui_hold_it->setToolTip(tr("When this is turned on, your next in-character message will be a shout!")); - ui_hold_it->set_image("holdit"); - - set_size_and_pos(ui_objection, "objection"); - ui_objection->setText(tr("Objection!")); - ui_objection->setToolTip(tr("When this is turned on, your next in-character message will be a shout!")); - ui_objection->set_image("objection"); - - set_size_and_pos(ui_take_that, "take_that"); - ui_take_that->setText(tr("Take That!")); - ui_take_that->setToolTip(tr("When this is turned on, your next in-character message will be a shout!")); - ui_take_that->set_image("takethat"); - - set_size_and_pos(ui_ooc_toggle, "ooc_toggle"); - ui_ooc_toggle->setText(tr("Server")); - ui_ooc_toggle->setToolTip(tr("Toggle between server chat and global AO2 chat.")); - - set_size_and_pos(ui_witness_testimony, "witness_testimony"); - ui_witness_testimony->set_image("witnesstestimony"); - ui_witness_testimony->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); - set_size_and_pos(ui_cross_examination, "cross_examination"); - ui_cross_examination->set_image("crossexamination"); - ui_cross_examination->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); - - set_size_and_pos(ui_guilty, "guilty"); - ui_guilty->setText(tr("Guilty!")); - ui_guilty->set_image("guilty"); - ui_guilty->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); - set_size_and_pos(ui_not_guilty, "not_guilty"); - ui_not_guilty->set_image("notguilty"); - ui_not_guilty->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); - - set_size_and_pos(ui_change_character, "change_character"); - ui_change_character->setText(tr("Change character")); - ui_change_character->set_image("change_character"); - ui_change_character->setToolTip(tr("Bring up the Character Select Screen and change your character.")); - - set_size_and_pos(ui_reload_theme, "reload_theme"); - ui_reload_theme->setText(tr("Reload theme")); - ui_reload_theme->set_image("reload_theme"); - ui_reload_theme->setToolTip(tr("Refresh the theme and update all of the ui elements to match.")); - - set_size_and_pos(ui_call_mod, "call_mod"); - ui_call_mod->setText(tr("Call mod")); - ui_call_mod->set_image("call_mod"); - ui_call_mod->setToolTip(tr("Request the attention of the current server's moderator.")); - - set_size_and_pos(ui_settings, "settings"); - ui_settings->setText(tr("Settings")); - ui_settings->set_image("settings"); - ui_settings->setToolTip(tr("Allows you to change various aspects of the client.")); - - set_size_and_pos(ui_announce_casing, "casing_button"); - ui_announce_casing->setText(tr("Casing")); - ui_announce_casing->set_image("casing_button"); - ui_announce_casing->setToolTip(tr("An interface to help you announce a case (you have to be a CM first to be able to announce cases)")); - - set_size_and_pos(ui_switch_area_music, "switch_area_music"); - ui_switch_area_music->setText(tr("A/M")); - ui_switch_area_music->set_image("switch_area_music"); - ui_switch_area_music->setToolTip(tr("Switch between Areas and Music lists")); - - set_size_and_pos(ui_pre, "pre"); - ui_pre->setText(tr("Preanim")); - ui_pre->setToolTip(tr("Play a single-shot animation as defined by the emote when checked.")); - - set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); - ui_pre_non_interrupt->setToolTip(tr("If preanim is checked, display the input text immediately as the animation plays concurrently.")); - - set_size_and_pos(ui_flip, "flip"); - ui_flip->setToolTip(tr("Mirror your character's emotes when checked.")); - - set_size_and_pos(ui_additive, "additive"); - ui_additive->setToolTip(tr("Add text to your last spoken message when checked.")); - - set_size_and_pos(ui_guard, "guard"); - ui_guard->setToolTip(tr("Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window.")); - - set_size_and_pos(ui_casing, "casing"); - ui_casing->setToolTip(tr("Lets you receive case alerts when enabled.\n" - "(You can set your preferences in the Settings!)")); + set_size_and_pos(ui_objection, "objection"); + ui_objection->setText(tr("Objection!")); + ui_objection->setToolTip(tr("When this is turned on, your next in-character message will be a shout!")); + ui_objection->set_image("objection"); - set_size_and_pos(ui_showname_enable, "showname_enable"); - ui_showname_enable->setToolTip(tr("Display customized shownames for all users when checked.")); + set_size_and_pos(ui_take_that, "take_that"); + ui_take_that->setText(tr("Take That!")); + ui_take_that->setToolTip(tr("When this is turned on, your next in-character message will be a shout!")); + ui_take_that->set_image("takethat"); - set_size_and_pos(ui_custom_objection, "custom_objection"); - ui_custom_objection->setText(tr("Custom Shout!")); - ui_custom_objection->set_image("custom"); - ui_custom_objection->setToolTip(tr("This will display the custom character-defined animation in the viewport as soon as it is pressed.\n" - "To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect")); + set_size_and_pos(ui_ooc_toggle, "ooc_toggle"); + ui_ooc_toggle->setText(tr("Server")); + ui_ooc_toggle->setToolTip(tr("Toggle between server chat and global AO2 chat.")); + + set_size_and_pos(ui_witness_testimony, "witness_testimony"); + ui_witness_testimony->set_image("witnesstestimony"); + ui_witness_testimony->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); + set_size_and_pos(ui_cross_examination, "cross_examination"); + ui_cross_examination->set_image("crossexamination"); + ui_cross_examination->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); + + set_size_and_pos(ui_guilty, "guilty"); + ui_guilty->setText(tr("Guilty!")); + ui_guilty->set_image("guilty"); + ui_guilty->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); + set_size_and_pos(ui_not_guilty, "not_guilty"); + ui_not_guilty->set_image("notguilty"); + ui_not_guilty->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); + + set_size_and_pos(ui_change_character, "change_character"); + ui_change_character->setText(tr("Change character")); + ui_change_character->set_image("change_character"); + ui_change_character->setToolTip(tr("Bring up the Character Select Screen and change your character.")); + + set_size_and_pos(ui_reload_theme, "reload_theme"); + ui_reload_theme->setText(tr("Reload theme")); + ui_reload_theme->set_image("reload_theme"); + ui_reload_theme->setToolTip(tr("Refresh the theme and update all of the ui elements to match.")); + + set_size_and_pos(ui_call_mod, "call_mod"); + ui_call_mod->setText(tr("Call mod")); + ui_call_mod->set_image("call_mod"); + ui_call_mod->setToolTip(tr("Request the attention of the current server's moderator.")); + + set_size_and_pos(ui_settings, "settings"); + ui_settings->setText(tr("Settings")); + ui_settings->set_image("settings"); + ui_settings->setToolTip(tr("Allows you to change various aspects of the client.")); + + set_size_and_pos(ui_announce_casing, "casing_button"); + ui_announce_casing->setText(tr("Casing")); + ui_announce_casing->set_image("casing_button"); + ui_announce_casing->setToolTip(tr("An interface to help you announce a case (you have to be a CM first to be able to announce cases)")); + + set_size_and_pos(ui_switch_area_music, "switch_area_music"); + ui_switch_area_music->setText(tr("A/M")); + ui_switch_area_music->set_image("switch_area_music"); + ui_switch_area_music->setToolTip(tr("Switch between Areas and Music lists")); + + set_size_and_pos(ui_pre, "pre"); + ui_pre->setText(tr("Preanim")); + ui_pre->setToolTip(tr("Play a single-shot animation as defined by the emote when checked.")); + + set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); + ui_pre_non_interrupt->setToolTip(tr("If preanim is checked, display the input text immediately as the animation plays concurrently.")); + + set_size_and_pos(ui_flip, "flip"); + ui_flip->setToolTip(tr("Mirror your character's emotes when checked.")); + + set_size_and_pos(ui_additive, "additive"); + ui_additive->setToolTip(tr("Add text to your last spoken message when checked.")); + + set_size_and_pos(ui_guard, "guard"); + ui_guard->setToolTip(tr("Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window.")); + + set_size_and_pos(ui_casing, "casing"); + ui_casing->setToolTip(tr("Lets you receive case alerts when enabled.\n" + "(You can set your preferences in the Settings!)")); + + set_size_and_pos(ui_showname_enable, "showname_enable"); + ui_showname_enable->setToolTip(tr("Display customized shownames for all users when checked.")); + + set_size_and_pos(ui_custom_objection, "custom_objection"); + ui_custom_objection->setText(tr("Custom Shout!")); + ui_custom_objection->set_image("custom"); + ui_custom_objection->setToolTip(tr("This will display the custom character-defined animation in the viewport as soon as it is pressed.\n" + "To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect")); - set_size_and_pos(ui_realization, "realization"); - ui_realization->set_image("realization"); - ui_realization->setToolTip(tr("Play realization sound and animation in the viewport on the next spoken message when checked.")); + set_size_and_pos(ui_realization, "realization"); + ui_realization->set_image("realization"); + ui_realization->setToolTip(tr("Play realization sound and animation in the viewport on the next spoken message when checked.")); - set_size_and_pos(ui_screenshake, "screenshake"); - ui_screenshake->set_image("screenshake"); - ui_screenshake->setToolTip(tr("Shake the screen on next spoken message when checked.")); + set_size_and_pos(ui_screenshake, "screenshake"); + ui_screenshake->set_image("screenshake"); + ui_screenshake->setToolTip(tr("Shake the screen on next spoken message when checked.")); - set_size_and_pos(ui_mute, "mute_button"); - ui_mute->setText("Mute"); - ui_mute->set_image("mute"); - ui_mute->setToolTip(tr("Display the list of character folders you wish to mute.")); + set_size_and_pos(ui_mute, "mute_button"); + ui_mute->setText("Mute"); + ui_mute->set_image("mute"); + ui_mute->setToolTip(tr("Display the list of character folders you wish to mute.")); - set_size_and_pos(ui_defense_plus, "defense_plus"); - ui_defense_plus->set_image("defplus"); - ui_defense_plus->setToolTip(tr("Increase the health bar.")); + set_size_and_pos(ui_defense_plus, "defense_plus"); + ui_defense_plus->set_image("defplus"); + ui_defense_plus->setToolTip(tr("Increase the health bar.")); - set_size_and_pos(ui_defense_minus, "defense_minus"); - ui_defense_minus->set_image("defminus"); - ui_defense_minus->setToolTip(tr("Decrease the health bar.")); + set_size_and_pos(ui_defense_minus, "defense_minus"); + ui_defense_minus->set_image("defminus"); + ui_defense_minus->setToolTip(tr("Decrease the health bar.")); - set_size_and_pos(ui_prosecution_plus, "prosecution_plus"); - ui_prosecution_plus->set_image("proplus"); - ui_prosecution_plus->setToolTip(tr("Increase the health bar.")); + set_size_and_pos(ui_prosecution_plus, "prosecution_plus"); + ui_prosecution_plus->set_image("proplus"); + ui_prosecution_plus->setToolTip(tr("Increase the health bar.")); - set_size_and_pos(ui_prosecution_minus, "prosecution_minus"); - ui_prosecution_minus->set_image("prominus"); - ui_prosecution_minus->setToolTip(tr("Decrease the health bar.")); + set_size_and_pos(ui_prosecution_minus, "prosecution_minus"); + ui_prosecution_minus->set_image("prominus"); + ui_prosecution_minus->setToolTip(tr("Decrease the health bar.")); - set_size_and_pos(ui_text_color, "text_color"); - ui_text_color->setToolTip(tr("Change the text color of the spoken message.\n" - "You can also select a part of your currently typed message and use the dropdown to change its color!")); - set_text_color_dropdown(); + set_size_and_pos(ui_text_color, "text_color"); + ui_text_color->setToolTip(tr("Change the text color of the spoken message.\n" + "You can also select a part of your currently typed message and use the dropdown to change its color!")); + set_text_color_dropdown(); - 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_music_slider, "music_slider"); + set_size_and_pos(ui_sfx_slider, "sfx_slider"); + set_size_and_pos(ui_blip_slider, "blip_slider"); - ui_selector->set_image("char_selector"); - ui_selector->hide(); + ui_selector->set_image("char_selector"); + ui_selector->hide(); - set_size_and_pos(ui_back_to_lobby, "back_to_lobby"); - ui_back_to_lobby->setText(tr("Back to Lobby")); - ui_back_to_lobby->setToolTip(tr("Return back to the server list.")); + set_size_and_pos(ui_back_to_lobby, "back_to_lobby"); + ui_back_to_lobby->setText(tr("Back to Lobby")); + ui_back_to_lobby->setToolTip(tr("Return back to the server list.")); - set_size_and_pos(ui_char_password, "char_password"); + set_size_and_pos(ui_char_password, "char_password"); - set_size_and_pos(ui_char_buttons, "char_buttons"); + 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"); + set_size_and_pos(ui_char_select_left, "char_select_left"); + ui_char_select_left->set_image("arrow_left"); - set_size_and_pos(ui_char_select_right, "char_select_right"); - ui_char_select_right->set_image("arrow_right"); + set_size_and_pos(ui_char_select_right, "char_select_right"); + ui_char_select_right->set_image("arrow_right"); - set_size_and_pos(ui_spectator, "spectator"); - ui_spectator->setToolTip(tr("Become a spectator. You won't be able to interact with the in-character screen.")); + set_size_and_pos(ui_spectator, "spectator"); + ui_spectator->setToolTip(tr("Become a spectator. You won't be able to interact with the in-character screen.")); - refresh_evidence(); + refresh_evidence(); } 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_font(ui_music_name, "", "music_name"); + 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_font(ui_music_name, "", "music_name"); - set_dropdowns(); + set_dropdowns(); } void Courtroom::set_font(QWidget *widget, QString class_name, QString p_identifier) { - QString design_file = "courtroom_fonts.ini"; - int f_pointsize = ao_app->get_font_size(p_identifier, design_file); - QString font_name = ao_app->get_font_name(p_identifier + "_font", design_file); - QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? - bool antialias = ao_app->get_font_size(p_identifier + "_sharp", design_file) != 1; // is the font anti-aliased or not? + QString design_file = "courtroom_fonts.ini"; + int f_pointsize = ao_app->get_font_size(p_identifier, design_file); + QString font_name = ao_app->get_font_name(p_identifier + "_font", design_file); + QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); + bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? + bool antialias = ao_app->get_font_size(p_identifier + "_sharp", design_file) != 1; // is the font anti-aliased or not? - this->set_qfont(widget, class_name, get_qfont(font_name, f_pointsize, antialias), f_color, bold); + this->set_qfont(widget, class_name, get_qfont(font_name, f_pointsize, antialias), f_color, bold); } QFont Courtroom::get_qfont(QString font_name, int f_pointsize, bool antialias) { - QFont font; - if (font_name.isEmpty()) - font_name = "Arial"; + QFont font; + if (font_name.isEmpty()) + font_name = "Arial"; - QFont::StyleStrategy style_strategy = QFont::PreferDefault; - if (!antialias) - style_strategy = QFont::NoAntialias; + QFont::StyleStrategy style_strategy = QFont::PreferDefault; + if (!antialias) + style_strategy = QFont::NoAntialias; - font = QFont(font_name, f_pointsize); - font.setStyleHint(QFont::SansSerif, style_strategy); - return font; + font = QFont(font_name, f_pointsize); + font.setStyleHint(QFont::SansSerif, style_strategy); + return font; } void Courtroom::set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color, bool bold) { - if(class_name.isEmpty()) - class_name = widget->metaObject()->className(); + if (class_name.isEmpty()) + class_name = widget->metaObject()->className(); - font.setBold(bold); - widget->setFont(font); + font.setBold(bold); + widget->setFont(font); - 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); + 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_dropdown(QWidget *widget) { - QString f_file = "courtroom_stylesheets.css"; - QString style_sheet_string = ao_app->get_stylesheet(f_file); - if (style_sheet_string != "") - widget->setStyleSheet(style_sheet_string); + QString f_file = "courtroom_stylesheets.css"; + QString style_sheet_string = ao_app->get_stylesheet(f_file); + if (style_sheet_string != "") + widget->setStyleSheet(style_sheet_string); } void Courtroom::set_dropdowns() { - set_dropdown(this); //EXPERIMENTAL - Read the style-sheet as-is for maximum memeage -// set_dropdown(ui_text_color, "[TEXT COLOR]"); -// set_dropdown(ui_pos_dropdown, "[POS DROPDOWN]"); -// set_dropdown(ui_emote_dropdown, "[EMOTE DROPDOWN]"); -// set_dropdown(ui_mute_list, "[MUTE LIST]"); + set_dropdown(this); //EXPERIMENTAL - Read the style-sheet as-is for maximum memeage + // set_dropdown(ui_text_color, "[TEXT COLOR]"); + // set_dropdown(ui_pos_dropdown, "[POS DROPDOWN]"); + // set_dropdown(ui_emote_dropdown, "[EMOTE DROPDOWN]"); + // set_dropdown(ui_mute_list, "[MUTE LIST]"); } void Courtroom::set_window_title(QString p_title) { - this->setWindowTitle(p_title); + this->setWindowTitle(p_title); } void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier) { - QString filename = "courtroom_design.ini"; + QString filename = "courtroom_design.ini"; - pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); + pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); - if (design_ini_result.width < 0 || design_ini_result.height < 0) - { - 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); - } + 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 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; - } + 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_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); + char_list.replace(n_char, f_char); } QPoint Courtroom::get_theme_pos(QString p_identifier) { - QString filename = "courtroom_design.ini"; + QString filename = "courtroom_design.ini"; - pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); + pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); - if (design_ini_result.width < 0 || design_ini_result.height < 0) - { - qDebug() << "W: could not find \"" << p_identifier << "\" in " << filename; - return QPoint(0,0); - } - else - { - return QPoint(design_ini_result.x, design_ini_result.y); - } + 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::done_received() { - m_cid = -1; + m_cid = -1; - music_player->set_volume(0); - sfx_player->set_volume(0); - objection_player->set_volume(0); - blip_player->set_volume(0); + 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_char_select_page(); - set_mute_list(); - set_pair_list(); + set_mute_list(); + set_pair_list(); - set_char_select(); + set_char_select(); - show(); + show(); - ui_spectator->show(); + ui_spectator->show(); } void Courtroom::set_background(QString p_background, bool display) { - ui_vp_testimony->stop(); - current_background = p_background; - - //welcome to hardcode central may I take your order of regularly scheduled CBT - QMap default_pos; - default_pos["defenseempty"] = "def"; - default_pos["helperstand"] = "hld"; - default_pos["prosecutorempty"] = "pro"; - default_pos["prohelperstand"] = "hlp"; - default_pos["witnessempty"] = "wit"; - default_pos["judgestand"] = "jud"; - default_pos["jurystand"] = "jur"; - default_pos["seancestand"] = "sea"; - - //Populate the dropdown list with all pos that exist on this bg - QStringList pos_list = {}; - for (QString key : default_pos.keys()) - { - if (file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path(key)))) - { - pos_list.append(default_pos[key]); + ui_vp_testimony->stop(); + current_background = p_background; + + //welcome to hardcode central may I take your order of regularly scheduled CBT + QMap default_pos; + default_pos["defenseempty"] = "def"; + default_pos["helperstand"] = "hld"; + default_pos["prosecutorempty"] = "pro"; + default_pos["prohelperstand"] = "hlp"; + default_pos["witnessempty"] = "wit"; + default_pos["judgestand"] = "jud"; + default_pos["jurystand"] = "jur"; + default_pos["seancestand"] = "sea"; + + //Populate the dropdown list with all pos that exist on this bg + QStringList pos_list = {}; + for (QString key : default_pos.keys()) { + if (file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path(key)))) { + pos_list.append(default_pos[key]); + } } - } - //TODO: search through extra/custom pos and add them to the pos dropdown as well + //TODO: search through extra/custom pos and add them to the pos dropdown as well - set_pos_dropdown(pos_list); + set_pos_dropdown(pos_list); - is_ao2_bg = true; + is_ao2_bg = true; - 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"); - } + 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"); + } - if (display) - { - ui_vp_speedlines->stop(); - ui_vp_player_char->stop(); + if (display) { + ui_vp_speedlines->stop(); + ui_vp_player_char->stop(); - ui_vp_sideplayer_char->stop(); - ui_vp_effect->stop(); - ui_vp_message->hide(); - ui_vp_chatbox->hide(); + ui_vp_sideplayer_char->stop(); + ui_vp_effect->stop(); + ui_vp_message->hide(); + ui_vp_chatbox->hide(); - //Stop the chat arrow from animating - ui_vp_chat_arrow->stop(); + //Stop the chat arrow from animating + ui_vp_chat_arrow->stop(); - text_state = 2; - anim_state = 3; - ui_vp_objection->stop(); - chat_tick_timer->stop(); - ui_vp_evidence_display->reset(); - set_scene(QString::number(ao_app->get_desk_mod(current_char, current_emote)), current_side); - } + text_state = 2; + anim_state = 3; + ui_vp_objection->stop(); + chat_tick_timer->stop(); + ui_vp_evidence_display->reset(); + set_scene(QString::number(ao_app->get_desk_mod(current_char, current_emote)), current_side); + } } void Courtroom::set_side(QString p_side) { - if (p_side == "") - current_side = ao_app->get_char_side(current_char); - else - current_side = p_side; + if (p_side == "") + current_side = ao_app->get_char_side(current_char); + else + current_side = p_side; - for (int i = 0; i < ui_pos_dropdown->count(); ++i) - { - QString pos = ui_pos_dropdown->itemText(i); - if (pos == current_side) - { - //Block the signals to prevent setCurrentIndex from triggering a pos change - ui_pos_dropdown->blockSignals(true); + for (int i = 0; i < ui_pos_dropdown->count(); ++i) { + QString pos = ui_pos_dropdown->itemText(i); + if (pos == current_side) { + //Block the signals to prevent setCurrentIndex from triggering a pos change + ui_pos_dropdown->blockSignals(true); - //Set the index on dropdown ui element to let you know what pos you're on right now - ui_pos_dropdown->setCurrentIndex(i); + //Set the index on dropdown ui element to let you know what pos you're on right now + ui_pos_dropdown->setCurrentIndex(i); - //Unblock the signals so the element can be used for setting pos again - ui_pos_dropdown->blockSignals(false); + //Unblock the signals so the element can be used for setting pos again + ui_pos_dropdown->blockSignals(false); - //alright we dun, jobs done here boyos - break; + //alright we dun, jobs done here boyos + break; + } } - } } void Courtroom::set_pos_dropdown(QStringList pos_dropdowns) { - //Block the signals to prevent setCurrentIndex from triggering a pos change - ui_pos_dropdown->blockSignals(true); - pos_dropdown_list = pos_dropdowns; - ui_pos_dropdown->clear(); - ui_pos_dropdown->addItems(pos_dropdown_list); - //Unblock the signals so the element can be used for setting pos again - ui_pos_dropdown->blockSignals(false); + //Block the signals to prevent setCurrentIndex from triggering a pos change + ui_pos_dropdown->blockSignals(true); + pos_dropdown_list = pos_dropdowns; + ui_pos_dropdown->clear(); + ui_pos_dropdown->addItems(pos_dropdown_list); + //Unblock the signals so the element can be used for setting pos again + ui_pos_dropdown->blockSignals(false); - qDebug() << pos_dropdown_list; + qDebug() << pos_dropdown_list; } void Courtroom::update_character(int p_cid) { - bool newchar = m_cid != p_cid; - - m_cid = p_cid; - - 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_side = ao_app->get_char_side(current_char); - - current_emote_page = 0; - current_emote = 0; - - if (m_cid == -1) - ui_emotes->hide(); - else - ui_emotes->show(); - - refresh_emotes(); - set_emote_page(); - set_emote_dropdown(); - - set_sfx_dropdown(); - set_effects_dropdown(); - - qDebug() << "update_character called"; - if (newchar) //Avoid infinite loop of death and suffering - set_iniswap_dropdown(); - - if (current_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 && file_exists(ao_app->get_image_suffix(ao_app->get_character_path(current_char, "custom")))) - ui_custom_objection->show(); - else - ui_custom_objection->hide(); - - ui_char_select_background->hide(); - ui_ic_chat_message->setEnabled(m_cid != -1); - ui_ic_chat_message->setFocus(); + bool newchar = m_cid != p_cid; + + m_cid = p_cid; + + 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_side = ao_app->get_char_side(current_char); + + current_emote_page = 0; + current_emote = 0; + + if (m_cid == -1) + ui_emotes->hide(); + else + ui_emotes->show(); + + refresh_emotes(); + set_emote_page(); + set_emote_dropdown(); + + set_sfx_dropdown(); + set_effects_dropdown(); + + qDebug() << "update_character called"; + if (newchar) //Avoid infinite loop of death and suffering + set_iniswap_dropdown(); + + if (current_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 && file_exists(ao_app->get_image_suffix(ao_app->get_character_path(current_char, "custom")))) + ui_custom_objection->show(); + else + ui_custom_objection->hide(); + + ui_char_select_background->hide(); + ui_ic_chat_message->setEnabled(m_cid != -1); + ui_ic_chat_message->setFocus(); } void Courtroom::enter_courtroom() { - set_widgets(); + set_widgets(); - current_evidence_page = 0; - current_evidence = 0; + current_evidence_page = 0; + current_evidence = 0; - set_evidence_page(); + set_evidence_page(); - if (ao_app->flipping_enabled) - ui_flip->show(); - else - ui_flip->hide(); + if (ao_app->flipping_enabled) + ui_flip->show(); + else + ui_flip->hide(); - if (ao_app->additive_enabled) - ui_additive->show(); - else - ui_additive->hide(); + if (ao_app->additive_enabled) + ui_additive->show(); + else + ui_additive->hide(); - if (ao_app->casing_alerts_enabled) - ui_casing->show(); - else - ui_casing->hide(); + if (ao_app->casing_alerts_enabled) + ui_casing->show(); + else + ui_casing->hide(); - list_music(); - list_areas(); + list_music(); + list_areas(); - music_player->set_volume(ui_music_slider->value(), 0); //set music - //Set the ambience and other misc. music layers - for (int i = 1; i < music_player->m_channelmax; ++i) - { - music_player->set_volume(ui_sfx_slider->value(), i); - } - sfx_player->set_volume(ui_sfx_slider->value()); - objection_player->set_volume(ui_sfx_slider->value()); - blip_player->set_volume(ui_blip_slider->value()); + music_player->set_volume(ui_music_slider->value(), 0); //set music + //Set the ambience and other misc. music layers + for (int i = 1; i < music_player->m_channelmax; ++i) { + music_player->set_volume(ui_sfx_slider->value(), i); + } + sfx_player->set_volume(ui_sfx_slider->value()); + objection_player->set_volume(ui_sfx_slider->value()); + blip_player->set_volume(ui_blip_slider->value()); - ui_vp_testimony->stop(); - //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); + ui_vp_testimony->stop(); + //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); } //Todo: multithread this due to some servers having large as hell music list void Courtroom::list_music() { - ui_music_list->clear(); -// ui_music_search->setText(""); + ui_music_list->clear(); + // ui_music_search->setText(""); - QString f_file = "courtroom_design.ini"; + 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)); + 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; + 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_listname = i_song.left(i_song.lastIndexOf(".")); - i_song_listname = i_song_listname.right(i_song_listname.length() - (i_song_listname.lastIndexOf("/") + 1)); + 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)); - QTreeWidgetItem *treeItem; - if (i_song_listname != i_song && parent != nullptr) //not a category, parent exists - treeItem = new QTreeWidgetItem(parent); - else - treeItem = new QTreeWidgetItem(ui_music_list); - treeItem->setText(0, i_song_listname); - treeItem->setText(1, i_song); + QTreeWidgetItem *treeItem; + if (i_song_listname != i_song && parent != nullptr) //not a category, parent exists + treeItem = new QTreeWidgetItem(parent); + else + 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); + 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 (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; - } + 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 - if (ui_music_search->text() != "") - { - on_music_search_edited(ui_music_search->text()); - } + ui_music_list->expandAll(); //Needs to somehow remember which categories were expanded/collapsed if the music list didn't change since last time + if (ui_music_search->text() != "") { + on_music_search_edited(ui_music_search->text()); + } } //Todo: multithread this due to some servers having large as hell area list void Courtroom::list_areas() { - ui_area_list->clear(); -// ui_music_search->setText(""); + ui_area_list->clear(); + // ui_music_search->setText(""); - QString f_file = "courtroom_design.ini"; + 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)); + 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; + int n_listed_areas = 0; - for (int n_area = 0 ; n_area < area_list.size() ; ++n_area) - { - QString i_area = ""; - i_area.append(area_list.at(n_area)); + for (int n_area = 0; n_area < area_list.size(); ++n_area) { + QString i_area = ""; + i_area.append(area_list.at(n_area)); - if (ao_app->arup_enabled) - { - i_area.prepend("[" + QString::number(n_area) + "] "); //Give it the index + if (ao_app->arup_enabled) { + i_area.prepend("[" + QString::number(n_area) + "] "); //Give it the index - i_area.append("\n "); + 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(arup_statuses.at(n_area)); + i_area.append(" | CM: "); + i_area.append(arup_cms.at(n_area)); - i_area.append("\n "); + i_area.append("\n "); - i_area.append(QString::number(arup_players.at(n_area))); - i_area.append(" users | "); + i_area.append(QString::number(arup_players.at(n_area))); + i_area.append(" users | "); - i_area.append(arup_locks.at(n_area)); - } + i_area.append(arup_locks.at(n_area)); + } - QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_area_list); - treeItem->setText(0, area_list.at(n_area)); - treeItem->setText(1, i_area); + QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_area_list); + treeItem->setText(0, area_list.at(n_area)); + treeItem->setText(1, i_area); - if (ao_app->arup_enabled) - { - // Coloring logic here. - treeItem->setBackground(1, free_brush); - if (arup_locks.at(n_area) == "LOCKED") - { - treeItem->setBackground(1, locked_brush); - } - else - { - if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") - treeItem->setBackground(1, lfp_brush); - else if (arup_statuses.at(n_area) == "CASING") - treeItem->setBackground(1, casing_brush); - else if (arup_statuses.at(n_area) == "RECESS") - treeItem->setBackground(1, recess_brush); - else if (arup_statuses.at(n_area) == "RP") - treeItem->setBackground(1, rp_brush); - else if (arup_statuses.at(n_area) == "GAMING") - treeItem->setBackground(1, gaming_brush); - } - } - else - { - treeItem->setBackground(1, free_brush); - } + if (ao_app->arup_enabled) { + // Coloring logic here. + treeItem->setBackground(1, free_brush); + if (arup_locks.at(n_area) == "LOCKED") { + treeItem->setBackground(1, locked_brush); + } + else { + if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") + treeItem->setBackground(1, lfp_brush); + else if (arup_statuses.at(n_area) == "CASING") + treeItem->setBackground(1, casing_brush); + else if (arup_statuses.at(n_area) == "RECESS") + treeItem->setBackground(1, recess_brush); + else if (arup_statuses.at(n_area) == "RP") + treeItem->setBackground(1, rp_brush); + else if (arup_statuses.at(n_area) == "GAMING") + treeItem->setBackground(1, gaming_brush); + } + } + else { + treeItem->setBackground(1, free_brush); + } - ++n_listed_areas; - } + ++n_listed_areas; + } - if (ui_music_search->text() != "") - { - on_music_search_edited(ui_music_search->text()); - } + if (ui_music_search->text() != "") { + on_music_search_edited(ui_music_search->text()); + } } void Courtroom::append_ms_chatmessage(QString f_name, QString f_message) { - ui_ms_chatlog->append_chatmessage(f_name, f_message, ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini").name()); + ui_ms_chatlog->append_chatmessage(f_name, f_message, ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini").name()); } void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QString p_color) { - QString color = "#000000"; + QString color = "#000000"; - if (p_color == "0") - color = ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini").name(); - if (p_color == "1") - color = ao_app->get_color("server_chatlog_sender_color", "courtroom_fonts.ini").name(); - if(p_message == "Logged in as a moderator.") - { - ui_guard->show(); - append_server_chatmessage("CLIENT", "You were granted the Disable Modcalls button.", "1"); - } + if (p_color == "0") + color = ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini").name(); + if (p_color == "1") + color = ao_app->get_color("server_chatlog_sender_color", "courtroom_fonts.ini").name(); + if (p_message == "Logged in as a moderator.") { + ui_guard->show(); + append_server_chatmessage("CLIENT", "You were granted the Disable Modcalls button.", "1"); + } - ui_server_chatlog->append_chatmessage(p_name, p_message, color); + ui_server_chatlog->append_chatmessage(p_name, p_message, color); } 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; - - if (current_side == "") - current_side = ao_app->get_char_side(current_char); + if (ui_ic_chat_message->text() == "" || is_muted) + return; - QString f_desk_mod = "chat"; + if ((anim_state < 3 || text_state < 2) && + objection_state == 0) + return; - 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"; - } + //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; + + if (current_side == "") + current_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(f_desk_mod); - packet_contents.append(ao_app->get_pre_emote(current_char, current_emote)); + packet_contents.append(ao_app->get_pre_emote(current_char, current_emote)); - packet_contents.append(current_char); + packet_contents.append(current_char); - packet_contents.append(ao_app->get_emote(current_char, current_emote)); + packet_contents.append(ao_app->get_emote(current_char, current_emote)); - packet_contents.append(ui_ic_chat_message->text()); + packet_contents.append(ui_ic_chat_message->text()); - packet_contents.append(current_side); + packet_contents.append(current_side); - packet_contents.append(get_char_sfx()); - if (ui_pre->isChecked() && !ao_app->is_stickysounds_enabled()) - { - ui_sfx_dropdown->blockSignals(true); - ui_sfx_dropdown->setCurrentIndex(0); - ui_sfx_dropdown->blockSignals(false); - ui_sfx_remove->hide(); - } + packet_contents.append(get_char_sfx()); + if (ui_pre->isChecked() && !ao_app->is_stickysounds_enabled()) { + ui_sfx_dropdown->blockSignals(true); + ui_sfx_dropdown->setCurrentIndex(0); + ui_sfx_dropdown->blockSignals(false); + ui_sfx_remove->hide(); + } - int f_emote_mod = ao_app->get_emote_mod(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 == 4 || f_emote_mod == 5) - 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(get_char_sfx_delay())); - - QString f_obj_state; - - if ((objection_state == 4 && !ao_app->custom_objection_enabled) || - (objection_state < 0)) - f_obj_state = "0"; - 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); + //needed or else legacy won't understand what we're saying + if (objection_state > 0) { + if (ui_pre->isChecked()) { + if (f_emote_mod == 4 || f_emote_mod == 5) + 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(f_flip); + packet_contents.append(QString::number(f_emote_mod)); + packet_contents.append(QString::number(m_cid)); - packet_contents.append(QString::number(realization_state)); + packet_contents.append(QString::number(get_char_sfx_delay())); - QString f_text_color; + QString f_obj_state; - if (text_color < 0) - f_text_color = "0"; - else if (text_color > max_colors) - f_text_color = "0"; - else - f_text_color = QString::number(text_color); + if ((objection_state == 4 && !ao_app->custom_objection_enabled) || + (objection_state < 0)) + f_obj_state = "0"; + else + f_obj_state = QString::number(objection_state); - packet_contents.append(f_text_color); + packet_contents.append(f_obj_state); - // 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()); - } + 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(""); - } + packet_contents.append("0"); - // 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) - { - QString packet = QString::number(other_charid); - if (ao_app->effects_enabled) //Only servers with effects enabled will support pair reordering - packet += "^" + QString::number(pair_order); - packet_contents.append(packet); + QString f_flip; + + if (ao_app->flipping_enabled) { + if (ui_flip->isChecked()) + f_flip = "1"; + else + f_flip = "0"; } else - { - packet_contents.append("-1"); - } - //Send the offset as it's gonna be used regardless - packet_contents.append(QString::number(char_offset)); + f_flip = QString::number(m_cid); - // 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"); - } + 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 > max_colors) + f_text_color = "0"; else - { - packet_contents.append("0"); - } - } + f_text_color = QString::number(text_color); - // 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("0"); //ao_app->get_sfx_looping(current_char, current_emote)); - packet_contents.append(QString::number(screenshake_state)); + packet_contents.append(f_text_color); - QString pre_emote = ao_app->get_pre_emote(current_char, current_emote); - QString emote = ao_app->get_emote(current_char, current_emote); - QStringList emotes_to_check = {pre_emote, "(b)" + emote, "(a)" + emote}; - QStringList effects_to_check = {"_FrameScreenshake", "_FrameRealization", "_FrameSFX"}; + // 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(""); + } - foreach (QString f_effect, effects_to_check) - { - QString packet; - foreach (QString f_emote, emotes_to_check) - { - packet += f_emote; - if (ao_app->is_frame_network_enabled()) - { - QString sfx_frames = ao_app->read_ini_tags(ao_app->get_character_path(current_char, "char.ini"), f_emote.append(f_effect)).join("|"); - if (sfx_frames != "") - packet += "|" + sfx_frames; - } - packet += "^"; + // 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) { + QString packet = QString::number(other_charid); + if (ao_app->effects_enabled) //Only servers with effects enabled will support pair reordering + packet += "^" + QString::number(pair_order); + packet_contents.append(packet); + } + else { + packet_contents.append("-1"); + } + //Send the offset as it's gonna be used regardless + packet_contents.append(QString::number(char_offset)); + + // 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("0"); //ao_app->get_sfx_looping(current_char, current_emote)); + packet_contents.append(QString::number(screenshake_state)); + + QString pre_emote = ao_app->get_pre_emote(current_char, current_emote); + QString emote = ao_app->get_emote(current_char, current_emote); + QStringList emotes_to_check = {pre_emote, "(b)" + emote, "(a)" + emote}; + QStringList effects_to_check = {"_FrameScreenshake", "_FrameRealization", "_FrameSFX"}; + + foreach (QString f_effect, effects_to_check) { + QString packet; + foreach (QString f_emote, emotes_to_check) { + packet += f_emote; + if (ao_app->is_frame_network_enabled()) { + QString sfx_frames = ao_app->read_ini_tags(ao_app->get_character_path(current_char, "char.ini"), f_emote.append(f_effect)).join("|"); + if (sfx_frames != "") + packet += "|" + sfx_frames; + } + packet += "^"; + } + packet_contents.append(packet); + } + } + + if (ao_app->additive_enabled) { + packet_contents.append(ui_additive->isChecked() ? "1" : "0"); + } + if (ao_app->effects_enabled) { + QString fx_sound = ao_app->get_effect_sound(effect, current_char); + QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); + packet_contents.append(effect + "|" + p_effect + "|" + fx_sound); + if (!ao_app->is_stickyeffects_enabled()) { + ui_effects_dropdown->blockSignals(true); + ui_effects_dropdown->setCurrentIndex(0); + ui_effects_dropdown->blockSignals(false); + effect = ""; } - packet_contents.append(packet); - } - } - - if (ao_app->additive_enabled) - { - packet_contents.append(ui_additive->isChecked() ? "1" : "0"); - } - if (ao_app->effects_enabled) - { - QString fx_sound = ao_app->get_effect_sound(effect, current_char); - QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); - packet_contents.append(effect + "|" + p_effect + "|" + fx_sound); - if (!ao_app->is_stickyeffects_enabled()) - { - ui_effects_dropdown->blockSignals(true); - ui_effects_dropdown->setCurrentIndex(0); - ui_effects_dropdown->blockSignals(false); - effect = ""; } - } - ao_app->send_server_packet(new AOPacket("MS", packet_contents)); + 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 (f_char_id > 0 && (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]; - } - - if(f_showname.trimmed().isEmpty()) //Pure whitespace showname, get outta here. - f_showname = m_chatmessage[CHAR_NAME]; - - - QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n'; - //Remove undesired newline chars - m_chatmessage[MESSAGE].remove("\n"); - chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; - - if (f_char_id >= 0 && !chatmessage_is_empty && f_message == previous_ic_message) //Not a system message - return; - - if (f_char_id <= -1) - previous_ic_message = ""; //System messages don't care about repeating themselves - else - previous_ic_message = f_message; - - //Stop the chat arrow from animating - ui_vp_chat_arrow->stop(); - - text_state = 0; - anim_state = 0; - ui_vp_objection->stop(); - chat_tick_timer->stop(); - ui_vp_evidence_display->reset(); - - //Hey, our message showed up! Cool! - if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text().remove("\n") && m_chatmessage[CHAR_ID].toInt() == m_cid) - { - ui_ic_chat_message->clear(); - if (ui_additive->isChecked()) - ui_ic_chat_message->insert(" "); - objection_state = 0; - realization_state = 0; - screenshake_state = 0; - is_presenting_evidence = false; - if (!ao_app->is_stickypres_enabled()) - ui_pre->setChecked(false); - ui_hold_it->set_image("holdit"); - ui_objection->set_image("objection"); - ui_take_that->set_image("takethat"); - ui_custom_objection->set_image("custom"); - ui_realization->set_image("realization"); - ui_screenshake->set_image("screenshake"); - ui_evidence_present->set_image("present"); - } - - //Let the server handle actually checking if they're allowed to do this. - is_additive = m_chatmessage[ADDITIVE].toInt() == 1; + // 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; - QString f_charname = ""; - if (f_char_id >= 0) - f_charname = ao_app->get_showname(char_list.at(f_char_id).name); + for (int n_string = 0; n_string < chatmessage_size; ++n_string) { + //m_chatmessage[n_string] = p_contents->at(n_string); - chatlogpiece* temp = new chatlogpiece(f_charname, f_showname, m_chatmessage[MESSAGE], false); - ic_chatlog_history.append(*temp); - ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); + // 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] = ""; + } + } - while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) - { - ic_chatlog_history.removeFirst(); - } + int f_char_id = m_chatmessage[CHAR_ID].toInt(); - append_ic_text(m_chatmessage[MESSAGE], f_showname); + if (f_char_id >= 0 && f_char_id >= char_list.size()) + return; - int objection_mod = m_chatmessage[OBJECTION_MOD].toInt(); - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_custom_theme = ao_app->get_char_shouts(f_char); + if (mute_map.value(m_chatmessage[CHAR_ID].toInt())) + return; - //if an objection is used - if (objection_mod <= 4 && objection_mod >= 1) - { - switch (objection_mod) - { - case 1: - ui_vp_objection->play("holdit_bubble", f_char, f_custom_theme, 724); - objection_player->play("holdit", f_char, f_custom_theme); - break; - case 2: - ui_vp_objection->play("objection_bubble", f_char, f_custom_theme, 724); - objection_player->play("objection", f_char, f_custom_theme); - if(ao_app->objection_stop_music()) - music_player->stop(); - break; - case 3: - ui_vp_objection->play("takethat_bubble", f_char, f_custom_theme, 724); - objection_player->play("takethat", f_char, f_custom_theme); - break; - //case 4 is AO2 only - case 4: - ui_vp_objection->play("custom", f_char, f_custom_theme, 724); - objection_player->play("custom", f_char, f_custom_theme); - break; - default: - qDebug() << "W: Logic error in objection switch statement!"; + QString f_showname; + if (f_char_id > 0 && (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]; } - sfx_player->clear(); //Objection played! Cut all sfx. - int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); - if (emote_mod == 0) - m_chatmessage[EMOTE_MOD] = 1; - } - else - handle_chatmessage_2(); -} + if (f_showname.trimmed().isEmpty()) //Pure whitespace showname, get outta here. + f_showname = m_chatmessage[CHAR_NAME]; + + QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n'; + //Remove undesired newline chars + m_chatmessage[MESSAGE].remove("\n"); + chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; + + if (f_char_id >= 0 && !chatmessage_is_empty && f_message == previous_ic_message) //Not a system message + return; + + if (f_char_id <= -1) + previous_ic_message = ""; //System messages don't care about repeating themselves + else + previous_ic_message = f_message; + + //Stop the chat arrow from animating + ui_vp_chat_arrow->stop(); + + text_state = 0; + anim_state = 0; + ui_vp_objection->stop(); + chat_tick_timer->stop(); + ui_vp_evidence_display->reset(); + + //Hey, our message showed up! Cool! + if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text().remove("\n") && m_chatmessage[CHAR_ID].toInt() == m_cid) { + ui_ic_chat_message->clear(); + if (ui_additive->isChecked()) + ui_ic_chat_message->insert(" "); + objection_state = 0; + realization_state = 0; + screenshake_state = 0; + is_presenting_evidence = false; + if (!ao_app->is_stickypres_enabled()) + ui_pre->setChecked(false); + ui_hold_it->set_image("holdit"); + ui_objection->set_image("objection"); + ui_take_that->set_image("takethat"); + ui_custom_objection->set_image("custom"); + ui_realization->set_image("realization"); + ui_screenshake->set_image("screenshake"); + ui_evidence_present->set_image("present"); + } + + //Let the server handle actually checking if they're allowed to do this. + is_additive = m_chatmessage[ADDITIVE].toInt() == 1; + + QString f_charname = ""; + if (f_char_id >= 0) + f_charname = ao_app->get_showname(char_list.at(f_char_id).name); + + chatlogpiece *temp = new chatlogpiece(f_charname, f_showname, m_chatmessage[MESSAGE], false); + ic_chatlog_history.append(*temp); + ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); + + while (ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) { + ic_chatlog_history.removeFirst(); + } + + append_ic_text(m_chatmessage[MESSAGE], f_showname); + + int objection_mod = m_chatmessage[OBJECTION_MOD].toInt(); + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_custom_theme = ao_app->get_char_shouts(f_char); + + //if an objection is used + if (objection_mod <= 4 && objection_mod >= 1) { + switch (objection_mod) { + case 1: + ui_vp_objection->play("holdit_bubble", f_char, f_custom_theme, 724); + objection_player->play("holdit", f_char, f_custom_theme); + break; + case 2: + ui_vp_objection->play("objection_bubble", f_char, f_custom_theme, 724); + objection_player->play("objection", f_char, f_custom_theme); + if (ao_app->objection_stop_music()) + music_player->stop(); + break; + case 3: + ui_vp_objection->play("takethat_bubble", f_char, f_custom_theme, 724); + objection_player->play("takethat", f_char, f_custom_theme); + break; + //case 4 is AO2 only + case 4: + ui_vp_objection->play("custom", f_char, f_custom_theme, 724); + objection_player->play("custom", f_char, f_custom_theme); + break; + default: + qDebug() << "W: Logic error in objection switch statement!"; + } + sfx_player->clear(); //Objection played! Cut all sfx. + 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(); + handle_chatmessage_2(); } void Courtroom::handle_chatmessage_2() { - ui_vp_speedlines->stop(); - ui_vp_player_char->stop(); - ui_vp_effect->stop(); - //Clear all looping sfx to prevent obnoxiousness - sfx_player->loop_clear(); - - if (!m_chatmessage[FRAME_SFX].isEmpty() && ao_app->is_frame_network_enabled()) - { - //ORDER IS IMPORTANT!! - QStringList netstrings = {m_chatmessage[FRAME_SCREENSHAKE], m_chatmessage[FRAME_REALIZATION], m_chatmessage[FRAME_SFX]}; - ui_vp_player_char->network_strings = netstrings; - } - else - ui_vp_player_char->network_strings.clear(); - - int f_charid = m_chatmessage[CHAR_ID].toInt(); - if (f_charid >= 0 && (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())) - { - QString real_name = char_list.at(f_charid).name; - - QString f_showname = ao_app->get_showname(real_name); - - ui_vp_showname->setText(f_showname); - } - else - { - ui_vp_showname->setText(m_chatmessage[SHOWNAME]); - } - - if(ui_vp_showname->text().trimmed().isEmpty()) //Whitespace showname - { - ui_vp_chatbox->set_image("chatblank"); - } - else //Aw yeah dude do some showname resizing magic - { - if (!ui_vp_chatbox->set_image("chat")) - ui_vp_chatbox->set_image("chatbox"); - - QFontMetrics fm(ui_vp_showname->font()); - int fm_width=fm.horizontalAdvance(ui_vp_showname->text()); - - QString chatbox_path = ao_app->get_theme_path("chat"); - QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); - if (chatbox != "") - { - chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat"; - if (!ui_vp_chatbox->set_chatbox(chatbox_path)) - ui_vp_chatbox->set_chatbox(chatbox_path + "box"); + ui_vp_speedlines->stop(); + ui_vp_player_char->stop(); + ui_vp_effect->stop(); + //Clear all looping sfx to prevent obnoxiousness + sfx_player->loop_clear(); - pos_size_type design_ini_result = ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); - if (design_ini_result.width < 0 || design_ini_result.height < 0) - { - qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; - ui_vp_chat_arrow->hide(); - } - else - { - ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); - ui_vp_chat_arrow->combo_resize(design_ini_result.width, design_ini_result.height); - } + if (!m_chatmessage[FRAME_SFX].isEmpty() && ao_app->is_frame_network_enabled()) { + //ORDER IS IMPORTANT!! + QStringList netstrings = {m_chatmessage[FRAME_SCREENSHAKE], m_chatmessage[FRAME_REALIZATION], m_chatmessage[FRAME_SFX]}; + ui_vp_player_char->network_strings = netstrings; } + else + ui_vp_player_char->network_strings.clear(); - pos_size_type default_width = ao_app->get_element_dimensions("showname", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); - int extra_width = ao_app->get_design_element("showname_extra_width", "courtroom_design.ini", m_chatmessage[CHAR_NAME]).toInt(); + int f_charid = m_chatmessage[CHAR_ID].toInt(); + if (f_charid >= 0 && (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())) { + QString real_name = char_list.at(f_charid).name; + + QString f_showname = ao_app->get_showname(real_name); + + ui_vp_showname->setText(f_showname); + } + else { + ui_vp_showname->setText(m_chatmessage[SHOWNAME]); + } - if(extra_width > 0) + if (ui_vp_showname->text().trimmed().isEmpty()) //Whitespace showname { - if (fm_width > default_width.width && ui_vp_chatbox->set_chatbox(chatbox_path + "med")) //This text be big. Let's do some shenanigans. - { - ui_vp_showname->resize(default_width.width+extra_width, ui_vp_showname->height()); - if (fm_width > ui_vp_showname->width() && ui_vp_chatbox->set_chatbox(chatbox_path + "big")) //Biggest possible size for us. - { - ui_vp_showname->resize(static_cast(default_width.width+(extra_width*2)), ui_vp_showname->height()); - } - } - else - ui_vp_showname->resize(default_width.width, ui_vp_showname->height()); - } - } - - ui_vp_message->hide(); - ui_vp_chatbox->hide(); - - //todo: put this in its own function or update - QString design_file = "courtroom_fonts.ini"; - int f_pointsize = ao_app->get_font_size("message", design_file); - QString font_name = ao_app->get_font_name("message_font", design_file); - QColor f_color = ao_app->get_color("message_color", design_file); - bool bold = ao_app->get_font_size("message_bold", design_file) == 1; // is the font bold or not? - bool antialias = ao_app->get_font_size("message_sharp", design_file) != 1; // is the font anti-aliased or not? - - QString chatfont = ao_app->get_chat_font(m_chatmessage[CHAR_NAME]); - if (chatfont != "") - font_name = chatfont; - - int chatsize = ao_app->get_chat_size(m_chatmessage[CHAR_NAME]); - if (chatsize != -1) - f_pointsize = chatsize; - this->set_qfont(ui_vp_message, "", get_qfont(font_name, f_pointsize, antialias), f_color, bold); - - set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); - - 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]; - - // Making the second character appear. - if (m_chatmessage[OTHER_CHARID].isEmpty()) - { - // If there is no second character, hide 'em - ui_vp_sideplayer_char->stop(); - ui_vp_sideplayer_char->move(0,0); - } - else - { - bool ok; - int got_other_charid = m_chatmessage[OTHER_CHARID].split("^")[0].toInt(&ok); - if (ok) + ui_vp_chatbox->set_image("chatblank"); + } + else //Aw yeah dude do some showname resizing magic { - if (got_other_charid > -1) - { - // If there is, show them! - ui_vp_sideplayer_char->show(); + if (!ui_vp_chatbox->set_image("chat")) + ui_vp_chatbox->set_image("chatbox"); + + QFontMetrics fm(ui_vp_showname->font()); + int fm_width = fm.horizontalAdvance(ui_vp_showname->text()); + + QString chatbox_path = ao_app->get_theme_path("chat"); + QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); + if (chatbox != "") { + chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat"; + if (!ui_vp_chatbox->set_chatbox(chatbox_path)) + ui_vp_chatbox->set_chatbox(chatbox_path + "box"); + + pos_size_type design_ini_result = ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); + if (design_ini_result.width < 0 || design_ini_result.height < 0) { + qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; + ui_vp_chat_arrow->hide(); + } + else { + ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); + ui_vp_chat_arrow->combo_resize(design_ini_result.width, design_ini_result.height); + } + } - int other_offset = m_chatmessage[OTHER_OFFSET].toInt(); - ui_vp_sideplayer_char->move(ui_viewport->width() * other_offset / 100, 0); + pos_size_type default_width = ao_app->get_element_dimensions("showname", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); + int extra_width = ao_app->get_design_element("showname_extra_width", "courtroom_design.ini", m_chatmessage[CHAR_NAME]).toInt(); - QStringList args = m_chatmessage[OTHER_CHARID].split("^"); - if (args.size() > 1) //This ugly workaround is so we don't make an extra packet just for this purpose. Rewrite pairing when? - { - //Change the order of appearance based on the pair order variable - int order = args.at(1).toInt(); - switch (order) { - case 0: - ui_vp_sideplayer_char->stackUnder(ui_vp_player_char); - break; - case 1: - ui_vp_player_char->stackUnder(ui_vp_sideplayer_char); - break; - default: - break; - } + if (extra_width > 0) { + if (fm_width > default_width.width && ui_vp_chatbox->set_chatbox(chatbox_path + "med")) //This text be big. Let's do some shenanigans. + { + ui_vp_showname->resize(default_width.width + extra_width, ui_vp_showname->height()); + if (fm_width > ui_vp_showname->width() && ui_vp_chatbox->set_chatbox(chatbox_path + "big")) //Biggest possible size for us. + { + ui_vp_showname->resize(static_cast(default_width.width + (extra_width * 2)), ui_vp_showname->height()); + } + } + else + ui_vp_showname->resize(default_width.width, ui_vp_showname->height()); } + } - // 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]); - } - else - { - // If the server understands other characters, but there - // really is no second character, hide 'em, and center the first. - ui_vp_sideplayer_char->hide(); - ui_vp_sideplayer_char->move(0,0); - } - } - } - //Set ourselves according to SELF_OFFSET - - bool ok; - int self_offset = m_chatmessage[SELF_OFFSET].toInt(&ok); - if (ok) - ui_vp_player_char->move(ui_viewport->width() * self_offset / 100, 0); - else - ui_vp_player_char->move(0, 0); + ui_vp_message->hide(); + ui_vp_chatbox->hide(); + + //todo: put this in its own function or update + QString design_file = "courtroom_fonts.ini"; + int f_pointsize = ao_app->get_font_size("message", design_file); + QString font_name = ao_app->get_font_name("message_font", design_file); + QColor f_color = ao_app->get_color("message_color", design_file); + bool bold = ao_app->get_font_size("message_bold", design_file) == 1; // is the font bold or not? + bool antialias = ao_app->get_font_size("message_sharp", design_file) != 1; // is the font anti-aliased or not? + + QString chatfont = ao_app->get_chat_font(m_chatmessage[CHAR_NAME]); + if (chatfont != "") + font_name = chatfont; + + int chatsize = ao_app->get_chat_size(m_chatmessage[CHAR_NAME]); + if (chatsize != -1) + f_pointsize = chatsize; + this->set_qfont(ui_vp_message, "", get_qfont(font_name, f_pointsize, antialias), f_color, bold); + + set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); + + 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]; + + // Making the second character appear. + if (m_chatmessage[OTHER_CHARID].isEmpty()) { + // If there is no second character, hide 'em + ui_vp_sideplayer_char->stop(); + ui_vp_sideplayer_char->move(0, 0); + } + else { + bool ok; + int got_other_charid = m_chatmessage[OTHER_CHARID].split("^")[0].toInt(&ok); + if (ok) { + if (got_other_charid > -1) { + // If there is, show them! + ui_vp_sideplayer_char->show(); + + int other_offset = m_chatmessage[OTHER_OFFSET].toInt(); + ui_vp_sideplayer_char->move(ui_viewport->width() * other_offset / 100, 0); + + QStringList args = m_chatmessage[OTHER_CHARID].split("^"); + if (args.size() > 1) //This ugly workaround is so we don't make an extra packet just for this purpose. Rewrite pairing when? + { + //Change the order of appearance based on the pair order variable + int order = args.at(1).toInt(); + switch (order) { + case 0: + ui_vp_sideplayer_char->stackUnder(ui_vp_player_char); + break; + case 1: + ui_vp_player_char->stackUnder(ui_vp_sideplayer_char); + break; + default: + break; + } + } + + // 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]); + } + else { + // If the server understands other characters, but there + // really is no second character, hide 'em, and center the first. + ui_vp_sideplayer_char->hide(); + ui_vp_sideplayer_char->move(0, 0); + } + } + } + //Set ourselves according to SELF_OFFSET - 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(); + bool ok; + int self_offset = m_chatmessage[SELF_OFFSET].toInt(&ok); + if (ok) + ui_vp_player_char->move(ui_viewport->width() * self_offset / 100, 0); else - play_preanim(true); - break; - default: - qDebug() << "W: invalid emote mod: " << QString::number(emote_mod); - } + ui_vp_player_char->move(0, 0); + + 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::do_screenshake() { - if(!ao_app->is_shake_enabled()) - return; - - //This way, the animation is reset in such a way that last played screenshake would return to its "final frame" properly. - //This properly resets all UI elements without having to bother keeping track of "origin" positions. - //Works great wit the chat text being detached from the chat box! - screenshake_animation_group->setCurrentTime(screenshake_animation_group->duration()); - screenshake_animation_group->clear(); - - QList affected_list = { - ui_vp_background, - ui_vp_player_char, - ui_vp_sideplayer_char, - ui_vp_chatbox - }; - - //I would prefer if this was its own "shake" function to be honest. - foreach (QWidget* ui_element, affected_list) - { - QPropertyAnimation *screenshake_animation = new QPropertyAnimation(ui_element, "pos", this); - QPoint pos_default = QPoint(ui_element->x(), ui_element->y()); - - int duration = 300; //How long does the screenshake last - int frequency = 20; //How often in ms is there a "jolt" frame - int maxframes = duration/frequency; - int max_x = 7; //Max deviation from origin on x axis - int max_y = 7; //Max deviation from origin on y axis - screenshake_animation->setDuration(duration); - for (int frame=0; frame < maxframes; frame++) - { - double fraction = double(frame*frequency)/duration; - int rng = qrand();//QRandomGenerator::global()->generate(); - int rand_x = max_x - (int(rng) % (max_x*2)); - int rand_y = max_y - (int(rng+100) % (max_y*2)); - screenshake_animation->setKeyValueAt(fraction, QPoint(pos_default.x() + rand_x, pos_default.y() + rand_y)); + if (!ao_app->is_shake_enabled()) + return; + + //This way, the animation is reset in such a way that last played screenshake would return to its "final frame" properly. + //This properly resets all UI elements without having to bother keeping track of "origin" positions. + //Works great wit the chat text being detached from the chat box! + screenshake_animation_group->setCurrentTime(screenshake_animation_group->duration()); + screenshake_animation_group->clear(); + + QList affected_list = { + ui_vp_background, + ui_vp_player_char, + ui_vp_sideplayer_char, + ui_vp_chatbox}; + + //I would prefer if this was its own "shake" function to be honest. + foreach (QWidget *ui_element, affected_list) { + QPropertyAnimation *screenshake_animation = new QPropertyAnimation(ui_element, "pos", this); + QPoint pos_default = QPoint(ui_element->x(), ui_element->y()); + + int duration = 300; //How long does the screenshake last + int frequency = 20; //How often in ms is there a "jolt" frame + int maxframes = duration / frequency; + int max_x = 7; //Max deviation from origin on x axis + int max_y = 7; //Max deviation from origin on y axis + screenshake_animation->setDuration(duration); + for (int frame = 0; frame < maxframes; frame++) { + double fraction = double(frame * frequency) / duration; + int rng = qrand(); //QRandomGenerator::global()->generate(); + int rand_x = max_x - (int(rng) % (max_x * 2)); + int rand_y = max_y - (int(rng + 100) % (max_y * 2)); + screenshake_animation->setKeyValueAt(fraction, QPoint(pos_default.x() + rand_x, pos_default.y() + rand_y)); + } + screenshake_animation->setEndValue(pos_default); + screenshake_animation->setEasingCurve(QEasingCurve::Linear); + screenshake_animation_group->addAnimation(screenshake_animation); } - screenshake_animation->setEndValue(pos_default); - screenshake_animation->setEasingCurve(QEasingCurve::Linear); - screenshake_animation_group->addAnimation(screenshake_animation); - } - screenshake_animation_group->start(); + screenshake_animation_group->start(); } void Courtroom::do_flash() { - if(!ao_app->is_effects_enabled()) - return; + if (!ao_app->is_effects_enabled()) + return; - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_custom_theme = ao_app->get_char_shouts(f_char); - ui_vp_effect->play("realizationflash", f_char, f_custom_theme, 60); + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_custom_theme = ao_app->get_char_shouts(f_char); + ui_vp_effect->play("realizationflash", f_char, f_custom_theme, 60); } void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char, QString p_folder) { - QString effect = ao_app->get_effect(fx_name, p_char, p_folder); - if (effect == "") - return; + QString effect = ao_app->get_effect(fx_name, p_char, p_folder); + if (effect == "") + return; - if (fx_sound != "") - sfx_player->play(fx_sound); + if (fx_sound != "") + sfx_player->play(fx_sound); - //Only check if effects are disabled after playing the sound if it exists - if(!ao_app->is_effects_enabled()) - return; + //Only check if effects are disabled after playing the sound if it exists + if (!ao_app->is_effects_enabled()) + return; - ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping. Static effects will linger. - ui_vp_effect->play(effect); // It will set_play_once to true if the filepath provided is not designed to loop more than once + ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping. Static effects will linger. + ui_vp_effect->play(effect); // It will set_play_once to true if the filepath provided is not designed to loop more than once } void Courtroom::play_char_sfx(QString sfx_name) { - sfx_player->play(sfx_name); - if(ao_app->get_looping_sfx()) - sfx_player->set_looping(ao_app->get_sfx_looping(current_char, QString::number(current_emote))!="0"); + sfx_player->play(sfx_name); + if (ao_app->get_looping_sfx()) + sfx_player->set_looping(ao_app->get_sfx_looping(current_char, QString::number(current_emote)) != "0"); } void Courtroom::handle_chatmessage_3() { - start_chat_ticking(); - - int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt(); - QString f_side = m_chatmessage[SIDE]; - - QString f_showname; - int f_char_id = m_chatmessage[CHAR_ID].toInt(); - if (f_char_id > 0 && (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]; - } - if(f_showname.trimmed().isEmpty()) //Pure whitespace showname, get outta here. - f_showname = m_chatmessage[CHAR_NAME]; - - 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; - QString f_name = local_evidence_list.at(f_evi_id - 1).name; - //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()); - append_ic_text(f_name, f_showname, "has presented evidence"); - } - - 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(); + start_chat_ticking(); - // Since we're zooming, hide the second character, and centre the first. - ui_vp_sideplayer_char->hide(); - ui_vp_player_char->move(0,0); + int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt(); + QString f_side = m_chatmessage[SIDE]; - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_custom_theme = ao_app->get_char_shouts(f_char); - if (side == "pro" || - side == "hlp" || - side == "wit") - ui_vp_speedlines->play("prosecution_speedlines", f_char, f_custom_theme); - else - ui_vp_speedlines->play("defense_speedlines", f_char, f_custom_theme); + QString f_showname; + int f_char_id = m_chatmessage[CHAR_ID].toInt(); + if (f_char_id > 0 && (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]; + } + if (f_showname.trimmed().isEmpty()) //Pure whitespace showname, get outta here. + f_showname = m_chatmessage[CHAR_NAME]; + + 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; + QString f_name = local_evidence_list.at(f_evi_id - 1).name; + //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()); + append_ic_text(f_name, f_showname, "has presented evidence"); + } - } + int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); - //If this color is talking - color_is_talking = color_markdown_talking_list.at(m_chatmessage[TEXT_COLOR].toInt()); + QString side = m_chatmessage[SIDE]; - if (color_is_talking && text_state == 1 && anim_state < 2) //Set it to talking as we're not on that already - { - ui_vp_player_char->stop(); - ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - anim_state = 2; - } - else if (anim_state < 3) //Set it to idle as we're not on that already - { - ui_vp_player_char->stop(); - ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - anim_state = 3; - } + if (emote_mod == 5 || + emote_mod == 6) { + ui_vp_desk->hide(); + ui_vp_legacy_desk->hide(); - QString f_message = m_chatmessage[MESSAGE]; - QStringList call_words = ao_app->get_call_words(); + // Since we're zooming, hide the second character, and centre the first. + ui_vp_sideplayer_char->hide(); + ui_vp_player_char->move(0, 0); - 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); + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_custom_theme = ao_app->get_char_shouts(f_char); + if (side == "pro" || + side == "hlp" || + side == "wit") + ui_vp_speedlines->play("prosecution_speedlines", f_char, f_custom_theme); + else + ui_vp_speedlines->play("defense_speedlines", f_char, f_custom_theme); + } - break; + //If this color is talking + color_is_talking = color_markdown_talking_list.at(m_chatmessage[TEXT_COLOR].toInt()); + + if (color_is_talking && text_state == 1 && anim_state < 2) //Set it to talking as we're not on that already + { + ui_vp_player_char->stop(); + ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + anim_state = 2; } - } + else if (anim_state < 3) //Set it to idle as we're not on that already + { + ui_vp_player_char->stop(); + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[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 html, int target_pos, int default_color) { - QString p_text_escaped; + QString p_text_escaped; - int check_pos = 0; - int check_pos_escaped = 0; - bool ic_next_is_not_special = false; - std::stack ic_color_stack; + int check_pos = 0; + int check_pos_escaped = 0; + bool ic_next_is_not_special = false; + std::stack ic_color_stack; - //Text alignment shenanigans. Could make a dropdown for this later, too! - QString align; - if (p_text.trimmed().startsWith("~~")) - { - p_text.remove(p_text.indexOf("~~"), 2); - if (target_pos != -1) - { - target_pos = qMax(0, target_pos - 2); - } - align = "center"; - } - else if (p_text.trimmed().startsWith("~>")) - { - p_text.remove(p_text.indexOf("~>"), 2); - if (target_pos != -1) - { - target_pos = qMax(0, target_pos - 2); - } - align = "right"; - } - else if (p_text.trimmed().startsWith("<>")) - { - p_text.remove(p_text.indexOf("<>"), 2); - if (target_pos != -1) - { - target_pos = qMax(0, target_pos - 2); + //Text alignment shenanigans. Could make a dropdown for this later, too! + QString align; + if (p_text.trimmed().startsWith("~~")) { + p_text.remove(p_text.indexOf("~~"), 2); + if (target_pos != -1) { + target_pos = qMax(0, target_pos - 2); + } + align = "center"; + } + else if (p_text.trimmed().startsWith("~>")) { + p_text.remove(p_text.indexOf("~>"), 2); + if (target_pos != -1) { + target_pos = qMax(0, target_pos - 2); + } + align = "right"; + } + else if (p_text.trimmed().startsWith("<>")) { + p_text.remove(p_text.indexOf("<>"), 2); + if (target_pos != -1) { + target_pos = qMax(0, target_pos - 2); + } + align = "justify"; } - align = "justify"; - } - - //If html is enabled, prepare this text to be all ready for it. - if (html) - { - ic_color_stack.push(default_color); - QString appendage = ""; - - if (!align.isEmpty()) - appendage.prepend("

"); - - p_text_escaped.insert(check_pos_escaped, appendage); - check_pos_escaped += appendage.size(); - } - //Current issue: does not properly escape html stuff. - //Solution: probably parse p_text and export into a different string separately, perform some mumbo jumbo to properly adjust string indexes. - while (check_pos < p_text.size()) - { - QString f_rest = p_text.right(p_text.size() - check_pos); - QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); - QString f_character; - int f_char_length; + //If html is enabled, prepare this text to be all ready for it. + if (html) { + ic_color_stack.push(default_color); + QString appendage = ""; - tbf.toNextBoundary(); + if (!align.isEmpty()) + appendage.prepend("
"); - if (tbf.position() == -1) - f_character = f_rest; - else - f_character = f_rest.left(tbf.position()); - -// if (f_character == "&") //oh shit it's probably an escaped html -// { -// //Skip escaped chars like you would graphemes -// QRegularExpression re("&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});", QRegularExpression::CaseInsensitiveOption); -// QRegularExpressionMatch match = re.match(f_rest); -// if (match.hasMatch()) //OH SHIT IT IS, PANIC, PANIC -// { -// f_character = match.captured(0); //Phew, we solved the big problem here. -// } -// } - - if (html) - f_character = f_character.toHtmlEscaped(); + p_text_escaped.insert(check_pos_escaped, appendage); + check_pos_escaped += appendage.size(); + } - f_char_length = f_character.length(); + //Current issue: does not properly escape html stuff. + //Solution: probably parse p_text and export into a different string separately, perform some mumbo jumbo to properly adjust string indexes. + while (check_pos < p_text.size()) { + QString f_rest = p_text.right(p_text.size() - check_pos); + QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); + QString f_character; + int f_char_length; - bool color_update = false; - bool is_end = false; - bool skip = false; + tbf.toNextBoundary(); - if (!ic_next_is_not_special) - { - if (f_character == "\\") - { - ic_next_is_not_special = true; - skip = true; - } - //Nothing related to colors here - else if (f_character == "{" || f_character == "}") //|| f_character == "@" || f_character == "$") - { - skip = true; - } - //Parse markdown colors - else - { - for (int c = 0; c < max_colors; ++c) - { - //Clear the stored optimization information - QString markdown_start = color_markdown_start_list.at(c); - QString markdown_end = color_markdown_end_list.at(c); - if (html) - { - markdown_start = markdown_start.toHtmlEscaped(); - markdown_end = markdown_end.toHtmlEscaped(); - } - bool markdown_remove = color_markdown_remove_list.at(c); - if (markdown_start.isEmpty()) //Not defined - continue; - - if (markdown_end.isEmpty() || markdown_end == markdown_start) //"toggle switch" type - { - if (f_character == markdown_start) + if (tbf.position() == -1) + f_character = f_rest; + else + f_character = f_rest.left(tbf.position()); + + // if (f_character == "&") //oh shit it's probably an escaped html + // { + // //Skip escaped chars like you would graphemes + // QRegularExpression re("&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});", QRegularExpression::CaseInsensitiveOption); + // QRegularExpressionMatch match = re.match(f_rest); + // if (match.hasMatch()) //OH SHIT IT IS, PANIC, PANIC + // { + // f_character = match.captured(0); //Phew, we solved the big problem here. + // } + // } + + if (html) + f_character = f_character.toHtmlEscaped(); + + f_char_length = f_character.length(); + + bool color_update = false; + bool is_end = false; + bool skip = false; + + if (!ic_next_is_not_special) { + if (f_character == "\\") { + ic_next_is_not_special = true; + skip = true; + } + //Nothing related to colors here + else if (f_character == "{" || f_character == "}") //|| f_character == "@" || f_character == "$") { - if (html) - { - if (!ic_color_stack.empty() && ic_color_stack.top() == c && default_color != c) - { - ic_color_stack.pop(); //Cease our coloring - is_end = true; + skip = true; + } + //Parse markdown colors + else { + for (int c = 0; c < max_colors; ++c) { + //Clear the stored optimization information + QString markdown_start = color_markdown_start_list.at(c); + QString markdown_end = color_markdown_end_list.at(c); + if (html) { + markdown_start = markdown_start.toHtmlEscaped(); + markdown_end = markdown_end.toHtmlEscaped(); + } + bool markdown_remove = color_markdown_remove_list.at(c); + if (markdown_start.isEmpty()) //Not defined + continue; + + if (markdown_end.isEmpty() || markdown_end == markdown_start) //"toggle switch" type + { + if (f_character == markdown_start) { + if (html) { + if (!ic_color_stack.empty() && ic_color_stack.top() == c && default_color != c) { + ic_color_stack.pop(); //Cease our coloring + is_end = true; + } + else { + ic_color_stack.push(c); //Begin our coloring + } + color_update = true; + } + skip = markdown_remove; + break; //Prevent it from looping forward for whatever reason + } + } + else if (f_character == markdown_start || (f_character == markdown_end && !ic_color_stack.empty() && ic_color_stack.top() == c)) { + if (html) { + if (f_character == markdown_end) { + ic_color_stack.pop(); //Cease our coloring + is_end = true; + } + else if (f_character == markdown_start) { + ic_color_stack.push(c); //Begin our coloring + } + color_update = true; + } + skip = markdown_remove; + break; //Prevent it from looping forward for whatever reason + } } - else - { - ic_color_stack.push(c); //Begin our coloring + //Parse the newest color stack + if (color_update && (target_pos <= -1 || check_pos < target_pos)) { + if (!ic_next_is_not_special) { + QString appendage = ""; + + if (!ic_color_stack.empty()) + appendage += ""; + + if (is_end && !skip) { + p_text_escaped.insert(check_pos_escaped, f_character); //Add that char right now + check_pos_escaped += f_char_length; //So the closing char is captured too + skip = true; + } + p_text_escaped.insert(check_pos_escaped, appendage); + check_pos_escaped += appendage.size(); + } } - color_update = true; - } - skip = markdown_remove; - break; //Prevent it from looping forward for whatever reason } - } - else if (f_character == markdown_start || (f_character == markdown_end && !ic_color_stack.empty() && ic_color_stack.top() == c)) - { - if (html) + } + else { + if (f_character == "n") // \n, that's a line break son { - if (f_character == markdown_end) - { - ic_color_stack.pop(); //Cease our coloring - is_end = true; - } - else if (f_character == markdown_start) - { - ic_color_stack.push(c); //Begin our coloring - } - color_update = true; + QString appendage = "
"; + if (!html) { + //actual newline commented out + // appendage = "\n"; + // size = 1; //yeah guess what \n is a "single character" apparently + appendage = "\\n "; //visual representation of a newline + } + p_text_escaped.insert(check_pos_escaped, appendage); + check_pos_escaped += appendage.size(); + skip = true; } - skip = markdown_remove; - break; //Prevent it from looping forward for whatever reason - } + if (f_character == "s" || f_character == "f") // screenshake/flash + skip = true; + + ic_next_is_not_special = false; } - //Parse the newest color stack - if (color_update && (target_pos <= -1 || check_pos < target_pos)) - { - if (!ic_next_is_not_special) - { - QString appendage = "
"; - if (!ic_color_stack.empty()) - appendage += ""; + //Make all chars we're not supposed to see invisible + if (target_pos > -1 && check_pos == target_pos) { + QString appendage = ""; + if (!ic_color_stack.empty()) { + if (!is_end) //Was our last coloring char ending the color stack or nah + { + //God forgive me for my transgressions but I have refactored this whole thing about 25 times and having to refactor it + //again to more elegantly support this will finally make me go insane. + color_is_talking = color_markdown_talking_list.at(ic_color_stack.top()); + } - if (is_end && !skip) - { - p_text_escaped.insert(check_pos_escaped, f_character); //Add that char right now - check_pos_escaped += f_char_length; //So the closing char is captured too - skip = true; + //Clean it up, we're done here + while (!ic_color_stack.empty()) + ic_color_stack.pop(); + + appendage += ""; } + ic_color_stack.push(-1); //Dummy colorstack push for maximum
appendage + appendage += ""; p_text_escaped.insert(check_pos_escaped, appendage); check_pos_escaped += appendage.size(); - } } - } - } - else - { - if (f_character == "n") // \n, that's a line break son - { - QString appendage = "
"; - if (!html) - { - //actual newline commented out -// appendage = "\n"; -// size = 1; //yeah guess what \n is a "single character" apparently - appendage = "\\n "; //visual representation of a newline + if (!skip) { + p_text_escaped.insert(check_pos_escaped, f_character); + check_pos_escaped += f_char_length; } - p_text_escaped.insert(check_pos_escaped, appendage); - check_pos_escaped += appendage.size(); - skip = true; - } - if (f_character == "s" || f_character == "f") // screenshake/flash - skip = true; + check_pos += 1; + } - ic_next_is_not_special = false; + if (!ic_color_stack.empty() && html) { + p_text_escaped.append("
"); } - //Make all chars we're not supposed to see invisible - if (target_pos > -1 && check_pos == target_pos) - { - QString appendage = ""; - if (!ic_color_stack.empty()) - { - if (!is_end) //Was our last coloring char ending the color stack or nah - { - //God forgive me for my transgressions but I have refactored this whole thing about 25 times and having to refactor it - //again to more elegantly support this will finally make me go insane. - color_is_talking = color_markdown_talking_list.at(ic_color_stack.top()); + if (html) { + //Example: https://regex101.com/r/oL4nM9/37 - this replaces excessive/trailing/etc. whitespace with non-breaking space. + //I WOULD use white-space: pre; stylesheet tag, but for whataver reason it doesn't work no matter where I try it. + //If somoene else can get that piece of HTML memery to work, please do. + p_text_escaped.replace(QRegularExpression("^\\s|(?<=\\s)\\s"), " "); + if (!align.isEmpty()) + p_text_escaped.append("
"); + } + + return p_text_escaped; +} + +void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action) +{ + 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 (p_action == "") + p_text = filter_ic_text(p_text, ao_app->is_colorlog_enabled(), -1, m_chatmessage[TEXT_COLOR].toInt()); + + if (log_goes_downwards) { + const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); + + ui_ic_chatlog->moveCursor(QTextCursor::End); + + if (!first_message_sent) { + ui_ic_chatlog->textCursor().insertText(p_name, bold); + first_message_sent = true; + } + else { + ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); } - //Clean it up, we're done here - while (!ic_color_stack.empty()) - ic_color_stack.pop(); + if (p_action != "") { + ui_ic_chatlog->textCursor().insertText(" " + p_action + ": ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + ".", italics); + } + else { + ui_ic_chatlog->textCursor().insertText(": ", normal); + ui_ic_chatlog->textCursor().insertHtml(p_text); + } - appendage += "
"; - } - ic_color_stack.push(-1); //Dummy colorstack push for maximum
appendage - appendage += ""; - p_text_escaped.insert(check_pos_escaped, appendage); - check_pos_escaped += appendage.size(); - } - if (!skip) - { - p_text_escaped.insert(check_pos_escaped, f_character); - check_pos_escaped += f_char_length; + // 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(); + } + + if (old_cursor.hasSelection() || !is_scrolled_down) { + // The user has selected text or scrolled away from the bottom: maintain position. + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } + else { + // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom. + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); + } } - check_pos += 1; - } + else { + const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); - if (!ic_color_stack.empty() && html) - { - p_text_escaped.append(""); - } + ui_ic_chatlog->moveCursor(QTextCursor::Start); - if (html) - { - //Example: https://regex101.com/r/oL4nM9/37 - this replaces excessive/trailing/etc. whitespace with non-breaking space. - //I WOULD use white-space: pre; stylesheet tag, but for whataver reason it doesn't work no matter where I try it. - //If somoene else can get that piece of HTML memery to work, please do. - p_text_escaped.replace(QRegularExpression("^\\s|(?<=\\s)\\s"), " "); - if (!align.isEmpty()) - p_text_escaped.append("
"); - } + ui_ic_chatlog->textCursor().insertText(p_name, bold); - return p_text_escaped; -} + if (p_action != "") { + ui_ic_chatlog->textCursor().insertText(" " + p_action + ": ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics); + } + else { + ui_ic_chatlog->textCursor().insertText(": ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); + } -void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action) -{ - 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 (p_action == "") - p_text = filter_ic_text(p_text, ao_app->is_colorlog_enabled(), -1, m_chatmessage[TEXT_COLOR].toInt()); - - if (log_goes_downwards) - { - const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); - - ui_ic_chatlog->moveCursor(QTextCursor::End); - - if (!first_message_sent) - { - ui_ic_chatlog->textCursor().insertText(p_name, bold); - first_message_sent = true; - } - else - { - ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); - } - - if (p_action != "") - { - ui_ic_chatlog->textCursor().insertText(" " + p_action + ": ", normal); - ui_ic_chatlog->textCursor().insertText(p_text + ".", italics); - } - else - { - ui_ic_chatlog->textCursor().insertText(": ", normal); - ui_ic_chatlog->textCursor().insertHtml(p_text); - } - - // 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(); - } - - if (old_cursor.hasSelection() || !is_scrolled_down) - { - // The user has selected text or scrolled away from the bottom: maintain position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); - } - else - { - // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom. - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); - } - } - else - { - const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); - - ui_ic_chatlog->moveCursor(QTextCursor::Start); - - ui_ic_chatlog->textCursor().insertText(p_name, bold); - - if (p_action != "") - { - ui_ic_chatlog->textCursor().insertText(" " + p_action + ": ", normal); - ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics); - } - else - { - ui_ic_chatlog->textCursor().insertText(": ", normal); - ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); - } - - // If we got too many blocks in the current log, delete some from the bottom. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) - { - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); - ui_ic_chatlog->textCursor().removeSelectedText(); - ui_ic_chatlog->textCursor().deletePreviousChar(); - } - - if (old_cursor.hasSelection() || !is_scrolled_up) - { - // The user has selected text or scrolled away from the top: maintain position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); - } - else - { - // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); - } - } + // If 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(); + } + + if (old_cursor.hasSelection() || !is_scrolled_up) { + // The user has selected text or scrolled away from the top: maintain position. + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } + else { + // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); + } + } } 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() * time_mod; + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_preanim = m_chatmessage[PRE_EMOTE]; - int preanim_duration; + //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() * time_mod; - if (ao2_duration < 0) - preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim); - else - preanim_duration = ao2_duration; + int preanim_duration; - sfx_delay_timer->start(sfx_delay); - QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim)); - if (!file_exists(anim_to_find)) - { - if (noninterrupting) - anim_state = 4; + if (ao2_duration < 0) + preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim); else - anim_state = 1; - preanim_done(); - qDebug() << "could not find " + anim_to_find; - return; - } + preanim_duration = ao2_duration; - ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration); + sfx_delay_timer->start(sfx_delay); + QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim)); + if (!file_exists(anim_to_find)) { + if (noninterrupting) + anim_state = 4; + else + anim_state = 1; + preanim_done(); + qDebug() << "could not find " + anim_to_find; + return; + } - if (noninterrupting) - anim_state = 4; - else - anim_state = 1; + ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration); - if (text_delay >= 0) - text_delay_timer->start(text_delay); + if (noninterrupting) + anim_state = 4; + else + anim_state = 1; - if (noninterrupting) - handle_chatmessage_3(); + 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(); + anim_state = 1; + handle_chatmessage_3(); } - 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; + //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[EFFECTS] != "") - { - QStringList fx_list = m_chatmessage[EFFECTS].split("|"); - QString fx = fx_list[0]; - QString fx_sound; - QString fx_folder; + if (m_chatmessage[EFFECTS] != "") { + QStringList fx_list = m_chatmessage[EFFECTS].split("|"); + QString fx = fx_list[0]; + QString fx_sound; + QString fx_folder; - if (fx_list.length() > 1) - fx_sound = fx_list[1]; + if (fx_list.length() > 1) + fx_sound = fx_list[1]; - if (fx_list.length() > 2) - { - fx_folder = fx_list[1]; - fx_sound = fx_list[2]; - } + if (fx_list.length() > 2) { + fx_folder = fx_list[1]; + fx_sound = fx_list[2]; + } - this->do_effect(fx, fx_sound, m_chatmessage[CHAR_NAME], fx_folder); - } - else if (m_chatmessage[REALIZATION] == "1") - { - this->do_flash(); - sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); - } - if (chatmessage_is_empty) - { - //since the message is empty, it's technically done ticking - text_state = 2; - return; - } + this->do_effect(fx, fx_sound, m_chatmessage[CHAR_NAME], fx_folder); + } + else if (m_chatmessage[REALIZATION] == "1") { + this->do_flash(); + sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); + } + if (chatmessage_is_empty) { + //since the message is empty, it's technically done ticking + text_state = 2; + return; + } - ui_vp_chatbox->show(); - ui_vp_message->show(); + ui_vp_chatbox->show(); + ui_vp_message->show(); - if (!is_additive) - { - ui_vp_message->clear(); - real_tick_pos = 0; - additive_previous = ""; - } + if (!is_additive) { + ui_vp_message->clear(); + real_tick_pos = 0; + additive_previous = ""; + } - tick_pos = 0; - blip_ticker = 0; + tick_pos = 0; + blip_ticker = 0; - // At the start of every new message, we set the text speed to the default. - current_display_speed = 3; - chat_tick_timer->start(0); //Display the first char right away + // At the start of every new message, we set the text speed to the default. + current_display_speed = 3; + chat_tick_timer->start(0); //Display the first char right away - QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]); + QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]); - blip_player->set_blips(f_gender); + blip_player->set_blips(f_gender); - int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); //text meme bonanza - if ((emote_mod == 0 || emote_mod == 5) && m_chatmessage[SCREENSHAKE] == "1") - { - this->do_screenshake(); - } + int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); //text meme bonanza + if ((emote_mod == 0 || emote_mod == 5) && m_chatmessage[SCREENSHAKE] == "1") { + this->do_screenshake(); + } - //means text is currently ticking - text_state = 1; + //means text is currently ticking + text_state = 1; } void Courtroom::chat_tick() { - //note: this is called fairly often - //do not perform heavy operations here + //note: this is called fairly often + //do not perform heavy operations here - QString f_message = m_chatmessage[MESSAGE]; + QString f_message = m_chatmessage[MESSAGE]; - // 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(); - if (tick_pos >= f_message.size()) - { - text_state = 2; - if (anim_state < 3) - { - anim_state = 3; - ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - } - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_custom_theme = ao_app->get_chat(f_char); - ui_vp_chat_arrow->play("chat_arrow", f_char, f_custom_theme); //Chat stopped being processed, indicate that. - additive_previous = additive_previous + filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt()); - real_tick_pos = ui_vp_message->toPlainText().size(); - return; - } - - // Stops blips from playing when we have a formatting option. - bool formatting_char = false; - - QString f_rest = f_message; - - //Alignment characters - if (tick_pos < 2) - { - if (f_rest.startsWith("~~")) - { - tick_pos = f_rest.indexOf("~~"); - f_rest.remove(tick_pos, 2); - tick_pos += 2; - } - else if (f_rest.startsWith("~>")) - { - tick_pos = f_rest.indexOf("~>"); - f_rest.remove(tick_pos, 2); - tick_pos += 2; - } - else if (f_rest.startsWith("<>")) - { - tick_pos = f_rest.indexOf("<>"); - f_rest.remove(tick_pos, 2); - tick_pos += 2; - } - } - f_rest.remove(0, tick_pos); - QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); - QString f_character; - int f_char_length; - - tbf.toNextBoundary(); - - if (tbf.position() == -1) - f_character = f_rest; - else - f_character = f_rest.left(tbf.position()); - - f_char_length = f_character.length(); - tick_pos += f_char_length; - - // Escape character. - if (!next_character_is_not_special) - { - if (f_character == "\\") - { - next_character_is_not_special = true; - formatting_char = true; + if (tick_pos >= f_message.size()) { + text_state = 2; + if (anim_state < 3) { + anim_state = 3; + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + } + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_custom_theme = ao_app->get_chat(f_char); + ui_vp_chat_arrow->play("chat_arrow", f_char, f_custom_theme); //Chat stopped being processed, indicate that. + additive_previous = additive_previous + filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt()); + real_tick_pos = ui_vp_message->toPlainText().size(); + return; } - // Text speed modifier. - else if (f_character == "{") - { - // ++, because it INCREASES delay! - current_display_speed++; - formatting_char = true; - } - else if (f_character == "}") - { - current_display_speed--; - formatting_char = true; + // Stops blips from playing when we have a formatting option. + bool formatting_char = false; + + QString f_rest = f_message; + + //Alignment characters + if (tick_pos < 2) { + if (f_rest.startsWith("~~")) { + tick_pos = f_rest.indexOf("~~"); + f_rest.remove(tick_pos, 2); + tick_pos += 2; + } + else if (f_rest.startsWith("~>")) { + tick_pos = f_rest.indexOf("~>"); + f_rest.remove(tick_pos, 2); + tick_pos += 2; + } + else if (f_rest.startsWith("<>")) { + tick_pos = f_rest.indexOf("<>"); + f_rest.remove(tick_pos, 2); + tick_pos += 2; + } } + f_rest.remove(0, tick_pos); + QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); + QString f_character; + int f_char_length; + + tbf.toNextBoundary(); + if (tbf.position() == -1) + f_character = f_rest; else - { - //Parse markdown colors - for (int c = 0; c < max_colors; ++c) - { - QString markdown_start = color_markdown_start_list.at(c); - QString markdown_end = color_markdown_end_list.at(c); - bool markdown_remove = color_markdown_remove_list.at(c); - if (markdown_start.isEmpty()) - continue; + f_character = f_rest.left(tbf.position()); - if (f_character == markdown_start || f_character == markdown_end) - { - if (markdown_remove) + f_char_length = f_character.length(); + tick_pos += f_char_length; + + // Escape character. + if (!next_character_is_not_special) { + if (f_character == "\\") { + next_character_is_not_special = true; formatting_char = true; - break; } - } - } - } - else - { - if (f_character == "n") - formatting_char = true; //it's a newline - if (f_character == "s") //Screenshake. - { - this->do_screenshake(); - formatting_char = true; + + // Text speed modifier. + else if (f_character == "{") { + // ++, because it INCREASES delay! + current_display_speed++; + formatting_char = true; + } + else if (f_character == "}") { + current_display_speed--; + formatting_char = true; + } + + else { + //Parse markdown colors + for (int c = 0; c < max_colors; ++c) { + QString markdown_start = color_markdown_start_list.at(c); + QString markdown_end = color_markdown_end_list.at(c); + bool markdown_remove = color_markdown_remove_list.at(c); + if (markdown_start.isEmpty()) + continue; + + if (f_character == markdown_start || f_character == markdown_end) { + if (markdown_remove) + formatting_char = true; + break; + } + } + } } - if (f_character == "f")//Flash. - { - this->do_flash(); - formatting_char = true; - } - next_character_is_not_special = false; - } - - if ((message_display_speed[current_display_speed] <= 0 && tick_pos < f_message.size()-1) || formatting_char) - { - chat_tick_timer->start(0); //Don't bother rendering anything out as we're doing the SPEED. (there's latency otherwise) - if (!formatting_char || f_character == "n" || f_character == "f" || f_character == "s") - real_tick_pos += f_char_length; //Adjust the tick position for the scrollbar convenience - } - else - { - int msg_delay = message_display_speed[current_display_speed]; - //Do the colors, gradual showing, etc. in here - ui_vp_message->setHtml(additive_previous + filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt())); - - //This should always be done AFTER setHtml. Scroll the chat window with the text. - - //Make the cursor follow the message - QTextCursor cursor = ui_vp_message->textCursor(); - cursor.setPosition(real_tick_pos); - ui_vp_message->setTextCursor(cursor); - real_tick_pos += f_char_length; - - ui_vp_message->ensureCursorVisible(); - - // Keep the speed at bay. - if (current_display_speed < 0) - current_display_speed = 0; - else if (current_display_speed > 6) - current_display_speed = 6; - - //Blip player and real tick pos ticker - if (!formatting_char && (f_character != ' ' || blank_blip)) - { - if (blip_ticker % blip_rate == 0) - { - blip_player->blip_tick(); - } - ++blip_ticker; + else { + if (f_character == "n") + formatting_char = true; //it's a newline + if (f_character == "s") //Screenshake. + { + this->do_screenshake(); + formatting_char = true; + } + if (f_character == "f") //Flash. + { + this->do_flash(); + formatting_char = true; + } + next_character_is_not_special = false; } - //Punctuation delayer - if (punctuation_chars.contains(f_character)) - { - msg_delay *= punctuation_modifier; + if ((message_display_speed[current_display_speed] <= 0 && tick_pos < f_message.size() - 1) || formatting_char) { + chat_tick_timer->start(0); //Don't bother rendering anything out as we're doing the SPEED. (there's latency otherwise) + if (!formatting_char || f_character == "n" || f_character == "f" || f_character == "s") + real_tick_pos += f_char_length; //Adjust the tick position for the scrollbar convenience } + else { + int msg_delay = message_display_speed[current_display_speed]; + //Do the colors, gradual showing, etc. in here + ui_vp_message->setHtml(additive_previous + filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt())); + + //This should always be done AFTER setHtml. Scroll the chat window with the text. + + //Make the cursor follow the message + QTextCursor cursor = ui_vp_message->textCursor(); + cursor.setPosition(real_tick_pos); + ui_vp_message->setTextCursor(cursor); + real_tick_pos += f_char_length; + + ui_vp_message->ensureCursorVisible(); + + // Keep the speed at bay. + if (current_display_speed < 0) + current_display_speed = 0; + else if (current_display_speed > 6) + current_display_speed = 6; + + //Blip player and real tick pos ticker + if (!formatting_char && (f_character != ' ' || blank_blip)) { + if (blip_ticker % blip_rate == 0) { + blip_player->blip_tick(); + } + ++blip_ticker; + } - //If this color is talking - if (color_is_talking && anim_state != 2 && anim_state < 4) //Set it to talking as we're not on that already (though we have to avoid interrupting a non-interrupted preanim) - { - ui_vp_player_char->stop(); - ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - anim_state = 2; - } - else if (!color_is_talking && anim_state < 3 && anim_state != 3) //Set it to idle as we're not on that already - { - ui_vp_player_char->stop(); - ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - anim_state = 3; + //Punctuation delayer + if (punctuation_chars.contains(f_character)) { + msg_delay *= punctuation_modifier; + } + + //If this color is talking + if (color_is_talking && anim_state != 2 && anim_state < 4) //Set it to talking as we're not on that already (though we have to avoid interrupting a non-interrupted preanim) + { + ui_vp_player_char->stop(); + ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + anim_state = 2; + } + else if (!color_is_talking && anim_state < 3 && anim_state != 3) //Set it to idle as we're not on that already + { + ui_vp_player_char->stop(); + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + anim_state = 3; + } + //Continue ticking + chat_tick_timer->start(msg_delay); } - //Continue ticking - chat_tick_timer->start(msg_delay); - } } void Courtroom::play_sfx() { - QString sfx_name = m_chatmessage[SFX_NAME]; - if (m_chatmessage[SCREENSHAKE] == "1") //Screenshake dependant on preanim sfx delay meme - { - this->do_screenshake(); - } - if (sfx_name == "1") - return; + QString sfx_name = m_chatmessage[SFX_NAME]; + if (m_chatmessage[SCREENSHAKE] == "1") //Screenshake dependant on preanim sfx delay meme + { + this->do_screenshake(); + } + if (sfx_name == "1") + return; - sfx_player->play(sfx_name); - if(ao_app->get_looping_sfx()) - sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name)!="0"); + sfx_player->play(sfx_name); + if (ao_app->get_looping_sfx()) + sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name) != "0"); } void Courtroom::set_scene(QString f_desk_mod, QString f_side) { - //witness is default if pos is invalid - QString f_background = "witnessempty"; - QString f_desk_image = "stand"; - - if (f_side == "def" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("defenseempty")))) - { - f_background = "defenseempty"; - f_desk_image = "defensedesk"; - } - else if (f_side == "pro" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("prosecutorempty")))) - { - f_background = "prosecutorempty"; - f_desk_image = "prosecutiondesk"; - } - else if (f_side == "jud" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("judgestand")))) - { - f_background = "judgestand"; - f_desk_image = "judgedesk"; - } - else if (f_side == "hld" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("helperstand")))) - { - f_background = "helperstand"; - f_desk_image = "helperdesk"; - } - else if (f_side == "hlp" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("prohelperstand")))) - { - 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"; - } - 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"; - } - - if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path(f_side)))) //Unique pos path - { - f_background = f_side; - f_desk_image = f_side + "_overlay"; - } - - 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 - { - ui_vp_legacy_desk->hide(); - ui_vp_desk->show(); - } + //witness is default if pos is invalid + QString f_background = "witnessempty"; + QString f_desk_image = "stand"; + + if (f_side == "def" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("defenseempty")))) { + f_background = "defenseempty"; + f_desk_image = "defensedesk"; + } + else if (f_side == "pro" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("prosecutorempty")))) { + f_background = "prosecutorempty"; + f_desk_image = "prosecutiondesk"; + } + else if (f_side == "jud" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("judgestand")))) { + f_background = "judgestand"; + f_desk_image = "judgedesk"; + } + else if (f_side == "hld" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("helperstand")))) { + f_background = "helperstand"; + f_desk_image = "helperdesk"; + } + else if (f_side == "hlp" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("prohelperstand")))) { + 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"; + } + 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"; + } + + if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path(f_side)))) //Unique pos path + { + f_background = f_side; + f_desk_image = f_side + "_overlay"; + } + + 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 { + ui_vp_legacy_desk->hide(); + ui_vp_desk->show(); + } } void Courtroom::set_ip_list(QString p_list) { - QString f_list = p_list.replace("|", ":").replace("*", "\n"); + QString f_list = p_list.replace("|", ":").replace("*", "\n"); - ui_server_chatlog->append(f_list); + 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_cid != m_cid && p_cid != -1) + return; - if (p_muted) - ui_muted->show(); - else - { - ui_muted->hide(); - ui_ic_chat_message->setFocus(); - } + 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"); + ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); + ui_muted->set_image("muted"); - is_muted = p_muted; - ui_ic_chat_message->setEnabled(!p_muted); + 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; + if (p_cid != m_cid && p_cid != -1) + return; - call_notice("You have been banned."); + call_notice("You have been banned."); - ao_app->construct_lobby(); - ao_app->destruct_courtroom(); + ao_app->construct_lobby(); + ao_app->destruct_courtroom(); } void Courtroom::handle_song(QStringList *p_contents) { - QStringList f_contents = *p_contents; + QStringList f_contents = *p_contents; - if (f_contents.size() < 2) - return; + if (f_contents.size() < 2) + return; - QString f_song = f_contents.at(0); - QString f_song_clear = f_song.left(f_song.lastIndexOf(".")); - f_song_clear = f_song_clear.right(f_song_clear.length() - (f_song_clear.lastIndexOf("/") + 1)); - int n_char = f_contents.at(1).toInt(); + QString f_song = f_contents.at(0); + QString f_song_clear = f_song.left(f_song.lastIndexOf(".")); + f_song_clear = f_song_clear.right(f_song_clear.length() - (f_song_clear.lastIndexOf("/") + 1)); + int n_char = f_contents.at(1).toInt(); - bool looping = true; - int channel = 0; - int effect_flags = 0; - if (n_char < 0 || n_char >= char_list.size()) - { + bool looping = true; int channel = 0; - if (p_contents->length() > 3 && p_contents->at(3) != "-1") - looping = false; + int effect_flags = 0; + if (n_char < 0 || n_char >= char_list.size()) { + int channel = 0; + if (p_contents->length() > 3 && p_contents->at(3) != "-1") + looping = false; - if (p_contents->length() > 4) //eyyy we want to change this song's CHANNEL huh - channel = p_contents->at(4).toInt(); //let the music player handle it if it's bigger than the channel list + if (p_contents->length() > 4) //eyyy we want to change this song's CHANNEL huh + channel = p_contents->at(4).toInt(); //let the music player handle it if it's bigger than the channel list - if (p_contents->length() > 5) //Flags provided to us by server such as Fade In, Fade Out, Sync Pos etc. - { - effect_flags = p_contents->at(5).toInt(); + if (p_contents->length() > 5) //Flags provided to us by server such as Fade In, Fade Out, Sync Pos etc. + { + effect_flags = p_contents->at(5).toInt(); + } + + music_player->play(f_song, channel, looping, effect_flags); + if (channel == 0) + ui_music_name->setText(f_song_clear); } + else { + QString str_char = char_list.at(n_char).name; + QString str_show = char_list.at(n_char).name; - music_player->play(f_song, channel, looping, effect_flags); - if (channel == 0) - ui_music_name->setText(f_song_clear); - } - 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 && p_contents->at(3) != "-1") { + //I am really confused why "-1" is "loop this song" and why anything else passes as "don't loop" + //(if we even have this length) but alright + looping = false; + } + if (p_contents->length() > 4) //eyyy we want to change this song's CHANNEL huh + channel = p_contents->at(4).toInt(); //let the music player handle it if it's bigger than the channel list - if (p_contents->length() > 2) - { - if(p_contents->at(2) != "") + if (p_contents->length() > 5) //Flags provided to us by server such as Fade In, Fade Out, Sync Pos etc. { - str_show = p_contents->at(2); + effect_flags = p_contents->at(5).toInt(); } - } - if (p_contents->length() > 3 && p_contents->at(3) != "-1") - { - //I am really confused why "-1" is "loop this song" and why anything else passes as "don't loop" - //(if we even have this length) but alright - looping = false; - } - if (p_contents->length() > 4) //eyyy we want to change this song's CHANNEL huh - channel = p_contents->at(4).toInt(); //let the music player handle it if it's bigger than the channel list - - if (p_contents->length() > 5) //Flags provided to us by server such as Fade In, Fade Out, Sync Pos etc. - { - effect_flags = p_contents->at(5).toInt(); - } - if (!mute_map.value(n_char)) - { - chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true); - ic_chatlog_history.append(*temp); - ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); + if (!mute_map.value(n_char)) { + chatlogpiece *temp = new chatlogpiece(str_char, str_show, f_song, true); + ic_chatlog_history.append(*temp); + ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); - while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) - { - ic_chatlog_history.removeFirst(); - } + while (ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) { + ic_chatlog_history.removeFirst(); + } - append_ic_text(f_song_clear, str_show, "has played a song"); + append_ic_text(f_song_clear, str_show, "has played a song"); - music_player->play(f_song, channel, looping, effect_flags); - if (channel == 0) - ui_music_name->setText(f_song_clear); + music_player->play(f_song, channel, looping, effect_flags); + if (channel == 0) + ui_music_name->setText(f_song_clear); + } } - } } void Courtroom::handle_wtce(QString p_wtce, int variant) { - QString sfx_file = "courtroom_sounds.ini"; - - //witness testimony - if (p_wtce == "testimony1") - { - sfx_player->play(ao_app->get_sfx("witness_testimony")); - ui_vp_wtce->play("witnesstestimony", "", "", 1500); - ui_vp_testimony->play("testimony"); - } - //cross examination - else if (p_wtce == "testimony2") - { - sfx_player->play(ao_app->get_sfx("cross_examination")); - ui_vp_wtce->play("crossexamination", "", "", 1500); - ui_vp_testimony->stop(); - } - else if (p_wtce == "judgeruling") - { - if (variant == 0) - { - sfx_player->play(ao_app->get_sfx("not_guilty")); - ui_vp_wtce->play("notguilty", "", "", 3000); - ui_vp_testimony->stop(); + QString sfx_file = "courtroom_sounds.ini"; + + //witness testimony + if (p_wtce == "testimony1") { + sfx_player->play(ao_app->get_sfx("witness_testimony")); + ui_vp_wtce->play("witnesstestimony", "", "", 1500); + ui_vp_testimony->play("testimony"); } - else if (variant == 1) { - sfx_player->play(ao_app->get_sfx("guilty")); - ui_vp_wtce->play("guilty", "", "", 3000); + //cross examination + else if (p_wtce == "testimony2") { + sfx_player->play(ao_app->get_sfx("cross_examination")); + ui_vp_wtce->play("crossexamination", "", "", 1500); ui_vp_testimony->stop(); } - } + else if (p_wtce == "judgeruling") { + if (variant == 0) { + sfx_player->play(ao_app->get_sfx("not_guilty")); + ui_vp_wtce->play("notguilty", "", "", 3000); + ui_vp_testimony->stop(); + } + else if (variant == 1) { + sfx_player->play(ao_app->get_sfx("guilty")); + ui_vp_wtce->play("guilty", "", "", 3000); + 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_state < 0 || p_state > 10) + return; - if (p_bar == 1) - { - ui_defense_bar->set_image("defensebar" + QString::number(p_state)); - defense_bar_state = p_state; - } - else if (p_bar == 2) - { - ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state)); - prosecution_bar_state = p_state; - } + if (p_bar == 1) { + ui_defense_bar->set_image("defensebar" + QString::number(p_state)); + defense_bar_state = p_state; + } + else if (p_bar == 2) { + ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state)); + 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(); - } + 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); - } + 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) { - if (ui_casing->isChecked()) - { - ui_server_chatlog->append(msg); - if ((ao_app->get_casing_defence_enabled() && def) || - (ao_app->get_casing_prosecution_enabled() && pro) || - (ao_app->get_casing_judge_enabled() && jud) || - (ao_app->get_casing_juror_enabled() && jur) || - (ao_app->get_casing_steno_enabled() && steno)) - { - modcall_player->play(ao_app->get_sfx("case_call")); - ao_app->alert(this); + if (ui_casing->isChecked()) { + ui_server_chatlog->append(msg); + if ((ao_app->get_casing_defence_enabled() && def) || + (ao_app->get_casing_prosecution_enabled() && pro) || + (ao_app->get_casing_judge_enabled() && jud) || + (ao_app->get_casing_juror_enabled() && jur) || + (ao_app->get_casing_steno_enabled() && steno)) { + modcall_player->play(ao_app->get_sfx("case_call")); + ao_app->alert(this); + } } - } } void Courtroom::on_ooc_return_pressed() { - QString ooc_message = ui_ooc_chat_message->text(); + QString ooc_message = ui_ooc_chat_message->text(); - if (ooc_message == "" || ui_ooc_chat_name->text() == "") - return; + if (ooc_message == "" || ui_ooc_chat_name->text() == "") + return; - if (ooc_message.startsWith("/pos")) - { - if (ooc_message == "/pos jud") - { - toggle_judge_buttons(true); + if (ooc_message.startsWith("/pos")) { + if (ooc_message == "/pos jud") { + toggle_judge_buttons(true); + } + else { + toggle_judge_buttons(false); + } } - else - { - toggle_judge_buttons(false); + 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("/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 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 - { - append_server_chatmessage("CLIENT", tr("Are you sure you typed that well? The char ID could not be recognised."), "1"); + 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) { + char_offset = 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; } - 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) - { - char_offset = 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 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 - { - 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; + 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); + QTextStream out(&file); - foreach (chatlogpiece item, ic_chatlog_history) { - out << item.get_full() << '\n'; - } + foreach (chatlogpiece item, ic_chatlog_history) { + out << item.get_full() << '\n'; + } - file.close(); + 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"); + append_server_chatmessage("CLIENT", tr("The IC chatlog has been saved."), "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; - } - + 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; - } + 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); + 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(); + 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"); + 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) + "#%")); - } + 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; + foreach (QString evi, casefile.childGroups()) { + if (evi == "General") + continue; - QStringList f_contents; + 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()); + 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)); - } + 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"); + 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"); + 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 = 0; i < local_evidence_list.size(); 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; - } - 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 = 0; i < local_evidence_list.size(); 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; - - } - - 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(); + } + + 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("Master")); + if (server_ooc) { + ui_ms_chatlog->show(); + ui_server_chatlog->hide(); + ui_ooc_toggle->setText(tr("Master")); - server_ooc = false; - } - else - { - ui_ms_chatlog->hide(); - ui_server_chatlog->show(); - ui_ooc_toggle->setText(tr("Server")); + server_ooc = false; + } + else { + ui_ms_chatlog->hide(); + ui_server_chatlog->show(); + ui_ooc_toggle->setText(tr("Server")); - server_ooc = true; - } + server_ooc = true; + } } //Todo: multithread this due to some servers having large as hell music list void Courtroom::on_music_search_edited(QString p_text) { - // Iterate through all QTreeWidgetItem items - if (!ui_music_list->isHidden()) - { - QTreeWidgetItemIterator it(ui_music_list); - while (*it) - { - (*it)->setHidden(p_text != ""); - ++it; + // Iterate through all QTreeWidgetItem items + if (!ui_music_list->isHidden()) { + QTreeWidgetItemIterator it(ui_music_list); + while (*it) { + (*it)->setHidden(p_text != ""); + ++it; + } } - } - if (!ui_area_list->isHidden()) - { - QTreeWidgetItemIterator ait(ui_area_list); - while (*ait) - { - (*ait)->setHidden(p_text != ""); - ++ait; + if (!ui_area_list->isHidden()) { + QTreeWidgetItemIterator ait(ui_area_list); + while (*ait) { + (*ait)->setHidden(p_text != ""); + ++ait; + } } - } - if (p_text != "") - { - if (!ui_music_list->isHidden()) - { - //Search in metadata - QList clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1); - foreach(QTreeWidgetItem* item, clist) - { - if (item->parent() != nullptr) //So the category shows up too - item->parent()->setHidden(false); - item->setHidden(false); - } - } + if (p_text != "") { + if (!ui_music_list->isHidden()) { + //Search in metadata + QList clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains | Qt::MatchRecursive, 1); + foreach (QTreeWidgetItem *item, clist) { + if (item->parent() != nullptr) //So the category shows up too + item->parent()->setHidden(false); + item->setHidden(false); + } + } - if (!ui_area_list->isHidden()) - { - //Search in metadata - QList alist = ui_area_list->findItems(ui_music_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1); - foreach(QTreeWidgetItem* item, alist) - { - if (item->parent() != nullptr) //So the category shows up too - item->parent()->setHidden(false); - item->setHidden(false); - } + if (!ui_area_list->isHidden()) { + //Search in metadata + QList alist = ui_area_list->findItems(ui_music_search->text(), Qt::MatchContains | Qt::MatchRecursive, 1); + foreach (QTreeWidgetItem *item, alist) { + if (item->parent() != nullptr) //So the category shows up too + item->parent()->setHidden(false); + item->setHidden(false); + } + } } - } } void Courtroom::on_pos_dropdown_changed(int p_index) { - if (p_index < 0 || p_index > 7) - return; + if (p_index < 0 || p_index > 7) + return; - toggle_judge_buttons(false); + toggle_judge_buttons(false); - QString f_pos = ui_pos_dropdown->itemText(p_index); + QString f_pos = ui_pos_dropdown->itemText(p_index); - if (f_pos == "") - return; + if (f_pos == "") + return; - if (f_pos == "jud") - toggle_judge_buttons(true); + if (f_pos == "jud") + toggle_judge_buttons(true); - //YEAH SENDING LIKE 20 PACKETS IF THE USER SCROLLS THROUGH, GREAT IDEA - //how about this instead - set_side(f_pos); + //YEAH SENDING LIKE 20 PACKETS IF THE USER SCROLLS THROUGH, GREAT IDEA + //how about this instead + set_side(f_pos); } void Courtroom::set_iniswap_dropdown() { - ui_iniswap_dropdown->blockSignals(true); - ui_iniswap_dropdown->clear(); - if (m_cid == -1) - { - ui_iniswap_dropdown->hide(); - ui_iniswap_remove->hide(); - return; - } - QStringList iniswaps = ao_app->get_list_file(ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")); - iniswaps.prepend(char_list.at(m_cid).name); - if (iniswaps.size() <= 0) - { - ui_iniswap_dropdown->hide(); - ui_iniswap_remove->hide(); - return; - } - ui_iniswap_dropdown->show(); - ui_iniswap_dropdown->addItems(iniswaps); - - for (int i = 0; i < iniswaps.size(); ++i) - { - if (iniswaps.at(i) == current_char) - { - ui_iniswap_dropdown->setCurrentIndex(i); - if (i != 0) - ui_iniswap_remove->show(); - else + ui_iniswap_dropdown->blockSignals(true); + ui_iniswap_dropdown->clear(); + if (m_cid == -1) { + ui_iniswap_dropdown->hide(); + ui_iniswap_remove->hide(); + return; + } + QStringList iniswaps = ao_app->get_list_file(ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")); + iniswaps.prepend(char_list.at(m_cid).name); + if (iniswaps.size() <= 0) { + ui_iniswap_dropdown->hide(); ui_iniswap_remove->hide(); - break; + return; + } + ui_iniswap_dropdown->show(); + ui_iniswap_dropdown->addItems(iniswaps); + + for (int i = 0; i < iniswaps.size(); ++i) { + if (iniswaps.at(i) == current_char) { + ui_iniswap_dropdown->setCurrentIndex(i); + if (i != 0) + ui_iniswap_remove->show(); + else + ui_iniswap_remove->hide(); + break; + } } - } - ui_iniswap_dropdown->blockSignals(false); + ui_iniswap_dropdown->blockSignals(false); } void Courtroom::on_iniswap_dropdown_changed(int p_index) { - ui_ic_chat_message->setFocus(); - QString iniswap = ui_iniswap_dropdown->itemText(p_index); - ao_app->set_char_ini(char_list.at(m_cid).name, iniswap, "name", "Options"); - - QStringList swaplist; - for (int i = 0; i < ui_iniswap_dropdown->count(); ++i) - { - QString entry = ui_iniswap_dropdown->itemText(i); - if (!swaplist.contains(entry) && entry != char_list.at(m_cid).name) - swaplist.append(entry); - } - ao_app->write_to_file(swaplist.join("\n"), ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")); - ui_iniswap_dropdown->blockSignals(true); - ui_iniswap_dropdown->setCurrentIndex(p_index); - ui_iniswap_dropdown->blockSignals(false); - update_character(m_cid); - if (p_index != 0) - ui_iniswap_remove->show(); - else - ui_iniswap_remove->hide(); + ui_ic_chat_message->setFocus(); + QString iniswap = ui_iniswap_dropdown->itemText(p_index); + ao_app->set_char_ini(char_list.at(m_cid).name, iniswap, "name", "Options"); + + QStringList swaplist; + for (int i = 0; i < ui_iniswap_dropdown->count(); ++i) { + QString entry = ui_iniswap_dropdown->itemText(i); + if (!swaplist.contains(entry) && entry != char_list.at(m_cid).name) + swaplist.append(entry); + } + ao_app->write_to_file(swaplist.join("\n"), ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")); + ui_iniswap_dropdown->blockSignals(true); + ui_iniswap_dropdown->setCurrentIndex(p_index); + ui_iniswap_dropdown->blockSignals(false); + update_character(m_cid); + if (p_index != 0) + ui_iniswap_remove->show(); + else + ui_iniswap_remove->hide(); } void Courtroom::on_iniswap_context_menu_requested(const QPoint &pos) { - QMenu *menu = ui_iniswap_dropdown->lineEdit()->createStandardContextMenu(); + QMenu *menu = ui_iniswap_dropdown->lineEdit()->createStandardContextMenu(); - menu->addSeparator(); - if (file_exists(ao_app->get_character_path(current_char, "char.ini"))) - menu->addAction(QString("Edit " + current_char + "/char.ini"), this, SLOT(on_iniswap_edit_requested())); - if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) != char_list.at(m_cid).name) - menu->addAction(QString("Remove " + current_char), this, SLOT(on_iniswap_remove_clicked())); - menu->popup(ui_iniswap_dropdown->mapToGlobal(pos)); + menu->addSeparator(); + if (file_exists(ao_app->get_character_path(current_char, "char.ini"))) + menu->addAction(QString("Edit " + current_char + "/char.ini"), this, SLOT(on_iniswap_edit_requested())); + if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) != char_list.at(m_cid).name) + menu->addAction(QString("Remove " + current_char), this, SLOT(on_iniswap_remove_clicked())); + menu->popup(ui_iniswap_dropdown->mapToGlobal(pos)); } void Courtroom::on_iniswap_edit_requested() { - QString p_path = ao_app->get_character_path(current_char, "char.ini"); - if (!file_exists(p_path)) - return; - QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); + QString p_path = ao_app->get_character_path(current_char, "char.ini"); + if (!file_exists(p_path)) + return; + QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); } void Courtroom::on_iniswap_remove_clicked() { - if (ui_iniswap_dropdown->count() <= 0) - { - ui_iniswap_remove->hide(); //We're not supposed to see it. Do this or the client will crash - return; - } - if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) != char_list.at(m_cid).name) - { - ui_iniswap_dropdown->removeItem(ui_iniswap_dropdown->currentIndex()); - on_iniswap_dropdown_changed(0); //Reset back to original - update_character(m_cid); - } + if (ui_iniswap_dropdown->count() <= 0) { + ui_iniswap_remove->hide(); //We're not supposed to see it. Do this or the client will crash + return; + } + if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) != char_list.at(m_cid).name) { + ui_iniswap_dropdown->removeItem(ui_iniswap_dropdown->currentIndex()); + on_iniswap_dropdown_changed(0); //Reset back to original + update_character(m_cid); + } } void Courtroom::set_sfx_dropdown() { - ui_sfx_dropdown->blockSignals(true); - ui_sfx_dropdown->clear(); - if (m_cid == -1) - { - ui_sfx_dropdown->hide(); - ui_sfx_remove->hide(); - return; - } - QStringList soundlist = ao_app->get_list_file(ao_app->get_character_path(current_char, "soundlist.ini")); - - if (soundlist.size() <= 0) - { - soundlist = ao_app->get_list_file(ao_app->get_theme_path("character_soundlist.ini")); - if (soundlist.size() <= 0) - { - soundlist = ao_app->get_list_file(ao_app->get_default_theme_path("character_soundlist.ini")); + ui_sfx_dropdown->blockSignals(true); + ui_sfx_dropdown->clear(); + if (m_cid == -1) { + ui_sfx_dropdown->hide(); + ui_sfx_remove->hide(); + return; } - } + QStringList soundlist = ao_app->get_list_file(ao_app->get_character_path(current_char, "soundlist.ini")); - if (soundlist.size() <= 0) - { - ui_sfx_dropdown->hide(); - ui_sfx_remove->hide(); - return; - } - soundlist.prepend("Default"); + if (soundlist.size() <= 0) { + soundlist = ao_app->get_list_file(ao_app->get_theme_path("character_soundlist.ini")); + if (soundlist.size() <= 0) { + soundlist = ao_app->get_list_file(ao_app->get_default_theme_path("character_soundlist.ini")); + } + } - ui_sfx_dropdown->show(); - ui_sfx_dropdown->addItems(soundlist); - ui_sfx_dropdown->setCurrentIndex(0); - ui_sfx_remove->hide(); - ui_sfx_dropdown->blockSignals(false); + if (soundlist.size() <= 0) { + ui_sfx_dropdown->hide(); + ui_sfx_remove->hide(); + return; + } + soundlist.prepend("Default"); + + ui_sfx_dropdown->show(); + ui_sfx_dropdown->addItems(soundlist); + ui_sfx_dropdown->setCurrentIndex(0); + ui_sfx_remove->hide(); + ui_sfx_dropdown->blockSignals(false); } void Courtroom::on_sfx_dropdown_changed(int p_index) { - ui_ic_chat_message->setFocus(); - - QStringList soundlist; - for (int i = 0; i < ui_sfx_dropdown->count(); ++i) - { - QString entry = ui_sfx_dropdown->itemText(i); - if (!soundlist.contains(entry) && entry != "Default") - soundlist.append(entry); - } - - QStringList defaultlist = ao_app->get_list_file(ao_app->get_theme_path("character_soundlist.ini")); - if (defaultlist.size() <= 0) - { - defaultlist = ao_app->get_list_file(ao_app->get_default_theme_path("character_soundlist.ini")); - } - - if (defaultlist.size() > 0 && defaultlist.toSet().subtract(soundlist.toSet()).size() > 0) //There's a difference from the default configuration - ao_app->write_to_file(soundlist.join("\n"), ao_app->get_character_path(current_char, "soundlist.ini")); //Create a new sound list - - ui_sfx_dropdown->blockSignals(true); - ui_sfx_dropdown->setCurrentIndex(p_index); - ui_sfx_dropdown->blockSignals(false); - if (p_index != 0) - ui_sfx_remove->show(); - else - ui_sfx_remove->hide(); + ui_ic_chat_message->setFocus(); + + QStringList soundlist; + for (int i = 0; i < ui_sfx_dropdown->count(); ++i) { + QString entry = ui_sfx_dropdown->itemText(i); + if (!soundlist.contains(entry) && entry != "Default") + soundlist.append(entry); + } + + QStringList defaultlist = ao_app->get_list_file(ao_app->get_theme_path("character_soundlist.ini")); + if (defaultlist.size() <= 0) { + defaultlist = ao_app->get_list_file(ao_app->get_default_theme_path("character_soundlist.ini")); + } + + if (defaultlist.size() > 0 && defaultlist.toSet().subtract(soundlist.toSet()).size() > 0) //There's a difference from the default configuration + ao_app->write_to_file(soundlist.join("\n"), ao_app->get_character_path(current_char, "soundlist.ini")); //Create a new sound list + + ui_sfx_dropdown->blockSignals(true); + ui_sfx_dropdown->setCurrentIndex(p_index); + ui_sfx_dropdown->blockSignals(false); + if (p_index != 0) + ui_sfx_remove->show(); + else + ui_sfx_remove->hide(); } void Courtroom::on_sfx_context_menu_requested(const QPoint &pos) { - QMenu *menu = ui_sfx_dropdown->lineEdit()->createStandardContextMenu(); + QMenu *menu = ui_sfx_dropdown->lineEdit()->createStandardContextMenu(); - menu->addSeparator(); - if (file_exists(ao_app->get_character_path(current_char, "soundlist.ini"))) - menu->addAction(QString("Edit " + current_char + "/soundlist.ini"), this, SLOT(on_sfx_edit_requested())); - else - menu->addAction(QString("Edit theme's character_soundlist.ini"), this, SLOT(on_sfx_edit_requested())); - if (ui_sfx_dropdown->currentIndex() != 0) - menu->addAction(QString("Remove " + ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex())), this, SLOT(on_sfx_remove_clicked())); - menu->popup(ui_sfx_dropdown->mapToGlobal(pos)); + menu->addSeparator(); + if (file_exists(ao_app->get_character_path(current_char, "soundlist.ini"))) + menu->addAction(QString("Edit " + current_char + "/soundlist.ini"), this, SLOT(on_sfx_edit_requested())); + else + menu->addAction(QString("Edit theme's character_soundlist.ini"), this, SLOT(on_sfx_edit_requested())); + if (ui_sfx_dropdown->currentIndex() != 0) + menu->addAction(QString("Remove " + ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex())), this, SLOT(on_sfx_remove_clicked())); + menu->popup(ui_sfx_dropdown->mapToGlobal(pos)); } void Courtroom::on_sfx_edit_requested() { - QString p_path = ao_app->get_character_path(current_char, "soundlist.ini"); - if (!file_exists(p_path)) - { - p_path = ao_app->get_theme_path("character_soundlist.ini"); - if (!file_exists(p_path)) - { - p_path = ao_app->get_default_theme_path("character_soundlist.ini"); - if (!file_exists(p_path)) - { - return; - } + QString p_path = ao_app->get_character_path(current_char, "soundlist.ini"); + if (!file_exists(p_path)) { + p_path = ao_app->get_theme_path("character_soundlist.ini"); + if (!file_exists(p_path)) { + p_path = ao_app->get_default_theme_path("character_soundlist.ini"); + if (!file_exists(p_path)) { + return; + } + } } - } - QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); } void Courtroom::on_sfx_remove_clicked() { - if (ui_sfx_dropdown->count() <= 0) - { - ui_sfx_remove->hide(); //We're not supposed to see it. Do this or the client will crash - return; - } - if (ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()) != "Default") - { - ui_sfx_dropdown->removeItem(ui_sfx_dropdown->currentIndex()); - on_sfx_dropdown_changed(0); //Reset back to original - } + if (ui_sfx_dropdown->count() <= 0) { + ui_sfx_remove->hide(); //We're not supposed to see it. Do this or the client will crash + return; + } + if (ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()) != "Default") { + ui_sfx_dropdown->removeItem(ui_sfx_dropdown->currentIndex()); + on_sfx_dropdown_changed(0); //Reset back to original + } } void Courtroom::set_effects_dropdown() { - ui_effects_dropdown->blockSignals(true); - ui_effects_dropdown->clear(); - if (m_cid == -1) - { - ui_effects_dropdown->hide(); - return; - } - QStringList effectslist = ao_app->get_effects(current_char); - - if (effectslist.size() <= 0) - { - ui_effects_dropdown->hide(); - return; - } - - - effectslist.prepend("None"); - - ui_effects_dropdown->show(); - ui_effects_dropdown->addItems(effectslist); - - //ICON-MAKING HELL - QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); - QString custom_path = ao_app->get_base_path() + "misc/" + p_effect + "/icons/"; - QString theme_path = ao_app->get_theme_path("effects/icons/"); - QString default_path = ao_app->get_default_theme_path("effects/icons/"); - for (int i = 0; i < ui_effects_dropdown->count(); ++i) - { - QString entry = ui_effects_dropdown->itemText(i); - QString iconpath = ao_app->get_static_image_suffix(custom_path + entry); - if (!file_exists(iconpath)) - { - iconpath = ao_app->get_static_image_suffix(theme_path + entry); - if (!file_exists(iconpath)) - { - iconpath = ao_app->get_static_image_suffix(default_path + entry); - if (!file_exists(iconpath)) - continue; - } + ui_effects_dropdown->blockSignals(true); + ui_effects_dropdown->clear(); + if (m_cid == -1) { + ui_effects_dropdown->hide(); + return; + } + QStringList effectslist = ao_app->get_effects(current_char); + + if (effectslist.size() <= 0) { + ui_effects_dropdown->hide(); + return; + } + + effectslist.prepend("None"); + + ui_effects_dropdown->show(); + ui_effects_dropdown->addItems(effectslist); + + //ICON-MAKING HELL + QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); + QString custom_path = ao_app->get_base_path() + "misc/" + p_effect + "/icons/"; + QString theme_path = ao_app->get_theme_path("effects/icons/"); + QString default_path = ao_app->get_default_theme_path("effects/icons/"); + for (int i = 0; i < ui_effects_dropdown->count(); ++i) { + QString entry = ui_effects_dropdown->itemText(i); + QString iconpath = ao_app->get_static_image_suffix(custom_path + entry); + if (!file_exists(iconpath)) { + iconpath = ao_app->get_static_image_suffix(theme_path + entry); + if (!file_exists(iconpath)) { + iconpath = ao_app->get_static_image_suffix(default_path + entry); + if (!file_exists(iconpath)) + continue; + } + } + ui_effects_dropdown->setItemIcon(i, QIcon(iconpath)); } - ui_effects_dropdown->setItemIcon(i, QIcon(iconpath)); - } - ui_effects_dropdown->setCurrentIndex(0); - ui_effects_dropdown->blockSignals(false); + ui_effects_dropdown->setCurrentIndex(0); + ui_effects_dropdown->blockSignals(false); } void Courtroom::on_effects_context_menu_requested(const QPoint &pos) { - QMenu *menu = new QMenu(); + QMenu *menu = new QMenu(); - if (!ao_app->read_char_ini(current_char, "effects", "Options").isEmpty()) - menu->addAction(QString("Open misc/" + ao_app->read_char_ini(current_char, "effects", "Options") + " folder"), this, SLOT(on_character_effects_edit_requested())); - menu->addAction(QString("Open theme's effects folder"), this, SLOT(on_effects_edit_requested())); - menu->popup(ui_effects_dropdown->mapToGlobal(pos)); + if (!ao_app->read_char_ini(current_char, "effects", "Options").isEmpty()) + menu->addAction(QString("Open misc/" + ao_app->read_char_ini(current_char, "effects", "Options") + " folder"), this, SLOT(on_character_effects_edit_requested())); + menu->addAction(QString("Open theme's effects folder"), this, SLOT(on_effects_edit_requested())); + menu->popup(ui_effects_dropdown->mapToGlobal(pos)); } void Courtroom::on_effects_edit_requested() { - QString p_path = ao_app->get_theme_path("effects/"); - if (!dir_exists(p_path)) - { - p_path = ao_app->get_default_theme_path("effects/"); - if (!dir_exists(p_path)) - { - return; + QString p_path = ao_app->get_theme_path("effects/"); + if (!dir_exists(p_path)) { + p_path = ao_app->get_default_theme_path("effects/"); + if (!dir_exists(p_path)) { + return; + } } - } - QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); } void Courtroom::on_character_effects_edit_requested() { - QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); - QString p_path = ao_app->get_base_path() + "misc/" + p_effect + "/"; - if (!dir_exists(p_path)) - return; + QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); + QString p_path = ao_app->get_base_path() + "misc/" + p_effect + "/"; + if (!dir_exists(p_path)) + return; - QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); } void Courtroom::on_effects_dropdown_changed(int p_index) { - effect = ui_effects_dropdown->itemText(p_index); - ui_ic_chat_message->setFocus(); + effect = ui_effects_dropdown->itemText(p_index); + ui_ic_chat_message->setFocus(); } bool Courtroom::effects_dropdown_find_and_set(QString effect) { - for (int i = 0; i < ui_effects_dropdown->count(); ++i) - { - QString entry = ui_effects_dropdown->itemText(i); - if (entry == effect) - { - ui_effects_dropdown->setCurrentIndex(i); - return true; + for (int i = 0; i < ui_effects_dropdown->count(); ++i) { + QString entry = ui_effects_dropdown->itemText(i); + if (entry == effect) { + ui_effects_dropdown->setCurrentIndex(i); + return true; + } } - } - return false; + return false; } QString Courtroom::get_char_sfx() { - QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); - if (sfx != "" && sfx != "Default") - return sfx; - return ao_app->get_sfx_name(current_char, current_emote); + QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); + if (sfx != "" && sfx != "Default") + return sfx; + return ao_app->get_sfx_name(current_char, current_emote); } int Courtroom::get_char_sfx_delay() { -// QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); -// if (sfx != "" && sfx != "Default") -// return 0; //todo: a way to define this - return ao_app->get_sfx_delay(current_char, current_emote); + // QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); + // if (sfx != "" && sfx != "Default") + // return 0; //todo: a way to define this + return ao_app->get_sfx_delay(current_char, current_emote); } 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]"); - } -} + QListWidgetItem *f_item = ui_mute_list->item(p_index.row()); + QString f_char = f_item->text(); + QString real_char; -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); + else + real_char = f_char; - 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; - } - } + 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; - } + if (f_cid < -2 || f_cid >= char_list.size()) { + qDebug() << "W: " << real_char << " not present in char_list"; + return; + } - other_charid = f_cid; + other_charid = f_cid; - // Redo the character list. - QStringList sorted_pair_list; + // Redo the character list. + QStringList sorted_pair_list; - for (char_type i_char : char_list) - sorted_pair_list.append(i_char.name); + for (char_type i_char : char_list) + sorted_pair_list.append(i_char.name); - sorted_pair_list.sort(); + 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]"); - } + 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); + column = 1; //Column 1 is always the metadata (which we want) + QString p_song = p_item->text(column); - QStringList packet_contents; - packet_contents.append(p_song); - packet_contents.append(QString::number(m_cid)); - if ((!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) || ao_app->effects_enabled) - packet_contents.append(ui_ic_chat_name->text()); - if (ao_app->effects_enabled) - packet_contents.append(QString::number(music_flags)); - ao_app->send_server_packet(new AOPacket("MC", packet_contents), false); + QStringList packet_contents; + packet_contents.append(p_song); + packet_contents.append(QString::number(m_cid)); + if ((!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) || ao_app->effects_enabled) + packet_contents.append(ui_ic_chat_name->text()); + if (ao_app->effects_enabled) + packet_contents.append(QString::number(music_flags)); + ao_app->send_server_packet(new AOPacket("MC", packet_contents), false); } void Courtroom::on_music_list_context_menu_requested(const QPoint &pos) { - QMenu *menu = new QMenu(); + QMenu *menu = new QMenu(); - menu->addAction(QString("Expand All Categories"), this, SLOT(music_list_expand_all())); - menu->addAction(QString("Collapse All Categories"), this, SLOT(music_list_collapse_all())); - menu->addSeparator(); + menu->addAction(QString("Expand All Categories"), this, SLOT(music_list_expand_all())); + menu->addAction(QString("Collapse All Categories"), this, SLOT(music_list_collapse_all())); + menu->addSeparator(); - menu->addAction(new QAction("Fade Out Previous", this)); - menu->actions().back()->setCheckable(true); - menu->actions().back()->setChecked(music_flags & FADE_OUT); - connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_fade_out(bool))); + menu->addAction(new QAction("Fade Out Previous", this)); + menu->actions().back()->setCheckable(true); + menu->actions().back()->setChecked(music_flags & FADE_OUT); + connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_fade_out(bool))); - menu->addAction(new QAction("Fade In", this)); - menu->actions().back()->setCheckable(true); - menu->actions().back()->setChecked(music_flags & FADE_IN); - connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_fade_in(bool))); + menu->addAction(new QAction("Fade In", this)); + menu->actions().back()->setCheckable(true); + menu->actions().back()->setChecked(music_flags & FADE_IN); + connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_fade_in(bool))); - menu->addAction(new QAction("Synchronize", this)); - menu->actions().back()->setCheckable(true); - menu->actions().back()->setChecked(music_flags & SYNC_POS); - connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_synchronize(bool))); + menu->addAction(new QAction("Synchronize", this)); + menu->actions().back()->setCheckable(true); + menu->actions().back()->setChecked(music_flags & SYNC_POS); + connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_synchronize(bool))); - menu->popup(ui_music_list->mapToGlobal(pos)); + menu->popup(ui_music_list->mapToGlobal(pos)); } void Courtroom::music_fade_out(bool toggle) { - if (toggle) - music_flags |= FADE_OUT; - else - music_flags &= ~FADE_OUT; + if (toggle) + music_flags |= FADE_OUT; + else + music_flags &= ~FADE_OUT; } void Courtroom::music_fade_in(bool toggle) { - if (toggle) - music_flags |= FADE_IN; - else - music_flags &= ~FADE_IN; + if (toggle) + music_flags |= FADE_IN; + else + music_flags &= ~FADE_IN; } void Courtroom::music_synchronize(bool toggle) { - if (toggle) - music_flags |= SYNC_POS; - else - music_flags &= ~SYNC_POS; + if (toggle) + music_flags |= SYNC_POS; + else + music_flags &= ~SYNC_POS; } void Courtroom::music_list_expand_all() { - ui_music_list->expandAll(); + ui_music_list->expandAll(); } void Courtroom::music_list_collapse_all() { - ui_music_list->collapseAll(); - QTreeWidgetItem *current = ui_music_list->selectedItems()[0]; - if (current->parent() != nullptr) - current = current->parent(); - ui_music_list->setCurrentItem(current); + ui_music_list->collapseAll(); + QTreeWidgetItem *current = ui_music_list->selectedItems()[0]; + if (current->parent() != nullptr) + current = current->parent(); + ui_music_list->setCurrentItem(current); } void Courtroom::on_area_list_double_clicked(QTreeWidgetItem *p_item, int column) { - column = 0; //The metadata - QString p_area = p_item->text(0); + column = 0; //The metadata + QString p_area = p_item->text(0); - QStringList packet_contents; - packet_contents.append(p_area); - packet_contents.append(QString::number(m_cid)); - qDebug() << packet_contents; - ao_app->send_server_packet(new AOPacket("MC", packet_contents), false); + QStringList packet_contents; + packet_contents.append(p_area); + packet_contents.append(QString::number(m_cid)); + qDebug() << packet_contents; + ao_app->send_server_packet(new AOPacket("MC", packet_contents), false); } void Courtroom::on_hold_it_clicked() { - if (objection_state == 1) - { - ui_hold_it->set_image("holdit"); - objection_state = 0; - } - else - { - ui_objection->set_image("objection"); - ui_take_that->set_image("takethat"); - ui_custom_objection->set_image("custom"); + if (objection_state == 1) { + ui_hold_it->set_image("holdit"); + objection_state = 0; + } + else { + ui_objection->set_image("objection"); + ui_take_that->set_image("takethat"); + ui_custom_objection->set_image("custom"); - ui_hold_it->set_image("holdit_selected"); - objection_state = 1; - } + ui_hold_it->set_image("holdit_selected"); + objection_state = 1; + } - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_objection_clicked() { - if (objection_state == 2) - { - ui_objection->set_image("objection"); - objection_state = 0; - } - else - { - ui_hold_it->set_image("holdit"); - ui_take_that->set_image("takethat"); - ui_custom_objection->set_image("custom"); + if (objection_state == 2) { + ui_objection->set_image("objection"); + objection_state = 0; + } + else { + ui_hold_it->set_image("holdit"); + ui_take_that->set_image("takethat"); + ui_custom_objection->set_image("custom"); - ui_objection->set_image("objection_selected"); - objection_state = 2; - } + ui_objection->set_image("objection_selected"); + objection_state = 2; + } - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_take_that_clicked() { - if (objection_state == 3) - { - ui_take_that->set_image("takethat"); - objection_state = 0; - } - else - { - ui_objection->set_image("objection"); - ui_hold_it->set_image("holdit"); - ui_custom_objection->set_image("custom"); + if (objection_state == 3) { + ui_take_that->set_image("takethat"); + objection_state = 0; + } + else { + ui_objection->set_image("objection"); + ui_hold_it->set_image("holdit"); + ui_custom_objection->set_image("custom"); - ui_take_that->set_image("takethat_selected"); - objection_state = 3; - } + ui_take_that->set_image("takethat_selected"); + objection_state = 3; + } - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_custom_objection_clicked() { - if (objection_state == 4) - { - ui_custom_objection->set_image("custom"); - objection_state = 0; - } - else - { - ui_objection->set_image("objection"); - ui_take_that->set_image("takethat"); - ui_hold_it->set_image("holdit"); + if (objection_state == 4) { + ui_custom_objection->set_image("custom"); + objection_state = 0; + } + else { + ui_objection->set_image("objection"); + ui_take_that->set_image("takethat"); + ui_hold_it->set_image("holdit"); - ui_custom_objection->set_image("custom_selected"); - objection_state = 4; - } + ui_custom_objection->set_image("custom_selected"); + objection_state = 4; + } - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_realization_clicked() { - if (realization_state == 0) - { - realization_state = 1; - if (effects_dropdown_find_and_set("realization")) - on_effects_dropdown_changed(ui_effects_dropdown->currentIndex()); - - ui_realization->set_image("realization_pressed"); - } - else - { - realization_state = 0; - ui_effects_dropdown->setCurrentIndex(0); - on_effects_dropdown_changed(ui_effects_dropdown->currentIndex()); - ui_realization->set_image("realization"); - } + if (realization_state == 0) { + realization_state = 1; + if (effects_dropdown_find_and_set("realization")) + on_effects_dropdown_changed(ui_effects_dropdown->currentIndex()); + + ui_realization->set_image("realization_pressed"); + } + else { + realization_state = 0; + ui_effects_dropdown->setCurrentIndex(0); + on_effects_dropdown_changed(ui_effects_dropdown->currentIndex()); + ui_realization->set_image("realization"); + } - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_screenshake_clicked() { - if (screenshake_state == 0) - { - screenshake_state = 1; - ui_screenshake->set_image("screenshake_pressed"); - } - else - { - screenshake_state = 0; - ui_screenshake->set_image("screenshake"); - } + if (screenshake_state == 0) { + screenshake_state = 1; + ui_screenshake->set_image("screenshake_pressed"); + } + else { + screenshake_state = 0; + ui_screenshake->set_image("screenshake"); + } - ui_ic_chat_message->setFocus(); + 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_order_dropdown->hide(); - ui_pair_button->set_image("pair_button"); - ui_mute->set_image("mute_pressed"); - } - else - { - ui_mute_list->hide(); - ui_mute->set_image("mute"); - } + if (ui_mute_list->isHidden()) { + ui_mute_list->show(); + ui_pair_list->hide(); + ui_pair_offset_spinbox->hide(); + ui_pair_order_dropdown->hide(); + ui_pair_button->set_image("pair_button"); + ui_mute->set_image("mute_pressed"); + } + else { + ui_mute_list->hide(); + ui_mute->set_image("mute"); + } } void Courtroom::on_pair_clicked() { - if (ui_pair_list->isHidden()) - { - ui_pair_list->show(); - ui_pair_offset_spinbox->show(); - ui_pair_order_dropdown->show(); - ui_mute_list->hide(); - ui_mute->set_image("mute"); - ui_pair_button->set_image("pair_button_pressed"); - } - else - { - ui_pair_list->hide(); - ui_pair_offset_spinbox->hide(); - ui_pair_order_dropdown->hide(); - ui_pair_button->set_image("pair_button"); - } + if (ui_pair_list->isHidden()) { + ui_pair_list->show(); + ui_pair_offset_spinbox->show(); + ui_pair_order_dropdown->show(); + ui_mute_list->hide(); + ui_mute->set_image("mute"); + ui_pair_button->set_image("pair_button_pressed"); + } + else { + ui_pair_list->hide(); + ui_pair_offset_spinbox->hide(); + ui_pair_order_dropdown->hide(); + ui_pair_button->set_image("pair_button"); + } } void Courtroom::on_pair_order_dropdown_changed(int p_index) { - pair_order = p_index; + pair_order = p_index; } void Courtroom::on_defense_minus_clicked() { - int f_state = defense_bar_state - 1; + int f_state = defense_bar_state - 1; - if (f_state >= 0) - ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%")); + 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; + int f_state = defense_bar_state + 1; - if (f_state <= 10) - ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%")); + 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; + int f_state = prosecution_bar_state - 1; - if (f_state >= 0) - ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%")); + 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; + int f_state = prosecution_bar_state + 1; - if (f_state <= 10) - ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%")); + if (f_state <= 10) + ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%")); } void Courtroom::set_text_color_dropdown() { - //Clear the lists - ui_text_color->clear(); - color_row_to_number.clear(); - - //Clear the stored optimization information - color_rgb_list.clear(); - color_markdown_start_list.clear(); - color_markdown_end_list.clear(); - color_markdown_remove_list.clear(); - color_markdown_talking_list.clear(); - - //Update markdown colors. TODO: make a loading function that only loads the config file once instead of several times - for (int c = 0; c < max_colors; ++c) - { - QColor color = ao_app->get_chat_color(QString::number(c), current_char); - color_rgb_list.append(color); - color_markdown_start_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_start", current_char)); - color_markdown_end_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_end", current_char)); - color_markdown_remove_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_remove", current_char) == "1"); - color_markdown_talking_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_talking", current_char) == "1"); - - QString color_name = ao_app->get_chat_markdown("c" + QString::number(c) + "_name", current_char); - if (color_name.isEmpty()) //Not defined - { - if (c > 0) - continue; - color_name = tr("Default"); + //Clear the lists + ui_text_color->clear(); + color_row_to_number.clear(); + + //Clear the stored optimization information + color_rgb_list.clear(); + color_markdown_start_list.clear(); + color_markdown_end_list.clear(); + color_markdown_remove_list.clear(); + color_markdown_talking_list.clear(); + + //Update markdown colors. TODO: make a loading function that only loads the config file once instead of several times + for (int c = 0; c < max_colors; ++c) { + QColor color = ao_app->get_chat_color(QString::number(c), current_char); + color_rgb_list.append(color); + color_markdown_start_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_start", current_char)); + color_markdown_end_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_end", current_char)); + color_markdown_remove_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_remove", current_char) == "1"); + color_markdown_talking_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_talking", current_char) == "1"); + + QString color_name = ao_app->get_chat_markdown("c" + QString::number(c) + "_name", current_char); + if (color_name.isEmpty()) //Not defined + { + if (c > 0) + continue; + color_name = tr("Default"); + } + ui_text_color->addItem(color_name); + QPixmap pixmap(16, 16); + pixmap.fill(color); + ui_text_color->setItemIcon(ui_text_color->count() - 1, QIcon(pixmap)); + color_row_to_number.append(c); } - ui_text_color->addItem(color_name); - QPixmap pixmap(16,16); - pixmap.fill(color); - ui_text_color->setItemIcon(ui_text_color->count() - 1, QIcon(pixmap)); - color_row_to_number.append(c); - } } void Courtroom::on_text_color_changed(int p_color) { - if (ui_ic_chat_message->selectionStart() != -1) //We have a selection! - { - int c = color_row_to_number.at(p_color); - QString markdown_start = color_markdown_start_list.at(c); - if (markdown_start.isEmpty()) + if (ui_ic_chat_message->selectionStart() != -1) //We have a selection! { - qDebug() << "W: Color list dropdown selected a non-existent markdown start character"; - return; - } - QString markdown_end = color_markdown_end_list.at(c); - if (markdown_end.isEmpty()) - markdown_end = markdown_start; - int start = ui_ic_chat_message->selectionStart(); - int end = ui_ic_chat_message->selectionEnd()+1; - ui_ic_chat_message->setCursorPosition(start); - ui_ic_chat_message->insert(markdown_start); - ui_ic_chat_message->setCursorPosition(end); - ui_ic_chat_message->insert(markdown_end); -// ui_ic_chat_message->end(false); - ui_text_color->setCurrentIndex(0); - } - else - { - if (p_color != -1 && p_color < color_row_to_number.size()) - text_color = color_row_to_number.at(p_color); - else - text_color = 0; - } - ui_ic_chat_message->setFocus(); + int c = color_row_to_number.at(p_color); + QString markdown_start = color_markdown_start_list.at(c); + if (markdown_start.isEmpty()) { + qDebug() << "W: Color list dropdown selected a non-existent markdown start character"; + return; + } + QString markdown_end = color_markdown_end_list.at(c); + if (markdown_end.isEmpty()) + markdown_end = markdown_start; + int start = ui_ic_chat_message->selectionStart(); + int end = ui_ic_chat_message->selectionEnd() + 1; + ui_ic_chat_message->setCursorPosition(start); + ui_ic_chat_message->insert(markdown_start); + ui_ic_chat_message->setCursorPosition(end); + ui_ic_chat_message->insert(markdown_end); + // ui_ic_chat_message->end(false); + ui_text_color->setCurrentIndex(0); + } + else { + if (p_color != -1 && p_color < color_row_to_number.size()) + text_color = color_row_to_number.at(p_color); + else + text_color = 0; + } + ui_ic_chat_message->setFocus(); } void Courtroom::on_music_slider_moved(int p_value) { - music_player->set_volume(p_value, 0); //Set volume on music layer - ui_ic_chat_message->setFocus(); + music_player->set_volume(p_value, 0); //Set volume on music layer + ui_ic_chat_message->setFocus(); } void Courtroom::on_sfx_slider_moved(int p_value) { - sfx_player->set_volume(p_value); - //Set the ambience and other misc. music layers - for (int i = 1; i < music_player->m_channelmax; ++i) - { - music_player->set_volume(p_value, i); - } - objection_player->set_volume(p_value); - ui_ic_chat_message->setFocus(); + sfx_player->set_volume(p_value); + //Set the ambience and other misc. music layers + for (int i = 1; i < music_player->m_channelmax; ++i) { + music_player->set_volume(p_value, i); + } + objection_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(); + blip_player->set_volume(p_value); + ui_ic_chat_message->setFocus(); } void Courtroom::on_log_limit_changed(int value) { - log_maximum_blocks = value; + log_maximum_blocks = value; } void Courtroom::on_pair_offset_changed(int value) { - char_offset = value; + char_offset = value; } void Courtroom::on_witness_testimony_clicked() { - if (is_muted) - return; + if (is_muted) + return; - ao_app->send_server_packet(new AOPacket("RT#testimony1#%")); + ao_app->send_server_packet(new AOPacket("RT#testimony1#%")); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_cross_examination_clicked() { - if (is_muted) - return; + if (is_muted) + return; - ao_app->send_server_packet(new AOPacket("RT#testimony2#%")); + ao_app->send_server_packet(new AOPacket("RT#testimony2#%")); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_not_guilty_clicked() { - if (is_muted) - return; + if (is_muted) + return; - ao_app->send_server_packet(new AOPacket("RT#judgeruling#0#%")); + ao_app->send_server_packet(new AOPacket("RT#judgeruling#0#%")); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_guilty_clicked() { - if (is_muted) - return; + if (is_muted) + return; - ao_app->send_server_packet(new AOPacket("RT#judgeruling#1#%")); + ao_app->send_server_packet(new AOPacket("RT#judgeruling#1#%")); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_change_character_clicked() { - sfx_player->set_volume(0); - blip_player->set_volume(0); + sfx_player->set_volume(0); + blip_player->set_volume(0); - set_char_select(); + set_char_select(); - ui_char_select_background->show(); - ui_spectator->hide(); + ui_char_select_background->show(); + ui_spectator->hide(); } void Courtroom::on_reload_theme_clicked() { - ao_app->reload_theme(); + ao_app->reload_theme(); - enter_courtroom(); - update_character(m_cid); + enter_courtroom(); + update_character(m_cid); - anim_state = 4; - text_state = 3; + anim_state = 4; + text_state = 3; - //to update status on the background - set_background(current_background); + //to update status on the background + set_background(current_background); } void Courtroom::on_back_to_lobby_clicked() { - ao_app->construct_lobby(); - ao_app->destruct_courtroom(); + ao_app->construct_lobby(); + ao_app->destruct_courtroom(); } void Courtroom::on_char_select_left_clicked() { - --current_char_page; - set_char_select_page(); + --current_char_page; + set_char_select_page(); } void Courtroom::on_char_select_right_clicked() { - ++current_char_page; - set_char_select_page(); + ++current_char_page; + set_char_select_page(); } void Courtroom::on_spectator_clicked() { - update_character(-1); + update_character(-1); } void Courtroom::on_call_mod_clicked() { - if (ao_app->modcall_reason_enabled) { - QMessageBox errorBox; - QInputDialog input; + 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(); + input.setWindowFlags(Qt::WindowSystemMenuHint); + input.setLabelText(tr("Reason:")); + input.setWindowTitle(tr("Call Moderator")); + auto code = input.exec(); - if (code != QDialog::Accepted) - return; + 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; - } + 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); + 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#%")); - } + ao_app->send_server_packet(new AOPacket("ZZ", mod_reason)); + } + else { + ao_app->send_server_packet(new AOPacket("ZZ#%")); + } - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_settings_clicked() @@ -4381,79 +4079,72 @@ void Courtroom::on_announce_casing_clicked() void Courtroom::on_pre_clicked() { - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_flip_clicked() { - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_additive_clicked() { - if (ui_additive->isChecked()) - { - ui_ic_chat_message->home(false); //move cursor to the start of the message - ui_ic_chat_message->insert(" "); //preface the message by whitespace - ui_ic_chat_message->end(false); //move cursor to the end of the message without selecting anything - } - ui_ic_chat_message->setFocus(); + if (ui_additive->isChecked()) { + ui_ic_chat_message->home(false); //move cursor to the start of the message + ui_ic_chat_message->insert(" "); //preface the message by whitespace + ui_ic_chat_message->end(false); //move cursor to the end of the message without selecting anything + } + ui_ic_chat_message->setFocus(); } void Courtroom::on_guard_clicked() { - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_showname_enable_clicked() { - ui_ic_chatlog->clear(); - first_message_sent = false; + ui_ic_chatlog->clear(); + first_message_sent = false; - foreach (chatlogpiece item, ic_chatlog_history) { - if (ui_showname_enable->isChecked()) - { - if (item.is_song()) - append_ic_text(item.get_message(), item.get_showname(), "has played a song"); - else - append_ic_text(item.get_message(), item.get_showname()); - } - else - { - if (item.is_song()) - append_ic_text(item.get_message(), item.get_name(), "has played a song"); - else - append_ic_text(item.get_message(), item.get_name()); - } + foreach (chatlogpiece item, ic_chatlog_history) { + if (ui_showname_enable->isChecked()) { + if (item.is_song()) + append_ic_text(item.get_message(), item.get_showname(), "has played a song"); + else + append_ic_text(item.get_message(), item.get_showname()); + } + else { + if (item.is_song()) + append_ic_text(item.get_message(), item.get_name(), "has played a song"); + else + append_ic_text(item.get_message(), item.get_name()); + } } - ui_ic_chat_message->setFocus(); + 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(); - } + if (ui_evidence->isHidden()) { + ui_evidence->show(); + ui_evidence_overlay->hide(); + } + else { + ui_evidence->hide(); + } } void Courtroom::on_switch_area_music_clicked() { ui_music_search->setText(""); on_music_search_edited(ui_music_search->text()); - if (ui_area_list->isHidden()) - { + if (ui_area_list->isHidden()) { ui_area_list->show(); ui_music_list->hide(); } - else - { + else { ui_area_list->hide(); ui_music_list->show(); } @@ -4461,80 +4152,76 @@ void Courtroom::on_switch_area_music_clicked() void Courtroom::ping_server() { - ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%")); + ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%")); } void Courtroom::on_casing_clicked() { - if (ao_app->casing_alerts_enabled) - { - if (ui_casing->isChecked()) - { - QStringList f_packet; + 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(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())); - ao_app->send_server_packet(new AOPacket("SETCASE", f_packet)); + 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#%")); } - else - ao_app->send_server_packet(new AOPacket("SETCASE#\"\"#0#0#0#0#0#0#%")); - } } void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno) { - if (ao_app->casing_alerts_enabled) - { - QStringList f_packet; + 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(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)); - ao_app->send_server_packet(new AOPacket("CASEA", f_packet)); + ao_app->send_server_packet(new AOPacket("CASEA", f_packet)); } } Courtroom::~Courtroom() { - delete music_player; - delete sfx_player; - delete objection_player; - delete blip_player; + delete music_player; + delete sfx_player; + delete objection_player; + delete blip_player; } - -#if (defined (_WIN32) || defined (_WIN64)) +#if (defined(_WIN32) || defined(_WIN64)) void Courtroom::load_bass_opus_plugin() { - #ifdef BASSAUDIO - BASS_PluginLoad("bassopus.dll", 0); - #endif +#ifdef BASSAUDIO + BASS_PluginLoad("bassopus.dll", 0); +#endif } -#elif (defined (LINUX) || defined (__linux__)) +#elif (defined(LINUX) || defined(__linux__)) void Courtroom::load_bass_opus_plugin() { - #ifdef BASSAUDIO - BASS_PluginLoad("libbassopus.so", 0); - #endif +#ifdef BASSAUDIO + BASS_PluginLoad("libbassopus.so", 0); +#endif } #elif defined __APPLE__ void Courtroom::load_bass_opus_plugin() { - QString libpath = ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib"; - QByteArray ba = libpath.toLocal8Bit(); - #ifdef BASSAUDIO - BASS_PluginLoad(ba.data(), 0); - #endif + QString libpath = ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib"; + QByteArray ba = libpath.toLocal8Bit(); +#ifdef BASSAUDIO + BASS_PluginLoad(ba.data(), 0); +#endif } #else #error This operating system is unsupported for bass plugins. diff --git a/src/debug_functions.cpp b/src/debug_functions.cpp index a790610d..ba189ec0 100644 --- a/src/debug_functions.cpp +++ b/src/debug_functions.cpp @@ -1,28 +1,26 @@ -#include #include +#include #include "debug_functions.h" void call_error(QString p_message) { - QMessageBox *msgBox = new QMessageBox; + QMessageBox *msgBox = new QMessageBox; - msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1").arg(p_message)); - msgBox->setWindowTitle(QCoreApplication::translate("debug_functions", "Error")); + msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1").arg(p_message)); + msgBox->setWindowTitle(QCoreApplication::translate("debug_functions", "Error")); - - //msgBox->setWindowModality(Qt::NonModal); - msgBox->exec(); + //msgBox->setWindowModality(Qt::NonModal); + msgBox->exec(); } void call_notice(QString p_message) { - QMessageBox *msgBox = new QMessageBox; - - msgBox->setText(p_message); - msgBox->setWindowTitle(QCoreApplication::translate("debug_functions", "Notice")); + QMessageBox *msgBox = new QMessageBox; + msgBox->setText(p_message); + msgBox->setWindowTitle(QCoreApplication::translate("debug_functions", "Notice")); - //msgBox->setWindowModality(Qt::NonModal); - msgBox->exec(); + //msgBox->setWindowModality(Qt::NonModal); + msgBox->exec(); } diff --git a/src/discord_rich_presence.cpp b/src/discord_rich_presence.cpp index 95a824a1..05a94948 100644 --- a/src/discord_rich_presence.cpp +++ b/src/discord_rich_presence.cpp @@ -3,133 +3,129 @@ namespace AttorneyOnline { #ifdef DISCORD -Discord::Discord() -{ - DiscordEventHandlers handlers; - std::memset(&handlers, 0, sizeof(handlers)); - handlers = {}; - 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) { - qWarning() << "Discord RPC errored out! " << message << errorCode; - }; - qInfo() << "Initializing Discord RPC"; - Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr); -} - -Discord::~Discord() -{ - Discord_Shutdown(); -} - -void Discord::state_lobby() -{ - DiscordRichPresence presence; - std::memset(&presence, 0, sizeof(presence)); - presence.largeImageKey = "ao2-logo"; - presence.largeImageText = "Objection!"; - presence.instance = 1; - - presence.state = "In Lobby"; - presence.details = "Idle"; - Discord_UpdatePresence(&presence); -} - -void Discord::state_server(std::string name, std::string server_id) -{ - qDebug() << "Discord RPC: Setting server state"; - - DiscordRichPresence presence; - std::memset(&presence, 0, sizeof(presence)); - presence.largeImageKey = "ao2-logo"; - presence.largeImageText = "Objection!"; - presence.instance = 1; - - auto timestamp = static_cast(std::time(nullptr)); - - presence.state = "In a Server"; - presence.details = name.c_str(); - presence.matchSecret = server_id.c_str(); - presence.startTimestamp = this->timestamp; - - this->server_id = server_id; - this->server_name = name; - this->timestamp = timestamp; - Discord_UpdatePresence(&presence); -} - -void Discord::state_character(std::string name) -{ - 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() << ")"; - - DiscordRichPresence presence; - std::memset(&presence, 0, sizeof(presence)); - presence.largeImageKey = "ao2-logo"; - presence.largeImageText = "Objection!"; - presence.instance = 1; - presence.details = this->server_name.c_str(); - presence.matchSecret = this->server_id.c_str(); - presence.startTimestamp = this->timestamp; - - presence.state = playing_as.c_str(); - presence.smallImageKey = name_internal.c_str(); - // presence.smallImageText = name_internal.c_str(); - Discord_UpdatePresence(&presence); -} - -void Discord::state_spectate() -{ - qDebug() << "Discord RPC: Setting specator state"; - - DiscordRichPresence presence; - std::memset(&presence, 0, sizeof(presence)); - presence.largeImageKey = "ao2-logo"; - presence.largeImageText = "Objection!"; - presence.instance = 1; - presence.details = this->server_name.c_str(); - presence.matchSecret = this->server_id.c_str(); - presence.startTimestamp = this->timestamp; - - presence.state = "Spectating"; - Discord_UpdatePresence(&presence); -} + Discord::Discord() + { + DiscordEventHandlers handlers; + std::memset(&handlers, 0, sizeof(handlers)); + handlers = {}; + 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) { + qWarning() << "Discord RPC errored out! " << message << errorCode; + }; + qInfo() << "Initializing Discord RPC"; + Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr); + } + + Discord::~Discord() + { + Discord_Shutdown(); + } + + void Discord::state_lobby() + { + DiscordRichPresence presence; + std::memset(&presence, 0, sizeof(presence)); + presence.largeImageKey = "ao2-logo"; + presence.largeImageText = "Objection!"; + presence.instance = 1; + + presence.state = "In Lobby"; + presence.details = "Idle"; + Discord_UpdatePresence(&presence); + } + + void Discord::state_server(std::string name, std::string server_id) + { + qDebug() << "Discord RPC: Setting server state"; + + DiscordRichPresence presence; + std::memset(&presence, 0, sizeof(presence)); + presence.largeImageKey = "ao2-logo"; + presence.largeImageText = "Objection!"; + presence.instance = 1; + + auto timestamp = static_cast(std::time(nullptr)); + + presence.state = "In a Server"; + presence.details = name.c_str(); + presence.matchSecret = server_id.c_str(); + presence.startTimestamp = this->timestamp; + + this->server_id = server_id; + this->server_name = name; + this->timestamp = timestamp; + Discord_UpdatePresence(&presence); + } + + void Discord::state_character(std::string name) + { + 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() << ")"; + + DiscordRichPresence presence; + std::memset(&presence, 0, sizeof(presence)); + presence.largeImageKey = "ao2-logo"; + presence.largeImageText = "Objection!"; + presence.instance = 1; + presence.details = this->server_name.c_str(); + presence.matchSecret = this->server_id.c_str(); + presence.startTimestamp = this->timestamp; + + presence.state = playing_as.c_str(); + presence.smallImageKey = name_internal.c_str(); + // presence.smallImageText = name_internal.c_str(); + Discord_UpdatePresence(&presence); + } + + void Discord::state_spectate() + { + qDebug() << "Discord RPC: Setting specator state"; + + DiscordRichPresence presence; + std::memset(&presence, 0, sizeof(presence)); + presence.largeImageKey = "ao2-logo"; + presence.largeImageText = "Objection!"; + presence.instance = 1; + presence.details = this->server_name.c_str(); + presence.matchSecret = this->server_id.c_str(); + presence.startTimestamp = this->timestamp; + + presence.state = "Spectating"; + Discord_UpdatePresence(&presence); + } #else -Discord::Discord() -{ - -} - -Discord::~Discord() -{ - -} - -void Discord::state_lobby() -{ - -} - -void Discord::state_server(std::string name, std::string server_id) -{ - qDebug() << "Discord RPC: Setting server state"; -} - -void Discord::state_character(std::string name) -{ - qDebug() << "Discord RPC: Setting character state"; -} - -void Discord::state_spectate() -{ - qDebug() << "Discord RPC: Setting specator state"; - -} + Discord::Discord() + { + } + + Discord::~Discord() + { + } + + void Discord::state_lobby() + { + } + + void Discord::state_server(std::string name, std::string server_id) + { + qDebug() << "Discord RPC: Setting server state"; + } + + void Discord::state_character(std::string name) + { + qDebug() << "Discord RPC: Setting character state"; + } + + void Discord::state_spectate() + { + qDebug() << "Discord RPC: Setting specator state"; + } #endif -} +} // namespace AttorneyOnline diff --git a/src/emotes.cpp b/src/emotes.cpp index 1484784e..59952971 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -4,199 +4,189 @@ void Courtroom::initialize_emotes() { - ui_emotes = new QWidget(this); + ui_emotes = new QWidget(this); - ui_emote_left = new AOButton(this, ao_app); - ui_emote_right = new AOButton(this, ao_app); + ui_emote_left = new AOButton(this, ao_app); + ui_emote_right = new AOButton(this, ao_app); - ui_emote_dropdown = new QComboBox(this); + ui_emote_dropdown = new QComboBox(this); - connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked())); - connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked())); + connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked())); + connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked())); - connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int))); + connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int))); } void Courtroom::refresh_emotes() { - //Should properly refresh the emote list - qDeleteAll(ui_emote_list.begin(), ui_emote_list.end()); - ui_emote_list.clear(); + //Should properly refresh the emote list + qDeleteAll(ui_emote_list.begin(), ui_emote_list.end()); + ui_emote_list.clear(); - set_size_and_pos(ui_emotes, "emotes"); + set_size_and_pos(ui_emotes, "emotes"); - set_size_and_pos(ui_emote_left, "emote_left"); - ui_emote_left->set_image("arrow_left"); + set_size_and_pos(ui_emote_left, "emote_left"); + ui_emote_left->set_image("arrow_left"); - set_size_and_pos(ui_emote_right, "emote_right"); - ui_emote_right->set_image("arrow_right"); + set_size_and_pos(ui_emote_right, "emote_right"); + ui_emote_right->set_image("arrow_right"); - QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini"); - QPoint p_point = ao_app->get_button_spacing("emote_button_size", "courtroom_design.ini"); + QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini"); + QPoint p_point = ao_app->get_button_spacing("emote_button_size", "courtroom_design.ini"); - const int button_width = p_point.x(); - int x_spacing = f_spacing.x(); - int x_mod_count = 0; + const int button_width = p_point.x(); + int x_spacing = f_spacing.x(); + int x_mod_count = 0; - const int button_height = p_point.y(); - int y_spacing = f_spacing.y(); - int y_mod_count = 0; + const int button_height = p_point.y(); + 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; + max_emotes_on_page = emote_columns * emote_rows; - 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; + 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; - AOEmoteButton *f_emote = new AOEmoteButton(ui_emotes, ao_app, x_pos, y_pos, button_width, button_height); + AOEmoteButton *f_emote = new AOEmoteButton(ui_emotes, ao_app, x_pos, y_pos, button_width, button_height); - ui_emote_list.append(f_emote); + ui_emote_list.append(f_emote); - f_emote->set_id(n); + 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; + ++x_mod_count; - if (x_mod_count == emote_columns) - { - ++y_mod_count; - x_mod_count = 0; + if (x_mod_count == emote_columns) { + ++y_mod_count; + x_mod_count = 0; + } } - } } void Courtroom::set_emote_page() { - if (m_cid == -1) - return; + if (m_cid == -1) + return; - int total_emotes = ao_app->get_emote_number(current_char); + int total_emotes = ao_app->get_emote_number(current_char); - ui_emote_left->hide(); - ui_emote_right->hide(); + ui_emote_left->hide(); + ui_emote_right->hide(); - for (AOEmoteButton *i_button : ui_emote_list) - { - i_button->hide(); - } + for (AOEmoteButton *i_button : ui_emote_list) { + i_button->hide(); + } - int total_pages = total_emotes / max_emotes_on_page; - int emotes_on_page = 0; + int total_pages = total_emotes / max_emotes_on_page; + int emotes_on_page = 0; - if (total_emotes % max_emotes_on_page != 0) - { - ++total_pages; - //i. e. not on the last page - if (total_pages > current_emote_page + 1) - emotes_on_page = max_emotes_on_page; + if (total_emotes % max_emotes_on_page != 0) { + ++total_pages; + //i. e. not on the last page + if (total_pages > current_emote_page + 1) + emotes_on_page = max_emotes_on_page; + else + emotes_on_page = total_emotes % max_emotes_on_page; + } else - emotes_on_page = total_emotes % max_emotes_on_page; + emotes_on_page = max_emotes_on_page; - } - else - emotes_on_page = max_emotes_on_page; - - if (total_pages > current_emote_page + 1) - ui_emote_right->show(); - - if (current_emote_page > 0) - ui_emote_left->show(); + if (total_pages > current_emote_page + 1) + ui_emote_right->show(); - for (int n_emote = 0 ; n_emote < emotes_on_page && n_emote < ui_emote_list.size(); ++n_emote) - { - int n_real_emote = n_emote + current_emote_page * max_emotes_on_page; - AOEmoteButton *f_emote = ui_emote_list.at(n_emote); + if (current_emote_page > 0) + ui_emote_left->show(); - if (n_real_emote == current_emote) - f_emote->set_char_image(current_char, n_real_emote, "_on"); - else - f_emote->set_char_image(current_char, n_real_emote, "_off"); + for (int n_emote = 0; n_emote < emotes_on_page && n_emote < ui_emote_list.size(); ++n_emote) { + int n_real_emote = n_emote + current_emote_page * max_emotes_on_page; + AOEmoteButton *f_emote = ui_emote_list.at(n_emote); - f_emote->show(); - f_emote->setToolTip(QString::number(n_real_emote+1) + ": " + ao_app->get_emote_comment(current_char, n_real_emote)); - } + if (n_real_emote == current_emote) + f_emote->set_char_image(current_char, n_real_emote, "_on"); + else + f_emote->set_char_image(current_char, n_real_emote, "_off"); + f_emote->show(); + f_emote->setToolTip(QString::number(n_real_emote + 1) + ": " + ao_app->get_emote_comment(current_char, n_real_emote)); + } } void Courtroom::set_emote_dropdown() { - ui_emote_dropdown->clear(); + ui_emote_dropdown->clear(); - int total_emotes = ao_app->get_emote_number(current_char); - QStringList emote_list; + int total_emotes = ao_app->get_emote_number(current_char); + QStringList emote_list; - for (int n = 0 ; n < total_emotes ; ++n) - { - emote_list.append(QString::number(n+1) + ": " + ao_app->get_emote_comment(current_char, n)); - } + for (int n = 0; n < total_emotes; ++n) { + emote_list.append(QString::number(n + 1) + ": " + ao_app->get_emote_comment(current_char, n)); + } - ui_emote_dropdown->addItems(emote_list); + ui_emote_dropdown->addItems(emote_list); } void Courtroom::select_emote(int p_id) { - int min = current_emote_page * max_emotes_on_page; - int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page; + int min = current_emote_page * max_emotes_on_page; + 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_char_image(current_char, current_emote, "_off"); + if (current_emote >= min && current_emote <= max) + ui_emote_list.at(current_emote % max_emotes_on_page)->set_char_image(current_char, current_emote, "_off"); - int old_emote = current_emote; + int old_emote = current_emote; - current_emote = p_id; + current_emote = p_id; - if (current_emote >= min && current_emote <= max) - ui_emote_list.at(current_emote % max_emotes_on_page)->set_char_image(current_char, current_emote, "_on"); + if (current_emote >= min && current_emote <= max) + ui_emote_list.at(current_emote % max_emotes_on_page)->set_char_image(current_char, current_emote, "_on"); - int emote_mod = ao_app->get_emote_mod(current_char, current_emote); + int emote_mod = ao_app->get_emote_mod(current_char, current_emote); - if (old_emote == current_emote) - { - ui_pre->setChecked(!ui_pre->isChecked()); - } - else if (!ao_app->is_stickypres_enabled()) - { - if (emote_mod == 1 || emote_mod == 4) - ui_pre->setChecked(true); - else - ui_pre->setChecked(false); - } + if (old_emote == current_emote) { + ui_pre->setChecked(!ui_pre->isChecked()); + } + else if (!ao_app->is_stickypres_enabled()) { + if (emote_mod == 1 || emote_mod == 4) + ui_pre->setChecked(true); + else + ui_pre->setChecked(false); + } - ui_emote_dropdown->setCurrentIndex(current_emote); + ui_emote_dropdown->setCurrentIndex(current_emote); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_emote_clicked(int p_id) { - select_emote(p_id + max_emotes_on_page * current_emote_page); + select_emote(p_id + max_emotes_on_page * current_emote_page); } void Courtroom::on_emote_left_clicked() { - --current_emote_page; + --current_emote_page; - set_emote_page(); + set_emote_page(); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_emote_right_clicked() { - qDebug() << "emote right clicked"; - ++current_emote_page; + qDebug() << "emote right clicked"; + ++current_emote_page; - set_emote_page(); + set_emote_page(); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_emote_dropdown_changed(int p_index) { - select_emote(p_index); + select_emote(p_index); } diff --git a/src/encryption_functions.cpp b/src/encryption_functions.cpp index ffbe0cdb..f26d4d47 100644 --- a/src/encryption_functions.cpp +++ b/src/encryption_functions.cpp @@ -4,60 +4,55 @@ 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; - unsigned int C2 = 32618; + unsigned int key = p_key; + unsigned int C1 = 53761; + unsigned int C2 = 32618; - QVector temp_result; - std::string input = temp_input.toUtf8().constData(); + QVector temp_result; + std::string input = temp_input.toUtf8().constData(); - 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; - } + 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; + } - std::string result = ""; + std::string result = ""; - for (uint_fast8_t i_int : temp_result) - { - result += omni::int_to_hex(i_int); - } + for (uint_fast8_t i_int : temp_result) { + result += omni::int_to_hex(i_int); + } - QString final_result = QString::fromStdString(result); + QString final_result = QString::fromStdString(result); - return final_result; + return final_result; } QString fanta_decrypt(QString temp_input, unsigned int key) { - std::string input = temp_input.toUtf8().constData(); + std::string input = temp_input.toUtf8().constData(); - QVector unhexed_vector; + QVector unhexed_vector; - 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); - } + 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); + } - unsigned int C1 = 53761; - unsigned int C2 = 32618; + unsigned int C1 = 53761; + unsigned int C2 = 32618; - std::string result = ""; + std::string result = ""; - 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); + 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 0cee435a..50ed9a4f 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -2,533 +2,510 @@ void Courtroom::initialize_evidence() { - ui_evidence = new AOImage(this, ao_app); - - //ui_evidence_name = new QLabel(ui_evidence); - ui_evidence_name = new AOLineEdit(ui_evidence); - ui_evidence_name->setAlignment(Qt::AlignCenter); - ui_evidence_name->setFrame(false); - - ui_evidence_buttons = new QWidget(ui_evidence); - - ui_evidence_left = new AOButton(ui_evidence, ao_app); - ui_evidence_right = new AOButton(ui_evidence, ao_app); - ui_evidence_present = new AOButton(ui_evidence, ao_app); - ui_evidence_present->setToolTip(tr("Present this piece of evidence to everyone on your next spoken message")); - - ui_evidence_switch = new AOButton(ui_evidence, ao_app); - ui_evidence_transfer = new AOButton(ui_evidence, ao_app); - - ui_evidence_save = new AOButton(ui_evidence, ao_app); - ui_evidence_save->setToolTip(tr("Save evidence to an .ini file.")); - ui_evidence_load = new AOButton(ui_evidence, ao_app); - ui_evidence_load->setToolTip(tr("Load evidence from an .ini file.")); - - ui_evidence_overlay = new AOImage(ui_evidence, ao_app); - - ui_evidence_delete = new AOButton(ui_evidence_overlay, ao_app); - ui_evidence_delete->setToolTip(tr("Destroy this piece of evidence")); - ui_evidence_image_name = new AOLineEdit(ui_evidence_overlay); - ui_evidence_image_button = new AOButton(ui_evidence_overlay, ao_app); - ui_evidence_image_button->setText(tr("Choose...")); - ui_evidence_x = new AOButton(ui_evidence_overlay, ao_app); - ui_evidence_x->setToolTip(tr("Close the evidence display/editing overlay.\n" - "You will be prompted if there's any unsaved changes.")); - ui_evidence_ok = new AOButton(ui_evidence_overlay, ao_app); - ui_evidence_ok->setToolTip(tr("Save any changes made to this piece of evidence and send them to server.")); - - ui_evidence_description = new AOTextEdit(ui_evidence_overlay); - ui_evidence_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: white;"); - ui_evidence_description->setFrameStyle(QFrame::NoFrame); - ui_evidence_description->setToolTip("Double-click to edit. Press [X] to update your changes."); - - connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited())); - connect(ui_evidence_name, SIGNAL(double_clicked()), this, SLOT(on_evidence_name_double_clicked())); - 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_switch, SIGNAL(clicked()), this, SLOT(on_evidence_switch_clicked())); - connect(ui_evidence_transfer, SIGNAL(clicked()), this, SLOT(on_evidence_transfer_clicked())); - connect(ui_evidence_save, SIGNAL(clicked()), this, SLOT(on_evidence_save_clicked())); - connect(ui_evidence_load, SIGNAL(clicked()), this, SLOT(on_evidence_load_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_name, SIGNAL(double_clicked()), this, SLOT(on_evidence_image_name_double_clicked())); - 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_ok, SIGNAL(clicked()), this, SLOT(on_evidence_ok_clicked())); - - connect(ui_evidence_name, SIGNAL(textChanged(QString)), this, SLOT(on_evidence_edited())); - connect(ui_evidence_image_name, SIGNAL(textChanged(QString)), this, SLOT(on_evidence_edited())); - connect(ui_evidence_description, SIGNAL(textChanged()), this, SLOT(on_evidence_edited())); - - ui_evidence->hide(); + ui_evidence = new AOImage(this, ao_app); + + //ui_evidence_name = new QLabel(ui_evidence); + ui_evidence_name = new AOLineEdit(ui_evidence); + ui_evidence_name->setAlignment(Qt::AlignCenter); + ui_evidence_name->setFrame(false); + + ui_evidence_buttons = new QWidget(ui_evidence); + + ui_evidence_left = new AOButton(ui_evidence, ao_app); + ui_evidence_right = new AOButton(ui_evidence, ao_app); + ui_evidence_present = new AOButton(ui_evidence, ao_app); + ui_evidence_present->setToolTip(tr("Present this piece of evidence to everyone on your next spoken message")); + + ui_evidence_switch = new AOButton(ui_evidence, ao_app); + ui_evidence_transfer = new AOButton(ui_evidence, ao_app); + + ui_evidence_save = new AOButton(ui_evidence, ao_app); + ui_evidence_save->setToolTip(tr("Save evidence to an .ini file.")); + ui_evidence_load = new AOButton(ui_evidence, ao_app); + ui_evidence_load->setToolTip(tr("Load evidence from an .ini file.")); + + ui_evidence_overlay = new AOImage(ui_evidence, ao_app); + + ui_evidence_delete = new AOButton(ui_evidence_overlay, ao_app); + ui_evidence_delete->setToolTip(tr("Destroy this piece of evidence")); + ui_evidence_image_name = new AOLineEdit(ui_evidence_overlay); + ui_evidence_image_button = new AOButton(ui_evidence_overlay, ao_app); + ui_evidence_image_button->setText(tr("Choose...")); + ui_evidence_x = new AOButton(ui_evidence_overlay, ao_app); + ui_evidence_x->setToolTip(tr("Close the evidence display/editing overlay.\n" + "You will be prompted if there's any unsaved changes.")); + ui_evidence_ok = new AOButton(ui_evidence_overlay, ao_app); + ui_evidence_ok->setToolTip(tr("Save any changes made to this piece of evidence and send them to server.")); + + ui_evidence_description = new AOTextEdit(ui_evidence_overlay); + ui_evidence_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);" + "color: white;"); + ui_evidence_description->setFrameStyle(QFrame::NoFrame); + ui_evidence_description->setToolTip("Double-click to edit. Press [X] to update your changes."); + + connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited())); + connect(ui_evidence_name, SIGNAL(double_clicked()), this, SLOT(on_evidence_name_double_clicked())); + 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_switch, SIGNAL(clicked()), this, SLOT(on_evidence_switch_clicked())); + connect(ui_evidence_transfer, SIGNAL(clicked()), this, SLOT(on_evidence_transfer_clicked())); + connect(ui_evidence_save, SIGNAL(clicked()), this, SLOT(on_evidence_save_clicked())); + connect(ui_evidence_load, SIGNAL(clicked()), this, SLOT(on_evidence_load_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_name, SIGNAL(double_clicked()), this, SLOT(on_evidence_image_name_double_clicked())); + 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_ok, SIGNAL(clicked()), this, SLOT(on_evidence_ok_clicked())); + + connect(ui_evidence_name, SIGNAL(textChanged(QString)), this, SLOT(on_evidence_edited())); + connect(ui_evidence_image_name, SIGNAL(textChanged(QString)), this, SLOT(on_evidence_edited())); + connect(ui_evidence_description, SIGNAL(textChanged()), this, SLOT(on_evidence_edited())); + + ui_evidence->hide(); } void Courtroom::refresh_evidence() { - set_font(ui_evidence_name, "", "evidence_name"); - set_font(ui_evidence_image_name, "", "evidence_image_name"); - set_font(ui_evidence_description, "", "evidence_description"); - - //Should properly refresh the evidence list - qDeleteAll(ui_evidence_list.begin(), ui_evidence_list.end()); - ui_evidence_list.clear(); - - set_size_and_pos(ui_evidence_button, "evidence_button"); - ui_evidence_button->set_image("evidence_button"); - ui_evidence_button->setToolTip(tr("Bring up the Evidence screen.")); - - set_size_and_pos(ui_evidence, "evidence_background"); - if (current_evidence_global) - ui_evidence->set_image("evidence_background"); - else - ui_evidence->set_image("evidence_background_private"); + set_font(ui_evidence_name, "", "evidence_name"); + set_font(ui_evidence_image_name, "", "evidence_image_name"); + set_font(ui_evidence_description, "", "evidence_description"); - set_size_and_pos(ui_evidence_name, "evidence_name"); - - set_size_and_pos(ui_evidence_buttons, "evidence_buttons"); + //Should properly refresh the evidence list + qDeleteAll(ui_evidence_list.begin(), ui_evidence_list.end()); + ui_evidence_list.clear(); - set_size_and_pos(ui_evidence_left, "evidence_left"); - ui_evidence_left->set_image("arrow_left"); + set_size_and_pos(ui_evidence_button, "evidence_button"); + ui_evidence_button->set_image("evidence_button"); + ui_evidence_button->setToolTip(tr("Bring up the Evidence screen.")); - set_size_and_pos(ui_evidence_right, "evidence_right"); - ui_evidence_right->set_image("arrow_right"); + set_size_and_pos(ui_evidence, "evidence_background"); + if (current_evidence_global) + ui_evidence->set_image("evidence_background"); + else + ui_evidence->set_image("evidence_background_private"); - set_size_and_pos(ui_evidence_present, "evidence_present"); - ui_evidence_present->set_image("present"); + set_size_and_pos(ui_evidence_name, "evidence_name"); - set_size_and_pos(ui_evidence_overlay, "evidence_overlay"); - if (current_evidence_global) - ui_evidence_overlay->set_image("evidence_overlay"); - else - ui_evidence_overlay->set_image("evidence_overlay_private"); + set_size_and_pos(ui_evidence_buttons, "evidence_buttons"); - set_size_and_pos(ui_evidence_delete, "evidence_delete"); - ui_evidence_delete->set_image("evidence_delete"); + set_size_and_pos(ui_evidence_left, "evidence_left"); + ui_evidence_left->set_image("arrow_left"); - set_size_and_pos(ui_evidence_image_name, "evidence_image_name"); + set_size_and_pos(ui_evidence_right, "evidence_right"); + ui_evidence_right->set_image("arrow_right"); - set_size_and_pos(ui_evidence_image_button, "evidence_image_button"); + set_size_and_pos(ui_evidence_present, "evidence_present"); + ui_evidence_present->set_image("present"); - set_size_and_pos(ui_evidence_x, "evidence_x"); - ui_evidence_x->set_image("evidence_x"); + set_size_and_pos(ui_evidence_overlay, "evidence_overlay"); + if (current_evidence_global) + ui_evidence_overlay->set_image("evidence_overlay"); + else + ui_evidence_overlay->set_image("evidence_overlay_private"); - set_size_and_pos(ui_evidence_ok, "evidence_ok"); - ui_evidence_ok->set_image("evidence_ok"); + set_size_and_pos(ui_evidence_delete, "evidence_delete"); + ui_evidence_delete->set_image("evidence_delete"); - set_size_and_pos(ui_evidence_switch, "evidence_switch"); - if (current_evidence_global) - { - ui_evidence_switch->set_image("evidence_global"); - ui_evidence_switch->setToolTip(tr("Switch evidence to private inventory.")); - } - else - { - ui_evidence_switch->set_image("evidence_private"); - ui_evidence_switch->setToolTip(tr("Switch evidence to global inventory.")); - } + set_size_and_pos(ui_evidence_image_name, "evidence_image_name"); - set_size_and_pos(ui_evidence_transfer, "evidence_transfer"); - if (current_evidence_global) - { - ui_evidence_transfer->set_image("evidence_transfer"); - ui_evidence_transfer->setToolTip(tr("Transfer evidence to private inventory.")); - } - else - { - ui_evidence_transfer->set_image("evidence_transfer_private"); - ui_evidence_transfer->setToolTip(tr("Transfer evidence to global inventory.")); - } + set_size_and_pos(ui_evidence_image_button, "evidence_image_button"); - set_size_and_pos(ui_evidence_save, "evidence_save"); - ui_evidence_save->set_image("evidence_save"); - if (current_evidence_global) - ui_evidence_save->hide(); - else - ui_evidence_save->show(); + set_size_and_pos(ui_evidence_x, "evidence_x"); + ui_evidence_x->set_image("evidence_x"); - set_size_and_pos(ui_evidence_load, "evidence_load"); - ui_evidence_load->set_image("evidence_load"); - if (current_evidence_global) - ui_evidence_load->hide(); - else - ui_evidence_load->show(); + set_size_and_pos(ui_evidence_ok, "evidence_ok"); + ui_evidence_ok->set_image("evidence_ok"); - set_size_and_pos(ui_evidence_description, "evidence_description"); + set_size_and_pos(ui_evidence_switch, "evidence_switch"); + if (current_evidence_global) { + ui_evidence_switch->set_image("evidence_global"); + ui_evidence_switch->setToolTip(tr("Switch evidence to private inventory.")); + } + else { + ui_evidence_switch->set_image("evidence_private"); + ui_evidence_switch->setToolTip(tr("Switch evidence to global inventory.")); + } - QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", "courtroom_design.ini"); - QPoint p_point = ao_app->get_button_spacing("evidence_button_size", "courtroom_design.ini"); + set_size_and_pos(ui_evidence_transfer, "evidence_transfer"); + if (current_evidence_global) { + ui_evidence_transfer->set_image("evidence_transfer"); + ui_evidence_transfer->setToolTip(tr("Transfer evidence to private inventory.")); + } + else { + ui_evidence_transfer->set_image("evidence_transfer_private"); + ui_evidence_transfer->setToolTip(tr("Transfer evidence to global inventory.")); + } - const int button_width = p_point.x(); - int x_spacing = f_spacing.x(); - int x_mod_count = 0; + set_size_and_pos(ui_evidence_save, "evidence_save"); + ui_evidence_save->set_image("evidence_save"); + if (current_evidence_global) + ui_evidence_save->hide(); + else + ui_evidence_save->show(); - const int button_height = p_point.y(); - int y_spacing = f_spacing.y(); - int y_mod_count = 0; + set_size_and_pos(ui_evidence_load, "evidence_load"); + ui_evidence_load->set_image("evidence_load"); + if (current_evidence_global) + ui_evidence_load->hide(); + else + ui_evidence_load->show(); - 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; + set_size_and_pos(ui_evidence_description, "evidence_description"); - max_evidence_on_page = evidence_columns * evidence_rows; + QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", "courtroom_design.ini"); + QPoint p_point = ao_app->get_button_spacing("evidence_button_size", "courtroom_design.ini"); - 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; + const int button_width = p_point.x(); + int x_spacing = f_spacing.x(); + int x_mod_count = 0; - AOEvidenceButton *f_evidence = new AOEvidenceButton(ui_evidence_buttons, ao_app, x_pos, y_pos, button_width, button_height); + const int button_height = p_point.y(); + int y_spacing = f_spacing.y(); + int y_mod_count = 0; - ui_evidence_list.append(f_evidence); + 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; - f_evidence->set_id(n); + max_evidence_on_page = evidence_columns * evidence_rows; - 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))); + 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; - ++x_mod_count; + AOEvidenceButton *f_evidence = new AOEvidenceButton(ui_evidence_buttons, ao_app, x_pos, y_pos, button_width, button_height); - if (x_mod_count == evidence_columns) - { - ++y_mod_count; - x_mod_count = 0; + 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))); + + ++x_mod_count; + + if (x_mod_count == evidence_columns) { + ++y_mod_count; + x_mod_count = 0; + } } - } } void Courtroom::set_evidence_list(QVector &p_evi_list) { - global_evidence_list = p_evi_list; - if (!current_evidence_global) - return; //We're on private evidence editing, wait for user to do their thing + global_evidence_list = p_evi_list; + if (!current_evidence_global) + return; //We're on private evidence editing, wait for user to do their thing - QVector old_list = local_evidence_list; - local_evidence_list.clear(); - local_evidence_list = p_evi_list; + QVector old_list = local_evidence_list; + local_evidence_list.clear(); + local_evidence_list = p_evi_list; - set_evidence_page(); + set_evidence_page(); - if (ui_evidence_overlay->isVisible())//Update the currently edited evidence for this user - { - if (current_evidence >= local_evidence_list.size()) - { - evidence_close(); - ui_evidence_name->setText(""); - } - else if (ui_evidence_description->isReadOnly()) //We haven't double clicked to edit it or anything - { - on_evidence_double_clicked(current_evidence); - } - //Todo: make a function that compares two pieces of evidence for any differences - else if (compare_evidence_changed(old_list.at(current_evidence), local_evidence_list.at(current_evidence))) + if (ui_evidence_overlay->isVisible()) //Update the currently edited evidence for this user { - QMessageBox *msgBox = new QMessageBox; - - msgBox->setText("The piece of evidence you've been editing has changed."); - msgBox->setInformativeText("Do you wish to keep your changes?"); - msgBox->setDetailedText("Name: " + local_evidence_list.at(current_evidence).name + "\nImage: " + local_evidence_list.at(current_evidence).image + "\nDescription:\n" + local_evidence_list.at(current_evidence).description); - msgBox->setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msgBox->setDefaultButton(QMessageBox::LastButton); - //msgBox->setWindowModality(Qt::NonModal); - int ret = msgBox->exec(); - switch (ret) { - case QMessageBox::Yes: - // "Keep changes" - break; - case QMessageBox::No: - // "Discard changes and keep theirs" + if (current_evidence >= local_evidence_list.size()) { + evidence_close(); + ui_evidence_name->setText(""); + } + else if (ui_evidence_description->isReadOnly()) //We haven't double clicked to edit it or anything + { on_evidence_double_clicked(current_evidence); - break; - default: - // should never be reached - break; - } + } + //Todo: make a function that compares two pieces of evidence for any differences + else if (compare_evidence_changed(old_list.at(current_evidence), local_evidence_list.at(current_evidence))) { + QMessageBox *msgBox = new QMessageBox; + + msgBox->setText("The piece of evidence you've been editing has changed."); + msgBox->setInformativeText("Do you wish to keep your changes?"); + msgBox->setDetailedText("Name: " + local_evidence_list.at(current_evidence).name + "\nImage: " + local_evidence_list.at(current_evidence).image + "\nDescription:\n" + local_evidence_list.at(current_evidence).description); + msgBox->setStandardButtons(QMessageBox::Yes | QMessageBox::No); + msgBox->setDefaultButton(QMessageBox::LastButton); + //msgBox->setWindowModality(Qt::NonModal); + int ret = msgBox->exec(); + switch (ret) { + case QMessageBox::Yes: + // "Keep changes" + break; + case QMessageBox::No: + // "Discard changes and keep theirs" + on_evidence_double_clicked(current_evidence); + break; + default: + // should never be reached + break; + } + } } - } } void Courtroom::set_evidence_page() { - int total_evidence = local_evidence_list.size(); + int total_evidence = local_evidence_list.size(); - ui_evidence_left->hide(); - ui_evidence_right->hide(); + ui_evidence_left->hide(); + ui_evidence_right->hide(); - for (AOEvidenceButton *i_button : ui_evidence_list) - { - i_button->hide(); - } + for (AOEvidenceButton *i_button : ui_evidence_list) { + i_button->hide(); + } - //to account for the "add evidence" button - ++total_evidence; + //to account for the "add evidence" button + ++total_evidence; - int total_pages = total_evidence / max_evidence_on_page; - int evidence_on_page = 0; + int total_pages = total_evidence / max_evidence_on_page; + int evidence_on_page = 0; - if ((total_evidence % max_evidence_on_page) != 0) - { - ++total_pages; - //i. e. not on the last page - if (total_pages > current_evidence_page + 1) - evidence_on_page = max_evidence_on_page; + if ((total_evidence % max_evidence_on_page) != 0) { + ++total_pages; + //i. e. not on the last page + if (total_pages > current_evidence_page + 1) + evidence_on_page = max_evidence_on_page; + else + evidence_on_page = total_evidence % max_evidence_on_page; + } else - evidence_on_page = total_evidence % max_evidence_on_page; + evidence_on_page = max_evidence_on_page; - } - else - evidence_on_page = max_evidence_on_page; + if (total_pages > current_evidence_page + 1) + ui_evidence_right->show(); - if (total_pages > current_evidence_page + 1) - ui_evidence_right->show(); + if (current_evidence_page > 0) + ui_evidence_left->show(); - 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); + f_evidence_button->set_selected(false); + f_evidence_button->setToolTip(""); + 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); - f_evidence_button->set_selected(false); - f_evidence_button->setToolTip(""); - 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); + if (n_real_evidence == current_evidence) + f_evidence_button->set_selected(true); - if (n_real_evidence == current_evidence) - f_evidence_button->set_selected(true); + f_evidence_button->setToolTip(QString::number(n_real_evidence + 1) + ": " + local_evidence_list.at(n_real_evidence).name); + } + else + f_evidence_button->set_image(""); - f_evidence_button->setToolTip(QString::number(n_real_evidence+1) + ": " + local_evidence_list.at(n_real_evidence).name); + f_evidence_button->show(); } - else - f_evidence_button->set_image(""); - - f_evidence_button->show(); - } } void Courtroom::on_evidence_name_edited() { - ui_evidence_name->setReadOnly(true); - if (current_evidence >= local_evidence_list.size()) - return; + ui_evidence_name->setReadOnly(true); + if (current_evidence >= local_evidence_list.size()) + return; } void Courtroom::on_evidence_name_double_clicked() { - if (ui_evidence_overlay->isVisible()) - { - ui_evidence_name->setReadOnly(false); - } - else - { - ui_evidence_name->setReadOnly(true); - } + if (ui_evidence_overlay->isVisible()) { + ui_evidence_name->setReadOnly(false); + } + else { + ui_evidence_name->setReadOnly(true); + } } void Courtroom::on_evidence_image_name_double_clicked() { - ui_evidence_image_name->setReadOnly(false); + ui_evidence_image_name->setReadOnly(false); } void Courtroom::on_evidence_image_name_edited() { - ui_evidence_image_name->setReadOnly(true); - if (current_evidence >= local_evidence_list.size()) - return; + ui_evidence_image_name->setReadOnly(true); + if (current_evidence >= local_evidence_list.size()) + return; } void Courtroom::on_evidence_image_button_clicked() { - QDir dir(ao_app->get_base_path() + "evidence"); - QFileDialog dialog(this); - dialog.setFileMode(QFileDialog::ExistingFile); - dialog.setNameFilter(tr("Images (*.png)")); - dialog.setViewMode(QFileDialog::List); - dialog.setDirectory(dir); + QDir dir(ao_app->get_base_path() + "evidence"); + QFileDialog dialog(this); + dialog.setFileMode(QFileDialog::ExistingFile); + dialog.setNameFilter(tr("Images (*.png)")); + dialog.setViewMode(QFileDialog::List); + dialog.setDirectory(dir); - QStringList filenames; + QStringList filenames; - if (dialog.exec()) - filenames = dialog.selectedFiles(); + if (dialog.exec()) + filenames = dialog.selectedFiles(); - if (filenames.size() != 1) - return; + if (filenames.size() != 1) + return; - QString filename = filenames.at(0); - filename = dir.relativeFilePath(filename); - ui_evidence_image_name->setText(filename); - on_evidence_image_name_edited(); + QString filename = filenames.at(0); + filename = dir.relativeFilePath(filename); + ui_evidence_image_name->setText(filename); + on_evidence_image_name_edited(); } void Courtroom::on_evidence_clicked(int p_id) { - ui_evidence_name->setReadOnly(true); - - int f_real_id = p_id + max_evidence_on_page * current_evidence_page; + ui_evidence_name->setReadOnly(true); - if (f_real_id == local_evidence_list.size()) - { - if (current_evidence_global) - ao_app->send_server_packet(new AOPacket("PE###empty.png#%")); - else - { - evi_type f_evi; - f_evi.name = ""; - f_evi.description = ""; - f_evi.image = "empty.png"; - - local_evidence_list.append(f_evi); - private_evidence_list = local_evidence_list; - set_evidence_page(); + int f_real_id = p_id + max_evidence_on_page * current_evidence_page; + + if (f_real_id == local_evidence_list.size()) { + if (current_evidence_global) + ao_app->send_server_packet(new AOPacket("PE###empty.png#%")); + else { + evi_type f_evi; + f_evi.name = ""; + f_evi.description = ""; + f_evi.image = "empty.png"; + + local_evidence_list.append(f_evi); + private_evidence_list = local_evidence_list; + set_evidence_page(); + } + return; } - return; - } - else if (f_real_id > local_evidence_list.size()) - return; + else if (f_real_id > local_evidence_list.size()) + return; - ui_evidence_name->setText(local_evidence_list.at(f_real_id).name); + ui_evidence_name->setText(local_evidence_list.at(f_real_id).name); - for (AOEvidenceButton *i_button : ui_evidence_list) - i_button->set_selected(false); + for (AOEvidenceButton *i_button : ui_evidence_list) + i_button->set_selected(false); - ui_evidence_list.at(p_id)->set_selected(true); + ui_evidence_list.at(p_id)->set_selected(true); - current_evidence = f_real_id; - -// ui_ic_chat_message->setFocus(); + current_evidence = f_real_id; + // ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_double_clicked(int p_id) { - int f_real_id = p_id + max_evidence_on_page * current_evidence_page; + int f_real_id = p_id + max_evidence_on_page * current_evidence_page; - if (f_real_id >= local_evidence_list.size()) - return; + if (f_real_id >= local_evidence_list.size()) + return; - current_evidence = f_real_id; + current_evidence = f_real_id; - evi_type f_evi = local_evidence_list.at(f_real_id); + evi_type f_evi = local_evidence_list.at(f_real_id); - ui_evidence_description->clear(); - ui_evidence_description->appendPlainText(f_evi.description); - ui_evidence_description->setReadOnly(true); - ui_evidence_description->setToolTip("Double-click to edit..."); + ui_evidence_description->clear(); + ui_evidence_description->appendPlainText(f_evi.description); + ui_evidence_description->setReadOnly(true); + ui_evidence_description->setToolTip("Double-click to edit..."); - ui_evidence_name->setText(f_evi.name); - ui_evidence_name->setReadOnly(true); - ui_evidence_name->setToolTip("Double-click to edit..."); - ui_evidence_image_name->setText(f_evi.image); - ui_evidence_image_name->setReadOnly(true); - ui_evidence_image_name->setToolTip("Double-click to edit..."); + ui_evidence_name->setText(f_evi.name); + ui_evidence_name->setReadOnly(true); + ui_evidence_name->setToolTip("Double-click to edit..."); + ui_evidence_image_name->setText(f_evi.image); + ui_evidence_image_name->setReadOnly(true); + ui_evidence_image_name->setToolTip("Double-click to edit..."); - ui_evidence_overlay->show(); - ui_evidence_ok->hide(); + ui_evidence_overlay->show(); + ui_evidence_ok->hide(); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } 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 (final_id == local_evidence_list.size()) - ui_evidence_name->setText(tr("Add new evidence...")); - else if (final_id < local_evidence_list.size()) - ui_evidence_name->setText(local_evidence_list.at(final_id).name); - } - else if (current_evidence < local_evidence_list.size()) - ui_evidence_name->setText(local_evidence_list.at(current_evidence).name); - else - ui_evidence_name->setText(""); + ui_evidence_name->setReadOnly(true); + int final_id = p_id + max_evidence_on_page * current_evidence_page; + + 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()) + ui_evidence_name->setText(local_evidence_list.at(final_id).name); + } + else if (current_evidence < local_evidence_list.size()) + ui_evidence_name->setText(local_evidence_list.at(current_evidence).name); + else + ui_evidence_name->setText(""); } void Courtroom::on_evidence_left_clicked() { - --current_evidence_page; + --current_evidence_page; - set_evidence_page(); + set_evidence_page(); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_right_clicked() { - ++current_evidence_page; + ++current_evidence_page; - set_evidence_page(); + set_evidence_page(); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_present_clicked() { - if (!current_evidence_global) - { - ui_evidence_present->hide(); - is_presenting_evidence = false; - return; //otherwise we get force-disconnected - } - if (is_presenting_evidence) - ui_evidence_present->set_image("present"); - else - ui_evidence_present->set_image("present_disabled"); + if (!current_evidence_global) { + ui_evidence_present->hide(); + is_presenting_evidence = false; + return; //otherwise we get force-disconnected + } + if (is_presenting_evidence) + ui_evidence_present->set_image("present"); + else + ui_evidence_present->set_image("present_disabled"); - is_presenting_evidence = !is_presenting_evidence; + is_presenting_evidence = !is_presenting_evidence; - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_delete_clicked() { - evidence_close(); - if (current_evidence_global) - ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%")); - else - { - local_evidence_list.remove(current_evidence); - private_evidence_list = local_evidence_list; - set_evidence_page(); - } + evidence_close(); + if (current_evidence_global) + ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%")); + else { + local_evidence_list.remove(current_evidence); + private_evidence_list = local_evidence_list; + set_evidence_page(); + } - current_evidence = 0; + current_evidence = 0; - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_x_clicked() { - if (current_evidence >= local_evidence_list.size()) //Should never happen but you never know. - return; - - evi_type fake_evidence; - fake_evidence.name = ui_evidence_name->text(); - fake_evidence.description = ui_evidence_description->toPlainText(); - fake_evidence.image = ui_evidence_image_name->text(); - if (!compare_evidence_changed(fake_evidence, local_evidence_list.at(current_evidence))) - { - evidence_close(); - return; - } - QMessageBox *msgBox = new QMessageBox; - msgBox->setText("Evidence has been modified."); - msgBox->setInformativeText("Do you want to save your changes?"); - msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - msgBox->setDefaultButton(QMessageBox::Save); - int ret = msgBox->exec(); - switch (ret) { + if (current_evidence >= local_evidence_list.size()) //Should never happen but you never know. + return; + + evi_type fake_evidence; + fake_evidence.name = ui_evidence_name->text(); + fake_evidence.description = ui_evidence_description->toPlainText(); + fake_evidence.image = ui_evidence_image_name->text(); + if (!compare_evidence_changed(fake_evidence, local_evidence_list.at(current_evidence))) { + evidence_close(); + return; + } + QMessageBox *msgBox = new QMessageBox; + msgBox->setText("Evidence has been modified."); + msgBox->setInformativeText("Do you want to save your changes?"); + msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); + msgBox->setDefaultButton(QMessageBox::Save); + int ret = msgBox->exec(); + switch (ret) { case QMessageBox::Save: evidence_close(); on_evidence_ok_clicked(); @@ -542,200 +519,191 @@ void Courtroom::on_evidence_x_clicked() default: // should never be reached break; - } + } } void Courtroom::on_evidence_ok_clicked() { - ui_evidence_name->setReadOnly(true); - ui_evidence_description->setReadOnly(true); - ui_evidence_image_name->setReadOnly(true); - if (current_evidence < local_evidence_list.size()) - { - evi_type f_evi = local_evidence_list.at(current_evidence); - if (current_evidence_global) - { - QStringList f_contents; - f_contents.append(QString::number(current_evidence)); - f_contents.append(ui_evidence_name->text()); - f_contents.append(ui_evidence_description->toPlainText()); - f_contents.append(ui_evidence_image_name->text()); - - ao_app->send_server_packet(new AOPacket("EE", f_contents)); - } - else - { - f_evi.name = ui_evidence_name->text(); - f_evi.description = ui_evidence_description->toPlainText(); - f_evi.image = ui_evidence_image_name->text(); - local_evidence_list.replace(current_evidence, f_evi); - private_evidence_list = local_evidence_list; - ui_evidence_ok->hide(); - set_evidence_page(); + ui_evidence_name->setReadOnly(true); + ui_evidence_description->setReadOnly(true); + ui_evidence_image_name->setReadOnly(true); + if (current_evidence < local_evidence_list.size()) { + evi_type f_evi = local_evidence_list.at(current_evidence); + if (current_evidence_global) { + QStringList f_contents; + f_contents.append(QString::number(current_evidence)); + f_contents.append(ui_evidence_name->text()); + f_contents.append(ui_evidence_description->toPlainText()); + f_contents.append(ui_evidence_image_name->text()); + + ao_app->send_server_packet(new AOPacket("EE", f_contents)); + } + else { + f_evi.name = ui_evidence_name->text(); + f_evi.description = ui_evidence_description->toPlainText(); + f_evi.image = ui_evidence_image_name->text(); + local_evidence_list.replace(current_evidence, f_evi); + private_evidence_list = local_evidence_list; + ui_evidence_ok->hide(); + set_evidence_page(); + } } - } } void Courtroom::on_evidence_switch_clicked() { - evidence_close(); - evidence_switch(!current_evidence_global); - if (current_evidence_global) - { - ui_evidence_switch->set_image("evidence_global"); - ui_evidence->set_image("evidence_background"); - ui_evidence_overlay->set_image("evidence_overlay"); - ui_evidence_transfer->set_image("evidence_transfer"); - ui_evidence_transfer->setToolTip(tr("Transfer evidence to private inventory.")); - ui_evidence_switch->setToolTip(tr("Current evidence is global. Click to switch to private.")); - } - else - { - ui_evidence_switch->set_image("evidence_private"); - ui_evidence->set_image("evidence_background_private"); - ui_evidence_overlay->set_image("evidence_overlay_private"); - ui_evidence_transfer->set_image("evidence_transfer_private"); - ui_evidence_transfer->setToolTip(tr("Transfer evidence to global inventory.")); - ui_evidence_switch->setToolTip(tr("Current evidence is private. Click to switch to global.")); - } + evidence_close(); + evidence_switch(!current_evidence_global); + if (current_evidence_global) { + ui_evidence_switch->set_image("evidence_global"); + ui_evidence->set_image("evidence_background"); + ui_evidence_overlay->set_image("evidence_overlay"); + ui_evidence_transfer->set_image("evidence_transfer"); + ui_evidence_transfer->setToolTip(tr("Transfer evidence to private inventory.")); + ui_evidence_switch->setToolTip(tr("Current evidence is global. Click to switch to private.")); + } + else { + ui_evidence_switch->set_image("evidence_private"); + ui_evidence->set_image("evidence_background_private"); + ui_evidence_overlay->set_image("evidence_overlay_private"); + ui_evidence_transfer->set_image("evidence_transfer_private"); + ui_evidence_transfer->setToolTip(tr("Transfer evidence to global inventory.")); + ui_evidence_switch->setToolTip(tr("Current evidence is private. Click to switch to global.")); + } } void Courtroom::on_evidence_transfer_clicked() { - if (current_evidence >= local_evidence_list.size()) - return; - - QString name; - if (!current_evidence_global) //Transfer private evidence to global - { - evi_type f_evi = local_evidence_list.at(current_evidence); - - QStringList f_contents; - f_contents.append(f_evi.name); - f_contents.append(f_evi.description); - f_contents.append(f_evi.image); - - name = f_evi.name; - ao_app->send_server_packet(new AOPacket("PE", f_contents)); - } - else //Transfer global evidence to private - { - evi_type f_evi = local_evidence_list.at(current_evidence); - name = f_evi.name; - private_evidence_list.append(f_evi); - } - - QMessageBox *msgBox = new QMessageBox; - msgBox->setText("\"" + name + "\" has been transferred."); - msgBox->setStandardButtons(QMessageBox::Ok); - msgBox->setDefaultButton(QMessageBox::Ok); - msgBox->exec(); + if (current_evidence >= local_evidence_list.size()) + return; + + QString name; + if (!current_evidence_global) //Transfer private evidence to global + { + evi_type f_evi = local_evidence_list.at(current_evidence); + + QStringList f_contents; + f_contents.append(f_evi.name); + f_contents.append(f_evi.description); + f_contents.append(f_evi.image); + + name = f_evi.name; + ao_app->send_server_packet(new AOPacket("PE", f_contents)); + } + else //Transfer global evidence to private + { + evi_type f_evi = local_evidence_list.at(current_evidence); + name = f_evi.name; + private_evidence_list.append(f_evi); + } + + QMessageBox *msgBox = new QMessageBox; + msgBox->setText("\"" + name + "\" has been transferred."); + msgBox->setStandardButtons(QMessageBox::Ok); + msgBox->setDefaultButton(QMessageBox::Ok); + msgBox->exec(); } void Courtroom::on_evidence_edited() { - if (current_evidence >= local_evidence_list.size()) //Should never happen but you never know. - return; - evi_type fake_evidence; - fake_evidence.name = ui_evidence_name->text(); - fake_evidence.description = ui_evidence_description->toPlainText(); - fake_evidence.image = ui_evidence_image_name->text(); - if (compare_evidence_changed(fake_evidence, local_evidence_list.at(current_evidence))) - ui_evidence_ok->show(); - else - ui_evidence_ok->hide(); + if (current_evidence >= local_evidence_list.size()) //Should never happen but you never know. + return; + evi_type fake_evidence; + fake_evidence.name = ui_evidence_name->text(); + fake_evidence.description = ui_evidence_description->toPlainText(); + fake_evidence.image = ui_evidence_image_name->text(); + if (compare_evidence_changed(fake_evidence, local_evidence_list.at(current_evidence))) + ui_evidence_ok->show(); + else + ui_evidence_ok->hide(); } void Courtroom::evidence_close() { - ui_evidence_description->setReadOnly(true); - ui_evidence_description->setToolTip(""); - ui_evidence_name->setReadOnly(true); - ui_evidence_name->setToolTip(""); - ui_evidence_image_name->setReadOnly(true); - ui_evidence_image_name->setToolTip(""); - ui_evidence_overlay->hide(); - ui_ic_chat_message->setFocus(); + ui_evidence_description->setReadOnly(true); + ui_evidence_description->setToolTip(""); + ui_evidence_name->setReadOnly(true); + ui_evidence_name->setToolTip(""); + ui_evidence_image_name->setReadOnly(true); + ui_evidence_image_name->setToolTip(""); + ui_evidence_overlay->hide(); + ui_ic_chat_message->setFocus(); } void Courtroom::evidence_switch(bool global) { - current_evidence_global = global; - is_presenting_evidence = false; - ui_evidence_present->set_image("present"); - local_evidence_list.clear(); - if (current_evidence_global) - { - local_evidence_list = global_evidence_list; - ui_evidence_present->show(); - ui_evidence_save->hide(); - ui_evidence_load->hide(); - } - else - { - local_evidence_list = private_evidence_list; - ui_evidence_present->hide(); - ui_evidence_save->show(); - ui_evidence_load->show(); - } - set_evidence_page(); + current_evidence_global = global; + is_presenting_evidence = false; + ui_evidence_present->set_image("present"); + local_evidence_list.clear(); + if (current_evidence_global) { + local_evidence_list = global_evidence_list; + ui_evidence_present->show(); + ui_evidence_save->hide(); + ui_evidence_load->hide(); + } + else { + local_evidence_list = private_evidence_list; + ui_evidence_present->hide(); + ui_evidence_save->show(); + ui_evidence_load->show(); + } + set_evidence_page(); } void Courtroom::on_evidence_save_clicked() { - if (current_evidence_global) - return; //Don't allow saving/loading operations when in global inventory mode for now - - QString p_path = QFileDialog::getSaveFileName(this, tr("Save Inventory"), "base/inventories/", tr("Ini Files (*.ini)")); - if (p_path.isEmpty()) - return; - - evidence_close(); - ui_evidence_name->setText(""); - - QSettings inventory(p_path, QSettings::IniFormat); - inventory.clear(); - for(int i = 0; i < local_evidence_list.size(); i++) - { - inventory.beginGroup(QString::number(i)); - inventory.setValue("name",local_evidence_list[i].name); - inventory.setValue("description",local_evidence_list[i].description); - inventory.setValue("image",local_evidence_list[i].image); - inventory.endGroup(); - } - inventory.sync(); + if (current_evidence_global) + return; //Don't allow saving/loading operations when in global inventory mode for now + + QString p_path = QFileDialog::getSaveFileName(this, tr("Save Inventory"), "base/inventories/", tr("Ini Files (*.ini)")); + if (p_path.isEmpty()) + return; + + evidence_close(); + ui_evidence_name->setText(""); + + QSettings inventory(p_path, QSettings::IniFormat); + inventory.clear(); + for (int i = 0; i < local_evidence_list.size(); i++) { + inventory.beginGroup(QString::number(i)); + inventory.setValue("name", local_evidence_list[i].name); + inventory.setValue("description", local_evidence_list[i].description); + inventory.setValue("image", local_evidence_list[i].image); + inventory.endGroup(); + } + inventory.sync(); } void Courtroom::on_evidence_load_clicked() { - if (current_evidence_global) - return; //Don't allow saving/loading operations when in global inventory mode for now - - QString p_path = QFileDialog::getOpenFileName(this, tr("Open Inventory"), "base/inventories/", tr("Ini Files (*.ini)")); - if (p_path.isEmpty()) - return; - - evidence_close(); - ui_evidence_name->setText(""); - - QSettings inventory(p_path, QSettings::IniFormat); - local_evidence_list.clear(); - foreach (QString evi, inventory.childGroups()) - { - if (evi == "General") - continue; - - evi_type f_evi; - f_evi.name = inventory.value(evi + "/name", "UNKNOWN").value(); - f_evi.description = inventory.value(evi + "/description", "UNKNOWN").value(); - f_evi.image = inventory.value(evi + "/image", "UNKNOWN.png").value(); - local_evidence_list.append(f_evi); - } - private_evidence_list = local_evidence_list; - set_evidence_page(); + if (current_evidence_global) + return; //Don't allow saving/loading operations when in global inventory mode for now + + QString p_path = QFileDialog::getOpenFileName(this, tr("Open Inventory"), "base/inventories/", tr("Ini Files (*.ini)")); + if (p_path.isEmpty()) + return; + + evidence_close(); + ui_evidence_name->setText(""); + + QSettings inventory(p_path, QSettings::IniFormat); + local_evidence_list.clear(); + foreach (QString evi, inventory.childGroups()) { + if (evi == "General") + continue; + + evi_type f_evi; + f_evi.name = inventory.value(evi + "/name", "UNKNOWN").value(); + f_evi.description = inventory.value(evi + "/description", "UNKNOWN").value(); + f_evi.image = inventory.value(evi + "/image", "UNKNOWN.png").value(); + local_evidence_list.append(f_evi); + } + private_evidence_list = local_evidence_list; + set_evidence_page(); } bool Courtroom::compare_evidence_changed(evi_type evi_a, evi_type evi_b) { - return evi_a.name != evi_b.name || evi_a.image != evi_b.image || evi_a.description != evi_b.description; + return evi_a.name != evi_b.name || evi_a.image != evi_b.image || evi_a.description != evi_b.description; } diff --git a/src/file_functions.cpp b/src/file_functions.cpp index f93ee15d..e2b28824 100644 --- a/src/file_functions.cpp +++ b/src/file_functions.cpp @@ -2,20 +2,21 @@ bool file_exists(QString file_path) { - QFileInfo check_file(file_path); + QFileInfo check_file(file_path); - return check_file.exists() && check_file.isFile(); + return check_file.exists() && check_file.isFile(); } bool dir_exists(QString dir_path) { - QDir check_dir(dir_path); + QDir check_dir(dir_path); - return check_dir.exists(); + return check_dir.exists(); } -bool exists(QString p_path) { - QFile file(p_path); +bool exists(QString p_path) +{ + QFile file(p_path); - return file.exists(); + return file.exists(); } diff --git a/src/hardware_functions.cpp b/src/hardware_functions.cpp index bd6a6c3c..21d72ece 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,43 +10,41 @@ static BOOL bIsRetrieved; QString get_hdid() { - 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 - return "gxsps32sa9fnwic92mfbs0"; + 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 + return "gxsps32sa9fnwic92mfbs0"; } -#elif (defined (LINUX) || defined (__linux__)) +#elif (defined(LINUX) || defined(__linux__)) #include #include QString get_hdid() { - QFile fstab_file("/etc/fstab"); - if (!fstab_file.open(QIODevice::ReadOnly)) - return "gxcps32sa9fnwic92mfbs0"; + QFile fstab_file("/etc/fstab"); + if (!fstab_file.open(QIODevice::ReadOnly)) + return "gxcps32sa9fnwic92mfbs0"; - QTextStream in(&fstab_file); + QTextStream in(&fstab_file); - while(!in.atEnd()) - { - QString line = in.readLine(); + while (!in.atEnd()) { + QString line = in.readLine(); - if (line.startsWith("UUID")) - { - QStringList line_elements = line.split("="); + if (line.startsWith("UUID")) { + QStringList line_elements = line.split("="); - if (line_elements.size() > 1) - return line_elements.at(1).left(23).trimmed(); + if (line_elements.size() > 1) + return line_elements.at(1).left(23).trimmed(); + } } - } - return "gxcpz32sa9fnwic92mfbs0"; + return "gxcpz32sa9fnwic92mfbs0"; } #elif defined __APPLE__ @@ -56,25 +54,24 @@ QString get_hdid() QString get_hdid() { CFStringRef serial; - char buffer[64] = {0}; - QString hdid; - io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, + char buffer[64] = {0}; + QString hdid; + io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); - if (platformExpert) - { - CFTypeRef serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert, + 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); + if (serialNumberAsCFString) { + serial = (CFStringRef)serialNumberAsCFString; + } + if (CFStringGetCString(serial, buffer, 64, kCFStringEncodingUTF8)) { + hdid = buffer; } - return hdid; + + IOObjectRelease(platformExpert); + } + return hdid; } #else diff --git a/src/hex_functions.cpp b/src/hex_functions.cpp index 4a58d2b4..63293c14 100644 --- a/src/hex_functions.cpp +++ b/src/hex_functions.cpp @@ -1,18 +1,17 @@ #include "hex_functions.h" -namespace omni -{ - std::string int_to_hex(unsigned int input) - { - if (input > 255) - return "FF"; +namespace omni { + std::string int_to_hex(unsigned int input) + { + if (input > 255) + return "FF"; - std::stringstream stream; - stream << std::setfill('0') << std::setw(sizeof(char)*2) - << std::hex << input; - 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 19bb4c66..30a8ed02 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -1,198 +1,193 @@ #include "lobby.h" -#include "debug_functions.h" #include "aoapplication.h" -#include "networkmanager.h" #include "aosfxplayer.h" +#include "debug_functions.h" +#include "networkmanager.h" Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() { - 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_settings = new AOButton(this, ao_app); - - ui_server_list = new QTreeWidget(this); - ui_server_list->setHeaderLabels({"#", "Name"});//, "Players"}); - ui_server_list->hideColumn(0); - - ui_server_search = new QLineEdit(this); - ui_server_search->setFrame(false); - ui_server_search->setPlaceholderText(tr("Search")); - - ui_player_count = new QLabel(this); - ui_description = new AOTextArea(this); - ui_description->setOpenExternalLinks(true); - 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_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked())); - connect(ui_server_list, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(on_server_list_clicked(QTreeWidgetItem*, int))); - connect(ui_server_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(on_server_list_doubleclicked(QTreeWidgetItem*, int))); - connect(ui_server_search, SIGNAL(textChanged(QString)), this, SLOT(on_server_search_edited(QString))); - 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(); + 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_settings = new AOButton(this, ao_app); + + ui_server_list = new QTreeWidget(this); + ui_server_list->setHeaderLabels({"#", "Name"}); //, "Players"}); + ui_server_list->hideColumn(0); + + ui_server_search = new QLineEdit(this); + ui_server_search->setFrame(false); + ui_server_search->setPlaceholderText(tr("Search")); + + ui_player_count = new QLabel(this); + ui_description = new AOTextArea(this); + ui_description->setOpenExternalLinks(true); + 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_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked())); + connect(ui_server_list, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(on_server_list_clicked(QTreeWidgetItem *, int))); + connect(ui_server_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(on_server_list_doubleclicked(QTreeWidgetItem *, int))); + connect(ui_server_search, SIGNAL(textChanged(QString)), this, SLOT(on_server_search_edited(QString))); + 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(); + ao_app->reload_theme(); - QString filename = "lobby_design.ini"; + QString filename = "lobby_design.ini"; - pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename); + 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 " << filename; + if (f_lobby.width < 0 || f_lobby.height < 0) { + qDebug() << "W: did not find lobby width or height in " << filename; - // Most common symptom of bad config files and missing assets. - 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?")); + // 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); - } + 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"); + set_size_and_pos(ui_background, "lobby"); + ui_background->set_image("lobbybackground"); - set_size_and_pos(ui_public_servers, "public_servers"); - ui_public_servers->set_image("publicservers_selected"); + set_size_and_pos(ui_public_servers, "public_servers"); + ui_public_servers->set_image("publicservers_selected"); - set_size_and_pos(ui_favorites, "favorites"); - ui_favorites->set_image("favorites"); + set_size_and_pos(ui_favorites, "favorites"); + ui_favorites->set_image("favorites"); - set_size_and_pos(ui_refresh, "refresh"); - ui_refresh->set_image("refresh"); + set_size_and_pos(ui_refresh, "refresh"); + ui_refresh->set_image("refresh"); - set_size_and_pos(ui_add_to_fav, "add_to_fav"); - ui_add_to_fav->set_image("addtofav"); + set_size_and_pos(ui_add_to_fav, "add_to_fav"); + ui_add_to_fav->set_image("addtofav"); - set_size_and_pos(ui_connect, "connect"); - ui_connect->set_image("connect"); + set_size_and_pos(ui_connect, "connect"); + ui_connect->set_image("connect"); - set_size_and_pos(ui_version, "version"); - ui_version->setText(tr("Version: KFO%1").arg(ao_app->get_version_string())); + set_size_and_pos(ui_version, "version"); + ui_version->setText(tr("Version: KFO%1").arg(ao_app->get_version_string())); - set_size_and_pos(ui_about, "about"); - ui_about->set_image("about"); + set_size_and_pos(ui_about, "about"); + ui_about->set_image("about"); - set_size_and_pos(ui_settings, "settings"); - ui_settings->setText(tr("Settings")); - ui_settings->set_image("settings"); - ui_settings->setToolTip(tr("Allows you to change various aspects of the client.")); + set_size_and_pos(ui_settings, "settings"); + ui_settings->setText(tr("Settings")); + ui_settings->set_image("settings"); + ui_settings->setToolTip(tr("Allows you to change various aspects of the client.")); - set_size_and_pos(ui_server_list, "server_list"); - ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);" + 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_server_search, "server_search"); - ui_server_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); - - 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_server_search, "server_search"); + ui_server_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); - 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_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_chatbox, "chatbox"); - ui_chatbox->setReadOnly(true); - ui_chatbox->setStyleSheet("QTextBrowser{background-color: rgba(0, 0, 0, 0);}"); + 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_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_chatbox, "chatbox"); + ui_chatbox->setReadOnly(true); + ui_chatbox->setStyleSheet("QTextBrowser{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);"); + 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);"); - ui_loading_background->resize(this->width(), this->height()); - ui_loading_background->set_image("loadingbackground"); + 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"); - 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_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")); + 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(); + ui_loading_background->hide(); - set_fonts(); - set_stylesheets(); + set_fonts(); + set_stylesheets(); } void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier) { - QString filename = "lobby_design.ini"; + QString filename = "lobby_design.ini"; - pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); + pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); - if (design_ini_result.width < 0 || design_ini_result.height < 0) - { - 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); - } + 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_fonts() @@ -208,169 +203,170 @@ void Lobby::set_fonts() void Lobby::set_stylesheet(QWidget *widget, QString target_tag) { - QString f_file = "lobby_stylesheets.css"; - QString style_sheet_string = ao_app->get_tagged_stylesheet(target_tag, f_file); - if (style_sheet_string != "") - widget->setStyleSheet(style_sheet_string); + QString f_file = "lobby_stylesheets.css"; + QString style_sheet_string = ao_app->get_tagged_stylesheet(target_tag, f_file); + if (style_sheet_string != "") + widget->setStyleSheet(style_sheet_string); } void Lobby::set_stylesheets() { - set_stylesheet(ui_player_count, "[PLAYER COUNT]"); - set_stylesheet(ui_description, "[DESCRIPTION]"); - set_stylesheet(ui_chatbox, "[CHAT BOX]"); - set_stylesheet(ui_chatname, "[CHAT NAME]"); - set_stylesheet(ui_chatmessage, "[CHAT MESSAGE]"); - set_stylesheet(ui_loading_text, "[LOADING TEXT]"); - set_stylesheet(ui_server_list, "[SERVER LIST]"); + set_stylesheet(ui_player_count, "[PLAYER COUNT]"); + set_stylesheet(ui_description, "[DESCRIPTION]"); + set_stylesheet(ui_chatbox, "[CHAT BOX]"); + set_stylesheet(ui_chatname, "[CHAT NAME]"); + set_stylesheet(ui_chatmessage, "[CHAT MESSAGE]"); + set_stylesheet(ui_loading_text, "[LOADING TEXT]"); + set_stylesheet(ui_server_list, "[SERVER LIST]"); } void Lobby::set_font(QWidget *widget, QString p_identifier) { - QString design_file = "lobby_fonts.ini"; - int f_weight = ao_app->get_font_size(p_identifier, design_file); - QString class_name = widget->metaObject()->className(); - QString font_name = ao_app->get_font_name("font_" + p_identifier, design_file); - QFont font(font_name, f_weight); - bool use = ao_app->get_font_size("use_custom_fonts", design_file) == 1; - if(use) - { - widget->setFont(font); - QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? - bool center = ao_app->get_font_size(p_identifier + "_center", design_file) == 1; // should it be centered? - QString is_bold = ""; - if(bold) is_bold = "bold"; - QString is_center = ""; - if(center) is_center = "qproperty-alignment: AlignCenter;"; - 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);\n" + - is_center + "\n" + - "font: " + is_bold + "; }"; - widget->setStyleSheet(style_sheet_string); - } - return; + QString design_file = "lobby_fonts.ini"; + int f_weight = ao_app->get_font_size(p_identifier, design_file); + QString class_name = widget->metaObject()->className(); + QString font_name = ao_app->get_font_name("font_" + p_identifier, design_file); + QFont font(font_name, f_weight); + bool use = ao_app->get_font_size("use_custom_fonts", design_file) == 1; + if (use) { + widget->setFont(font); + QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); + bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? + bool center = ao_app->get_font_size(p_identifier + "_center", design_file) == 1; // should it be centered? + QString is_bold = ""; + if (bold) + is_bold = "bold"; + QString is_center = ""; + if (center) + is_center = "qproperty-alignment: AlignCenter;"; + 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);\n" + + is_center + "\n" + + "font: " + is_bold + "; }"; + widget->setStyleSheet(style_sheet_string); + } + return; } void Lobby::set_loading_text(QString p_text) { - ui_loading_text->clear(); - ui_loading_text->setAlignment(Qt::AlignCenter); - ui_loading_text->append(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(); + QString return_value = ui_chatbox->toPlainText(); - return return_value; + return return_value; } int Lobby::get_selected_server() { - return ui_server_list->currentItem()->text(0).toInt(); + return ui_server_list->currentItem()->text(0).toInt(); } void Lobby::set_loading_value(int p_value) { - ui_progress_bar->setValue(p_value); + ui_progress_bar->setValue(p_value); } void Lobby::on_public_servers_clicked() { - ui_public_servers->set_image("publicservers_selected"); - ui_favorites->set_image("favorites"); + ui_public_servers->set_image("publicservers_selected"); + ui_favorites->set_image("favorites"); - list_servers(); + list_servers(); - public_servers_selected = true; + public_servers_selected = true; } void Lobby::on_favorites_clicked() { - ui_favorites->set_image("favorites_selected"); - ui_public_servers->set_image("publicservers"); + ui_favorites->set_image("favorites_selected"); + ui_public_servers->set_image("publicservers"); - ao_app->set_favorite_list(); - //ao_app->favorite_list = read_serverlist_txt(); + ao_app->set_favorite_list(); + //ao_app->favorite_list = read_serverlist_txt(); - list_favorites(); + list_favorites(); - public_servers_selected = false; + public_servers_selected = false; } void Lobby::on_refresh_pressed() { - ui_refresh->set_image("refresh_pressed"); + ui_refresh->set_image("refresh_pressed"); } void Lobby::on_refresh_released() { - ui_refresh->set_image("refresh"); + ui_refresh->set_image("refresh"); - AOPacket *f_packet = new AOPacket("ALL#%"); + AOPacket *f_packet = new AOPacket("ALL#%"); - ao_app->send_ms_packet(f_packet); + ao_app->send_ms_packet(f_packet); } void Lobby::on_add_to_fav_pressed() { - ui_add_to_fav->set_image("addtofav_pressed"); + ui_add_to_fav->set_image("addtofav_pressed"); } void Lobby::on_add_to_fav_released() { - ui_add_to_fav->set_image("addtofav"); + ui_add_to_fav->set_image("addtofav"); - //you cant add favorites from favorites m8 - if (!public_servers_selected) - return; + //you cant add favorites from favorites m8 + if (!public_servers_selected) + return; - ao_app->add_favorite_server(get_selected_server()); + ao_app->add_favorite_server(get_selected_server()); } void Lobby::on_connect_pressed() { - ui_connect->set_image("connect_pressed"); + ui_connect->set_image("connect_pressed"); } void Lobby::on_connect_released() { - ui_connect->set_image("connect"); + ui_connect->set_image("connect"); - AOPacket *f_packet; + AOPacket *f_packet; - f_packet = new AOPacket("askchaa#%"); + f_packet = new AOPacket("askchaa#%"); - ao_app->send_server_packet(f_packet); + 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:
" - "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter" - "

2.8 Major Release development:
" - "Crystalwarrior, Iamgoofball" - "

2.8 Quality Assurance:
" - "WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry," - "CedricDewitt, Chewable Tablets, Fantos, Futugaze," - "Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy," - "GreenBowers, Robotic Overlord, Veritas, Gin-Gi" - "

Special thanks:
" - "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), " - "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " - "Noevain, Cronnicossy, the AO2 community, server hosts, game masters," - "case makers, content creators and players!") - .arg(ao_app->get_version_string()); - QMessageBox::about(this, "About", msg); + 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" + "

2.8 Major Release development:
" + "Crystalwarrior, Iamgoofball" + "

2.8 Quality Assurance:
" + "WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry," + "CedricDewitt, Chewable Tablets, Fantos, Futugaze," + "Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy," + "GreenBowers, Robotic Overlord, Veritas, Gin-Gi" + "

Special thanks:
" + "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), " + "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " + "Noevain, Cronnicossy, the AO2 community, server hosts, game masters," + "case makers, content creators and players!") + .arg(ao_app->get_version_string()); + QMessageBox::about(this, "About", msg); } void Lobby::on_settings_clicked() @@ -379,51 +375,48 @@ void Lobby::on_settings_clicked() } //clicked on an item in the serverlist -void Lobby::on_server_list_clicked(QTreeWidgetItem* p_item, int column) +void Lobby::on_server_list_clicked(QTreeWidgetItem *p_item, int column) { - column = 0; - if (p_item->text(column).toInt() != last_index) - { - server_type f_server; - int n_server = p_item->text(column).toInt(); - last_index = n_server; + column = 0; + if (p_item->text(column).toInt() != last_index) { + server_type f_server; + int n_server = p_item->text(column).toInt(); + last_index = n_server; - if (n_server < 0) - return; + if (n_server < 0) + return; - if (public_servers_selected) - { - QVector f_server_list = ao_app->get_server_list(); + if (public_servers_selected) { + QVector f_server_list = ao_app->get_server_list(); - if (n_server >= f_server_list.size()) - return; + if (n_server >= f_server_list.size()) + return; - f_server = f_server_list.at(n_server); - } - else - { - if (n_server >= ao_app->get_favorite_list().size()) - return; + f_server = f_server_list.at(n_server); + } + else { + if (n_server >= ao_app->get_favorite_list().size()) + return; - f_server = ao_app->get_favorite_list().at(n_server); - } + f_server = ao_app->get_favorite_list().at(n_server); + } - ui_description->clear(); - ui_description->append_linked(f_server.desc); + ui_description->clear(); + ui_description->append_linked(f_server.desc); - ui_description->moveCursor(QTextCursor::Start); - ui_description->ensureCursorVisible(); + ui_description->moveCursor(QTextCursor::Start); + ui_description->ensureCursorVisible(); - ui_player_count->setText(tr("Offline")); + ui_player_count->setText(tr("Offline")); - ui_connect->setEnabled(false); + ui_connect->setEnabled(false); - ao_app->net_manager->connect_to_server(f_server); - } + 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(QTreeWidgetItem* p_item, int column) +void Lobby::on_server_list_doubleclicked(QTreeWidgetItem *p_item, int column) { on_server_list_clicked(p_item, column); on_connect_released(); @@ -431,106 +424,98 @@ void Lobby::on_server_list_doubleclicked(QTreeWidgetItem* p_item, int column) void Lobby::on_server_search_edited(QString p_text) { - // Iterate through all QTreeWidgetItem items - QTreeWidgetItemIterator it(ui_server_list); - while (*it) - { - (*it)->setHidden(p_text != ""); - ++it; - } - - if (p_text != "") - { - //Search in metadata - QList clist = ui_server_list->findItems(ui_server_search->text(), Qt::MatchContains|Qt::MatchRecursive, 1); - foreach(QTreeWidgetItem* item, clist) - { - if (item->parent() != nullptr) //So the category shows up too - item->parent()->setHidden(false); - item->setHidden(false); + // Iterate through all QTreeWidgetItem items + QTreeWidgetItemIterator it(ui_server_list); + while (*it) { + (*it)->setHidden(p_text != ""); + ++it; } - } -} + if (p_text != "") { + //Search in metadata + QList clist = ui_server_list->findItems(ui_server_search->text(), Qt::MatchContains | Qt::MatchRecursive, 1); + foreach (QTreeWidgetItem *item, clist) { + if (item->parent() != nullptr) //So the category shows up too + item->parent()->setHidden(false); + item->setHidden(false); + } + } +} void Lobby::on_chatfield_return_pressed() { - //no you can't send empty messages - if (ui_chatname->text() == "" || ui_chatmessage->text() == "") - return; - + //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()}; + QString f_header = "CT"; + QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()}; - AOPacket *f_packet = new AOPacket(f_header, f_contents); + AOPacket *f_packet = new AOPacket(f_header, f_contents); - ao_app->send_ms_packet(f_packet); + ao_app->send_ms_packet(f_packet); - ui_chatmessage->clear(); + ui_chatmessage->clear(); } void Lobby::list_servers() { - public_servers_selected = true; - ui_favorites->set_image("favorites"); - ui_public_servers->set_image("publicservers_selected"); + public_servers_selected = true; + ui_favorites->set_image("favorites"); + ui_public_servers->set_image("publicservers_selected"); - ui_server_list->setSortingEnabled(false); - ui_server_list->clear(); + ui_server_list->setSortingEnabled(false); + ui_server_list->clear(); - ui_server_search->setText(""); + ui_server_search->setText(""); - int i = 0; - for (server_type i_server : ao_app->get_server_list()) - { - QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); - treeItem->setText(0, QString::number(i)); - treeItem->setText(1, i_server.name); - i++; - } - ui_server_list->setSortingEnabled(true); + int i = 0; + for (server_type i_server : ao_app->get_server_list()) { + QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); + treeItem->setText(0, QString::number(i)); + treeItem->setText(1, i_server.name); + i++; + } + ui_server_list->setSortingEnabled(true); } void Lobby::list_favorites() { - ui_server_list->setSortingEnabled(false); - ui_server_list->clear(); + ui_server_list->setSortingEnabled(false); + ui_server_list->clear(); - int i = 0; - for (server_type i_server : ao_app->get_favorite_list()) - { - QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); - treeItem->setText(0, QString::number(i)); - treeItem->setText(1, i_server.name); -// treeItem->setText(2, "-"); - i++; - } - ui_server_list->setSortingEnabled(true); + int i = 0; + for (server_type i_server : ao_app->get_favorite_list()) { + QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); + treeItem->setText(0, QString::number(i)); + treeItem->setText(1, i_server.name); + // treeItem->setText(2, "-"); + i++; + } + ui_server_list->setSortingEnabled(true); } void Lobby::append_chatmessage(QString f_name, QString f_message) { - ui_chatbox->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name()); + ui_chatbox->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name()); } void Lobby::append_error(QString f_message) { - ui_chatbox->append_error(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); + 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); + ui_connect->setEnabled(true); } Lobby::~Lobby() { - } diff --git a/src/main.cpp b/src/main.cpp index 8d3f53b1..9370bcea 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,13 +1,13 @@ #include "aoapplication.h" +#include "courtroom.h" #include "datatypes.h" -#include "networkmanager.h" #include "lobby.h" -#include "courtroom.h" -#include +#include "networkmanager.h" #include -#include #include +#include +#include int main(int argc, char *argv[]) { @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) QTranslator qtTranslator; qtTranslator.load("qt_" + p_language, - QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + QLibraryInfo::location(QLibraryInfo::TranslationsPath)); main_app.installTranslator(&qtTranslator); QTranslator appTranslator; diff --git a/src/misc_functions.cpp b/src/misc_functions.cpp index 23520551..fa49ba48 100644 --- a/src/misc_functions.cpp +++ b/src/misc_functions.cpp @@ -2,8 +2,8 @@ void delay(int p_milliseconds) { - QTime dieTime = QTime::currentTime().addMSecs(p_milliseconds); + QTime dieTime = QTime::currentTime().addMSecs(p_milliseconds); - while(QTime::currentTime() < dieTime) - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + while (QTime::currentTime() < dieTime) + QCoreApplication::processEvents(QEventLoop::AllEvents, 100); } diff --git a/src/networkmanager.cpp b/src/networkmanager.cpp index a9810d49..19f02415 100644 --- a/src/networkmanager.cpp +++ b/src/networkmanager.cpp @@ -6,242 +6,220 @@ NetworkManager::NetworkManager(AOApplication *parent) : QObject(parent) { - ao_app = parent; + ao_app = parent; - ms_socket = new QTcpSocket(this); - server_socket = new QTcpSocket(this); + ms_socket = new QTcpSocket(this); + server_socket = new QTcpSocket(this); - ms_reconnect_timer = new QTimer(this); - ms_reconnect_timer->setSingleShot(true); - QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, SLOT(retry_ms_connect())); + ms_reconnect_timer = new QTimer(this); + ms_reconnect_timer->setSingleShot(true); + QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, SLOT(retry_ms_connect())); - QObject::connect(ms_socket, SIGNAL(readyRead()), this, SLOT(handle_ms_packet())); - QObject::connect(server_socket, SIGNAL(readyRead()), this, SLOT(handle_server_packet())); - QObject::connect(server_socket, SIGNAL(disconnected()), ao_app, SLOT(server_disconnected())); + 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(); - if (master_config != "") - ms_nosrv_hostname = master_config; + QString master_config = ao_app->configini->value("master", "").value(); + if (master_config != "") + ms_nosrv_hostname = master_config; } NetworkManager::~NetworkManager() { - } void NetworkManager::connect_to_master() { - ms_socket->close(); - ms_socket->abort(); + ms_socket->close(); + ms_socket->abort(); #ifdef MS_FAILOVER_SUPPORTED - perform_srv_lookup(); + perform_srv_lookup(); #else - connect_to_master_nosrv(); + connect_to_master_nosrv(); #endif } 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())); - ms_socket->connectToHost(ms_nosrv_hostname, ms_port); + QObject::connect(ms_socket, SIGNAL(connected()), + this, SLOT(on_ms_nosrv_connect_success())); + ms_socket->connectToHost(ms_nosrv_hostname, ms_port); } void NetworkManager::connect_to_server(server_type p_server) { - server_socket->close(); - server_socket->abort(); + server_socket->close(); + server_socket->abort(); - server_socket->connectToHost(p_server.ip, p_server.port); + server_socket->connectToHost(p_server.ip, p_server.port); } void NetworkManager::ship_ms_packet(QString p_packet) { - if (!ms_socket->isOpen()) - { - retry_ms_connect(); - } - else - { - ms_socket->write(p_packet.toUtf8()); - } + if (!ms_socket->isOpen()) { + retry_ms_connect(); + } + else { + ms_socket->write(p_packet.toUtf8()); + } } void NetworkManager::ship_server_packet(QString p_packet) { - server_socket->write(p_packet.toUtf8()); + server_socket->write(p_packet.toUtf8()); } void NetworkManager::handle_ms_packet() { - QByteArray buffer = ms_socket->readAll(); - QString in_data = QString::fromUtf8(buffer, buffer.size()); - - if (!in_data.endsWith("%")) - { - ms_partial_packet = true; - ms_temp_packet += in_data; - return; - } - - else - { - if (ms_partial_packet) - { - in_data = ms_temp_packet + in_data; - ms_temp_packet = ""; - ms_partial_packet = false; + QByteArray buffer = ms_socket->readAll(); + QString in_data = QString::fromUtf8(buffer, buffer.size()); + + if (!in_data.endsWith("%")) { + ms_partial_packet = true; + ms_temp_packet += in_data; + return; + } + + 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) - { - AOPacket *f_packet = new AOPacket(packet); + for (QString packet : packet_list) { + AOPacket *f_packet = new AOPacket(packet); - ao_app->ms_packet_received(f_packet); - } + ao_app->ms_packet_received(f_packet); + } } - void NetworkManager::perform_srv_lookup() { - #ifdef MS_FAILOVER_SUPPORTED - ms_dns = new QDnsLookup(QDnsLookup::SRV, ms_srv_hostname, this); +#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 + connect(ms_dns, SIGNAL(finished()), this, SLOT(on_srv_lookup())); + ms_dns->lookup(); +#endif } void NetworkManager::on_srv_lookup() { - #ifdef MS_FAILOVER_SUPPORTED - bool connected = false; - if (ms_dns->error() != QDnsLookup::NoError) - { - qWarning("SRV lookup of the master server DNS failed."); - ms_dns->deleteLater(); - } - else - { - const auto srv_records = ms_dns->serviceRecords(); - - for (const QDnsServiceRecord &record : srv_records) - { +#ifdef MS_FAILOVER_SUPPORTED + bool connected = false; + if (ms_dns->error() != QDnsLookup::NoError) { + qWarning("SRV lookup of the master server DNS failed."); + ms_dns->deleteLater(); + } + else { + const auto srv_records = ms_dns->serviceRecords(); + + for (const QDnsServiceRecord &record : srv_records) { #ifdef DEBUG_NETWORK - qDebug() << "Connecting to " << record.target() << ":" << record.port(); + qDebug() << "Connecting to " << record.target() << ":" << record.port(); #endif - ms_socket->connectToHost(record.target(), record.port()); - QTime timer; - timer.start(); - do - { - ao_app->processEvents(); - if (ms_socket->state() == QAbstractSocket::ConnectedState) - { - connected = true; - break; + ms_socket->connectToHost(record.target(), record.port()); + QTime timer; + timer.start(); + do { + ao_app->processEvents(); + 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) { + qDebug() << ms_socket->error(); + 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))); + break; + } + else { + ms_socket->abort(); + ms_socket->close(); + } } - 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(); - 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))); - break; - } - else - { - ms_socket->abort(); - ms_socket->close(); - } } - } - // Failover to non-SRV connection - if (!connected) - connect_to_master_nosrv(); - else - emit ms_connect_finished(connected, false); - #endif + // Failover to non-SRV connection + if (!connected) + connect_to_master_nosrv(); + else + emit ms_connect_finished(connected, false); +#endif } void NetworkManager::on_ms_nosrv_connect_success() { - emit ms_connect_finished(true, false); + 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))); + // 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))); - emit ms_connect_finished(false, true); + emit ms_connect_finished(false, true); - ms_reconnect_timer->start(ms_reconnect_delay * 1000); + ms_reconnect_timer->start(ms_reconnect_delay * 1000); } void NetworkManager::retry_ms_connect() { - if (!ms_reconnect_timer->isActive() && ms_socket->state() != QAbstractSocket::ConnectingState) - connect_to_master(); + if (!ms_reconnect_timer->isActive() && ms_socket->state() != QAbstractSocket::ConnectingState) + connect_to_master(); } void NetworkManager::handle_server_packet() { - QByteArray buffer = server_socket->readAll(); - QString in_data = QString::fromUtf8(buffer, buffer.size()); - - if (!in_data.endsWith("%")) - { - partial_packet = true; - temp_packet += in_data; - return; - } - - else - { - if (partial_packet) - { - in_data = temp_packet + in_data; - temp_packet = ""; - partial_packet = false; + QByteArray buffer = server_socket->readAll(); + QString in_data = QString::fromUtf8(buffer, buffer.size()); + + if (!in_data.endsWith("%")) { + partial_packet = true; + temp_packet += in_data; + return; } - } - QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts)); + else { + if (partial_packet) { + in_data = temp_packet + in_data; + temp_packet = ""; + partial_packet = false; + } + } - for (QString packet : packet_list) - { - AOPacket *f_packet = new AOPacket(packet); + QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts)); - ao_app->server_packet_received(f_packet); - } + 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 23050836..68f568ba 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -1,776 +1,699 @@ #include "aoapplication.h" -#include "lobby.h" #include "courtroom.h" -#include "networkmanager.h" +#include "debug_functions.h" #include "encryption_functions.h" #include "hardware_functions.h" -#include "debug_functions.h" +#include "lobby.h" +#include "networkmanager.h" void AOApplication::ms_packet_received(AOPacket *p_packet) { - p_packet->net_decode(); + p_packet->net_decode(); - QString header = p_packet->get_header(); - QStringList f_contents = p_packet->get_contents(); + 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(); + if (header != "CHECK") + qDebug() << "R(ms):" << p_packet->to_string(); #endif - if (header == "ALL") - { - server_list.clear(); + if (header == "ALL") { + server_list.clear(); - for (QString i_string : p_packet->get_contents()) - { - server_type f_server; - QStringList sub_contents = i_string.split("&"); + 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; - } + 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(); + 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); - } + server_list.append(f_server); + } - if (lobby_constructed) - { - w_lobby->list_servers(); + if (lobby_constructed) { + w_lobby->list_servers(); + } } - } - else if (header == "CT") - { - QString f_name, f_message; + 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 (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); + 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(); + 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; + } + } - 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(); } - call_notice(tr("Outdated version! Your version: %1\n" - "Please go to aceattorneyonline.com to update.") - .arg(get_version_string())); - destruct_courtroom(); - destruct_lobby(); - } - - end: +end: - delete p_packet; + delete p_packet; } void AOApplication::server_packet_received(AOPacket *p_packet) { - p_packet->net_decode(); + p_packet->net_decode(); - QString header = p_packet->get_header(); - QStringList f_contents = p_packet->get_contents(); - QString f_packet = p_packet->to_string(); + 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; + 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; - additive_enabled = false; - effects_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("prezoom",Qt::CaseInsensitive)) - prezoom_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; - if (f_packet.contains("additive",Qt::CaseInsensitive)) - additive_enabled = true; - if (f_packet.contains("effects",Qt::CaseInsensitive)) - effects_enabled = true; - } - 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, QString::number(info.port)); - qDebug() << server_address; - 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 = QString("%1:%2").arg(info.ip, QString::number(info.port)); - qDebug() << server_address; - 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); - - //Remove any characters not accepted in folder names for the server_name here - this->log_filename = QDateTime::currentDateTime().toUTC().toString("'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|\']")) + "/'ddd MMMM yyyy hh.mm.ss t'.log'"); - this->write_to_file("Joined server " + server_name + " on address " + server_address +" on " + QDateTime::currentDateTime().toUTC().toString(), log_filename, true); - 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; + 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; + additive_enabled = false; + effects_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; - //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; + s_pv = f_contents.at(0).toInt(); + server_software = f_contents.at(1); - QStringList sub_elements = f_contents.at(n_element + 1).split("&"); - if (sub_elements.size() < 2) - break; + w_lobby->enable_connect_button(); - 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; + 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("prezoom", Qt::CaseInsensitive)) + prezoom_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; + if (f_packet.contains("additive", Qt::CaseInsensitive)) + additive_enabled = true; + if (f_packet.contains("effects", Qt::CaseInsensitive)) + effects_enabled = true; + } + else if (header == "PN") { + if (f_contents.size() < 2) + goto end; - ++loaded_chars; + 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, QString::number(info.port)); + qDebug() << server_address; + 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 = QString("%1:%2").arg(info.ip, QString::number(info.port)); + qDebug() << server_address; + window_title += ": " + server_name; + } + } - w_lobby->set_loading_text("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size)); + w_courtroom->set_window_title(window_title); - w_courtroom->append_char(f_char); + w_lobby->show_loading_overlay(); + w_lobby->set_loading_text(tr("Loading")); + w_lobby->set_loading_value(0); - 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); - } + AOPacket *f_packet; - 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 + "#%")); + if (improved_loading_enabled) + f_packet = new AOPacket("RC#%"); + else + f_packet = new AOPacket("askchar2#%"); + + send_server_packet(f_packet); + + //Remove any characters not accepted in folder names for the server_name here + this->log_filename = QDateTime::currentDateTime().toUTC().toString("'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|\']")) + "/'ddd MMMM yyyy hh.mm.ss t'.log'"); + this->write_to_file("Joined server " + server_name + " on address " + server_address + " on " + QDateTime::currentDateTime().toUTC().toString(), log_filename, true); + 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; - } - else if (header == "EI") - { - 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; - // +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; + QStringList sub_elements = f_contents.at(n_element + 1).split("&"); + if (sub_elements.size() < 2) + break; - if (f_contents.size() < 2) - goto end; + 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; - QStringList sub_elements = f_contents.at(1).split("&"); - if (sub_elements.size() < 4) - goto end; + ++loaded_chars; - 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); + w_lobby->set_loading_text("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size)); - ++loaded_evidence; + w_courtroom->append_char(f_char); - w_lobby->set_loading_text(tr("Loading evidence:\n%1/%2").arg(QString::number(loaded_evidence)).arg(QString::number(evidence_list_size))); + 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_courtroom->append_evidence(f_evi); + 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; - 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); + // +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; - QString next_packet_number = QString::number(loaded_evidence); - send_server_packet(new AOPacket("AE#" + next_packet_number + "#%")); + if (f_contents.size() < 2) + goto end; - } - else if (header == "EM") - { - if (!courtroom_constructed) - goto end; + QStringList sub_elements = f_contents.at(1).split("&"); + if (sub_elements.size() < 4) + goto end; - bool musics_time = false; - int areas = 0; + 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); - 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))); - - if (musics_time) - { - w_courtroom->append_music(f_music); - } - else - { - if (f_music.endsWith(".wav") || - f_music.endsWith(".mp3") || - f_music.endsWith(".mp4") || - f_music.endsWith(".ogg") || - f_music.endsWith(".opus")) - { - musics_time = true; - areas--; - w_courtroom->fix_last_area(); - w_courtroom->append_music(f_music); - } - else - { - w_courtroom->append_area(f_music); - areas++; - } - } - - 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); + ++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 musics_time = 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))); + + if (musics_time) { + w_courtroom->append_music(f_music); + } + else { + if (f_music.endsWith(".wav") || + f_music.endsWith(".mp3") || + f_music.endsWith(".mp4") || + f_music.endsWith(".ogg") || + f_music.endsWith(".opus")) { + musics_time = true; + areas--; + w_courtroom->fix_last_area(); + w_courtroom->append_music(f_music); + } + else { + w_courtroom->append_area(f_music); + areas++; + } + } + + 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); + } - else if (header == "SC") - { - if (!courtroom_constructed) - goto end; + 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); + } + } - for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element) - { - QStringList sub_elements = f_contents.at(n_element).split("&"); + else if (header == "SC") { + if (!courtroom_constructed) + goto end; - char_type f_char; - f_char.name = sub_elements.at(0); - if (sub_elements.size() >= 2) - f_char.description = sub_elements.at(1); + for (int n_element = 0; n_element < f_contents.size(); ++n_element) { + QStringList sub_elements = f_contents.at(n_element).split("&"); - //temporary. the CharsCheck packet sets this properly - f_char.taken = false; + char_type f_char; + f_char.name = sub_elements.at(0); + if (sub_elements.size() >= 2) + f_char.description = sub_elements.at(1); - ++loaded_chars; + //temporary. the CharsCheck packet sets this properly + f_char.taken = false; - w_lobby->set_loading_text(tr("Loading chars:\n%1/%2").arg(QString::number(loaded_chars)).arg(QString::number(char_list_size))); + ++loaded_chars; - w_courtroom->append_char(f_char); + w_lobby->set_loading_text(tr("Loading chars:\n%1/%2").arg(QString::number(loaded_chars)).arg(QString::number(char_list_size))); - 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_courtroom->append_char(f_char); - send_server_packet(new AOPacket("RM#%")); - } - else if (header == "SM") - { - if (!courtroom_constructed) - goto end; + 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); + } - bool musics_time = false; - int areas = 0; + send_server_packet(new AOPacket("RM#%")); + } + else if (header == "SM") { + if (!courtroom_constructed) + goto end; + + bool musics_time = false; + int areas = 0; + + for (int n_element = 0; n_element < f_contents.size(); ++n_element) { + ++loaded_music; + + w_lobby->set_loading_text(tr("Loading music:\n%1/%2").arg(QString::number(loaded_music)).arg(QString::number(music_list_size))); + + if (musics_time) { + w_courtroom->append_music(f_contents.at(n_element)); + } + else { + if (f_contents.at(n_element).endsWith(".wav") || + f_contents.at(n_element).endsWith(".mp3") || + f_contents.at(n_element).endsWith(".mp4") || + f_contents.at(n_element).endsWith(".ogg") || + f_contents.at(n_element).endsWith(".opus")) { + musics_time = true; + w_courtroom->fix_last_area(); + w_courtroom->append_music(f_contents.at(n_element)); + areas--; + } + else { + w_courtroom->append_area(f_contents.at(n_element)); + areas++; + } + } + + 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); + } - for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element) - { - ++loaded_music; - - w_lobby->set_loading_text(tr("Loading music:\n%1/%2").arg(QString::number(loaded_music)).arg(QString::number(music_list_size))); - - if (musics_time) - { - w_courtroom->append_music(f_contents.at(n_element)); - } - else - { - if (f_contents.at(n_element).endsWith(".wav") || - f_contents.at(n_element).endsWith(".mp3") || - f_contents.at(n_element).endsWith(".mp4") || - f_contents.at(n_element).endsWith(".ogg") || - f_contents.at(n_element).endsWith(".opus")) - { - musics_time = true; - w_courtroom->fix_last_area(); - w_courtroom->append_music(f_contents.at(n_element)); - areas--; - } - else - { - w_courtroom->append_area(f_contents.at(n_element)); - areas++; - } - } - - 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); - } - - send_server_packet(new AOPacket("RD#%")); - } - else if (header == "FM") //Fetch music ONLY - { - if (!courtroom_constructed) - goto end; - - w_courtroom->clear_music(); - - for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element) - { - w_courtroom->append_music(f_contents.at(n_element)); + send_server_packet(new AOPacket("RD#%")); } + else if (header == "FM") //Fetch music ONLY + { + if (!courtroom_constructed) + goto end; - w_courtroom->list_music(); - } - else if (header == "FA") //Fetch areas ONLY - { - if (!courtroom_constructed) - goto end; + w_courtroom->clear_music(); - w_courtroom->clear_areas(); + for (int n_element = 0; n_element < f_contents.size(); ++n_element) { + w_courtroom->append_music(f_contents.at(n_element)); + } - for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element) - { - w_courtroom->append_area(f_contents.at(n_element)); + w_courtroom->list_music(); } + else if (header == "FA") //Fetch areas ONLY + { + if (!courtroom_constructed) + goto end; - w_courtroom->list_areas(); - } - else if (header == "DONE") - { - if (!courtroom_constructed) - goto end; + w_courtroom->clear_areas(); - if (lobby_constructed) - w_courtroom->append_ms_chatmessage("", w_lobby->get_chatlog()); + for (int n_element = 0; n_element < f_contents.size(); ++n_element) { + w_courtroom->append_area(f_contents.at(n_element)); + } - w_courtroom->character_loading_finished(); - w_courtroom->done_received(); + w_courtroom->list_areas(); + } + else if (header == "DONE") { + if (!courtroom_constructed) + goto end; - courtroom_loaded = true; + if (lobby_constructed) + w_courtroom->append_ms_chatmessage("", w_lobby->get_chatlog()); - destruct_lobby(); - } - else if (header == "BN") - { - if (f_contents.size() < 1) - goto end; + w_courtroom->character_loading_finished(); + w_courtroom->done_received(); - if (courtroom_constructed) - { - if (f_contents.size() >= 2) //We have a pos included in the background packet! - w_courtroom->set_side(f_contents.at(1)); - w_courtroom->set_background(f_contents.at(0), f_contents.size() >= 2); + courtroom_loaded = true; + + destruct_lobby(); + } + else if (header == "BN") { + if (f_contents.size() < 1) + goto end; + + if (courtroom_constructed) { + if (f_contents.size() >= 2) //We have a pos included in the background packet! + w_courtroom->set_side(f_contents.at(1)); + w_courtroom->set_background(f_contents.at(0), f_contents.size() >= 2); + } } - } - else if (header == "SP") - { - if (f_contents.size() < 1) - goto end; + else if (header == "SP") { + if (f_contents.size() < 1) + goto end; - if (courtroom_constructed) //We were sent a "set position" packet - { - w_courtroom->set_side(f_contents.at(0)); - } - } - else if (header == "SD") //Send pos dropdown - { - if (f_contents.size() < 1) - goto end; - - w_courtroom->set_pos_dropdown(f_contents.at(0).split("*")); - } - //server accepting char request(CC) packet - else if (header == "PV") - { - if (f_contents.size() < 3) - goto end; - - if (courtroom_constructed) - w_courtroom->update_character(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) + if (courtroom_constructed) //We were sent a "set position" packet + { + w_courtroom->set_side(f_contents.at(0)); + } + } + else if (header == "SD") //Send pos dropdown { - QVector f_evi_list; + if (f_contents.size() < 1) + goto end; - for (QString f_string : f_contents) - { - QStringList sub_contents = f_string.split("&"); + w_courtroom->set_pos_dropdown(f_contents.at(0).split("*")); + } + //server accepting char request(CC) packet + else if (header == "PV") { + if (f_contents.size() < 3) + goto end; - if (sub_contents.size() < 3) - continue; + if (courtroom_constructed) + w_courtroom->update_character(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; - 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)); + 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 == "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() > 6) - w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", f_contents.at(2) == "1", f_contents.at(3) == "1", f_contents.at(4) == "1", f_contents.at(5) == "1"); - } - - end: - - delete p_packet; + } + else if (header == "ARUP") { + if (courtroom_constructed) { + int arup_type = f_contents.at(0).toInt(); + for (int n_element = 1; n_element < f_contents.size(); n_element++) { + w_courtroom->arup_modify(arup_type, n_element - 1, f_contents.at(n_element)); + } + } + } + else if (header == "IL") { + 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() > 6) + w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", f_contents.at(2) == "1", f_contents.at(3) == "1", f_contents.at(4) == "1", f_contents.at(5) == "1"); + } + +end: + + delete p_packet; } void AOApplication::send_ms_packet(AOPacket *p_packet) { - p_packet->net_encode(); + p_packet->net_encode(); - QString f_packet = p_packet->to_string(); + QString f_packet = p_packet->to_string(); - net_manager->ship_ms_packet(f_packet); + net_manager->ship_ms_packet(f_packet); #ifdef DEBUG_NETWORK - qDebug() << "S(ms):" << f_packet; + qDebug() << "S(ms):" << f_packet; #endif - delete p_packet; + delete p_packet; } void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded) { - if (encoded) - p_packet->net_encode(); + if (encoded) + p_packet->net_encode(); - QString f_packet = p_packet->to_string(); + QString f_packet = p_packet->to_string(); - if (encryption_needed) - { + if (encryption_needed) { #ifdef DEBUG_NETWORK - qDebug() << "S(e):" << f_packet; + qDebug() << "S(e):" << f_packet; #endif - p_packet->encrypt_header(s_decryptor); - f_packet = p_packet->to_string(); - } - else - { + p_packet->encrypt_header(s_decryptor); + f_packet = p_packet->to_string(); + } + else { #ifdef DEBUG_NETWORK - qDebug() << "S:" << f_packet; + qDebug() << "S:" << f_packet; #endif - } + } - net_manager->ship_server_packet(f_packet); + net_manager->ship_server_packet(f_packet); - delete p_packet; + delete p_packet; } diff --git a/src/path_functions.cpp b/src/path_functions.cpp index 5eb97a32..ebf4b629 100644 --- a/src/path_functions.cpp +++ b/src/path_functions.cpp @@ -3,8 +3,8 @@ #include "file_functions.h" #include -#include #include +#include #ifdef BASE_OVERRIDE #include "base_override.h" @@ -14,151 +14,153 @@ //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__)) +#if (defined(LINUX) || defined(__linux__)) #define CASE_SENSITIVE_FILESYSTEM #endif QString AOApplication::get_base_path() { - QString 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/"; - } + 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/"; + base_path = applicationDirPath() + "/../../../base/"; #else - base_path = applicationDirPath() + "/base/"; + base_path = applicationDirPath() + "/base/"; #endif - return base_path; + return base_path; } QString AOApplication::get_data_path() { - return get_base_path() + "data/"; + return get_base_path() + "data/"; } QString AOApplication::get_default_theme_path(QString p_file) { - QString path = get_base_path() + "themes/default/" + p_file; + QString path = get_base_path() + "themes/default/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + 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; + QString path = get_base_path() + "themes/" + p_theme + "/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + 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; + QString path = get_base_path() + "themes/" + current_theme + "/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + 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; + QString path = get_base_path() + "characters/" + p_char + "/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + return get_case_sensitive_path(path); #endif } QString AOApplication::get_sounds_path(QString p_file) { - QString path = get_base_path() + "sounds/general/" + p_file; + QString path = get_base_path() + "sounds/general/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + return get_case_sensitive_path(path); #endif } QString AOApplication::get_music_path(QString p_song) { - QString path = get_base_path() + "sounds/music/" + p_song; + QString path = get_base_path() + "sounds/music/" + p_song; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + return get_case_sensitive_path(path); #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) { + QString path = get_base_path() + "background/" + w_courtroom->get_current_background() + "/" + p_file; + if (courtroom_constructed) { #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + return get_case_sensitive_path(path); #endif - } - return get_default_background_path(p_file); + } + 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; + QString path = get_base_path() + "background/default/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + return get_case_sensitive_path(path); #endif } QString AOApplication::get_evidence_path(QString p_file) { - QString path = get_base_path() + "evidence/" + p_file; + QString path = get_base_path() + "evidence/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + 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; +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); + QFileInfo file(p_file); - QString file_basename = file.fileName(); - QString file_parent_dir = get_case_sensitive_path(file.absolutePath()); + 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; + //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(); + //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); + int result = files.indexOf(file_rx); - if (result != -1) - return file_parent_dir + "/" + files.at(result); + 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; + //if nothing is found, let the caller handle the missing file + return file_parent_dir + "/" + file_basename; } diff --git a/src/scrolltext.cpp b/src/scrolltext.cpp index 6cf075d2..543f0f62 100644 --- a/src/scrolltext.cpp +++ b/src/scrolltext.cpp @@ -1,12 +1,10 @@ #include "scrolltext.h" - -ScrollText::ScrollText(QWidget *parent) : - QWidget(parent), scrollPos(0) +ScrollText::ScrollText(QWidget *parent) : QWidget(parent), scrollPos(0) { staticText.setTextFormat(Qt::PlainText); -// setFixedHeight(fontMetrics().height()*2); //The theme sets this + // setFixedHeight(fontMetrics().height()*2); //The theme sets this leftMargin = height() / 3; setSeparator(" --- "); @@ -44,10 +42,9 @@ void ScrollText::updateText() timer.stop(); singleTextWidth = fontMetrics().horizontalAdvance(_text); - scrollEnabled = (singleTextWidth > width() - leftMargin*2); + scrollEnabled = (singleTextWidth > width() - leftMargin * 2); - if(scrollEnabled) - { + if (scrollEnabled) { scrollPos = -64; staticText.setText(_text + _separator); timer.start(); @@ -59,20 +56,18 @@ void ScrollText::updateText() wholeTextSize = QSize(fontMetrics().horizontalAdvance(staticText.text()), fontMetrics().height()); } -void ScrollText::paintEvent(QPaintEvent*) +void ScrollText::paintEvent(QPaintEvent *) { QPainter p(this); - if(scrollEnabled) - { + if (scrollEnabled) { buffer.fill(qRgba(0, 0, 0, 0)); QPainter pb(&buffer); pb.setPen(p.pen()); pb.setFont(p.font()); int x = qMin(-scrollPos, 0) + leftMargin; - while(x < width()) - { + while (x < width()) { pb.drawStaticText(QPointF(x, (height() - wholeTextSize.height()) / 2), staticText); x += wholeTextSize.width(); } @@ -83,20 +78,19 @@ void ScrollText::paintEvent(QPaintEvent*) pb.drawImage(0, 0, alphaChannel); pb.setClipRect(0, 0, 15, height()); //initial situation: don't apply alpha channel in the left half of the image at all; apply it more and more until scrollPos gets positive - if(scrollPos < 0) + if (scrollPos < 0) pb.setOpacity(static_cast((qMax(-8, scrollPos) + 8) / 8.0)); pb.drawImage(0, 0, alphaChannel); //pb.end(); p.drawImage(0, 0, buffer); } - else - { + else { p.drawStaticText(QPointF(leftMargin, (height() - wholeTextSize.height()) / 2), staticText); } } -void ScrollText::resizeEvent(QResizeEvent*) +void ScrollText::resizeEvent(QResizeEvent *) { //When the widget is resized, we need to update the alpha channel. @@ -104,31 +98,28 @@ void ScrollText::resizeEvent(QResizeEvent*) buffer = QImage(size(), QImage::Format_ARGB32_Premultiplied); //Create Alpha Channel: - if(width() > 64) - { + if (width() > 64) { //create first scanline - QRgb* scanline1 = reinterpret_cast(alphaChannel.scanLine(0)); - for(int x = 1; x < 16; ++x) + QRgb *scanline1 = reinterpret_cast(alphaChannel.scanLine(0)); + for (int x = 1; x < 16; ++x) scanline1[x - 1] = scanline1[width() - x] = qRgba(0, 0, 0, x << 4); - for(int x = 15; x < width() - 15; ++x) + for (int x = 15; x < width() - 15; ++x) scanline1[x] = qRgb(0, 0, 0); //copy scanline to the other ones - for(int y = 1; y < height(); ++y) + for (int y = 1; y < height(); ++y) memcpy(alphaChannel.scanLine(y), scanline1, static_cast(width() * 4)); } else alphaChannel.fill(qRgb(0, 0, 0)); - //Update scrolling state bool newScrollEnabled = (singleTextWidth > width() - leftMargin); - if(newScrollEnabled != scrollEnabled) + if (newScrollEnabled != scrollEnabled) updateText(); } void ScrollText::timer_timeout() { - scrollPos = (scrollPos + 2) - % wholeTextSize.width(); + scrollPos = (scrollPos + 2) % wholeTextSize.width(); update(); } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index d9867094..18da8538 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -2,110 +2,108 @@ QString AOApplication::read_theme() { - QString result = configini->value("theme", "default").value(); - return result; + QString result = configini->value("theme", "default").value(); + return result; } int AOApplication::read_blip_rate() { - int result = configini->value("blip_rate", 2).toInt(); + int result = configini->value("blip_rate", 2).toInt(); - if (result < 1) - return 1; + if (result < 1) + return 1; - return result; + return result; } QString AOApplication::get_ooc_name() { - QString result = configini->value("ooc_name").value(); - return result; + 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 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 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 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 result = configini->value("log_maximum", 200).toInt(); + return result; } bool AOApplication::get_log_goes_downwards() { - QString result = configini->value("log_goes_downwards", "true").value(); - return result.startsWith("true"); + QString result = configini->value("log_goes_downwards", "true").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 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 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; + QString result = configini->value("default_audio_device", "default").value(); + return result; } QStringList AOApplication::get_call_words() { - return get_list_file(get_base_path() + "callwords.ini"); + return get_list_file(get_base_path() + "callwords.ini"); } QStringList AOApplication::get_list_file(QString p_file) { - QStringList return_value; + QStringList return_value; - QFile p_ini; + QFile p_ini; - p_ini.setFileName(p_file); + p_ini.setFileName(p_file); - if (!p_ini.open(QIODevice::ReadOnly)) - return return_value; + if (!p_ini.open(QIODevice::ReadOnly)) + return return_value; - QTextStream in(&p_ini); + QTextStream in(&p_ini); - while (!in.atEnd()) - { - QString line = in.readLine(); - return_value.append(line); - } + while (!in.atEnd()) { + QString line = in.readLine(); + return_value.append(line); + } - return return_value; + return return_value; } QString AOApplication::read_file(QString filename) { QFile f_log(filename); - if(!f_log.open(QIODevice::ReadOnly | QIODevice::Text)) - { + if (!f_log.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug() << "Couldn't open" << filename; return ""; } @@ -119,18 +117,16 @@ QString AOApplication::read_file(QString filename) bool AOApplication::write_to_file(QString p_text, QString p_file, bool make_dir) { QString path = QFileInfo(p_file).path(); - if(make_dir) - { - //Create the dir if it doesn't exist yet - QDir dir(path); - if (!dir.exists()) - if (!dir.mkpath(".")) - return false; + if (make_dir) { + //Create the dir if it doesn't exist yet + QDir dir(path); + if (!dir.exists()) + if (!dir.mkpath(".")) + return false; } QFile f_log(p_file); - if(f_log.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) - { + if (f_log.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { QTextStream out(&f_log); out << p_text; @@ -146,20 +142,19 @@ bool AOApplication::append_to_file(QString p_text, QString p_file, bool make_dir { QString path = QFileInfo(p_file).path(); //Create the dir if it doesn't exist yet - if(make_dir) - { - QDir dir(path); - if (!dir.exists()) - if (!dir.mkpath(".")) - return false; + if (make_dir) { + QDir dir(path); + if (!dir.exists()) + if (!dir.mkpath(".")) + return false; } QFile f_log(p_file); - if(f_log.open(QIODevice::WriteOnly | QIODevice::Append)) - { + if (f_log.open(QIODevice::WriteOnly | QIODevice::Append)) { QTextStream out(&f_log); - out << "\r\n" << p_text; + out << "\r\n" + << p_text; f_log.flush(); f_log.close(); @@ -170,369 +165,354 @@ bool AOApplication::append_to_file(QString p_text, QString p_file, bool make_dir void AOApplication::write_to_serverlist_txt(QString p_line) { - QFile serverlist_txt; - QString serverlist_txt_path = get_base_path() + "serverlist.txt"; + QFile serverlist_txt; + QString serverlist_txt_path = get_base_path() + "serverlist.txt"; - serverlist_txt.setFileName(serverlist_txt_path); + serverlist_txt.setFileName(serverlist_txt_path); - if (!serverlist_txt.open(QIODevice::WriteOnly | QIODevice::Append)) - { - return; - } + if (!serverlist_txt.open(QIODevice::WriteOnly | QIODevice::Append)) { + return; + } - QTextStream out(&serverlist_txt); + QTextStream out(&serverlist_txt); - out << "\r\n" << p_line; + out << "\r\n" + << p_line; - serverlist_txt.close(); + serverlist_txt.close(); } QVector AOApplication::read_serverlist_txt() { - QVector f_server_list; + QVector f_server_list; - QFile serverlist_txt; - QString serverlist_txt_path = get_base_path() + "serverlist.txt"; + QFile serverlist_txt; + QString serverlist_txt_path = get_base_path() + "serverlist.txt"; - serverlist_txt.setFileName(serverlist_txt_path); + serverlist_txt.setFileName(serverlist_txt_path); - if (!serverlist_txt.open(QIODevice::ReadOnly)) - { - return f_server_list; - } + if (!serverlist_txt.open(QIODevice::ReadOnly)) { + return f_server_list; + } - QTextStream in(&serverlist_txt); + QTextStream in(&serverlist_txt); - while(!in.atEnd()) - { - QString line = in.readLine(); - server_type f_server; - QStringList line_contents = line.split(":"); + while (!in.atEnd()) { + QString line = in.readLine(); + server_type f_server; + QStringList line_contents = line.split(":"); - if (line_contents.size() < 3) - continue; + 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.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); - } + f_server_list.append(f_server); + } - return f_server_list; + 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.type() == QVariant::StringList) { - return value.toStringList().join(","); - } else { - return value.toString(); - } + QSettings settings(p_design_path, QSettings::IniFormat); + QVariant value = settings.value(p_identifier); + 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); + 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; + QPoint return_value; - return_value.setX(0); - return_value.setY(0); + return_value.setX(0); + return_value.setY(0); - if (f_result == "") - { - f_result = read_design_ini(p_identifier, default_path); + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); - if (f_result == "") - return return_value; - } + if (f_result == "") + return return_value; + } - QStringList sub_line_elements = f_result.split(","); + QStringList sub_line_elements = f_result.split(","); - if (sub_line_elements.size() < 2) - return return_value; + 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_value.setX(sub_line_elements.at(0).toInt()); + return_value.setY(sub_line_elements.at(1).toInt()); - return return_value; + return return_value; } pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QString p_file, QString p_char) { - QString char_ini_path = get_base_path() + "misc/" + get_chat(p_char) + "/" + 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, char_ini_path); + QString char_ini_path = get_base_path() + "misc/" + get_chat(p_char) + "/" + 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, char_ini_path); - pos_size_type return_value; + pos_size_type return_value; - return_value.x = 0; - return_value.y = 0; - return_value.width = -1; - return_value.height = -1; + 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, design_ini_path); - if (f_result == "") - { - f_result = read_design_ini(p_identifier, default_path); + if (f_result == "") { + 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_value; + if (f_result == "") + return return_value; + } } - } - QStringList sub_line_elements = f_result.split(","); + QStringList sub_line_elements = f_result.split(","); - if (sub_line_elements.size() < 4) - return return_value; + 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_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; + return return_value; } QString AOApplication::get_design_element(QString p_identifier, QString p_file, QString p_char) { - QString char_ini_path = get_base_path() + "misc/" + get_chat(p_char) + "/" + 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, char_ini_path); - if (f_result == "") - { - f_result = read_design_ini(p_identifier, design_ini_path); - if (f_result == "") - f_result = read_design_ini(p_identifier, default_path); - } - return f_result; + QString char_ini_path = get_base_path() + "misc/" + get_chat(p_char) + "/" + 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, char_ini_path); + if (f_result == "") { + f_result = read_design_ini(p_identifier, design_ini_path); + if (f_result == "") + f_result = read_design_ini(p_identifier, default_path); + } + return f_result; } 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 ""; - } - return f_result; + 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 ""; + } + 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); + 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 == "") { + f_result = read_design_ini(p_identifier, default_path); - if (f_result == "") - return 10; - } + if (f_result == "") + return 10; + } - return f_result.toInt(); + 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); + 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); + QColor return_color(0, 0, 0); - if (f_result == "") - { - f_result = read_design_ini(p_identifier, default_path); + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); - if (f_result == "") - return return_color; - } + if (f_result == "") + return return_color; + } - QStringList color_list = f_result.split(","); + QStringList color_list = f_result.split(","); - if (color_list.size() < 3) - return return_color; + 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_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; + return return_color; } QString AOApplication::get_stylesheet(QString p_file) { - QString design_ini_path = get_theme_path(p_file); - QString default_path = get_default_theme_path(p_file); + QString design_ini_path = get_theme_path(p_file); + QString default_path = get_default_theme_path(p_file); - QFile design_ini; + QFile design_ini; - design_ini.setFileName(design_ini_path); + design_ini.setFileName(design_ini_path); - if(!design_ini.open(QIODevice::ReadOnly)) - { - design_ini.setFileName(default_path); - if(!design_ini.open(QIODevice::ReadOnly)) - return ""; - } + if (!design_ini.open(QIODevice::ReadOnly)) { + design_ini.setFileName(default_path); + if (!design_ini.open(QIODevice::ReadOnly)) + return ""; + } - QTextStream in(&design_ini); + QTextStream in(&design_ini); - QString f_text; + QString f_text; - while(!in.atEnd()) - { - f_text.append(in.readLine()); - } + while (!in.atEnd()) { + f_text.append(in.readLine()); + } - design_ini.close(); - return f_text; + design_ini.close(); + return f_text; } QString AOApplication::get_tagged_stylesheet(QString target_tag, QString p_file) { - QString design_ini_path = get_theme_path(p_file); + QString design_ini_path = get_theme_path(p_file); + + QFile design_ini; - QFile design_ini; + design_ini.setFileName(design_ini_path); - design_ini.setFileName(design_ini_path); + if (!design_ini.open(QIODevice::ReadOnly)) + return ""; - if(!design_ini.open(QIODevice::ReadOnly)) - return ""; + QTextStream in(&design_ini); - QTextStream in(&design_ini); + QString f_text; - QString f_text; + bool tag_found = false; - bool tag_found = false; + while (!in.atEnd()) { + QString line = in.readLine(); - while(!in.atEnd()) - { - QString line = in.readLine(); + if (line.startsWith(target_tag, Qt::CaseInsensitive)) { + tag_found = true; + continue; + } - if (line.startsWith(target_tag, Qt::CaseInsensitive)) - { - tag_found = true; - continue; + if (tag_found) { + if ((line.startsWith("[") && line.endsWith("]"))) + break; + f_text.append(line); + } } - if(tag_found) - { - if((line.startsWith("[") && line.endsWith("]"))) - break; - f_text.append(line); - } - } - - design_ini.close(); - return f_text; + design_ini.close(); + return f_text; } QString AOApplication::get_chat_markdown(QString p_identifier, QString p_chat) { - 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); + 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 == "") + f_result = read_design_ini(p_identifier, default_path); - return f_result.toLatin1(); + return f_result.toLatin1(); } QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) { - QColor return_color(255, 255, 255); + QColor return_color(255, 255, 255); - switch (p_identifier.toInt()) { + switch (p_identifier.toInt()) { case 0: //White - return_color = QColor(255, 255, 255); - break; + return_color = QColor(255, 255, 255); + break; case 1: //Green - return_color = QColor(0, 255, 0); - break; + return_color = QColor(0, 255, 0); + break; case 2: //Red - return_color = QColor(255, 0, 0); - break; + return_color = QColor(255, 0, 0); + break; case 3: //Orange - return_color = QColor(255, 165, 0); - break; + return_color = QColor(255, 165, 0); + break; case 4: //Blue - return_color = QColor(45, 150, 255); - break; + return_color = QColor(45, 150, 255); + break; case 5: //Yellow - return_color = QColor(255, 255, 0); - break; + return_color = QColor(255, 255, 0); + break; case 6: //Pink - return_color = QColor(255, 192, 203); - break; + return_color = QColor(255, 192, 203); + break; case 7: //Cyan - return_color = QColor(0, 255, 255); - break; + return_color = QColor(0, 255, 255); + break; case 8: //Grey - return_color = QColor(187, 187, 187); - break; + return_color = QColor(187, 187, 187); + break; default: - return_color = QColor(255, 255, 255); - break; - } - 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("c" + p_identifier, design_ini_path); + return_color = QColor(255, 255, 255); + break; + } + 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("c" + p_identifier, design_ini_path); - if (f_result == "") - { - f_result = read_design_ini(p_identifier, default_path); + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); - if (f_result == "") - return return_color; - } + if (f_result == "") + return return_color; + } - QStringList color_list = f_result.split(","); + QStringList color_list = f_result.split(","); - if (color_list.size() < 3) - return return_color; + 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_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; + 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 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 = ""; + QString return_sfx = ""; - if (f_result == "") - { - f_result = read_design_ini(p_identifier, default_path); + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); - if (f_result == "") - return return_sfx; - } + if (f_result == "") + return return_sfx; + } - return_sfx = f_result; + return_sfx = f_result; - return return_sfx; + return return_sfx; } QString AOApplication::get_sfx_suffix(QString sound_to_check) @@ -572,381 +552,368 @@ QString AOApplication::get_static_image_suffix(QString path_to_check) //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; + 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; } void AOApplication::set_char_ini(QString p_char, QString value, QString p_search_line, QString target_tag) { - QSettings settings(get_character_path(p_char, "char.ini"), QSettings::IniFormat); - settings.beginGroup(target_tag); - settings.setValue(p_search_line, value); - settings.endGroup(); + QSettings settings(get_character_path(p_char, "char.ini"), QSettings::IniFormat); + settings.beginGroup(target_tag); + settings.setValue(p_search_line, value); + settings.endGroup(); } //returns all the values of target_tag QStringList AOApplication::read_ini_tags(QString p_path, QString target_tag) { - QStringList r_values; - QSettings settings(p_path, QSettings::IniFormat); - if (!target_tag.isEmpty()) - settings.beginGroup(target_tag); - QStringList keys = settings.allKeys(); - foreach (QString key, keys) - { - QString value = settings.value(key).toString(); - r_values << key + "=" + value; - } - if (!settings.group().isEmpty()) - settings.endGroup(); - return r_values; + QStringList r_values; + QSettings settings(p_path, QSettings::IniFormat); + if (!target_tag.isEmpty()) + settings.beginGroup(target_tag); + QStringList keys = settings.allKeys(); + foreach (QString key, keys) { + QString value = settings.value(key).toString(); + r_values << key + "=" + value; + } + if (!settings.group().isEmpty()) + settings.endGroup(); + return r_values; } QString AOApplication::get_char_name(QString p_char) { - QString f_result = read_char_ini(p_char, "name", "Options"); + QString f_result = read_char_ini(p_char, "name", "Options"); - if (f_result == "") - return p_char; - return f_result; + if (f_result == "") + return p_char; + 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"); + 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; - return f_result; + if (f_needed.startsWith("false")) + return ""; + if (f_result == "") + return p_char; + return f_result; } QString AOApplication::get_char_side(QString p_char) { - QString f_result = read_char_ini(p_char, "side", "Options"); + QString f_result = read_char_ini(p_char, "side", "Options"); - if (f_result == "") - return "wit"; - return f_result; + if (f_result == "") + return "wit"; + return f_result; } QString AOApplication::get_gender(QString p_char) { - QString f_result = read_char_ini(p_char, "gender", "Options"); + QString f_result = read_char_ini(p_char, "gender", "Options"); - if (f_result == "") - return "sfx-blipmale"; + if (f_result == "") + return "sfx-blipmale"; - if (!file_exists(get_sfx_suffix(get_sounds_path(f_result)))) - { - if (file_exists(get_sfx_suffix(get_sounds_path("../blips/" + f_result)))) - return "../blips/" + f_result; //Return the cool kids variant + if (!file_exists(get_sfx_suffix(get_sounds_path(f_result)))) { + if (file_exists(get_sfx_suffix(get_sounds_path("../blips/" + f_result)))) + return "../blips/" + f_result; //Return the cool kids variant - return "sfx-blip" + f_result; //Return legacy variant - } - return f_result; + return "sfx-blip" + f_result; //Return legacy variant + } + return f_result; } QString AOApplication::get_chat(QString p_char) { - QString f_result = read_char_ini(p_char, "chat", "Options"); + 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; + //handling the correct order of chat is a bit complicated, we let the caller do it + return f_result; } QString AOApplication::get_chat_font(QString p_char) { - QString f_result = read_char_ini(p_char, "chat_font", "Options"); + QString f_result = read_char_ini(p_char, "chat_font", "Options"); - return f_result; + return f_result; } int AOApplication::get_chat_size(QString p_char) { - QString f_result = read_char_ini(p_char, "chat_size", "Options"); + QString f_result = read_char_ini(p_char, "chat_size", "Options"); - if (f_result == "") - return -1; - return f_result.toInt(); + if (f_result == "") + return -1; + return f_result.toInt(); } QString AOApplication::get_char_shouts(QString p_char) { - QString f_result = read_char_ini(p_char, "shouts", "Options"); - if (f_result == "") - return "default"; - return f_result; + QString f_result = read_char_ini(p_char, "shouts", "Options"); + if (f_result == "") + return "default"; + 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"); + QString f_result = read_char_ini(p_char, p_emote, "Time"); - if (f_result == "") - return -1; - return f_result.toInt(); + if (f_result == "") + return -1; + 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"); + QString f_result = read_char_ini(p_char, "%" + p_emote, "Time"); - if (f_result == "") - return -1; - return f_result.toInt(); + if (f_result == "") + return -1; + return f_result.toInt(); } int AOApplication::get_emote_number(QString p_char) { - QString f_result = read_char_ini(p_char, "number", "Emotions"); + QString f_result = read_char_ini(p_char, "number", "Emotions"); - if (f_result == "") - return 0; - return f_result.toInt(); + if (f_result == "") + return 0; + return f_result.toInt(); } QString AOApplication::get_emote_comment(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); - QStringList result_contents = f_result.split("#"); + QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 4) - { - qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; - return "normal"; - } - return result_contents.at(0); + if (result_contents.size() < 4) { + qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; + return "normal"; + } + return result_contents.at(0); } QString AOApplication::get_pre_emote(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); - QStringList result_contents = f_result.split("#"); + QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 4) - { - qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; - return ""; - } - return result_contents.at(1); + if (result_contents.size() < 4) { + qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; + return ""; + } + return result_contents.at(1); } QString AOApplication::get_emote(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); - QStringList result_contents = f_result.split("#"); + QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 4) - { - qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; - return "normal"; - } - return result_contents.at(2); + if (result_contents.size() < 4) { + qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; + return "normal"; + } + return result_contents.at(2); } int AOApplication::get_emote_mod(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); - QStringList result_contents = f_result.split("#"); + QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 4) - { - qDebug() << "W: misformatted char.ini: " << p_char << ", " << QString::number(p_emote); - return 0; - } - return result_contents.at(3).toInt(); + if (result_contents.size() < 4) { + qDebug() << "W: misformatted char.ini: " << p_char << ", " << QString::number(p_emote); + return 0; + } + return result_contents.at(3).toInt(); } int AOApplication::get_desk_mod(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); - QStringList result_contents = f_result.split("#"); + QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 5) - return -1; + if (result_contents.size() < 5) + return -1; - QString string_result = result_contents.at(4); - if (string_result == "") - return -1; + QString string_result = result_contents.at(4); + if (string_result == "") + return -1; - return string_result.toInt(); + return string_result.toInt(); } QString AOApplication::get_sfx_name(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundN"); + QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundN"); - if (f_result == "") - return "1"; - return f_result; + if (f_result == "") + return "1"; + return f_result; } QString AOApplication::get_emote_blip(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundB"); - return f_result; + QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundB"); + return f_result; } int AOApplication::get_sfx_delay(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundT"); + QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundT"); - if (f_result == "") - return 1; - return f_result.toInt(); + if (f_result == "") + return 1; + return f_result.toInt(); } QString AOApplication::get_sfx_looping(QString p_char, QString p_sfx) { - QString f_result = read_char_ini(p_char, p_sfx, "SoundL"); + QString f_result = read_char_ini(p_char, p_sfx, "SoundL"); - if (f_result == "") - return "0"; - return f_result; + if (f_result == "") + return "0"; + return f_result; } QString AOApplication::get_sfx_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("_FrameSFX")); + QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameSFX")); - if (f_result == "") - return ""; - return f_result; + if (f_result == "") + return ""; + 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")); + QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameScreenshake")); - if (f_result == "") - return ""; - return f_result; + if (f_result == "") + return ""; + return f_result; } QString AOApplication::get_flash_frame(QString p_char, QString p_emote, int n_frame) { - QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameRealization")); + QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameRealization")); - if (f_result == "") - return ""; - return f_result; + if (f_result == "") + return ""; + return f_result; } int AOApplication::get_text_delay(QString p_char, QString p_emote) { - QString f_result = read_char_ini(p_char, p_emote, "TextDelay"); + QString f_result = read_char_ini(p_char, p_emote, "TextDelay"); - if (f_result == "") - return -1; - return f_result.toInt(); + if (f_result == "") + return -1; + return f_result.toInt(); } QStringList AOApplication::get_theme_effects() { - QString p_path = get_theme_path("effects/effects.ini"); - QString default_path = get_default_theme_path("effects/effects.ini"); + QString p_path = get_theme_path("effects/effects.ini"); + QString default_path = get_default_theme_path("effects/effects.ini"); - QStringList effects; - if (!file_exists(p_path)) - { - p_path = default_path; - if (!file_exists(p_path)) - return effects; - } + QStringList effects; + if (!file_exists(p_path)) { + p_path = default_path; + if (!file_exists(p_path)) + return effects; + } - QStringList lines = read_file(p_path).split("\n"); - foreach (QString effect, lines) - { - effect = effect.split("=")[0].trimmed(); - if (!effect.isEmpty() && !effects.contains(effect)) - effects.append(effect); - } - return effects; + QStringList lines = read_file(p_path).split("\n"); + foreach (QString effect, lines) { + effect = effect.split("=")[0].trimmed(); + if (!effect.isEmpty() && !effects.contains(effect)) + effects.append(effect); + } + return effects; } QStringList AOApplication::get_effects(QString p_char) { - QString p_effect = read_char_ini(p_char, "effects", "Options"); - QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; + QString p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; - QStringList effects = get_theme_effects(); - if (!file_exists(p_path)) - return effects; + QStringList effects = get_theme_effects(); + if (!file_exists(p_path)) + return effects; - QStringList lines = read_file(p_path).split("\n"); - foreach (QString effect, lines) - { - effect = effect.split("=")[0].trimmed(); - if (!effect.isEmpty() && !effects.contains(effect)) - effects.append(effect); - } + QStringList lines = read_file(p_path).split("\n"); + foreach (QString effect, lines) { + effect = effect.split("=")[0].trimmed(); + if (!effect.isEmpty() && !effects.contains(effect)) + effects.append(effect); + } - return effects; + return effects; } QString AOApplication::get_effect(QString effect, QString p_char, QString p_folder) { - QString p_effect = p_folder; - if (p_folder == "") - p_effect = read_char_ini(p_char, "effects", "Options"); - - QString p_path = get_image_suffix(get_base_path() + "misc/" + p_effect + "/" + effect); - QString design_ini_path = get_image_suffix(get_theme_path("effects/" + effect)); - QString default_path = get_image_suffix(get_default_theme_path("effects/" + effect)); - - if (!file_exists(p_path)) - { - p_path = design_ini_path; - if (!file_exists(p_path)) - { - p_path = default_path; - if (!file_exists(p_path)) - { - return ""; - } + QString p_effect = p_folder; + if (p_folder == "") + p_effect = read_char_ini(p_char, "effects", "Options"); + + QString p_path = get_image_suffix(get_base_path() + "misc/" + p_effect + "/" + effect); + QString design_ini_path = get_image_suffix(get_theme_path("effects/" + effect)); + QString default_path = get_image_suffix(get_default_theme_path("effects/" + effect)); + + if (!file_exists(p_path)) { + p_path = design_ini_path; + if (!file_exists(p_path)) { + p_path = default_path; + if (!file_exists(p_path)) { + return ""; + } + } } - } - return p_path; + return p_path; } QString AOApplication::get_effect_sound(QString fx_name, QString p_char) { - QString p_effect = read_char_ini(p_char, "effects", "Options"); - QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; - QString design_ini_path = get_theme_path("effects/effects.ini"); - QString default_path = get_default_theme_path("effects/effects.ini"); - - QString f_result = read_design_ini(fx_name, p_path); - if (f_result == "") - { - f_result = read_design_ini(fx_name, design_ini_path); - if (f_result == "") - { - f_result = read_design_ini(fx_name, default_path); + QString p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; + QString design_ini_path = get_theme_path("effects/effects.ini"); + QString default_path = get_default_theme_path("effects/effects.ini"); + + QString f_result = read_design_ini(fx_name, p_path); + if (f_result == "") { + f_result = read_design_ini(fx_name, design_ini_path); + if (f_result == "") { + f_result = read_design_ini(fx_name, default_path); + } } - } - return f_result; + return f_result; } QString AOApplication::get_custom_realization(QString p_char) { - QString f_result = read_char_ini(p_char, "realization", "Options"); + QString f_result = read_char_ini(p_char, "realization", "Options"); - if (f_result == "") - return get_sfx("realization"); - else return get_sfx_suffix(get_sounds_path(f_result)); + if (f_result == "") + return get_sfx("realization"); + else + return get_sfx_suffix(get_sounds_path(f_result)); } bool AOApplication::get_blank_blip() @@ -1047,8 +1014,8 @@ bool AOApplication::get_casing_juror_enabled() bool AOApplication::get_casing_steno_enabled() { - QString result = configini->value("casing_steno_enabled", "false").value(); - return result.startsWith("true"); + QString result = configini->value("casing_steno_enabled", "false").value(); + return result.startsWith("true"); } bool AOApplication::get_casing_cm_enabled() @@ -1059,6 +1026,6 @@ bool AOApplication::get_casing_cm_enabled() QString AOApplication::get_casing_can_host_cases() { - QString result = configini->value("casing_can_host_cases", "Turnabout Check Your Settings").value(); - return result; + QString result = configini->value("casing_can_host_cases", "Turnabout Check Your Settings").value(); + return result; } -- cgit From 88de4cde0433ef5e606f38a2f1e6041f0d24a87e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 22 May 2020 02:14:54 +0300 Subject: clang 2 electric boogaloo { BasedOnStyle: LLVM, BreakBeforeBraces: Stroustrup} --- include/aoapplication.h | 561 +-- include/aoblipplayer.h | 26 +- include/aobutton.h | 10 +- include/aocaseannouncerdialog.h | 34 +- include/aocharbutton.h | 33 +- include/aocharmovie.h | 143 +- include/aoemotebutton.h | 23 +- include/aoevidencebutton.h | 45 +- include/aoevidencedisplay.h | 22 +- include/aoimage.h | 16 +- include/aolineedit.h | 14 +- include/aomovie.h | 27 +- include/aomusicplayer.h | 69 +- include/aooptionsdialog.h | 207 +- include/aopacket.h | 26 +- include/aoscene.h | 41 +- include/aosfxplayer.h | 33 +- include/aotextarea.h | 13 +- include/aotextedit.h | 10 +- include/bass.h | 866 ++--- include/bassopus.h | 32 +- include/chatlogpiece.h | 32 +- include/courtroom.h | 1082 +++--- include/datatypes.h | 148 +- include/discord-rpc.h | 56 +- include/discord_register.h | 6 +- include/discord_rich_presence.h | 34 +- include/discord_rpc.h | 56 +- include/hex_functions.h | 4 +- include/lobby.h | 126 +- include/networkmanager.h | 70 +- include/scrolltext.h | 46 +- src/aoapplication.cpp | 181 +- src/aoblipplayer.cpp | 110 +- src/aobutton.cpp | 44 +- src/aocaseannouncerdialog.cpp | 147 +- src/aocharbutton.cpp | 122 +- src/aocharmovie.cpp | 426 +-- src/aoemotebutton.cpp | 50 +- src/aoevidencebutton.cpp | 132 +- src/aoevidencedisplay.cpp | 85 +- src/aoimage.cpp | 64 +- src/aolineedit.cpp | 19 +- src/aomovie.cpp | 118 +- src/aomusicplayer.cpp | 289 +- src/aooptionsdialog.cpp | 1158 ++++--- src/aopacket.cpp | 78 +- src/aoscene.cpp | 178 +- src/aosfxplayer.cpp | 216 +- src/aotextarea.cpp | 84 +- src/aotextedit.cpp | 13 +- src/charselect.cpp | 354 +- src/chatlogpiece.cpp | 96 +- src/courtroom.cpp | 7307 ++++++++++++++++++++------------------- src/debug_functions.cpp | 23 +- src/discord_rich_presence.cpp | 237 +- src/emotes.cpp | 228 +- src/encryption_functions.cpp | 68 +- src/evidence.cpp | 1198 ++++--- src/file_functions.cpp | 12 +- src/hardware_functions.cpp | 77 +- src/hex_functions.cpp | 22 +- src/lobby.cpp | 718 ++-- src/main.cpp | 55 +- src/misc_functions.cpp | 6 +- src/networkmanager.cpp | 290 +- src/packet_distribution.cpp | 1261 +++---- src/path_functions.cpp | 134 +- src/scrolltext.cpp | 180 +- src/text_file_functions.cpp | 1191 ++++--- 70 files changed, 10868 insertions(+), 10014 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index ff75e4d1..d9e84fa8 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -32,402 +32,415 @@ class Lobby; class Courtroom; class AOApplication : public QApplication { - Q_OBJECT + Q_OBJECT public: - AOApplication(int &argc, char **argv); - ~AOApplication(); + AOApplication(int &argc, char **argv); + ~AOApplication(); - NetworkManager *net_manager; - Lobby *w_lobby; - Courtroom *w_courtroom; - AttorneyOnline::Discord *discord; + NetworkManager *net_manager; + Lobby *w_lobby; + Courtroom *w_courtroom; + AttorneyOnline::Discord *discord; + + bool lobby_constructed = false; + bool courtroom_constructed = false; - bool lobby_constructed = false; - bool courtroom_constructed = false; + void construct_lobby(); + void destruct_lobby(); - void construct_lobby(); - void destruct_lobby(); + void construct_courtroom(); + void destruct_courtroom(); - void construct_courtroom(); - void destruct_courtroom(); + void ms_packet_received(AOPacket *p_packet); + void server_packet_received(AOPacket *p_packet); - 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 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); - void call_settings_menu(); - void call_announce_menu(Courtroom *court); + /////////////////server metadata////////////////// - /////////////////server metadata////////////////// + unsigned int s_decryptor = 5; + bool encryption_needed = true; - 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; + bool additive_enabled = false; + bool effects_enabled = false; - 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; - bool additive_enabled = false; - bool effects_enabled = false; + ///////////////loading info/////////////////// - ///////////////loading info/////////////////// + // player number, it's hardly used but might be needed for some old servers + int s_pv = 0; - //player number, it's hardly used but might be needed for some old servers - int s_pv = 0; + QString server_software = ""; - 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 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; + bool courtroom_loaded = false; - bool courtroom_loaded = false; + //////////////////versioning/////////////// - //////////////////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(); - 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_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; } - void set_server_list(); - QVector &get_server_list() { return server_list; } + // reads the theme from config.ini and sets it accordingly + void reload_theme(); - //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(); - //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); - //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 - ////// Functions for reading and writing files ////// - // Implementations file_functions.cpp + // Instead of reinventing the wheel, we'll use a QSettings class. + QSettings *configini; - // 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(); - //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 value of ooc_name in config.ini - QString get_ooc_name(); + // Returns the blip rate from config.ini (once per X symbols) + int read_blip_rate(); - //Returns the blip rate from config.ini (once per X symbols) - int read_blip_rate(); + // Returns true if blank blips is enabled in config.ini and false otherwise + bool get_blank_blip(); - //Returns true if 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 looping sound effects are enabled in the config.ini - bool get_looping_sfx(); + // Returns true if stop music on objection is enabled in the config.ini + bool objection_stop_music(); - //Returns true if stop music on objection is enabled in the config.ini - bool objection_stop_music(); + // Returns the value of default_music in config.ini + int get_default_music(); - //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_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 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 Discord should be enabled on startup - // from the config.ini. - bool is_discord_enabled(); + // Returns the value of whether shaking should be enabled. + // from the config.ini. + bool is_shake_enabled(); - // Returns the value of whether shaking should be enabled. - // from the config.ini. - bool is_shake_enabled(); + // Returns the value of whether effects should be enabled. + // from the config.ini. + bool is_effects_enabled(); - // Returns the value of whether effects should be enabled. - // from the config.ini. - bool is_effects_enabled(); + // Returns the value of whether frame-specific effects defined in char.ini + // should be sent/received over the network. from the config.ini. + bool is_frame_network_enabled(); - // Returns the value of whether frame-specific effects defined in char.ini should be sent/received over the network. - // from the config.ini. - bool is_frame_network_enabled(); + // Returns the value of whether colored ic log should be a thing. + // from the config.ini. + bool is_colorlog_enabled(); - // Returns the value of whether colored ic log should be a thing. - // from the config.ini. - bool is_colorlog_enabled(); + // Returns the value of whether sticky sounds should be a thing. + // from the config.ini. + bool is_stickysounds_enabled(); - // Returns the value of whether sticky sounds should be a thing. - // from the config.ini. - bool is_stickysounds_enabled(); + // Returns the value of whether sticky effects should be a thing. + // from the config.ini. + bool is_stickyeffects_enabled(); - // Returns the value of whether sticky effects should be a thing. - // from the config.ini. - bool is_stickyeffects_enabled(); + // Returns the value of whether sticky preanims should be a thing. + // from the config.ini. + bool is_stickypres_enabled(); - // Returns the value of whether sticky preanims should be a thing. - // from the config.ini. - bool is_stickypres_enabled(); + // Returns the value of the maximum amount of lines the IC chatlog + // may contain, from config.ini. + int get_max_log_size(); - // Returns the value of the maximum amount of lines the IC chatlog - // may contain, from config.ini. - int get_max_log_size(); + // Returns whether the log should go upwards (new behaviour) + // or downwards (vanilla behaviour). + bool get_log_goes_downwards(); - // 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 username the user may have set in config.ini. - QString get_default_username(); - - // Returns the audio device used for the client. - QString get_audio_output_device(); + // Returns the audio device used for the client. + QString get_audio_output_device(); #ifdef QTAUDIO - QAudioDeviceInfo QtAudioDevice; + QAudioDeviceInfo QtAudioDevice; #endif - // Returns whether the user would like to have custom shownames on by default. - bool get_showname_enabled_by_default(); + // 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(); + // Returns the list of words in callwords.ini + QStringList get_call_words(); - //returns all of the file's lines in a QStringList - QStringList get_list_file(QString p_file); + // returns all of the file's lines in a QStringList + QStringList get_list_file(QString p_file); - //Process a file and return its text as a QString - QString read_file(QString filename); + // Process a file and return its text as a QString + QString read_file(QString filename); - //Write text to file. make_dir would auto-create the directory if it doesn't exist. - bool write_to_file(QString p_text, QString p_file, bool make_dir = false); + // Write text to file. make_dir would auto-create the directory if it doesn't + // exist. + bool write_to_file(QString p_text, QString p_file, bool make_dir = false); - //Append text to the end of the file. make_dir would auto-create the directory if it doesn't exist. - bool append_to_file(QString p_text, QString p_file, bool make_dir = false); + // Append text to the end of the file. make_dir would auto-create the + // directory if it doesn't exist. + bool append_to_file(QString p_text, QString p_file, bool make_dir = false); - //Appends the argument string to serverlist.txt - void write_to_serverlist_txt(QString p_line); + // 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 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 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 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, QString p_char = ""); + // Returns the dimensions of widget with specified identifier from p_file + pos_size_type get_element_dimensions(QString p_identifier, QString p_file, + QString p_char = ""); - //Returns the value to you - QString get_design_element(QString p_identifier, QString p_file, QString p_char = ""); + // Returns the value to you + QString get_design_element(QString p_identifier, QString p_file, + QString p_char = ""); - //Returns the name of the font with p_identifier from p_file - QString get_font_name(QString p_identifier, QString p_file); + // Returns the name of the font with p_identifier from p_file + QString get_font_name(QString p_identifier, QString p_file); - //Returns the value of font_size with p_identifier from p_file - int get_font_size(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 color with p_identifier from p_file + QColor get_color(QString p_identifier, QString p_file); - // Returns the markdown symbol used for specified p_identifier such as colors - QString get_chat_markdown(QString p_identifier, QString p_file); + // Returns the markdown symbol used for specified p_identifier such as colors + QString get_chat_markdown(QString p_identifier, QString p_file); - // Returns the color from the misc folder. - QColor get_chat_color(QString p_identifier, QString p_chat); + // Returns the color 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); + // 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 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, WEBP? If not, GIF? If not, fall back to PNG. - QString get_image_suffix(QString path_to_check); + // Can we use APNG for this? If not, WEBP? If not, GIF? If not, fall back to + // PNG. + QString get_image_suffix(QString path_to_check); - // If this image is static and non-animated, return the supported static image formats. Currently only PNG. - QString get_static_image_suffix(QString path_to_check); + // If this image is static and non-animated, return the supported static image + // formats. Currently only PNG. + QString get_static_image_suffix(QString path_to_check); - //Returns the value of p_search_line within target_tag and terminator_tag - QString read_char_ini(QString p_char, QString p_search_line, QString target_tag); + // Returns the value of p_search_line within target_tag and terminator_tag + QString read_char_ini(QString p_char, QString p_search_line, + QString target_tag); - //Returns a QStringList of all key=value definitions on a given tag. - QStringList read_ini_tags(QString p_file, QString target_tag = ""); + // Returns a QStringList of all key=value definitions on a given tag. + QStringList read_ini_tags(QString p_file, QString target_tag = ""); - //Sets the char.ini p_search_line key under tag target_tag to value. - void set_char_ini(QString p_char, QString value, QString p_search_line, QString target_tag); + // Sets the char.ini p_search_line key under tag target_tag to value. + void set_char_ini(QString p_char, QString value, QString p_search_line, + QString target_tag); - //Returns the text between target_tag and terminator_tag in p_file - QString get_stylesheet(QString p_file); + // Returns the text between target_tag and terminator_tag in p_file + QString get_stylesheet(QString p_file); - //Returns the text between target_tag and terminator_tag in p_file - QString get_tagged_stylesheet(QString target_tag, QString p_file); + // Returns the text between target_tag and terminator_tag in p_file + QString get_tagged_stylesheet(QString target_tag, QString p_file); - //Returns the side of the p_char character from that characters ini file - QString get_char_side(QString p_char); + // 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 showname from the ini of p_char + QString get_showname(QString p_char); - //Returns the value of chat image from the specific p_char's ini file - QString get_chat(QString p_char); + // Returns the value of chat image from the specific p_char's ini file + QString get_chat(QString p_char); - //Returns the value of chat font from the specific p_char's ini file - QString get_chat_font(QString p_char); + // Returns the value of chat font from the specific p_char's ini file + QString get_chat_font(QString p_char); - //Returns the value of chat font size from the specific p_char's ini file - int get_chat_size(QString p_char); + // Returns the value of chat font size from the specific p_char's ini file + int get_chat_size(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 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); + // 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); + // 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); + // Not in use + int get_text_delay(QString p_char, QString p_emote); - //Get the effects folder referenced by the char.ini, read it and return the list of filenames in a string - QStringList get_theme_effects(); + // Get the effects folder referenced by the char.ini, read it and return the + // list of filenames in a string + QStringList get_theme_effects(); - //Get the theme's effects folder, read it and return the list of filenames in a string - QStringList get_effects(QString p_char); + // Get the theme's effects folder, read it and return the list of filenames in + // a string + QStringList get_effects(QString p_char); - //t - QString get_effect(QString effect, QString p_char, QString p_folder); + // t + QString get_effect(QString effect, QString p_char, QString p_folder); - //Return the effect sound associated with the fx_name in the misc/effects//sounds.ini, or theme/effects/sounds.ini. - QString get_effect_sound(QString fx_name, QString p_char); + // Return the effect sound associated with the fx_name in the + // misc/effects//sounds.ini, or theme/effects/sounds.ini. + QString get_effect_sound(QString fx_name, QString p_char); - // Returns the custom realisation used by the character. - QString get_custom_realization(QString p_char); + // 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 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 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 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 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 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 the sfx of p_char's p_emote + QString get_sfx_name(QString p_char, int p_emote); - //Returns the blipsound of p_char's p_emote - QString get_emote_blip(QString p_char, int p_emote); + // Returns the blipsound of p_char's p_emote + QString get_emote_blip(QString p_char, int p_emote); - //Returns if the sfx is defined as looping in char.ini - QString get_sfx_looping(QString p_char, QString p_sfx); + // Returns if the sfx is defined as looping in char.ini + QString get_sfx_looping(QString p_char, QString p_sfx); - //Returns if an emote has a frame specific SFX for it - QString get_sfx_frame(QString p_char, QString p_emote, int n_frame); + // Returns if an emote has a frame specific SFX for it + QString get_sfx_frame(QString p_char, QString p_emote, int n_frame); - //Returns if an emote has a frame specific SFX for it - QString get_flash_frame(QString p_char, QString p_emote, int n_frame); + // Returns if an emote has a frame specific SFX for it + QString get_flash_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 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); + // 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 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 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); + // Returns p_char's gender + QString get_gender(QString p_char); - // ====== - // These are all casing-related settings. - // ====== + // ====== + // These are all casing-related settings. + // ====== - // Returns if the user has casing alerts enabled. - bool get_casing_enabled(); + // 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(); + // 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 prosecution. + bool get_casing_prosecution_enabled(); - // Same for judge. - bool get_casing_judge_enabled(); + // Same for judge. + bool get_casing_judge_enabled(); - // Same for juror. - bool get_casing_juror_enabled(); + // Same for juror. + bool get_casing_juror_enabled(); - // Same for steno. - bool get_casing_steno_enabled(); + // Same for steno. + bool get_casing_steno_enabled(); - // Same for CM. - bool get_casing_cm_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 the message for the CM for casing alerts. + QString get_casing_can_host_cases(); - //The file name of the log file in base/logs. - QString log_filename; + // The file name of the log file in base/logs. + QString log_filename; private: - const int RELEASE = 2; - const int MAJOR_VERSION = 8; - const int MINOR_VERSION = 3; + const int RELEASE = 2; + const int MAJOR_VERSION = 8; + const int MINOR_VERSION = 3; - QString current_theme = "default"; + QString current_theme = "default"; - QVector server_list; - QVector favorite_list; + QVector server_list; + QVector favorite_list; private slots: - void ms_connect_finished(bool connected, bool will_retry); + void ms_connect_finished(bool connected, bool will_retry); public slots: - void server_disconnected(); - void loading_cancelled(); + void server_disconnected(); + void loading_cancelled(); }; #endif // AOAPPLICATION_H diff --git a/include/aoblipplayer.h b/include/aoblipplayer.h index db6dfce6..3a582a27 100644 --- a/include/aoblipplayer.h +++ b/include/aoblipplayer.h @@ -17,28 +17,28 @@ class AOBlipPlayer { public: - AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app); + AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app); - void set_blips(QString p_sfx); - void blip_tick(); - void set_volume(qreal p_volume); + void set_blips(QString p_sfx); + void blip_tick(); + void set_volume(qreal p_volume); - int m_cycle = 0; + int m_cycle = 0; private: - const int max_blip_ms = 60; + const int max_blip_ms = 60; - QWidget *m_parent; - AOApplication *ao_app; - qreal m_volume; - QElapsedTimer delay; + QWidget *m_parent; + AOApplication *ao_app; + qreal m_volume; + QElapsedTimer delay; - void set_volume_internal(qreal p_volume); + void set_volume_internal(qreal p_volume); #if defined(BASSAUDIO) - HSTREAM m_stream_list[5]; + HSTREAM m_stream_list[5]; #elif defined(QTAUDIO) - QSoundEffect m_blips; + QSoundEffect m_blips; #endif }; diff --git a/include/aobutton.h b/include/aobutton.h index 598d2c0d..f5758856 100644 --- a/include/aobutton.h +++ b/include/aobutton.h @@ -7,15 +7,15 @@ #include class AOButton : public QPushButton { - Q_OBJECT + Q_OBJECT public: - AOButton(QWidget *parent, AOApplication *p_ao_app); - ~AOButton(); + AOButton(QWidget *parent, AOApplication *p_ao_app); + ~AOButton(); - AOApplication *ao_app; + AOApplication *ao_app; - void set_image(QString p_image); + void set_image(QString p_image); }; #endif // AOBUTTON_H diff --git a/include/aocaseannouncerdialog.h b/include/aocaseannouncerdialog.h index 930fa414..0ac8f074 100644 --- a/include/aocaseannouncerdialog.h +++ b/include/aocaseannouncerdialog.h @@ -13,32 +13,34 @@ #include class AOCaseAnnouncerDialog : public QDialog { - Q_OBJECT + 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; - Courtroom *court; + AOApplication *ao_app; + Courtroom *court; - QDialogButtonBox *ui_announcer_buttons; + QDialogButtonBox *ui_announcer_buttons; - QVBoxLayout *ui_vbox_layout; - QFormLayout *ui_form_layout; + QVBoxLayout *ui_vbox_layout; + QFormLayout *ui_form_layout; - QLabel *ui_case_title_label; - QLineEdit *ui_case_title_textbox; + QLabel *ui_case_title_label; + QLineEdit *ui_case_title_textbox; - QCheckBox *ui_defense_needed; - QCheckBox *ui_prosecutor_needed; - QCheckBox *ui_judge_needed; - QCheckBox *ui_juror_needed; - QCheckBox *ui_steno_needed; + QCheckBox *ui_defense_needed; + QCheckBox *ui_prosecutor_needed; + QCheckBox *ui_judge_needed; + QCheckBox *ui_juror_needed; + QCheckBox *ui_steno_needed; public slots: - void ok_pressed(); - void cancel_pressed(); + void ok_pressed(); + void cancel_pressed(); }; #endif // AOCASEANNOUNCERDIALOG_H diff --git a/include/aocharbutton.h b/include/aocharbutton.h index a5367924..dd27e62c 100644 --- a/include/aocharbutton.h +++ b/include/aocharbutton.h @@ -10,34 +10,35 @@ #include class AOCharButton : public QPushButton { - Q_OBJECT + 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; + AOApplication *ao_app; - void refresh(); - void reset(); - void set_taken(bool is_taken); - void set_passworded(); + void refresh(); + void reset(); + void set_taken(bool is_taken); + void set_passworded(); - void apply_taken_image(); + void apply_taken_image(); - void set_image(QString p_character); + void set_image(QString p_character); private: - bool taken; + bool taken; - QWidget *m_parent; + QWidget *m_parent; - AOImage *ui_taken; - AOImage *ui_passworded; - AOImage *ui_selector; + AOImage *ui_taken; + AOImage *ui_passworded; + AOImage *ui_selector; protected: - void enterEvent(QEvent *e); - void leaveEvent(QEvent *e); + void enterEvent(QEvent *e); + void leaveEvent(QEvent *e); }; #endif // AOCHARBUTTON_H diff --git a/include/aocharmovie.h b/include/aocharmovie.h index 2a185dd2..2dda0ec2 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -10,109 +10,116 @@ class AOApplication; class AOCharMovie : public QLabel { - Q_OBJECT + Q_OBJECT public: - AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app); + AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app); - //Play a hat.gif - style preanimation - void play_pre(QString p_char, QString p_emote, int duration); + // Play a hat.gif - style preanimation + void play_pre(QString p_char, QString p_emote, int duration); - //Play a (b)normal.gif - style animation (talking) - void play_talking(QString p_char, QString p_emote); + // Play a (b)normal.gif - style animation (talking) + void play_talking(QString p_char, QString p_emote); - //Play an (a)normal.gif - style animation (not talking) - void play_idle(QString p_char, QString p_emote); + // Play an (a)normal.gif - style animation (not talking) + void play_idle(QString p_char, QString p_emote); - //Stop the movie, clearing the image - void stop(); + // Stop the movie, clearing the image + void stop(); - //Set the m_flipped variable to true/false - void set_flipped(bool p_flipped) { m_flipped = p_flipped; } + // Set the m_flipped variable to true/false + void set_flipped(bool p_flipped) { m_flipped = p_flipped; } - //Set the movie's playback speed (between 10% and 1000%) - void set_speed(int modifier) { speed = qMax(10, qMin(modifier, 1000)); } + // Set the movie's playback speed (between 10% and 1000%) + void set_speed(int modifier) { speed = qMax(10, qMin(modifier, 1000)); } - //Move the label itself around - void move(int ax, int ay); + // Move the label itself around + void move(int ax, int ay); - //This is somewhat pointless now as there's no "QMovie" object to resize, aka no "combo" to speak of - void combo_resize(int w, int h); + // This is somewhat pointless now as there's no "QMovie" object to resize, aka + // no "combo" to speak of + void combo_resize(int w, int h); - //Return the frame delay adjusted for speed - int get_frame_delay(int delay); + // Return the frame delay adjusted for speed + int get_frame_delay(int delay); - QStringList network_strings; + QStringList network_strings; - QString m_char; - QString m_emote; + QString m_char; + QString m_emote; private: - AOApplication *ao_app; + AOApplication *ao_app; - QVector movie_frames; - QVector movie_delays; + QVector movie_frames; + QVector movie_delays; - //Effects such as sfx, screenshakes and realization flashes are stored in here. - //QString entry format: "sfx^[sfx_name]", "shake", "flash". - //The program uses the QVector index as reference. - QVector> movie_effects; + // Effects such as sfx, screenshakes and realization flashes are stored in + // here. QString entry format: "sfx^[sfx_name]", "shake", "flash". The program + // uses the QVector index as reference. + QVector> movie_effects; - QTimer *preanim_timer; - QTimer *ticker; - QString last_path; - QImageReader *m_reader = new QImageReader(); + QTimer *preanim_timer; + QTimer *ticker; + QString last_path; + QImageReader *m_reader = new QImageReader(); - QElapsedTimer actual_time; + QElapsedTimer actual_time; - //Usually used to turn seconds into milliseconds such as for [Time] tag in char.ini - const int time_mod = 60; + // Usually used to turn seconds into milliseconds such as for [Time] tag in + // char.ini + const int time_mod = 60; - // These are the X and Y values before they are fixed based on the sprite's width. - int x = 0; - int y = 0; - // These are the width and height values before they are fixed based on the sprite's width. - int f_w = 0; - int f_h = 0; + // These are the X and Y values before they are fixed based on the sprite's + // width. + int x = 0; + int y = 0; + // These are the width and height values before they are fixed based on the + // sprite's width. + int f_w = 0; + int f_h = 0; - int frame = 0; - int max_frames = 0; + int frame = 0; + int max_frames = 0; - int speed = 100; + int speed = 100; - bool m_flipped = false; - bool play_once = true; + bool m_flipped = false; + bool play_once = true; - //Set the movie's image to provided paths, preparing for playback. - void load_image(QString p_char, QString p_emote, QString emote_prefix); + // Set the movie's image to provided paths, preparing for playback. + void load_image(QString p_char, QString p_emote, QString emote_prefix); - //Start playback of the movie (if animated). - void play(); + // Start playback of the movie (if animated). + void play(); - //Play a frame-specific effect, if there's any defined for that specific frame. - void play_frame_effect(int frame); + // Play a frame-specific effect, if there's any defined for that specific + // frame. + void play_frame_effect(int frame); - //Retreive a pixmap adjused for mirroring/aspect ratio shenanigans from a provided QImage - QPixmap get_pixmap(QImage image); + // Retreive a pixmap adjused for mirroring/aspect ratio shenanigans from a + // provided QImage + QPixmap get_pixmap(QImage image); - //Set the movie's frame to provided pixmap - void set_frame(QPixmap f_pixmap); + // Set the movie's frame to provided pixmap + void set_frame(QPixmap f_pixmap); - //Initialize the frame-specific effects from the char.ini - void load_effects(); + // Initialize the frame-specific effects from the char.ini + void load_effects(); - //Initialize the frame-specific effects from the provided network_strings, this is only initialized if network_strings has size more than 0. - void load_network_effects(); + // Initialize the frame-specific effects from the provided network_strings, + // this is only initialized if network_strings has size more than 0. + void load_network_effects(); signals: - void done(); - void shake(); - void flash(); - void play_sfx(QString sfx); + void done(); + void shake(); + void flash(); + void play_sfx(QString sfx); private slots: - void preanim_done(); - void movie_ticker(); + void preanim_done(); + void movie_ticker(); }; #endif // AOCHARMOVIE_H diff --git a/include/aoemotebutton.h b/include/aoemotebutton.h index 8674bb08..cb46167f 100644 --- a/include/aoemotebutton.h +++ b/include/aoemotebutton.h @@ -7,28 +7,29 @@ #include class AOEmoteButton : public QPushButton { - Q_OBJECT + Q_OBJECT public: - AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, int p_w, int p_h); + AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, + int p_w, int p_h); - void set_image(QString p_image, QString p_emote_comment); - void set_char_image(QString p_char, int p_emote, QString suffix); + void set_image(QString p_image, QString p_emote_comment); + void set_char_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; - AOApplication *ao_app; + QWidget *parent; + AOApplication *ao_app; - int m_id = 0; + int m_id = 0; signals: - void emote_clicked(int p_id); + void emote_clicked(int p_id); private slots: - void on_clicked(); + void on_clicked(); }; #endif // AOEMOTEBUTTON_H diff --git a/include/aoevidencebutton.h b/include/aoevidencebutton.h index 2ac6860b..d7812fe9 100644 --- a/include/aoevidencebutton.h +++ b/include/aoevidencebutton.h @@ -9,42 +9,43 @@ #include class AOEvidenceButton : public QPushButton { - Q_OBJECT + Q_OBJECT public: - AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, int p_w, int p_h); + AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, + int p_w, int p_h); - 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_image(QString p_image); + void set_theme_image(QString p_image); + void set_id(int p_id) { m_id = p_id; } - void set_selected(bool p_selected); + void set_selected(bool p_selected); private: - AOApplication *ao_app; - QWidget *m_parent; + AOApplication *ao_app; + QWidget *m_parent; - AOImage *ui_selected; - AOImage *ui_selector; + AOImage *ui_selected; + AOImage *ui_selector; - int m_id = 0; + int m_id = 0; protected: - void enterEvent(QEvent *e); - void leaveEvent(QEvent *e); - void mouseDoubleClickEvent(QMouseEvent *e); - /* - void dragLeaveEvent(QMouseEvent *e); - void dragEnterEvent(QMouseEvent *e); - */ + void enterEvent(QEvent *e); + void leaveEvent(QEvent *e); + void mouseDoubleClickEvent(QMouseEvent *e); + /* +void dragLeaveEvent(QMouseEvent *e); +void dragEnterEvent(QMouseEvent *e); +*/ signals: - void evidence_clicked(int p_id); - void evidence_double_clicked(int p_id); - void on_hover(int p_id, bool p_state); + void evidence_clicked(int p_id); + void evidence_double_clicked(int p_id); + void on_hover(int p_id, bool p_state); private slots: - void on_clicked(); + void on_clicked(); }; #endif // AOEVIDENCEBUTTON_H diff --git a/include/aoevidencedisplay.h b/include/aoevidencedisplay.h index 0315ffcf..979a754e 100644 --- a/include/aoevidencedisplay.h +++ b/include/aoevidencedisplay.h @@ -9,24 +9,24 @@ #include class AOEvidenceDisplay : public QLabel { - Q_OBJECT + Q_OBJECT public: - AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app); + 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(); - void reset(); - void combo_resize(int w, int h); + void show_evidence(QString p_evidence_image, bool is_left_side, int p_volume); + QLabel *get_evidence_icon(); + void reset(); + void combo_resize(int w, int h); private: - AOApplication *ao_app; - AOMovie *evidence_movie; - QLabel *evidence_icon; - AOSfxPlayer *sfx_player; + AOApplication *ao_app; + AOMovie *evidence_movie; + QLabel *evidence_icon; + AOSfxPlayer *sfx_player; private slots: - void show_done(); + void show_done(); }; #endif // AOEVIDENCEDISPLAY_H diff --git a/include/aoimage.h b/include/aoimage.h index a6960de6..01ef8540 100644 --- a/include/aoimage.h +++ b/include/aoimage.h @@ -1,4 +1,4 @@ -//This class represents a static theme-dependent image +// This class represents a static theme-dependent image #ifndef AOIMAGE_H #define AOIMAGE_H @@ -10,15 +10,15 @@ class AOImage : public QLabel { public: - AOImage(QWidget *parent, AOApplication *p_ao_app); - ~AOImage(); + AOImage(QWidget *parent, AOApplication *p_ao_app); + ~AOImage(); - QWidget *m_parent; - AOApplication *ao_app; + QWidget *m_parent; + AOApplication *ao_app; - bool set_image(QString p_image); - bool set_chatbox(QString p_path); - void set_size_and_pos(QString identifier); + bool set_image(QString p_image); + bool set_chatbox(QString p_path); + void set_size_and_pos(QString identifier); }; #endif // AOIMAGE_H diff --git a/include/aolineedit.h b/include/aolineedit.h index 06206a95..5dce3aaa 100644 --- a/include/aolineedit.h +++ b/include/aolineedit.h @@ -5,22 +5,22 @@ #include class AOLineEdit : public QLineEdit { - Q_OBJECT + Q_OBJECT public: - AOLineEdit(QWidget *parent); + AOLineEdit(QWidget *parent); - void preserve_selection(bool toggle) { p_selection = toggle; } + void preserve_selection(bool toggle) { p_selection = toggle; } private: - bool p_selection = false; + bool p_selection = false; protected: - void mouseDoubleClickEvent(QMouseEvent *e); - void focusOutEvent(QFocusEvent *ev); + void mouseDoubleClickEvent(QMouseEvent *e); + void focusOutEvent(QFocusEvent *ev); signals: - void double_clicked(); + void double_clicked(); }; #endif // AOLINEEDIT_H diff --git a/include/aomovie.h b/include/aomovie.h index 8d604423..eb7f7a53 100644 --- a/include/aomovie.h +++ b/include/aomovie.h @@ -8,28 +8,29 @@ class Courtroom; class AOApplication; class AOMovie : public QLabel { - Q_OBJECT + Q_OBJECT public: - AOMovie(QWidget *p_parent, AOApplication *p_ao_app); + AOMovie(QWidget *p_parent, AOApplication *p_ao_app); - void set_play_once(bool p_play_once); - void play(QString p_image, QString p_char = "", QString p_custom_theme = "", int default_duration = 0); - void combo_resize(int w, int h); - void stop(); + void set_play_once(bool p_play_once); + void play(QString p_image, 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; + QMovie *m_movie; + AOApplication *ao_app; + QTimer *timer; + bool play_once = true; signals: - void done(); + void done(); private slots: - void frame_change(int n_frame); - void timer_done(); + void frame_change(int n_frame); + void timer_done(); }; #endif // AOMOVIE_H diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index d28a3ed6..5c72649f 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -17,63 +17,64 @@ #if defined(BASSAUDIO) class AOMusicPlayer { public: - AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - virtual ~AOMusicPlayer(); - void set_volume(int p_value, int channel = -1); - void set_looping(bool toggle, int channel = 0); + AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); + virtual ~AOMusicPlayer(); + void set_volume(int p_value, int channel = -1); + void set_looping(bool toggle, int channel = 0); - const int m_channelmax = 4; + const int m_channelmax = 4; - //These have to be public for the stupid sync thing - QWORD loop_start = 0; - QWORD loop_end = 0; + // These have to be public for the stupid sync thing + QWORD loop_start = 0; + QWORD loop_end = 0; public slots: - void play(QString p_song, int channel = 0, bool loop = false, int effect_flags = 0); - void stop(int channel = 0); + void play(QString p_song, int channel = 0, bool loop = false, + int effect_flags = 0); + void stop(int channel = 0); private: - QWidget *m_parent; - AOApplication *ao_app; + QWidget *m_parent; + AOApplication *ao_app; - bool m_looping = false; - int m_volume[4] = {0, 0, 0, 0}; + bool m_looping = false; + int m_volume[4] = {0, 0, 0, 0}; - // Channel 0 = music - // Channel 1 = ambience - // Channel 2 = extra - // Channel 3 = extra - HSTREAM m_stream_list[4]; - HSYNC loop_sync[4]; + // Channel 0 = music + // Channel 1 = ambience + // Channel 2 = extra + // Channel 3 = extra + HSTREAM m_stream_list[4]; + HSYNC loop_sync[4]; }; #elif defined(QTAUDIO) class AOMusicPlayer { public: - AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - ~AOMusicPlayer(); + AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); + ~AOMusicPlayer(); - void play(QString p_song); - void set_volume(int p_value); + void play(QString p_song); + void set_volume(int p_value); private: - QMediaPlayer m_player; - QWidget *m_parent; - AOApplication *ao_app; + QMediaPlayer m_player; + QWidget *m_parent; + AOApplication *ao_app; - int m_volume = 0; + int m_volume = 0; }; #else class AOMusicPlayer { public: - AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - ~AOMusicPlayer(); + AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); + ~AOMusicPlayer(); - void play(QString p_song); - void set_volume(int p_value); + void play(QString p_song); + void set_volume(int p_value); private: - QWidget *m_parent; - AOApplication *ao_app; + QWidget *m_parent; + AOApplication *ao_app; }; #endif diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index f9c369d2..b89e3174 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -31,116 +31,117 @@ #include class AOOptionsDialog : public QDialog { - Q_OBJECT + Q_OBJECT public: - explicit AOOptionsDialog(QWidget *parent = nullptr, AOApplication *p_ao_app = nullptr); + explicit AOOptionsDialog(QWidget *parent = nullptr, + AOApplication *p_ao_app = nullptr); private: - AOApplication *ao_app; - - QVBoxLayout *ui_vertical_layout; - QTabWidget *ui_settings_tabs; - - QWidget *ui_gameplay_tab; - QWidget *ui_form_layout_widget; - QFormLayout *ui_gameplay_form; - QLabel *ui_theme_label; - QComboBox *ui_theme_combobox; - QFrame *ui_theme_log_divider; - QLabel *ui_downwards_lbl; - QCheckBox *ui_downwards_cb; - QLabel *ui_length_lbl; - QSpinBox *ui_length_spinbox; - QFrame *ui_log_names_divider; - QLineEdit *ui_username_textbox; - QLabel *ui_username_lbl; - QLabel *ui_showname_lbl; - QCheckBox *ui_showname_cb; - QFrame *ui_net_divider; - QLabel *ui_ms_lbl; - QLineEdit *ui_ms_textbox; - QLabel *ui_discord_lbl; - QCheckBox *ui_discord_cb; - QLabel *ui_language_label; - QComboBox *ui_language_combobox; - - QLabel *ui_shake_lbl; - QCheckBox *ui_shake_cb; - QLabel *ui_effects_lbl; - QCheckBox *ui_effects_cb; - QLabel *ui_framenetwork_lbl; - QCheckBox *ui_framenetwork_cb; - - QLabel *ui_colorlog_lbl; - QCheckBox *ui_colorlog_cb; - - QLabel *ui_stickysounds_lbl; - QCheckBox *ui_stickysounds_cb; - - QLabel *ui_stickyeffects_lbl; - QCheckBox *ui_stickyeffects_cb; - - QLabel *ui_stickypres_lbl; - QCheckBox *ui_stickypres_cb; - - 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_cm_cases_lbl; - QLineEdit *ui_casing_cm_cases_textbox; - - bool needs_default_audiodev(); + 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; + 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_language_label; + QComboBox *ui_language_combobox; + + QLabel *ui_shake_lbl; + QCheckBox *ui_shake_cb; + QLabel *ui_effects_lbl; + QCheckBox *ui_effects_cb; + QLabel *ui_framenetwork_lbl; + QCheckBox *ui_framenetwork_cb; + + QLabel *ui_colorlog_lbl; + QCheckBox *ui_colorlog_cb; + + QLabel *ui_stickysounds_lbl; + QCheckBox *ui_stickysounds_cb; + + QLabel *ui_stickyeffects_lbl; + QCheckBox *ui_stickyeffects_cb; + + QLabel *ui_stickypres_lbl; + QCheckBox *ui_stickypres_cb; + + 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_cm_cases_lbl; + QLineEdit *ui_casing_cm_cases_textbox; + + bool needs_default_audiodev(); signals: public slots: - void save_pressed(); - void discard_pressed(); + void save_pressed(); + void discard_pressed(); }; #endif // AOOPTIONSDIALOG_H diff --git a/include/aopacket.h b/include/aopacket.h index 4133fd56..4097be86 100644 --- a/include/aopacket.h +++ b/include/aopacket.h @@ -7,25 +7,25 @@ class AOPacket { public: - AOPacket(QString p_packet_string); - AOPacket(QString header, QStringList &p_contents); - ~AOPacket(); + 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 to_string(); + QString get_header() { return m_header; } + QStringList &get_contents() { return m_contents; } + QString to_string(); - void encrypt_header(unsigned int p_key); - void decrypt_header(unsigned int p_key); + void encrypt_header(unsigned int p_key); + void decrypt_header(unsigned int p_key); - void net_encode(); - void net_decode(); + void net_encode(); + void net_decode(); private: - bool encrypted = false; + bool encrypted = false; - QString m_header; - QStringList m_contents; + QString m_header; + QStringList m_contents; }; #endif // AOPACKET_H diff --git a/include/aoscene.h b/include/aoscene.h index 3093b0fb..726e2641 100644 --- a/include/aoscene.h +++ b/include/aoscene.h @@ -9,31 +9,34 @@ class Courtroom; class AOApplication; class AOScene : public QLabel { - Q_OBJECT + Q_OBJECT public: - explicit AOScene(QWidget *parent, AOApplication *p_ao_app); + explicit AOScene(QWidget *parent, AOApplication *p_ao_app); - void set_image(QString p_image); - void set_legacy_desk(QString p_image); + void set_image(QString p_image); + void set_legacy_desk(QString p_image); - //Move the label itself around - void move(int ax, int ay); + // Move the label itself around + void move(int ax, int ay); - //This is somewhat pointless now as there's no "QMovie" object to resize, aka no "combo" to speak of - void combo_resize(int w, int h); + // This is somewhat pointless now as there's no "QMovie" object to resize, aka + // no "combo" to speak of + void combo_resize(int w, int h); private: - QWidget *m_parent; - QMovie *m_movie; - AOApplication *ao_app; - QString last_image; - - // These are the X and Y values before they are fixed based on the sprite's width. - int x = 0; - int y = 0; - // These are the width and height values before they are fixed based on the sprite's width. - int f_w = 0; - int f_h = 0; + QWidget *m_parent; + QMovie *m_movie; + AOApplication *ao_app; + QString last_image; + + // These are the X and Y values before they are fixed based on the sprite's + // width. + int x = 0; + int y = 0; + // These are the width and height values before they are fixed based on the + // sprite's width. + int f_w = 0; + int f_h = 0; }; #endif // AOSCENE_H diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h index 4488aa6a..9c9824ab 100644 --- a/include/aosfxplayer.h +++ b/include/aosfxplayer.h @@ -16,29 +16,30 @@ class AOSfxPlayer { public: - AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app); + AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app); - void clear(); - void loop_clear(); - void play(QString p_sfx, QString p_char = "", QString shout = "", int channel = -1); - void stop(int channel = -1); - void set_volume(qreal p_volume); - void set_looping(bool toggle, int channel = -1); - int m_channel = 0; + void clear(); + void loop_clear(); + void play(QString p_sfx, QString p_char = "", QString shout = "", + int channel = -1); + void stop(int channel = -1); + void set_volume(qreal p_volume); + void set_looping(bool toggle, int channel = -1); + int m_channel = 0; private: - QWidget *m_parent; - AOApplication *ao_app; - qreal m_volume = 0; + QWidget *m_parent; + AOApplication *ao_app; + qreal m_volume = 0; - bool m_looping = true; - void set_volume_internal(qreal p_volume); + bool m_looping = true; + void set_volume_internal(qreal p_volume); #if defined(BASSAUDIO) - const int m_channelmax = 5; - HSTREAM m_stream_list[5]; + const int m_channelmax = 5; + HSTREAM m_stream_list[5]; #elif defined(QTAUDIO) - QSoundEffect m_sfx; + QSoundEffect m_sfx; #endif }; diff --git a/include/aotextarea.h b/include/aotextarea.h index 8bf5199b..453e9659 100644 --- a/include/aotextarea.h +++ b/include/aotextarea.h @@ -9,16 +9,17 @@ class AOTextArea : public QTextBrowser { public: - AOTextArea(QWidget *p_parent = nullptr); + AOTextArea(QWidget *p_parent = nullptr); - void append_linked(QString p_message); - void append_chatmessage(QString p_name, QString p_message, QString p_colur); - void append_error(QString p_message); + void append_linked(QString p_message); + void append_chatmessage(QString p_name, QString p_message, QString p_colur); + void append_error(QString p_message); private: - const QRegExp url_parser_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b"); + const QRegExp url_parser_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 eb2c356d..8d876f17 100644 --- a/include/aotextedit.h +++ b/include/aotextedit.h @@ -4,18 +4,18 @@ #include class AOTextEdit : public QPlainTextEdit { - Q_OBJECT + Q_OBJECT public: - AOTextEdit(QWidget *parent); + AOTextEdit(QWidget *parent); protected: - void mouseDoubleClickEvent(QMouseEvent *e); + void mouseDoubleClickEvent(QMouseEvent *e); signals: - void double_clicked(); + void double_clicked(); private slots: - void on_enter_pressed(); + void on_enter_pressed(); }; #endif // AOTEXTEDIT_H diff --git a/include/bass.h b/include/bass.h index 4180a371..ec2c7a29 100644 --- a/include/bass.h +++ b/include/bass.h @@ -1,8 +1,8 @@ /* - BASS 2.4 C/C++ header file - Copyright (c) 1999-2019 Un4seen Developments Ltd. + BASS 2.4 C/C++ header file + Copyright (c) 1999-2019 Un4seen Developments Ltd. - See the BASS.CHM file for more detailed documentation + See the BASS.CHM file for more detailed documentation */ #ifndef BASS_H @@ -152,13 +152,14 @@ typedef DWORD HPLUGIN; // Plugin handle #define BASS_CONFIG_LIBSSL 64 // 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_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 @@ -173,14 +174,15 @@ typedef DWORD HPLUGIN; // Plugin handle // Device info structure typedef struct { -#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) - const wchar_t *name; // description - const wchar_t *driver; // driver +#if defined(_WIN32_WCE) || \ + (WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) + const wchar_t *name; // description + const wchar_t *driver; // driver #else - const char *name; // description - const char *driver; // driver + const char *name; // description + const char *driver; // driver #endif - DWORD flags; + DWORD flags; } BASS_DEVICEINFO; // BASS_DEVICEINFO flags @@ -206,26 +208,32 @@ typedef struct { #define BASS_DEVICES_AIRPLAY 0x1000000 typedef struct { - DWORD flags; // device capabilities (DSCAPS_xxx flags) - DWORD hwsize; // size of total device hardware memory - DWORD hwfree; // size of free device hardware memory - DWORD freesam; // number of free sample slots in the hardware - DWORD free3d; // number of free 3D sample slots in the hardware - DWORD minrate; // min sample rate supported by the hardware - DWORD maxrate; // max sample rate supported by the hardware - BOOL eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used) - DWORD minbuf; // recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY) - DWORD dsver; // DirectSound version - DWORD latency; // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY) - DWORD initflags; // BASS_Init "flags" parameter - DWORD speakers; // number of speakers available - DWORD freq; // current output rate + DWORD flags; // device capabilities (DSCAPS_xxx flags) + DWORD hwsize; // size of total device hardware memory + DWORD hwfree; // size of free device hardware memory + DWORD freesam; // number of free sample slots in the hardware + DWORD free3d; // number of free 3D sample slots in the hardware + DWORD minrate; // min sample rate supported by the hardware + DWORD maxrate; // max sample rate supported by the hardware + BOOL + eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used) + DWORD minbuf; // recommended minimum buffer length in ms (requires + // BASS_DEVICE_LATENCY) + DWORD dsver; // DirectSound version + DWORD latency; // delay (in ms) before start of playback (requires + // BASS_DEVICE_LATENCY) + DWORD initflags; // BASS_Init "flags" parameter + DWORD speakers; // number of speakers available + DWORD freq; // current output rate } BASS_INFO; // BASS_INFO flags (from DSOUND.H) -#define DSCAPS_CONTINUOUSRATE 0x00000010 // supports all sample rates between min/maxrate -#define DSCAPS_EMULDRIVER 0x00000020 // device does NOT have hardware DirectSound support -#define DSCAPS_CERTIFIED 0x00000040 // device driver has been certified by Microsoft +#define DSCAPS_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 @@ -233,16 +241,19 @@ typedef struct { // Recording device info structure typedef struct { - DWORD flags; // device capabilities (DSCCAPS_xxx flags) - DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags) - DWORD inputs; // number of inputs - BOOL singlein; // TRUE = only 1 input can be set at a time - DWORD freq; // current input rate + DWORD flags; // device capabilities (DSCCAPS_xxx flags) + DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags) + DWORD inputs; // number of inputs + BOOL singlein; // TRUE = only 1 input can be set at a time + DWORD freq; // current input rate } BASS_RECORDINFO; // BASS_RECORDINFO flags (from DSOUND.H) -#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER // device does NOT have hardware DirectSound recording support -#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED // device driver has been certified by Microsoft +#define DSCCAPS_EMULDRIVER \ + DSCAPS_EMULDRIVER // device does NOT have hardware DirectSound recording + // support +#define DSCCAPS_CERTIFIED \ + DSCAPS_CERTIFIED // device driver has been certified by Microsoft // defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H) #ifndef WAVE_FORMAT_1M08 @@ -262,46 +273,54 @@ typedef struct { // Sample info structure typedef struct { - DWORD freq; // default playback rate - float volume; // default volume (0-1) - float pan; // default pan (-1=left, 0=middle, 1=right) - DWORD flags; // BASS_SAMPLE_xxx flags - DWORD length; // length (in bytes) - DWORD max; // maximum simultaneous playbacks - DWORD origres; // original resolution - DWORD chans; // number of channels - DWORD mingap; // minimum gap (ms) between creating channels - DWORD mode3d; // BASS_3DMODE_xxx mode - float mindist; // minimum distance - float maxdist; // maximum distance - DWORD iangle; // angle of inside projection cone - DWORD oangle; // angle of outside projection cone - float outvol; // delta-volume outside the projection cone - DWORD vam; // voice allocation/management flags (BASS_VAM_xxx) - DWORD priority; // priority (0=lowest, 0xffffffff=highest) + DWORD freq; // default playback rate + float volume; // default volume (0-1) + float pan; // default pan (-1=left, 0=middle, 1=right) + DWORD flags; // BASS_SAMPLE_xxx flags + DWORD length; // length (in bytes) + DWORD max; // maximum simultaneous playbacks + DWORD origres; // original resolution + DWORD chans; // number of channels + DWORD mingap; // minimum gap (ms) between creating channels + DWORD mode3d; // BASS_3DMODE_xxx mode + float mindist; // minimum distance + float maxdist; // maximum distance + DWORD iangle; // angle of inside projection cone + DWORD oangle; // angle of outside projection cone + float outvol; // delta-volume outside the projection cone + DWORD vam; // voice allocation/management flags (BASS_VAM_xxx) + DWORD priority; // priority (0=lowest, 0xffffffff=highest) } BASS_SAMPLE; -#define BASS_SAMPLE_8BITS 1 // 8 bit -#define BASS_SAMPLE_FLOAT 256 // 32 bit floating-point -#define BASS_SAMPLE_MONO 2 // mono -#define BASS_SAMPLE_LOOP 4 // looped -#define BASS_SAMPLE_3D 8 // 3D functionality -#define BASS_SAMPLE_SOFTWARE 16 // not using hardware mixing -#define BASS_SAMPLE_MUTEMAX 32 // mute at max distance (3D only) -#define BASS_SAMPLE_VAM 64 // DX7 voice allocation & management -#define BASS_SAMPLE_FX 128 // old implementation of DX8 effects -#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume -#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing -#define BASS_SAMPLE_OVER_DIST 0x30000 // override furthest from listener (3D only) - -#define BASS_STREAM_PRESCAN 0x20000 // enable pin-point seeking/length (MP3/MP2/MP1) -#define BASS_STREAM_AUTOFREE 0x40000 // automatically free the stream when it stop/ends -#define BASS_STREAM_RESTRATE 0x80000 // restrict the download rate of internet file streams -#define BASS_STREAM_BLOCK 0x100000 // download/play internet file stream in small blocks -#define BASS_STREAM_DECODE 0x200000 // don't play the stream, only decode (BASS_ChannelGetData) -#define BASS_STREAM_STATUS 0x800000 // give server status info (HTTP/ICY tags) in DOWNLOADPROC - -#define BASS_MP3_IGNOREDELAY 0x200 // ignore LAME/Xing/VBRI/iTunes delay & padding info +#define BASS_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 @@ -313,19 +332,20 @@ typedef struct { #define BASS_MUSIC_DECODE BASS_STREAM_DECODE #define BASS_MUSIC_PRESCAN BASS_STREAM_PRESCAN // calculate playback length #define BASS_MUSIC_CALCLEN BASS_MUSIC_PRESCAN -#define BASS_MUSIC_RAMP 0x200 // normal ramping -#define BASS_MUSIC_RAMPS 0x400 // sensitive ramping -#define BASS_MUSIC_SURROUND 0x800 // surround sound -#define BASS_MUSIC_SURROUND2 0x1000 // surround sound (mode 2) -#define BASS_MUSIC_FT2PAN 0x2000 // apply FastTracker 2 panning to XM files -#define BASS_MUSIC_FT2MOD 0x2000 // play .MOD as FastTracker 2 does -#define BASS_MUSIC_PT1MOD 0x4000 // play .MOD as ProTracker 1 does -#define BASS_MUSIC_NONINTER 0x10000 // non-interpolated sample mixing -#define BASS_MUSIC_SINCINTER 0x800000 // sinc interpolated sample mixing -#define BASS_MUSIC_POSRESET 0x8000 // stop all notes when moving position -#define BASS_MUSIC_POSRESETEX 0x400000 // stop all notes and reset bmp/etc when moving position -#define BASS_MUSIC_STOPBACK 0x80000 // stop the music on a backwards jump effect -#define BASS_MUSIC_NOSAMPLE 0x100000 // don't load the samples +#define BASS_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 @@ -360,14 +380,14 @@ typedef struct { // Channel info structure typedef struct { - DWORD freq; // default playback rate - DWORD chans; // channels - DWORD flags; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags - DWORD ctype; // type of channel - DWORD origres; // original resolution - HPLUGIN plugin; // plugin - HSAMPLE sample; // sample - const char *filename; // filename + DWORD freq; // default playback rate + DWORD chans; // channels + DWORD flags; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags + DWORD ctype; // type of channel + DWORD origres; // original resolution + HPLUGIN plugin; // plugin + HSAMPLE sample; // sample + const char *filename; // filename } BASS_CHANNELINFO; #define BASS_ORIGRES_FLOAT 0x10000 @@ -397,31 +417,32 @@ typedef struct { #define BASS_CTYPE_MUSIC_MO3 0x00100 // MO3 flag typedef struct { - DWORD ctype; // channel type -#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) - const wchar_t *name; // format description - const wchar_t *exts; // file extension filter (*.ext1;*.ext2;etc...) + DWORD ctype; // channel type +#if defined(_WIN32_WCE) || \ + (WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) + const wchar_t *name; // format description + const wchar_t *exts; // file extension filter (*.ext1;*.ext2;etc...) #else - const char *name; // format description - const char *exts; // file extension filter (*.ext1;*.ext2;etc...) + const char *name; // format description + const char *exts; // file extension filter (*.ext1;*.ext2;etc...) #endif } BASS_PLUGINFORM; typedef struct { - DWORD version; // version (same form as BASS_GetVersion) - DWORD formatc; // number of formats - const BASS_PLUGINFORM *formats; // the array of formats + DWORD version; // version (same form as BASS_GetVersion) + DWORD formatc; // number of formats + const BASS_PLUGINFORM *formats; // the array of formats } BASS_PLUGININFO; // 3D vector (for 3D positions/velocities/orientations) typedef struct BASS_3DVECTOR { #ifdef __cplusplus - BASS_3DVECTOR(){}; - BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z){}; + BASS_3DVECTOR(){}; + BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z){}; #endif - float x; // +=right, -=left - float y; // +=up, -=down - float z; // +=front, -=behind + float x; // +=right, -=left + float y; // +=up, -=down + float z; // +=front, -=behind } BASS_3DVECTOR; // 3D channel modes @@ -437,34 +458,34 @@ typedef struct BASS_3DVECTOR { // 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_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) @@ -479,9 +500,11 @@ enum { #define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE, 0.5F, 2.886F, 1.304F #define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA, 0.361F, 7.284F, 0.332F #define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR, 0.5F, 10.0F, 0.3F -#define EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153F, 0.259F, 2.0F +#define EAX_PRESET_CARPETEDHALLWAY \ + EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153F, 0.259F, 2.0F #define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY, 0.361F, 1.493F, 0.0F -#define EAX_PRESET_STONECORRIDOR EAX_ENVIRONMENT_STONECORRIDOR, 0.444F, 2.697F, 0.638F +#define EAX_PRESET_STONECORRIDOR \ + EAX_ENVIRONMENT_STONECORRIDOR, 0.444F, 2.697F, 0.638F #define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY, 0.25F, 1.752F, 0.776F #define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST, 0.111F, 3.145F, 0.472F #define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY, 0.111F, 2.767F, 0.224F @@ -495,14 +518,14 @@ enum { #define EAX_PRESET_DIZZY EAX_ENVIRONMENT_DIZZY, 0.139F, 17.234F, 0.666F #define EAX_PRESET_PSYCHOTIC EAX_ENVIRONMENT_PSYCHOTIC, 0.486F, 7.563F, 0.806F -typedef DWORD(CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, void *user); -/* User stream callback function. NOTE: A stream function should obviously be as quick -as possible, other streams (and MOD musics) can't be mixed until it's finished. -handle : The stream that needs writing -buffer : Buffer to write the samples in -length : Number of bytes to write -user : The 'user' parameter value given when calling BASS_StreamCreate -RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end the stream. */ +typedef DWORD(CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, + void *user); +/* User stream callback function. NOTE: A stream function should obviously be as +quick as possible, other streams (and MOD musics) can't be mixed until it's +finished. handle : The stream that needs writing buffer : Buffer to write the +samples in length : Number of bytes to write user : The 'user' parameter value +given when calling BASS_StreamCreate RETURN : Number of bytes written. Set the +BASS_STREAMPROC_END flag to end the stream. */ #define BASS_STREAMPROC_END 0x80000000 // end of user stream flag @@ -524,10 +547,10 @@ typedef DWORD(CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user); typedef BOOL(CALLBACK FILESEEKPROC)(QWORD offset, void *user); typedef struct { - FILECLOSEPROC *close; - FILELENPROC *length; - FILEREADPROC *read; - FILESEEKPROC *seek; + FILECLOSEPROC *close; + FILELENPROC *length; + FILEREADPROC *read; + FILESEEKPROC *seek; } BASS_FILEPROCS; // BASS_StreamPutFileData options @@ -546,7 +569,8 @@ typedef struct { #define BASS_FILEPOS_SIZE 8 #define BASS_FILEPOS_BUFFERING 9 -typedef void(CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, void *user); +typedef void(CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, + void *user); /* Internet stream download callback function. buffer : Buffer containing the downloaded data... NULL=end of download length : Number of bytes in the buffer @@ -570,7 +594,8 @@ user : The 'user' parameter value given when calling BASS_StreamCreateURL */ #define BASS_SYNC_MIXTIME 0x40000000 // flag: sync at mixtime, else at playtime #define BASS_SYNC_ONETIME 0x80000000 // flag: sync only once, else continuously -typedef void(CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, void *user); +typedef void(CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, + void *user); /* Sync callback function. NOTE: a sync callback function should be very quick as other syncs can't be processed until it has finished. If the sync is a "mixtime" sync, then other streams and MOD musics can't be mixed until @@ -580,7 +605,8 @@ channel: Channel that the sync occured in data : Additional data associated with the sync's occurance user : The 'user' parameter given when calling BASS_ChannelSetSync */ -typedef void(CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user); +typedef void(CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, + DWORD length, void *user); /* DSP callback function. NOTE: A DSP function should obviously be as quick as possible... other DSP functions, streams and MOD musics can not be processed until it's finished. @@ -590,7 +616,8 @@ buffer : Buffer to apply the DSP to length : Number of bytes in the buffer user : The 'user' parameter given when calling BASS_ChannelSetDSP */ -typedef BOOL(CALLBACK RECORDPROC)(HRECORD handle, const void *buffer, DWORD length, void *user); +typedef BOOL(CALLBACK RECORDPROC)(HRECORD handle, const void *buffer, + DWORD length, void *user); /* Recording callback function. handle : The recording handle buffer : Buffer containing the recorded sample data @@ -644,11 +671,12 @@ RETURN : TRUE = continue recording, FALSE = stop */ #define BASS_DATA_FFT8192 0x80000005 // 8192 FFT #define BASS_DATA_FFT16384 0x80000006 // 16384 FFT #define BASS_DATA_FFT32768 0x80000007 // 32768 FFT -#define BASS_DATA_FFT_INDIVIDUAL 0x10 // FFT flag: FFT for each channel, else all combined -#define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window -#define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias -#define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data -#define BASS_DATA_FFT_NYQUIST 0x100 // FFT flag: return extra Nyquist value +#define BASS_DATA_FFT_INDIVIDUAL \ + 0x10 // FFT flag: FFT for each channel, else all combined +#define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window +#define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias +#define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data +#define BASS_DATA_FFT_NYQUIST 0x100 // FFT flag: return extra Nyquist value // BASS_ChannelGetLevelEx flags #define BASS_LEVEL_MONO 1 @@ -657,52 +685,59 @@ RETURN : TRUE = continue recording, FALSE = stop */ #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_ID3 0 // ID3v1 tags : TAG_ID3 structure +#define BASS_TAG_ID3V2 1 // ID3v2 tags : variable length block +#define BASS_TAG_OGG 2 // OGG comments : series of null-terminated UTF-8 strings +#define BASS_TAG_HTTP 3 // HTTP headers : series of null-terminated ANSI strings +#define BASS_TAG_ICY 4 // ICY headers : series of null-terminated ANSI strings +#define BASS_TAG_META 5 // ICY metadata : ANSI string +#define BASS_TAG_APE 6 // APE tags : series of null-terminated UTF-8 strings +#define BASS_TAG_MP4 \ + 7 // MP4/iTunes metadata : series of null-terminated UTF-8 strings +#define BASS_TAG_WMA 8 // WMA tags : series of null-terminated UTF-8 strings +#define BASS_TAG_VENDOR 9 // OGG encoder : UTF-8 string +#define BASS_TAG_LYRICS3 10 // Lyric3v2 tag : ASCII string +#define BASS_TAG_CA_CODEC 11 // CoreAudio codec info : TAG_CA_CODEC structure +#define BASS_TAG_MF \ + 13 // Media Foundation tags : series of null-terminated UTF-8 strings +#define BASS_TAG_WAVEFORMAT 14 // WAVE format : WAVEFORMATEEX structure +#define BASS_TAG_AM_MIME 15 // Android Media MIME type : ASCII string +#define BASS_TAG_AM_NAME 16 // Android Media codec name : ASCII string +#define BASS_TAG_RIFF_INFO \ + 0x100 // RIFF "INFO" tags : series of null-terminated ANSI strings +#define BASS_TAG_RIFF_BEXT 0x101 // RIFF/BWF "bext" tags : TAG_BEXT structure +#define BASS_TAG_RIFF_CART 0x102 // RIFF/BWF "cart" tags : TAG_CART structure +#define BASS_TAG_RIFF_DISP 0x103 // RIFF "DISP" text tag : ANSI string +#define BASS_TAG_RIFF_CUE 0x104 // RIFF "cue " chunk : TAG_CUE structure +#define BASS_TAG_RIFF_SMPL 0x105 // RIFF "smpl" chunk : TAG_SMPL structure +#define BASS_TAG_APE_BINARY \ + 0x1000 // + index #, binary APE tag : TAG_APE_BINARY structure #define BASS_TAG_MUSIC_NAME 0x10000 // MOD music name : ANSI string #define BASS_TAG_MUSIC_MESSAGE 0x10001 // MOD message : ANSI string -#define BASS_TAG_MUSIC_ORDERS 0x10002 // MOD order list : BYTE array of pattern numbers -#define BASS_TAG_MUSIC_AUTH 0x10003 // MOD author : UTF-8 string -#define BASS_TAG_MUSIC_INST 0x10100 // + instrument #, MOD instrument name : ANSI string -#define BASS_TAG_MUSIC_SAMPLE 0x10300 // + sample #, MOD sample name : ANSI string +#define BASS_TAG_MUSIC_ORDERS \ + 0x10002 // MOD order list : BYTE array of pattern numbers +#define BASS_TAG_MUSIC_AUTH 0x10003 // MOD author : UTF-8 string +#define BASS_TAG_MUSIC_INST \ + 0x10100 // + instrument #, MOD instrument name : ANSI string +#define BASS_TAG_MUSIC_SAMPLE \ + 0x10300 // + sample #, MOD sample name : ANSI string // ID3v1 tag structure typedef struct { - char id[3]; - char title[30]; - char artist[30]; - char album[30]; - char year[4]; - char comment[30]; - BYTE genre; + char id[3]; + char title[30]; + char artist[30]; + char album[30]; + char year[4]; + char comment[30]; + BYTE genre; } TAG_ID3; // Binary APE tag structure typedef struct { - const char *key; - const void *data; - DWORD length; + const char *key; + const void *data; + DWORD length; } TAG_APE_BINARY; // BWF "bext" tag structure @@ -712,113 +747,107 @@ typedef struct { #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]; + char Description[256]; // description + char Originator[32]; // name of the originator + char OriginatorReference[32]; // reference of the originator + char OriginationDate[10]; // date of creation (yyyy-mm-dd) + char OriginationTime[8]; // time of creation (hh-mm-ss) + QWORD TimeReference; // first sample count since midnight (little-endian) + WORD Version; // BWF version (little-endian) + BYTE UMID[64]; // SMPTE UMID + BYTE Reserved[190]; #if defined(__GNUC__) && __GNUC__ < 3 - char CodingHistory[0]; // history -#elif 1 // change to 0 if compiler fails the following line - char CodingHistory[]; // history + char CodingHistory[0]; // history +#elif 1 // change to 0 if compiler fails the following line + char CodingHistory[]; // history #else - char CodingHistory[1]; // history + char CodingHistory[1]; // history #endif } TAG_BEXT; #pragma pack(pop) // BWF "cart" tag structures -typedef struct -{ - DWORD dwUsage; // FOURCC timer usage ID - DWORD dwValue; // timer value in samples from head +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 +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 + 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; +typedef struct { + DWORD dwCuePoints; #if defined(__GNUC__) && __GNUC__ < 3 - TAG_CUE_POINT CuePoints[0]; + 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; +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]; + 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 @@ -827,37 +856,40 @@ typedef struct // CoreAudio codec info structure typedef struct { - DWORD ftype; // file format - DWORD atype; // audio format - const char *name; // description + DWORD ftype; // file format + DWORD atype; // audio format + const char *name; // description } TAG_CA_CODEC; #ifndef _WAVEFORMATEX_ #define _WAVEFORMATEX_ #pragma pack(push, 1) typedef struct tWAVEFORMATEX { - WORD wFormatTag; - WORD nChannels; - DWORD nSamplesPerSec; - DWORD nAvgBytesPerSec; - WORD nBlockAlign; - WORD wBitsPerSample; - WORD cbSize; + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; + WORD wBitsPerSample; + WORD cbSize; } WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX; typedef const WAVEFORMATEX *LPCWAVEFORMATEX; #pragma pack(pop) #endif // BASS_ChannelGetLength/GetPosition/SetPosition modes -#define BASS_POS_BYTE 0 // byte position -#define BASS_POS_MUSIC_ORDER 1 // order.row position, MAKELONG(order,row) -#define BASS_POS_OGG 3 // OGG bitstream number -#define BASS_POS_RESET 0x2000000 // flag: reset user file buffers -#define BASS_POS_RELATIVE 0x4000000 // flag: seek relative to the current position -#define BASS_POS_INEXACT 0x8000000 // flag: allow seeking to inexact position -#define BASS_POS_DECODE 0x10000000 // flag: get the decoding (not playing) position -#define BASS_POS_DECODETO 0x20000000 // flag: decode to the position instead of seeking -#define BASS_POS_SCAN 0x40000000 // flag: scan to the position +#define BASS_POS_BYTE 0 // byte position +#define BASS_POS_MUSIC_ORDER 1 // order.row position, MAKELONG(order,row) +#define BASS_POS_OGG 3 // OGG bitstream number +#define BASS_POS_RESET 0x2000000 // flag: reset user file buffers +#define BASS_POS_RELATIVE \ + 0x4000000 // flag: seek relative to the current position +#define BASS_POS_INEXACT 0x8000000 // flag: allow seeking to inexact position +#define BASS_POS_DECODE \ + 0x10000000 // flag: get the decoding (not playing) position +#define BASS_POS_DECODETO \ + 0x20000000 // flag: decode to the position instead of seeking +#define BASS_POS_SCAN 0x40000000 // flag: scan to the position // BASS_ChannelSetDevice/GetDevice option #define BASS_NODEVICE 0x20000 @@ -892,81 +924,81 @@ typedef const WAVEFORMATEX *LPCWAVEFORMATEX; #define BASS_FX_VOLUME 9 typedef struct { - float fWetDryMix; - float fDepth; - float fFeedback; - float fFrequency; - DWORD lWaveform; // 0=triangle, 1=sine - float fDelay; - DWORD lPhase; // BASS_DX8_PHASE_xxx + float fWetDryMix; + float fDepth; + float fFeedback; + float fFrequency; + DWORD lWaveform; // 0=triangle, 1=sine + float fDelay; + DWORD lPhase; // BASS_DX8_PHASE_xxx } BASS_DX8_CHORUS; typedef struct { - float fGain; - float fAttack; - float fRelease; - float fThreshold; - float fRatio; - float fPredelay; + float fGain; + float fAttack; + float fRelease; + float fThreshold; + float fRatio; + float fPredelay; } BASS_DX8_COMPRESSOR; typedef struct { - float fGain; - float fEdge; - float fPostEQCenterFrequency; - float fPostEQBandwidth; - float fPreLowpassCutoff; + float fGain; + float fEdge; + float fPostEQCenterFrequency; + float fPostEQBandwidth; + float fPreLowpassCutoff; } BASS_DX8_DISTORTION; typedef struct { - float fWetDryMix; - float fFeedback; - float fLeftDelay; - float fRightDelay; - BOOL lPanDelay; + float fWetDryMix; + float fFeedback; + float fLeftDelay; + float fRightDelay; + BOOL lPanDelay; } BASS_DX8_ECHO; typedef struct { - float fWetDryMix; - float fDepth; - float fFeedback; - float fFrequency; - DWORD lWaveform; // 0=triangle, 1=sine - float fDelay; - DWORD lPhase; // BASS_DX8_PHASE_xxx + float fWetDryMix; + float fDepth; + float fFeedback; + float fFrequency; + DWORD lWaveform; // 0=triangle, 1=sine + float fDelay; + DWORD lPhase; // BASS_DX8_PHASE_xxx } BASS_DX8_FLANGER; typedef struct { - DWORD dwRateHz; // Rate of modulation in hz - DWORD dwWaveShape; // 0=triangle, 1=square + DWORD dwRateHz; // Rate of modulation in hz + DWORD dwWaveShape; // 0=triangle, 1=square } BASS_DX8_GARGLE; typedef struct { - int lRoom; // [-10000, 0] default: -1000 mB - int lRoomHF; // [-10000, 0] default: 0 mB - float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0 - float flDecayTime; // [0.1, 20.0] default: 1.49s - float flDecayHFRatio; // [0.1, 2.0] default: 0.83 - int lReflections; // [-10000, 1000] default: -2602 mB - float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s - int lReverb; // [-10000, 2000] default: 200 mB - float flReverbDelay; // [0.0, 0.1] default: 0.011 s - float flDiffusion; // [0.0, 100.0] default: 100.0 % - float flDensity; // [0.0, 100.0] default: 100.0 % - float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz + int lRoom; // [-10000, 0] default: -1000 mB + int lRoomHF; // [-10000, 0] default: 0 mB + float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0 + float flDecayTime; // [0.1, 20.0] default: 1.49s + float flDecayHFRatio; // [0.1, 2.0] default: 0.83 + int lReflections; // [-10000, 1000] default: -2602 mB + float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s + int lReverb; // [-10000, 2000] default: 200 mB + float flReverbDelay; // [0.0, 0.1] default: 0.011 s + float flDiffusion; // [0.0, 100.0] default: 100.0 % + float flDensity; // [0.0, 100.0] default: 100.0 % + float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz } BASS_DX8_I3DL2REVERB; typedef struct { - float fCenter; - float fBandwidth; - float fGain; + float fCenter; + float fBandwidth; + float fGain; } BASS_DX8_PARAMEQ; typedef struct { - float fInGain; // [-96.0,0.0] default: 0.0 dB - float fReverbMix; // [-96.0,0.0] default: 0.0 db - float fReverbTime; // [0.001,3000.0] default: 1000.0 ms - float fHighFreqRTRatio; // [0.001,0.999] default: 0.001 + float fInGain; // [-96.0,0.0] default: 0.0 dB + float fReverbMix; // [-96.0,0.0] default: 0.0 db + float fReverbTime; // [0.001,3000.0] default: 1000.0 ms + float fHighFreqRTRatio; // [0.001,0.999] default: 0.001 } BASS_DX8_REVERB; #define BASS_DX8_PHASE_NEG_180 0 @@ -976,10 +1008,10 @@ typedef struct { #define BASS_DX8_PHASE_180 4 typedef struct { - float fTarget; - float fCurrent; - float fTime; - DWORD lCurve; + float fTarget; + float fCurrent; + float fTime; + DWORD lCurve; } BASS_FX_VOLUME_PARAM; typedef void(CALLBACK IOSNOTIFYPROC)(DWORD status); @@ -996,15 +1028,19 @@ void *BASSDEF(BASS_GetConfigPtr)(DWORD option); DWORD BASSDEF(BASS_GetVersion)(); int BASSDEF(BASS_ErrorGetCode)(); BOOL BASSDEF(BASS_GetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info); -#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) -BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, HWND win, const GUID *dsguid); +#if defined(_WIN32) && !defined(_WIN32_WCE) && \ + !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) +BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, HWND win, + const GUID *dsguid); #else -BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, void *win, void *dsguid); +BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, void *win, + void *dsguid); #endif BOOL BASSDEF(BASS_SetDevice)(DWORD device); DWORD BASSDEF(BASS_GetDevice)(); BOOL BASSDEF(BASS_Free)(); -#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) +#if defined(_WIN32) && !defined(_WIN32_WCE) && \ + !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) void *BASSDEF(BASS_GetDSoundObject)(DWORD object); #endif BOOL BASSDEF(BASS_GetInfo)(BASS_INFO *info); @@ -1023,19 +1059,29 @@ const BASS_PLUGININFO *BASSDEF(BASS_PluginGetInfo)(HPLUGIN handle); BOOL BASSDEF(BASS_Set3DFactors)(float distf, float rollf, float doppf); BOOL BASSDEF(BASS_Get3DFactors)(float *distf, float *rollf, float *doppf); -BOOL BASSDEF(BASS_Set3DPosition)(const BASS_3DVECTOR *pos, const BASS_3DVECTOR *vel, const BASS_3DVECTOR *front, const BASS_3DVECTOR *top); -BOOL BASSDEF(BASS_Get3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, BASS_3DVECTOR *front, BASS_3DVECTOR *top); +BOOL BASSDEF(BASS_Set3DPosition)(const BASS_3DVECTOR *pos, + const BASS_3DVECTOR *vel, + const BASS_3DVECTOR *front, + const BASS_3DVECTOR *top); +BOOL BASSDEF(BASS_Get3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, + BASS_3DVECTOR *front, BASS_3DVECTOR *top); void BASSDEF(BASS_Apply3D)(); -#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) -BOOL BASSDEF(BASS_SetEAXParameters)(int env, float vol, float decay, float damp); -BOOL BASSDEF(BASS_GetEAXParameters)(DWORD *env, float *vol, float *decay, float *damp); +#if defined(_WIN32) && !defined(_WIN32_WCE) && \ + !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) +BOOL BASSDEF(BASS_SetEAXParameters)(int env, float vol, float decay, + float damp); +BOOL BASSDEF(BASS_GetEAXParameters)(DWORD *env, float *vol, float *decay, + float *damp); #endif -HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, const void *file, QWORD offset, DWORD length, DWORD flags, DWORD freq); +HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, const void *file, QWORD offset, + DWORD length, DWORD flags, DWORD freq); BOOL BASSDEF(BASS_MusicFree)(HMUSIC handle); -HSAMPLE BASSDEF(BASS_SampleLoad)(BOOL mem, const void *file, QWORD offset, DWORD length, DWORD max, DWORD flags); -HSAMPLE BASSDEF(BASS_SampleCreate)(DWORD length, DWORD freq, DWORD chans, DWORD max, DWORD flags); +HSAMPLE BASSDEF(BASS_SampleLoad)(BOOL mem, const void *file, QWORD offset, + DWORD length, DWORD max, DWORD flags); +HSAMPLE BASSDEF(BASS_SampleCreate)(DWORD length, DWORD freq, DWORD chans, + DWORD max, DWORD flags); BOOL BASSDEF(BASS_SampleFree)(HSAMPLE handle); BOOL BASSDEF(BASS_SampleSetData)(HSAMPLE handle, const void *buffer); BOOL BASSDEF(BASS_SampleGetData)(HSAMPLE handle, void *buffer); @@ -1045,14 +1091,22 @@ HCHANNEL BASSDEF(BASS_SampleGetChannel)(HSAMPLE handle, BOOL onlynew); DWORD BASSDEF(BASS_SampleGetChannels)(HSAMPLE handle, HCHANNEL *channels); BOOL BASSDEF(BASS_SampleStop)(HSAMPLE handle); -HSTREAM BASSDEF(BASS_StreamCreate)(DWORD freq, DWORD chans, DWORD flags, STREAMPROC *proc, void *user); -HSTREAM BASSDEF(BASS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags); -HSTREAM BASSDEF(BASS_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user); -HSTREAM BASSDEF(BASS_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *proc, void *user); +HSTREAM BASSDEF(BASS_StreamCreate)(DWORD freq, DWORD chans, DWORD flags, + STREAMPROC *proc, void *user); +HSTREAM BASSDEF(BASS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, + QWORD length, DWORD flags); +HSTREAM BASSDEF(BASS_StreamCreateURL)(const char *url, DWORD offset, + DWORD flags, DOWNLOADPROC *proc, + void *user); +HSTREAM BASSDEF(BASS_StreamCreateFileUser)(DWORD system, DWORD flags, + const BASS_FILEPROCS *proc, + void *user); BOOL BASSDEF(BASS_StreamFree)(HSTREAM handle); QWORD BASSDEF(BASS_StreamGetFilePosition)(HSTREAM handle, DWORD mode); -DWORD BASSDEF(BASS_StreamPutData)(HSTREAM handle, const void *buffer, DWORD length); -DWORD BASSDEF(BASS_StreamPutFileData)(HSTREAM handle, const void *buffer, DWORD length); +DWORD BASSDEF(BASS_StreamPutData)(HSTREAM handle, const void *buffer, + DWORD length); +DWORD BASSDEF(BASS_StreamPutFileData)(HSTREAM handle, const void *buffer, + DWORD length); BOOL BASSDEF(BASS_RecordGetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info); BOOL BASSDEF(BASS_RecordInit)(int device); @@ -1063,7 +1117,8 @@ BOOL BASSDEF(BASS_RecordGetInfo)(BASS_RECORDINFO *info); const char *BASSDEF(BASS_RecordGetInputName)(int input); BOOL BASSDEF(BASS_RecordSetInput)(int input, DWORD flags, float volume); DWORD BASSDEF(BASS_RecordGetInput)(int input, float *volume); -HRECORD BASSDEF(BASS_RecordStart)(DWORD freq, DWORD chans, DWORD flags, RECORDPROC *proc, void *user); +HRECORD BASSDEF(BASS_RecordStart)(DWORD freq, DWORD chans, DWORD flags, + RECORDPROC *proc, void *user); double BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos); QWORD BASSDEF(BASS_ChannelSeconds2Bytes)(DWORD handle, double pos); @@ -1079,24 +1134,39 @@ BOOL BASSDEF(BASS_ChannelPlay)(DWORD handle, BOOL restart); BOOL BASSDEF(BASS_ChannelStop)(DWORD handle); BOOL BASSDEF(BASS_ChannelPause)(DWORD handle); BOOL BASSDEF(BASS_ChannelSetAttribute)(DWORD handle, DWORD attrib, float value); -BOOL BASSDEF(BASS_ChannelGetAttribute)(DWORD handle, DWORD attrib, float *value); -BOOL BASSDEF(BASS_ChannelSlideAttribute)(DWORD handle, DWORD attrib, float value, DWORD time); +BOOL BASSDEF(BASS_ChannelGetAttribute)(DWORD handle, DWORD attrib, + float *value); +BOOL BASSDEF(BASS_ChannelSlideAttribute)(DWORD handle, DWORD attrib, + float value, DWORD time); BOOL BASSDEF(BASS_ChannelIsSliding)(DWORD handle, DWORD attrib); -BOOL BASSDEF(BASS_ChannelSetAttributeEx)(DWORD handle, DWORD attrib, void *value, DWORD size); -DWORD BASSDEF(BASS_ChannelGetAttributeEx)(DWORD handle, DWORD attrib, void *value, DWORD size); -BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min, float max, int iangle, int oangle, float outvol); -BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min, float *max, DWORD *iangle, DWORD *oangle, float *outvol); -BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, const BASS_3DVECTOR *pos, const BASS_3DVECTOR *orient, const BASS_3DVECTOR *vel); -BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel); +BOOL BASSDEF(BASS_ChannelSetAttributeEx)(DWORD handle, DWORD attrib, + void *value, DWORD size); +DWORD BASSDEF(BASS_ChannelGetAttributeEx)(DWORD handle, DWORD attrib, + void *value, DWORD size); +BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min, + float max, int iangle, int oangle, + float outvol); +BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min, + float *max, DWORD *iangle, + DWORD *oangle, float *outvol); +BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, const BASS_3DVECTOR *pos, + const BASS_3DVECTOR *orient, + const BASS_3DVECTOR *vel); +BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, + BASS_3DVECTOR *orient, + BASS_3DVECTOR *vel); QWORD BASSDEF(BASS_ChannelGetLength)(DWORD handle, DWORD mode); BOOL BASSDEF(BASS_ChannelSetPosition)(DWORD handle, QWORD pos, DWORD mode); QWORD BASSDEF(BASS_ChannelGetPosition)(DWORD handle, DWORD mode); DWORD BASSDEF(BASS_ChannelGetLevel)(DWORD handle); -BOOL BASSDEF(BASS_ChannelGetLevelEx)(DWORD handle, float *levels, float length, DWORD flags); +BOOL BASSDEF(BASS_ChannelGetLevelEx)(DWORD handle, float *levels, float length, + DWORD flags); DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length); -HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param, SYNCPROC *proc, void *user); +HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param, + SYNCPROC *proc, void *user); BOOL BASSDEF(BASS_ChannelRemoveSync)(DWORD handle, HSYNC sync); -HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, void *user, int priority); +HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, void *user, + int priority); BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp); BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan); BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan); @@ -1114,32 +1184,42 @@ BOOL BASSDEF(BASS_FXSetPriority)(HFX handle, int priority); #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 diff --git a/include/bassopus.h b/include/bassopus.h index 757ff70c..3d8b131d 100644 --- a/include/bassopus.h +++ b/include/bassopus.h @@ -1,8 +1,8 @@ /* - BASSOPUS 2.4 C/C++ header file - Copyright (c) 2012-2015 Un4seen Developments Ltd. + BASSOPUS 2.4 C/C++ header file + Copyright (c) 2012-2015 Un4seen Developments Ltd. - See the BASSOPUS.CHM file for more detailed documentation + See the BASSOPUS.CHM file for more detailed documentation */ #ifndef BASSOPUS_H @@ -29,22 +29,34 @@ extern "C" { #define BASS_ATTRIB_OPUS_ORIGFREQ 0x13000 #define BASS_ATTRIB_OPUS_GAIN 0x13001 -HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags); -HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user); -HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *procs, void *user); +HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFile)(BOOL mem, const void *file, + QWORD offset, QWORD length, + DWORD flags); +HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateURL)(const char *url, DWORD offset, + DWORD flags, DOWNLOADPROC *proc, + void *user); +HSTREAM BASSOPUSDEF(BASS_OPUS_StreamCreateFileUser)(DWORD system, DWORD flags, + const BASS_FILEPROCS *procs, + void *user); #ifdef __cplusplus } #if defined(_WIN32) && !defined(NOBASSOVERLOADS) -static inline HSTREAM BASS_OPUS_StreamCreateFile(BOOL mem, const WCHAR *file, QWORD offset, QWORD length, DWORD flags) +static inline HSTREAM BASS_OPUS_StreamCreateFile(BOOL mem, const WCHAR *file, + QWORD offset, QWORD length, + DWORD flags) { - return BASS_OPUS_StreamCreateFile(mem, (const void *)file, offset, length, flags | BASS_UNICODE); + return BASS_OPUS_StreamCreateFile(mem, (const void *)file, offset, length, + flags | BASS_UNICODE); } -static inline HSTREAM BASS_OPUS_StreamCreateURL(const WCHAR *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user) +static inline HSTREAM BASS_OPUS_StreamCreateURL(const WCHAR *url, DWORD offset, + DWORD flags, DOWNLOADPROC *proc, + void *user) { - return BASS_OPUS_StreamCreateURL((const char *)url, offset, flags | BASS_UNICODE, proc, user); + return BASS_OPUS_StreamCreateURL((const char *)url, offset, + flags | BASS_UNICODE, proc, user); } #endif #endif diff --git a/include/chatlogpiece.h b/include/chatlogpiece.h index c2d32b24..e6f77c74 100644 --- a/include/chatlogpiece.h +++ b/include/chatlogpiece.h @@ -6,25 +6,27 @@ 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(); + chatlogpiece(QString p_name, QString p_showname, QString p_message, + bool p_song); + chatlogpiece(QString p_name, QString p_showname, QString p_message, + bool p_song, QDateTime p_datetime); - QString get_name(); - QString get_showname(); - QString get_message(); - bool is_song(); - QDateTime get_datetime(); - QString get_datetime_as_string(); + QString get_name(); + QString get_showname(); + QString get_message(); + bool is_song(); + QDateTime get_datetime(); + QString get_datetime_as_string(); - QString get_full(); + QString get_full(); private: - QString name; - QString showname; - QString message; - QDateTime datetime; - bool p_is_song; + QString name; + QString showname; + QString message; + QDateTime datetime; + bool p_is_song; }; #endif // CHATLOGPIECE_H diff --git a/include/courtroom.h b/include/courtroom.h index c3c6b87e..259a7ed5 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -63,723 +63,743 @@ class AOApplication; class Courtroom : public QMainWindow { - Q_OBJECT + 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 fix_last_area() - { - if (area_list.size() > 0) { - QString malplaced = area_list.last(); - area_list.removeLast(); - append_music(malplaced); - } + 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 fix_last_area() + { + if (area_list.size() > 0) { + QString malplaced = area_list.last(); + area_list.removeLast(); + append_music(malplaced); } - - 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_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(); } - - 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(); + 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(); + void character_loading_finished(); - //sets position of widgets based on theme ini files - void set_widgets(); + // 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 class_name, QString p_identifier); + // sets font size based on theme ini files + void set_font(QWidget *widget, QString class_name, QString p_identifier); - //Get the properly constructed font - QFont get_qfont(QString font_name, int f_pointsize, bool antialias = true); + // Get the properly constructed font + QFont get_qfont(QString font_name, int f_pointsize, bool antialias = true); - //actual operation of setting the font on a widget - void set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color = Qt::black, bool bold = false); + // actual operation of setting the font on a widget + void set_qfont(QWidget *widget, QString class_name, QFont font, + QColor f_color = Qt::black, bool bold = false); - //helper function that calls above function on the relevant widgets - void set_fonts(); + // helper function that calls above function on the relevant widgets + void set_fonts(); - //sets dropdown menu stylesheet - void set_dropdown(QWidget *widget); + // sets dropdown menu stylesheet + void set_dropdown(QWidget *widget); - //helper funciton that call above function on the relevant widgets - void set_dropdowns(); + // helper funciton that call above function on the relevant widgets + void set_dropdowns(); - void set_window_title(QString p_title); + 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); + // reads theme inis and sets size and pos based on the identifier + void set_size_and_pos(QWidget *p_widget, QString p_identifier); - //reads theme inis and returns the size and pos as defined by it - QPoint get_theme_pos(QString p_identifier); + // reads theme inis and returns the size and pos as defined by it + 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 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, bool display = false); + // sets the current background to argument. also does some checks to see if + // it's a legacy bg + void set_background(QString p_background, bool display = false); - //sets the local character pos/side to use. - void set_side(QString p_side); + // sets the local character pos/side to use. + void set_side(QString p_side); - //sets the pos dropdown - void set_pos_dropdown(QStringList pos_dropdowns); + // sets the pos dropdown + void set_pos_dropdown(QStringList pos_dropdowns); - //sets the evidence list member variable to argument - void set_evidence_list(QVector &p_evi_list); + // 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(); + // 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 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 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(QString f_desk_mod, QString f_side); + // sets desk and bg based on pos in chatmessage + void set_scene(QString f_desk_mod, QString f_side); - //takes in serverD-formatted IP list as prints a converted version to server OOC - //admittedly poorly named - void set_ip_list(QString p_list); + // 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); + // 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); + // send a message that the player is banned and quits the server + void set_ban(int p_cid); - //cid = character id, returns the cid of the currently selected character - int get_cid() { return m_cid; } - QString get_current_char() { return current_char; } - QString get_current_background() { return current_background; } + // cid = character id, returns the cid of the currently selected character + int get_cid() { return m_cid; } + QString get_current_char() { return current_char; } + QString get_current_background() { return current_background; } - //updates character to p_cid and updates necessary ui elements - void update_character(int p_cid); + // updates character to p_cid and updates necessary ui elements + void update_character(int p_cid); - //properly sets up some varibles: resets user state - void enter_courtroom(); + // properly sets up some varibles: resets user state + void enter_courtroom(); - //helper function that populates ui_music_list with the contents of music_list - void list_music(); - void list_areas(); + // 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_color); + // 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_color); - //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(); + // 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 colorize = false, int pos = -1, int default_color = 0); + // This function filters out the common CC inline text trickery, for appending + // to the IC chatlog. + QString filter_ic_text(QString p_text, bool colorize = false, int pos = -1, + int default_color = 0); - //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 = "", QString action = ""); + // 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 = "", QString action = ""); - //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); + // 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); + void play_preanim(bool noninterrupting); - //plays the witness testimony or cross examination animation based on argument - void handle_wtce(QString p_wtce, int variant); + // 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); + // 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); + // Toggles the judge buttons, whether they should appear or not. + void toggle_judge_buttons(bool is_on); - void announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno); + void announce_case(QString title, bool def, bool pro, bool jud, bool jur, + bool steno); - void check_connection_received(); + void check_connection_received(); - ~Courtroom(); + ~Courtroom(); private: - AOApplication *ao_app; - - int m_courtroom_width = 714; - int m_courtroom_height = 668; - - int m_viewport_x = 0; - int m_viewport_y = 0; + AOApplication *ao_app; - int m_viewport_width = 256; - int m_viewport_height = 192; + int m_courtroom_width = 714; + int m_courtroom_height = 668; - bool first_message_sent = false; - int maximumMessages = 0; + int m_viewport_x = 0; + int m_viewport_y = 0; - QParallelAnimationGroup *screenshake_animation_group = new QParallelAnimationGroup; + int m_viewport_width = 256; + int m_viewport_height = 192; - bool next_character_is_not_special = false; // If true, write the - // next character as it is. + bool first_message_sent = false; + int maximumMessages = 0; - bool message_is_centered = false; + QParallelAnimationGroup *screenshake_animation_group = + new QParallelAnimationGroup; - int current_display_speed = 3; - int message_display_speed[7] = {0, 10, 25, 40, 50, 70, 90}; + bool next_character_is_not_special = false; // If true, write the + // next character as it is. - // The character ID of the character this user wants to appear alongside with. - int other_charid = -1; + bool message_is_centered = false; - // The offset this user has given if they want to appear alongside someone. - int char_offset = 0; + int current_display_speed = 3; + int message_display_speed[7] = {0, 10, 25, 40, 50, 70, 90}; - // 0 = in front, 1 = behind - int pair_order = 0; + // The character ID of the character this user wants to appear alongside with. + int other_charid = -1; - QVector char_list; - QVector evidence_list; - QVector music_list; - QVector area_list; + // The offset this user has given if they want to appear alongside someone. + int char_offset = 0; - QVector arup_players; - QVector arup_statuses; - QVector arup_cms; - QVector arup_locks; + // 0 = in front, 1 = behind + int pair_order = 0; - QVector ic_chatlog_history; + QVector char_list; + QVector evidence_list; + QVector music_list; + QVector area_list; - //triggers ping_server() every 60 seconds - QTimer *keepalive_timer; + QVector arup_players; + QVector arup_statuses; + QVector arup_cms; + QVector arup_locks; - //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; - //the actual document tick pos we gotta worry about for making the text scroll better - int real_tick_pos = 0; - //used to determine how often blips sound - int blip_ticker = 0; - int blip_rate = 1; - int rainbow_counter = 0; - bool rainbow_appended = false; - bool blank_blip = false; + QVector ic_chatlog_history; - //Whether or not is this message additive to the previous one - bool is_additive = false; + // triggers ping_server() every 60 seconds + QTimer *keepalive_timer; - // Used for getting the current maximum blocks allowed in the IC chatlog. - int log_maximum_blocks = 0; + // 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; + // the actual document tick pos we gotta worry about for making the text + // scroll better + int real_tick_pos = 0; + // used to determine how often blips sound + int blip_ticker = 0; + int blip_rate = 1; + int rainbow_counter = 0; + bool rainbow_appended = false; + bool blank_blip = false; - // True, if the log should go downwards. - bool log_goes_downwards = false; + // Whether or not is this message additive to the previous one + bool is_additive = false; - //delay before chat messages starts ticking - QTimer *text_delay_timer; + // Used for getting the current maximum blocks allowed in the IC chatlog. + int log_maximum_blocks = 0; - //delay before sfx plays - QTimer *sfx_delay_timer; + // True, if the log should go downwards. + bool log_goes_downwards = false; - //every time point in char.inis times this equals the final time - const int time_mod = 40; + // delay before chat messages starts ticking + QTimer *text_delay_timer; - //the amount of time non-animated objection/hold it/takethat images stay onscreen for in ms - const int shout_stay_time = 724; + // delay before sfx plays + QTimer *sfx_delay_timer; - //the amount of time non-animated guilty/not guilty images stay onscreen for in ms - const int verdict_stay_time = 3000; + // every time point in char.inis times this equals the final time + const int time_mod = 40; - //the amount of time non-animated witness testimony/cross-examination images stay onscreen for in ms - const int wtce_stay_time = 1500; + // the amount of time non-animated objection/hold it/takethat images stay + // onscreen for in ms + const int shout_stay_time = 724; - //characters we consider punctuation - const QString punctuation_chars = ".,?!:;"; + // the amount of time non-animated guilty/not guilty images stay onscreen for + // in ms + const int verdict_stay_time = 3000; - //amount by which we multiply the delay when we parse punctuation chars - const int punctuation_modifier = 3; + // 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 = 30; - QString m_chatmessage[chatmessage_size]; - bool chatmessage_is_empty = false; + // characters we consider punctuation + const QString punctuation_chars = ".,?!:;"; - QString previous_ic_message = ""; - QString additive_previous = ""; + // amount by which we multiply the delay when we parse punctuation chars + const int punctuation_modifier = 3; - //char id, muted or not - QMap mute_map; + static const int chatmessage_size = 30; + QString m_chatmessage[chatmessage_size]; + bool chatmessage_is_empty = false; - //QVector muted_cids; + QString previous_ic_message = ""; + QString additive_previous = ""; - bool is_muted = false; + // char id, muted or not + QMap mute_map; - //state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle, 4 = noniterrupting preanim - int anim_state = 3; + // QVector muted_cids; - //whether or not current color is a talking one - bool color_is_talking = true; + bool is_muted = false; - //state of text ticking, 0 = not yet ticking, 1 = ticking in progress, 2 = ticking done - int text_state = 2; + // state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle, 4 = + // noniterrupting preanim + int anim_state = 3; - //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 current_char = ""; + // whether or not current color is a talking one + bool color_is_talking = true; - int objection_state = 0; - int realization_state = 0; - int screenshake_state = 0; - int text_color = 0; + // state of text ticking, 0 = not yet ticking, 1 = ticking in progress, 2 = + // ticking done + int text_state = 2; - //How many unique user colors are possible - static const int max_colors = 12; + // 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 current_char = ""; - //Text Color-related optimization: - //Current color list indexes to real color references - QVector color_row_to_number; + int objection_state = 0; + int realization_state = 0; + int screenshake_state = 0; + int text_color = 0; - //List of associated RGB colors for this color index - QVector color_rgb_list; + // How many unique user colors are possible + static const int max_colors = 12; - //List of markdown start characters, their index is tied to the color index - QStringList color_markdown_start_list; + // Text Color-related optimization: + // Current color list indexes to real color references + QVector color_row_to_number; - //List of markdown end characters, their index is tied to the color index - QStringList color_markdown_end_list; + // List of associated RGB colors for this color index + QVector color_rgb_list; - //Whether or not we're supposed to remove this char during parsing - QVector color_markdown_remove_list; + // List of markdown start characters, their index is tied to the color index + QStringList color_markdown_start_list; - //Whether or not this color allows us to play the talking animation - QVector color_markdown_talking_list; - //Text Color-related optimization END + // List of markdown end characters, their index is tied to the color index + QStringList color_markdown_end_list; - //List of all currently available pos - QStringList pos_dropdown_list; + // Whether or not we're supposed to remove this char during parsing + QVector color_markdown_remove_list; - bool is_presenting_evidence = false; + // Whether or not this color allows us to play the talking animation + QVector color_markdown_talking_list; + // Text Color-related optimization END - QString effect = ""; + // List of all currently available pos + QStringList pos_dropdown_list; - //Music effect flags we want to send to server when we play music - int music_flags = 0; + bool is_presenting_evidence = false; - int defense_bar_state = 0; - int prosecution_bar_state = 0; + QString effect = ""; - int current_char_page = 0; - int char_columns = 10; - int char_rows = 9; - int max_chars_on_page = 90; + // Music effect flags we want to send to server when we play music + int music_flags = 0; - const int button_width = 60; - const int button_height = 60; + int defense_bar_state = 0; + int prosecution_bar_state = 0; - int current_emote_page = 0; - int current_emote = 0; - int emote_columns = 5; - int emote_rows = 2; - int max_emotes_on_page = 10; + int current_char_page = 0; + int char_columns = 10; + int char_rows = 9; + int max_chars_on_page = 90; - QVector local_evidence_list; - QVector private_evidence_list; - QVector global_evidence_list; + const int button_width = 60; + const int button_height = 60; - //false = use private_evidence_list - bool current_evidence_global = true; + int current_emote_page = 0; + int current_emote = 0; + int emote_columns = 5; + int emote_rows = 2; + int max_emotes_on_page = 10; - int current_evidence_page = 0; - int current_evidence = 0; - int evidence_columns = 6; - int evidence_rows = 3; - int max_evidence_on_page = 18; + QVector local_evidence_list; + QVector private_evidence_list; + QVector global_evidence_list; - //is set to true if the bg folder contains defensedesk.png, prosecutiondesk.png and stand.png - bool is_ao2_bg = false; + // false = use private_evidence_list + bool current_evidence_global = true; - //whether the ooc chat is server or master chat, true is server - bool server_ooc = true; + int current_evidence_page = 0; + int current_evidence = 0; + int evidence_columns = 6; + int evidence_rows = 3; + int max_evidence_on_page = 18; - QString current_background = "default"; - QString current_side = ""; + // is set to true if the bg folder contains defensedesk.png, + // prosecutiondesk.png and stand.png + bool is_ao2_bg = false; - AOMusicPlayer *music_player; - AOSfxPlayer *sfx_player; - AOSfxPlayer *objection_player; - AOBlipPlayer *blip_player; + // whether the ooc chat is server or master chat, true is server + bool server_ooc = true; - AOSfxPlayer *modcall_player; + QString current_background = "default"; + QString current_side = ""; - AOImage *ui_background; + AOMusicPlayer *music_player; + AOSfxPlayer *sfx_player; + AOSfxPlayer *objection_player; + AOBlipPlayer *blip_player; - 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; - AOMovie *ui_vp_chat_arrow; - QTextEdit *ui_vp_message; - AOMovie *ui_vp_effect; - AOMovie *ui_vp_testimony; - AOMovie *ui_vp_wtce; - AOMovie *ui_vp_objection; + AOSfxPlayer *modcall_player; - QTextEdit *ui_ic_chatlog; + AOImage *ui_background; - AOTextArea *ui_ms_chatlog; - AOTextArea *ui_server_chatlog; + 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; + AOMovie *ui_vp_chat_arrow; + QTextEdit *ui_vp_message; + AOMovie *ui_vp_effect; + AOMovie *ui_vp_testimony; + AOMovie *ui_vp_wtce; + AOMovie *ui_vp_objection; - QListWidget *ui_mute_list; - QTreeWidget *ui_area_list; - QTreeWidget *ui_music_list; + QTextEdit *ui_ic_chatlog; - ScrollText *ui_music_name; - AOMovie *ui_music_display; + AOTextArea *ui_ms_chatlog; + AOTextArea *ui_server_chatlog; - AOButton *ui_pair_button; - QListWidget *ui_pair_list; - QSpinBox *ui_pair_offset_spinbox; + QListWidget *ui_mute_list; + QTreeWidget *ui_area_list; + QTreeWidget *ui_music_list; - QComboBox *ui_pair_order_dropdown; + ScrollText *ui_music_name; + AOMovie *ui_music_display; - AOLineEdit *ui_ic_chat_message; - QLineEdit *ui_ic_chat_name; + AOButton *ui_pair_button; + QListWidget *ui_pair_list; + QSpinBox *ui_pair_offset_spinbox; - QLineEdit *ui_ooc_chat_message; - QLineEdit *ui_ooc_chat_name; + QComboBox *ui_pair_order_dropdown; - //QLineEdit *ui_area_password; - QLineEdit *ui_music_search; + AOLineEdit *ui_ic_chat_message; + QLineEdit *ui_ic_chat_name; - QWidget *ui_emotes; - QVector ui_emote_list; - AOButton *ui_emote_left; - AOButton *ui_emote_right; + QLineEdit *ui_ooc_chat_message; + QLineEdit *ui_ooc_chat_name; - QComboBox *ui_emote_dropdown; - QComboBox *ui_pos_dropdown; + // QLineEdit *ui_area_password; + QLineEdit *ui_music_search; - QComboBox *ui_iniswap_dropdown; - AOButton *ui_iniswap_remove; + QWidget *ui_emotes; + QVector ui_emote_list; + AOButton *ui_emote_left; + AOButton *ui_emote_right; - QComboBox *ui_sfx_dropdown; - AOButton *ui_sfx_remove; + QComboBox *ui_emote_dropdown; + QComboBox *ui_pos_dropdown; - QComboBox *ui_effects_dropdown; + QComboBox *ui_iniswap_dropdown; + AOButton *ui_iniswap_remove; - AOImage *ui_defense_bar; - AOImage *ui_prosecution_bar; + QComboBox *ui_sfx_dropdown; + AOButton *ui_sfx_remove; - QLabel *ui_music_label; - QLabel *ui_sfx_label; - QLabel *ui_blip_label; + QComboBox *ui_effects_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_hold_it; + AOButton *ui_objection; + AOButton *ui_take_that; - AOButton *ui_ooc_toggle; + AOButton *ui_ooc_toggle; - AOButton *ui_witness_testimony; - AOButton *ui_cross_examination; - AOButton *ui_guilty; - AOButton *ui_not_guilty; + 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; + 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_additive; - QCheckBox *ui_guard; - QCheckBox *ui_casing; + QCheckBox *ui_pre; + QCheckBox *ui_flip; + QCheckBox *ui_additive; + QCheckBox *ui_guard; + QCheckBox *ui_casing; - QCheckBox *ui_pre_non_interrupt; - QCheckBox *ui_showname_enable; + QCheckBox *ui_pre_non_interrupt; + QCheckBox *ui_showname_enable; - AOButton *ui_custom_objection; - AOButton *ui_realization; - AOButton *ui_screenshake; - AOButton *ui_mute; - - AOButton *ui_defense_plus; - AOButton *ui_defense_minus; - - AOButton *ui_prosecution_plus; - AOButton *ui_prosecution_minus; + AOButton *ui_custom_objection; + AOButton *ui_realization; + AOButton *ui_screenshake; + AOButton *ui_mute; + + AOButton *ui_defense_plus; + AOButton *ui_defense_minus; + + AOButton *ui_prosecution_plus; + AOButton *ui_prosecution_minus; - QComboBox *ui_text_color; + QComboBox *ui_text_color; - QSlider *ui_music_slider; - QSlider *ui_sfx_slider; - QSlider *ui_blip_slider; + QSlider *ui_music_slider; + QSlider *ui_sfx_slider; + QSlider *ui_blip_slider; - AOImage *ui_muted; + AOImage *ui_muted; - 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; - AOButton *ui_evidence_ok; - AOButton *ui_evidence_switch; - AOButton *ui_evidence_transfer; - AOButton *ui_evidence_save; - AOButton *ui_evidence_load; - AOTextEdit *ui_evidence_description; + 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; + AOButton *ui_evidence_ok; + AOButton *ui_evidence_switch; + AOButton *ui_evidence_transfer; + AOButton *ui_evidence_save; + AOButton *ui_evidence_load; + AOTextEdit *ui_evidence_description; - AOImage *ui_char_select_background; + AOImage *ui_char_select_background; - //abstract widget to hold char buttons - QWidget *ui_char_buttons; + // abstract widget to hold char buttons + QWidget *ui_char_buttons; - QVector ui_char_button_list; - QVector ui_char_button_list_filtered; - AOImage *ui_selector; + QVector ui_char_button_list; + QVector ui_char_button_list_filtered; + AOImage *ui_selector; - AOButton *ui_back_to_lobby; + AOButton *ui_back_to_lobby; - QLineEdit *ui_char_password; + QLineEdit *ui_char_password; - AOButton *ui_char_select_left; - AOButton *ui_char_select_right; + AOButton *ui_char_select_left; + AOButton *ui_char_select_right; - AOButton *ui_spectator; + AOButton *ui_spectator; - QLineEdit *ui_char_search; - QCheckBox *ui_char_passworded; - QCheckBox *ui_char_taken; + QLineEdit *ui_char_search; + QCheckBox *ui_char_passworded; + QCheckBox *ui_char_taken; - void construct_char_select(); - void set_char_select(); - void set_char_select_page(); - void char_clicked(int n_char); - void put_button_in_place(int starting, int chars_on_this_page); - void filter_character_list(); - - void initialize_emotes(); - void refresh_emotes(); - void set_emote_page(); - void set_emote_dropdown(); - - void initialize_evidence(); - void refresh_evidence(); - void set_evidence_page(); + void construct_char_select(); + void set_char_select(); + void set_char_select_page(); + void char_clicked(int n_char); + void put_button_in_place(int starting, int chars_on_this_page); + void filter_character_list(); + + void initialize_emotes(); + void refresh_emotes(); + void set_emote_page(); + void set_emote_dropdown(); + + void initialize_evidence(); + void refresh_evidence(); + void set_evidence_page(); public slots: - void objection_done(); - void preanim_done(); - void do_screenshake(); - void do_flash(); - void do_effect(QString fx_path, QString fx_sound, QString p_char, QString p_folder); - void play_char_sfx(QString sfx_name); + void objection_done(); + void preanim_done(); + void do_screenshake(); + void do_flash(); + void do_effect(QString fx_path, QString fx_sound, QString p_char, + QString p_folder); + void play_char_sfx(QString sfx_name); - void mod_called(QString p_ip); + void mod_called(QString p_ip); - void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno); + void case_called(QString msg, bool def, bool pro, bool jud, bool jur, + bool steno); private slots: - void start_chat_ticking(); - void play_sfx(); + void start_chat_ticking(); + void play_sfx(); - void chat_tick(); + void chat_tick(); - void on_mute_list_clicked(QModelIndex p_index); - void on_pair_list_clicked(QModelIndex p_index); + void on_mute_list_clicked(QModelIndex p_index); + void on_pair_list_clicked(QModelIndex p_index); - void on_chat_return_pressed(); + void on_chat_return_pressed(); - void on_ooc_return_pressed(); + void on_ooc_return_pressed(); - void on_music_search_edited(QString p_text); - void on_music_list_double_clicked(QTreeWidgetItem *p_item, int column); - void on_music_list_context_menu_requested(const QPoint &pos); - void music_fade_out(bool toggle); - void music_fade_in(bool toggle); - void music_synchronize(bool toggle); - void music_list_expand_all(); - void music_list_collapse_all(); - void on_area_list_double_clicked(QTreeWidgetItem *p_item, int column); + void on_music_search_edited(QString p_text); + void on_music_list_double_clicked(QTreeWidgetItem *p_item, int column); + void on_music_list_context_menu_requested(const QPoint &pos); + void music_fade_out(bool toggle); + void music_fade_in(bool toggle); + void music_synchronize(bool toggle); + void music_list_expand_all(); + void music_list_collapse_all(); + void on_area_list_double_clicked(QTreeWidgetItem *p_item, int column); - void select_emote(int p_id); + void select_emote(int p_id); - void on_emote_clicked(int p_id); + void on_emote_clicked(int p_id); - void on_emote_left_clicked(); - void on_emote_right_clicked(); + 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_emote_dropdown_changed(int p_index); + void on_pos_dropdown_changed(int p_index); - void on_iniswap_dropdown_changed(int p_index); - void set_iniswap_dropdown(); - void on_iniswap_context_menu_requested(const QPoint &pos); - void on_iniswap_edit_requested(); - void on_iniswap_remove_clicked(); + void on_iniswap_dropdown_changed(int p_index); + void set_iniswap_dropdown(); + void on_iniswap_context_menu_requested(const QPoint &pos); + void on_iniswap_edit_requested(); + void on_iniswap_remove_clicked(); - void on_sfx_dropdown_changed(int p_index); - void set_sfx_dropdown(); - void on_sfx_context_menu_requested(const QPoint &pos); - void on_sfx_edit_requested(); - void on_sfx_remove_clicked(); + void on_sfx_dropdown_changed(int p_index); + void set_sfx_dropdown(); + void on_sfx_context_menu_requested(const QPoint &pos); + void on_sfx_edit_requested(); + void on_sfx_remove_clicked(); - void set_effects_dropdown(); - void on_effects_context_menu_requested(const QPoint &pos); - void on_effects_edit_requested(); - void on_character_effects_edit_requested(); - void on_effects_dropdown_changed(int p_index); - bool effects_dropdown_find_and_set(QString effect); + void set_effects_dropdown(); + void on_effects_context_menu_requested(const QPoint &pos); + void on_effects_edit_requested(); + void on_character_effects_edit_requested(); + void on_effects_dropdown_changed(int p_index); + bool effects_dropdown_find_and_set(QString effect); - QString get_char_sfx(); - int get_char_sfx_delay(); + QString get_char_sfx(); + int get_char_sfx_delay(); - 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_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_hover(int p_id, bool p_state); - void on_evidence_left_clicked(); - void on_evidence_right_clicked(); - void on_evidence_present_clicked(); + 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 on_hold_it_clicked(); + void on_objection_clicked(); + void on_take_that_clicked(); + void on_custom_objection_clicked(); - void on_realization_clicked(); - void on_screenshake_clicked(); + void on_realization_clicked(); + void on_screenshake_clicked(); - void on_mute_clicked(); - void on_pair_clicked(); - void on_pair_order_dropdown_changed(int p_index); + void on_mute_clicked(); + void on_pair_clicked(); + void on_pair_order_dropdown_changed(int p_index); - void on_defense_minus_clicked(); - void on_defense_plus_clicked(); - void on_prosecution_minus_clicked(); - void on_prosecution_plus_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 set_text_color_dropdown(); + void on_text_color_changed(int p_color); + void set_text_color_dropdown(); - 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_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_log_limit_changed(int value); + void on_pair_offset_changed(int value); - void on_ooc_toggle_clicked(); + 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_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_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_additive_clicked(); - void on_guard_clicked(); + void on_pre_clicked(); + void on_flip_clicked(); + void on_additive_clicked(); + void on_guard_clicked(); - void on_showname_enable_clicked(); + void on_showname_enable_clicked(); - void on_evidence_name_double_clicked(); - void on_evidence_image_name_double_clicked(); - void on_evidence_button_clicked(); + void on_evidence_name_double_clicked(); + void on_evidence_image_name_double_clicked(); + void on_evidence_button_clicked(); - void on_evidence_delete_clicked(); - void on_evidence_x_clicked(); - void on_evidence_ok_clicked(); - void on_evidence_switch_clicked(); - void on_evidence_transfer_clicked(); + void on_evidence_delete_clicked(); + void on_evidence_x_clicked(); + void on_evidence_ok_clicked(); + void on_evidence_switch_clicked(); + void on_evidence_transfer_clicked(); - void on_evidence_edited(); + void on_evidence_edited(); - void evidence_close(); - void evidence_switch(bool global); - void on_evidence_save_clicked(); - void on_evidence_load_clicked(); - bool compare_evidence_changed(evi_type evi_a, evi_type evi_b); + void evidence_close(); + void evidence_switch(bool global); + void on_evidence_save_clicked(); + void on_evidence_load_clicked(); + bool compare_evidence_changed(evi_type evi_a, evi_type evi_b); - void on_back_to_lobby_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_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 on_spectator_clicked(); - void on_switch_area_music_clicked(); + void on_switch_area_music_clicked(); - void on_casing_clicked(); + void on_casing_clicked(); - void ping_server(); + void ping_server(); - void load_bass_opus_plugin(); + void load_bass_opus_plugin(); }; #endif // COURTROOM_H diff --git a/include/datatypes.h b/include/datatypes.h index 715bb3e0..21ade040 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -4,107 +4,103 @@ #include struct server_type { - QString name; - QString desc; - QString ip; - int port; + QString name; + QString desc; + QString ip; + int port; }; struct emote_type { - QString comment; - QString preanim; - QString anim; - int mod; - QString sfx_name; - int sfx_delay; - int sfx_duration; + QString comment; + QString preanim; + QString anim; + int mod; + QString sfx_name; + int sfx_delay; + int sfx_duration; }; struct char_type { - QString name; - QString description; - QString evidence_string; - bool taken; + QString name; + QString description; + QString evidence_string; + bool taken; }; struct evi_type { - QString name; - QString description; - QString image; + QString name; + QString description; + QString image; }; struct chatmessage_type { - QString message; - QString character; - QString side; - QString sfx_name; - QString pre_emote; - QString emote; - int emote_modifier; - int objection_modifier; - int realization; - int text_color; - int evidence; - int cid; - int sfx_delay; - int flip; + QString message; + QString character; + QString side; + QString sfx_name; + QString pre_emote; + QString emote; + int emote_modifier; + int objection_modifier; + int realization; + int text_color; + int evidence; + int cid; + int sfx_delay; + int flip; }; struct area_type { - QString name; - QString background; - bool passworded; + QString name; + QString background; + bool passworded; }; struct pos_type { - int x; - int y; + int x; + int y; }; struct pos_size_type { - int x = 0; - int y = 0; - int width = 0; - int height = 0; + int x = 0; + int y = 0; + int width = 0; + int height = 0; }; enum CHAT_MESSAGE { - DESK_MOD = 0, - PRE_EMOTE, - CHAR_NAME, - EMOTE, - MESSAGE, - SIDE, - SFX_NAME, - EMOTE_MOD, - CHAR_ID, - SFX_DELAY, - OBJECTION_MOD, - EVIDENCE_ID, - FLIP, - REALIZATION, - TEXT_COLOR, - SHOWNAME, - OTHER_CHARID, - OTHER_NAME, - OTHER_EMOTE, - SELF_OFFSET, - OTHER_OFFSET, - OTHER_FLIP, - NONINTERRUPTING_PRE, - LOOPING_SFX, - SCREENSHAKE, - FRAME_SCREENSHAKE, - FRAME_REALIZATION, - FRAME_SFX, - ADDITIVE, - EFFECTS + DESK_MOD = 0, + PRE_EMOTE, + CHAR_NAME, + EMOTE, + MESSAGE, + SIDE, + SFX_NAME, + EMOTE_MOD, + CHAR_ID, + SFX_DELAY, + OBJECTION_MOD, + EVIDENCE_ID, + FLIP, + REALIZATION, + TEXT_COLOR, + SHOWNAME, + OTHER_CHARID, + OTHER_NAME, + OTHER_EMOTE, + SELF_OFFSET, + OTHER_OFFSET, + OTHER_FLIP, + NONINTERRUPTING_PRE, + LOOPING_SFX, + SCREENSHAKE, + FRAME_SCREENSHAKE, + FRAME_REALIZATION, + FRAME_SFX, + ADDITIVE, + EFFECTS }; -enum MUSIC_EFFECT { - FADE_IN = 1, - FADE_OUT = 2, - SYNC_POS = 4 -}; +enum MUSIC_EFFECT { FADE_IN = 1, FADE_OUT = 2, SYNC_POS = 4 }; #endif // DATATYPES_H diff --git a/include/discord-rpc.h b/include/discord-rpc.h index 24885430..455f62aa 100644 --- a/include/discord-rpc.h +++ b/include/discord-rpc.h @@ -24,37 +24,37 @@ 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 @@ -70,7 +70,8 @@ DISCORD_EXPORT void Discord_Shutdown(void); /* checks for incoming messages, dispatches callbacks */ DISCORD_EXPORT void Discord_RunCallbacks(void); -/* If you disable the lib starting its own io thread, you'll need to call this from your own */ +/* If you disable the lib starting its own io thread, you'll need to call this + * from your own */ #ifdef DISCORD_DISABLE_IO_THREAD DISCORD_EXPORT void Discord_UpdateConnection(void); #endif @@ -78,7 +79,8 @@ DISCORD_EXPORT void Discord_UpdateConnection(void); DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence); DISCORD_EXPORT void Discord_ClearPresence(void); -DISCORD_EXPORT void Discord_Respond(const char *userid, /* DISCORD_REPLY_ */ int reply); +DISCORD_EXPORT void Discord_Respond(const char *userid, + /* DISCORD_REPLY_ */ int reply); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/discord_register.h b/include/discord_register.h index 71e856a5..655a3dfb 100644 --- a/include/discord_register.h +++ b/include/discord_register.h @@ -18,8 +18,10 @@ extern "C" { #endif -DISCORD_EXPORT void Discord_Register(const char *applicationId, const char *command); -DISCORD_EXPORT void Discord_RegisterSteamGame(const char *applicationId, const char *steamId); +DISCORD_EXPORT void Discord_Register(const char *applicationId, + const char *command); +DISCORD_EXPORT void Discord_RegisterSteamGame(const char *applicationId, + const char *steamId); #ifdef __cplusplus } diff --git a/include/discord_rich_presence.h b/include/discord_rich_presence.h index 1949d248..71c85e25 100644 --- a/include/discord_rich_presence.h +++ b/include/discord_rich_presence.h @@ -16,23 +16,23 @@ namespace AttorneyOnline { - class Discord { - Q_DECLARE_TR_FUNCTIONS(Discord) - - private: - const char *APPLICATION_ID = "399779271737868288"; - std::string server_name, server_id; - int64_t timestamp; - - public: - Discord(); - ~Discord(); - - void state_lobby(); - void state_server(std::string name, std::string server_id); - void state_character(std::string name); - void state_spectate(); - }; +class Discord { + Q_DECLARE_TR_FUNCTIONS(Discord) + +private: + const char *APPLICATION_ID = "399779271737868288"; + std::string server_name, server_id; + int64_t timestamp; + +public: + Discord(); + ~Discord(); + + void state_lobby(); + void state_server(std::string name, std::string server_id); + void state_character(std::string name); + void state_spectate(); +}; } // namespace AttorneyOnline #endif // DISCORD_RICH_PRESENCE_H diff --git a/include/discord_rpc.h b/include/discord_rpc.h index 737f2f66..6bd44041 100644 --- a/include/discord_rpc.h +++ b/include/discord_rpc.h @@ -24,37 +24,37 @@ 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 @@ -70,7 +70,8 @@ DISCORD_EXPORT void Discord_Shutdown(void); /* checks for incoming messages, dispatches callbacks */ DISCORD_EXPORT void Discord_RunCallbacks(void); -/* If you disable the lib starting its own io thread, you'll need to call this from your own */ +/* If you disable the lib starting its own io thread, you'll need to call this + * from your own */ #ifdef DISCORD_DISABLE_IO_THREAD DISCORD_EXPORT void Discord_UpdateConnection(void); #endif @@ -78,7 +79,8 @@ DISCORD_EXPORT void Discord_UpdateConnection(void); DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence); DISCORD_EXPORT void Discord_ClearPresence(void); -DISCORD_EXPORT void Discord_Respond(const char *userid, /* DISCORD_REPLY_ */ int reply); +DISCORD_EXPORT void Discord_Respond(const char *userid, + /* DISCORD_REPLY_ */ int reply); DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers *handlers); diff --git a/include/hex_functions.h b/include/hex_functions.h index 429bdb14..d178ba1b 100644 --- a/include/hex_functions.h +++ b/include/hex_functions.h @@ -10,7 +10,7 @@ #include namespace omni { - std::string int_to_hex(unsigned int input); +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 7b978d32..42f52977 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -21,87 +21,87 @@ class AOApplication; class Lobby : public QMainWindow { - Q_OBJECT + Q_OBJECT public: - Lobby(AOApplication *p_ao_app); - - void set_widgets(); - void list_servers(); - void list_favorites(); - void append_chatmessage(QString f_name, QString f_message); - void append_error(QString f_message); - void set_player_count(int players_online, int max_players); - void set_stylesheet(QWidget *widget, QString target_tag); - void set_stylesheets(); - void set_fonts(); - void set_font(QWidget *widget, QString p_identifier); - void set_loading_text(QString p_text); - void show_loading_overlay() { ui_loading_background->show(); } - void hide_loading_overlay() { ui_loading_background->hide(); } - QString get_chatlog(); - int get_selected_server(); - void enable_connect_button(); - - void set_loading_value(int p_value); - - bool public_servers_selected = true; - - ~Lobby(); + Lobby(AOApplication *p_ao_app); + + void set_widgets(); + void list_servers(); + void list_favorites(); + void append_chatmessage(QString f_name, QString f_message); + void append_error(QString f_message); + void set_player_count(int players_online, int max_players); + void set_stylesheet(QWidget *widget, QString target_tag); + void set_stylesheets(); + void set_fonts(); + void set_font(QWidget *widget, QString p_identifier); + void set_loading_text(QString p_text); + void show_loading_overlay() { ui_loading_background->show(); } + void hide_loading_overlay() { ui_loading_background->hide(); } + QString get_chatlog(); + int get_selected_server(); + void enable_connect_button(); + + void set_loading_value(int p_value); + + bool public_servers_selected = true; + + ~Lobby(); private: - AOApplication *ao_app; + AOApplication *ao_app; - AOImage *ui_background; + AOImage *ui_background; - AOButton *ui_public_servers; - AOButton *ui_favorites; + AOButton *ui_public_servers; + AOButton *ui_favorites; - AOButton *ui_refresh; - AOButton *ui_add_to_fav; - AOButton *ui_connect; + AOButton *ui_refresh; + AOButton *ui_add_to_fav; + AOButton *ui_connect; - QLabel *ui_version; - AOButton *ui_about; + QLabel *ui_version; + AOButton *ui_about; - AOButton *ui_settings; + AOButton *ui_settings; - QTreeWidget *ui_server_list; - QLineEdit *ui_server_search; + QTreeWidget *ui_server_list; + QLineEdit *ui_server_search; - QLabel *ui_player_count; - AOTextArea *ui_description; + QLabel *ui_player_count; + AOTextArea *ui_description; - AOTextArea *ui_chatbox; + AOTextArea *ui_chatbox; - QLineEdit *ui_chatname; - QLineEdit *ui_chatmessage; + QLineEdit *ui_chatname; + QLineEdit *ui_chatmessage; - AOImage *ui_loading_background; - QTextEdit *ui_loading_text; - QProgressBar *ui_progress_bar; - AOButton *ui_cancel; + AOImage *ui_loading_background; + QTextEdit *ui_loading_text; + QProgressBar *ui_progress_bar; + AOButton *ui_cancel; - int last_index; + int last_index; - void set_size_and_pos(QWidget *p_widget, QString p_identifier); + void set_size_and_pos(QWidget *p_widget, QString p_identifier); private slots: - void on_public_servers_clicked(); - void on_favorites_clicked(); - - void on_refresh_pressed(); - void on_refresh_released(); - void on_add_to_fav_pressed(); - void on_add_to_fav_released(); - void on_connect_pressed(); - void on_connect_released(); - void on_about_clicked(); - void on_settings_clicked(); - void on_server_list_clicked(QTreeWidgetItem *p_item, int column); - void on_server_list_doubleclicked(QTreeWidgetItem *p_item, int column); - void on_server_search_edited(QString p_text); - void on_chatfield_return_pressed(); + void on_public_servers_clicked(); + void on_favorites_clicked(); + + void on_refresh_pressed(); + void on_refresh_released(); + void on_add_to_fav_pressed(); + void on_add_to_fav_released(); + void on_connect_pressed(); + void on_connect_released(); + void on_about_clicked(); + void on_settings_clicked(); + void on_server_list_clicked(QTreeWidgetItem *p_item, int column); + void on_server_list_doubleclicked(QTreeWidgetItem *p_item, int column); + void on_server_search_edited(QString p_text); + void on_chatfield_return_pressed(); }; #endif // LOBBY_H diff --git a/include/networkmanager.h b/include/networkmanager.h index 4d9d401d..ed57a956 100644 --- a/include/networkmanager.h +++ b/include/networkmanager.h @@ -1,8 +1,8 @@ #ifndef NETWORKMANAGER_H #define NETWORKMANAGER_H -// Qt for Android has stubbed QDnsLookup. This is not documented in any part of their wiki. -// This prevents SRV lookup/failover behavior from functioning. +// Qt for Android has stubbed QDnsLookup. This is not documented in any part of +// their wiki. This prevents SRV lookup/failover behavior from functioning. // https://bugreports.qt.io/browse/QTBUG-56143 #ifndef ANDROID #define MS_FAILOVER_SUPPORTED @@ -24,60 +24,60 @@ #include class NetworkManager : public QObject { - Q_OBJECT + Q_OBJECT public: - NetworkManager(AOApplication *parent); - ~NetworkManager(); + NetworkManager(AOApplication *parent); + ~NetworkManager(); - AOApplication *ao_app; - QTcpSocket *ms_socket; - QTcpSocket *server_socket; - QDnsLookup *ms_dns; - QTimer *ms_reconnect_timer; + AOApplication *ao_app; + QTcpSocket *ms_socket; + QTcpSocket *server_socket; + QDnsLookup *ms_dns; + QTimer *ms_reconnect_timer; - const QString ms_srv_hostname = "_aoms._tcp.aceattorneyonline.com"; + const QString ms_srv_hostname = "_aoms._tcp.aceattorneyonline.com"; #ifdef LOCAL_MS - QString ms_nosrv_hostname = "localhost"; + QString ms_nosrv_hostname = "localhost"; #else - QString ms_nosrv_hostname = "master.aceattorneyonline.com"; + QString ms_nosrv_hostname = "master.aceattorneyonline.com"; #endif - const quint16 ms_port = 27016; - const int timeout_milliseconds = 2000; + const quint16 ms_port = 27016; + const int timeout_milliseconds = 2000; - // in seconds - const int ms_reconnect_delay = 7; + // in seconds + const int ms_reconnect_delay = 7; - bool ms_partial_packet = false; - QString ms_temp_packet = ""; + bool ms_partial_packet = false; + QString ms_temp_packet = ""; - bool partial_packet = false; - QString temp_packet = ""; + bool partial_packet = false; + QString temp_packet = ""; - unsigned int s_decryptor = 5; + unsigned int s_decryptor = 5; - void connect_to_master(); - void connect_to_master_nosrv(); - void connect_to_server(server_type p_server); + void connect_to_master(); + void connect_to_master_nosrv(); + void connect_to_server(server_type p_server); public slots: - void ship_ms_packet(QString p_packet); - void ship_server_packet(QString p_packet); + void ship_ms_packet(QString p_packet); + void ship_server_packet(QString p_packet); signals: - void ms_connect_finished(bool success, bool will_retry); + void ms_connect_finished(bool success, bool will_retry); private: - void perform_srv_lookup(); + void perform_srv_lookup(); private slots: - void on_srv_lookup(); - void handle_ms_packet(); - void handle_server_packet(); - void on_ms_nosrv_connect_success(); - void on_ms_socket_error(QAbstractSocket::SocketError error); - void retry_ms_connect(); + void on_srv_lookup(); + void handle_ms_packet(); + void handle_server_packet(); + void on_ms_nosrv_connect_success(); + void on_ms_socket_error(QAbstractSocket::SocketError error); + void retry_ms_connect(); }; #endif // NETWORKMANAGER_H diff --git a/include/scrolltext.h b/include/scrolltext.h index 1455762f..9ed5ff77 100644 --- a/include/scrolltext.h +++ b/include/scrolltext.h @@ -8,40 +8,40 @@ #include class ScrollText : public QWidget { - Q_OBJECT - Q_PROPERTY(QString text READ text WRITE setText) - Q_PROPERTY(QString separator READ separator WRITE setSeparator) + Q_OBJECT + Q_PROPERTY(QString text READ text WRITE setText) + Q_PROPERTY(QString separator READ separator WRITE setSeparator) public: - explicit ScrollText(QWidget *parent = nullptr); + explicit ScrollText(QWidget *parent = nullptr); public slots: - QString text() const; - void setText(QString text); + QString text() const; + void setText(QString text); - QString separator() const; - void setSeparator(QString separator); + QString separator() const; + void setSeparator(QString separator); protected: - virtual void paintEvent(QPaintEvent *); - virtual void resizeEvent(QResizeEvent *); + virtual void paintEvent(QPaintEvent *); + virtual void resizeEvent(QResizeEvent *); private: - void updateText(); - QString _text; - QString _separator; - QStaticText staticText; - int singleTextWidth; - QSize wholeTextSize; - int leftMargin; - bool scrollEnabled; - int scrollPos; - QImage alphaChannel; - QImage buffer; - QTimer timer; + void updateText(); + QString _text; + QString _separator; + QStaticText staticText; + int singleTextWidth; + QSize wholeTextSize; + int leftMargin; + bool scrollEnabled; + int scrollPos; + QImage alphaChannel; + QImage buffer; + QTimer timer; private slots: - virtual void timer_timeout(); + virtual void timer_timeout(); }; #endif // SCROLLTEXT_H diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 4d2bb31d..e1e9e7fe 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -10,167 +10,170 @@ 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); + // Create the QSettings class that points to the config.ini. + configini = + new QSettings(get_base_path() + "config.ini", QSettings::IniFormat); - net_manager = new NetworkManager(this); - discord = new AttorneyOnline::Discord(); - QObject::connect(net_manager, SIGNAL(ms_connect_finished(bool, bool)), - SLOT(ms_connect_finished(bool, bool))); + net_manager = new NetworkManager(this); + discord = new AttorneyOnline::Discord(); + QObject::connect(net_manager, SIGNAL(ms_connect_finished(bool, bool)), + SLOT(ms_connect_finished(bool, bool))); } AOApplication::~AOApplication() { - destruct_lobby(); - destruct_courtroom(); - delete discord; + destruct_lobby(); + destruct_courtroom(); + delete discord; } void AOApplication::construct_lobby() { - if (lobby_constructed) { - qDebug() << "W: lobby was attempted constructed when it already exists"; - return; - } + if (lobby_constructed) { + qDebug() << "W: lobby was attempted constructed when it already exists"; + return; + } - w_lobby = new Lobby(this); - lobby_constructed = true; + w_lobby = new Lobby(this); + lobby_constructed = true; - QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width() - w_lobby->width()) / 2; - int y = (geometry.height() - w_lobby->height()) / 2; - w_lobby->move(x, y); + QRect geometry = QGuiApplication::primaryScreen()->geometry(); + 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()) - discord->state_lobby(); + if (is_discord_enabled()) + discord->state_lobby(); - w_lobby->show(); + w_lobby->show(); } void AOApplication::destruct_lobby() { - if (!lobby_constructed) { - qDebug() << "W: lobby was attempted destructed when it did not exist"; - return; - } + if (!lobby_constructed) { + qDebug() << "W: lobby was attempted destructed when it did not exist"; + return; + } - delete w_lobby; - w_lobby = nullptr; - lobby_constructed = false; + delete w_lobby; + w_lobby = nullptr; + lobby_constructed = false; } void AOApplication::construct_courtroom() { - if (courtroom_constructed) { - qDebug() << "W: courtroom was attempted constructed when it already exists"; - return; - } + if (courtroom_constructed) { + qDebug() << "W: courtroom was attempted constructed when it already exists"; + return; + } - w_courtroom = new Courtroom(this); - courtroom_constructed = true; + w_courtroom = new Courtroom(this); + courtroom_constructed = true; - QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width() - w_courtroom->width()) / 2; - int y = (geometry.height() - w_courtroom->height()) / 2; - w_courtroom->move(x, y); + QRect geometry = QGuiApplication::primaryScreen()->geometry(); + 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) { - qDebug() << "W: courtroom was attempted destructed when it did not exist"; - return; - } + if (!courtroom_constructed) { + qDebug() << "W: courtroom was attempted destructed when it did not exist"; + return; + } - delete w_courtroom; - w_courtroom = nullptr; - courtroom_constructed = false; + delete w_courtroom; + w_courtroom = nullptr; + courtroom_constructed = false; } 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() { - favorite_list = read_serverlist_txt(); + favorite_list = read_serverlist_txt(); } QString AOApplication::get_current_char() { - if (courtroom_constructed) - return w_courtroom->get_current_char(); - else - return ""; + if (courtroom_constructed) + return w_courtroom->get_current_char(); + else + return ""; } void AOApplication::add_favorite_server(int p_server) { - if (p_server < 0 || p_server >= server_list.size()) - return; + if (p_server < 0 || p_server >= server_list.size()) + return; - server_type fav_server = server_list.at(p_server); + server_type fav_server = server_list.at(p_server); - QString str_port = QString::number(fav_server.port); + QString str_port = QString::number(fav_server.port); - QString server_line = fav_server.ip + ":" + str_port + ":" + fav_server.name; + QString server_line = fav_server.ip + ":" + str_port + ":" + fav_server.name; - write_to_serverlist_txt(server_line); + write_to_serverlist_txt(server_line); } void AOApplication::server_disconnected() { - if (courtroom_constructed) { - call_notice(tr("Disconnected from server.")); - construct_lobby(); - destruct_courtroom(); - } + if (courtroom_constructed) { + call_notice(tr("Disconnected from server.")); + construct_lobby(); + destruct_courtroom(); + } } void AOApplication::loading_cancelled() { - destruct_courtroom(); + destruct_courtroom(); - w_lobby->hide_loading_overlay(); + w_lobby->hide_loading_overlay(); } void AOApplication::ms_connect_finished(bool connected, bool will_retry) { - if (connected) { - AOPacket *f_packet = new AOPacket("ALL#%"); - send_ms_packet(f_packet); + if (connected) { + AOPacket *f_packet = new AOPacket("ALL#%"); + send_ms_packet(f_packet); + } + 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))); } 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))); - } - 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.")); - } + 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.")); } + } } 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 957fd559..6affc284 100644 --- a/src/aoblipplayer.cpp +++ b/src/aoblipplayer.cpp @@ -1,117 +1,111 @@ #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; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } void AOBlipPlayer::set_blips(QString p_sfx) { - QString f_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx)); + QString f_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx)); - for (int n_stream = 0; n_stream < 5; ++n_stream) { - BASS_StreamFree(m_stream_list[n_stream]); + for (int n_stream = 0; n_stream < 5; ++n_stream) { + BASS_StreamFree(m_stream_list[n_stream]); - if (f_path.endsWith(".opus")) - m_stream_list[n_stream] = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); - else - m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); - } + if (f_path.endsWith(".opus")) + m_stream_list[n_stream] = BASS_OPUS_StreamCreateFile( + FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); + else + m_stream_list[n_stream] = BASS_StreamCreateFile( + FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); + } - set_volume_internal(m_volume); + set_volume_internal(m_volume); } void AOBlipPlayer::blip_tick() { - if (delay.isValid() && delay.elapsed() < max_blip_ms) - return; + if (delay.isValid() && delay.elapsed() < max_blip_ms) + return; - delay.start(); - int f_cycle = m_cycle++; + delay.start(); + int f_cycle = m_cycle++; - if (m_cycle == 5) - m_cycle = 0; + if (m_cycle == 5) + m_cycle = 0; - HSTREAM f_stream = m_stream_list[f_cycle]; - if (ao_app->get_audio_output_device() != "default") - BASS_ChannelSetDevice(f_stream, BASS_GetDevice()); - BASS_ChannelPlay(f_stream, false); + HSTREAM f_stream = m_stream_list[f_cycle]; + if (ao_app->get_audio_output_device() != "default") + BASS_ChannelSetDevice(f_stream, BASS_GetDevice()); + BASS_ChannelPlay(f_stream, false); } void AOBlipPlayer::set_volume(qreal p_value) { - m_volume = p_value / 100; - set_volume_internal(m_volume); + m_volume = p_value / 100; + set_volume_internal(m_volume); } void AOBlipPlayer::set_volume_internal(qreal p_value) { - float volume = static_cast(p_value); + float volume = static_cast(p_value); - for (int n_stream = 0; n_stream < 5; ++n_stream) { - BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); - } + 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; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } void AOBlipPlayer::set_blips(QString p_sfx) { - QString f_path = ao_app->get_sounds_path(p_sfx); + QString f_path = ao_app->get_sounds_path(p_sfx); - for (int n_stream = 0; n_stream < 5; ++n_stream) { - m_blips.setSource(QUrl::fromLocalFile(f_path)); - } + for (int n_stream = 0; n_stream < 5; ++n_stream) { + m_blips.setSource(QUrl::fromLocalFile(f_path)); + } - set_volume_internal(m_volume); + set_volume_internal(m_volume); } void AOBlipPlayer::blip_tick() { - int f_cycle = m_cycle++; + int f_cycle = m_cycle++; - if (m_cycle == 5) - m_cycle = 0; + if (m_cycle == 5) + m_cycle = 0; - m_blips.play(); + m_blips.play(); } void AOBlipPlayer::set_volume(qreal p_value) { - m_volume = p_value / 100; - set_volume_internal(m_volume); + m_volume = p_value / 100; + set_volume_internal(m_volume); } void AOBlipPlayer::set_volume_internal(qreal p_value) { - m_blips.setVolume(m_volume); + 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; + 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 05dedc16..dc2d8817 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -3,30 +3,36 @@ #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; + ao_app = p_ao_app; } -AOButton::~AOButton() -{ -} +AOButton::~AOButton() {} void AOButton::set_image(QString p_image) { - QString image_path = ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); - QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); + QString image_path = + ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); + QString default_image_path = + ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); - if (file_exists(image_path)) { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } - else if (file_exists(default_image_path)) { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + default_image_path + "\"); }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } - else - return; + if (file_exists(image_path)) { + this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { background-image: url(); color: #000000; " + "background-color: #ffffff; border: 0px; }"); + } + else if (file_exists(default_image_path)) { + this->setText(""); + this->setStyleSheet("QPushButton { border-image: url(\"" + + default_image_path + + "\"); }" + "QToolTip { background-image: url(); color: #000000; " + "background-color: #ffffff; border: 0px; }"); + } + else + return; } diff --git a/src/aocaseannouncerdialog.cpp b/src/aocaseannouncerdialog.cpp index 3063aa8a..d91433a6 100644 --- a/src/aocaseannouncerdialog.cpp +++ b/src/aocaseannouncerdialog.cpp @@ -1,82 +1,85 @@ #include "aocaseannouncerdialog.h" -AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_ao_app, Courtroom *p_court) +AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, + AOApplication *p_ao_app, + Courtroom *p_court) : QDialog(parent) { - ao_app = p_ao_app; - court = p_court; - - setWindowTitle(tr("Case Announcer")); - resize(405, 235); - - ui_announcer_buttons = new QDialogButtonBox(this); - - QSizePolicy sizepolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - sizepolicy.setHorizontalStretch(0); - sizepolicy.setVerticalStretch(0); - 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); - - 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->setContentsMargins(6, 6, 6, 6); - - ui_vbox_layout->addItem(ui_form_layout); - ui_vbox_layout->addWidget(ui_announcer_buttons); - - ui_case_title_label = new QLabel(this); - ui_case_title_label->setText(tr("Case title:")); - - ui_form_layout->setWidget(0, QFormLayout::LabelRole, ui_case_title_label); - - ui_case_title_textbox = new QLineEdit(this); - ui_case_title_textbox->setMaxLength(50); - - ui_form_layout->setWidget(0, QFormLayout::FieldRole, ui_case_title_textbox); - - ui_defense_needed = new QCheckBox(this); - ui_defense_needed->setText(tr("Defense needed")); - ui_prosecutor_needed = new QCheckBox(this); - ui_prosecutor_needed->setText(tr("Prosecution needed")); - ui_judge_needed = new QCheckBox(this); - ui_judge_needed->setText(tr("Judge needed")); - ui_juror_needed = new QCheckBox(this); - ui_juror_needed->setText(tr("Jurors needed")); - ui_steno_needed = new QCheckBox(this); - ui_steno_needed->setText(tr("Stenographer needed")); - - ui_form_layout->setWidget(1, QFormLayout::FieldRole, ui_defense_needed); - ui_form_layout->setWidget(2, QFormLayout::FieldRole, ui_prosecutor_needed); - ui_form_layout->setWidget(3, QFormLayout::FieldRole, ui_judge_needed); - ui_form_layout->setWidget(4, QFormLayout::FieldRole, ui_juror_needed); - ui_form_layout->setWidget(5, QFormLayout::FieldRole, ui_steno_needed); - - setUpdatesEnabled(true); + ao_app = p_ao_app; + court = p_court; + + setWindowTitle(tr("Case Announcer")); + resize(405, 235); + + ui_announcer_buttons = new QDialogButtonBox(this); + + QSizePolicy sizepolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + sizepolicy.setHorizontalStretch(0); + sizepolicy.setVerticalStretch(0); + 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); + + 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->setContentsMargins(6, 6, 6, 6); + + ui_vbox_layout->addItem(ui_form_layout); + ui_vbox_layout->addWidget(ui_announcer_buttons); + + ui_case_title_label = new QLabel(this); + ui_case_title_label->setText(tr("Case title:")); + + ui_form_layout->setWidget(0, QFormLayout::LabelRole, ui_case_title_label); + + ui_case_title_textbox = new QLineEdit(this); + ui_case_title_textbox->setMaxLength(50); + + ui_form_layout->setWidget(0, QFormLayout::FieldRole, ui_case_title_textbox); + + ui_defense_needed = new QCheckBox(this); + ui_defense_needed->setText(tr("Defense needed")); + ui_prosecutor_needed = new QCheckBox(this); + ui_prosecutor_needed->setText(tr("Prosecution needed")); + ui_judge_needed = new QCheckBox(this); + ui_judge_needed->setText(tr("Judge needed")); + ui_juror_needed = new QCheckBox(this); + ui_juror_needed->setText(tr("Jurors needed")); + ui_steno_needed = new QCheckBox(this); + ui_steno_needed->setText(tr("Stenographer needed")); + + ui_form_layout->setWidget(1, QFormLayout::FieldRole, ui_defense_needed); + ui_form_layout->setWidget(2, QFormLayout::FieldRole, ui_prosecutor_needed); + ui_form_layout->setWidget(3, QFormLayout::FieldRole, ui_judge_needed); + ui_form_layout->setWidget(4, QFormLayout::FieldRole, ui_juror_needed); + ui_form_layout->setWidget(5, QFormLayout::FieldRole, ui_steno_needed); + + setUpdatesEnabled(true); } 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()); - - done(0); -} + 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()); -void AOCaseAnnouncerDialog::cancel_pressed() -{ - done(0); + done(0); } + +void AOCaseAnnouncerDialog::cancel_pressed() { done(0); } diff --git a/src/aocharbutton.cpp b/src/aocharbutton.cpp index d8c337d9..844c9599 100644 --- a/src/aocharbutton.cpp +++ b/src/aocharbutton.cpp @@ -2,94 +2,94 @@ #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; + m_parent = parent; - ao_app = p_ao_app; + ao_app = p_ao_app; - taken = is_taken; + taken = is_taken; - this->resize(60, 60); - this->move(x_pos, y_pos); + this->resize(60, 60); + this->move(x_pos, y_pos); - ui_taken = new AOImage(this, ao_app); - ui_taken->resize(60, 60); - ui_taken->set_image("char_taken"); - ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_taken->hide(); + ui_taken = new AOImage(this, ao_app); + ui_taken->resize(60, 60); + ui_taken->set_image("char_taken"); + ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_taken->hide(); + + ui_passworded = new AOImage(this, ao_app); + ui_passworded->resize(60, 60); + ui_passworded->set_image("char_passworded"); + ui_passworded->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_passworded->hide(); - ui_passworded = new AOImage(this, ao_app); - ui_passworded->resize(60, 60); - ui_passworded->set_image("char_passworded"); - ui_passworded->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_passworded->hide(); - - ui_selector = new AOImage(parent, ao_app); - ui_selector->resize(62, 62); - ui_selector->move(x_pos - 1, y_pos - 1); - ui_selector->set_image("char_selector"); - ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_selector->hide(); + ui_selector = new AOImage(parent, ao_app); + ui_selector->resize(62, 62); + ui_selector->move(x_pos - 1, y_pos - 1); + ui_selector->set_image("char_selector"); + ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_selector->hide(); } void AOCharButton::reset() { - ui_taken->hide(); - ui_passworded->hide(); - ui_selector->hide(); + ui_taken->hide(); + ui_passworded->hide(); + 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); - ui_taken->show(); - } - else { - ui_taken->hide(); - } + if (taken) { + ui_taken->move(0, 0); + ui_taken->show(); + } + 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_static_image_suffix(ao_app->get_character_path(p_character, "char_icon")); - - this->setText(""); - - if (file_exists(image_path)) { - this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } - else { - this->setStyleSheet("QPushButton { border-image: url(); }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - this->setText(p_character); - } + QString image_path = ao_app->get_static_image_suffix( + ao_app->get_character_path(p_character, "char_icon")); + + this->setText(""); + + if (file_exists(image_path)) { + this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { background-image: url(); color: #000000; " + "background-color: #ffffff; border: 0px; }"); + } + else { + this->setStyleSheet("QPushButton { border-image: url(); }" + "QToolTip { background-image: url(); color: #000000; " + "background-color: #ffffff; border: 0px; }"); + this->setText(p_character); + } } void AOCharButton::enterEvent(QEvent *e) { - ui_selector->move(this->x() - 1, this->y() - 1); - ui_selector->raise(); - ui_selector->show(); + ui_selector->move(this->x() - 1, this->y() - 1); + ui_selector->raise(); + ui_selector->show(); - setFlat(false); - QPushButton::enterEvent(e); + setFlat(false); + QPushButton::enterEvent(e); } void AOCharButton::leaveEvent(QEvent *e) { - ui_selector->hide(); - QPushButton::leaveEvent(e); + ui_selector->hide(); + QPushButton::leaveEvent(e); } diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 29632757..252aab5d 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -4,292 +4,320 @@ #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; - preanim_timer = new QTimer(this); - preanim_timer->setSingleShot(true); - - ticker = new QTimer(this); - ticker->setTimerType(Qt::PreciseTimer); - ticker->setSingleShot(false); - connect(ticker, SIGNAL(timeout()), this, SLOT(movie_ticker())); - - // connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); - connect(preanim_timer, SIGNAL(timeout()), this, SLOT(preanim_done())); + ao_app = p_ao_app; + preanim_timer = new QTimer(this); + preanim_timer->setSingleShot(true); + + ticker = new QTimer(this); + ticker->setTimerType(Qt::PreciseTimer); + ticker->setSingleShot(false); + connect(ticker, SIGNAL(timeout()), this, SLOT(movie_ticker())); + + // connect(m_movie, SIGNAL(frameChanged(int)), this, + // SLOT(frame_change(int))); + connect(preanim_timer, SIGNAL(timeout()), this, SLOT(preanim_done())); } -void AOCharMovie::load_image(QString p_char, QString p_emote, QString emote_prefix) +void AOCharMovie::load_image(QString p_char, QString p_emote, + QString emote_prefix) { #ifdef DEBUG_CHARMOVIE - actual_time.restart(); + actual_time.restart(); #endif - QString emote_path; - QList pathlist; - pathlist = { - ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + p_emote)), //Default path - ao_app->get_image_suffix(ao_app->get_character_path(p_char, emote_prefix + "/" + p_emote)), //Path check if it's categorized into a folder - ao_app->get_character_path(p_char, p_emote + ".png"), //Non-animated path if emote_prefix fails - ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Theme placeholder path - ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")), //Default theme placeholder path - }; - - for (QString path : pathlist) { - if (file_exists(path)) { - emote_path = path; - break; - } + QString emote_path; + QList pathlist; + pathlist = { + ao_app->get_image_suffix(ao_app->get_character_path( + p_char, emote_prefix + p_emote)), // Default path + ao_app->get_image_suffix(ao_app->get_character_path( + p_char, emote_prefix + "/" + + p_emote)), // Path check if it's categorized into a folder + ao_app->get_character_path( + p_char, p_emote + ".png"), // Non-animated path if emote_prefix fails + ao_app->get_image_suffix( + ao_app->get_theme_path("placeholder")), // Theme placeholder path + ao_app->get_image_suffix(ao_app->get_default_theme_path( + "placeholder")), // Default theme placeholder path + }; + + for (QString path : pathlist) { + if (file_exists(path)) { + emote_path = path; + break; } - - this->clear(); - ticker->stop(); - preanim_timer->stop(); - movie_frames.clear(); - movie_delays.clear(); - movie_effects.clear(); - - if (!file_exists(emote_path)) - return; - - m_reader->setFileName(emote_path); - QPixmap f_pixmap = this->get_pixmap(m_reader->read()); - int f_delay = m_reader->nextImageDelay(); - - frame = 0; - max_frames = m_reader->imageCount(); - - this->set_frame(f_pixmap); - this->show(); - if (max_frames > 1) { - movie_frames.append(f_pixmap); - movie_delays.append(f_delay); - } - - m_char = p_char; - m_emote = emote_prefix + p_emote; - - if (network_strings.size() > 0) //our FX overwritten by networked ones - this->load_network_effects(); - else //Use default ini FX - this->load_effects(); + } + + this->clear(); + ticker->stop(); + preanim_timer->stop(); + movie_frames.clear(); + movie_delays.clear(); + movie_effects.clear(); + + if (!file_exists(emote_path)) + return; + + m_reader->setFileName(emote_path); + QPixmap f_pixmap = this->get_pixmap(m_reader->read()); + int f_delay = m_reader->nextImageDelay(); + + frame = 0; + max_frames = m_reader->imageCount(); + + this->set_frame(f_pixmap); + this->show(); + if (max_frames > 1) { + movie_frames.append(f_pixmap); + movie_delays.append(f_delay); + } + + m_char = p_char; + m_emote = emote_prefix + p_emote; + + if (network_strings.size() > 0) // our FX overwritten by networked ones + this->load_network_effects(); + else // Use default ini FX + this->load_effects(); #ifdef DEBUG_CHARMOVIE - qDebug() << max_frames << "Setting image to " << emote_path << "Time taken to process image:" << actual_time.elapsed(); + qDebug() << max_frames << "Setting image to " << emote_path + << "Time taken to process image:" << actual_time.elapsed(); - actual_time.restart(); + actual_time.restart(); #endif } void AOCharMovie::load_effects() { - movie_effects.clear(); - movie_effects.resize(max_frames); - for (int e_frame = 0; e_frame < max_frames; ++e_frame) { - QString effect = ao_app->get_screenshake_frame(m_char, m_emote, e_frame); - if (effect != "") { - movie_effects[e_frame].append("shake"); - } + movie_effects.clear(); + movie_effects.resize(max_frames); + for (int e_frame = 0; e_frame < max_frames; ++e_frame) { + QString effect = ao_app->get_screenshake_frame(m_char, m_emote, e_frame); + if (effect != "") { + movie_effects[e_frame].append("shake"); + } - effect = ao_app->get_flash_frame(m_char, m_emote, e_frame); - if (effect != "") { - movie_effects[e_frame].append("flash"); - } + effect = ao_app->get_flash_frame(m_char, m_emote, e_frame); + if (effect != "") { + movie_effects[e_frame].append("flash"); + } - effect = ao_app->get_sfx_frame(m_char, m_emote, e_frame); - if (effect != "") { - movie_effects[e_frame].append("sfx^" + effect); - } + effect = ao_app->get_sfx_frame(m_char, m_emote, e_frame); + if (effect != "") { + movie_effects[e_frame].append("sfx^" + effect); } + } } void AOCharMovie::load_network_effects() { - movie_effects.clear(); - movie_effects.resize(max_frames); - //Order is important!!! - QStringList effects_list = {"shake", "flash", "sfx^"}; - - //Determines which list is smaller - effects_list or network_strings - and uses it as basis for the loop. - //This way, incomplete network_strings would still be parsed, and excess/unaccounted for networked information is omitted. - int effects_size = qMin(effects_list.size(), network_strings.size()); - - for (int i = 0; i < effects_size; ++i) { - QString netstring = network_strings.at(i); - QStringList emote_splits = netstring.split("^"); - foreach (QString emote, emote_splits) { - QStringList parsed = emote.split("|"); - if (parsed.size() <= 0 || parsed.at(0) != m_emote) - continue; - foreach (QString frame_data, parsed) { - QStringList frame_split = frame_data.split("="); - if (frame_split.size() <= 1) //We might still be hanging at the emote itself (entry 0). - continue; - int f_frame = frame_split.at(0).toInt(); - if (f_frame >= max_frames) { - qDebug() << "Warning: out of bounds" << effects_list[i] << "frame" << f_frame << "out of" << max_frames << "for" << m_char << m_emote; - continue; - } - QString f_data = frame_split.at(1); - if (f_data != "") { - QString effect = effects_list[i]; - if (effect == "sfx^") //Currently the only frame result that feeds us data, let's yank it in. - effect += f_data; - qDebug() << effect << f_data << "frame" << f_frame << "for" << m_char << m_emote; - movie_effects[f_frame].append(effect); - } - } + movie_effects.clear(); + movie_effects.resize(max_frames); + // Order is important!!! + QStringList effects_list = {"shake", "flash", "sfx^"}; + + // Determines which list is smaller - effects_list or network_strings - and + // uses it as basis for the loop. This way, incomplete network_strings would + // still be parsed, and excess/unaccounted for networked information is + // omitted. + int effects_size = qMin(effects_list.size(), network_strings.size()); + + for (int i = 0; i < effects_size; ++i) { + QString netstring = network_strings.at(i); + QStringList emote_splits = netstring.split("^"); + foreach (QString emote, emote_splits) { + QStringList parsed = emote.split("|"); + if (parsed.size() <= 0 || parsed.at(0) != m_emote) + continue; + foreach (QString frame_data, parsed) { + QStringList frame_split = frame_data.split("="); + if (frame_split.size() <= + 1) // We might still be hanging at the emote itself (entry 0). + continue; + int f_frame = frame_split.at(0).toInt(); + if (f_frame >= max_frames) { + qDebug() << "Warning: out of bounds" << effects_list[i] << "frame" + << f_frame << "out of" << max_frames << "for" << m_char + << m_emote; + continue; + } + QString f_data = frame_split.at(1); + if (f_data != "") { + QString effect = effects_list[i]; + if (effect == "sfx^") // Currently the only frame result that feeds us + // data, let's yank it in. + effect += f_data; + qDebug() << effect << f_data << "frame" << f_frame << "for" << m_char + << m_emote; + movie_effects[f_frame].append(effect); } + } } + } } void AOCharMovie::play() { - play_frame_effect(frame); - if (max_frames <= 1) { - if (play_once) - ticker->start(60); - } - else - ticker->start(this->get_frame_delay(movie_delays[frame])); + play_frame_effect(frame); + if (max_frames <= 1) { + if (play_once) + ticker->start(60); + } + else + ticker->start(this->get_frame_delay(movie_delays[frame])); } void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) { - load_image(p_char, p_emote, ""); - //As much as I'd like to screw around with [Time] durations modifying the animation speed, I don't think I can reliably do that, - //not without looping through all frames in the image at least - which causes lag. So for now it simply ends the preanimation early instead. - play_once = true; - if (duration > 0) //It's -1 if there's no definition in [Time] for it. In which case, it will let the animation run out in full. Duration 0 does the same. - preanim_timer->start(duration * time_mod); //This timer will not fire if the animation finishes earlier than that - play(); + load_image(p_char, p_emote, ""); + // As much as I'd like to screw around with [Time] durations modifying the + // animation speed, I don't think I can reliably do that, not without looping + // through all frames in the image at least - which causes lag. So for now it + // simply ends the preanimation early instead. + play_once = true; + if (duration > + 0) // It's -1 if there's no definition in [Time] for it. In which case, it + // will let the animation run out in full. Duration 0 does the same. + preanim_timer->start(duration * + time_mod); // This timer will not fire if the animation + // finishes earlier than that + play(); } void AOCharMovie::play_talking(QString p_char, QString p_emote) { - play_once = false; - load_image(p_char, p_emote, "(b)"); - play(); + play_once = false; + load_image(p_char, p_emote, "(b)"); + play(); } void AOCharMovie::play_idle(QString p_char, QString p_emote) { - play_once = false; - load_image(p_char, p_emote, "(a)"); - play(); + play_once = false; + load_image(p_char, p_emote, "(a)"); + play(); } void AOCharMovie::play_frame_effect(int frame) { - if (frame < max_frames) { - foreach (QString effect, movie_effects[frame]) { - if (effect == "shake") { - shake(); + if (frame < max_frames) { + foreach (QString effect, movie_effects[frame]) { + if (effect == "shake") { + shake(); #ifdef DEBUG_CHARMOVIE - qDebug() << "Attempting to play shake on frame" << frame; + qDebug() << "Attempting to play shake on frame" << frame; #endif - } + } - if (effect == "flash") { - flash(); + if (effect == "flash") { + flash(); #ifdef DEBUG_CHARMOVIE - qDebug() << "Attempting to play flash on frame" << frame; + qDebug() << "Attempting to play flash on frame" << frame; #endif - } + } - if (effect.startsWith("sfx^")) { - QString sfx = effect.section("^", 1); - play_sfx(sfx); + if (effect.startsWith("sfx^")) { + QString sfx = effect.section("^", 1); + play_sfx(sfx); #ifdef DEBUG_CHARMOVIE - qDebug() << "Attempting to play sfx" << sfx << "on frame" << frame; + qDebug() << "Attempting to play sfx" << sfx << "on frame" << frame; #endif - } - } + } } + } } 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 - ticker->stop(); - preanim_timer->stop(); - this->hide(); + // for all intents and purposes, stopping is the same as hiding. at no point + // do we want a frozen gif to display + ticker->stop(); + preanim_timer->stop(); + this->hide(); } QPixmap AOCharMovie::get_pixmap(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; - auto transform_mode = Qt::FastTransformation; - if (f_pixmap.height() > f_h) //We are downscaling, use anti-aliasing. - transform_mode = Qt::SmoothTransformation; - - f_pixmap = f_pixmap.scaledToHeight(f_h, transform_mode); - this->resize(f_pixmap.size()); - - return f_pixmap; + 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; + auto transform_mode = Qt::FastTransformation; + if (f_pixmap.height() > f_h) // We are downscaling, use anti-aliasing. + transform_mode = Qt::SmoothTransformation; + + f_pixmap = f_pixmap.scaledToHeight(f_h, transform_mode); + this->resize(f_pixmap.size()); + + return f_pixmap; } void AOCharMovie::set_frame(QPixmap f_pixmap) { - this->setPixmap(f_pixmap); - QLabel::move(x + (f_w - f_pixmap.width()) / 2, y + (f_h - f_pixmap.height())); //Always center horizontally, always put at the bottom vertically + this->setPixmap(f_pixmap); + QLabel::move( + x + (f_w - f_pixmap.width()) / 2, + y + (f_h - f_pixmap.height())); // Always center horizontally, always put + // at the bottom vertically } void AOCharMovie::combo_resize(int w, int h) { - QSize f_size(w, h); - f_w = w; - f_h = h; - this->resize(f_size); + QSize f_size(w, h); + f_w = w; + f_h = h; + this->resize(f_size); } int AOCharMovie::get_frame_delay(int delay) { - return static_cast(double(delay) * double(speed / 100)); + return static_cast(double(delay) * double(speed / 100)); } void AOCharMovie::move(int ax, int ay) { - x = ax; - y = ay; - QLabel::move(x, y); + x = ax; + y = ay; + QLabel::move(x, y); } void AOCharMovie::movie_ticker() { - ++frame; - if (frame >= max_frames) { - if (play_once) { - preanim_done(); - return; - } - else - frame = 0; - } - // qint64 difference = elapsed - movie_delays[frame]; - if (frame >= movie_frames.size()) { - m_reader->jumpToImage(frame); - movie_frames.resize(frame + 1); - movie_frames[frame] = this->get_pixmap(m_reader->read()); - movie_delays.resize(frame + 1); - movie_delays[frame] = m_reader->nextImageDelay(); + ++frame; + if (frame >= max_frames) { + if (play_once) { + preanim_done(); + return; } + else + frame = 0; + } + // qint64 difference = elapsed - movie_delays[frame]; + if (frame >= movie_frames.size()) { + m_reader->jumpToImage(frame); + movie_frames.resize(frame + 1); + movie_frames[frame] = this->get_pixmap(m_reader->read()); + movie_delays.resize(frame + 1); + movie_delays[frame] = m_reader->nextImageDelay(); + } #ifdef DEBUG_CHARMOVIE - qDebug() << frame << movie_delays[frame] << "actual time taken from last frame:" << actual_time.restart(); + qDebug() << frame << movie_delays[frame] + << "actual time taken from last frame:" << actual_time.restart(); #endif - this->set_frame(movie_frames[frame]); - play_frame_effect(frame); - ticker->setInterval(this->get_frame_delay(movie_delays[frame])); + this->set_frame(movie_frames[frame]); + play_frame_effect(frame); + ticker->setInterval(this->get_frame_delay(movie_delays[frame])); } void AOCharMovie::preanim_done() { - ticker->stop(); - preanim_timer->stop(); - done(); + ticker->stop(); + preanim_timer->stop(); + done(); } diff --git a/src/aoemotebutton.cpp b/src/aoemotebutton.cpp index 991451f8..abec526b 100644 --- a/src/aoemotebutton.cpp +++ b/src/aoemotebutton.cpp @@ -2,40 +2,44 @@ #include "file_functions.h" -AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, int p_w, int p_h) : QPushButton(p_parent) +AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, + int p_x, int p_y, int p_w, int p_h) + : QPushButton(p_parent) { - parent = p_parent; - ao_app = p_ao_app; + parent = p_parent; + ao_app = p_ao_app; - this->move(p_x, p_y); - this->resize(p_w, p_h); + this->move(p_x, p_y); + this->resize(p_w, p_h); - connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); + connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); } void AOEmoteButton::set_image(QString p_image, QString p_emote_comment) { - if (file_exists(p_image)) { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + p_image + "\") 0 0 0 0 stretch stretch; }" - "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); - } - else { - this->setText(p_emote_comment); - this->setStyleSheet("QPushButton { border-image: url(); }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } + if (file_exists(p_image)) { + this->setText(""); + this->setStyleSheet( + "QPushButton { border-image: url(\"" + p_image + + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); + } + else { + this->setText(p_emote_comment); + this->setStyleSheet("QPushButton { border-image: url(); }" + "QToolTip { background-image: url(); color: #000000; " + "background-color: #ffffff; border: 0px; }"); + } } void AOEmoteButton::set_char_image(QString p_char, int p_emote, QString suffix) { - QString emotion_number = QString::number(p_emote + 1); - QString image_path = ao_app->get_static_image_suffix(ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix)); + QString emotion_number = QString::number(p_emote + 1); + QString image_path = + ao_app->get_static_image_suffix(ao_app->get_character_path( + p_char, "emotions/button" + emotion_number + suffix)); - this->set_image(image_path, ao_app->get_emote_comment(p_char, p_emote)); + this->set_image(image_path, ao_app->get_emote_comment(p_char, p_emote)); } -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 596374b2..f85a223f 100644 --- a/src/aoevidencebutton.cpp +++ b/src/aoevidencebutton.cpp @@ -2,84 +2,88 @@ #include "file_functions.h" -AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y, int p_w, int p_h) : QPushButton(p_parent) +AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, + int p_x, int p_y, int p_w, int p_h) + : QPushButton(p_parent) { - ao_app = p_ao_app; - m_parent = p_parent; - - ui_selected = new AOImage(this, ao_app); - ui_selected->resize(p_w, p_h); - // ui_selected->move(p_x, p_y); - ui_selected->set_image("evidence_selected"); - ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_selected->hide(); - - ui_selector = new AOImage(this, ao_app); - ui_selector->resize(p_w, p_h); - // ui_selector->move(p_x - 1, p_y - 1); - ui_selector->set_image("evidence_selector"); - ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_selector->hide(); - - this->move(p_x, p_y); - this->resize(p_w, p_h); - // this->setAcceptDrops(true); - - connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); + ao_app = p_ao_app; + m_parent = p_parent; + + ui_selected = new AOImage(this, ao_app); + ui_selected->resize(p_w, p_h); + // ui_selected->move(p_x, p_y); + ui_selected->set_image("evidence_selected"); + ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_selected->hide(); + + ui_selector = new AOImage(this, ao_app); + ui_selector->resize(p_w, p_h); + // ui_selector->move(p_x - 1, p_y - 1); + ui_selector->set_image("evidence_selector"); + ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_selector->hide(); + + this->move(p_x, p_y); + this->resize(p_w, p_h); + // this->setAcceptDrops(true); + + connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); } void AOEvidenceButton::set_image(QString p_image) { - QString image_path = ao_app->get_evidence_path(p_image); - if (file_exists(p_image)) { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + p_image + "\") 0 0 0 0 stretch stretch; }" - "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); - } - else if (file_exists(image_path)) { - this->setText(""); - this->setStyleSheet("QPushButton { border-image: url(\"" + image_path + "\") 0 0 0 0 stretch stretch; }" - "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); - } - else { - this->setText(p_image); - this->setStyleSheet("QPushButton { border-image: url(); }" - "QToolTip { background-image: url(); color: #000000; background-color: #ffffff; border: 0px; }"); - } + QString image_path = ao_app->get_evidence_path(p_image); + if (file_exists(p_image)) { + this->setText(""); + this->setStyleSheet( + "QPushButton { border-image: url(\"" + p_image + + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); + } + else if (file_exists(image_path)) { + this->setText(""); + this->setStyleSheet( + "QPushButton { border-image: url(\"" + image_path + + "\") 0 0 0 0 stretch stretch; }" + "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); + } + else { + this->setText(p_image); + this->setStyleSheet("QPushButton { border-image: url(); }" + "QToolTip { background-image: url(); color: #000000; " + "background-color: #ffffff; border: 0px; }"); + } } void AOEvidenceButton::set_theme_image(QString p_image) { - QString theme_image_path = ao_app->get_theme_path(p_image); - QString default_image_path = ao_app->get_default_theme_path(p_image); + QString theme_image_path = ao_app->get_theme_path(p_image); + QString default_image_path = ao_app->get_default_theme_path(p_image); - QString final_image_path; + QString final_image_path; - if (file_exists(theme_image_path)) - final_image_path = theme_image_path; - else - final_image_path = default_image_path; + if (file_exists(theme_image_path)) + final_image_path = theme_image_path; + else + final_image_path = default_image_path; - this->set_image(final_image_path); + this->set_image(final_image_path); } void AOEvidenceButton::set_selected(bool p_selected) { - if (p_selected) - ui_selected->show(); - else - ui_selected->hide(); + if (p_selected) + ui_selected->show(); + else + ui_selected->hide(); } -void AOEvidenceButton::on_clicked() -{ - evidence_clicked(m_id); -} +void AOEvidenceButton::on_clicked() { evidence_clicked(m_id); } void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e) { - QPushButton::mouseDoubleClickEvent(e); - evidence_double_clicked(m_id); + QPushButton::mouseDoubleClickEvent(e); + evidence_double_clicked(m_id); } /* @@ -100,18 +104,18 @@ void AOEvidenceButton::dragEnterEvent(QMouseEvent *e) void AOEvidenceButton::enterEvent(QEvent *e) { - ui_selector->show(); + ui_selector->show(); - on_hover(m_id, true); + on_hover(m_id, true); - setFlat(false); - QPushButton::enterEvent(e); + setFlat(false); + QPushButton::enterEvent(e); } void AOEvidenceButton::leaveEvent(QEvent *e) { - ui_selector->hide(); + ui_selector->hide(); - on_hover(m_id, false); - QPushButton::leaveEvent(e); + on_hover(m_id, false); + QPushButton::leaveEvent(e); } diff --git a/src/aoevidencedisplay.cpp b/src/aoevidencedisplay.cpp index 22f57205..2ffea2c9 100644 --- a/src/aoevidencedisplay.cpp +++ b/src/aoevidencedisplay.cpp @@ -4,71 +4,68 @@ #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; - evidence_icon = new QLabel(this); - sfx_player = new AOSfxPlayer(this, ao_app); + ao_app = p_ao_app; + evidence_icon = new QLabel(this); + sfx_player = new AOSfxPlayer(this, ao_app); - evidence_movie = new AOMovie(this, ao_app); + evidence_movie = new AOMovie(this, ao_app); - connect(evidence_movie, SIGNAL(done()), this, SLOT(show_done())); + connect(evidence_movie, SIGNAL(done()), this, SLOT(show_done())); } -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(); + this->reset(); - sfx_player->set_volume(p_volume); + sfx_player->set_volume(p_volume); - QString final_gif_path; - QString gif_name; - QString icon_identifier; + QString final_gif_path; + QString gif_name; + QString icon_identifier; - if (is_left_side) { - icon_identifier = "left_evidence_icon"; - gif_name = "evidence_appear_left"; - } - else { - icon_identifier = "right_evidence_icon"; - gif_name = "evidence_appear_right"; - } + if (is_left_side) { + icon_identifier = "left_evidence_icon"; + gif_name = "evidence_appear_left"; + } + else { + icon_identifier = "right_evidence_icon"; + gif_name = "evidence_appear_right"; + } - QString f_evidence_path = ao_app->get_evidence_path(p_evidence_image); - QPixmap f_pixmap(f_evidence_path); + QString f_evidence_path = ao_app->get_evidence_path(p_evidence_image); + QPixmap f_pixmap(f_evidence_path); - 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"); - f_pixmap = f_pixmap.scaled(icon_dimensions.width, icon_dimensions.height); - evidence_icon->setPixmap(f_pixmap); - evidence_icon->resize(f_pixmap.size()); - evidence_icon->move(icon_dimensions.x, icon_dimensions.y); + f_pixmap = f_pixmap.scaled(icon_dimensions.width, icon_dimensions.height); + evidence_icon->setPixmap(f_pixmap); + evidence_icon->resize(f_pixmap.size()); + evidence_icon->move(icon_dimensions.x, icon_dimensions.y); - evidence_movie->play(gif_name); - sfx_player->play(ao_app->get_sfx("evidence_present")); + evidence_movie->play(gif_name); + sfx_player->play(ao_app->get_sfx("evidence_present")); } void AOEvidenceDisplay::reset() { - sfx_player->stop(); - evidence_movie->stop(); - evidence_icon->hide(); - this->clear(); + sfx_player->stop(); + evidence_movie->stop(); + evidence_icon->hide(); + this->clear(); } -void AOEvidenceDisplay::show_done() -{ - evidence_icon->show(); -} +void AOEvidenceDisplay::show_done() { evidence_icon->show(); } -QLabel *AOEvidenceDisplay::get_evidence_icon() -{ - return evidence_icon; -} +QLabel *AOEvidenceDisplay::get_evidence_icon() { return evidence_icon; } void AOEvidenceDisplay::combo_resize(int w, int h) { - QSize f_size(w, h); - this->resize(f_size); - evidence_movie->combo_resize(w, h); + QSize f_size(w, h); + this->resize(f_size); + evidence_movie->combo_resize(w, h); } diff --git a/src/aoimage.cpp b/src/aoimage.cpp index e1c01e55..2663ba05 100644 --- a/src/aoimage.cpp +++ b/src/aoimage.cpp @@ -4,46 +4,48 @@ AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } -AOImage::~AOImage() -{ -} +AOImage::~AOImage() {} bool AOImage::set_image(QString p_image) { - QString theme_image_path = ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); - QString default_image_path = ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); - - QString final_image_path; - - if (file_exists(theme_image_path)) - final_image_path = theme_image_path; - else if (file_exists(default_image_path)) - final_image_path = default_image_path; - else { - qDebug() << "Warning: Image" << p_image << "not found! Can't set!"; - return false; - } - - QPixmap f_pixmap(final_image_path); - - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); - return true; + QString theme_image_path = + ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); + QString default_image_path = + ao_app->get_static_image_suffix(ao_app->get_default_theme_path(p_image)); + + QString final_image_path; + + if (file_exists(theme_image_path)) + final_image_path = theme_image_path; + else if (file_exists(default_image_path)) + final_image_path = default_image_path; + else { + qDebug() << "Warning: Image" << p_image << "not found! Can't set!"; + return false; + } + + QPixmap f_pixmap(final_image_path); + + this->setPixmap( + f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + return true; } bool AOImage::set_chatbox(QString p_path) { - p_path = ao_app->get_static_image_suffix(p_path); - if (!file_exists(p_path)) { - qDebug() << "Warning: Chatbox" << p_path << "not found! Can't set!"; - return false; - } + p_path = ao_app->get_static_image_suffix(p_path); + if (!file_exists(p_path)) { + qDebug() << "Warning: Chatbox" << p_path << "not found! Can't set!"; + return false; + } - QPixmap f_pixmap(p_path); + QPixmap f_pixmap(p_path); - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); - return true; + this->setPixmap( + f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + return true; } diff --git a/src/aolineedit.cpp b/src/aolineedit.cpp index ce851a0d..f98d95fe 100644 --- a/src/aolineedit.cpp +++ b/src/aolineedit.cpp @@ -1,20 +1,19 @@ #include "aolineedit.h" -AOLineEdit::AOLineEdit(QWidget *parent) : QLineEdit(parent) -{ -} +AOLineEdit::AOLineEdit(QWidget *parent) : QLineEdit(parent) {} void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e) { - QLineEdit::mouseDoubleClickEvent(e); + QLineEdit::mouseDoubleClickEvent(e); - double_clicked(); + double_clicked(); } void AOLineEdit::focusOutEvent(QFocusEvent *ev) { - int start = selectionStart(); - int len = selectionEnd() - start; //We're not using selectionLength because Linux build doesn't run qt5.10 - QLineEdit::focusOutEvent(ev); - if (p_selection && start != -1 && len != -1) - this->setSelection(start, len); + int start = selectionStart(); + int len = selectionEnd() - start; // We're not using selectionLength because + // Linux build doesn't run qt5.10 + QLineEdit::focusOutEvent(ev); + if (p_selection && start != -1 && len != -1) + this->setSelection(start, len); } diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 7e3bbae0..ac949219 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -6,88 +6,94 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) { - ao_app = p_ao_app; + ao_app = p_ao_app; - m_movie = new QMovie(); + m_movie = new QMovie(); - this->setMovie(m_movie); + this->setMovie(m_movie); - timer = new QTimer(this); - timer->setTimerType(Qt::PreciseTimer); - timer->setSingleShot(true); + 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())); + 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::set_play_once(bool p_play_once) { play_once = p_play_once; } -void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int duration) +void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, + int duration) { - m_movie->stop(); - - QString shout_path = p_image; - if (!file_exists(p_image)) { - QList pathlist; - - pathlist = { - ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image)), //Character folder - ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image), //Misc path - ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path - ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path - ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //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->stop(); + + QString shout_path = p_image; + if (!file_exists(p_image)) { + QList pathlist; + + pathlist = { + ao_app->get_image_suffix( + ao_app->get_character_path(p_char, p_image)), // Character folder + ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + + p_custom_theme + "/" + p_image), // Misc path + ao_app->get_image_suffix(ao_app->get_custom_theme_path( + p_custom_theme, p_image)), // Custom theme path + ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), // Theme path + ao_app->get_image_suffix( + ao_app->get_default_theme_path(p_image)), // 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); + m_movie->setFileName(shout_path); - if (m_movie->loopCount() == 0) - play_once = true; + if (m_movie->loopCount() == 0) + play_once = true; - this->show(); - m_movie->start(); - if (m_movie->frameCount() == 0 && duration > 0) - timer->start(duration); + this->show(); + m_movie->start(); + if (m_movie->frameCount() == 0 && duration > 0) + timer->start(duration); } void AOMovie::stop() { - m_movie->stop(); - this->hide(); + 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()); + // 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(); - //signal connected to courtroom object, let it figure out what to do - done(); + this->stop(); + // signal connected to courtroom object, let it figure out what to do + done(); } void AOMovie::combo_resize(int w, int h) { - QSize f_size(w, h); - this->resize(f_size); - m_movie->setScaledSize(f_size); + 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 77222e1d..bc1ab235 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -3,200 +3,209 @@ #ifdef BASSAUDIO AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } AOMusicPlayer::~AOMusicPlayer() { - for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { - BASS_ChannelStop(m_stream_list[n_stream]); - } + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + BASS_ChannelStop(m_stream_list[n_stream]); + } } -void AOMusicPlayer::play(QString p_song, int channel, bool loop, int effect_flags) +void AOMusicPlayer::play(QString p_song, int channel, bool loop, + int effect_flags) { - channel = channel % m_channelmax; - if (channel < 0) //wtf? - return; - QString f_path = ao_app->get_music_path(p_song); - - unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE; - if (loop) - flags |= BASS_SAMPLE_LOOP; - - DWORD newstream; - if (f_path.endsWith(".opus")) - newstream = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); - else - newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); - - if (ao_app->get_audio_output_device() != "default") - BASS_ChannelSetDevice(m_stream_list[channel], BASS_GetDevice()); - - QString d_path = f_path + ".txt"; - - loop_start = 0; - loop_end = BASS_ChannelGetLength(newstream, BASS_POS_BYTE); - if (loop && file_exists(d_path)) //Contains loop/etc. information file - { - QStringList lines = ao_app->read_file(d_path).split("\n"); - foreach (QString line, lines) { - QStringList args = line.split("="); - if (args.size() < 2) - continue; - QString arg = args[0].trimmed(); - - float sample_rate; - BASS_ChannelGetAttribute(newstream, BASS_ATTRIB_FREQ, &sample_rate); - - //Grab number of bytes for sample size - int sample_size = 16 / 8; - - //number of channels (stereo/mono) - int num_channels = 2; - - //Calculate the bytes for loop_start/loop_end to use with the sync proc - QWORD bytes = static_cast(args[1].trimmed().toFloat() * sample_size * num_channels); - if (arg == "loop_start") - loop_start = bytes; - else if (arg == "loop_length") - loop_end = loop_start + bytes; - else if (arg == "loop_end") - loop_end = bytes; - } - qDebug() << "Found data file for song" << p_song << "length" << BASS_ChannelGetLength(newstream, BASS_POS_BYTE) << "loop start" << loop_start << "loop end" << loop_end; + channel = channel % m_channelmax; + if (channel < 0) // wtf? + return; + QString f_path = ao_app->get_music_path(p_song); + + unsigned int flags = BASS_STREAM_PRESCAN | BASS_STREAM_AUTOFREE | + BASS_UNICODE | BASS_ASYNCFILE; + if (loop) + flags |= BASS_SAMPLE_LOOP; + + DWORD newstream; + if (f_path.endsWith(".opus")) + newstream = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); + else + newstream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, flags); + + if (ao_app->get_audio_output_device() != "default") + BASS_ChannelSetDevice(m_stream_list[channel], BASS_GetDevice()); + + QString d_path = f_path + ".txt"; + + loop_start = 0; + loop_end = BASS_ChannelGetLength(newstream, BASS_POS_BYTE); + if (loop && file_exists(d_path)) // Contains loop/etc. information file + { + QStringList lines = ao_app->read_file(d_path).split("\n"); + foreach (QString line, lines) { + QStringList args = line.split("="); + if (args.size() < 2) + continue; + QString arg = args[0].trimmed(); + + float sample_rate; + BASS_ChannelGetAttribute(newstream, BASS_ATTRIB_FREQ, &sample_rate); + + // Grab number of bytes for sample size + int sample_size = 16 / 8; + + // number of channels (stereo/mono) + int num_channels = 2; + + // Calculate the bytes for loop_start/loop_end to use with the sync proc + QWORD bytes = static_cast(args[1].trimmed().toFloat() * + sample_size * num_channels); + if (arg == "loop_start") + loop_start = bytes; + else if (arg == "loop_length") + loop_end = loop_start + bytes; + else if (arg == "loop_end") + loop_end = bytes; } - - if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING) { - DWORD oldstream = m_stream_list[channel]; - - if (effect_flags & SYNC_POS) { - BASS_ChannelLock(oldstream, true); - //Sync it with the new sample - BASS_ChannelSetPosition(newstream, BASS_ChannelGetPosition(oldstream, BASS_POS_BYTE), BASS_POS_BYTE); - BASS_ChannelLock(oldstream, false); - } - - if (effect_flags & FADE_OUT) { - //Fade out the other sample and stop it (due to -1) - BASS_ChannelSlideAttribute(oldstream, BASS_ATTRIB_VOL | BASS_SLIDE_LOG, -1, 4000); - } - else - BASS_ChannelStop(oldstream); //Stop the sample since we don't need it anymore + qDebug() << "Found data file for song" << p_song << "length" + << BASS_ChannelGetLength(newstream, BASS_POS_BYTE) << "loop start" + << loop_start << "loop end" << loop_end; + } + + if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING) { + DWORD oldstream = m_stream_list[channel]; + + if (effect_flags & SYNC_POS) { + BASS_ChannelLock(oldstream, true); + // Sync it with the new sample + BASS_ChannelSetPosition(newstream, + BASS_ChannelGetPosition(oldstream, BASS_POS_BYTE), + BASS_POS_BYTE); + BASS_ChannelLock(oldstream, false); } - else - BASS_ChannelStop(m_stream_list[channel]); - - m_stream_list[channel] = newstream; - BASS_ChannelPlay(m_stream_list[channel], false); - if (effect_flags & FADE_IN) { - //Fade in our sample - BASS_ChannelSetAttribute(newstream, BASS_ATTRIB_VOL, 0); - BASS_ChannelSlideAttribute(newstream, BASS_ATTRIB_VOL, static_cast(m_volume[channel] / 100.0f), 1000); + + if (effect_flags & FADE_OUT) { + // Fade out the other sample and stop it (due to -1) + BASS_ChannelSlideAttribute(oldstream, BASS_ATTRIB_VOL | BASS_SLIDE_LOG, + -1, 4000); } else - this->set_volume(m_volume[channel], channel); + BASS_ChannelStop( + oldstream); // Stop the sample since we don't need it anymore + } + else + BASS_ChannelStop(m_stream_list[channel]); - this->set_looping(loop); //Have to do this here due to any crossfading-related changes, etc. + m_stream_list[channel] = newstream; + BASS_ChannelPlay(m_stream_list[channel], false); + if (effect_flags & FADE_IN) { + // Fade in our sample + BASS_ChannelSetAttribute(newstream, BASS_ATTRIB_VOL, 0); + BASS_ChannelSlideAttribute(newstream, BASS_ATTRIB_VOL, + static_cast(m_volume[channel] / 100.0f), + 1000); + } + else + this->set_volume(m_volume[channel], channel); + + this->set_looping(loop); // Have to do this here due to any + // crossfading-related changes, etc. } void AOMusicPlayer::stop(int channel) { - BASS_ChannelStop(m_stream_list[channel]); + BASS_ChannelStop(m_stream_list[channel]); } void AOMusicPlayer::set_volume(int p_value, int channel) { - m_volume[channel] = p_value; - float volume = m_volume[channel] / 100.0f; - if (channel < 0) { - for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { - BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); - } - } - else { - BASS_ChannelSetAttribute(m_stream_list[channel], BASS_ATTRIB_VOL, volume); + m_volume[channel] = p_value; + float volume = m_volume[channel] / 100.0f; + if (channel < 0) { + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, + volume); } + } + else { + BASS_ChannelSetAttribute(m_stream_list[channel], BASS_ATTRIB_VOL, volume); + } } void CALLBACK loopProc(HSYNC handle, DWORD channel, DWORD data, void *user) { - QWORD loop_start = *(static_cast(user)); - BASS_ChannelLock(channel, true); - BASS_ChannelSetPosition(channel, loop_start, BASS_POS_BYTE); - BASS_ChannelLock(channel, false); + QWORD loop_start = *(static_cast(user)); + BASS_ChannelLock(channel, true); + BASS_ChannelSetPosition(channel, loop_start, BASS_POS_BYTE); + BASS_ChannelLock(channel, false); } void AOMusicPlayer::set_looping(bool toggle, int channel) { - m_looping = toggle; - if (!m_looping) { - if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) - BASS_ChannelFlags(m_stream_list[channel], 0, BASS_SAMPLE_LOOP); // remove the LOOP flag - BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]); - loop_sync[channel] = 0; + m_looping = toggle; + if (!m_looping) { + if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) + BASS_ChannelFlags(m_stream_list[channel], 0, + BASS_SAMPLE_LOOP); // remove the LOOP flag + BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]); + loop_sync[channel] = 0; + } + else { + BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, + BASS_SAMPLE_LOOP); // set the LOOP flag + if (loop_sync[channel] != 0) { + BASS_ChannelRemoveSync(m_stream_list[channel], + loop_sync[channel]); // remove the sync + loop_sync[channel] = 0; } - else { - BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag - if (loop_sync[channel] != 0) { - BASS_ChannelRemoveSync(m_stream_list[channel], loop_sync[channel]); //remove the sync - loop_sync[channel] = 0; - } - if (loop_start > 0) { - if (loop_end == 0) - loop_end = BASS_ChannelGetLength(m_stream_list[channel], BASS_POS_BYTE); - if (loop_end > 0) //Don't loop zero length songs even if we're asked to - loop_sync[channel] = BASS_ChannelSetSync(m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end, loopProc, &loop_start); - } + if (loop_start > 0) { + if (loop_end == 0) + loop_end = BASS_ChannelGetLength(m_stream_list[channel], BASS_POS_BYTE); + if (loop_end > 0) // Don't loop zero length songs even if we're asked to + loop_sync[channel] = BASS_ChannelSetSync( + m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end, + loopProc, &loop_start); } + } } #elif defined(QTAUDIO) AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } -AOMusicPlayer::~AOMusicPlayer() -{ - m_player.stop(); -} +AOMusicPlayer::~AOMusicPlayer() { m_player.stop(); } void AOMusicPlayer::play(QString p_song) { - m_player.stop(); + m_player.stop(); - QString f_path = ao_app->get_music_path(p_song); + QString f_path = ao_app->get_music_path(p_song); - m_player.setMedia(QUrl::fromLocalFile(f_path)); + m_player.setMedia(QUrl::fromLocalFile(f_path)); - this->set_volume(m_volume); + this->set_volume(m_volume); - m_player.play(); + m_player.play(); } void AOMusicPlayer::set_volume(int p_value) { - m_volume = p_value; - m_player.setVolume(m_volume); + m_volume = p_value; + m_player.setVolume(m_volume); } #else AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + 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) -{ -} +void AOMusicPlayer::set_volume(int p_value) {} #endif diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 06df7a56..18556f3f 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -1,689 +1,755 @@ #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; - - // Setting up the basics. - // setAttribute(Qt::WA_DeleteOnClose); - setWindowTitle(tr("Settings")); - resize(398, 320); - - ui_settings_buttons = new QDialogButtonBox(this); - - QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); - sizePolicy1.setHorizontalStretch(0); - sizePolicy1.setVerticalStretch(0); - sizePolicy1.setHeightForWidth(ui_settings_buttons->sizePolicy().hasHeightForWidth()); - ui_settings_buttons->setSizePolicy(sizePolicy1); - ui_settings_buttons->setOrientation(Qt::Horizontal); - ui_settings_buttons->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save); - - QObject::connect(ui_settings_buttons, SIGNAL(accepted()), this, SLOT(save_pressed())); - QObject::connect(ui_settings_buttons, SIGNAL(rejected()), this, SLOT(discard_pressed())); - - // We'll stop updates so that the window won't flicker while it's being made. - setUpdatesEnabled(false); - - // First of all, we want a tabbed dialog, so let's add some layout. - ui_vertical_layout = new QVBoxLayout(this); - ui_settings_tabs = new QTabWidget(this); - - ui_vertical_layout->addWidget(ui_settings_tabs); - ui_vertical_layout->addWidget(ui_settings_buttons); - - // Let's add the tabs one by one. - // First, we'll start with 'Gameplay'. - ui_gameplay_tab = new QWidget(); - ui_gameplay_tab->setSizePolicy(sizePolicy1); - ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay")); - ui_form_layout_widget = new QWidget(ui_gameplay_tab); - ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 361)); - ui_form_layout_widget->setSizePolicy(sizePolicy1); + ao_app = p_ao_app; + + // Setting up the basics. + // setAttribute(Qt::WA_DeleteOnClose); + setWindowTitle(tr("Settings")); + resize(398, 320); + + ui_settings_buttons = new QDialogButtonBox(this); + + QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth( + ui_settings_buttons->sizePolicy().hasHeightForWidth()); + ui_settings_buttons->setSizePolicy(sizePolicy1); + ui_settings_buttons->setOrientation(Qt::Horizontal); + ui_settings_buttons->setStandardButtons(QDialogButtonBox::Cancel | + QDialogButtonBox::Save); + + QObject::connect(ui_settings_buttons, SIGNAL(accepted()), this, + SLOT(save_pressed())); + QObject::connect(ui_settings_buttons, SIGNAL(rejected()), this, + SLOT(discard_pressed())); + + // We'll stop updates so that the window won't flicker while it's being made. + setUpdatesEnabled(false); + + // First of all, we want a tabbed dialog, so let's add some layout. + ui_vertical_layout = new QVBoxLayout(this); + ui_settings_tabs = new QTabWidget(this); + + ui_vertical_layout->addWidget(ui_settings_tabs); + ui_vertical_layout->addWidget(ui_settings_buttons); + + // Let's add the tabs one by one. + // First, we'll start with 'Gameplay'. + ui_gameplay_tab = new QWidget(); + ui_gameplay_tab->setSizePolicy(sizePolicy1); + ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay")); + ui_form_layout_widget = new QWidget(ui_gameplay_tab); + ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 361)); + ui_form_layout_widget->setSizePolicy(sizePolicy1); + + 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->setSpacing(2); + + int row = 0; + + 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(row, QFormLayout::LabelRole, ui_theme_label); + ui_theme_combobox = new QComboBox(ui_form_layout_widget); + + // Fill the combobox with the names of the themes. + QDirIterator it(p_ao_app->get_base_path() + "themes", QDir::Dirs, + QDirIterator::NoIteratorFlags); + while (it.hasNext()) { + QString actualname = QDir(it.next()).dirName(); + if (actualname != "." && actualname != "..") + ui_theme_combobox->addItem(actualname); + if (actualname == p_ao_app->read_theme()) + ui_theme_combobox->setCurrentIndex(ui_theme_combobox->count() - 1); + } + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_theme_combobox); + + row += 1; + ui_theme_log_divider = new QFrame(ui_form_layout_widget); + ui_theme_log_divider->setMidLineWidth(0); + ui_theme_log_divider->setFrameShape(QFrame::HLine); + ui_theme_log_divider->setFrameShadow(QFrame::Sunken); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, + ui_theme_log_divider); + + row += 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(row, 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(row, QFormLayout::FieldRole, ui_downwards_cb); + + row += 1; + 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(row, 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(row, QFormLayout::FieldRole, ui_length_spinbox); + + row += 1; + 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(row, QFormLayout::FieldRole, + ui_log_names_divider); + + row += 1; + 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(row, 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(row, QFormLayout::FieldRole, ui_username_textbox); + + row += 1; + 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(row, 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(row, QFormLayout::FieldRole, ui_showname_cb); + + row += 1; + 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(row, QFormLayout::FieldRole, ui_net_divider); + + row += 1; + 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 = 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->setSpacing(2); - - int row = 0; + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_ms_lbl); - 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(row, QFormLayout::LabelRole, ui_theme_label); - ui_theme_combobox = new QComboBox(ui_form_layout_widget); - - // Fill the combobox with the names of the themes. - QDirIterator it(p_ao_app->get_base_path() + "themes", QDir::Dirs, QDirIterator::NoIteratorFlags); - while (it.hasNext()) { - QString actualname = QDir(it.next()).dirName(); - if (actualname != "." && actualname != "..") - ui_theme_combobox->addItem(actualname); - if (actualname == p_ao_app->read_theme()) - ui_theme_combobox->setCurrentIndex(ui_theme_combobox->count() - 1); - } - - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_theme_combobox); - - row += 1; - 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); + 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(row, QFormLayout::FieldRole, ui_theme_log_divider); + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_ms_textbox); - row += 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.")); + row += 1; + 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_gameplay_form->setWidget(row, 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(row, QFormLayout::FieldRole, ui_downwards_cb); - - row += 1; - 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(row, 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(row, QFormLayout::LabelRole, ui_discord_lbl); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_length_spinbox); - - row += 1; - 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_discord_cb = new QCheckBox(ui_form_layout_widget); + ui_discord_cb->setChecked(ao_app->is_discord_enabled()); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_log_names_divider); - - row += 1; - 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(row, QFormLayout::FieldRole, ui_discord_cb); - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_username_lbl); + row += 1; + 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(row, QFormLayout::LabelRole, ui_language_label); - 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_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("jp - 日本語"); + ui_language_combobox->addItem("ru - Русский"); + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, + ui_language_combobox); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_username_textbox); + row += 1; + ui_shake_lbl = new QLabel(ui_form_layout_widget); + ui_shake_lbl->setText(tr("Allow Screenshake:")); + ui_shake_lbl->setToolTip( + tr("Allows screenshaking. Disable this if you have concerns or issues " + "with photosensitivity and/or seizures.")); - row += 1; - 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(row, QFormLayout::LabelRole, ui_shake_lbl); - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_showname_lbl); + ui_shake_cb = new QCheckBox(ui_form_layout_widget); + ui_shake_cb->setChecked(ao_app->is_shake_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(row, QFormLayout::FieldRole, ui_shake_cb); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_showname_cb); + row += 1; + ui_effects_lbl = new QLabel(ui_form_layout_widget); + ui_effects_lbl->setText(tr("Allow Effects:")); + ui_effects_lbl->setToolTip( + tr("Allows screen effects. Disable this if you have concerns or issues " + "with photosensitivity and/or seizures.")); - row += 1; - 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(row, QFormLayout::LabelRole, ui_effects_lbl); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_net_divider); + ui_effects_cb = new QCheckBox(ui_form_layout_widget); + ui_effects_cb->setChecked(ao_app->is_effects_enabled()); - row += 1; - 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(row, QFormLayout::FieldRole, ui_effects_cb); - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_ms_lbl); + row += 1; + ui_framenetwork_lbl = new QLabel(ui_form_layout_widget); + ui_framenetwork_lbl->setText(tr("Network Frame Effects:")); + ui_framenetwork_lbl->setToolTip(tr( + "Send screen-shaking, flashes and sounds as defined in the char.ini over " + "the network. Only works for servers that support this functionality.")); - 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(row, QFormLayout::LabelRole, ui_framenetwork_lbl); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_ms_textbox); + ui_framenetwork_cb = new QCheckBox(ui_form_layout_widget); + ui_framenetwork_cb->setChecked(ao_app->is_frame_network_enabled()); - row += 1; - 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_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_framenetwork_cb); - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_discord_lbl); + row += 1; + ui_colorlog_lbl = new QLabel(ui_form_layout_widget); + ui_colorlog_lbl->setText(tr("Colors in IC Log:")); + ui_colorlog_lbl->setToolTip( + tr("Use the markup colors in the server IC chatlog.")); - ui_discord_cb = new QCheckBox(ui_form_layout_widget); - ui_discord_cb->setChecked(ao_app->is_discord_enabled()); + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_colorlog_lbl); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_discord_cb); + ui_colorlog_cb = new QCheckBox(ui_form_layout_widget); + ui_colorlog_cb->setChecked(ao_app->is_colorlog_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_colorlog_cb); + + row += 1; + ui_stickysounds_lbl = new QLabel(ui_form_layout_widget); + ui_stickysounds_lbl->setText(tr("Sticky Sounds:")); + ui_stickysounds_lbl->setToolTip( + tr("Turn this on to prevent the sound dropdown from clearing the sound " + "after playing it.")); - row += 1; - 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(row, QFormLayout::LabelRole, ui_language_label); + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickysounds_lbl); - 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("jp - 日本語"); - ui_language_combobox->addItem("ru - Русский"); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_language_combobox); + ui_stickysounds_cb = new QCheckBox(ui_form_layout_widget); + ui_stickysounds_cb->setChecked(ao_app->is_stickysounds_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickysounds_cb); - row += 1; - ui_shake_lbl = new QLabel(ui_form_layout_widget); - ui_shake_lbl->setText(tr("Allow Screenshake:")); - ui_shake_lbl->setToolTip(tr("Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures.")); + row += 1; + ui_stickyeffects_lbl = new QLabel(ui_form_layout_widget); + ui_stickyeffects_lbl->setText(tr("Sticky Effects:")); + ui_stickyeffects_lbl->setToolTip( + tr("Turn this on to prevent the effects dropdown from clearing the " + "effect after playing it.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, + ui_stickyeffects_lbl); + + ui_stickyeffects_cb = new QCheckBox(ui_form_layout_widget); + ui_stickyeffects_cb->setChecked(ao_app->is_stickyeffects_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickyeffects_cb); + + row += 1; + ui_stickypres_lbl = new QLabel(ui_form_layout_widget); + ui_stickypres_lbl->setText(tr("Sticky Preanims:")); + ui_stickypres_lbl->setToolTip( + tr("Turn this on to prevent preanimation checkbox from clearing after " + "playing the emote.")); - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_shake_lbl); + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickypres_lbl); - ui_shake_cb = new QCheckBox(ui_form_layout_widget); - ui_shake_cb->setChecked(ao_app->is_shake_enabled()); + ui_stickypres_cb = new QCheckBox(ui_form_layout_widget); + ui_stickypres_cb->setChecked(ao_app->is_stickypres_enabled()); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_shake_cb); + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickypres_cb); - row += 1; - ui_effects_lbl = new QLabel(ui_form_layout_widget); - ui_effects_lbl->setText(tr("Allow Effects:")); - ui_effects_lbl->setToolTip(tr("Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures.")); + QScrollArea *scroll = new QScrollArea; + scroll->setWidget(ui_form_layout_widget); + ui_gameplay_tab->setLayout(new QVBoxLayout); + ui_gameplay_tab->layout()->addWidget(scroll); + ui_gameplay_tab->show(); - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_effects_lbl); + // Here we start the callwords tab. + ui_callwords_tab = new QWidget(); + ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords")); - ui_effects_cb = new QCheckBox(ui_form_layout_widget); - ui_effects_cb->setChecked(ao_app->is_effects_enabled()); + ui_callwords_widget = new QWidget(ui_callwords_tab); + ui_callwords_widget->setGeometry(QRect(10, 10, 361, 211)); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_effects_cb); + ui_callwords_layout = new QVBoxLayout(ui_callwords_widget); + ui_callwords_layout->setContentsMargins(0, 0, 0, 0); - row += 1; - ui_framenetwork_lbl = new QLabel(ui_form_layout_widget); - ui_framenetwork_lbl->setText(tr("Network Frame Effects:")); - ui_framenetwork_lbl->setToolTip(tr("Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality.")); + ui_callwords_textbox = new QPlainTextEdit(ui_callwords_widget); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth( + ui_callwords_textbox->sizePolicy().hasHeightForWidth()); + ui_callwords_textbox->setSizePolicy(sizePolicy); - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_framenetwork_lbl); + // Let's fill the callwords text edit with the already present callwords. + ui_callwords_textbox->document()->clear(); + foreach (QString callword, p_ao_app->get_call_words()) { + ui_callwords_textbox->appendPlainText(callword); + } - ui_framenetwork_cb = new QCheckBox(ui_form_layout_widget); - ui_framenetwork_cb->setChecked(ao_app->is_frame_network_enabled()); + ui_callwords_layout->addWidget(ui_callwords_textbox); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_framenetwork_cb); + 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.")); - row += 1; - ui_colorlog_lbl = new QLabel(ui_form_layout_widget); - ui_colorlog_lbl->setText(tr("Colors in IC Log:")); - ui_colorlog_lbl->setToolTip(tr("Use the markup colors in the server IC chatlog.")); + ui_callwords_layout->addWidget(ui_callwords_explain_lbl); - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_colorlog_lbl); + // The audio tab. + ui_audio_tab = new QWidget(); + ui_settings_tabs->addTab(ui_audio_tab, tr("Audio")); - ui_colorlog_cb = new QCheckBox(ui_form_layout_widget); - ui_colorlog_cb->setChecked(ao_app->is_colorlog_enabled()); + ui_audio_widget = new QWidget(ui_audio_tab); + ui_audio_widget->setGeometry(QRect(10, 10, 361, 211)); - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_colorlog_cb); + ui_audio_layout = new QFormLayout(ui_audio_widget); + ui_audio_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignVCenter); + ui_audio_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignTop); + ui_audio_layout->setContentsMargins(0, 0, 0, 0); + row = 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.")); - row += 1; - ui_stickysounds_lbl = new QLabel(ui_form_layout_widget); - ui_stickysounds_lbl->setText(tr("Sticky Sounds:")); - ui_stickysounds_lbl->setToolTip(tr("Turn this on to prevent the sound dropdown from clearing the sound after playing it.")); + ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_audio_device_lbl); - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickysounds_lbl); + ui_audio_device_combobox = new QComboBox(ui_audio_widget); - ui_stickysounds_cb = new QCheckBox(ui_form_layout_widget); - ui_stickysounds_cb->setChecked(ao_app->is_stickysounds_enabled()); + // Let's fill out the combobox with the available audio devices. Or don't if + // there is no audio + int a = 0; + if (needs_default_audiodev()) { - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickysounds_cb); - - row += 1; - ui_stickyeffects_lbl = new QLabel(ui_form_layout_widget); - ui_stickyeffects_lbl->setText(tr("Sticky Effects:")); - ui_stickyeffects_lbl->setToolTip(tr("Turn this on to prevent the effects dropdown from clearing the effect after playing it.")); - - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickyeffects_lbl); - - ui_stickyeffects_cb = new QCheckBox(ui_form_layout_widget); - ui_stickyeffects_cb->setChecked(ao_app->is_stickyeffects_enabled()); - - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickyeffects_cb); - - row += 1; - ui_stickypres_lbl = new QLabel(ui_form_layout_widget); - ui_stickypres_lbl->setText(tr("Sticky Preanims:")); - ui_stickypres_lbl->setToolTip(tr("Turn this on to prevent preanimation checkbox from clearing after playing the emote.")); - - ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_stickypres_lbl); - - ui_stickypres_cb = new QCheckBox(ui_form_layout_widget); - ui_stickypres_cb->setChecked(ao_app->is_stickypres_enabled()); - - ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickypres_cb); - - QScrollArea *scroll = new QScrollArea; - scroll->setWidget(ui_form_layout_widget); - ui_gameplay_tab->setLayout(new QVBoxLayout); - ui_gameplay_tab->layout()->addWidget(scroll); - ui_gameplay_tab->show(); - - // 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); - row = 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(row, 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 - int a = 0; - if (needs_default_audiodev()) { - - ui_audio_device_combobox->addItem("default"); - } + ui_audio_device_combobox->addItem("default"); + } #ifdef BASSAUDIO - BASS_DEVICEINFO info; - 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); - } + BASS_DEVICEINFO info; + 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); - } + 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(row, QFormLayout::FieldRole, ui_audio_device_combobox); - - row += 1; - 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(row, QFormLayout::FieldRole, ui_audio_volume_divider); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, + ui_audio_device_combobox); - row += 1; - 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.")); + row += 1; + 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(row, QFormLayout::LabelRole, ui_music_volume_lbl); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, + ui_audio_volume_divider); - 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("%"); + row += 1; + 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(row, QFormLayout::LabelRole, ui_music_volume_lbl); - ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_music_volume_spinbox); + 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("%"); - row += 1; - 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(row, QFormLayout::LabelRole, ui_sfx_volume_lbl); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, + ui_music_volume_spinbox); - 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("%"); + row += 1; + 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(row, QFormLayout::LabelRole, ui_sfx_volume_lbl); - ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_sfx_volume_spinbox); + 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("%"); - row += 1; - 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(row, QFormLayout::FieldRole, + ui_sfx_volume_spinbox); - ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_blips_volume_lbl); + row += 1; + 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(row, 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_blips_volume_spinbox = new QSpinBox(ui_audio_widget); + ui_blips_volume_spinbox->setValue(p_ao_app->get_default_blip()); + ui_blips_volume_spinbox->setMaximum(100); + ui_blips_volume_spinbox->setSuffix("%"); - ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_blips_volume_spinbox); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, + ui_blips_volume_spinbox); - row += 1; - ui_volume_blip_divider = new QFrame(ui_audio_widget); - ui_volume_blip_divider->setFrameShape(QFrame::HLine); - ui_volume_blip_divider->setFrameShadow(QFrame::Sunken); + row += 1; + ui_volume_blip_divider = new QFrame(ui_audio_widget); + ui_volume_blip_divider->setFrameShape(QFrame::HLine); + ui_volume_blip_divider->setFrameShadow(QFrame::Sunken); - ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_volume_blip_divider); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, + ui_volume_blip_divider); - row += 1; - 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.")); + row += 1; + ui_bliprate_lbl = new QLabel(ui_audio_widget); + ui_bliprate_lbl->setText(tr("Blip rate:")); + ui_bliprate_lbl->setToolTip( + tr("Sets the delay between playing the blip sounds.")); - ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_bliprate_lbl); + ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_bliprate_lbl); - ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); - ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate()); - ui_bliprate_spinbox->setMinimum(1); - ui_bliprate_spinbox->setToolTip(tr("Play a blip sound \"once per every X symbols\", where " - "X is the blip rate.")); + ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); + ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate()); + ui_bliprate_spinbox->setMinimum(1); + ui_bliprate_spinbox->setToolTip( + tr("Play a blip sound \"once per every X symbols\", where " + "X is the blip rate.")); - ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_bliprate_spinbox); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_bliprate_spinbox); - row += 1; - 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'.")); + row += 1; + ui_blank_blips_lbl = new QLabel(ui_audio_widget); + ui_blank_blips_lbl->setText(tr("Blank blips:")); + ui_blank_blips_lbl->setToolTip( + tr("If true, the game will play a blip sound even " + "when a space is 'being said'.")); - ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_blank_blips_lbl); + ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_blank_blips_lbl); - ui_blank_blips_cb = new QCheckBox(ui_audio_widget); - ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip()); + ui_blank_blips_cb = new QCheckBox(ui_audio_widget); + ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip()); - ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_blank_blips_cb); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_blank_blips_cb); - row += 1; - 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.")); + row += 1; + 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_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_loopsfx_lbl); + ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_loopsfx_lbl); - ui_loopsfx_cb = new QCheckBox(ui_audio_widget); - ui_loopsfx_cb->setChecked(p_ao_app->get_looping_sfx()); + ui_loopsfx_cb = new QCheckBox(ui_audio_widget); + ui_loopsfx_cb->setChecked(p_ao_app->get_looping_sfx()); - ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_loopsfx_cb); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_loopsfx_cb); - row += 1; - ui_objectmusic_lbl = new QLabel(ui_audio_widget); - ui_objectmusic_lbl->setText(tr("Kill Music On Objection:")); - ui_objectmusic_lbl->setToolTip(tr("If true, AO2 will stop the music for you when you or someone else does 'Objection!'.")); + row += 1; + ui_objectmusic_lbl = new QLabel(ui_audio_widget); + ui_objectmusic_lbl->setText(tr("Kill Music On Objection:")); + ui_objectmusic_lbl->setToolTip( + tr("If true, AO2 will stop the music for you when you or someone else " + "does 'Objection!'.")); - ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_objectmusic_lbl); + ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_objectmusic_lbl); - ui_objectmusic_cb = new QCheckBox(ui_audio_widget); - ui_objectmusic_cb->setChecked(p_ao_app->objection_stop_music()); + ui_objectmusic_cb = new QCheckBox(ui_audio_widget); + ui_objectmusic_cb->setChecked(p_ao_app->objection_stop_music()); - ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_objectmusic_cb); + ui_audio_layout->setWidget(row, QFormLayout::FieldRole, ui_objectmusic_cb); - // The casing tab! - ui_casing_tab = new QWidget(); - ui_settings_tabs->addTab(ui_casing_tab, tr("Casing")); + // The casing tab! + ui_casing_tab = new QWidget(); + ui_settings_tabs->addTab(ui_casing_tab, tr("Casing")); - ui_casing_widget = new QWidget(ui_casing_tab); - ui_casing_widget->setGeometry(QRect(10, 10, 361, 211)); + ui_casing_widget = new QWidget(ui_casing_tab); + ui_casing_widget->setGeometry(QRect(10, 10, 361, 211)); - ui_casing_layout = new QFormLayout(ui_casing_widget); - ui_casing_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter); - ui_casing_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop); - ui_casing_layout->setContentsMargins(0, 0, 0, 0); - row = 0; + ui_casing_layout = new QFormLayout(ui_casing_widget); + ui_casing_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignVCenter); + ui_casing_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignTop); + ui_casing_layout->setContentsMargins(0, 0, 0, 0); + row = 0; - // -- SERVER SUPPORTS CASING + // -- SERVER SUPPORTS CASING - ui_casing_supported_lbl = new QLabel(ui_casing_widget); - if (ao_app->casing_alerts_enabled) - ui_casing_supported_lbl->setText(tr("This server supports case alerts.")); - else - ui_casing_supported_lbl->setText(tr("This server does not support case alerts.")); - ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory.")); + ui_casing_supported_lbl = new QLabel(ui_casing_widget); + if (ao_app->casing_alerts_enabled) + ui_casing_supported_lbl->setText(tr("This server supports case alerts.")); + else + ui_casing_supported_lbl->setText( + tr("This server does not support case alerts.")); + ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory.")); - ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_supported_lbl); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, + ui_casing_supported_lbl); - // -- CASE ANNOUNCEMENTS + // -- CASE ANNOUNCEMENTS - row += 1; - 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.")); + row += 1; + ui_casing_enabled_lbl = new QLabel(ui_casing_widget); + ui_casing_enabled_lbl->setText(tr("Casing:")); + ui_casing_enabled_lbl->setToolTip( + tr("If checked, you will get alerts about case " + "announcements.")); - ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_enabled_lbl); + ui_casing_layout->setWidget(row, QFormLayout::LabelRole, + ui_casing_enabled_lbl); - ui_casing_enabled_cb = new QCheckBox(ui_casing_widget); - ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled()); + ui_casing_enabled_cb = new QCheckBox(ui_casing_widget); + ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled()); - ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_enabled_cb); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, + ui_casing_enabled_cb); - // -- DEFENSE ANNOUNCEMENTS + // -- DEFENSE ANNOUNCEMENTS - row += 1; - 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.")); + row += 1; + 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(row, QFormLayout::LabelRole, ui_casing_def_lbl); + ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_def_lbl); - ui_casing_def_cb = new QCheckBox(ui_casing_widget); - ui_casing_def_cb->setChecked(ao_app->get_casing_defence_enabled()); + ui_casing_def_cb = new QCheckBox(ui_casing_widget); + ui_casing_def_cb->setChecked(ao_app->get_casing_defence_enabled()); - ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_def_cb); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_def_cb); - // -- PROSECUTOR ANNOUNCEMENTS + // -- PROSECUTOR ANNOUNCEMENTS - row += 1; - 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.")); + row += 1; + 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(row, QFormLayout::LabelRole, ui_casing_pro_lbl); + ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_pro_lbl); - ui_casing_pro_cb = new QCheckBox(ui_casing_widget); - ui_casing_pro_cb->setChecked(ao_app->get_casing_prosecution_enabled()); + ui_casing_pro_cb = new QCheckBox(ui_casing_widget); + ui_casing_pro_cb->setChecked(ao_app->get_casing_prosecution_enabled()); - ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_pro_cb); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_pro_cb); - // -- JUDGE ANNOUNCEMENTS + // -- JUDGE ANNOUNCEMENTS - row += 1; - 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.")); + row += 1; + 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(row, QFormLayout::LabelRole, ui_casing_jud_lbl); + ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_jud_lbl); - ui_casing_jud_cb = new QCheckBox(ui_casing_widget); - ui_casing_jud_cb->setChecked(ao_app->get_casing_judge_enabled()); + ui_casing_jud_cb = new QCheckBox(ui_casing_widget); + ui_casing_jud_cb->setChecked(ao_app->get_casing_judge_enabled()); - ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_jud_cb); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_jud_cb); - // -- JUROR ANNOUNCEMENTS + // -- JUROR ANNOUNCEMENTS - row += 1; - 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.")); + row += 1; + 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(row, QFormLayout::LabelRole, ui_casing_jur_lbl); + ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_jur_lbl); - ui_casing_jur_cb = new QCheckBox(ui_casing_widget); - ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled()); + ui_casing_jur_cb = new QCheckBox(ui_casing_widget); + ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled()); - ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_jur_cb); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_jur_cb); - // -- STENO ANNOUNCEMENTS + // -- STENO ANNOUNCEMENTS - row += 1; - 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.")); + row += 1; + 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(row, QFormLayout::LabelRole, ui_casing_steno_lbl); + ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_steno_lbl); - ui_casing_steno_cb = new QCheckBox(ui_casing_widget); - ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled()); + ui_casing_steno_cb = new QCheckBox(ui_casing_widget); + ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled()); - ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_steno_cb); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_steno_cb); - // -- CM ANNOUNCEMENTS + // -- CM ANNOUNCEMENTS - row += 1; - 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.")); + row += 1; + 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(row, QFormLayout::LabelRole, ui_casing_cm_lbl); + ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_casing_cm_lbl); - ui_casing_cm_cb = new QCheckBox(ui_casing_widget); - ui_casing_cm_cb->setChecked(ao_app->get_casing_cm_enabled()); + ui_casing_cm_cb = new QCheckBox(ui_casing_widget); + ui_casing_cm_cb->setChecked(ao_app->get_casing_cm_enabled()); - ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_cm_cb); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_cm_cb); - // -- CM CASES ANNOUNCEMENTS + // -- CM CASES ANNOUNCEMENTS - row += 1; - 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.")); + row += 1; + 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(row, QFormLayout::LabelRole, ui_casing_cm_cases_lbl); + ui_casing_layout->setWidget(row, QFormLayout::LabelRole, + ui_casing_cm_cases_lbl); - ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget); - ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases()); + ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget); + ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases()); - ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_cm_cases_textbox); + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, + ui_casing_cm_cases_textbox); - // When we're done, we should continue the updates! - setUpdatesEnabled(true); + // When we're done, we should continue the updates! + setUpdatesEnabled(true); } void AOOptionsDialog::save_pressed() { - // Save everything into the config.ini. - QSettings *configini = ao_app->configini; - - configini->setValue("theme", ui_theme_combobox->currentText()); - configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked()); - configini->setValue("log_maximum", ui_length_spinbox->value()); - configini->setValue("default_username", ui_username_textbox->text()); - configini->setValue("show_custom_shownames", ui_showname_cb->isChecked()); - configini->setValue("master", ui_ms_textbox->text()); - configini->setValue("discord", ui_discord_cb->isChecked()); - configini->setValue("language", ui_language_combobox->currentText().left(2)); - configini->setValue("shake", ui_shake_cb->isChecked()); - configini->setValue("effects", ui_effects_cb->isChecked()); - configini->setValue("framenetwork", ui_framenetwork_cb->isChecked()); - configini->setValue("colorlog", ui_colorlog_cb->isChecked()); - configini->setValue("stickysounds", ui_stickysounds_cb->isChecked()); - configini->setValue("stickyeffects", ui_stickyeffects_cb->isChecked()); - configini->setValue("stickypres", ui_stickypres_cb->isChecked()); - - QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); - - if (callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) { - 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("objection_stop_music", 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_can_host_cases", ui_casing_cm_cases_textbox->text()); - + // Save everything into the config.ini. + QSettings *configini = ao_app->configini; + + configini->setValue("theme", ui_theme_combobox->currentText()); + configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked()); + configini->setValue("log_maximum", ui_length_spinbox->value()); + configini->setValue("default_username", ui_username_textbox->text()); + configini->setValue("show_custom_shownames", ui_showname_cb->isChecked()); + configini->setValue("master", ui_ms_textbox->text()); + configini->setValue("discord", ui_discord_cb->isChecked()); + configini->setValue("language", ui_language_combobox->currentText().left(2)); + configini->setValue("shake", ui_shake_cb->isChecked()); + configini->setValue("effects", ui_effects_cb->isChecked()); + configini->setValue("framenetwork", ui_framenetwork_cb->isChecked()); + configini->setValue("colorlog", ui_colorlog_cb->isChecked()); + configini->setValue("stickysounds", ui_stickysounds_cb->isChecked()); + configini->setValue("stickyeffects", ui_stickyeffects_cb->isChecked()); + configini->setValue("stickypres", ui_stickypres_cb->isChecked()); + + QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); + + if (callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | + QIODevice::Text)) { + 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("objection_stop_music", 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_can_host_cases", + ui_casing_cm_cases_textbox->text()); + + callwordsini->close(); + done(0); } -void AOOptionsDialog::discard_pressed() -{ - done(0); -} +void AOOptionsDialog::discard_pressed() { done(0); } #if (defined(_WIN32) || defined(_WIN64)) -bool AOOptionsDialog::needs_default_audiodev() -{ - return true; -} +bool AOOptionsDialog::needs_default_audiodev() { return true; } #elif (defined(LINUX) || defined(__linux__)) -bool AOOptionsDialog::needs_default_audiodev() -{ - return false; -} +bool AOOptionsDialog::needs_default_audiodev() { return false; } #elif defined __APPLE__ -bool AOOptionsDialog::needs_default_audiodev() -{ - return true; -} +bool AOOptionsDialog::needs_default_audiodev() { return true; } #else #error This operating system is not supported. #endif diff --git a/src/aopacket.cpp b/src/aopacket.cpp index 457cc65c..6afd39e7 100644 --- a/src/aopacket.cpp +++ b/src/aopacket.cpp @@ -4,73 +4,77 @@ AOPacket::AOPacket(QString p_packet_string) { - QStringList packet_contents = p_packet_string.split("#"); + QStringList packet_contents = p_packet_string.split("#"); - m_header = packet_contents.at(0); + m_header = packet_contents.at(0); - for (int n_string = 1; n_string < packet_contents.size() - 1; ++n_string) { - m_contents.append(packet_contents.at(n_string)); - } + for (int n_string = 1; n_string < packet_contents.size() - 1; ++n_string) { + m_contents.append(packet_contents.at(n_string)); + } } AOPacket::AOPacket(QString p_header, QStringList &p_contents) { - m_header = p_header; - m_contents = p_contents; + m_header = p_header; + m_contents = p_contents; } -AOPacket::~AOPacket() -{ -} +AOPacket::~AOPacket() {} QString AOPacket::to_string() { - QString f_string = m_header; + QString f_string = m_header; - for (QString i_string : m_contents) { - f_string += ("#" + i_string); - } + for (QString i_string : m_contents) { + f_string += ("#" + i_string); + } - f_string += "#%"; + f_string += "#%"; - if (encrypted) - return "#" + f_string; - else - return f_string; + if (encrypted) + return "#" + f_string; + else + return f_string; } void AOPacket::encrypt_header(unsigned int p_key) { - m_header = fanta_encrypt(m_header, p_key); + m_header = fanta_encrypt(m_header, p_key); - encrypted = true; + encrypted = true; } void AOPacket::decrypt_header(unsigned int p_key) { - m_header = fanta_decrypt(m_header, p_key); + m_header = fanta_decrypt(m_header, p_key); - encrypted = false; + encrypted = false; } void AOPacket::net_encode() { - 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("&", ""); - - m_contents.removeAt(n_element); - m_contents.insert(n_element, f_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("&", ""); + + m_contents.removeAt(n_element); + m_contents.insert(n_element, f_element); + } } void AOPacket::net_decode() { - 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("", "&"); - - m_contents.removeAt(n_element); - m_contents.insert(n_element, f_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("", "&"); + + m_contents.removeAt(n_element); + m_contents.insert(n_element, f_element); + } } diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 64f741a4..094d7a54 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -4,119 +4,125 @@ 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 = ""; + 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_image_suffix(ao_app->get_background_path(p_image)); - if (!file_exists(background_path)) //If image is missing, clear current image - { - this->clear(); - this->setMovie(nullptr); - - m_movie->stop(); - last_image = ""; - return; - } - - if (file_exists(background_path) && background_path == last_image) - return; - + QString background_path = + ao_app->get_image_suffix(ao_app->get_background_path(p_image)); + if (!file_exists(background_path)) // If image is missing, clear current image + { this->clear(); this->setMovie(nullptr); m_movie->stop(); - m_movie->setFileName(background_path); - - if (m_movie->isValid() && m_movie->frameCount() > 1) { - m_movie->jumpToNextFrame(); - float scale_factor = static_cast(f_h) / static_cast(m_movie->frameRect().height()); - //preserve aspect ratio - int n_w = static_cast(m_movie->frameRect().width() * scale_factor); - int n_h = static_cast(m_movie->frameRect().height() * scale_factor); - - m_movie->setScaledSize(QSize(n_w, n_h)); - this->resize(m_movie->scaledSize()); - this->setMovie(m_movie); - QLabel::move(x + (f_w - n_w) / 2, y + (f_h - n_h) / 2); //Center - m_movie->start(); - } - else { - QPixmap background(background_path); - auto transform_mode = Qt::FastTransformation; - if (background.height() > f_h) //We are downscaling, use anti-aliasing. - transform_mode = Qt::SmoothTransformation; - - background = background.scaledToHeight(f_h, transform_mode); - this->resize(background.size()); - this->setPixmap(background); - QLabel::move(x + (f_w - background.width()) / 2, y + (f_h - background.height()) / 2); //Always center horizontally, always center vertically - } - last_image = background_path; + last_image = ""; + return; + } + + if (file_exists(background_path) && background_path == last_image) + return; + + this->clear(); + this->setMovie(nullptr); + + m_movie->stop(); + m_movie->setFileName(background_path); + + if (m_movie->isValid() && m_movie->frameCount() > 1) { + m_movie->jumpToNextFrame(); + float scale_factor = static_cast(f_h) / + static_cast(m_movie->frameRect().height()); + // preserve aspect ratio + int n_w = static_cast(m_movie->frameRect().width() * scale_factor); + int n_h = static_cast(m_movie->frameRect().height() * scale_factor); + + m_movie->setScaledSize(QSize(n_w, n_h)); + this->resize(m_movie->scaledSize()); + this->setMovie(m_movie); + QLabel::move(x + (f_w - n_w) / 2, y + (f_h - n_h) / 2); // Center + m_movie->start(); + } + else { + QPixmap background(background_path); + auto transform_mode = Qt::FastTransformation; + if (background.height() > f_h) // We are downscaling, use anti-aliasing. + transform_mode = Qt::SmoothTransformation; + + background = background.scaledToHeight(f_h, transform_mode); + this->resize(background.size()); + this->setPixmap(background); + QLabel::move( + x + (f_w - background.width()) / 2, + y + (f_h - background.height()) / + 2); // Always center horizontally, always center vertically + } + last_image = background_path; } void AOScene::set_legacy_desk(QString p_image) { - QString desk_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); - if (!file_exists(desk_path)) //If image is missing, clear current image - { - this->clear(); - this->setMovie(nullptr); + QString desk_path = + ao_app->get_image_suffix(ao_app->get_background_path(p_image)); + if (!file_exists(desk_path)) // If image is missing, clear current image + { + this->clear(); + this->setMovie(nullptr); + + m_movie->stop(); + last_image = ""; + return; + } - m_movie->stop(); - last_image = ""; - return; - } + if (file_exists(desk_path) && desk_path == last_image) + return; - if (file_exists(desk_path) && desk_path == last_image) - return; + QPixmap f_desk(desk_path); - QPixmap f_desk(desk_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(); - //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 h_modifier = vp_height / 192; - double h_modifier = vp_height / 192; + int final_h = static_cast(h_modifier * f_desk.height()); - int final_h = static_cast(h_modifier * f_desk.height()); + this->clear(); + this->setMovie(nullptr); - this->clear(); - this->setMovie(nullptr); + m_movie->stop(); + m_movie->setFileName(desk_path); - m_movie->stop(); - m_movie->setFileName(desk_path); - - m_movie->setScaledSize(QSize(vp_width, final_h)); - - if (m_movie->isValid() && m_movie->frameCount() > 1) { - 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; + m_movie->setScaledSize(QSize(vp_width, final_h)); + + if (m_movie->isValid() && m_movie->frameCount() > 1) { + 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; } void AOScene::combo_resize(int w, int h) { - QSize f_size(w, h); - f_w = w; - f_h = h; - this->resize(f_size); + QSize f_size(w, h); + f_w = w; + f_h = h; + this->resize(f_size); } void AOScene::move(int ax, int ay) { - x = ax; - y = ay; - QLabel::move(x, y); + x = ax; + y = ay; + QLabel::move(x, y); } diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index 4b375a46..3afd704f 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -1,181 +1,179 @@ #include "aosfxplayer.h" #include "file_functions.h" -#if defined(BASSAUDIO) //Using bass.dll for sfx +#if defined(BASSAUDIO) // Using bass.dll for sfx AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } void AOSfxPlayer::clear() { - for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { - BASS_ChannelStop(m_stream_list[n_stream]); - } - set_volume_internal(m_volume); + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + BASS_ChannelStop(m_stream_list[n_stream]); + } + set_volume_internal(m_volume); } void AOSfxPlayer::loop_clear() { - for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { - if ((BASS_ChannelFlags(m_stream_list[n_stream], 0, 0) & BASS_SAMPLE_LOOP)) - BASS_ChannelStop(m_stream_list[n_stream]); - } - set_volume_internal(m_volume); + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + if ((BASS_ChannelFlags(m_stream_list[n_stream], 0, 0) & BASS_SAMPLE_LOOP)) + BASS_ChannelStop(m_stream_list[n_stream]); + } + set_volume_internal(m_volume); } -void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, int channel) +void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, + int channel) { - if (channel == -1) { - if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING) - m_channel = (m_channel + 1) % m_channelmax; - channel = m_channel; - } + if (channel == -1) { + if (BASS_ChannelIsActive(m_stream_list[channel]) == BASS_ACTIVE_PLAYING) + m_channel = (m_channel + 1) % m_channelmax; + channel = m_channel; + } - BASS_ChannelStop(m_stream_list[channel]); + BASS_ChannelStop(m_stream_list[channel]); - QString misc_path = ""; - QString char_path = ""; - QString sound_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx)); + QString misc_path = ""; + QString char_path = ""; + QString sound_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx)); - if (shout != "") - misc_path = ao_app->get_sfx_suffix(ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx); - if (p_char != "") - char_path = ao_app->get_sfx_suffix(ao_app->get_character_path(p_char, p_sfx)); + if (shout != "") + misc_path = ao_app->get_sfx_suffix(ao_app->get_base_path() + "misc/" + + shout + "/" + p_sfx); + if (p_char != "") + char_path = + ao_app->get_sfx_suffix(ao_app->get_character_path(p_char, p_sfx)); - QString f_path; + QString f_path; - if (file_exists(char_path)) - f_path = char_path; - else if (file_exists(misc_path)) - f_path = misc_path; - else - f_path = sound_path; + if (file_exists(char_path)) + f_path = char_path; + else if (file_exists(misc_path)) + f_path = misc_path; + else + f_path = sound_path; - if (f_path.endsWith(".opus")) - m_stream_list[channel] = BASS_OPUS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); - else - m_stream_list[channel] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + if (f_path.endsWith(".opus")) + m_stream_list[channel] = BASS_OPUS_StreamCreateFile( + FALSE, f_path.utf16(), 0, 0, + BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + else + m_stream_list[channel] = BASS_StreamCreateFile( + FALSE, f_path.utf16(), 0, 0, + BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); - set_volume_internal(m_volume); + set_volume_internal(m_volume); - if (ao_app->get_audio_output_device() != "default") - BASS_ChannelSetDevice(m_stream_list[m_channel], BASS_GetDevice()); - BASS_ChannelPlay(m_stream_list[m_channel], false); + if (ao_app->get_audio_output_device() != "default") + BASS_ChannelSetDevice(m_stream_list[m_channel], BASS_GetDevice()); + BASS_ChannelPlay(m_stream_list[m_channel], false); } void AOSfxPlayer::stop(int channel) { - if (channel == -1) { - channel = m_channel; - } - BASS_ChannelStop(m_stream_list[channel]); + if (channel == -1) { + channel = m_channel; + } + BASS_ChannelStop(m_stream_list[channel]); } void AOSfxPlayer::set_volume(qreal p_value) { - m_volume = p_value / 100; - set_volume_internal(m_volume); + m_volume = p_value / 100; + set_volume_internal(m_volume); } void AOSfxPlayer::set_volume_internal(qreal p_value) { - float volume = static_cast(p_value); - for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { - BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); - } + float volume = static_cast(p_value); + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); + } } void AOSfxPlayer::set_looping(bool toggle, int channel) { - if (channel == -1) { - channel = m_channel; - } - m_looping = toggle; - if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) { - if (m_looping == false) - BASS_ChannelFlags(m_stream_list[channel], 0, BASS_SAMPLE_LOOP); // remove the LOOP flag - } - else { - if (m_looping == true) - BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); // set the LOOP flag - } -} -#elif defined(QTAUDIO) //Using Qt's QSoundEffect class + if (channel == -1) { + channel = m_channel; + } + m_looping = toggle; + if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) { + if (m_looping == false) + BASS_ChannelFlags(m_stream_list[channel], 0, + BASS_SAMPLE_LOOP); // remove the LOOP flag + } + else { + if (m_looping == true) + BASS_ChannelFlags(m_stream_list[channel], BASS_SAMPLE_LOOP, + BASS_SAMPLE_LOOP); // set the LOOP flag + } +} +#elif defined(QTAUDIO) // Using Qt's QSoundEffect class AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + m_parent = parent; + ao_app = p_ao_app; } void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) { - m_sfx.stop(); + m_sfx.stop(); - QString misc_path = ""; - QString char_path = ""; - QString sound_path = ao_app->get_sounds_path(p_sfx); + QString misc_path = ""; + QString char_path = ""; + QString sound_path = ao_app->get_sounds_path(p_sfx); - if (shout != "") - misc_path = ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx; - if (p_char != "") - char_path = ao_app->get_character_path(p_char, p_sfx); + if (shout != "") + misc_path = ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx; + if (p_char != "") + char_path = ao_app->get_character_path(p_char, p_sfx); - QString f_path; + QString f_path; - if (file_exists(char_path)) - f_path = char_path; - else if (file_exists(misc_path)) - f_path = misc_path; - else - f_path = sound_path; + if (file_exists(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 - { - m_sfx.setSource(QUrl::fromLocalFile(f_path)); + if (file_exists(f_path)) // if its missing, it will glitch out + { + 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::stop() -{ - m_sfx.stop(); -} +void AOSfxPlayer::stop() { m_sfx.stop(); } void AOSfxPlayer::set_volume(qreal p_value) { - m_volume = p_value / 100; - set_volume_internal(m_volume); + m_volume = p_value / 100; + set_volume_internal(m_volume); } void AOSfxPlayer::set_volume_internal(qreal p_value) { - m_sfx.setVolume(m_volume); + m_sfx.setVolume(m_volume); } #else AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { - m_parent = parent; - ao_app = p_ao_app; + 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::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 524f3283..52e32f55 100644 --- a/src/aotextarea.cpp +++ b/src/aotextarea.cpp @@ -1,63 +1,73 @@ #include "aotextarea.h" -AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) -{ -} +AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) {} void AOTextArea::append_linked(QString p_message) { - QString result = p_message.toHtmlEscaped().replace("\n", "
").replace(url_parser_regex, "\\1"); - this->insertHtml(result); + QString result = p_message.toHtmlEscaped() + .replace("\n", "
") + .replace(url_parser_regex, "\\1"); + this->insertHtml(result); } -void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p_colour) +void AOTextArea::append_chatmessage(QString p_name, QString p_message, + QString p_colour) { - const QTextCursor old_cursor = this->textCursor(); - const int old_scrollbar_value = this->verticalScrollBar()->value(); - const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum(); + const QTextCursor old_cursor = this->textCursor(); + const int old_scrollbar_value = this->verticalScrollBar()->value(); + const bool is_scrolled_down = + old_scrollbar_value == this->verticalScrollBar()->maximum(); - this->moveCursor(QTextCursor::End); + this->moveCursor(QTextCursor::End); - this->append(""); - this->insertHtml("" + p_name.toHtmlEscaped() + ": "); + this->append(""); + this->insertHtml("" + p_name.toHtmlEscaped() + + ": "); - //cheap workarounds ahoy - p_message += " "; - QString result = p_message.toHtmlEscaped().replace("\n", "
").replace(url_parser_regex, "\\1"); + // cheap workarounds ahoy + p_message += " "; + QString result = p_message.toHtmlEscaped() + .replace("\n", "
") + .replace(url_parser_regex, "\\1"); - this->insertHtml(result); + this->insertHtml(result); - this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down); + this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down); } 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 QTextCursor old_cursor = this->textCursor(); + const int old_scrollbar_value = this->verticalScrollBar()->value(); + const bool is_scrolled_down = + old_scrollbar_value == this->verticalScrollBar()->maximum(); - this->moveCursor(QTextCursor::End); + this->moveCursor(QTextCursor::End); - this->append(""); + this->append(""); - p_message += " "; - QString result = p_message.replace("\n", "
").replace(url_parser_regex, "\\1"); + p_message += " "; + QString result = p_message.replace("\n", "
") + .replace(url_parser_regex, "\\1"); - this->insertHtml("" + result + ""); + this->insertHtml("" + result + ""); - this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down); + 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); - } - 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()); - } + 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()); + } } diff --git a/src/aotextedit.cpp b/src/aotextedit.cpp index 0dc5cb4f..22d9a62e 100644 --- a/src/aotextedit.cpp +++ b/src/aotextedit.cpp @@ -2,19 +2,16 @@ AOTextEdit::AOTextEdit(QWidget *parent) : QPlainTextEdit(parent) { - this->setReadOnly(true); + 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) { - QPlainTextEdit::mouseDoubleClickEvent(e); + QPlainTextEdit::mouseDoubleClickEvent(e); - this->setReadOnly(false); + 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 65758690..de9748b0 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -7,251 +7,269 @@ void Courtroom::construct_char_select() { - ui_char_select_background = new AOImage(this, ao_app); + ui_char_select_background = new AOImage(this, ao_app); - ui_char_buttons = new QWidget(ui_char_select_background); + ui_char_buttons = new QWidget(ui_char_select_background); - ui_selector = new AOImage(ui_char_select_background, ao_app); - ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_selector->resize(62, 62); + ui_selector = new AOImage(ui_char_select_background, ao_app); + ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_selector->resize(62, 62); - ui_back_to_lobby = new AOButton(ui_char_select_background, ao_app); + ui_back_to_lobby = new AOButton(ui_char_select_background, ao_app); - ui_char_password = new QLineEdit(ui_char_select_background); - ui_char_password->setPlaceholderText(tr("Password")); + ui_char_password = new QLineEdit(ui_char_select_background); + ui_char_password->setPlaceholderText(tr("Password")); - ui_char_select_left = new AOButton(ui_char_select_background, ao_app); - ui_char_select_right = new AOButton(ui_char_select_background, ao_app); + ui_char_select_left = new AOButton(ui_char_select_background, ao_app); + ui_char_select_right = new AOButton(ui_char_select_background, ao_app); - ui_spectator = new AOButton(ui_char_select_background, ao_app); - ui_spectator->setText(tr("Spectator")); + ui_spectator = new AOButton(ui_char_select_background, ao_app); + ui_spectator->setText(tr("Spectator")); - ui_char_search = new QLineEdit(ui_char_select_background); - ui_char_search->setPlaceholderText(tr("Search")); - ui_char_search->setFocus(); - set_size_and_pos(ui_char_search, "char_search"); + ui_char_search = new QLineEdit(ui_char_select_background); + ui_char_search->setPlaceholderText(tr("Search")); + ui_char_search->setFocus(); + set_size_and_pos(ui_char_search, "char_search"); - ui_char_passworded = new QCheckBox(ui_char_select_background); - ui_char_passworded->setText(tr("Passworded")); - set_size_and_pos(ui_char_passworded, "char_passworded"); + ui_char_passworded = new QCheckBox(ui_char_select_background); + ui_char_passworded->setText(tr("Passworded")); + set_size_and_pos(ui_char_passworded, "char_passworded"); - ui_char_taken = new QCheckBox(ui_char_select_background); - ui_char_taken->setText(tr("Taken")); - set_size_and_pos(ui_char_taken, "char_taken"); + ui_char_taken = new QCheckBox(ui_char_select_background); + ui_char_taken->setText(tr("Taken")); + set_size_and_pos(ui_char_taken, "char_taken"); - ui_char_taken->setChecked(true); - ui_char_passworded->setChecked(true); + ui_char_taken->setChecked(true); + ui_char_passworded->setChecked(true); - set_size_and_pos(ui_char_buttons, "char_buttons"); + set_size_and_pos(ui_char_buttons, "char_buttons"); - connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked())); + connect(ui_back_to_lobby, SIGNAL(clicked()), this, + SLOT(on_back_to_lobby_clicked())); - connect(ui_char_select_left, SIGNAL(clicked()), this, SLOT(on_char_select_left_clicked())); - connect(ui_char_select_right, SIGNAL(clicked()), this, SLOT(on_char_select_right_clicked())); + connect(ui_char_select_left, SIGNAL(clicked()), this, + SLOT(on_char_select_left_clicked())); + connect(ui_char_select_right, SIGNAL(clicked()), this, + SLOT(on_char_select_right_clicked())); - connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked())); + connect(ui_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"; + 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 char_select width or height in courtroom_design.ini!"; - this->resize(714, 668); - } - else - this->resize(f_charselect.width, f_charselect.height); + if (f_charselect.width < 0 || f_charselect.height < 0) { + qDebug() << "W: did not find char_select width or height in " + "courtroom_design.ini!"; + this->resize(714, 668); + } + else + this->resize(f_charselect.width, f_charselect.height); - ui_char_select_background->resize(f_charselect.width, f_charselect.height); - ui_char_select_background->set_image("charselect_background"); + ui_char_select_background->resize(f_charselect.width, f_charselect.height); + ui_char_select_background->set_image("charselect_background"); - filter_character_list(); + filter_character_list(); - ui_char_search->setFocus(); + ui_char_search->setFocus(); } void Courtroom::set_char_select_page() { - ui_char_select_background->show(); + ui_char_select_background->show(); - ui_char_select_left->hide(); - ui_char_select_right->hide(); + ui_char_select_left->hide(); + ui_char_select_right->hide(); - for (AOCharButton *i_button : ui_char_button_list) { - i_button->reset(); - i_button->hide(); - i_button->move(0, 0); - } + for (AOCharButton *i_button : ui_char_button_list) { + i_button->reset(); + i_button->hide(); + i_button->move(0, 0); + } - int total_pages = ui_char_button_list_filtered.size() / max_chars_on_page; - int chars_on_page = 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) { - ++total_pages; - //i. e. not on the last page - if (total_pages > current_char_page + 1) - chars_on_page = max_chars_on_page; - else - chars_on_page = ui_char_button_list_filtered.size() % max_chars_on_page; - } + if (ui_char_button_list_filtered.size() % max_chars_on_page != 0) { + ++total_pages; + // i. e. not on the last page + if (total_pages > current_char_page + 1) + chars_on_page = max_chars_on_page; else - chars_on_page = max_chars_on_page; + chars_on_page = ui_char_button_list_filtered.size() % max_chars_on_page; + } + else + chars_on_page = max_chars_on_page; - if (total_pages > current_char_page + 1) - ui_char_select_right->show(); + if (total_pages > current_char_page + 1) + ui_char_select_right->show(); - if (current_char_page > 0) - ui_char_select_left->show(); + if (current_char_page > 0) + ui_char_select_left->show(); - put_button_in_place(current_char_page * max_chars_on_page, chars_on_page); + put_button_in_place(current_char_page * max_chars_on_page, chars_on_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; + qDebug() << "char_ini_path" << char_ini_path; - if (!file_exists(char_ini_path)) { - call_notice("Could not find " + char_ini_path); - return; - } + if (!file_exists(char_ini_path)) { + call_notice("Could not find " + char_ini_path); + return; + } - if (n_char != m_cid) { - 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 - update_character(n_char); + if (n_char != m_cid) { + 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 + update_character(n_char); - enter_courtroom(); + enter_courtroom(); - ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); + ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); } 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; } - - // First, we'll make all the character buttons in the very beginning. - // We also hide them all, so they can't be accidentally clicked. - // Later on, we'll be revealing buttons as we need them. - for (int n = 0; n < char_list.size(); n++) { - AOCharButton *char_button = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); - char_button->reset(); - char_button->hide(); - char_button->set_image(char_list.at(n).name); - ui_char_button_list.append(char_button); - - connect(char_button, &AOCharButton::clicked, [this, n]() { - this->char_clicked(n); - }); - - // This part here serves as a way of showing to the player that the game is still running, it is - // just loading the pictures of the characters. - if (ao_app->lobby_constructed) { - ao_app->generated_chars++; - int total_loading_size = ao_app->char_list_size * 2 + ao_app->evidence_list_size + ao_app->music_list_size; - int loading_value = int(((ao_app->loaded_chars + ao_app->generated_chars + ao_app->loaded_music + ao_app->loaded_evidence) / static_cast(total_loading_size)) * 100); - ao_app->w_lobby->set_loading_value(loading_value); - ao_app->w_lobby->set_loading_text(tr("Generating chars:\n%1/%2").arg(QString::number(ao_app->generated_chars)).arg(QString::number(ao_app->char_list_size))); - } + ui_char_button_list.clear(); + } + + // First, we'll make all the character buttons in the very beginning. + // We also hide them all, so they can't be accidentally clicked. + // Later on, we'll be revealing buttons as we need them. + for (int n = 0; n < char_list.size(); n++) { + AOCharButton *char_button = + new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); + char_button->reset(); + char_button->hide(); + char_button->set_image(char_list.at(n).name); + ui_char_button_list.append(char_button); + + connect(char_button, &AOCharButton::clicked, + [this, n]() { this->char_clicked(n); }); + + // This part here serves as a way of showing to the player that the game is + // still running, it is just loading the pictures of the characters. + if (ao_app->lobby_constructed) { + ao_app->generated_chars++; + int total_loading_size = ao_app->char_list_size * 2 + + ao_app->evidence_list_size + + ao_app->music_list_size; + int loading_value = + int(((ao_app->loaded_chars + ao_app->generated_chars + + ao_app->loaded_music + ao_app->loaded_evidence) / + static_cast(total_loading_size)) * + 100); + ao_app->w_lobby->set_loading_value(loading_value); + ao_app->w_lobby->set_loading_text( + tr("Generating chars:\n%1/%2") + .arg(QString::number(ao_app->generated_chars)) + .arg(QString::number(ao_app->char_list_size))); } + } - filter_character_list(); + filter_character_list(); } void Courtroom::filter_character_list() { - ui_char_button_list_filtered.clear(); - for (int i = 0; i < char_list.size(); i++) { - AOCharButton *current_char = ui_char_button_list.at(i); + ui_char_button_list_filtered.clear(); + for (int i = 0; i < char_list.size(); i++) { + AOCharButton *current_char = ui_char_button_list.at(i); - // It seems passwording characters is unimplemented yet? - // Until then, this will stay here, I suppose. - //if (ui_char_passworded->isChecked() && character_is_passworded??) - // continue; + // It seems passwording characters is unimplemented yet? + // Until then, this will stay here, I suppose. + // if (ui_char_passworded->isChecked() && character_is_passworded??) + // continue; - if (!ui_char_taken->isChecked() && char_list.at(i).taken) - continue; + if (!ui_char_taken->isChecked() && char_list.at(i).taken) + continue; - if (!char_list.at(i).name.contains(ui_char_search->text(), Qt::CaseInsensitive)) - continue; + if (!char_list.at(i).name.contains(ui_char_search->text(), + Qt::CaseInsensitive)) + continue; - // We only really need to update the fact that a character is taken - // for the buttons that actually appear. - // You'd also update the passwordedness and etc. here later. - current_char->reset(); - current_char->set_taken(char_list.at(i).taken); + // We only really need to update the fact that a character is taken + // for the buttons that actually appear. + // You'd also update the passwordedness and etc. here later. + current_char->reset(); + current_char->set_taken(char_list.at(i).taken); - ui_char_button_list_filtered.append(current_char); - } + ui_char_button_list_filtered.append(current_char); + } - current_char_page = 0; - set_char_select_page(); + current_char_page = 0; + set_char_select_page(); } -void Courtroom::on_char_search_changed() -{ - filter_character_list(); -} +void Courtroom::on_char_search_changed() { filter_character_list(); } -void Courtroom::on_char_passworded_clicked() -{ - filter_character_list(); -} +void Courtroom::on_char_passworded_clicked() { filter_character_list(); } -void Courtroom::on_char_taken_clicked() -{ - filter_character_list(); -} +void Courtroom::on_char_taken_clicked() { filter_character_list(); } diff --git a/src/chatlogpiece.cpp b/src/chatlogpiece.cpp index b0113de2..34a2fea4 100644 --- a/src/chatlogpiece.cpp +++ b/src/chatlogpiece.cpp @@ -2,76 +2,60 @@ chatlogpiece::chatlogpiece() { - name = "UNKNOWN"; - showname = "UNKNOWN"; - message = "UNKNOWN"; - p_is_song = false; - datetime = QDateTime::currentDateTime().toUTC(); + name = "UNKNOWN"; + showname = "UNKNOWN"; + message = "UNKNOWN"; + p_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) { - name = p_name; - showname = p_showname; - message = p_message; - p_is_song = p_song; - datetime = QDateTime::currentDateTime().toUTC(); + name = p_name; + showname = p_showname; + message = p_message; + p_is_song = p_song; + datetime = QDateTime::currentDateTime().toUTC(); } -chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime) +chatlogpiece::chatlogpiece(QString p_name, QString p_showname, + QString p_message, bool p_song, QDateTime p_datetime) { - name = p_name; - showname = p_showname; - message = p_message; - p_is_song = p_song; - datetime = p_datetime.toUTC(); + name = p_name; + showname = p_showname; + message = p_message; + p_is_song = p_song; + 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::is_song() -{ - return p_is_song; -} +bool chatlogpiece::is_song() { return p_is_song; } -QString chatlogpiece::get_datetime_as_string() -{ - return datetime.toString(); -} +QString chatlogpiece::get_datetime_as_string() { return datetime.toString(); } QString chatlogpiece::get_full() { - QString full = "["; - - full.append(get_datetime_as_string()); - full.append("] "); - full.append(get_showname()); - full.append(" ("); - full.append(get_name()); - full.append(")"); - if (p_is_song) - full.append(" has played a song: "); - else - full.append(": "); - full.append(get_message()); - - return full; + QString full = "["; + + full.append(get_datetime_as_string()); + full.append("] "); + full.append(get_showname()); + full.append(" ("); + full.append(get_name()); + full.append(")"); + if (p_is_song) + full.append(" has played a song: "); + else + full.append(": "); + full.append(get_message()); + + return full; } diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 4c240fed..9261de33 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2,4225 +2,4598 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() { - ao_app = p_ao_app; + 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); + // 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; + } } - 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; - } - } + 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 - qsrand(static_cast(QDateTime::currentMSecsSinceEpoch() / 1000)); + qsrand(static_cast(QDateTime::currentMSecsSinceEpoch() / 1000)); + + 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); + + 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); + + 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_sideplayer_char = new AOCharMovie(ui_viewport, ao_app); + 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(ui_viewport, ao_app); + + ui_vp_chatbox = new AOImage(this, ao_app); + ui_vp_showname = new QLabel(ui_vp_chatbox); + ui_vp_showname->setAlignment(Qt::AlignHCenter); + ui_vp_chat_arrow = new AOMovie(ui_vp_chatbox, ao_app); + ui_vp_chat_arrow->set_play_once(false); + + ui_vp_message = new QTextEdit(this); + 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_testimony->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_vp_effect = new AOMovie(this, ao_app); + ui_vp_effect->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_vp_wtce = new AOMovie(this, ao_app); + ui_vp_wtce->setAttribute(Qt::WA_TransparentForMouseEvents); + ui_vp_objection = new AOMovie(this, ao_app); + ui_vp_objection->setAttribute(Qt::WA_TransparentForMouseEvents); + + 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 QTreeWidget(this); + ui_area_list->setColumnCount(2); + ui_area_list->hideColumn(0); + ui_area_list->setHeaderHidden(true); + ui_area_list->header()->setStretchLastSection(false); + ui_area_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui_area_list->hide(); + + ui_music_list = new QTreeWidget(this); + ui_music_list->setColumnCount(2); + ui_music_list->hideColumn(1); + ui_music_list->setHeaderHidden(true); + ui_music_list->header()->setStretchLastSection(false); + ui_music_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui_music_list->setContextMenuPolicy(Qt::CustomContextMenu); + + ui_music_display = new AOMovie(this, ao_app); + ui_music_display->set_play_once(false); + ui_music_display->setAttribute(Qt::WA_TransparentForMouseEvents); + + ui_music_name = new ScrollText(ui_music_display); + ui_music_name->setText(tr("None")); + ui_music_name->setAttribute(Qt::WA_TransparentForMouseEvents); + + 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 AOLineEdit(this); + ui_ic_chat_message->setFrame(false); + ui_ic_chat_message->setPlaceholderText(tr("Message")); + ui_ic_chat_message->preserve_selection(true); + // ui_ic_chat_message->setValidator(new QRegExpValidator(QRegExp("^\\S+(?: + // \\S+)*$"), ui_ic_chat_message)); + // todo: filter out \n from showing up as that commonly breaks the chatlog and + // can be spammed to hell + + 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_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_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")); + + initialize_emotes(); + + ui_pos_dropdown = new QComboBox(this); + + ui_iniswap_dropdown = new QComboBox(this); + ui_iniswap_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); + ui_iniswap_remove = new AOButton(this, ao_app); + + ui_sfx_dropdown = new QComboBox(this); + ui_sfx_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); + ui_sfx_remove = new AOButton(this, ao_app); + + ui_effects_dropdown = new QComboBox(this); + ui_effects_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); + + 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_hold_it = new AOButton(this, ao_app); + ui_objection = new AOButton(this, ao_app); + ui_take_that = new AOButton(this, ao_app); - keepalive_timer = new QTimer(this); - keepalive_timer->start(60000); + 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); - chat_tick_timer = new QTimer(this); + 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("Guard")); + ui_guard->hide(); + + ui_additive = new QCheckBox(this); + ui_additive->setText(tr("Additive")); + ui_additive->hide(); - text_delay_timer = new QTimer(this); - text_delay_timer->setSingleShot(true); + ui_casing = new QCheckBox(this); + ui_casing->setChecked(ao_app->get_casing_enabled()); + ui_casing->setText(tr("Casing")); + ui_casing->hide(); - sfx_delay_timer = new QTimer(this); - sfx_delay_timer->setSingleShot(true); + ui_showname_enable = new QCheckBox(this); + ui_showname_enable->setChecked(ao_app->get_showname_enabled_by_default()); + ui_showname_enable->setText(tr("Shownames")); - music_player = new AOMusicPlayer(this, ao_app); - music_player->set_volume(0); + ui_pre_non_interrupt = new QCheckBox(this); + ui_pre_non_interrupt->setText(tr("No Interrupt")); + ui_pre_non_interrupt->hide(); - sfx_player = new AOSfxPlayer(this, ao_app); - sfx_player->set_volume(0); + ui_custom_objection = new AOButton(this, ao_app); + ui_realization = new AOButton(this, ao_app); + ui_screenshake = new AOButton(this, ao_app); + ui_mute = new AOButton(this, ao_app); - objection_player = new AOSfxPlayer(this, ao_app); - objection_player->set_volume(0); + ui_defense_plus = new AOButton(this, ao_app); + ui_defense_minus = new AOButton(this, ao_app); - blip_player = new AOBlipPlayer(this, ao_app); - blip_player->set_volume(0); + ui_prosecution_plus = new AOButton(this, ao_app); + ui_prosecution_minus = new AOButton(this, ao_app); - modcall_player = new AOSfxPlayer(this, ao_app); - modcall_player->set_volume(50); + ui_text_color = new QComboBox(this); - ui_background = new AOImage(this, ao_app); + ui_music_slider = new QSlider(Qt::Horizontal, this); + ui_music_slider->setRange(0, 100); + ui_music_slider->setValue(ao_app->get_default_music()); - 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_sideplayer_char = new AOCharMovie(ui_viewport, ao_app); - 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(ui_viewport, ao_app); - - ui_vp_chatbox = new AOImage(this, ao_app); - ui_vp_showname = new QLabel(ui_vp_chatbox); - ui_vp_showname->setAlignment(Qt::AlignHCenter); - ui_vp_chat_arrow = new AOMovie(ui_vp_chatbox, ao_app); - ui_vp_chat_arrow->set_play_once(false); - - ui_vp_message = new QTextEdit(this); - 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_testimony->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_vp_effect = new AOMovie(this, ao_app); - ui_vp_effect->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_vp_wtce = new AOMovie(this, ao_app); - ui_vp_wtce->setAttribute(Qt::WA_TransparentForMouseEvents); - ui_vp_objection = new AOMovie(this, ao_app); - ui_vp_objection->setAttribute(Qt::WA_TransparentForMouseEvents); - - 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_sfx_slider = new QSlider(Qt::Horizontal, this); + ui_sfx_slider->setRange(0, 100); + ui_sfx_slider->setValue(ao_app->get_default_sfx()); - ui_server_chatlog = new AOTextArea(this); - ui_server_chatlog->setReadOnly(true); - ui_server_chatlog->setOpenExternalLinks(true); + ui_blip_slider = new QSlider(Qt::Horizontal, this); + ui_blip_slider->setRange(0, 100); + ui_blip_slider->setValue(ao_app->get_default_blip()); - ui_area_list = new QTreeWidget(this); - ui_area_list->setColumnCount(2); - ui_area_list->hideColumn(0); - ui_area_list->setHeaderHidden(true); - ui_area_list->header()->setStretchLastSection(false); - ui_area_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - ui_area_list->hide(); + ui_mute_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->header()->setStretchLastSection(false); - ui_music_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - ui_music_list->setContextMenuPolicy(Qt::CustomContextMenu); - - ui_music_display = new AOMovie(this, ao_app); - ui_music_display->set_play_once(false); - ui_music_display->setAttribute(Qt::WA_TransparentForMouseEvents); - - ui_music_name = new ScrollText(ui_music_display); - ui_music_name->setText(tr("None")); - ui_music_name->setAttribute(Qt::WA_TransparentForMouseEvents); - - 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 AOLineEdit(this); - ui_ic_chat_message->setFrame(false); - ui_ic_chat_message->setPlaceholderText(tr("Message")); - ui_ic_chat_message->preserve_selection(true); - // ui_ic_chat_message->setValidator(new QRegExpValidator(QRegExp("^\\S+(?: \\S+)*$"), ui_ic_chat_message)); - //todo: filter out \n from showing up as that commonly breaks the chatlog and can be spammed to hell - - ui_muted = new AOImage(ui_ic_chat_message, ao_app); - ui_muted->hide(); + 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_ooc_chat_message = new QLineEdit(this); - ui_ooc_chat_message->setFrame(false); + ui_pair_order_dropdown = new QComboBox(this); + ui_pair_order_dropdown->addItem("To front"); + ui_pair_order_dropdown->addItem("To behind"); - 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_pair_button = 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")); + ui_evidence_button = new AOButton(this, ao_app); - initialize_emotes(); + initialize_evidence(); + + construct_char_select(); - ui_pos_dropdown = new QComboBox(this); + 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(ui_vp_player_char, SIGNAL(shake()), this, SLOT(do_screenshake())); + connect(ui_vp_player_char, SIGNAL(flash()), this, SLOT(do_flash())); + connect(ui_vp_player_char, SIGNAL(play_sfx(QString)), this, + SLOT(play_char_sfx(QString))); + + 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(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, + SLOT(on_pos_dropdown_changed(int))); + + connect(ui_iniswap_dropdown, SIGNAL(currentIndexChanged(int)), this, + SLOT(on_iniswap_dropdown_changed(int))); + connect(ui_iniswap_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, + SLOT(on_iniswap_context_menu_requested(QPoint))); + connect(ui_iniswap_remove, SIGNAL(clicked()), this, + SLOT(on_iniswap_remove_clicked())); + + connect(ui_sfx_dropdown, SIGNAL(currentIndexChanged(int)), this, + SLOT(on_sfx_dropdown_changed(int))); + connect(ui_sfx_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, + SLOT(on_sfx_context_menu_requested(QPoint))); + connect(ui_sfx_remove, SIGNAL(clicked()), this, + SLOT(on_sfx_remove_clicked())); + + connect(ui_effects_dropdown, SIGNAL(currentIndexChanged(int)), this, + SLOT(on_effects_dropdown_changed(int))); + connect(ui_effects_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, + SLOT(on_effects_context_menu_requested(QPoint))); + + 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())); - ui_iniswap_dropdown = new QComboBox(this); - ui_iniswap_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); - ui_iniswap_remove = new AOButton(this, ao_app); + connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, + SLOT(on_ooc_return_pressed())); - ui_sfx_dropdown = new QComboBox(this); - ui_sfx_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); - ui_sfx_remove = new AOButton(this, ao_app); + connect(ui_music_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), + this, SLOT(on_music_list_double_clicked(QTreeWidgetItem *, int))); + connect(ui_music_list, SIGNAL(customContextMenuRequested(QPoint)), this, + SLOT(on_music_list_context_menu_requested(QPoint))); - ui_effects_dropdown = new QComboBox(this); - ui_effects_dropdown->setContextMenuPolicy(Qt::CustomContextMenu); + connect(ui_area_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, + SLOT(on_area_list_double_clicked(QTreeWidgetItem *, int))); - ui_defense_bar = new AOImage(this, ao_app); - ui_prosecution_bar = new AOImage(this, ao_app); + 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())); - ui_music_label = new QLabel(this); - ui_sfx_label = new QLabel(this); - ui_blip_label = new QLabel(this); + 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())); - ui_hold_it = new AOButton(this, ao_app); - ui_objection = new AOButton(this, ao_app); - ui_take_that = new AOButton(this, ao_app); + 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_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_additive, SIGNAL(clicked()), this, SLOT(on_additive_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_pair_order_dropdown, SIGNAL(currentIndexChanged(int)), this, + SLOT(on_pair_order_dropdown_changed(int))); + + connect(ui_evidence_button, SIGNAL(clicked()), this, + SLOT(on_evidence_button_clicked())); + + set_widgets(); + + set_char_select(); +} - 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); +void Courtroom::set_mute_list() +{ + mute_map.clear(); - 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); + // 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); + } - ui_pre = new QCheckBox(this); - ui_pre->setText(tr("Pre")); + QStringList sorted_mute_list; - ui_flip = new QCheckBox(this); - ui_flip->setText(tr("Flip")); - ui_flip->hide(); + for (char_type i_char : char_list) + sorted_mute_list.append(i_char.name); - ui_guard = new QCheckBox(this); - ui_guard->setText(tr("Guard")); - ui_guard->hide(); + sorted_mute_list.sort(); - ui_additive = new QCheckBox(this); - ui_additive->setText(tr("Additive")); - ui_additive->hide(); + for (QString i_name : sorted_mute_list) { + // mute_map.insert(i_name, false); + ui_mute_list->addItem(i_name); + } +} - ui_casing = new QCheckBox(this); - ui_casing->setChecked(ao_app->get_casing_enabled()); - ui_casing->setText(tr("Casing")); - ui_casing->hide(); +void Courtroom::set_pair_list() +{ + QStringList sorted_pair_list; - ui_showname_enable = new QCheckBox(this); - ui_showname_enable->setChecked(ao_app->get_showname_enabled_by_default()); - ui_showname_enable->setText(tr("Shownames")); + for (char_type i_char : char_list) + sorted_pair_list.append(i_char.name); - ui_pre_non_interrupt = new QCheckBox(this); - ui_pre_non_interrupt->setText(tr("No Interrupt")); - ui_pre_non_interrupt->hide(); + sorted_pair_list.sort(); - ui_custom_objection = new AOButton(this, ao_app); - ui_realization = new AOButton(this, ao_app); - ui_screenshake = new AOButton(this, ao_app); - ui_mute = new AOButton(this, ao_app); + for (QString i_name : sorted_pair_list) { + ui_pair_list->addItem(i_name); + } +} - ui_defense_plus = new AOButton(this, ao_app); - ui_defense_minus = new AOButton(this, ao_app); +void Courtroom::set_widgets() +{ + blip_rate = ao_app->read_blip_rate(); + blank_blip = ao_app->get_blank_blip(); - ui_prosecution_plus = new AOButton(this, ao_app); - ui_prosecution_minus = new AOButton(this, ao_app); + QString filename = "courtroom_design.ini"; - ui_text_color = new QComboBox(this); + pos_size_type f_courtroom = + ao_app->get_element_dimensions("courtroom", filename); - ui_music_slider = new QSlider(Qt::Horizontal, this); - ui_music_slider->setRange(0, 100); - ui_music_slider->setValue(ao_app->get_default_music()); + if (f_courtroom.width < 0 || f_courtroom.height < 0) { + qDebug() << "W: did not find courtroom width or height in " << filename; - ui_sfx_slider = new QSlider(Qt::Horizontal, this); - ui_sfx_slider->setRange(0, 100); - ui_sfx_slider->setValue(ao_app->get_default_sfx()); + this->resize(714, 668); + } + else { + m_courtroom_width = f_courtroom.width; + m_courtroom_height = f_courtroom.height; - ui_blip_slider = new QSlider(Qt::Horizontal, this); - ui_blip_slider->setRange(0, 100); - ui_blip_slider->setValue(ao_app->get_default_blip()); + this->resize(f_courtroom.width, f_courtroom.height); + } - ui_mute_list = new QListWidget(this); + set_fonts(); - 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_background->move(0, 0); + ui_background->resize(m_courtroom_width, m_courtroom_height); + ui_background->set_image("courtroombackground"); - ui_pair_order_dropdown = new QComboBox(this); - ui_pair_order_dropdown->addItem("To front"); - ui_pair_order_dropdown->addItem("To behind"); + set_size_and_pos(ui_viewport, "viewport"); - ui_pair_button = new AOButton(this, ao_app); + // 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(); + ui_casing->show(); + } + else { + ui_announce_casing->hide(); + ui_casing->hide(); + } - ui_evidence_button = new AOButton(this, ao_app); + // 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(); - initialize_evidence(); + ui_vp_background->move(0, 0); + ui_vp_background->combo_resize(ui_viewport->width(), ui_viewport->height()); - construct_char_select(); + ui_vp_speedlines->move(0, 0); + ui_vp_speedlines->combo_resize(ui_viewport->width(), ui_viewport->height()); - connect(keepalive_timer, SIGNAL(timeout()), this, SLOT(ping_server())); + ui_vp_player_char->move(0, 0); + ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height()); - connect(ui_vp_objection, SIGNAL(done()), this, SLOT(objection_done())); - connect(ui_vp_player_char, SIGNAL(done()), this, SLOT(preanim_done())); - connect(ui_vp_player_char, SIGNAL(shake()), this, SLOT(do_screenshake())); - connect(ui_vp_player_char, SIGNAL(flash()), this, SLOT(do_flash())); - connect(ui_vp_player_char, SIGNAL(play_sfx(QString)), this, SLOT(play_char_sfx(QString))); + ui_vp_sideplayer_char->move(0, 0); + ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), + ui_viewport->height()); - connect(text_delay_timer, SIGNAL(timeout()), this, SLOT(start_chat_ticking())); - connect(sfx_delay_timer, SIGNAL(timeout()), this, SLOT(play_sfx())); + // the AO2 desk element + ui_vp_desk->move(0, 0); + ui_vp_desk->combo_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->combo_resize(ui_viewport->width(), + ui_viewport->height()); + + ui_vp_chat_arrow->move(0, 0); + pos_size_type design_ini_result = + ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini"); + + if (design_ini_result.width < 0 || design_ini_result.height < 0) { + qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; + ui_vp_chat_arrow->hide(); + } + else { + ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); + ui_vp_chat_arrow->combo_resize(design_ini_result.width, + design_ini_result.height); + } + + ui_vp_testimony->move(ui_viewport->x(), ui_viewport->y()); + ui_vp_testimony->combo_resize(ui_viewport->width(), ui_viewport->height()); + + ui_vp_effect->move(ui_viewport->x(), ui_viewport->y()); + ui_vp_effect->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()); - connect(chat_tick_timer, SIGNAL(timeout()), this, SLOT(chat_tick())); + ui_vp_objection->move(ui_viewport->x(), ui_viewport->y()); + ui_vp_objection->combo_resize(ui_viewport->width(), ui_viewport->height()); - connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pos_dropdown_changed(int))); + set_size_and_pos(ui_ic_chatlog, "ic_chatlog"); + ui_ic_chatlog->setFrameShape(QFrame::NoFrame); + + set_size_and_pos(ui_ms_chatlog, "ms_chatlog"); + ui_ms_chatlog->setFrameShape(QFrame::NoFrame); + + set_size_and_pos(ui_server_chatlog, "server_chatlog"); + ui_server_chatlog->setFrameShape(QFrame::NoFrame); - connect(ui_iniswap_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_iniswap_dropdown_changed(int))); - connect(ui_iniswap_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_iniswap_context_menu_requested(QPoint))); - connect(ui_iniswap_remove, SIGNAL(clicked()), this, SLOT(on_iniswap_remove_clicked())); + 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(); + ui_pair_list->setToolTip(tr("Select a character you wish to pair with.")); + + set_size_and_pos(ui_pair_offset_spinbox, "pair_offset_spinbox"); + ui_pair_offset_spinbox->hide(); + ui_pair_offset_spinbox->setToolTip( + tr("Change the percentage offset of your character's position from the " + "center of the screen.")); + + ui_pair_order_dropdown->hide(); + set_size_and_pos(ui_pair_order_dropdown, "pair_order_dropdown"); + ui_pair_offset_spinbox->setToolTip( + tr("Change the order of appearance for your character.")); + + set_size_and_pos(ui_pair_button, "pair_button"); + ui_pair_button->set_image("pair_button"); + ui_pair_button->setToolTip( + tr("Display the list of characters to pair with.")); + + set_size_and_pos(ui_area_list, "music_list"); + ui_area_list->header()->setMinimumSectionSize(ui_area_list->width()); + + set_size_and_pos(ui_music_list, "music_list"); + ui_music_list->header()->setMinimumSectionSize(ui_music_list->width()); + + set_size_and_pos(ui_music_name, "music_name"); + + ui_music_display->move(0, 0); + design_ini_result = + ao_app->get_element_dimensions("music_display", "courtroom_design.ini"); + + if (design_ini_result.width < 0 || design_ini_result.height < 0) { + qDebug() << "W: could not find \"music_name\" in courtroom_design.ini"; + ui_music_display->hide(); + } + else { + ui_music_display->move(design_ini_result.x, design_ini_result.y); + ui_music_display->combo_resize(design_ini_result.width, + design_ini_result.height); + } + + ui_music_display->play("music_display"); + + 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("chatblank"); + ui_vp_chatbox->hide(); + + set_size_and_pos(ui_vp_showname, "showname"); + + set_size_and_pos(ui_vp_message, "message"); + ui_vp_message->hide(); + + // We detached the text as parent from the chatbox so it doesn't get affected + // by the screenshake. + ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), + ui_vp_message->y() + ui_vp_chatbox->y()); + ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); + + ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); + ui_muted->set_image("muted"); + ui_muted->setToolTip(tr("Oops, you're muted!")); + + 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"); + ui_music_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); + + set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); + ui_emote_dropdown->setToolTip( + tr("Set your character's emote to play on your next message.")); + + set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); + ui_pos_dropdown->setToolTip( + tr("Set your character's supplementary background.")); + + set_size_and_pos(ui_iniswap_dropdown, "iniswap_dropdown"); + ui_iniswap_dropdown->setEditable(true); + ui_iniswap_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); + ui_iniswap_dropdown->setToolTip( + tr("Set an 'iniswap', or an alternative character folder to refer to " + "from your current character.\n" + "Edit by typing and pressing Enter, [X] to remove. This saves to your " + "base/characters//iniswaps.ini")); + + set_size_and_pos(ui_iniswap_remove, "iniswap_remove"); + ui_iniswap_remove->setText("X"); + ui_iniswap_remove->set_image("evidencex"); + ui_iniswap_remove->setToolTip( + tr("Remove the currently selected iniswap from the list and return to " + "the original character folder.")); + ui_iniswap_remove->hide(); + + set_size_and_pos(ui_sfx_dropdown, "sfx_dropdown"); + ui_sfx_dropdown->setEditable(true); + ui_sfx_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); + ui_sfx_dropdown->setToolTip( + tr("Set a sound effect to play on your next 'Preanim'. Leaving it on " + "Default will use the emote-defined sound (if any).\n" + "Edit by typing and pressing Enter, [X] to remove. This saves to your " + "base/characters//soundlist.ini")); + + set_size_and_pos(ui_sfx_remove, "sfx_remove"); + ui_sfx_remove->setText("X"); + ui_sfx_remove->set_image("evidencex"); + ui_sfx_remove->setToolTip( + tr("Remove the currently selected iniswap from the list and return to " + "the original character folder.")); + ui_sfx_remove->hide(); + + set_size_and_pos(ui_effects_dropdown, "effects_dropdown"); + ui_effects_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); + ui_effects_dropdown->setToolTip( + tr("Choose an effect to play on your next spoken message.\n" + "The effects are defined in your theme/effects/effects.ini. Your " + "character can define custom effects by\n" + "char.ini [Options] category, effects = 'miscname' where it referes " + "to misc//effects.ini to read the effects.")); + // Todo: recode this entire fucking system with these dumbass goddamn ini's + // why is everything so specifically coded for all these purposes is ABSTRACT + // CODING not a thing now huh what the FUCK why do I gotta do this pleASE FOR + // THE LOVE OF GOD SPARE ME FROM THIS FRESH HELL btw i still love coding. + QPoint p_point = ao_app->get_button_spacing("effects_icon_size", filename); + ui_effects_dropdown->setIconSize(QSize(p_point.x(), p_point.y())); + + set_size_and_pos(ui_defense_bar, "defense_bar"); + ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state)); + + set_size_and_pos(ui_prosecution_bar, "prosecution_bar"); + ui_prosecution_bar->set_image("prosecutionbar" + + QString::number(prosecution_bar_state)); + + 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_hold_it, "hold_it"); + ui_hold_it->setText(tr("Hold It!")); + ui_hold_it->setToolTip(tr("When this is turned on, your next in-character " + "message will be a shout!")); + ui_hold_it->set_image("holdit"); + + set_size_and_pos(ui_objection, "objection"); + ui_objection->setText(tr("Objection!")); + ui_objection->setToolTip(tr("When this is turned on, your next in-character " + "message will be a shout!")); + ui_objection->set_image("objection"); + + set_size_and_pos(ui_take_that, "take_that"); + ui_take_that->setText(tr("Take That!")); + ui_take_that->setToolTip(tr("When this is turned on, your next in-character " + "message will be a shout!")); + ui_take_that->set_image("takethat"); + + set_size_and_pos(ui_ooc_toggle, "ooc_toggle"); + ui_ooc_toggle->setText(tr("Server")); + ui_ooc_toggle->setToolTip( + tr("Toggle between server chat and global AO2 chat.")); + + set_size_and_pos(ui_witness_testimony, "witness_testimony"); + ui_witness_testimony->set_image("witnesstestimony"); + ui_witness_testimony->setToolTip(tr("This will display the animation in the " + "viewport as soon as it is pressed.")); + set_size_and_pos(ui_cross_examination, "cross_examination"); + ui_cross_examination->set_image("crossexamination"); + ui_cross_examination->setToolTip(tr("This will display the animation in the " + "viewport as soon as it is pressed.")); + + set_size_and_pos(ui_guilty, "guilty"); + ui_guilty->setText(tr("Guilty!")); + ui_guilty->set_image("guilty"); + ui_guilty->setToolTip(tr("This will display the animation in the viewport as " + "soon as it is pressed.")); + set_size_and_pos(ui_not_guilty, "not_guilty"); + ui_not_guilty->set_image("notguilty"); + ui_not_guilty->setToolTip(tr("This will display the animation in the " + "viewport as soon as it is pressed.")); + + set_size_and_pos(ui_change_character, "change_character"); + ui_change_character->setText(tr("Change character")); + ui_change_character->set_image("change_character"); + ui_change_character->setToolTip( + tr("Bring up the Character Select Screen and change your character.")); + + set_size_and_pos(ui_reload_theme, "reload_theme"); + ui_reload_theme->setText(tr("Reload theme")); + ui_reload_theme->set_image("reload_theme"); + ui_reload_theme->setToolTip( + tr("Refresh the theme and update all of the ui elements to match.")); + + set_size_and_pos(ui_call_mod, "call_mod"); + ui_call_mod->setText(tr("Call mod")); + ui_call_mod->set_image("call_mod"); + ui_call_mod->setToolTip( + tr("Request the attention of the current server's moderator.")); + + set_size_and_pos(ui_settings, "settings"); + ui_settings->setText(tr("Settings")); + ui_settings->set_image("settings"); + ui_settings->setToolTip( + tr("Allows you to change various aspects of the client.")); + + set_size_and_pos(ui_announce_casing, "casing_button"); + ui_announce_casing->setText(tr("Casing")); + ui_announce_casing->set_image("casing_button"); + ui_announce_casing->setToolTip( + tr("An interface to help you announce a case (you have to be a CM first " + "to be able to announce cases)")); + + set_size_and_pos(ui_switch_area_music, "switch_area_music"); + ui_switch_area_music->setText(tr("A/M")); + ui_switch_area_music->set_image("switch_area_music"); + ui_switch_area_music->setToolTip(tr("Switch between Areas and Music lists")); + + set_size_and_pos(ui_pre, "pre"); + ui_pre->setText(tr("Preanim")); + ui_pre->setToolTip( + tr("Play a single-shot animation as defined by the emote when checked.")); + + set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); + ui_pre_non_interrupt->setToolTip( + tr("If preanim is checked, display the input text immediately as the " + "animation plays concurrently.")); + + set_size_and_pos(ui_flip, "flip"); + ui_flip->setToolTip(tr("Mirror your character's emotes when checked.")); + + set_size_and_pos(ui_additive, "additive"); + ui_additive->setToolTip( + tr("Add text to your last spoken message when checked.")); + + set_size_and_pos(ui_guard, "guard"); + ui_guard->setToolTip( + tr("Do not listen to mod calls when checked, preventing them from " + "playing sounds or focusing attention on the window.")); + + set_size_and_pos(ui_casing, "casing"); + ui_casing->setToolTip(tr("Lets you receive case alerts when enabled.\n" + "(You can set your preferences in the Settings!)")); + + set_size_and_pos(ui_showname_enable, "showname_enable"); + ui_showname_enable->setToolTip( + tr("Display customized shownames for all users when checked.")); + + set_size_and_pos(ui_custom_objection, "custom_objection"); + ui_custom_objection->setText(tr("Custom Shout!")); + ui_custom_objection->set_image("custom"); + ui_custom_objection->setToolTip( + tr("This will display the custom character-defined animation in the " + "viewport as soon as it is pressed.\n" + "To make one, your character's folder must contain " + "custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect")); + + set_size_and_pos(ui_realization, "realization"); + ui_realization->set_image("realization"); + ui_realization->setToolTip( + tr("Play realization sound and animation in the viewport on the next " + "spoken message when checked.")); + + set_size_and_pos(ui_screenshake, "screenshake"); + ui_screenshake->set_image("screenshake"); + ui_screenshake->setToolTip( + tr("Shake the screen on next spoken message when checked.")); + + set_size_and_pos(ui_mute, "mute_button"); + ui_mute->setText("Mute"); + ui_mute->set_image("mute"); + ui_mute->setToolTip( + tr("Display the list of character folders you wish to mute.")); + + set_size_and_pos(ui_defense_plus, "defense_plus"); + ui_defense_plus->set_image("defplus"); + ui_defense_plus->setToolTip(tr("Increase the health bar.")); + + set_size_and_pos(ui_defense_minus, "defense_minus"); + ui_defense_minus->set_image("defminus"); + ui_defense_minus->setToolTip(tr("Decrease the health bar.")); + + set_size_and_pos(ui_prosecution_plus, "prosecution_plus"); + ui_prosecution_plus->set_image("proplus"); + ui_prosecution_plus->setToolTip(tr("Increase the health bar.")); + + set_size_and_pos(ui_prosecution_minus, "prosecution_minus"); + ui_prosecution_minus->set_image("prominus"); + ui_prosecution_minus->setToolTip(tr("Decrease the health bar.")); + + set_size_and_pos(ui_text_color, "text_color"); + ui_text_color->setToolTip( + tr("Change the text color of the spoken message.\n" + "You can also select a part of your currently typed message and use " + "the dropdown to change its color!")); + set_text_color_dropdown(); + + 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"); + + ui_selector->set_image("char_selector"); + ui_selector->hide(); + + set_size_and_pos(ui_back_to_lobby, "back_to_lobby"); + ui_back_to_lobby->setText(tr("Back to Lobby")); + ui_back_to_lobby->setToolTip(tr("Return back to the server list.")); + + set_size_and_pos(ui_char_password, "char_password"); + + set_size_and_pos(ui_char_buttons, "char_buttons"); - connect(ui_sfx_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_sfx_dropdown_changed(int))); - connect(ui_sfx_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_sfx_context_menu_requested(QPoint))); - connect(ui_sfx_remove, SIGNAL(clicked()), this, SLOT(on_sfx_remove_clicked())); + set_size_and_pos(ui_char_select_left, "char_select_left"); + ui_char_select_left->set_image("arrow_left"); - connect(ui_effects_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_effects_dropdown_changed(int))); - connect(ui_effects_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_effects_context_menu_requested(QPoint))); + set_size_and_pos(ui_char_select_right, "char_select_right"); + ui_char_select_right->set_image("arrow_right"); - connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); + set_size_and_pos(ui_spectator, "spectator"); + ui_spectator->setToolTip(tr("Become a spectator. You won't be able to " + "interact with the in-character screen.")); - connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, SLOT(on_chat_return_pressed())); + refresh_evidence(); +} - connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, SLOT(on_ooc_return_pressed())); +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_font(ui_music_name, "", "music_name"); - connect(ui_music_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(on_music_list_double_clicked(QTreeWidgetItem *, int))); - connect(ui_music_list, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_music_list_context_menu_requested(QPoint))); + set_dropdowns(); +} - connect(ui_area_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(on_area_list_double_clicked(QTreeWidgetItem *, int))); +void Courtroom::set_font(QWidget *widget, QString class_name, + QString p_identifier) +{ + QString design_file = "courtroom_fonts.ini"; + int f_pointsize = ao_app->get_font_size(p_identifier, design_file); + QString font_name = + ao_app->get_font_name(p_identifier + "_font", design_file); + QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); + bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == + 1; // is the font bold or not? + bool antialias = + ao_app->get_font_size(p_identifier + "_sharp", design_file) != + 1; // is the font anti-aliased or not? - 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())); + this->set_qfont(widget, class_name, + get_qfont(font_name, f_pointsize, antialias), f_color, bold); +} - connect(ui_realization, SIGNAL(clicked()), this, SLOT(on_realization_clicked())); - connect(ui_screenshake, SIGNAL(clicked()), this, SLOT(on_screenshake_clicked())); +QFont Courtroom::get_qfont(QString font_name, int f_pointsize, bool antialias) +{ + QFont font; + if (font_name.isEmpty()) + font_name = "Arial"; - connect(ui_mute, SIGNAL(clicked()), this, SLOT(on_mute_clicked())); + QFont::StyleStrategy style_strategy = QFont::PreferDefault; + if (!antialias) + style_strategy = QFont::NoAntialias; - 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())); + font = QFont(font_name, f_pointsize); + font.setStyleHint(QFont::SansSerif, style_strategy); + return font; +} - connect(ui_text_color, SIGNAL(currentIndexChanged(int)), this, SLOT(on_text_color_changed(int))); +void Courtroom::set_qfont(QWidget *widget, QString class_name, QFont font, + QColor f_color, bool bold) +{ + if (class_name.isEmpty()) + class_name = widget->metaObject()->className(); - 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))); + font.setBold(bold); + widget->setFont(font); - connect(ui_ooc_toggle, SIGNAL(clicked()), this, SLOT(on_ooc_toggle_clicked())); + 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); +} - connect(ui_music_search, SIGNAL(textChanged(QString)), this, SLOT(on_music_search_edited(QString))); +void Courtroom::set_dropdown(QWidget *widget) +{ + QString f_file = "courtroom_stylesheets.css"; + QString style_sheet_string = ao_app->get_stylesheet(f_file); + if (style_sheet_string != "") + widget->setStyleSheet(style_sheet_string); +} - 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())); +void Courtroom::set_dropdowns() +{ + set_dropdown( + this); // EXPERIMENTAL - Read the style-sheet as-is for maximum memeage + // set_dropdown(ui_text_color, "[TEXT COLOR]"); + // set_dropdown(ui_pos_dropdown, "[POS DROPDOWN]"); + // set_dropdown(ui_emote_dropdown, "[EMOTE DROPDOWN]"); + // set_dropdown(ui_mute_list, "[MUTE LIST]"); +} - 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())); +void Courtroom::set_window_title(QString p_title) +{ + this->setWindowTitle(p_title); +} - connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked())); - connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked())); - connect(ui_additive, SIGNAL(clicked()), this, SLOT(on_additive_clicked())); - connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked())); - connect(ui_casing, SIGNAL(clicked()), this, SLOT(on_casing_clicked())); +void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier) +{ + QString filename = "courtroom_design.ini"; - connect(ui_showname_enable, SIGNAL(clicked()), this, SLOT(on_showname_enable_clicked())); + pos_size_type design_ini_result = + ao_app->get_element_dimensions(p_identifier, filename); - connect(ui_pair_button, SIGNAL(clicked()), this, SLOT(on_pair_clicked())); - connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_pair_list_clicked(QModelIndex))); - connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_pair_offset_changed(int))); - connect(ui_pair_order_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pair_order_dropdown_changed(int))); + 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); + } +} - connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked())); +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; + } - set_widgets(); + 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; - set_char_select(); + char_list.replace(n_char, f_char); } -void Courtroom::set_mute_list() +QPoint Courtroom::get_theme_pos(QString p_identifier) { - mute_map.clear(); + QString filename = "courtroom_design.ini"; - //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); - } + pos_size_type design_ini_result = + ao_app->get_element_dimensions(p_identifier, filename); - QStringList sorted_mute_list; + 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); + } +} - for (char_type i_char : char_list) - sorted_mute_list.append(i_char.name); +void Courtroom::done_received() +{ + m_cid = -1; - sorted_mute_list.sort(); + music_player->set_volume(0); + sfx_player->set_volume(0); + objection_player->set_volume(0); + blip_player->set_volume(0); - for (QString i_name : sorted_mute_list) { - //mute_map.insert(i_name, false); - ui_mute_list->addItem(i_name); - } -} + set_char_select_page(); -void Courtroom::set_pair_list() -{ - QStringList sorted_pair_list; + set_mute_list(); + set_pair_list(); - for (char_type i_char : char_list) - sorted_pair_list.append(i_char.name); + set_char_select(); - sorted_pair_list.sort(); + show(); - for (QString i_name : sorted_pair_list) { - ui_pair_list->addItem(i_name); - } + ui_spectator->show(); } -void Courtroom::set_widgets() +void Courtroom::set_background(QString p_background, bool display) { - blip_rate = ao_app->read_blip_rate(); - blank_blip = ao_app->get_blank_blip(); - - QString filename = "courtroom_design.ini"; + ui_vp_testimony->stop(); + current_background = p_background; + + // welcome to hardcode central may I take your order of regularly scheduled + // CBT + QMap default_pos; + default_pos["defenseempty"] = "def"; + default_pos["helperstand"] = "hld"; + default_pos["prosecutorempty"] = "pro"; + default_pos["prohelperstand"] = "hlp"; + default_pos["witnessempty"] = "wit"; + default_pos["judgestand"] = "jud"; + default_pos["jurystand"] = "jur"; + default_pos["seancestand"] = "sea"; + + // Populate the dropdown list with all pos that exist on this bg + QStringList pos_list = {}; + for (QString key : default_pos.keys()) { + if (file_exists(ao_app->get_static_image_suffix( + ao_app->get_background_path(key)))) { + pos_list.append(default_pos[key]); + } + } + + // TODO: search through extra/custom pos and add them to the pos dropdown as + // well + + set_pos_dropdown(pos_list); + + is_ao2_bg = true; + + 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"); + } + + if (display) { + ui_vp_speedlines->stop(); + ui_vp_player_char->stop(); - pos_size_type f_courtroom = ao_app->get_element_dimensions("courtroom", filename); + ui_vp_sideplayer_char->stop(); + ui_vp_effect->stop(); + ui_vp_message->hide(); + ui_vp_chatbox->hide(); - if (f_courtroom.width < 0 || f_courtroom.height < 0) { - qDebug() << "W: did not find courtroom width or height in " << filename; + // Stop the chat arrow from animating + ui_vp_chat_arrow->stop(); - this->resize(714, 668); - } - else { - m_courtroom_width = f_courtroom.width; - m_courtroom_height = f_courtroom.height; + text_state = 2; + anim_state = 3; + ui_vp_objection->stop(); + chat_tick_timer->stop(); + ui_vp_evidence_display->reset(); + set_scene( + QString::number(ao_app->get_desk_mod(current_char, current_emote)), + current_side); + } +} - this->resize(f_courtroom.width, f_courtroom.height); - } +void Courtroom::set_side(QString p_side) +{ + if (p_side == "") + current_side = ao_app->get_char_side(current_char); + else + current_side = p_side; - set_fonts(); + for (int i = 0; i < ui_pos_dropdown->count(); ++i) { + QString pos = ui_pos_dropdown->itemText(i); + if (pos == current_side) { + // Block the signals to prevent setCurrentIndex from triggering a pos + // change + ui_pos_dropdown->blockSignals(true); - ui_background->move(0, 0); - ui_background->resize(m_courtroom_width, m_courtroom_height); - ui_background->set_image("courtroombackground"); + // Set the index on dropdown ui element to let you know what pos you're on + // right now + ui_pos_dropdown->setCurrentIndex(i); - set_size_and_pos(ui_viewport, "viewport"); + // Unblock the signals so the element can be used for setting pos again + ui_pos_dropdown->blockSignals(false); - // 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); + // alright we dun, jobs done here boyos + break; } + } +} - if (ao_app->casing_alerts_enabled) { - ui_announce_casing->show(); - ui_casing->show(); - } - else { - ui_announce_casing->hide(); - ui_casing->hide(); - } +void Courtroom::set_pos_dropdown(QStringList pos_dropdowns) +{ + // Block the signals to prevent setCurrentIndex from triggering a pos change + ui_pos_dropdown->blockSignals(true); + pos_dropdown_list = pos_dropdowns; + ui_pos_dropdown->clear(); + ui_pos_dropdown->addItems(pos_dropdown_list); + // Unblock the signals so the element can be used for setting pos again + ui_pos_dropdown->blockSignals(false); + + qDebug() << pos_dropdown_list; +} + +void Courtroom::update_character(int p_cid) +{ + bool newchar = m_cid != p_cid; + + m_cid = p_cid; + + 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_side = ao_app->get_char_side(current_char); + + current_emote_page = 0; + current_emote = 0; + + if (m_cid == -1) + ui_emotes->hide(); + else + ui_emotes->show(); + + refresh_emotes(); + set_emote_page(); + set_emote_dropdown(); + + set_sfx_dropdown(); + set_effects_dropdown(); + + qDebug() << "update_character called"; + if (newchar) // Avoid infinite loop of death and suffering + set_iniswap_dropdown(); + + if (current_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 && + file_exists(ao_app->get_image_suffix( + ao_app->get_character_path(current_char, "custom")))) + ui_custom_objection->show(); + else + ui_custom_objection->hide(); + + ui_char_select_background->hide(); + ui_ic_chat_message->setEnabled(m_cid != -1); + ui_ic_chat_message->setFocus(); +} - // 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(); +void Courtroom::enter_courtroom() +{ + set_widgets(); - ui_vp_background->move(0, 0); - ui_vp_background->combo_resize(ui_viewport->width(), ui_viewport->height()); + current_evidence_page = 0; + current_evidence = 0; - ui_vp_speedlines->move(0, 0); - ui_vp_speedlines->combo_resize(ui_viewport->width(), ui_viewport->height()); + set_evidence_page(); - ui_vp_player_char->move(0, 0); - ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height()); + if (ao_app->flipping_enabled) + ui_flip->show(); + else + ui_flip->hide(); - ui_vp_sideplayer_char->move(0, 0); - ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), ui_viewport->height()); + if (ao_app->additive_enabled) + ui_additive->show(); + else + ui_additive->hide(); - //the AO2 desk element - ui_vp_desk->move(0, 0); - ui_vp_desk->combo_resize(ui_viewport->width(), ui_viewport->height()); + if (ao_app->casing_alerts_enabled) + ui_casing->show(); + else + ui_casing->hide(); - //the size of the ui_vp_legacy_desk element relies on various factors and is set in set_scene() + list_music(); + list_areas(); - 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(); + music_player->set_volume(ui_music_slider->value(), 0); // set music + // Set the ambience and other misc. music layers + for (int i = 1; i < music_player->m_channelmax; ++i) { + music_player->set_volume(ui_sfx_slider->value(), i); + } + sfx_player->set_volume(ui_sfx_slider->value()); + objection_player->set_volume(ui_sfx_slider->value()); + blip_player->set_volume(ui_blip_slider->value()); - ui_vp_evidence_display->move(0, 0); - ui_vp_evidence_display->combo_resize(ui_viewport->width(), ui_viewport->height()); + ui_vp_testimony->stop(); + // ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); +} - ui_vp_chat_arrow->move(0, 0); - pos_size_type design_ini_result = ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini"); +// Todo: multithread this due to some servers having large as hell music list +void Courtroom::list_music() +{ + ui_music_list->clear(); + // ui_music_search->setText(""); - if (design_ini_result.width < 0 || design_ini_result.height < 0) { - qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; - ui_vp_chat_arrow->hide(); - } - else { - ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); - ui_vp_chat_arrow->combo_resize(design_ini_result.width, design_ini_result.height); - } + QString f_file = "courtroom_design.ini"; - ui_vp_testimony->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_testimony->combo_resize(ui_viewport->width(), ui_viewport->height()); + QBrush found_brush(ao_app->get_color("found_song_color", f_file)); + QBrush missing_brush(ao_app->get_color("missing_song_color", f_file)); - ui_vp_effect->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_effect->combo_resize(ui_viewport->width(), ui_viewport->height()); + int n_listed_songs = 0; - ui_vp_wtce->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_wtce->combo_resize(ui_viewport->width(), ui_viewport->height()); + 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)); - ui_vp_objection->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_objection->combo_resize(ui_viewport->width(), ui_viewport->height()); + QTreeWidgetItem *treeItem; + if (i_song_listname != i_song && + parent != nullptr) // not a category, parent exists + treeItem = new QTreeWidgetItem(parent); + else + treeItem = new QTreeWidgetItem(ui_music_list); + treeItem->setText(0, i_song_listname); + treeItem->setText(1, i_song); - set_size_and_pos(ui_ic_chatlog, "ic_chatlog"); - ui_ic_chatlog->setFrameShape(QFrame::NoFrame); + QString song_path = ao_app->get_music_path(i_song); - set_size_and_pos(ui_ms_chatlog, "ms_chatlog"); - ui_ms_chatlog->setFrameShape(QFrame::NoFrame); + 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; + } + + ui_music_list->expandAll(); // Needs to somehow remember which categories were + // expanded/collapsed if the music list didn't + // change since last time + if (ui_music_search->text() != "") { + on_music_search_edited(ui_music_search->text()); + } +} - set_size_and_pos(ui_server_chatlog, "server_chatlog"); - ui_server_chatlog->setFrameShape(QFrame::NoFrame); +// Todo: multithread this due to some servers having large as hell area list +void Courtroom::list_areas() +{ + ui_area_list->clear(); + // ui_music_search->setText(""); - set_size_and_pos(ui_mute_list, "mute_list"); - ui_mute_list->hide(); + QString f_file = "courtroom_design.ini"; - set_size_and_pos(ui_pair_list, "pair_list"); - ui_pair_list->hide(); - ui_pair_list->setToolTip(tr("Select a character you wish to pair with.")); + 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)); - set_size_and_pos(ui_pair_offset_spinbox, "pair_offset_spinbox"); - ui_pair_offset_spinbox->hide(); - ui_pair_offset_spinbox->setToolTip(tr("Change the percentage offset of your character's position from the center of the screen.")); + int n_listed_areas = 0; - ui_pair_order_dropdown->hide(); - set_size_and_pos(ui_pair_order_dropdown, "pair_order_dropdown"); - ui_pair_offset_spinbox->setToolTip(tr("Change the order of appearance for your character.")); + for (int n_area = 0; n_area < area_list.size(); ++n_area) { + QString i_area = ""; + i_area.append(area_list.at(n_area)); - set_size_and_pos(ui_pair_button, "pair_button"); - ui_pair_button->set_image("pair_button"); - ui_pair_button->setToolTip(tr("Display the list of characters to pair with.")); + if (ao_app->arup_enabled) { + i_area.prepend("[" + QString::number(n_area) + "] "); // Give it the index - set_size_and_pos(ui_area_list, "music_list"); - ui_area_list->header()->setMinimumSectionSize(ui_area_list->width()); + i_area.append("\n "); - set_size_and_pos(ui_music_list, "music_list"); - ui_music_list->header()->setMinimumSectionSize(ui_music_list->width()); + i_area.append(arup_statuses.at(n_area)); + i_area.append(" | CM: "); + i_area.append(arup_cms.at(n_area)); - set_size_and_pos(ui_music_name, "music_name"); + i_area.append("\n "); - ui_music_display->move(0, 0); - design_ini_result = ao_app->get_element_dimensions("music_display", "courtroom_design.ini"); + i_area.append(QString::number(arup_players.at(n_area))); + i_area.append(" users | "); - if (design_ini_result.width < 0 || design_ini_result.height < 0) { - qDebug() << "W: could not find \"music_name\" in courtroom_design.ini"; - ui_music_display->hide(); - } - else { - ui_music_display->move(design_ini_result.x, design_ini_result.y); - ui_music_display->combo_resize(design_ini_result.width, design_ini_result.height); + i_area.append(arup_locks.at(n_area)); } - ui_music_display->play("music_display"); + QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_area_list); + treeItem->setText(0, area_list.at(n_area)); + treeItem->setText(1, i_area); - 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"); + if (ao_app->arup_enabled) { + // Coloring logic here. + treeItem->setBackground(1, free_brush); + if (arup_locks.at(n_area) == "LOCKED") { + treeItem->setBackground(1, locked_brush); + } + else { + if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") + treeItem->setBackground(1, lfp_brush); + else if (arup_statuses.at(n_area) == "CASING") + treeItem->setBackground(1, casing_brush); + else if (arup_statuses.at(n_area) == "RECESS") + treeItem->setBackground(1, recess_brush); + else if (arup_statuses.at(n_area) == "RP") + treeItem->setBackground(1, rp_brush); + else if (arup_statuses.at(n_area) == "GAMING") + treeItem->setBackground(1, gaming_brush); + } } 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"); + treeItem->setBackground(1, free_brush); } - 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);}"); + ++n_listed_areas; + } - ui_vp_chatbox->set_image("chatblank"); - ui_vp_chatbox->hide(); + if (ui_music_search->text() != "") { + on_music_search_edited(ui_music_search->text()); + } +} - set_size_and_pos(ui_vp_showname, "showname"); +void Courtroom::append_ms_chatmessage(QString f_name, QString f_message) +{ + ui_ms_chatlog->append_chatmessage( + f_name, f_message, + ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini") + .name()); +} - set_size_and_pos(ui_vp_message, "message"); - ui_vp_message->hide(); +void Courtroom::append_server_chatmessage(QString p_name, QString p_message, + QString p_color) +{ + QString color = "#000000"; - //We detached the text as parent from the chatbox so it doesn't get affected by the screenshake. - ui_vp_message->move(ui_vp_message->x() + ui_vp_chatbox->x(), ui_vp_message->y() + ui_vp_chatbox->y()); - ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); + if (p_color == "0") + color = ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini") + .name(); + if (p_color == "1") + color = + ao_app->get_color("server_chatlog_sender_color", "courtroom_fonts.ini") + .name(); + if (p_message == "Logged in as a moderator.") { + ui_guard->show(); + append_server_chatmessage( + "CLIENT", "You were granted the Disable Modcalls button.", "1"); + } - ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); - ui_muted->set_image("muted"); - ui_muted->setToolTip(tr("Oops, you're muted!")); + ui_server_chatlog->append_chatmessage(p_name, p_message, color); +} - set_size_and_pos(ui_ooc_chat_message, "ooc_chat_message"); - ui_ooc_chat_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); +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; + + if (current_side == "") + current_side = ao_app->get_char_side(current_char); - set_size_and_pos(ui_ooc_chat_name, "ooc_chat_name"); - ui_ooc_chat_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); + QString f_desk_mod = "chat"; - //set_size_and_pos(ui_area_password, "area_password"); - set_size_and_pos(ui_music_search, "music_search"); - ui_music_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); + 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"; + } - set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); - ui_emote_dropdown->setToolTip(tr("Set your character's emote to play on your next message.")); + packet_contents.append(f_desk_mod); - set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); - ui_pos_dropdown->setToolTip(tr("Set your character's supplementary background.")); + packet_contents.append(ao_app->get_pre_emote(current_char, current_emote)); - set_size_and_pos(ui_iniswap_dropdown, "iniswap_dropdown"); - ui_iniswap_dropdown->setEditable(true); - ui_iniswap_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); - ui_iniswap_dropdown->setToolTip(tr("Set an 'iniswap', or an alternative character folder to refer to from your current character.\n" - "Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters//iniswaps.ini")); + packet_contents.append(current_char); - set_size_and_pos(ui_iniswap_remove, "iniswap_remove"); - ui_iniswap_remove->setText("X"); - ui_iniswap_remove->set_image("evidencex"); - ui_iniswap_remove->setToolTip(tr("Remove the currently selected iniswap from the list and return to the original character folder.")); - ui_iniswap_remove->hide(); + packet_contents.append(ao_app->get_emote(current_char, current_emote)); - set_size_and_pos(ui_sfx_dropdown, "sfx_dropdown"); - ui_sfx_dropdown->setEditable(true); - ui_sfx_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); - ui_sfx_dropdown->setToolTip(tr("Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any).\n" - "Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters//soundlist.ini")); + packet_contents.append(ui_ic_chat_message->text()); - set_size_and_pos(ui_sfx_remove, "sfx_remove"); - ui_sfx_remove->setText("X"); - ui_sfx_remove->set_image("evidencex"); - ui_sfx_remove->setToolTip(tr("Remove the currently selected iniswap from the list and return to the original character folder.")); - ui_sfx_remove->hide(); + packet_contents.append(current_side); - set_size_and_pos(ui_effects_dropdown, "effects_dropdown"); - ui_effects_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); - ui_effects_dropdown->setToolTip(tr("Choose an effect to play on your next spoken message.\n" - "The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by\n" - "char.ini [Options] category, effects = 'miscname' where it referes to misc//effects.ini to read the effects.")); - //Todo: recode this entire fucking system with these dumbass goddamn ini's why is everything so specifically coded for all these purposes - //is ABSTRACT CODING not a thing now huh what the FUCK why do I gotta do this pleASE FOR THE LOVE OF GOD SPARE ME FROM THIS FRESH HELL - //btw i still love coding. - QPoint p_point = ao_app->get_button_spacing("effects_icon_size", filename); - ui_effects_dropdown->setIconSize(QSize(p_point.x(), p_point.y())); - - set_size_and_pos(ui_defense_bar, "defense_bar"); - ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state)); - - set_size_and_pos(ui_prosecution_bar, "prosecution_bar"); - ui_prosecution_bar->set_image("prosecutionbar" + QString::number(prosecution_bar_state)); - - 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_hold_it, "hold_it"); - ui_hold_it->setText(tr("Hold It!")); - ui_hold_it->setToolTip(tr("When this is turned on, your next in-character message will be a shout!")); - ui_hold_it->set_image("holdit"); + packet_contents.append(get_char_sfx()); + if (ui_pre->isChecked() && !ao_app->is_stickysounds_enabled()) { + ui_sfx_dropdown->blockSignals(true); + ui_sfx_dropdown->setCurrentIndex(0); + ui_sfx_dropdown->blockSignals(false); + ui_sfx_remove->hide(); + } + + 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 == 4 || f_emote_mod == 5) + 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(get_char_sfx_delay())); + + QString f_obj_state; + + if ((objection_state == 4 && !ao_app->custom_objection_enabled) || + (objection_state < 0)) + f_obj_state = "0"; + 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); - set_size_and_pos(ui_objection, "objection"); - ui_objection->setText(tr("Objection!")); - ui_objection->setToolTip(tr("When this is turned on, your next in-character message will be a shout!")); - ui_objection->set_image("objection"); + packet_contents.append(f_flip); - set_size_and_pos(ui_take_that, "take_that"); - ui_take_that->setText(tr("Take That!")); - ui_take_that->setToolTip(tr("When this is turned on, your next in-character message will be a shout!")); - ui_take_that->set_image("takethat"); + packet_contents.append(QString::number(realization_state)); - set_size_and_pos(ui_ooc_toggle, "ooc_toggle"); - ui_ooc_toggle->setText(tr("Server")); - ui_ooc_toggle->setToolTip(tr("Toggle between server chat and global AO2 chat.")); - - set_size_and_pos(ui_witness_testimony, "witness_testimony"); - ui_witness_testimony->set_image("witnesstestimony"); - ui_witness_testimony->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); - set_size_and_pos(ui_cross_examination, "cross_examination"); - ui_cross_examination->set_image("crossexamination"); - ui_cross_examination->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); - - set_size_and_pos(ui_guilty, "guilty"); - ui_guilty->setText(tr("Guilty!")); - ui_guilty->set_image("guilty"); - ui_guilty->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); - set_size_and_pos(ui_not_guilty, "not_guilty"); - ui_not_guilty->set_image("notguilty"); - ui_not_guilty->setToolTip(tr("This will display the animation in the viewport as soon as it is pressed.")); - - set_size_and_pos(ui_change_character, "change_character"); - ui_change_character->setText(tr("Change character")); - ui_change_character->set_image("change_character"); - ui_change_character->setToolTip(tr("Bring up the Character Select Screen and change your character.")); - - set_size_and_pos(ui_reload_theme, "reload_theme"); - ui_reload_theme->setText(tr("Reload theme")); - ui_reload_theme->set_image("reload_theme"); - ui_reload_theme->setToolTip(tr("Refresh the theme and update all of the ui elements to match.")); - - set_size_and_pos(ui_call_mod, "call_mod"); - ui_call_mod->setText(tr("Call mod")); - ui_call_mod->set_image("call_mod"); - ui_call_mod->setToolTip(tr("Request the attention of the current server's moderator.")); - - set_size_and_pos(ui_settings, "settings"); - ui_settings->setText(tr("Settings")); - ui_settings->set_image("settings"); - ui_settings->setToolTip(tr("Allows you to change various aspects of the client.")); - - set_size_and_pos(ui_announce_casing, "casing_button"); - ui_announce_casing->setText(tr("Casing")); - ui_announce_casing->set_image("casing_button"); - ui_announce_casing->setToolTip(tr("An interface to help you announce a case (you have to be a CM first to be able to announce cases)")); - - set_size_and_pos(ui_switch_area_music, "switch_area_music"); - ui_switch_area_music->setText(tr("A/M")); - ui_switch_area_music->set_image("switch_area_music"); - ui_switch_area_music->setToolTip(tr("Switch between Areas and Music lists")); - - set_size_and_pos(ui_pre, "pre"); - ui_pre->setText(tr("Preanim")); - ui_pre->setToolTip(tr("Play a single-shot animation as defined by the emote when checked.")); - - set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); - ui_pre_non_interrupt->setToolTip(tr("If preanim is checked, display the input text immediately as the animation plays concurrently.")); - - set_size_and_pos(ui_flip, "flip"); - ui_flip->setToolTip(tr("Mirror your character's emotes when checked.")); - - set_size_and_pos(ui_additive, "additive"); - ui_additive->setToolTip(tr("Add text to your last spoken message when checked.")); - - set_size_and_pos(ui_guard, "guard"); - ui_guard->setToolTip(tr("Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window.")); - - set_size_and_pos(ui_casing, "casing"); - ui_casing->setToolTip(tr("Lets you receive case alerts when enabled.\n" - "(You can set your preferences in the Settings!)")); - - set_size_and_pos(ui_showname_enable, "showname_enable"); - ui_showname_enable->setToolTip(tr("Display customized shownames for all users when checked.")); - - set_size_and_pos(ui_custom_objection, "custom_objection"); - ui_custom_objection->setText(tr("Custom Shout!")); - ui_custom_objection->set_image("custom"); - ui_custom_objection->setToolTip(tr("This will display the custom character-defined animation in the viewport as soon as it is pressed.\n" - "To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect")); + QString f_text_color; - set_size_and_pos(ui_realization, "realization"); - ui_realization->set_image("realization"); - ui_realization->setToolTip(tr("Play realization sound and animation in the viewport on the next spoken message when checked.")); + if (text_color < 0) + f_text_color = "0"; + else if (text_color > max_colors) + f_text_color = "0"; + else + f_text_color = QString::number(text_color); - set_size_and_pos(ui_screenshake, "screenshake"); - ui_screenshake->set_image("screenshake"); - ui_screenshake->setToolTip(tr("Shake the screen on next spoken message when checked.")); + packet_contents.append(f_text_color); - set_size_and_pos(ui_mute, "mute_button"); - ui_mute->setText("Mute"); - ui_mute->set_image("mute"); - ui_mute->setToolTip(tr("Display the list of character folders you wish to mute.")); + // 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(""); + } - set_size_and_pos(ui_defense_plus, "defense_plus"); - ui_defense_plus->set_image("defplus"); - ui_defense_plus->setToolTip(tr("Increase the health bar.")); + // 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) { + QString packet = QString::number(other_charid); + if (ao_app->effects_enabled) // Only servers with effects enabled will + // support pair reordering + packet += "^" + QString::number(pair_order); + packet_contents.append(packet); + } + else { + packet_contents.append("-1"); + } + // Send the offset as it's gonna be used regardless + packet_contents.append(QString::number(char_offset)); - set_size_and_pos(ui_defense_minus, "defense_minus"); - ui_defense_minus->set_image("defminus"); - ui_defense_minus->setToolTip(tr("Decrease the health bar.")); + // 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( + "0"); // ao_app->get_sfx_looping(current_char, current_emote)); + packet_contents.append(QString::number(screenshake_state)); + + QString pre_emote = ao_app->get_pre_emote(current_char, current_emote); + QString emote = ao_app->get_emote(current_char, current_emote); + QStringList emotes_to_check = {pre_emote, "(b)" + emote, "(a)" + emote}; + QStringList effects_to_check = {"_FrameScreenshake", "_FrameRealization", + "_FrameSFX"}; + + foreach (QString f_effect, effects_to_check) { + QString packet; + foreach (QString f_emote, emotes_to_check) { + packet += f_emote; + if (ao_app->is_frame_network_enabled()) { + QString sfx_frames = + ao_app + ->read_ini_tags( + ao_app->get_character_path(current_char, "char.ini"), + f_emote.append(f_effect)) + .join("|"); + if (sfx_frames != "") + packet += "|" + sfx_frames; + } + packet += "^"; + } + packet_contents.append(packet); + } + } - set_size_and_pos(ui_prosecution_plus, "prosecution_plus"); - ui_prosecution_plus->set_image("proplus"); - ui_prosecution_plus->setToolTip(tr("Increase the health bar.")); + if (ao_app->additive_enabled) { + packet_contents.append(ui_additive->isChecked() ? "1" : "0"); + } + if (ao_app->effects_enabled) { + QString fx_sound = ao_app->get_effect_sound(effect, current_char); + QString p_effect = + ao_app->read_char_ini(current_char, "effects", "Options"); + packet_contents.append(effect + "|" + p_effect + "|" + fx_sound); + if (!ao_app->is_stickyeffects_enabled()) { + ui_effects_dropdown->blockSignals(true); + ui_effects_dropdown->setCurrentIndex(0); + ui_effects_dropdown->blockSignals(false); + effect = ""; + } + } - set_size_and_pos(ui_prosecution_minus, "prosecution_minus"); - ui_prosecution_minus->set_image("prominus"); - ui_prosecution_minus->setToolTip(tr("Decrease the health bar.")); + ao_app->send_server_packet(new AOPacket("MS", packet_contents)); +} - set_size_and_pos(ui_text_color, "text_color"); - ui_text_color->setToolTip(tr("Change the text color of the spoken message.\n" - "You can also select a part of your currently typed message and use the dropdown to change its color!")); - set_text_color_dropdown(); +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; - 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"); + for (int n_string = 0; n_string < chatmessage_size; ++n_string) { + // m_chatmessage[n_string] = p_contents->at(n_string); - ui_selector->set_image("char_selector"); - ui_selector->hide(); + // 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 (f_char_id > 0 && + (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]; + } + + if (f_showname.trimmed() + .isEmpty()) // Pure whitespace showname, get outta here. + f_showname = m_chatmessage[CHAR_NAME]; + + QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n'; + // Remove undesired newline chars + m_chatmessage[MESSAGE].remove("\n"); + chatmessage_is_empty = + m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; + + if (f_char_id >= 0 && !chatmessage_is_empty && + f_message == previous_ic_message) // Not a system message + return; + + if (f_char_id <= -1) + previous_ic_message = + ""; // System messages don't care about repeating themselves + else + previous_ic_message = f_message; + + // Stop the chat arrow from animating + ui_vp_chat_arrow->stop(); + + text_state = 0; + anim_state = 0; + ui_vp_objection->stop(); + chat_tick_timer->stop(); + ui_vp_evidence_display->reset(); + + // Hey, our message showed up! Cool! + if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text().remove("\n") && + m_chatmessage[CHAR_ID].toInt() == m_cid) { + ui_ic_chat_message->clear(); + if (ui_additive->isChecked()) + ui_ic_chat_message->insert(" "); + objection_state = 0; + realization_state = 0; + screenshake_state = 0; + is_presenting_evidence = false; + if (!ao_app->is_stickypres_enabled()) + ui_pre->setChecked(false); + ui_hold_it->set_image("holdit"); + ui_objection->set_image("objection"); + ui_take_that->set_image("takethat"); + ui_custom_objection->set_image("custom"); + ui_realization->set_image("realization"); + ui_screenshake->set_image("screenshake"); + ui_evidence_present->set_image("present"); + } - set_size_and_pos(ui_back_to_lobby, "back_to_lobby"); - ui_back_to_lobby->setText(tr("Back to Lobby")); - ui_back_to_lobby->setToolTip(tr("Return back to the server list.")); + // Let the server handle actually checking if they're allowed to do this. + is_additive = m_chatmessage[ADDITIVE].toInt() == 1; - set_size_and_pos(ui_char_password, "char_password"); + QString f_charname = ""; + if (f_char_id >= 0) + f_charname = ao_app->get_showname(char_list.at(f_char_id).name); - set_size_and_pos(ui_char_buttons, "char_buttons"); + chatlogpiece *temp = + new chatlogpiece(f_charname, f_showname, m_chatmessage[MESSAGE], false); + ic_chatlog_history.append(*temp); + ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); - set_size_and_pos(ui_char_select_left, "char_select_left"); - ui_char_select_left->set_image("arrow_left"); + while (ic_chatlog_history.size() > log_maximum_blocks && + log_maximum_blocks > 0) { + ic_chatlog_history.removeFirst(); + } - set_size_and_pos(ui_char_select_right, "char_select_right"); - ui_char_select_right->set_image("arrow_right"); + append_ic_text(m_chatmessage[MESSAGE], f_showname); - set_size_and_pos(ui_spectator, "spectator"); - ui_spectator->setToolTip(tr("Become a spectator. You won't be able to interact with the in-character screen.")); + int objection_mod = m_chatmessage[OBJECTION_MOD].toInt(); + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_custom_theme = ao_app->get_char_shouts(f_char); - refresh_evidence(); -} + // if an objection is used + if (objection_mod <= 4 && objection_mod >= 1) { + switch (objection_mod) { + case 1: + ui_vp_objection->play("holdit_bubble", f_char, f_custom_theme, 724); + objection_player->play("holdit", f_char, f_custom_theme); + break; + case 2: + ui_vp_objection->play("objection_bubble", f_char, f_custom_theme, 724); + objection_player->play("objection", f_char, f_custom_theme); + if (ao_app->objection_stop_music()) + music_player->stop(); + break; + case 3: + ui_vp_objection->play("takethat_bubble", f_char, f_custom_theme, 724); + objection_player->play("takethat", f_char, f_custom_theme); + break; + // case 4 is AO2 only + case 4: + ui_vp_objection->play("custom", f_char, f_custom_theme, 724); + objection_player->play("custom", f_char, f_custom_theme); + break; + default: + qDebug() << "W: Logic error in objection switch statement!"; + } + sfx_player->clear(); // Objection played! Cut all sfx. + int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); -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_font(ui_music_name, "", "music_name"); - - set_dropdowns(); + if (emote_mod == 0) + m_chatmessage[EMOTE_MOD] = 1; + } + else + handle_chatmessage_2(); } -void Courtroom::set_font(QWidget *widget, QString class_name, QString p_identifier) -{ - QString design_file = "courtroom_fonts.ini"; - int f_pointsize = ao_app->get_font_size(p_identifier, design_file); - QString font_name = ao_app->get_font_name(p_identifier + "_font", design_file); - QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? - bool antialias = ao_app->get_font_size(p_identifier + "_sharp", design_file) != 1; // is the font anti-aliased or not? - - this->set_qfont(widget, class_name, get_qfont(font_name, f_pointsize, antialias), f_color, bold); -} +void Courtroom::objection_done() { handle_chatmessage_2(); } -QFont Courtroom::get_qfont(QString font_name, int f_pointsize, bool antialias) +void Courtroom::handle_chatmessage_2() { - QFont font; - if (font_name.isEmpty()) - font_name = "Arial"; - - QFont::StyleStrategy style_strategy = QFont::PreferDefault; - if (!antialias) - style_strategy = QFont::NoAntialias; - - font = QFont(font_name, f_pointsize); - font.setStyleHint(QFont::SansSerif, style_strategy); - return font; -} + ui_vp_speedlines->stop(); + ui_vp_player_char->stop(); + ui_vp_effect->stop(); + // Clear all looping sfx to prevent obnoxiousness + sfx_player->loop_clear(); + + if (!m_chatmessage[FRAME_SFX].isEmpty() && + ao_app->is_frame_network_enabled()) { + // ORDER IS IMPORTANT!! + QStringList netstrings = {m_chatmessage[FRAME_SCREENSHAKE], + m_chatmessage[FRAME_REALIZATION], + m_chatmessage[FRAME_SFX]}; + ui_vp_player_char->network_strings = netstrings; + } + else + ui_vp_player_char->network_strings.clear(); + + int f_charid = m_chatmessage[CHAR_ID].toInt(); + if (f_charid >= 0 && + (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())) { + QString real_name = char_list.at(f_charid).name; + + QString f_showname = ao_app->get_showname(real_name); + + ui_vp_showname->setText(f_showname); + } + else { + ui_vp_showname->setText(m_chatmessage[SHOWNAME]); + } + + if (ui_vp_showname->text().trimmed().isEmpty()) // Whitespace showname + { + ui_vp_chatbox->set_image("chatblank"); + } + else // Aw yeah dude do some showname resizing magic + { + if (!ui_vp_chatbox->set_image("chat")) + ui_vp_chatbox->set_image("chatbox"); + + QFontMetrics fm(ui_vp_showname->font()); + int fm_width = fm.horizontalAdvance(ui_vp_showname->text()); + + QString chatbox_path = ao_app->get_theme_path("chat"); + QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); + if (chatbox != "") { + chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat"; + if (!ui_vp_chatbox->set_chatbox(chatbox_path)) + ui_vp_chatbox->set_chatbox(chatbox_path + "box"); + + pos_size_type design_ini_result = ao_app->get_element_dimensions( + "chat_arrow", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); + if (design_ini_result.width < 0 || design_ini_result.height < 0) { + qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; + ui_vp_chat_arrow->hide(); + } + else { + ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); + ui_vp_chat_arrow->combo_resize(design_ini_result.width, + design_ini_result.height); + } + } + + pos_size_type default_width = ao_app->get_element_dimensions( + "showname", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); + int extra_width = + ao_app + ->get_design_element("showname_extra_width", "courtroom_design.ini", + m_chatmessage[CHAR_NAME]) + .toInt(); + + if (extra_width > 0) { + if (fm_width > default_width.width && + ui_vp_chatbox->set_chatbox( + chatbox_path + + "med")) // This text be big. Let's do some shenanigans. + { + ui_vp_showname->resize(default_width.width + extra_width, + ui_vp_showname->height()); + if (fm_width > ui_vp_showname->width() && + ui_vp_chatbox->set_chatbox(chatbox_path + + "big")) // Biggest possible size for us. + { + ui_vp_showname->resize( + static_cast(default_width.width + (extra_width * 2)), + ui_vp_showname->height()); + } + } + else + ui_vp_showname->resize(default_width.width, ui_vp_showname->height()); + } + } + + ui_vp_message->hide(); + ui_vp_chatbox->hide(); + + // todo: put this in its own function or update + QString design_file = "courtroom_fonts.ini"; + int f_pointsize = ao_app->get_font_size("message", design_file); + QString font_name = ao_app->get_font_name("message_font", design_file); + QColor f_color = ao_app->get_color("message_color", design_file); + bool bold = ao_app->get_font_size("message_bold", design_file) == + 1; // is the font bold or not? + bool antialias = ao_app->get_font_size("message_sharp", design_file) != + 1; // is the font anti-aliased or not? + + QString chatfont = ao_app->get_chat_font(m_chatmessage[CHAR_NAME]); + if (chatfont != "") + font_name = chatfont; + + int chatsize = ao_app->get_chat_size(m_chatmessage[CHAR_NAME]); + if (chatsize != -1) + f_pointsize = chatsize; + this->set_qfont(ui_vp_message, "", + get_qfont(font_name, f_pointsize, antialias), f_color, bold); + + set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); + + 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]; + + // Making the second character appear. + if (m_chatmessage[OTHER_CHARID].isEmpty()) { + // If there is no second character, hide 'em + ui_vp_sideplayer_char->stop(); + ui_vp_sideplayer_char->move(0, 0); + } + else { + bool ok; + int got_other_charid = m_chatmessage[OTHER_CHARID].split("^")[0].toInt(&ok); + if (ok) { + if (got_other_charid > -1) { + // If there is, show them! + ui_vp_sideplayer_char->show(); + + int other_offset = m_chatmessage[OTHER_OFFSET].toInt(); + ui_vp_sideplayer_char->move(ui_viewport->width() * other_offset / 100, + 0); + + QStringList args = m_chatmessage[OTHER_CHARID].split("^"); + if (args.size() > + 1) // This ugly workaround is so we don't make an extra packet just + // for this purpose. Rewrite pairing when? + { + // Change the order of appearance based on the pair order variable + int order = args.at(1).toInt(); + switch (order) { + case 0: + ui_vp_sideplayer_char->stackUnder(ui_vp_player_char); + break; + case 1: + ui_vp_player_char->stackUnder(ui_vp_sideplayer_char); + break; + default: + break; + } + } -void Courtroom::set_qfont(QWidget *widget, QString class_name, QFont font, QColor f_color, bool bold) -{ - if (class_name.isEmpty()) - class_name = widget->metaObject()->className(); + // 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]); + } + else { + // If the server understands other characters, but there + // really is no second character, hide 'em, and center the first. + ui_vp_sideplayer_char->hide(); + ui_vp_sideplayer_char->move(0, 0); + } + } + } + // Set ourselves according to SELF_OFFSET - font.setBold(bold); - widget->setFont(font); + bool ok; + int self_offset = m_chatmessage[SELF_OFFSET].toInt(&ok); + if (ok) + ui_vp_player_char->move(ui_viewport->width() * self_offset / 100, 0); + else + ui_vp_player_char->move(0, 0); - 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); + 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::set_dropdown(QWidget *widget) +void Courtroom::do_screenshake() { - QString f_file = "courtroom_stylesheets.css"; - QString style_sheet_string = ao_app->get_stylesheet(f_file); - if (style_sheet_string != "") - widget->setStyleSheet(style_sheet_string); + if (!ao_app->is_shake_enabled()) + return; + + // This way, the animation is reset in such a way that last played screenshake + // would return to its "final frame" properly. This properly resets all UI + // elements without having to bother keeping track of "origin" positions. + // Works great wit the chat text being detached from the chat box! + screenshake_animation_group->setCurrentTime( + screenshake_animation_group->duration()); + screenshake_animation_group->clear(); + + QList affected_list = {ui_vp_background, ui_vp_player_char, + ui_vp_sideplayer_char, ui_vp_chatbox}; + + // I would prefer if this was its own "shake" function to be honest. + foreach (QWidget *ui_element, affected_list) { + QPropertyAnimation *screenshake_animation = + new QPropertyAnimation(ui_element, "pos", this); + QPoint pos_default = QPoint(ui_element->x(), ui_element->y()); + + int duration = 300; // How long does the screenshake last + int frequency = 20; // How often in ms is there a "jolt" frame + int maxframes = duration / frequency; + int max_x = 7; // Max deviation from origin on x axis + int max_y = 7; // Max deviation from origin on y axis + screenshake_animation->setDuration(duration); + for (int frame = 0; frame < maxframes; frame++) { + double fraction = double(frame * frequency) / duration; + int rng = qrand(); // QRandomGenerator::global()->generate(); + int rand_x = max_x - (int(rng) % (max_x * 2)); + int rand_y = max_y - (int(rng + 100) % (max_y * 2)); + screenshake_animation->setKeyValueAt( + fraction, QPoint(pos_default.x() + rand_x, pos_default.y() + rand_y)); + } + screenshake_animation->setEndValue(pos_default); + screenshake_animation->setEasingCurve(QEasingCurve::Linear); + screenshake_animation_group->addAnimation(screenshake_animation); + } + + screenshake_animation_group->start(); } -void Courtroom::set_dropdowns() +void Courtroom::do_flash() { - set_dropdown(this); //EXPERIMENTAL - Read the style-sheet as-is for maximum memeage - // set_dropdown(ui_text_color, "[TEXT COLOR]"); - // set_dropdown(ui_pos_dropdown, "[POS DROPDOWN]"); - // set_dropdown(ui_emote_dropdown, "[EMOTE DROPDOWN]"); - // set_dropdown(ui_mute_list, "[MUTE LIST]"); -} + if (!ao_app->is_effects_enabled()) + return; -void Courtroom::set_window_title(QString p_title) -{ - this->setWindowTitle(p_title); + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_custom_theme = ao_app->get_char_shouts(f_char); + ui_vp_effect->play("realizationflash", f_char, f_custom_theme, 60); } -void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier) +void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char, + QString p_folder) { - 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); - } -} + QString effect = ao_app->get_effect(fx_name, p_char, p_folder); + if (effect == "") + return; -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; - } + if (fx_sound != "") + sfx_player->play(fx_sound); - 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; + // Only check if effects are disabled after playing the sound if it exists + if (!ao_app->is_effects_enabled()) + return; - char_list.replace(n_char, f_char); + ui_vp_effect->set_play_once( + false); // The effects themselves dictate whether or not they're looping. + // Static effects will linger. + ui_vp_effect->play(effect); // It will set_play_once to true if the filepath + // provided is not designed to loop more than once } -QPoint Courtroom::get_theme_pos(QString p_identifier) +void Courtroom::play_char_sfx(QString sfx_name) { - 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); - } + sfx_player->play(sfx_name); + if (ao_app->get_looping_sfx()) + sfx_player->set_looping( + ao_app->get_sfx_looping(current_char, QString::number(current_emote)) != + "0"); } -void Courtroom::done_received() +void Courtroom::handle_chatmessage_3() { - m_cid = -1; + start_chat_ticking(); + + int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt(); + QString f_side = m_chatmessage[SIDE]; + + QString f_showname; + int f_char_id = m_chatmessage[CHAR_ID].toInt(); + if (f_char_id > 0 && + (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]; + } + if (f_showname.trimmed() + .isEmpty()) // Pure whitespace showname, get outta here. + f_showname = m_chatmessage[CHAR_NAME]; + + 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; + QString f_name = local_evidence_list.at(f_evi_id - 1).name; + // 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()); + append_ic_text(f_name, f_showname, "has presented evidence"); + } + + 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(); - music_player->set_volume(0); - sfx_player->set_volume(0); - objection_player->set_volume(0); - blip_player->set_volume(0); + // Since we're zooming, hide the second character, and centre the first. + ui_vp_sideplayer_char->hide(); + ui_vp_player_char->move(0, 0); - set_char_select_page(); + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_custom_theme = ao_app->get_char_shouts(f_char); + if (side == "pro" || side == "hlp" || side == "wit") + ui_vp_speedlines->play("prosecution_speedlines", f_char, f_custom_theme); + else + ui_vp_speedlines->play("defense_speedlines", f_char, f_custom_theme); + } - set_mute_list(); - set_pair_list(); + // If this color is talking + color_is_talking = + color_markdown_talking_list.at(m_chatmessage[TEXT_COLOR].toInt()); - set_char_select(); + if (color_is_talking && text_state == 1 && + anim_state < 2) // Set it to talking as we're not on that already + { + ui_vp_player_char->stop(); + ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], + m_chatmessage[EMOTE]); + anim_state = 2; + } + else if (anim_state < 3) // Set it to idle as we're not on that already + { + ui_vp_player_char->stop(); + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], + m_chatmessage[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 html, int target_pos, + int default_color) +{ + QString p_text_escaped; + + int check_pos = 0; + int check_pos_escaped = 0; + bool ic_next_is_not_special = false; + std::stack ic_color_stack; + + // Text alignment shenanigans. Could make a dropdown for this later, too! + QString align; + if (p_text.trimmed().startsWith("~~")) { + p_text.remove(p_text.indexOf("~~"), 2); + if (target_pos != -1) { + target_pos = qMax(0, target_pos - 2); + } + align = "center"; + } + else if (p_text.trimmed().startsWith("~>")) { + p_text.remove(p_text.indexOf("~>"), 2); + if (target_pos != -1) { + target_pos = qMax(0, target_pos - 2); + } + align = "right"; + } + else if (p_text.trimmed().startsWith("<>")) { + p_text.remove(p_text.indexOf("<>"), 2); + if (target_pos != -1) { + target_pos = qMax(0, target_pos - 2); + } + align = "justify"; + } + + // If html is enabled, prepare this text to be all ready for it. + if (html) { + ic_color_stack.push(default_color); + QString appendage = ""; + + if (!align.isEmpty()) + appendage.prepend("

"); + + p_text_escaped.insert(check_pos_escaped, appendage); + check_pos_escaped += appendage.size(); + } + + // Current issue: does not properly escape html stuff. + // Solution: probably parse p_text and export into a different string + // separately, perform some mumbo jumbo to properly adjust string indexes. + while (check_pos < p_text.size()) { + QString f_rest = p_text.right(p_text.size() - check_pos); + QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); + QString f_character; + int f_char_length; - show(); + tbf.toNextBoundary(); - ui_spectator->show(); -} + if (tbf.position() == -1) + f_character = f_rest; + else + f_character = f_rest.left(tbf.position()); + + // if (f_character == "&") //oh shit it's probably an escaped html + // { + // //Skip escaped chars like you would graphemes + // QRegularExpression re("&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});", + // QRegularExpression::CaseInsensitiveOption); QRegularExpressionMatch + // match = re.match(f_rest); if (match.hasMatch()) //OH SHIT IT IS, + // PANIC, PANIC + // { + // f_character = match.captured(0); //Phew, we solved the big problem + // here. + // } + // } + + if (html) + f_character = f_character.toHtmlEscaped(); -void Courtroom::set_background(QString p_background, bool display) -{ - ui_vp_testimony->stop(); - current_background = p_background; - - //welcome to hardcode central may I take your order of regularly scheduled CBT - QMap default_pos; - default_pos["defenseempty"] = "def"; - default_pos["helperstand"] = "hld"; - default_pos["prosecutorempty"] = "pro"; - default_pos["prohelperstand"] = "hlp"; - default_pos["witnessempty"] = "wit"; - default_pos["judgestand"] = "jud"; - default_pos["jurystand"] = "jur"; - default_pos["seancestand"] = "sea"; - - //Populate the dropdown list with all pos that exist on this bg - QStringList pos_list = {}; - for (QString key : default_pos.keys()) { - if (file_exists(ao_app->get_static_image_suffix(ao_app->get_background_path(key)))) { - pos_list.append(default_pos[key]); - } - } - - //TODO: search through extra/custom pos and add them to the pos dropdown as well - - set_pos_dropdown(pos_list); - - is_ao2_bg = true; - - 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"); - } - - if (display) { - ui_vp_speedlines->stop(); - ui_vp_player_char->stop(); - - ui_vp_sideplayer_char->stop(); - ui_vp_effect->stop(); - ui_vp_message->hide(); - ui_vp_chatbox->hide(); - - //Stop the chat arrow from animating - ui_vp_chat_arrow->stop(); - - text_state = 2; - anim_state = 3; - ui_vp_objection->stop(); - chat_tick_timer->stop(); - ui_vp_evidence_display->reset(); - set_scene(QString::number(ao_app->get_desk_mod(current_char, current_emote)), current_side); - } -} - -void Courtroom::set_side(QString p_side) -{ - if (p_side == "") - current_side = ao_app->get_char_side(current_char); - else - current_side = p_side; - - for (int i = 0; i < ui_pos_dropdown->count(); ++i) { - QString pos = ui_pos_dropdown->itemText(i); - if (pos == current_side) { - //Block the signals to prevent setCurrentIndex from triggering a pos change - ui_pos_dropdown->blockSignals(true); - - //Set the index on dropdown ui element to let you know what pos you're on right now - ui_pos_dropdown->setCurrentIndex(i); - - //Unblock the signals so the element can be used for setting pos again - ui_pos_dropdown->blockSignals(false); - - //alright we dun, jobs done here boyos - break; - } - } -} - -void Courtroom::set_pos_dropdown(QStringList pos_dropdowns) -{ - //Block the signals to prevent setCurrentIndex from triggering a pos change - ui_pos_dropdown->blockSignals(true); - pos_dropdown_list = pos_dropdowns; - ui_pos_dropdown->clear(); - ui_pos_dropdown->addItems(pos_dropdown_list); - //Unblock the signals so the element can be used for setting pos again - ui_pos_dropdown->blockSignals(false); - - qDebug() << pos_dropdown_list; -} - -void Courtroom::update_character(int p_cid) -{ - bool newchar = m_cid != p_cid; - - m_cid = p_cid; - - 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_side = ao_app->get_char_side(current_char); - - current_emote_page = 0; - current_emote = 0; - - if (m_cid == -1) - ui_emotes->hide(); - else - ui_emotes->show(); - - refresh_emotes(); - set_emote_page(); - set_emote_dropdown(); - - set_sfx_dropdown(); - set_effects_dropdown(); - - qDebug() << "update_character called"; - if (newchar) //Avoid infinite loop of death and suffering - set_iniswap_dropdown(); - - if (current_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 && file_exists(ao_app->get_image_suffix(ao_app->get_character_path(current_char, "custom")))) - ui_custom_objection->show(); - else - ui_custom_objection->hide(); - - ui_char_select_background->hide(); - ui_ic_chat_message->setEnabled(m_cid != -1); - ui_ic_chat_message->setFocus(); -} - -void Courtroom::enter_courtroom() -{ - set_widgets(); - - current_evidence_page = 0; - current_evidence = 0; - - set_evidence_page(); - - if (ao_app->flipping_enabled) - ui_flip->show(); - else - ui_flip->hide(); - - if (ao_app->additive_enabled) - ui_additive->show(); - else - ui_additive->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(), 0); //set music - //Set the ambience and other misc. music layers - for (int i = 1; i < music_player->m_channelmax; ++i) { - music_player->set_volume(ui_sfx_slider->value(), i); - } - sfx_player->set_volume(ui_sfx_slider->value()); - objection_player->set_volume(ui_sfx_slider->value()); - blip_player->set_volume(ui_blip_slider->value()); - - ui_vp_testimony->stop(); - //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); -} - -//Todo: multithread this due to some servers having large as hell music list -void Courtroom::list_music() -{ - ui_music_list->clear(); - // ui_music_search->setText(""); - - 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_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) //not a category, parent exists - treeItem = new QTreeWidgetItem(parent); - else - 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)) - 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; - } - - ui_music_list->expandAll(); //Needs to somehow remember which categories were expanded/collapsed if the music list didn't change since last time - if (ui_music_search->text() != "") { - on_music_search_edited(ui_music_search->text()); - } -} - -//Todo: multithread this due to some servers having large as hell area list -void Courtroom::list_areas() -{ - ui_area_list->clear(); - // ui_music_search->setText(""); - - 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(area_list.at(n_area)); - - if (ao_app->arup_enabled) { - i_area.prepend("[" + QString::number(n_area) + "] "); //Give it the index - - 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)); - } - - QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_area_list); - treeItem->setText(0, area_list.at(n_area)); - treeItem->setText(1, i_area); - - if (ao_app->arup_enabled) { - // Coloring logic here. - treeItem->setBackground(1, free_brush); - if (arup_locks.at(n_area) == "LOCKED") { - treeItem->setBackground(1, locked_brush); - } - else { - if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") - treeItem->setBackground(1, lfp_brush); - else if (arup_statuses.at(n_area) == "CASING") - treeItem->setBackground(1, casing_brush); - else if (arup_statuses.at(n_area) == "RECESS") - treeItem->setBackground(1, recess_brush); - else if (arup_statuses.at(n_area) == "RP") - treeItem->setBackground(1, rp_brush); - else if (arup_statuses.at(n_area) == "GAMING") - treeItem->setBackground(1, gaming_brush); - } - } - else { - treeItem->setBackground(1, free_brush); - } - - ++n_listed_areas; - } - - if (ui_music_search->text() != "") { - on_music_search_edited(ui_music_search->text()); - } -} - -void Courtroom::append_ms_chatmessage(QString f_name, QString f_message) -{ - ui_ms_chatlog->append_chatmessage(f_name, f_message, ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini").name()); -} - -void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QString p_color) -{ - QString color = "#000000"; - - if (p_color == "0") - color = ao_app->get_color("ms_chatlog_sender_color", "courtroom_fonts.ini").name(); - if (p_color == "1") - color = ao_app->get_color("server_chatlog_sender_color", "courtroom_fonts.ini").name(); - if (p_message == "Logged in as a moderator.") { - ui_guard->show(); - append_server_chatmessage("CLIENT", "You were granted the Disable Modcalls button.", "1"); - } - - ui_server_chatlog->append_chatmessage(p_name, p_message, color); -} - -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; - - if (current_side == "") - current_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(current_side); - - packet_contents.append(get_char_sfx()); - if (ui_pre->isChecked() && !ao_app->is_stickysounds_enabled()) { - ui_sfx_dropdown->blockSignals(true); - ui_sfx_dropdown->setCurrentIndex(0); - ui_sfx_dropdown->blockSignals(false); - ui_sfx_remove->hide(); - } - - 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 == 4 || f_emote_mod == 5) - 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(get_char_sfx_delay())); - - QString f_obj_state; - - if ((objection_state == 4 && !ao_app->custom_objection_enabled) || - (objection_state < 0)) - f_obj_state = "0"; - 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 > max_colors) - 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) { - QString packet = QString::number(other_charid); - if (ao_app->effects_enabled) //Only servers with effects enabled will support pair reordering - packet += "^" + QString::number(pair_order); - packet_contents.append(packet); - } - else { - packet_contents.append("-1"); - } - //Send the offset as it's gonna be used regardless - packet_contents.append(QString::number(char_offset)); - - // 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("0"); //ao_app->get_sfx_looping(current_char, current_emote)); - packet_contents.append(QString::number(screenshake_state)); - - QString pre_emote = ao_app->get_pre_emote(current_char, current_emote); - QString emote = ao_app->get_emote(current_char, current_emote); - QStringList emotes_to_check = {pre_emote, "(b)" + emote, "(a)" + emote}; - QStringList effects_to_check = {"_FrameScreenshake", "_FrameRealization", "_FrameSFX"}; - - foreach (QString f_effect, effects_to_check) { - QString packet; - foreach (QString f_emote, emotes_to_check) { - packet += f_emote; - if (ao_app->is_frame_network_enabled()) { - QString sfx_frames = ao_app->read_ini_tags(ao_app->get_character_path(current_char, "char.ini"), f_emote.append(f_effect)).join("|"); - if (sfx_frames != "") - packet += "|" + sfx_frames; - } - packet += "^"; - } - packet_contents.append(packet); - } - } - - if (ao_app->additive_enabled) { - packet_contents.append(ui_additive->isChecked() ? "1" : "0"); - } - if (ao_app->effects_enabled) { - QString fx_sound = ao_app->get_effect_sound(effect, current_char); - QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); - packet_contents.append(effect + "|" + p_effect + "|" + fx_sound); - if (!ao_app->is_stickyeffects_enabled()) { - ui_effects_dropdown->blockSignals(true); - ui_effects_dropdown->setCurrentIndex(0); - ui_effects_dropdown->blockSignals(false); - effect = ""; - } - } - - 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 (f_char_id > 0 && (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]; - } - - if (f_showname.trimmed().isEmpty()) //Pure whitespace showname, get outta here. - f_showname = m_chatmessage[CHAR_NAME]; - - QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n'; - //Remove undesired newline chars - m_chatmessage[MESSAGE].remove("\n"); - chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; - - if (f_char_id >= 0 && !chatmessage_is_empty && f_message == previous_ic_message) //Not a system message - return; - - if (f_char_id <= -1) - previous_ic_message = ""; //System messages don't care about repeating themselves - else - previous_ic_message = f_message; - - //Stop the chat arrow from animating - ui_vp_chat_arrow->stop(); - - text_state = 0; - anim_state = 0; - ui_vp_objection->stop(); - chat_tick_timer->stop(); - ui_vp_evidence_display->reset(); - - //Hey, our message showed up! Cool! - if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text().remove("\n") && m_chatmessage[CHAR_ID].toInt() == m_cid) { - ui_ic_chat_message->clear(); - if (ui_additive->isChecked()) - ui_ic_chat_message->insert(" "); - objection_state = 0; - realization_state = 0; - screenshake_state = 0; - is_presenting_evidence = false; - if (!ao_app->is_stickypres_enabled()) - ui_pre->setChecked(false); - ui_hold_it->set_image("holdit"); - ui_objection->set_image("objection"); - ui_take_that->set_image("takethat"); - ui_custom_objection->set_image("custom"); - ui_realization->set_image("realization"); - ui_screenshake->set_image("screenshake"); - ui_evidence_present->set_image("present"); - } - - //Let the server handle actually checking if they're allowed to do this. - is_additive = m_chatmessage[ADDITIVE].toInt() == 1; - - QString f_charname = ""; - if (f_char_id >= 0) - f_charname = ao_app->get_showname(char_list.at(f_char_id).name); - - chatlogpiece *temp = new chatlogpiece(f_charname, f_showname, m_chatmessage[MESSAGE], false); - ic_chatlog_history.append(*temp); - ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); - - while (ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) { - ic_chatlog_history.removeFirst(); - } - - append_ic_text(m_chatmessage[MESSAGE], f_showname); - - int objection_mod = m_chatmessage[OBJECTION_MOD].toInt(); - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_custom_theme = ao_app->get_char_shouts(f_char); - - //if an objection is used - if (objection_mod <= 4 && objection_mod >= 1) { - switch (objection_mod) { - case 1: - ui_vp_objection->play("holdit_bubble", f_char, f_custom_theme, 724); - objection_player->play("holdit", f_char, f_custom_theme); - break; - case 2: - ui_vp_objection->play("objection_bubble", f_char, f_custom_theme, 724); - objection_player->play("objection", f_char, f_custom_theme); - if (ao_app->objection_stop_music()) - music_player->stop(); - break; - case 3: - ui_vp_objection->play("takethat_bubble", f_char, f_custom_theme, 724); - objection_player->play("takethat", f_char, f_custom_theme); - break; - //case 4 is AO2 only - case 4: - ui_vp_objection->play("custom", f_char, f_custom_theme, 724); - objection_player->play("custom", f_char, f_custom_theme); - break; - default: - qDebug() << "W: Logic error in objection switch statement!"; - } - sfx_player->clear(); //Objection played! Cut all sfx. - 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_effect->stop(); - //Clear all looping sfx to prevent obnoxiousness - sfx_player->loop_clear(); - - if (!m_chatmessage[FRAME_SFX].isEmpty() && ao_app->is_frame_network_enabled()) { - //ORDER IS IMPORTANT!! - QStringList netstrings = {m_chatmessage[FRAME_SCREENSHAKE], m_chatmessage[FRAME_REALIZATION], m_chatmessage[FRAME_SFX]}; - ui_vp_player_char->network_strings = netstrings; - } - else - ui_vp_player_char->network_strings.clear(); - - int f_charid = m_chatmessage[CHAR_ID].toInt(); - if (f_charid >= 0 && (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())) { - QString real_name = char_list.at(f_charid).name; - - QString f_showname = ao_app->get_showname(real_name); - - ui_vp_showname->setText(f_showname); - } - else { - ui_vp_showname->setText(m_chatmessage[SHOWNAME]); - } - - if (ui_vp_showname->text().trimmed().isEmpty()) //Whitespace showname - { - ui_vp_chatbox->set_image("chatblank"); - } - else //Aw yeah dude do some showname resizing magic - { - if (!ui_vp_chatbox->set_image("chat")) - ui_vp_chatbox->set_image("chatbox"); - - QFontMetrics fm(ui_vp_showname->font()); - int fm_width = fm.horizontalAdvance(ui_vp_showname->text()); - - QString chatbox_path = ao_app->get_theme_path("chat"); - QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); - if (chatbox != "") { - chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat"; - if (!ui_vp_chatbox->set_chatbox(chatbox_path)) - ui_vp_chatbox->set_chatbox(chatbox_path + "box"); - - pos_size_type design_ini_result = ao_app->get_element_dimensions("chat_arrow", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); - if (design_ini_result.width < 0 || design_ini_result.height < 0) { - qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; - ui_vp_chat_arrow->hide(); - } - else { - ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); - ui_vp_chat_arrow->combo_resize(design_ini_result.width, design_ini_result.height); - } - } - - pos_size_type default_width = ao_app->get_element_dimensions("showname", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); - int extra_width = ao_app->get_design_element("showname_extra_width", "courtroom_design.ini", m_chatmessage[CHAR_NAME]).toInt(); - - if (extra_width > 0) { - if (fm_width > default_width.width && ui_vp_chatbox->set_chatbox(chatbox_path + "med")) //This text be big. Let's do some shenanigans. - { - ui_vp_showname->resize(default_width.width + extra_width, ui_vp_showname->height()); - if (fm_width > ui_vp_showname->width() && ui_vp_chatbox->set_chatbox(chatbox_path + "big")) //Biggest possible size for us. - { - ui_vp_showname->resize(static_cast(default_width.width + (extra_width * 2)), ui_vp_showname->height()); - } - } - else - ui_vp_showname->resize(default_width.width, ui_vp_showname->height()); - } - } - - ui_vp_message->hide(); - ui_vp_chatbox->hide(); - - //todo: put this in its own function or update - QString design_file = "courtroom_fonts.ini"; - int f_pointsize = ao_app->get_font_size("message", design_file); - QString font_name = ao_app->get_font_name("message_font", design_file); - QColor f_color = ao_app->get_color("message_color", design_file); - bool bold = ao_app->get_font_size("message_bold", design_file) == 1; // is the font bold or not? - bool antialias = ao_app->get_font_size("message_sharp", design_file) != 1; // is the font anti-aliased or not? - - QString chatfont = ao_app->get_chat_font(m_chatmessage[CHAR_NAME]); - if (chatfont != "") - font_name = chatfont; - - int chatsize = ao_app->get_chat_size(m_chatmessage[CHAR_NAME]); - if (chatsize != -1) - f_pointsize = chatsize; - this->set_qfont(ui_vp_message, "", get_qfont(font_name, f_pointsize, antialias), f_color, bold); - - set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); - - 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]; - - // Making the second character appear. - if (m_chatmessage[OTHER_CHARID].isEmpty()) { - // If there is no second character, hide 'em - ui_vp_sideplayer_char->stop(); - ui_vp_sideplayer_char->move(0, 0); - } - else { - bool ok; - int got_other_charid = m_chatmessage[OTHER_CHARID].split("^")[0].toInt(&ok); - if (ok) { - if (got_other_charid > -1) { - // If there is, show them! - ui_vp_sideplayer_char->show(); - - int other_offset = m_chatmessage[OTHER_OFFSET].toInt(); - ui_vp_sideplayer_char->move(ui_viewport->width() * other_offset / 100, 0); - - QStringList args = m_chatmessage[OTHER_CHARID].split("^"); - if (args.size() > 1) //This ugly workaround is so we don't make an extra packet just for this purpose. Rewrite pairing when? - { - //Change the order of appearance based on the pair order variable - int order = args.at(1).toInt(); - switch (order) { - case 0: - ui_vp_sideplayer_char->stackUnder(ui_vp_player_char); - break; - case 1: - ui_vp_player_char->stackUnder(ui_vp_sideplayer_char); - break; - default: - break; - } - } - - // 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]); - } - else { - // If the server understands other characters, but there - // really is no second character, hide 'em, and center the first. - ui_vp_sideplayer_char->hide(); - ui_vp_sideplayer_char->move(0, 0); - } - } - } - //Set ourselves according to SELF_OFFSET - - bool ok; - int self_offset = m_chatmessage[SELF_OFFSET].toInt(&ok); - if (ok) - ui_vp_player_char->move(ui_viewport->width() * self_offset / 100, 0); - else - ui_vp_player_char->move(0, 0); - - 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::do_screenshake() -{ - if (!ao_app->is_shake_enabled()) - return; - - //This way, the animation is reset in such a way that last played screenshake would return to its "final frame" properly. - //This properly resets all UI elements without having to bother keeping track of "origin" positions. - //Works great wit the chat text being detached from the chat box! - screenshake_animation_group->setCurrentTime(screenshake_animation_group->duration()); - screenshake_animation_group->clear(); - - QList affected_list = { - ui_vp_background, - ui_vp_player_char, - ui_vp_sideplayer_char, - ui_vp_chatbox}; - - //I would prefer if this was its own "shake" function to be honest. - foreach (QWidget *ui_element, affected_list) { - QPropertyAnimation *screenshake_animation = new QPropertyAnimation(ui_element, "pos", this); - QPoint pos_default = QPoint(ui_element->x(), ui_element->y()); - - int duration = 300; //How long does the screenshake last - int frequency = 20; //How often in ms is there a "jolt" frame - int maxframes = duration / frequency; - int max_x = 7; //Max deviation from origin on x axis - int max_y = 7; //Max deviation from origin on y axis - screenshake_animation->setDuration(duration); - for (int frame = 0; frame < maxframes; frame++) { - double fraction = double(frame * frequency) / duration; - int rng = qrand(); //QRandomGenerator::global()->generate(); - int rand_x = max_x - (int(rng) % (max_x * 2)); - int rand_y = max_y - (int(rng + 100) % (max_y * 2)); - screenshake_animation->setKeyValueAt(fraction, QPoint(pos_default.x() + rand_x, pos_default.y() + rand_y)); - } - screenshake_animation->setEndValue(pos_default); - screenshake_animation->setEasingCurve(QEasingCurve::Linear); - screenshake_animation_group->addAnimation(screenshake_animation); - } - - screenshake_animation_group->start(); -} - -void Courtroom::do_flash() -{ - if (!ao_app->is_effects_enabled()) - return; - - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_custom_theme = ao_app->get_char_shouts(f_char); - ui_vp_effect->play("realizationflash", f_char, f_custom_theme, 60); -} - -void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char, QString p_folder) -{ - - QString effect = ao_app->get_effect(fx_name, p_char, p_folder); - if (effect == "") - return; - - if (fx_sound != "") - sfx_player->play(fx_sound); - - //Only check if effects are disabled after playing the sound if it exists - if (!ao_app->is_effects_enabled()) - return; - - ui_vp_effect->set_play_once(false); // The effects themselves dictate whether or not they're looping. Static effects will linger. - ui_vp_effect->play(effect); // It will set_play_once to true if the filepath provided is not designed to loop more than once -} - -void Courtroom::play_char_sfx(QString sfx_name) -{ - sfx_player->play(sfx_name); - if (ao_app->get_looping_sfx()) - sfx_player->set_looping(ao_app->get_sfx_looping(current_char, QString::number(current_emote)) != "0"); -} - -void Courtroom::handle_chatmessage_3() -{ - start_chat_ticking(); - - int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt(); - QString f_side = m_chatmessage[SIDE]; - - QString f_showname; - int f_char_id = m_chatmessage[CHAR_ID].toInt(); - if (f_char_id > 0 && (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]; - } - if (f_showname.trimmed().isEmpty()) //Pure whitespace showname, get outta here. - f_showname = m_chatmessage[CHAR_NAME]; - - 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; - QString f_name = local_evidence_list.at(f_evi_id - 1).name; - //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()); - append_ic_text(f_name, f_showname, "has presented evidence"); - } - - 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); - - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_custom_theme = ao_app->get_char_shouts(f_char); - if (side == "pro" || - side == "hlp" || - side == "wit") - ui_vp_speedlines->play("prosecution_speedlines", f_char, f_custom_theme); - else - ui_vp_speedlines->play("defense_speedlines", f_char, f_custom_theme); - } - - //If this color is talking - color_is_talking = color_markdown_talking_list.at(m_chatmessage[TEXT_COLOR].toInt()); - - if (color_is_talking && text_state == 1 && anim_state < 2) //Set it to talking as we're not on that already - { - ui_vp_player_char->stop(); - ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - anim_state = 2; - } - else if (anim_state < 3) //Set it to idle as we're not on that already - { - ui_vp_player_char->stop(); - ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[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 html, int target_pos, int default_color) -{ - QString p_text_escaped; - - int check_pos = 0; - int check_pos_escaped = 0; - bool ic_next_is_not_special = false; - std::stack ic_color_stack; - - //Text alignment shenanigans. Could make a dropdown for this later, too! - QString align; - if (p_text.trimmed().startsWith("~~")) { - p_text.remove(p_text.indexOf("~~"), 2); - if (target_pos != -1) { - target_pos = qMax(0, target_pos - 2); - } - align = "center"; - } - else if (p_text.trimmed().startsWith("~>")) { - p_text.remove(p_text.indexOf("~>"), 2); - if (target_pos != -1) { - target_pos = qMax(0, target_pos - 2); - } - align = "right"; - } - else if (p_text.trimmed().startsWith("<>")) { - p_text.remove(p_text.indexOf("<>"), 2); - if (target_pos != -1) { - target_pos = qMax(0, target_pos - 2); - } - align = "justify"; - } - - //If html is enabled, prepare this text to be all ready for it. - if (html) { - ic_color_stack.push(default_color); - QString appendage = ""; - - if (!align.isEmpty()) - appendage.prepend("
"); - - p_text_escaped.insert(check_pos_escaped, appendage); - check_pos_escaped += appendage.size(); - } - - //Current issue: does not properly escape html stuff. - //Solution: probably parse p_text and export into a different string separately, perform some mumbo jumbo to properly adjust string indexes. - while (check_pos < p_text.size()) { - QString f_rest = p_text.right(p_text.size() - check_pos); - QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); - QString f_character; - int f_char_length; - - tbf.toNextBoundary(); + f_char_length = f_character.length(); - if (tbf.position() == -1) - f_character = f_rest; - else - f_character = f_rest.left(tbf.position()); - - // if (f_character == "&") //oh shit it's probably an escaped html - // { - // //Skip escaped chars like you would graphemes - // QRegularExpression re("&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-f]{1,6});", QRegularExpression::CaseInsensitiveOption); - // QRegularExpressionMatch match = re.match(f_rest); - // if (match.hasMatch()) //OH SHIT IT IS, PANIC, PANIC - // { - // f_character = match.captured(0); //Phew, we solved the big problem here. - // } - // } - - if (html) - f_character = f_character.toHtmlEscaped(); - - f_char_length = f_character.length(); - - bool color_update = false; - bool is_end = false; - bool skip = false; - - if (!ic_next_is_not_special) { - if (f_character == "\\") { - ic_next_is_not_special = true; - skip = true; - } - //Nothing related to colors here - else if (f_character == "{" || f_character == "}") //|| f_character == "@" || f_character == "$") - { - skip = true; - } - //Parse markdown colors - else { - for (int c = 0; c < max_colors; ++c) { - //Clear the stored optimization information - QString markdown_start = color_markdown_start_list.at(c); - QString markdown_end = color_markdown_end_list.at(c); - if (html) { - markdown_start = markdown_start.toHtmlEscaped(); - markdown_end = markdown_end.toHtmlEscaped(); - } - bool markdown_remove = color_markdown_remove_list.at(c); - if (markdown_start.isEmpty()) //Not defined - continue; - - if (markdown_end.isEmpty() || markdown_end == markdown_start) //"toggle switch" type - { - if (f_character == markdown_start) { - if (html) { - if (!ic_color_stack.empty() && ic_color_stack.top() == c && default_color != c) { - ic_color_stack.pop(); //Cease our coloring - is_end = true; - } - else { - ic_color_stack.push(c); //Begin our coloring - } - color_update = true; - } - skip = markdown_remove; - break; //Prevent it from looping forward for whatever reason - } - } - else if (f_character == markdown_start || (f_character == markdown_end && !ic_color_stack.empty() && ic_color_stack.top() == c)) { - if (html) { - if (f_character == markdown_end) { - ic_color_stack.pop(); //Cease our coloring - is_end = true; - } - else if (f_character == markdown_start) { - ic_color_stack.push(c); //Begin our coloring - } - color_update = true; - } - skip = markdown_remove; - break; //Prevent it from looping forward for whatever reason - } + bool color_update = false; + bool is_end = false; + bool skip = false; + + if (!ic_next_is_not_special) { + if (f_character == "\\") { + ic_next_is_not_special = true; + skip = true; + } + // Nothing related to colors here + else if (f_character == "{" || + f_character == + "}") //|| f_character == "@" || f_character == "$") + { + skip = true; + } + // Parse markdown colors + else { + for (int c = 0; c < max_colors; ++c) { + // Clear the stored optimization information + QString markdown_start = color_markdown_start_list.at(c); + QString markdown_end = color_markdown_end_list.at(c); + if (html) { + markdown_start = markdown_start.toHtmlEscaped(); + markdown_end = markdown_end.toHtmlEscaped(); + } + bool markdown_remove = color_markdown_remove_list.at(c); + if (markdown_start.isEmpty()) // Not defined + continue; + + if (markdown_end.isEmpty() || + markdown_end == markdown_start) //"toggle switch" type + { + if (f_character == markdown_start) { + if (html) { + if (!ic_color_stack.empty() && ic_color_stack.top() == c && + default_color != c) { + ic_color_stack.pop(); // Cease our coloring + is_end = true; } - //Parse the newest color stack - if (color_update && (target_pos <= -1 || check_pos < target_pos)) { - if (!ic_next_is_not_special) { - QString appendage = ""; - - if (!ic_color_stack.empty()) - appendage += ""; - - if (is_end && !skip) { - p_text_escaped.insert(check_pos_escaped, f_character); //Add that char right now - check_pos_escaped += f_char_length; //So the closing char is captured too - skip = true; - } - p_text_escaped.insert(check_pos_escaped, appendage); - check_pos_escaped += appendage.size(); - } + else { + ic_color_stack.push(c); // Begin our coloring } + color_update = true; + } + skip = markdown_remove; + break; // Prevent it from looping forward for whatever reason } - } - else { - if (f_character == "n") // \n, that's a line break son - { - QString appendage = "
"; - if (!html) { - //actual newline commented out - // appendage = "\n"; - // size = 1; //yeah guess what \n is a "single character" apparently - appendage = "\\n "; //visual representation of a newline - } - p_text_escaped.insert(check_pos_escaped, appendage); - check_pos_escaped += appendage.size(); - skip = true; + } + else if (f_character == markdown_start || + (f_character == markdown_end && !ic_color_stack.empty() && + ic_color_stack.top() == c)) { + if (html) { + if (f_character == markdown_end) { + ic_color_stack.pop(); // Cease our coloring + is_end = true; + } + else if (f_character == markdown_start) { + ic_color_stack.push(c); // Begin our coloring + } + color_update = true; } - if (f_character == "s" || f_character == "f") // screenshake/flash - skip = true; - - ic_next_is_not_special = false; + skip = markdown_remove; + break; // Prevent it from looping forward for whatever reason + } } - - //Make all chars we're not supposed to see invisible - if (target_pos > -1 && check_pos == target_pos) { - QString appendage = ""; - if (!ic_color_stack.empty()) { - if (!is_end) //Was our last coloring char ending the color stack or nah - { - //God forgive me for my transgressions but I have refactored this whole thing about 25 times and having to refactor it - //again to more elegantly support this will finally make me go insane. - color_is_talking = color_markdown_talking_list.at(ic_color_stack.top()); - } - - //Clean it up, we're done here - while (!ic_color_stack.empty()) - ic_color_stack.pop(); - - appendage += "
"; + // Parse the newest color stack + if (color_update && (target_pos <= -1 || check_pos < target_pos)) { + if (!ic_next_is_not_special) { + QString appendage = "
"; + + if (!ic_color_stack.empty()) + appendage += + ""; + + if (is_end && !skip) { + p_text_escaped.insert(check_pos_escaped, + f_character); // Add that char right now + check_pos_escaped += + f_char_length; // So the closing char is captured too + skip = true; } - ic_color_stack.push(-1); //Dummy colorstack push for maximum appendage - appendage += ""; p_text_escaped.insert(check_pos_escaped, appendage); check_pos_escaped += appendage.size(); + } } - if (!skip) { - p_text_escaped.insert(check_pos_escaped, f_character); - check_pos_escaped += f_char_length; - } - check_pos += 1; + } } + else { + if (f_character == "n") // \n, that's a line break son + { + QString appendage = "
"; + if (!html) { + // actual newline commented out + // appendage = "\n"; + // size = 1; //yeah guess what \n is a "single character" + // apparently + appendage = "\\n "; // visual representation of a newline + } + p_text_escaped.insert(check_pos_escaped, appendage); + check_pos_escaped += appendage.size(); + skip = true; + } + if (f_character == "s" || f_character == "f") // screenshake/flash + skip = true; - if (!ic_color_stack.empty() && html) { - p_text_escaped.append("
"); + ic_next_is_not_special = false; } - if (html) { - //Example: https://regex101.com/r/oL4nM9/37 - this replaces excessive/trailing/etc. whitespace with non-breaking space. - //I WOULD use white-space: pre; stylesheet tag, but for whataver reason it doesn't work no matter where I try it. - //If somoene else can get that piece of HTML memery to work, please do. - p_text_escaped.replace(QRegularExpression("^\\s|(?<=\\s)\\s"), " "); - if (!align.isEmpty()) - p_text_escaped.append("
"); + // Make all chars we're not supposed to see invisible + if (target_pos > -1 && check_pos == target_pos) { + QString appendage = ""; + if (!ic_color_stack.empty()) { + if (!is_end) // Was our last coloring char ending the color stack or nah + { + // God forgive me for my transgressions but I have refactored this + // whole thing about 25 times and having to refactor it again to more + // elegantly support this will finally make me go insane. + color_is_talking = + color_markdown_talking_list.at(ic_color_stack.top()); + } + + // Clean it up, we're done here + while (!ic_color_stack.empty()) + ic_color_stack.pop(); + + appendage += "
"; + } + ic_color_stack.push( + -1); // Dummy colorstack push for maximum appendage + appendage += ""; + p_text_escaped.insert(check_pos_escaped, appendage); + check_pos_escaped += appendage.size(); } + if (!skip) { + p_text_escaped.insert(check_pos_escaped, f_character); + check_pos_escaped += f_char_length; + } + check_pos += 1; + } + + if (!ic_color_stack.empty() && html) { + p_text_escaped.append(""); + } - return p_text_escaped; + if (html) { + // Example: https://regex101.com/r/oL4nM9/37 - this replaces + // excessive/trailing/etc. whitespace with non-breaking space. I WOULD use + // white-space: pre; stylesheet tag, but for whataver reason it doesn't work + // no matter where I try it. If somoene else can get that piece of HTML + // memery to work, please do. + p_text_escaped.replace(QRegularExpression("^\\s|(?<=\\s)\\s"), " "); + if (!align.isEmpty()) + p_text_escaped.append("
"); + } + + return p_text_escaped; } void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action) { - 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 (p_action == "") - p_text = filter_ic_text(p_text, ao_app->is_colorlog_enabled(), -1, m_chatmessage[TEXT_COLOR].toInt()); - - if (log_goes_downwards) { - const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); - - ui_ic_chatlog->moveCursor(QTextCursor::End); - - if (!first_message_sent) { - ui_ic_chatlog->textCursor().insertText(p_name, bold); - first_message_sent = true; - } - else { - ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); - } + 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 (p_action != "") { - ui_ic_chatlog->textCursor().insertText(" " + p_action + ": ", normal); - ui_ic_chatlog->textCursor().insertText(p_text + ".", italics); - } - else { - ui_ic_chatlog->textCursor().insertText(": ", normal); - ui_ic_chatlog->textCursor().insertHtml(p_text); - } + if (p_action == "") + p_text = filter_ic_text(p_text, ao_app->is_colorlog_enabled(), -1, + m_chatmessage[TEXT_COLOR].toInt()); - // 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(); - } + if (log_goes_downwards) { + const bool is_scrolled_down = + old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); - if (old_cursor.hasSelection() || !is_scrolled_down) { - // The user has selected text or scrolled away from the bottom: maintain position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); - } - else { - // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom. - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); - } + ui_ic_chatlog->moveCursor(QTextCursor::End); + + if (!first_message_sent) { + ui_ic_chatlog->textCursor().insertText(p_name, bold); + first_message_sent = true; } else { - const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); + ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); + } - ui_ic_chatlog->moveCursor(QTextCursor::Start); + if (p_action != "") { + ui_ic_chatlog->textCursor().insertText(" " + p_action + ": ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + ".", italics); + } + else { + ui_ic_chatlog->textCursor().insertText(": ", normal); + ui_ic_chatlog->textCursor().insertHtml(p_text); + } - ui_ic_chatlog->textCursor().insertText(p_name, bold); + // 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(); + } - if (p_action != "") { - ui_ic_chatlog->textCursor().insertText(" " + p_action + ": ", normal); - ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics); - } - else { - ui_ic_chatlog->textCursor().insertText(": ", normal); - ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); - } + if (old_cursor.hasSelection() || !is_scrolled_down) { + // The user has selected text or scrolled away from the bottom: maintain + // position. + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } + else { + // The user hasn't selected any text and the scrollbar is at the bottom: + // scroll to the bottom. + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->verticalScrollBar()->setValue( + ui_ic_chatlog->verticalScrollBar()->maximum()); + } + } + else { + const bool is_scrolled_up = + old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); - // 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(); - } + ui_ic_chatlog->moveCursor(QTextCursor::Start); - if (old_cursor.hasSelection() || !is_scrolled_up) { - // The user has selected text or scrolled away from the top: maintain position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); - } - else { - // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); - } + ui_ic_chatlog->textCursor().insertText(p_name, bold); + + if (p_action != "") { + ui_ic_chatlog->textCursor().insertText(" " + p_action + ": ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics); + } + else { + ui_ic_chatlog->textCursor().insertText(": ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); + } + + // If we got too many blocks in the current log, delete some from the + // bottom. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && + log_maximum_blocks > 0) { + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deletePreviousChar(); + } + + if (old_cursor.hasSelection() || !is_scrolled_up) { + // The user has selected text or scrolled away from the top: maintain + // position. + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } + else { + // The user hasn't selected any text and the scrollbar is at the top: + // scroll to the top. + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->verticalScrollBar()->setValue( + ui_ic_chatlog->verticalScrollBar()->minimum()); } + } } 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() * time_mod; - - int preanim_duration; + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_preanim = m_chatmessage[PRE_EMOTE]; - if (ao2_duration < 0) - preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim); - else - preanim_duration = ao2_duration; + // 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() * time_mod; - 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)) { - if (noninterrupting) - anim_state = 4; - else - anim_state = 1; - preanim_done(); - qDebug() << "could not find " + anim_to_find; - return; - } + int preanim_duration; - ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration); + if (ao2_duration < 0) + preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim); + else + preanim_duration = ao2_duration; + sfx_delay_timer->start(sfx_delay); + QString anim_to_find = + ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim)); + if (!file_exists(anim_to_find)) { if (noninterrupting) - anim_state = 4; + anim_state = 4; else - anim_state = 1; + anim_state = 1; + preanim_done(); + qDebug() << "could not find " + anim_to_find; + return; + } - if (text_delay >= 0) - text_delay_timer->start(text_delay); + ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration); - if (noninterrupting) - handle_chatmessage_3(); + 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(); + anim_state = 1; + handle_chatmessage_3(); } 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[EFFECTS] != "") { - QStringList fx_list = m_chatmessage[EFFECTS].split("|"); - QString fx = fx_list[0]; - QString fx_sound; - QString fx_folder; + // 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 (fx_list.length() > 1) - fx_sound = fx_list[1]; + if (m_chatmessage[EFFECTS] != "") { + QStringList fx_list = m_chatmessage[EFFECTS].split("|"); + QString fx = fx_list[0]; + QString fx_sound; + QString fx_folder; - if (fx_list.length() > 2) { - fx_folder = fx_list[1]; - fx_sound = fx_list[2]; - } + if (fx_list.length() > 1) + fx_sound = fx_list[1]; - this->do_effect(fx, fx_sound, m_chatmessage[CHAR_NAME], fx_folder); - } - else if (m_chatmessage[REALIZATION] == "1") { - this->do_flash(); - sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); - } - if (chatmessage_is_empty) { - //since the message is empty, it's technically done ticking - text_state = 2; - return; + if (fx_list.length() > 2) { + fx_folder = fx_list[1]; + fx_sound = fx_list[2]; } - ui_vp_chatbox->show(); - ui_vp_message->show(); + this->do_effect(fx, fx_sound, m_chatmessage[CHAR_NAME], fx_folder); + } + else if (m_chatmessage[REALIZATION] == "1") { + this->do_flash(); + sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); + } + if (chatmessage_is_empty) { + // since the message is empty, it's technically done ticking + text_state = 2; + return; + } - if (!is_additive) { - ui_vp_message->clear(); - real_tick_pos = 0; - additive_previous = ""; - } + ui_vp_chatbox->show(); + ui_vp_message->show(); - tick_pos = 0; - blip_ticker = 0; + if (!is_additive) { + ui_vp_message->clear(); + real_tick_pos = 0; + additive_previous = ""; + } - // At the start of every new message, we set the text speed to the default. - current_display_speed = 3; - chat_tick_timer->start(0); //Display the first char right away + tick_pos = 0; + blip_ticker = 0; - QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]); + // At the start of every new message, we set the text speed to the default. + current_display_speed = 3; + chat_tick_timer->start(0); // Display the first char right away - blip_player->set_blips(f_gender); + QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]); - int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); //text meme bonanza - if ((emote_mod == 0 || emote_mod == 5) && m_chatmessage[SCREENSHAKE] == "1") { - this->do_screenshake(); - } + blip_player->set_blips(f_gender); - //means text is currently ticking - text_state = 1; + int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); // text meme bonanza + if ((emote_mod == 0 || emote_mod == 5) && m_chatmessage[SCREENSHAKE] == "1") { + this->do_screenshake(); + } + + // means text is currently ticking + text_state = 1; } void Courtroom::chat_tick() { - //note: this is called fairly often - //do not perform heavy operations here + // note: this is called fairly often + // do not perform heavy operations here - QString f_message = m_chatmessage[MESSAGE]; + QString f_message = m_chatmessage[MESSAGE]; - // 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(); - if (tick_pos >= f_message.size()) { - text_state = 2; - if (anim_state < 3) { - anim_state = 3; - ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - } - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_custom_theme = ao_app->get_chat(f_char); - ui_vp_chat_arrow->play("chat_arrow", f_char, f_custom_theme); //Chat stopped being processed, indicate that. - additive_previous = additive_previous + filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt()); - real_tick_pos = ui_vp_message->toPlainText().size(); - return; + if (tick_pos >= f_message.size()) { + text_state = 2; + if (anim_state < 3) { + anim_state = 3; + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], + m_chatmessage[EMOTE]); } - - // Stops blips from playing when we have a formatting option. - bool formatting_char = false; - - QString f_rest = f_message; - - //Alignment characters - if (tick_pos < 2) { - if (f_rest.startsWith("~~")) { - tick_pos = f_rest.indexOf("~~"); - f_rest.remove(tick_pos, 2); - tick_pos += 2; - } - else if (f_rest.startsWith("~>")) { - tick_pos = f_rest.indexOf("~>"); - f_rest.remove(tick_pos, 2); - tick_pos += 2; - } - else if (f_rest.startsWith("<>")) { - tick_pos = f_rest.indexOf("<>"); - f_rest.remove(tick_pos, 2); - tick_pos += 2; - } + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_custom_theme = ao_app->get_chat(f_char); + ui_vp_chat_arrow->play( + "chat_arrow", f_char, + f_custom_theme); // Chat stopped being processed, indicate that. + additive_previous = + additive_previous + + filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt()); + real_tick_pos = ui_vp_message->toPlainText().size(); + return; + } + + // Stops blips from playing when we have a formatting option. + bool formatting_char = false; + + QString f_rest = f_message; + + // Alignment characters + if (tick_pos < 2) { + if (f_rest.startsWith("~~")) { + tick_pos = f_rest.indexOf("~~"); + f_rest.remove(tick_pos, 2); + tick_pos += 2; + } + else if (f_rest.startsWith("~>")) { + tick_pos = f_rest.indexOf("~>"); + f_rest.remove(tick_pos, 2); + tick_pos += 2; + } + else if (f_rest.startsWith("<>")) { + tick_pos = f_rest.indexOf("<>"); + f_rest.remove(tick_pos, 2); + tick_pos += 2; + } + } + f_rest.remove(0, tick_pos); + QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); + QString f_character; + int f_char_length; + + tbf.toNextBoundary(); + + if (tbf.position() == -1) + f_character = f_rest; + else + f_character = f_rest.left(tbf.position()); + + f_char_length = f_character.length(); + tick_pos += f_char_length; + + // Escape character. + if (!next_character_is_not_special) { + if (f_character == "\\") { + next_character_is_not_special = true; + formatting_char = true; + } + + // Text speed modifier. + else if (f_character == "{") { + // ++, because it INCREASES delay! + current_display_speed++; + formatting_char = true; + } + else if (f_character == "}") { + current_display_speed--; + formatting_char = true; } - f_rest.remove(0, tick_pos); - QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); - QString f_character; - int f_char_length; - - tbf.toNextBoundary(); - if (tbf.position() == -1) - f_character = f_rest; - else - f_character = f_rest.left(tbf.position()); - - f_char_length = f_character.length(); - tick_pos += f_char_length; - - // Escape character. - if (!next_character_is_not_special) { - if (f_character == "\\") { - next_character_is_not_special = true; - formatting_char = true; - } + else { + // Parse markdown colors + for (int c = 0; c < max_colors; ++c) { + QString markdown_start = color_markdown_start_list.at(c); + QString markdown_end = color_markdown_end_list.at(c); + bool markdown_remove = color_markdown_remove_list.at(c); + if (markdown_start.isEmpty()) + continue; - // Text speed modifier. - else if (f_character == "{") { - // ++, because it INCREASES delay! - current_display_speed++; - formatting_char = true; - } - else if (f_character == "}") { - current_display_speed--; + if (f_character == markdown_start || f_character == markdown_end) { + if (markdown_remove) formatting_char = true; + break; } - - else { - //Parse markdown colors - for (int c = 0; c < max_colors; ++c) { - QString markdown_start = color_markdown_start_list.at(c); - QString markdown_end = color_markdown_end_list.at(c); - bool markdown_remove = color_markdown_remove_list.at(c); - if (markdown_start.isEmpty()) - continue; - - if (f_character == markdown_start || f_character == markdown_end) { - if (markdown_remove) - formatting_char = true; - break; - } - } - } + } } - else { - if (f_character == "n") - formatting_char = true; //it's a newline - if (f_character == "s") //Screenshake. - { - this->do_screenshake(); - formatting_char = true; - } - if (f_character == "f") //Flash. - { - this->do_flash(); - formatting_char = true; - } - next_character_is_not_special = false; + } + else { + if (f_character == "n") + formatting_char = true; // it's a newline + if (f_character == "s") // Screenshake. + { + this->do_screenshake(); + formatting_char = true; } - - if ((message_display_speed[current_display_speed] <= 0 && tick_pos < f_message.size() - 1) || formatting_char) { - chat_tick_timer->start(0); //Don't bother rendering anything out as we're doing the SPEED. (there's latency otherwise) - if (!formatting_char || f_character == "n" || f_character == "f" || f_character == "s") - real_tick_pos += f_char_length; //Adjust the tick position for the scrollbar convenience + if (f_character == "f") // Flash. + { + this->do_flash(); + formatting_char = true; + } + next_character_is_not_special = false; + } + + if ((message_display_speed[current_display_speed] <= 0 && + tick_pos < f_message.size() - 1) || + formatting_char) { + chat_tick_timer->start(0); // Don't bother rendering anything out as we're + // doing the SPEED. (there's latency otherwise) + if (!formatting_char || f_character == "n" || f_character == "f" || + f_character == "s") + real_tick_pos += f_char_length; // Adjust the tick position for the + // scrollbar convenience + } + else { + int msg_delay = message_display_speed[current_display_speed]; + // Do the colors, gradual showing, etc. in here + ui_vp_message->setHtml(additive_previous + + filter_ic_text(f_message, true, tick_pos, + m_chatmessage[TEXT_COLOR].toInt())); + + // This should always be done AFTER setHtml. Scroll the chat window with the + // text. + + // Make the cursor follow the message + QTextCursor cursor = ui_vp_message->textCursor(); + cursor.setPosition(real_tick_pos); + ui_vp_message->setTextCursor(cursor); + real_tick_pos += f_char_length; + + ui_vp_message->ensureCursorVisible(); + + // Keep the speed at bay. + if (current_display_speed < 0) + current_display_speed = 0; + else if (current_display_speed > 6) + current_display_speed = 6; + + // Blip player and real tick pos ticker + if (!formatting_char && (f_character != ' ' || blank_blip)) { + if (blip_ticker % blip_rate == 0) { + blip_player->blip_tick(); + } + ++blip_ticker; + } + + // Punctuation delayer + if (punctuation_chars.contains(f_character)) { + msg_delay *= punctuation_modifier; + } + + // If this color is talking + if (color_is_talking && anim_state != 2 && + anim_state < + 4) // Set it to talking as we're not on that already (though we have + // to avoid interrupting a non-interrupted preanim) + { + ui_vp_player_char->stop(); + ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], + m_chatmessage[EMOTE]); + anim_state = 2; } - else { - int msg_delay = message_display_speed[current_display_speed]; - //Do the colors, gradual showing, etc. in here - ui_vp_message->setHtml(additive_previous + filter_ic_text(f_message, true, tick_pos, m_chatmessage[TEXT_COLOR].toInt())); - - //This should always be done AFTER setHtml. Scroll the chat window with the text. - - //Make the cursor follow the message - QTextCursor cursor = ui_vp_message->textCursor(); - cursor.setPosition(real_tick_pos); - ui_vp_message->setTextCursor(cursor); - real_tick_pos += f_char_length; - - ui_vp_message->ensureCursorVisible(); - - // Keep the speed at bay. - if (current_display_speed < 0) - current_display_speed = 0; - else if (current_display_speed > 6) - current_display_speed = 6; - - //Blip player and real tick pos ticker - if (!formatting_char && (f_character != ' ' || blank_blip)) { - if (blip_ticker % blip_rate == 0) { - blip_player->blip_tick(); - } - ++blip_ticker; - } - - //Punctuation delayer - if (punctuation_chars.contains(f_character)) { - msg_delay *= punctuation_modifier; - } - - //If this color is talking - if (color_is_talking && anim_state != 2 && anim_state < 4) //Set it to talking as we're not on that already (though we have to avoid interrupting a non-interrupted preanim) - { - ui_vp_player_char->stop(); - ui_vp_player_char->play_talking(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - anim_state = 2; - } - else if (!color_is_talking && anim_state < 3 && anim_state != 3) //Set it to idle as we're not on that already - { - ui_vp_player_char->stop(); - ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); - anim_state = 3; - } - //Continue ticking - chat_tick_timer->start(msg_delay); + else if (!color_is_talking && anim_state < 3 && + anim_state != 3) // Set it to idle as we're not on that already + { + ui_vp_player_char->stop(); + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], + m_chatmessage[EMOTE]); + anim_state = 3; } + // Continue ticking + chat_tick_timer->start(msg_delay); + } } void Courtroom::play_sfx() { - QString sfx_name = m_chatmessage[SFX_NAME]; - if (m_chatmessage[SCREENSHAKE] == "1") //Screenshake dependant on preanim sfx delay meme - { - this->do_screenshake(); - } - if (sfx_name == "1") - return; + QString sfx_name = m_chatmessage[SFX_NAME]; + if (m_chatmessage[SCREENSHAKE] == + "1") // Screenshake dependant on preanim sfx delay meme + { + this->do_screenshake(); + } + if (sfx_name == "1") + return; - sfx_player->play(sfx_name); - if (ao_app->get_looping_sfx()) - sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name) != "0"); + sfx_player->play(sfx_name); + if (ao_app->get_looping_sfx()) + sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name) != + "0"); } void Courtroom::set_scene(QString f_desk_mod, QString f_side) { - //witness is default if pos is invalid - QString f_background = "witnessempty"; - QString f_desk_image = "stand"; - - if (f_side == "def" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("defenseempty")))) { - f_background = "defenseempty"; - f_desk_image = "defensedesk"; - } - else if (f_side == "pro" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("prosecutorempty")))) { - f_background = "prosecutorempty"; - f_desk_image = "prosecutiondesk"; - } - else if (f_side == "jud" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("judgestand")))) { - f_background = "judgestand"; - f_desk_image = "judgedesk"; - } - else if (f_side == "hld" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("helperstand")))) { - f_background = "helperstand"; - f_desk_image = "helperdesk"; - } - else if (f_side == "hlp" && file_exists(ao_app->get_image_suffix(ao_app->get_background_path("prohelperstand")))) { - 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"; - } - 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"; - } - - if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path(f_side)))) //Unique pos path - { - f_background = f_side; - f_desk_image = f_side + "_overlay"; - } - - 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 { - ui_vp_legacy_desk->hide(); - ui_vp_desk->show(); - } + // witness is default if pos is invalid + QString f_background = "witnessempty"; + QString f_desk_image = "stand"; + + if (f_side == "def" && file_exists(ao_app->get_image_suffix( + ao_app->get_background_path("defenseempty")))) { + f_background = "defenseempty"; + f_desk_image = "defensedesk"; + } + else if (f_side == "pro" && + file_exists(ao_app->get_image_suffix( + ao_app->get_background_path("prosecutorempty")))) { + f_background = "prosecutorempty"; + f_desk_image = "prosecutiondesk"; + } + else if (f_side == "jud" && file_exists(ao_app->get_image_suffix( + ao_app->get_background_path("judgestand")))) { + f_background = "judgestand"; + f_desk_image = "judgedesk"; + } + else if (f_side == "hld" && + file_exists(ao_app->get_image_suffix( + ao_app->get_background_path("helperstand")))) { + f_background = "helperstand"; + f_desk_image = "helperdesk"; + } + else if (f_side == "hlp" && + file_exists(ao_app->get_image_suffix( + ao_app->get_background_path("prohelperstand")))) { + 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"; + } + 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"; + } + + if (file_exists(ao_app->get_image_suffix( + ao_app->get_background_path(f_side)))) // Unique pos path + { + f_background = f_side; + f_desk_image = f_side + "_overlay"; + } + + 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 { + ui_vp_legacy_desk->hide(); + ui_vp_desk->show(); + } } void Courtroom::set_ip_list(QString p_list) { - QString f_list = p_list.replace("|", ":").replace("*", "\n"); + QString f_list = p_list.replace("|", ":").replace("*", "\n"); - ui_server_chatlog->append(f_list); + 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_cid != m_cid && p_cid != -1) + return; - if (p_muted) - ui_muted->show(); - else { - ui_muted->hide(); - ui_ic_chat_message->setFocus(); - } + 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"); + ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); + ui_muted->set_image("muted"); - is_muted = p_muted; - ui_ic_chat_message->setEnabled(!p_muted); + 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; + if (p_cid != m_cid && p_cid != -1) + return; - call_notice("You have been banned."); + call_notice("You have been banned."); - ao_app->construct_lobby(); - ao_app->destruct_courtroom(); + ao_app->construct_lobby(); + ao_app->destruct_courtroom(); } void Courtroom::handle_song(QStringList *p_contents) { - QStringList f_contents = *p_contents; + QStringList f_contents = *p_contents; - if (f_contents.size() < 2) - return; + if (f_contents.size() < 2) + return; - QString f_song = f_contents.at(0); - QString f_song_clear = f_song.left(f_song.lastIndexOf(".")); - f_song_clear = f_song_clear.right(f_song_clear.length() - (f_song_clear.lastIndexOf("/") + 1)); - int n_char = f_contents.at(1).toInt(); + QString f_song = f_contents.at(0); + QString f_song_clear = f_song.left(f_song.lastIndexOf(".")); + f_song_clear = f_song_clear.right(f_song_clear.length() - + (f_song_clear.lastIndexOf("/") + 1)); + int n_char = f_contents.at(1).toInt(); - bool looping = true; + bool looping = true; + int channel = 0; + int effect_flags = 0; + if (n_char < 0 || n_char >= char_list.size()) { int channel = 0; - int effect_flags = 0; - if (n_char < 0 || n_char >= char_list.size()) { - int channel = 0; - if (p_contents->length() > 3 && p_contents->at(3) != "-1") - looping = false; + if (p_contents->length() > 3 && p_contents->at(3) != "-1") + looping = false; - if (p_contents->length() > 4) //eyyy we want to change this song's CHANNEL huh - channel = p_contents->at(4).toInt(); //let the music player handle it if it's bigger than the channel list - - if (p_contents->length() > 5) //Flags provided to us by server such as Fade In, Fade Out, Sync Pos etc. - { - effect_flags = p_contents->at(5).toInt(); - } + if (p_contents->length() > + 4) // eyyy we want to change this song's CHANNEL huh + channel = p_contents->at(4).toInt(); // let the music player handle it if + // it's bigger than the channel list - music_player->play(f_song, channel, looping, effect_flags); - if (channel == 0) - ui_music_name->setText(f_song_clear); + if (p_contents->length() > 5) // Flags provided to us by server such as Fade + // In, Fade Out, Sync Pos etc. + { + effect_flags = p_contents->at(5).toInt(); + } + + music_player->play(f_song, channel, looping, effect_flags); + if (channel == 0) + ui_music_name->setText(f_song_clear); + } + 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 && p_contents->at(3) != "-1") { + // I am really confused why "-1" is "loop this song" and why anything else + // passes as "don't loop" (if we even have this length) but alright + looping = false; + } + if (p_contents->length() > + 4) // eyyy we want to change this song's CHANNEL huh + channel = p_contents->at(4).toInt(); // let the music player handle it if + // it's bigger than the channel list + + if (p_contents->length() > 5) // Flags provided to us by server such as Fade + // In, Fade Out, Sync Pos etc. + { + effect_flags = p_contents->at(5).toInt(); } - 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 && p_contents->at(3) != "-1") { - //I am really confused why "-1" is "loop this song" and why anything else passes as "don't loop" - //(if we even have this length) but alright - looping = false; - } - if (p_contents->length() > 4) //eyyy we want to change this song's CHANNEL huh - channel = p_contents->at(4).toInt(); //let the music player handle it if it's bigger than the channel list - - if (p_contents->length() > 5) //Flags provided to us by server such as Fade In, Fade Out, Sync Pos etc. - { - effect_flags = p_contents->at(5).toInt(); - } + if (!mute_map.value(n_char)) { + chatlogpiece *temp = new chatlogpiece(str_char, str_show, f_song, true); + ic_chatlog_history.append(*temp); + ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); - if (!mute_map.value(n_char)) { - chatlogpiece *temp = new chatlogpiece(str_char, str_show, f_song, true); - ic_chatlog_history.append(*temp); - ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); - - while (ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) { - ic_chatlog_history.removeFirst(); - } + while (ic_chatlog_history.size() > log_maximum_blocks && + log_maximum_blocks > 0) { + ic_chatlog_history.removeFirst(); + } - append_ic_text(f_song_clear, str_show, "has played a song"); + append_ic_text(f_song_clear, str_show, "has played a song"); - music_player->play(f_song, channel, looping, effect_flags); - if (channel == 0) - ui_music_name->setText(f_song_clear); - } + music_player->play(f_song, channel, looping, effect_flags); + if (channel == 0) + ui_music_name->setText(f_song_clear); } + } } void Courtroom::handle_wtce(QString p_wtce, int variant) { - QString sfx_file = "courtroom_sounds.ini"; - - //witness testimony - if (p_wtce == "testimony1") { - sfx_player->play(ao_app->get_sfx("witness_testimony")); - ui_vp_wtce->play("witnesstestimony", "", "", 1500); - ui_vp_testimony->play("testimony"); - } - //cross examination - else if (p_wtce == "testimony2") { - sfx_player->play(ao_app->get_sfx("cross_examination")); - ui_vp_wtce->play("crossexamination", "", "", 1500); - ui_vp_testimony->stop(); + QString sfx_file = "courtroom_sounds.ini"; + + // witness testimony + if (p_wtce == "testimony1") { + sfx_player->play(ao_app->get_sfx("witness_testimony")); + ui_vp_wtce->play("witnesstestimony", "", "", 1500); + ui_vp_testimony->play("testimony"); + } + // cross examination + else if (p_wtce == "testimony2") { + sfx_player->play(ao_app->get_sfx("cross_examination")); + ui_vp_wtce->play("crossexamination", "", "", 1500); + ui_vp_testimony->stop(); + } + else if (p_wtce == "judgeruling") { + if (variant == 0) { + sfx_player->play(ao_app->get_sfx("not_guilty")); + ui_vp_wtce->play("notguilty", "", "", 3000); + ui_vp_testimony->stop(); } - else if (p_wtce == "judgeruling") { - if (variant == 0) { - sfx_player->play(ao_app->get_sfx("not_guilty")); - ui_vp_wtce->play("notguilty", "", "", 3000); - ui_vp_testimony->stop(); - } - else if (variant == 1) { - sfx_player->play(ao_app->get_sfx("guilty")); - ui_vp_wtce->play("guilty", "", "", 3000); - ui_vp_testimony->stop(); - } + else if (variant == 1) { + sfx_player->play(ao_app->get_sfx("guilty")); + ui_vp_wtce->play("guilty", "", "", 3000); + 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_state < 0 || p_state > 10) + return; - if (p_bar == 1) { - ui_defense_bar->set_image("defensebar" + QString::number(p_state)); - defense_bar_state = p_state; - } - else if (p_bar == 2) { - ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state)); - prosecution_bar_state = p_state; - } + if (p_bar == 1) { + ui_defense_bar->set_image("defensebar" + QString::number(p_state)); + defense_bar_state = p_state; + } + else if (p_bar == 2) { + ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state)); + 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(); - } + 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); - } + 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) +void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, + bool steno) { - if (ui_casing->isChecked()) { - ui_server_chatlog->append(msg); - if ((ao_app->get_casing_defence_enabled() && def) || - (ao_app->get_casing_prosecution_enabled() && pro) || - (ao_app->get_casing_judge_enabled() && jud) || - (ao_app->get_casing_juror_enabled() && jur) || - (ao_app->get_casing_steno_enabled() && steno)) { - modcall_player->play(ao_app->get_sfx("case_call")); - ao_app->alert(this); - } + if (ui_casing->isChecked()) { + ui_server_chatlog->append(msg); + if ((ao_app->get_casing_defence_enabled() && def) || + (ao_app->get_casing_prosecution_enabled() && pro) || + (ao_app->get_casing_judge_enabled() && jud) || + (ao_app->get_casing_juror_enabled() && jur) || + (ao_app->get_casing_steno_enabled() && steno)) { + modcall_player->play(ao_app->get_sfx("case_call")); + ao_app->alert(this); } + } } void Courtroom::on_ooc_return_pressed() { - QString ooc_message = ui_ooc_chat_message->text(); + QString ooc_message = ui_ooc_chat_message->text(); - if (ooc_message == "" || ui_ooc_chat_name->text() == "") - return; + 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("/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) { - char_offset = 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; + if (ooc_message.startsWith("/pos")) { + if (ooc_message == "/pos jud") { + toggle_judge_buttons(true); } - 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 { + toggle_judge_buttons(false); } - 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(); + } + 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); - append_server_chatmessage("CLIENT", tr("The IC chatlog has been saved."), "1"); - ui_ooc_chat_message->clear(); - return; + 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 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()); + 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); - ao_app->send_server_packet(new AOPacket("PE", f_contents)); - } + bool ok; + int off = ooc_message.toInt(&ok); + if (ok) { + if (off >= -100 && off <= 100) { + char_offset = 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"); - append_server_chatmessage("CLIENT", tr("Your case \"%1\" was loaded!").arg(command[1]), "1"); - ui_ooc_chat_message->clear(); - return; + 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; } - 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 = 0; i < local_evidence_list.size(); 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; + QTextStream out(&file); + + foreach (chatlogpiece item, ic_chatlog_history) { + out << item.get_full() << '\n'; } - QStringList packet_contents; - packet_contents.append(ui_ooc_chat_name->text()); - packet_contents.append(ooc_message); + 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 = 0; i < local_evidence_list.size(); 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; + } + + QStringList packet_contents; + packet_contents.append(ui_ooc_chat_name->text()); + packet_contents.append(ooc_message); - AOPacket *f_packet = new AOPacket("CT", packet_contents); + 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); + 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->clear(); - ui_ooc_chat_message->setFocus(); + 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("Master")); + if (server_ooc) { + ui_ms_chatlog->show(); + ui_server_chatlog->hide(); + ui_ooc_toggle->setText(tr("Master")); - server_ooc = false; - } - else { - ui_ms_chatlog->hide(); - ui_server_chatlog->show(); - ui_ooc_toggle->setText(tr("Server")); + server_ooc = false; + } + else { + ui_ms_chatlog->hide(); + ui_server_chatlog->show(); + ui_ooc_toggle->setText(tr("Server")); - server_ooc = true; - } + server_ooc = true; + } } -//Todo: multithread this due to some servers having large as hell music list +// Todo: multithread this due to some servers having large as hell music list void Courtroom::on_music_search_edited(QString p_text) { - // Iterate through all QTreeWidgetItem items - if (!ui_music_list->isHidden()) { - QTreeWidgetItemIterator it(ui_music_list); - while (*it) { - (*it)->setHidden(p_text != ""); - ++it; - } + // Iterate through all QTreeWidgetItem items + if (!ui_music_list->isHidden()) { + QTreeWidgetItemIterator it(ui_music_list); + while (*it) { + (*it)->setHidden(p_text != ""); + ++it; } + } - if (!ui_area_list->isHidden()) { - QTreeWidgetItemIterator ait(ui_area_list); - while (*ait) { - (*ait)->setHidden(p_text != ""); - ++ait; - } + if (!ui_area_list->isHidden()) { + QTreeWidgetItemIterator ait(ui_area_list); + while (*ait) { + (*ait)->setHidden(p_text != ""); + ++ait; } + } - if (p_text != "") { - if (!ui_music_list->isHidden()) { - //Search in metadata - QList clist = ui_music_list->findItems(ui_music_search->text(), Qt::MatchContains | Qt::MatchRecursive, 1); - foreach (QTreeWidgetItem *item, clist) { - if (item->parent() != nullptr) //So the category shows up too - item->parent()->setHidden(false); - item->setHidden(false); - } - } + if (p_text != "") { + if (!ui_music_list->isHidden()) { + // Search in metadata + QList clist = ui_music_list->findItems( + ui_music_search->text(), Qt::MatchContains | Qt::MatchRecursive, 1); + foreach (QTreeWidgetItem *item, clist) { + if (item->parent() != nullptr) // So the category shows up too + item->parent()->setHidden(false); + item->setHidden(false); + } + } - if (!ui_area_list->isHidden()) { - //Search in metadata - QList alist = ui_area_list->findItems(ui_music_search->text(), Qt::MatchContains | Qt::MatchRecursive, 1); - foreach (QTreeWidgetItem *item, alist) { - if (item->parent() != nullptr) //So the category shows up too - item->parent()->setHidden(false); - item->setHidden(false); - } - } + if (!ui_area_list->isHidden()) { + // Search in metadata + QList alist = ui_area_list->findItems( + ui_music_search->text(), Qt::MatchContains | Qt::MatchRecursive, 1); + foreach (QTreeWidgetItem *item, alist) { + if (item->parent() != nullptr) // So the category shows up too + item->parent()->setHidden(false); + item->setHidden(false); + } } + } } void Courtroom::on_pos_dropdown_changed(int p_index) { - if (p_index < 0 || p_index > 7) - return; + if (p_index < 0 || p_index > 7) + return; - toggle_judge_buttons(false); + toggle_judge_buttons(false); - QString f_pos = ui_pos_dropdown->itemText(p_index); + QString f_pos = ui_pos_dropdown->itemText(p_index); - if (f_pos == "") - return; + if (f_pos == "") + return; - if (f_pos == "jud") - toggle_judge_buttons(true); + if (f_pos == "jud") + toggle_judge_buttons(true); - //YEAH SENDING LIKE 20 PACKETS IF THE USER SCROLLS THROUGH, GREAT IDEA - //how about this instead - set_side(f_pos); + // YEAH SENDING LIKE 20 PACKETS IF THE USER SCROLLS THROUGH, GREAT IDEA + // how about this instead + set_side(f_pos); } void Courtroom::set_iniswap_dropdown() { - ui_iniswap_dropdown->blockSignals(true); - ui_iniswap_dropdown->clear(); - if (m_cid == -1) { - ui_iniswap_dropdown->hide(); - ui_iniswap_remove->hide(); - return; - } - QStringList iniswaps = ao_app->get_list_file(ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")); - iniswaps.prepend(char_list.at(m_cid).name); - if (iniswaps.size() <= 0) { - ui_iniswap_dropdown->hide(); + ui_iniswap_dropdown->blockSignals(true); + ui_iniswap_dropdown->clear(); + if (m_cid == -1) { + ui_iniswap_dropdown->hide(); + ui_iniswap_remove->hide(); + return; + } + QStringList iniswaps = ao_app->get_list_file( + ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")); + iniswaps.prepend(char_list.at(m_cid).name); + if (iniswaps.size() <= 0) { + ui_iniswap_dropdown->hide(); + ui_iniswap_remove->hide(); + return; + } + ui_iniswap_dropdown->show(); + ui_iniswap_dropdown->addItems(iniswaps); + + for (int i = 0; i < iniswaps.size(); ++i) { + if (iniswaps.at(i) == current_char) { + ui_iniswap_dropdown->setCurrentIndex(i); + if (i != 0) + ui_iniswap_remove->show(); + else ui_iniswap_remove->hide(); - return; - } - ui_iniswap_dropdown->show(); - ui_iniswap_dropdown->addItems(iniswaps); - - for (int i = 0; i < iniswaps.size(); ++i) { - if (iniswaps.at(i) == current_char) { - ui_iniswap_dropdown->setCurrentIndex(i); - if (i != 0) - ui_iniswap_remove->show(); - else - ui_iniswap_remove->hide(); - break; - } + break; } - ui_iniswap_dropdown->blockSignals(false); + } + ui_iniswap_dropdown->blockSignals(false); } void Courtroom::on_iniswap_dropdown_changed(int p_index) { - ui_ic_chat_message->setFocus(); - QString iniswap = ui_iniswap_dropdown->itemText(p_index); - ao_app->set_char_ini(char_list.at(m_cid).name, iniswap, "name", "Options"); - - QStringList swaplist; - for (int i = 0; i < ui_iniswap_dropdown->count(); ++i) { - QString entry = ui_iniswap_dropdown->itemText(i); - if (!swaplist.contains(entry) && entry != char_list.at(m_cid).name) - swaplist.append(entry); - } - ao_app->write_to_file(swaplist.join("\n"), ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")); - ui_iniswap_dropdown->blockSignals(true); - ui_iniswap_dropdown->setCurrentIndex(p_index); - ui_iniswap_dropdown->blockSignals(false); - update_character(m_cid); - if (p_index != 0) - ui_iniswap_remove->show(); - else - ui_iniswap_remove->hide(); + ui_ic_chat_message->setFocus(); + QString iniswap = ui_iniswap_dropdown->itemText(p_index); + ao_app->set_char_ini(char_list.at(m_cid).name, iniswap, "name", "Options"); + + QStringList swaplist; + for (int i = 0; i < ui_iniswap_dropdown->count(); ++i) { + QString entry = ui_iniswap_dropdown->itemText(i); + if (!swaplist.contains(entry) && entry != char_list.at(m_cid).name) + swaplist.append(entry); + } + ao_app->write_to_file( + swaplist.join("\n"), + ao_app->get_character_path(char_list.at(m_cid).name, "iniswaps.ini")); + ui_iniswap_dropdown->blockSignals(true); + ui_iniswap_dropdown->setCurrentIndex(p_index); + ui_iniswap_dropdown->blockSignals(false); + update_character(m_cid); + if (p_index != 0) + ui_iniswap_remove->show(); + else + ui_iniswap_remove->hide(); } void Courtroom::on_iniswap_context_menu_requested(const QPoint &pos) { - QMenu *menu = ui_iniswap_dropdown->lineEdit()->createStandardContextMenu(); - - menu->addSeparator(); - if (file_exists(ao_app->get_character_path(current_char, "char.ini"))) - menu->addAction(QString("Edit " + current_char + "/char.ini"), this, SLOT(on_iniswap_edit_requested())); - if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) != char_list.at(m_cid).name) - menu->addAction(QString("Remove " + current_char), this, SLOT(on_iniswap_remove_clicked())); - menu->popup(ui_iniswap_dropdown->mapToGlobal(pos)); + QMenu *menu = ui_iniswap_dropdown->lineEdit()->createStandardContextMenu(); + + menu->addSeparator(); + if (file_exists(ao_app->get_character_path(current_char, "char.ini"))) + menu->addAction(QString("Edit " + current_char + "/char.ini"), this, + SLOT(on_iniswap_edit_requested())); + if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) != + char_list.at(m_cid).name) + menu->addAction(QString("Remove " + current_char), this, + SLOT(on_iniswap_remove_clicked())); + menu->popup(ui_iniswap_dropdown->mapToGlobal(pos)); } void Courtroom::on_iniswap_edit_requested() { - QString p_path = ao_app->get_character_path(current_char, "char.ini"); - if (!file_exists(p_path)) - return; - QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); + QString p_path = ao_app->get_character_path(current_char, "char.ini"); + if (!file_exists(p_path)) + return; + QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); } void Courtroom::on_iniswap_remove_clicked() { - if (ui_iniswap_dropdown->count() <= 0) { - ui_iniswap_remove->hide(); //We're not supposed to see it. Do this or the client will crash - return; - } - if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) != char_list.at(m_cid).name) { - ui_iniswap_dropdown->removeItem(ui_iniswap_dropdown->currentIndex()); - on_iniswap_dropdown_changed(0); //Reset back to original - update_character(m_cid); - } + if (ui_iniswap_dropdown->count() <= 0) { + ui_iniswap_remove->hide(); // We're not supposed to see it. Do this or the + // client will crash + return; + } + if (ui_iniswap_dropdown->itemText(ui_iniswap_dropdown->currentIndex()) != + char_list.at(m_cid).name) { + ui_iniswap_dropdown->removeItem(ui_iniswap_dropdown->currentIndex()); + on_iniswap_dropdown_changed(0); // Reset back to original + update_character(m_cid); + } } void Courtroom::set_sfx_dropdown() { - ui_sfx_dropdown->blockSignals(true); - ui_sfx_dropdown->clear(); - if (m_cid == -1) { - ui_sfx_dropdown->hide(); - ui_sfx_remove->hide(); - return; - } - QStringList soundlist = ao_app->get_list_file(ao_app->get_character_path(current_char, "soundlist.ini")); - - if (soundlist.size() <= 0) { - soundlist = ao_app->get_list_file(ao_app->get_theme_path("character_soundlist.ini")); - if (soundlist.size() <= 0) { - soundlist = ao_app->get_list_file(ao_app->get_default_theme_path("character_soundlist.ini")); - } - } - + ui_sfx_dropdown->blockSignals(true); + ui_sfx_dropdown->clear(); + if (m_cid == -1) { + ui_sfx_dropdown->hide(); + ui_sfx_remove->hide(); + return; + } + QStringList soundlist = ao_app->get_list_file( + ao_app->get_character_path(current_char, "soundlist.ini")); + + if (soundlist.size() <= 0) { + soundlist = ao_app->get_list_file( + ao_app->get_theme_path("character_soundlist.ini")); if (soundlist.size() <= 0) { - ui_sfx_dropdown->hide(); - ui_sfx_remove->hide(); - return; + soundlist = ao_app->get_list_file( + ao_app->get_default_theme_path("character_soundlist.ini")); } - soundlist.prepend("Default"); + } - ui_sfx_dropdown->show(); - ui_sfx_dropdown->addItems(soundlist); - ui_sfx_dropdown->setCurrentIndex(0); + if (soundlist.size() <= 0) { + ui_sfx_dropdown->hide(); ui_sfx_remove->hide(); - ui_sfx_dropdown->blockSignals(false); + return; + } + soundlist.prepend("Default"); + + ui_sfx_dropdown->show(); + ui_sfx_dropdown->addItems(soundlist); + ui_sfx_dropdown->setCurrentIndex(0); + ui_sfx_remove->hide(); + ui_sfx_dropdown->blockSignals(false); } void Courtroom::on_sfx_dropdown_changed(int p_index) { - ui_ic_chat_message->setFocus(); - - QStringList soundlist; - for (int i = 0; i < ui_sfx_dropdown->count(); ++i) { - QString entry = ui_sfx_dropdown->itemText(i); - if (!soundlist.contains(entry) && entry != "Default") - soundlist.append(entry); - } - - QStringList defaultlist = ao_app->get_list_file(ao_app->get_theme_path("character_soundlist.ini")); - if (defaultlist.size() <= 0) { - defaultlist = ao_app->get_list_file(ao_app->get_default_theme_path("character_soundlist.ini")); - } - - if (defaultlist.size() > 0 && defaultlist.toSet().subtract(soundlist.toSet()).size() > 0) //There's a difference from the default configuration - ao_app->write_to_file(soundlist.join("\n"), ao_app->get_character_path(current_char, "soundlist.ini")); //Create a new sound list - - ui_sfx_dropdown->blockSignals(true); - ui_sfx_dropdown->setCurrentIndex(p_index); - ui_sfx_dropdown->blockSignals(false); - if (p_index != 0) - ui_sfx_remove->show(); - else - ui_sfx_remove->hide(); + ui_ic_chat_message->setFocus(); + + QStringList soundlist; + for (int i = 0; i < ui_sfx_dropdown->count(); ++i) { + QString entry = ui_sfx_dropdown->itemText(i); + if (!soundlist.contains(entry) && entry != "Default") + soundlist.append(entry); + } + + QStringList defaultlist = + ao_app->get_list_file(ao_app->get_theme_path("character_soundlist.ini")); + if (defaultlist.size() <= 0) { + defaultlist = ao_app->get_list_file( + ao_app->get_default_theme_path("character_soundlist.ini")); + } + + if (defaultlist.size() > 0 && + defaultlist.toSet().subtract(soundlist.toSet()).size() > + 0) // There's a difference from the default configuration + ao_app->write_to_file( + soundlist.join("\n"), + ao_app->get_character_path(current_char, + "soundlist.ini")); // Create a new sound list + + ui_sfx_dropdown->blockSignals(true); + ui_sfx_dropdown->setCurrentIndex(p_index); + ui_sfx_dropdown->blockSignals(false); + if (p_index != 0) + ui_sfx_remove->show(); + else + ui_sfx_remove->hide(); } void Courtroom::on_sfx_context_menu_requested(const QPoint &pos) { - QMenu *menu = ui_sfx_dropdown->lineEdit()->createStandardContextMenu(); - - menu->addSeparator(); - if (file_exists(ao_app->get_character_path(current_char, "soundlist.ini"))) - menu->addAction(QString("Edit " + current_char + "/soundlist.ini"), this, SLOT(on_sfx_edit_requested())); - else - menu->addAction(QString("Edit theme's character_soundlist.ini"), this, SLOT(on_sfx_edit_requested())); - if (ui_sfx_dropdown->currentIndex() != 0) - menu->addAction(QString("Remove " + ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex())), this, SLOT(on_sfx_remove_clicked())); - menu->popup(ui_sfx_dropdown->mapToGlobal(pos)); + QMenu *menu = ui_sfx_dropdown->lineEdit()->createStandardContextMenu(); + + menu->addSeparator(); + if (file_exists(ao_app->get_character_path(current_char, "soundlist.ini"))) + menu->addAction(QString("Edit " + current_char + "/soundlist.ini"), this, + SLOT(on_sfx_edit_requested())); + else + menu->addAction(QString("Edit theme's character_soundlist.ini"), this, + SLOT(on_sfx_edit_requested())); + if (ui_sfx_dropdown->currentIndex() != 0) + menu->addAction(QString("Remove " + ui_sfx_dropdown->itemText( + ui_sfx_dropdown->currentIndex())), + this, SLOT(on_sfx_remove_clicked())); + menu->popup(ui_sfx_dropdown->mapToGlobal(pos)); } void Courtroom::on_sfx_edit_requested() { - QString p_path = ao_app->get_character_path(current_char, "soundlist.ini"); + QString p_path = ao_app->get_character_path(current_char, "soundlist.ini"); + if (!file_exists(p_path)) { + p_path = ao_app->get_theme_path("character_soundlist.ini"); if (!file_exists(p_path)) { - p_path = ao_app->get_theme_path("character_soundlist.ini"); - if (!file_exists(p_path)) { - p_path = ao_app->get_default_theme_path("character_soundlist.ini"); - if (!file_exists(p_path)) { - return; - } - } + p_path = ao_app->get_default_theme_path("character_soundlist.ini"); + if (!file_exists(p_path)) { + return; + } } - QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); + } + QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); } void Courtroom::on_sfx_remove_clicked() { - if (ui_sfx_dropdown->count() <= 0) { - ui_sfx_remove->hide(); //We're not supposed to see it. Do this or the client will crash - return; - } - if (ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()) != "Default") { - ui_sfx_dropdown->removeItem(ui_sfx_dropdown->currentIndex()); - on_sfx_dropdown_changed(0); //Reset back to original - } + if (ui_sfx_dropdown->count() <= 0) { + ui_sfx_remove->hide(); // We're not supposed to see it. Do this or the + // client will crash + return; + } + if (ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()) != "Default") { + ui_sfx_dropdown->removeItem(ui_sfx_dropdown->currentIndex()); + on_sfx_dropdown_changed(0); // Reset back to original + } } void Courtroom::set_effects_dropdown() { - ui_effects_dropdown->blockSignals(true); - ui_effects_dropdown->clear(); - if (m_cid == -1) { - ui_effects_dropdown->hide(); - return; - } - QStringList effectslist = ao_app->get_effects(current_char); - - if (effectslist.size() <= 0) { - ui_effects_dropdown->hide(); - return; - } - - effectslist.prepend("None"); - - ui_effects_dropdown->show(); - ui_effects_dropdown->addItems(effectslist); - - //ICON-MAKING HELL - QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); - QString custom_path = ao_app->get_base_path() + "misc/" + p_effect + "/icons/"; - QString theme_path = ao_app->get_theme_path("effects/icons/"); - QString default_path = ao_app->get_default_theme_path("effects/icons/"); - for (int i = 0; i < ui_effects_dropdown->count(); ++i) { - QString entry = ui_effects_dropdown->itemText(i); - QString iconpath = ao_app->get_static_image_suffix(custom_path + entry); - if (!file_exists(iconpath)) { - iconpath = ao_app->get_static_image_suffix(theme_path + entry); - if (!file_exists(iconpath)) { - iconpath = ao_app->get_static_image_suffix(default_path + entry); - if (!file_exists(iconpath)) - continue; - } - } - ui_effects_dropdown->setItemIcon(i, QIcon(iconpath)); - } - - ui_effects_dropdown->setCurrentIndex(0); - ui_effects_dropdown->blockSignals(false); + ui_effects_dropdown->blockSignals(true); + ui_effects_dropdown->clear(); + if (m_cid == -1) { + ui_effects_dropdown->hide(); + return; + } + QStringList effectslist = ao_app->get_effects(current_char); + + if (effectslist.size() <= 0) { + ui_effects_dropdown->hide(); + return; + } + + effectslist.prepend("None"); + + ui_effects_dropdown->show(); + ui_effects_dropdown->addItems(effectslist); + + // ICON-MAKING HELL + QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); + QString custom_path = + ao_app->get_base_path() + "misc/" + p_effect + "/icons/"; + QString theme_path = ao_app->get_theme_path("effects/icons/"); + QString default_path = ao_app->get_default_theme_path("effects/icons/"); + for (int i = 0; i < ui_effects_dropdown->count(); ++i) { + QString entry = ui_effects_dropdown->itemText(i); + QString iconpath = ao_app->get_static_image_suffix(custom_path + entry); + if (!file_exists(iconpath)) { + iconpath = ao_app->get_static_image_suffix(theme_path + entry); + if (!file_exists(iconpath)) { + iconpath = ao_app->get_static_image_suffix(default_path + entry); + if (!file_exists(iconpath)) + continue; + } + } + ui_effects_dropdown->setItemIcon(i, QIcon(iconpath)); + } + + ui_effects_dropdown->setCurrentIndex(0); + ui_effects_dropdown->blockSignals(false); } void Courtroom::on_effects_context_menu_requested(const QPoint &pos) { - QMenu *menu = new QMenu(); + QMenu *menu = new QMenu(); - if (!ao_app->read_char_ini(current_char, "effects", "Options").isEmpty()) - menu->addAction(QString("Open misc/" + ao_app->read_char_ini(current_char, "effects", "Options") + " folder"), this, SLOT(on_character_effects_edit_requested())); - menu->addAction(QString("Open theme's effects folder"), this, SLOT(on_effects_edit_requested())); - menu->popup(ui_effects_dropdown->mapToGlobal(pos)); + if (!ao_app->read_char_ini(current_char, "effects", "Options").isEmpty()) + menu->addAction( + QString("Open misc/" + + ao_app->read_char_ini(current_char, "effects", "Options") + + " folder"), + this, SLOT(on_character_effects_edit_requested())); + menu->addAction(QString("Open theme's effects folder"), this, + SLOT(on_effects_edit_requested())); + menu->popup(ui_effects_dropdown->mapToGlobal(pos)); } void Courtroom::on_effects_edit_requested() { - QString p_path = ao_app->get_theme_path("effects/"); + QString p_path = ao_app->get_theme_path("effects/"); + if (!dir_exists(p_path)) { + p_path = ao_app->get_default_theme_path("effects/"); if (!dir_exists(p_path)) { - p_path = ao_app->get_default_theme_path("effects/"); - if (!dir_exists(p_path)) { - return; - } + return; } - QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); + } + QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); } void Courtroom::on_character_effects_edit_requested() { - QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); - QString p_path = ao_app->get_base_path() + "misc/" + p_effect + "/"; - if (!dir_exists(p_path)) - return; + QString p_effect = ao_app->read_char_ini(current_char, "effects", "Options"); + QString p_path = ao_app->get_base_path() + "misc/" + p_effect + "/"; + if (!dir_exists(p_path)) + return; - QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); + QDesktopServices::openUrl(QUrl::fromLocalFile(p_path)); } void Courtroom::on_effects_dropdown_changed(int p_index) { - effect = ui_effects_dropdown->itemText(p_index); - ui_ic_chat_message->setFocus(); + effect = ui_effects_dropdown->itemText(p_index); + ui_ic_chat_message->setFocus(); } bool Courtroom::effects_dropdown_find_and_set(QString effect) { - for (int i = 0; i < ui_effects_dropdown->count(); ++i) { - QString entry = ui_effects_dropdown->itemText(i); - if (entry == effect) { - ui_effects_dropdown->setCurrentIndex(i); - return true; - } + for (int i = 0; i < ui_effects_dropdown->count(); ++i) { + QString entry = ui_effects_dropdown->itemText(i); + if (entry == effect) { + ui_effects_dropdown->setCurrentIndex(i); + return true; } - return false; + } + return false; } QString Courtroom::get_char_sfx() { - QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); - if (sfx != "" && sfx != "Default") - return sfx; - return ao_app->get_sfx_name(current_char, current_emote); + QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); + if (sfx != "" && sfx != "Default") + return sfx; + return ao_app->get_sfx_name(current_char, current_emote); } int Courtroom::get_char_sfx_delay() { - // QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); - // if (sfx != "" && sfx != "Default") - // return 0; //todo: a way to define this - return ao_app->get_sfx_delay(current_char, current_emote); + // QString sfx = ui_sfx_dropdown->itemText(ui_sfx_dropdown->currentIndex()); + // if (sfx != "" && sfx != "Default") + // return 0; //todo: a way to define this + return ao_app->get_sfx_delay(current_char, current_emote); } 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; + 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; + if (f_char.endsWith(" [x]")) + real_char = f_char.left(f_char.size() - 4); + else + real_char = f_char; - int f_cid = -1; + 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; - } + 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 (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]"); - } + 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; - } + 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; - } + if (f_cid < -2 || f_cid >= char_list.size()) { + qDebug() << "W: " << real_char << " not present in char_list"; + return; + } - other_charid = f_cid; + other_charid = f_cid; - // Redo the character list. - QStringList sorted_pair_list; + // Redo the character list. + QStringList sorted_pair_list; - for (char_type i_char : char_list) - sorted_pair_list.append(i_char.name); + for (char_type i_char : char_list) + sorted_pair_list.append(i_char.name); - sorted_pair_list.sort(); + 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]"); - } + 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) +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); - column = 1; //Column 1 is always the metadata (which we want) - QString p_song = p_item->text(column); - - QStringList packet_contents; - packet_contents.append(p_song); - packet_contents.append(QString::number(m_cid)); - if ((!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) || ao_app->effects_enabled) - packet_contents.append(ui_ic_chat_name->text()); - if (ao_app->effects_enabled) - packet_contents.append(QString::number(music_flags)); - ao_app->send_server_packet(new AOPacket("MC", packet_contents), false); + QStringList packet_contents; + packet_contents.append(p_song); + packet_contents.append(QString::number(m_cid)); + if ((!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) || + ao_app->effects_enabled) + packet_contents.append(ui_ic_chat_name->text()); + if (ao_app->effects_enabled) + packet_contents.append(QString::number(music_flags)); + ao_app->send_server_packet(new AOPacket("MC", packet_contents), false); } void Courtroom::on_music_list_context_menu_requested(const QPoint &pos) { - QMenu *menu = new QMenu(); + QMenu *menu = new QMenu(); - menu->addAction(QString("Expand All Categories"), this, SLOT(music_list_expand_all())); - menu->addAction(QString("Collapse All Categories"), this, SLOT(music_list_collapse_all())); - menu->addSeparator(); + menu->addAction(QString("Expand All Categories"), this, + SLOT(music_list_expand_all())); + menu->addAction(QString("Collapse All Categories"), this, + SLOT(music_list_collapse_all())); + menu->addSeparator(); - menu->addAction(new QAction("Fade Out Previous", this)); - menu->actions().back()->setCheckable(true); - menu->actions().back()->setChecked(music_flags & FADE_OUT); - connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_fade_out(bool))); + menu->addAction(new QAction("Fade Out Previous", this)); + menu->actions().back()->setCheckable(true); + menu->actions().back()->setChecked(music_flags & FADE_OUT); + connect(menu->actions().back(), SIGNAL(toggled(bool)), this, + SLOT(music_fade_out(bool))); - menu->addAction(new QAction("Fade In", this)); - menu->actions().back()->setCheckable(true); - menu->actions().back()->setChecked(music_flags & FADE_IN); - connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_fade_in(bool))); + menu->addAction(new QAction("Fade In", this)); + menu->actions().back()->setCheckable(true); + menu->actions().back()->setChecked(music_flags & FADE_IN); + connect(menu->actions().back(), SIGNAL(toggled(bool)), this, + SLOT(music_fade_in(bool))); - menu->addAction(new QAction("Synchronize", this)); - menu->actions().back()->setCheckable(true); - menu->actions().back()->setChecked(music_flags & SYNC_POS); - connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_synchronize(bool))); + menu->addAction(new QAction("Synchronize", this)); + menu->actions().back()->setCheckable(true); + menu->actions().back()->setChecked(music_flags & SYNC_POS); + connect(menu->actions().back(), SIGNAL(toggled(bool)), this, + SLOT(music_synchronize(bool))); - menu->popup(ui_music_list->mapToGlobal(pos)); + menu->popup(ui_music_list->mapToGlobal(pos)); } void Courtroom::music_fade_out(bool toggle) { - if (toggle) - music_flags |= FADE_OUT; - else - music_flags &= ~FADE_OUT; + if (toggle) + music_flags |= FADE_OUT; + else + music_flags &= ~FADE_OUT; } void Courtroom::music_fade_in(bool toggle) { - if (toggle) - music_flags |= FADE_IN; - else - music_flags &= ~FADE_IN; + if (toggle) + music_flags |= FADE_IN; + else + music_flags &= ~FADE_IN; } void Courtroom::music_synchronize(bool toggle) { - if (toggle) - music_flags |= SYNC_POS; - else - music_flags &= ~SYNC_POS; + if (toggle) + music_flags |= SYNC_POS; + else + music_flags &= ~SYNC_POS; } -void Courtroom::music_list_expand_all() -{ - ui_music_list->expandAll(); -} +void Courtroom::music_list_expand_all() { ui_music_list->expandAll(); } void Courtroom::music_list_collapse_all() { - ui_music_list->collapseAll(); - QTreeWidgetItem *current = ui_music_list->selectedItems()[0]; - if (current->parent() != nullptr) - current = current->parent(); - ui_music_list->setCurrentItem(current); + ui_music_list->collapseAll(); + QTreeWidgetItem *current = ui_music_list->selectedItems()[0]; + if (current->parent() != nullptr) + current = current->parent(); + ui_music_list->setCurrentItem(current); } void Courtroom::on_area_list_double_clicked(QTreeWidgetItem *p_item, int column) { - column = 0; //The metadata - QString p_area = p_item->text(0); - - QStringList packet_contents; - packet_contents.append(p_area); - packet_contents.append(QString::number(m_cid)); - qDebug() << packet_contents; - ao_app->send_server_packet(new AOPacket("MC", packet_contents), false); + column = 0; // The metadata + QString p_area = p_item->text(0); + + QStringList packet_contents; + packet_contents.append(p_area); + packet_contents.append(QString::number(m_cid)); + qDebug() << packet_contents; + ao_app->send_server_packet(new AOPacket("MC", packet_contents), false); } void Courtroom::on_hold_it_clicked() { - if (objection_state == 1) { - ui_hold_it->set_image("holdit"); - objection_state = 0; - } - else { - ui_objection->set_image("objection"); - ui_take_that->set_image("takethat"); - ui_custom_objection->set_image("custom"); + if (objection_state == 1) { + ui_hold_it->set_image("holdit"); + objection_state = 0; + } + else { + ui_objection->set_image("objection"); + ui_take_that->set_image("takethat"); + ui_custom_objection->set_image("custom"); - ui_hold_it->set_image("holdit_selected"); - objection_state = 1; - } + ui_hold_it->set_image("holdit_selected"); + objection_state = 1; + } - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_objection_clicked() { - if (objection_state == 2) { - ui_objection->set_image("objection"); - objection_state = 0; - } - else { - ui_hold_it->set_image("holdit"); - ui_take_that->set_image("takethat"); - ui_custom_objection->set_image("custom"); + if (objection_state == 2) { + ui_objection->set_image("objection"); + objection_state = 0; + } + else { + ui_hold_it->set_image("holdit"); + ui_take_that->set_image("takethat"); + ui_custom_objection->set_image("custom"); - ui_objection->set_image("objection_selected"); - objection_state = 2; - } + ui_objection->set_image("objection_selected"); + objection_state = 2; + } - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_take_that_clicked() { - if (objection_state == 3) { - ui_take_that->set_image("takethat"); - objection_state = 0; - } - else { - ui_objection->set_image("objection"); - ui_hold_it->set_image("holdit"); - ui_custom_objection->set_image("custom"); + if (objection_state == 3) { + ui_take_that->set_image("takethat"); + objection_state = 0; + } + else { + ui_objection->set_image("objection"); + ui_hold_it->set_image("holdit"); + ui_custom_objection->set_image("custom"); - ui_take_that->set_image("takethat_selected"); - objection_state = 3; - } + ui_take_that->set_image("takethat_selected"); + objection_state = 3; + } - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_custom_objection_clicked() { - if (objection_state == 4) { - ui_custom_objection->set_image("custom"); - objection_state = 0; - } - else { - ui_objection->set_image("objection"); - ui_take_that->set_image("takethat"); - ui_hold_it->set_image("holdit"); + if (objection_state == 4) { + ui_custom_objection->set_image("custom"); + objection_state = 0; + } + else { + ui_objection->set_image("objection"); + ui_take_that->set_image("takethat"); + ui_hold_it->set_image("holdit"); - ui_custom_objection->set_image("custom_selected"); - objection_state = 4; - } + ui_custom_objection->set_image("custom_selected"); + objection_state = 4; + } - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_realization_clicked() { - if (realization_state == 0) { - realization_state = 1; - if (effects_dropdown_find_and_set("realization")) - on_effects_dropdown_changed(ui_effects_dropdown->currentIndex()); + if (realization_state == 0) { + realization_state = 1; + if (effects_dropdown_find_and_set("realization")) + on_effects_dropdown_changed(ui_effects_dropdown->currentIndex()); - ui_realization->set_image("realization_pressed"); - } - else { - realization_state = 0; - ui_effects_dropdown->setCurrentIndex(0); - on_effects_dropdown_changed(ui_effects_dropdown->currentIndex()); - ui_realization->set_image("realization"); - } + ui_realization->set_image("realization_pressed"); + } + else { + realization_state = 0; + ui_effects_dropdown->setCurrentIndex(0); + on_effects_dropdown_changed(ui_effects_dropdown->currentIndex()); + ui_realization->set_image("realization"); + } - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_screenshake_clicked() { - if (screenshake_state == 0) { - screenshake_state = 1; - ui_screenshake->set_image("screenshake_pressed"); - } - else { - screenshake_state = 0; - ui_screenshake->set_image("screenshake"); - } + if (screenshake_state == 0) { + screenshake_state = 1; + ui_screenshake->set_image("screenshake_pressed"); + } + else { + screenshake_state = 0; + ui_screenshake->set_image("screenshake"); + } - ui_ic_chat_message->setFocus(); + 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_order_dropdown->hide(); - ui_pair_button->set_image("pair_button"); - ui_mute->set_image("mute_pressed"); - } - else { - ui_mute_list->hide(); - ui_mute->set_image("mute"); - } + if (ui_mute_list->isHidden()) { + ui_mute_list->show(); + ui_pair_list->hide(); + ui_pair_offset_spinbox->hide(); + ui_pair_order_dropdown->hide(); + ui_pair_button->set_image("pair_button"); + ui_mute->set_image("mute_pressed"); + } + else { + ui_mute_list->hide(); + ui_mute->set_image("mute"); + } } void Courtroom::on_pair_clicked() { - if (ui_pair_list->isHidden()) { - ui_pair_list->show(); - ui_pair_offset_spinbox->show(); - ui_pair_order_dropdown->show(); - ui_mute_list->hide(); - ui_mute->set_image("mute"); - ui_pair_button->set_image("pair_button_pressed"); - } - else { - ui_pair_list->hide(); - ui_pair_offset_spinbox->hide(); - ui_pair_order_dropdown->hide(); - ui_pair_button->set_image("pair_button"); - } + if (ui_pair_list->isHidden()) { + ui_pair_list->show(); + ui_pair_offset_spinbox->show(); + ui_pair_order_dropdown->show(); + ui_mute_list->hide(); + ui_mute->set_image("mute"); + ui_pair_button->set_image("pair_button_pressed"); + } + else { + ui_pair_list->hide(); + ui_pair_offset_spinbox->hide(); + ui_pair_order_dropdown->hide(); + ui_pair_button->set_image("pair_button"); + } } void Courtroom::on_pair_order_dropdown_changed(int p_index) { - pair_order = p_index; + pair_order = p_index; } void Courtroom::on_defense_minus_clicked() { - int f_state = defense_bar_state - 1; + int f_state = defense_bar_state - 1; - if (f_state >= 0) - ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%")); + 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; + int f_state = defense_bar_state + 1; - if (f_state <= 10) - ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%")); + 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; + int f_state = prosecution_bar_state - 1; - if (f_state >= 0) - ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%")); + 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; + int f_state = prosecution_bar_state + 1; - if (f_state <= 10) - ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%")); + if (f_state <= 10) + ao_app->send_server_packet( + new AOPacket("HP#2#" + QString::number(f_state) + "#%")); } void Courtroom::set_text_color_dropdown() { - //Clear the lists - ui_text_color->clear(); - color_row_to_number.clear(); - - //Clear the stored optimization information - color_rgb_list.clear(); - color_markdown_start_list.clear(); - color_markdown_end_list.clear(); - color_markdown_remove_list.clear(); - color_markdown_talking_list.clear(); - - //Update markdown colors. TODO: make a loading function that only loads the config file once instead of several times - for (int c = 0; c < max_colors; ++c) { - QColor color = ao_app->get_chat_color(QString::number(c), current_char); - color_rgb_list.append(color); - color_markdown_start_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_start", current_char)); - color_markdown_end_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_end", current_char)); - color_markdown_remove_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_remove", current_char) == "1"); - color_markdown_talking_list.append(ao_app->get_chat_markdown("c" + QString::number(c) + "_talking", current_char) == "1"); - - QString color_name = ao_app->get_chat_markdown("c" + QString::number(c) + "_name", current_char); - if (color_name.isEmpty()) //Not defined - { - if (c > 0) - continue; - color_name = tr("Default"); - } - ui_text_color->addItem(color_name); - QPixmap pixmap(16, 16); - pixmap.fill(color); - ui_text_color->setItemIcon(ui_text_color->count() - 1, QIcon(pixmap)); - color_row_to_number.append(c); + // Clear the lists + ui_text_color->clear(); + color_row_to_number.clear(); + + // Clear the stored optimization information + color_rgb_list.clear(); + color_markdown_start_list.clear(); + color_markdown_end_list.clear(); + color_markdown_remove_list.clear(); + color_markdown_talking_list.clear(); + + // Update markdown colors. TODO: make a loading function that only loads the + // config file once instead of several times + for (int c = 0; c < max_colors; ++c) { + QColor color = ao_app->get_chat_color(QString::number(c), current_char); + color_rgb_list.append(color); + color_markdown_start_list.append(ao_app->get_chat_markdown( + "c" + QString::number(c) + "_start", current_char)); + color_markdown_end_list.append(ao_app->get_chat_markdown( + "c" + QString::number(c) + "_end", current_char)); + color_markdown_remove_list.append( + ao_app->get_chat_markdown("c" + QString::number(c) + "_remove", + current_char) == "1"); + color_markdown_talking_list.append( + ao_app->get_chat_markdown("c" + QString::number(c) + "_talking", + current_char) == "1"); + + QString color_name = ao_app->get_chat_markdown( + "c" + QString::number(c) + "_name", current_char); + if (color_name.isEmpty()) // Not defined + { + if (c > 0) + continue; + color_name = tr("Default"); } + ui_text_color->addItem(color_name); + QPixmap pixmap(16, 16); + pixmap.fill(color); + ui_text_color->setItemIcon(ui_text_color->count() - 1, QIcon(pixmap)); + color_row_to_number.append(c); + } } void Courtroom::on_text_color_changed(int p_color) { - if (ui_ic_chat_message->selectionStart() != -1) //We have a selection! - { - int c = color_row_to_number.at(p_color); - QString markdown_start = color_markdown_start_list.at(c); - if (markdown_start.isEmpty()) { - qDebug() << "W: Color list dropdown selected a non-existent markdown start character"; - return; - } - QString markdown_end = color_markdown_end_list.at(c); - if (markdown_end.isEmpty()) - markdown_end = markdown_start; - int start = ui_ic_chat_message->selectionStart(); - int end = ui_ic_chat_message->selectionEnd() + 1; - ui_ic_chat_message->setCursorPosition(start); - ui_ic_chat_message->insert(markdown_start); - ui_ic_chat_message->setCursorPosition(end); - ui_ic_chat_message->insert(markdown_end); - // ui_ic_chat_message->end(false); - ui_text_color->setCurrentIndex(0); - } - else { - if (p_color != -1 && p_color < color_row_to_number.size()) - text_color = color_row_to_number.at(p_color); - else - text_color = 0; - } - ui_ic_chat_message->setFocus(); + if (ui_ic_chat_message->selectionStart() != -1) // We have a selection! + { + int c = color_row_to_number.at(p_color); + QString markdown_start = color_markdown_start_list.at(c); + if (markdown_start.isEmpty()) { + qDebug() << "W: Color list dropdown selected a non-existent markdown " + "start character"; + return; + } + QString markdown_end = color_markdown_end_list.at(c); + if (markdown_end.isEmpty()) + markdown_end = markdown_start; + int start = ui_ic_chat_message->selectionStart(); + int end = ui_ic_chat_message->selectionEnd() + 1; + ui_ic_chat_message->setCursorPosition(start); + ui_ic_chat_message->insert(markdown_start); + ui_ic_chat_message->setCursorPosition(end); + ui_ic_chat_message->insert(markdown_end); + // ui_ic_chat_message->end(false); + ui_text_color->setCurrentIndex(0); + } + else { + if (p_color != -1 && p_color < color_row_to_number.size()) + text_color = color_row_to_number.at(p_color); + else + text_color = 0; + } + ui_ic_chat_message->setFocus(); } void Courtroom::on_music_slider_moved(int p_value) { - music_player->set_volume(p_value, 0); //Set volume on music layer - ui_ic_chat_message->setFocus(); + music_player->set_volume(p_value, 0); // Set volume on music layer + ui_ic_chat_message->setFocus(); } void Courtroom::on_sfx_slider_moved(int p_value) { - sfx_player->set_volume(p_value); - //Set the ambience and other misc. music layers - for (int i = 1; i < music_player->m_channelmax; ++i) { - music_player->set_volume(p_value, i); - } - objection_player->set_volume(p_value); - ui_ic_chat_message->setFocus(); + sfx_player->set_volume(p_value); + // Set the ambience and other misc. music layers + for (int i = 1; i < music_player->m_channelmax; ++i) { + music_player->set_volume(p_value, i); + } + objection_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(); + 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_log_limit_changed(int value) { log_maximum_blocks = value; } -void Courtroom::on_pair_offset_changed(int value) -{ - char_offset = value; -} +void Courtroom::on_pair_offset_changed(int value) { char_offset = value; } void Courtroom::on_witness_testimony_clicked() { - if (is_muted) - return; + if (is_muted) + return; - ao_app->send_server_packet(new AOPacket("RT#testimony1#%")); + ao_app->send_server_packet(new AOPacket("RT#testimony1#%")); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_cross_examination_clicked() { - if (is_muted) - return; + if (is_muted) + return; - ao_app->send_server_packet(new AOPacket("RT#testimony2#%")); + ao_app->send_server_packet(new AOPacket("RT#testimony2#%")); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_not_guilty_clicked() { - if (is_muted) - return; + if (is_muted) + return; - ao_app->send_server_packet(new AOPacket("RT#judgeruling#0#%")); + ao_app->send_server_packet(new AOPacket("RT#judgeruling#0#%")); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_guilty_clicked() { - if (is_muted) - return; + if (is_muted) + return; - ao_app->send_server_packet(new AOPacket("RT#judgeruling#1#%")); + ao_app->send_server_packet(new AOPacket("RT#judgeruling#1#%")); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_change_character_clicked() { - sfx_player->set_volume(0); - blip_player->set_volume(0); + sfx_player->set_volume(0); + blip_player->set_volume(0); - set_char_select(); + set_char_select(); - ui_char_select_background->show(); - ui_spectator->hide(); + ui_char_select_background->show(); + ui_spectator->hide(); } void Courtroom::on_reload_theme_clicked() { - ao_app->reload_theme(); + ao_app->reload_theme(); - enter_courtroom(); - update_character(m_cid); + enter_courtroom(); + update_character(m_cid); - anim_state = 4; - text_state = 3; + anim_state = 4; + text_state = 3; - //to update status on the background - set_background(current_background); + // to update status on the background + set_background(current_background); } void Courtroom::on_back_to_lobby_clicked() { - ao_app->construct_lobby(); - ao_app->destruct_courtroom(); + ao_app->construct_lobby(); + ao_app->destruct_courtroom(); } void Courtroom::on_char_select_left_clicked() { - --current_char_page; - set_char_select_page(); + --current_char_page; + set_char_select_page(); } void Courtroom::on_char_select_right_clicked() { - ++current_char_page; - set_char_select_page(); + ++current_char_page; + set_char_select_page(); } -void Courtroom::on_spectator_clicked() -{ - update_character(-1); -} +void Courtroom::on_spectator_clicked() { update_character(-1); } 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; - } + if (ao_app->modcall_reason_enabled) { + QMessageBox errorBox; + QInputDialog input; - QStringList mod_reason; - mod_reason.append(text); + input.setWindowFlags(Qt::WindowSystemMenuHint); + input.setLabelText(tr("Reason:")); + input.setWindowTitle(tr("Call Moderator")); + auto code = input.exec(); - ao_app->send_server_packet(new AOPacket("ZZ", mod_reason)); + 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 { - ao_app->send_server_packet(new AOPacket("ZZ#%")); + else if (text.length() > 256) { + errorBox.critical(nullptr, tr("Error"), tr("The message is too long.")); + return; } - ui_ic_chat_message->setFocus(); -} + QStringList mod_reason; + mod_reason.append(text); -void Courtroom::on_settings_clicked() -{ - ao_app->call_settings_menu(); + 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); + ao_app->call_announce_menu(this); } -void Courtroom::on_pre_clicked() -{ - ui_ic_chat_message->setFocus(); -} +void Courtroom::on_pre_clicked() { ui_ic_chat_message->setFocus(); } -void Courtroom::on_flip_clicked() -{ - ui_ic_chat_message->setFocus(); -} +void Courtroom::on_flip_clicked() { ui_ic_chat_message->setFocus(); } void Courtroom::on_additive_clicked() { - if (ui_additive->isChecked()) { - ui_ic_chat_message->home(false); //move cursor to the start of the message - ui_ic_chat_message->insert(" "); //preface the message by whitespace - ui_ic_chat_message->end(false); //move cursor to the end of the message without selecting anything - } - ui_ic_chat_message->setFocus(); + if (ui_additive->isChecked()) { + ui_ic_chat_message->home(false); // move cursor to the start of the message + ui_ic_chat_message->insert(" "); // preface the message by whitespace + ui_ic_chat_message->end(false); // move cursor to the end of the message + // without selecting anything + } + ui_ic_chat_message->setFocus(); } -void Courtroom::on_guard_clicked() -{ - ui_ic_chat_message->setFocus(); -} +void Courtroom::on_guard_clicked() { ui_ic_chat_message->setFocus(); } void Courtroom::on_showname_enable_clicked() { - ui_ic_chatlog->clear(); - first_message_sent = false; + ui_ic_chatlog->clear(); + first_message_sent = false; - foreach (chatlogpiece item, ic_chatlog_history) { - if (ui_showname_enable->isChecked()) { - if (item.is_song()) - append_ic_text(item.get_message(), item.get_showname(), "has played a song"); - else - append_ic_text(item.get_message(), item.get_showname()); - } - else { - if (item.is_song()) - append_ic_text(item.get_message(), item.get_name(), "has played a song"); - else - append_ic_text(item.get_message(), item.get_name()); - } + foreach (chatlogpiece item, ic_chatlog_history) { + if (ui_showname_enable->isChecked()) { + if (item.is_song()) + append_ic_text(item.get_message(), item.get_showname(), + "has played a song"); + else + append_ic_text(item.get_message(), item.get_showname()); + } + else { + if (item.is_song()) + append_ic_text(item.get_message(), item.get_name(), + "has played a song"); + else + append_ic_text(item.get_message(), item.get_name()); } + } - ui_ic_chat_message->setFocus(); + 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(); - } + if (ui_evidence->isHidden()) { + ui_evidence->show(); + ui_evidence_overlay->hide(); + } + else { + ui_evidence->hide(); + } } void Courtroom::on_switch_area_music_clicked() { - ui_music_search->setText(""); - on_music_search_edited(ui_music_search->text()); - if (ui_area_list->isHidden()) { - ui_area_list->show(); - ui_music_list->hide(); - } - else { - ui_area_list->hide(); - ui_music_list->show(); - } + ui_music_search->setText(""); + on_music_search_edited(ui_music_search->text()); + if (ui_area_list->isHidden()) { + ui_area_list->show(); + ui_music_list->hide(); + } + else { + ui_area_list->hide(); + ui_music_list->show(); + } } void Courtroom::ping_server() { - ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%")); + ao_app->send_server_packet( + new AOPacket("CH#" + QString::number(m_cid) + "#%")); } void Courtroom::on_casing_clicked() { - if (ao_app->casing_alerts_enabled) { - if (ui_casing->isChecked()) { - 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())); - - 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#%")); + 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())); + + 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#%")); + } } -void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno) +void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, + bool jur, bool steno) { - if (ao_app->casing_alerts_enabled) { - QStringList f_packet; + 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(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)); - ao_app->send_server_packet(new AOPacket("CASEA", f_packet)); - } + ao_app->send_server_packet(new AOPacket("CASEA", f_packet)); + } } Courtroom::~Courtroom() { - delete music_player; - delete sfx_player; - delete objection_player; - delete blip_player; + delete music_player; + delete sfx_player; + delete objection_player; + delete blip_player; } #if (defined(_WIN32) || defined(_WIN64)) void Courtroom::load_bass_opus_plugin() { #ifdef BASSAUDIO - BASS_PluginLoad("bassopus.dll", 0); + BASS_PluginLoad("bassopus.dll", 0); #endif } #elif (defined(LINUX) || defined(__linux__)) void Courtroom::load_bass_opus_plugin() { #ifdef BASSAUDIO - BASS_PluginLoad("libbassopus.so", 0); + BASS_PluginLoad("libbassopus.so", 0); #endif } #elif defined __APPLE__ void Courtroom::load_bass_opus_plugin() { - QString libpath = ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib"; - QByteArray ba = libpath.toLocal8Bit(); + QString libpath = + ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib"; + QByteArray ba = libpath.toLocal8Bit(); #ifdef BASSAUDIO - BASS_PluginLoad(ba.data(), 0); + BASS_PluginLoad(ba.data(), 0); #endif } #else diff --git a/src/debug_functions.cpp b/src/debug_functions.cpp index ba189ec0..b8321640 100644 --- a/src/debug_functions.cpp +++ b/src/debug_functions.cpp @@ -5,22 +5,25 @@ void call_error(QString p_message) { - QMessageBox *msgBox = new QMessageBox; + QMessageBox *msgBox = new QMessageBox; - msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1").arg(p_message)); - msgBox->setWindowTitle(QCoreApplication::translate("debug_functions", "Error")); + msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1") + .arg(p_message)); + msgBox->setWindowTitle( + QCoreApplication::translate("debug_functions", "Error")); - //msgBox->setWindowModality(Qt::NonModal); - msgBox->exec(); + // msgBox->setWindowModality(Qt::NonModal); + msgBox->exec(); } void call_notice(QString p_message) { - QMessageBox *msgBox = new QMessageBox; + QMessageBox *msgBox = new QMessageBox; - msgBox->setText(p_message); - msgBox->setWindowTitle(QCoreApplication::translate("debug_functions", "Notice")); + msgBox->setText(p_message); + msgBox->setWindowTitle( + QCoreApplication::translate("debug_functions", "Notice")); - //msgBox->setWindowModality(Qt::NonModal); - msgBox->exec(); + // msgBox->setWindowModality(Qt::NonModal); + msgBox->exec(); } diff --git a/src/discord_rich_presence.cpp b/src/discord_rich_presence.cpp index 05a94948..aea07e5e 100644 --- a/src/discord_rich_presence.cpp +++ b/src/discord_rich_presence.cpp @@ -3,129 +3,120 @@ namespace AttorneyOnline { #ifdef DISCORD - Discord::Discord() - { - DiscordEventHandlers handlers; - std::memset(&handlers, 0, sizeof(handlers)); - handlers = {}; - 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) { - qWarning() << "Discord RPC errored out! " << message << errorCode; - }; - qInfo() << "Initializing Discord RPC"; - Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr); - } - - Discord::~Discord() - { - Discord_Shutdown(); - } - - void Discord::state_lobby() - { - DiscordRichPresence presence; - std::memset(&presence, 0, sizeof(presence)); - presence.largeImageKey = "ao2-logo"; - presence.largeImageText = "Objection!"; - presence.instance = 1; - - presence.state = "In Lobby"; - presence.details = "Idle"; - Discord_UpdatePresence(&presence); - } - - void Discord::state_server(std::string name, std::string server_id) - { - qDebug() << "Discord RPC: Setting server state"; - - DiscordRichPresence presence; - std::memset(&presence, 0, sizeof(presence)); - presence.largeImageKey = "ao2-logo"; - presence.largeImageText = "Objection!"; - presence.instance = 1; - - auto timestamp = static_cast(std::time(nullptr)); - - presence.state = "In a Server"; - presence.details = name.c_str(); - presence.matchSecret = server_id.c_str(); - presence.startTimestamp = this->timestamp; - - this->server_id = server_id; - this->server_name = name; - this->timestamp = timestamp; - Discord_UpdatePresence(&presence); - } - - void Discord::state_character(std::string name) - { - 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() << ")"; - - DiscordRichPresence presence; - std::memset(&presence, 0, sizeof(presence)); - presence.largeImageKey = "ao2-logo"; - presence.largeImageText = "Objection!"; - presence.instance = 1; - presence.details = this->server_name.c_str(); - presence.matchSecret = this->server_id.c_str(); - presence.startTimestamp = this->timestamp; - - presence.state = playing_as.c_str(); - presence.smallImageKey = name_internal.c_str(); - // presence.smallImageText = name_internal.c_str(); - Discord_UpdatePresence(&presence); - } - - void Discord::state_spectate() - { - qDebug() << "Discord RPC: Setting specator state"; - - DiscordRichPresence presence; - std::memset(&presence, 0, sizeof(presence)); - presence.largeImageKey = "ao2-logo"; - presence.largeImageText = "Objection!"; - presence.instance = 1; - presence.details = this->server_name.c_str(); - presence.matchSecret = this->server_id.c_str(); - presence.startTimestamp = this->timestamp; - - presence.state = "Spectating"; - Discord_UpdatePresence(&presence); - } +Discord::Discord() +{ + DiscordEventHandlers handlers; + std::memset(&handlers, 0, sizeof(handlers)); + handlers = {}; + 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) { + qWarning() << "Discord RPC errored out! " << message << errorCode; + }; + qInfo() << "Initializing Discord RPC"; + Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr); +} + +Discord::~Discord() { Discord_Shutdown(); } + +void Discord::state_lobby() +{ + DiscordRichPresence presence; + std::memset(&presence, 0, sizeof(presence)); + presence.largeImageKey = "ao2-logo"; + presence.largeImageText = "Objection!"; + presence.instance = 1; + + presence.state = "In Lobby"; + presence.details = "Idle"; + Discord_UpdatePresence(&presence); +} + +void Discord::state_server(std::string name, std::string server_id) +{ + qDebug() << "Discord RPC: Setting server state"; + + DiscordRichPresence presence; + std::memset(&presence, 0, sizeof(presence)); + presence.largeImageKey = "ao2-logo"; + presence.largeImageText = "Objection!"; + presence.instance = 1; + + auto timestamp = static_cast(std::time(nullptr)); + + presence.state = "In a Server"; + presence.details = name.c_str(); + presence.matchSecret = server_id.c_str(); + presence.startTimestamp = this->timestamp; + + this->server_id = server_id; + this->server_name = name; + this->timestamp = timestamp; + Discord_UpdatePresence(&presence); +} + +void Discord::state_character(std::string name) +{ + 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() + << ")"; + + DiscordRichPresence presence; + std::memset(&presence, 0, sizeof(presence)); + presence.largeImageKey = "ao2-logo"; + presence.largeImageText = "Objection!"; + presence.instance = 1; + presence.details = this->server_name.c_str(); + presence.matchSecret = this->server_id.c_str(); + presence.startTimestamp = this->timestamp; + + presence.state = playing_as.c_str(); + presence.smallImageKey = name_internal.c_str(); + // presence.smallImageText = name_internal.c_str(); + Discord_UpdatePresence(&presence); +} + +void Discord::state_spectate() +{ + qDebug() << "Discord RPC: Setting specator state"; + + DiscordRichPresence presence; + std::memset(&presence, 0, sizeof(presence)); + presence.largeImageKey = "ao2-logo"; + presence.largeImageText = "Objection!"; + presence.instance = 1; + presence.details = this->server_name.c_str(); + presence.matchSecret = this->server_id.c_str(); + presence.startTimestamp = this->timestamp; + + presence.state = "Spectating"; + Discord_UpdatePresence(&presence); +} #else - Discord::Discord() - { - } - - Discord::~Discord() - { - } - - void Discord::state_lobby() - { - } - - void Discord::state_server(std::string name, std::string server_id) - { - qDebug() << "Discord RPC: Setting server state"; - } - - void Discord::state_character(std::string name) - { - qDebug() << "Discord RPC: Setting character state"; - } - - void Discord::state_spectate() - { - qDebug() << "Discord RPC: Setting specator state"; - } +Discord::Discord() {} + +Discord::~Discord() {} + +void Discord::state_lobby() {} + +void Discord::state_server(std::string name, std::string server_id) +{ + qDebug() << "Discord RPC: Setting server state"; +} + +void Discord::state_character(std::string name) +{ + qDebug() << "Discord RPC: Setting character state"; +} + +void Discord::state_spectate() +{ + qDebug() << "Discord RPC: Setting specator state"; +} #endif } // namespace AttorneyOnline diff --git a/src/emotes.cpp b/src/emotes.cpp index 59952971..8de55244 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -4,189 +4,203 @@ void Courtroom::initialize_emotes() { - ui_emotes = new QWidget(this); + ui_emotes = new QWidget(this); - ui_emote_left = new AOButton(this, ao_app); - ui_emote_right = new AOButton(this, ao_app); + ui_emote_left = new AOButton(this, ao_app); + ui_emote_right = new AOButton(this, ao_app); - ui_emote_dropdown = new QComboBox(this); + ui_emote_dropdown = new QComboBox(this); - connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked())); - connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked())); + connect(ui_emote_left, SIGNAL(clicked()), this, + SLOT(on_emote_left_clicked())); + connect(ui_emote_right, SIGNAL(clicked()), this, + SLOT(on_emote_right_clicked())); - connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int))); + connect(ui_emote_dropdown, SIGNAL(activated(int)), this, + SLOT(on_emote_dropdown_changed(int))); } void Courtroom::refresh_emotes() { - //Should properly refresh the emote list - qDeleteAll(ui_emote_list.begin(), ui_emote_list.end()); - ui_emote_list.clear(); + // Should properly refresh the emote list + qDeleteAll(ui_emote_list.begin(), ui_emote_list.end()); + ui_emote_list.clear(); - set_size_and_pos(ui_emotes, "emotes"); + set_size_and_pos(ui_emotes, "emotes"); - set_size_and_pos(ui_emote_left, "emote_left"); - ui_emote_left->set_image("arrow_left"); + set_size_and_pos(ui_emote_left, "emote_left"); + ui_emote_left->set_image("arrow_left"); - set_size_and_pos(ui_emote_right, "emote_right"); - ui_emote_right->set_image("arrow_right"); + set_size_and_pos(ui_emote_right, "emote_right"); + ui_emote_right->set_image("arrow_right"); - QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini"); - QPoint p_point = ao_app->get_button_spacing("emote_button_size", "courtroom_design.ini"); + QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", + "courtroom_design.ini"); + QPoint p_point = + ao_app->get_button_spacing("emote_button_size", "courtroom_design.ini"); - const int button_width = p_point.x(); - int x_spacing = f_spacing.x(); - int x_mod_count = 0; + const int button_width = p_point.x(); + int x_spacing = f_spacing.x(); + int x_mod_count = 0; - const int button_height = p_point.y(); - int y_spacing = f_spacing.y(); - int y_mod_count = 0; + const int button_height = p_point.y(); + 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; + max_emotes_on_page = emote_columns * emote_rows; - 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; + 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; - AOEmoteButton *f_emote = new AOEmoteButton(ui_emotes, ao_app, x_pos, y_pos, button_width, button_height); + AOEmoteButton *f_emote = new AOEmoteButton(ui_emotes, ao_app, x_pos, y_pos, + button_width, button_height); - ui_emote_list.append(f_emote); + ui_emote_list.append(f_emote); - f_emote->set_id(n); + 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; + ++x_mod_count; - if (x_mod_count == emote_columns) { - ++y_mod_count; - x_mod_count = 0; - } + if (x_mod_count == emote_columns) { + ++y_mod_count; + x_mod_count = 0; } + } } void Courtroom::set_emote_page() { - if (m_cid == -1) - return; + if (m_cid == -1) + return; - int total_emotes = ao_app->get_emote_number(current_char); + int total_emotes = ao_app->get_emote_number(current_char); - ui_emote_left->hide(); - ui_emote_right->hide(); + ui_emote_left->hide(); + ui_emote_right->hide(); - for (AOEmoteButton *i_button : ui_emote_list) { - i_button->hide(); - } + for (AOEmoteButton *i_button : ui_emote_list) { + i_button->hide(); + } - int total_pages = total_emotes / max_emotes_on_page; - int emotes_on_page = 0; + int total_pages = total_emotes / max_emotes_on_page; + int emotes_on_page = 0; - if (total_emotes % max_emotes_on_page != 0) { - ++total_pages; - //i. e. not on the last page - if (total_pages > current_emote_page + 1) - emotes_on_page = max_emotes_on_page; - else - emotes_on_page = total_emotes % max_emotes_on_page; - } + if (total_emotes % max_emotes_on_page != 0) { + ++total_pages; + // i. e. not on the last page + if (total_pages > current_emote_page + 1) + emotes_on_page = max_emotes_on_page; else - emotes_on_page = max_emotes_on_page; + emotes_on_page = total_emotes % max_emotes_on_page; + } + else + emotes_on_page = max_emotes_on_page; - if (total_pages > current_emote_page + 1) - ui_emote_right->show(); + if (total_pages > current_emote_page + 1) + ui_emote_right->show(); - if (current_emote_page > 0) - ui_emote_left->show(); + if (current_emote_page > 0) + ui_emote_left->show(); - for (int n_emote = 0; n_emote < emotes_on_page && n_emote < ui_emote_list.size(); ++n_emote) { - int n_real_emote = n_emote + current_emote_page * max_emotes_on_page; - AOEmoteButton *f_emote = ui_emote_list.at(n_emote); + for (int n_emote = 0; + n_emote < emotes_on_page && n_emote < ui_emote_list.size(); ++n_emote) { + int n_real_emote = n_emote + current_emote_page * max_emotes_on_page; + AOEmoteButton *f_emote = ui_emote_list.at(n_emote); - if (n_real_emote == current_emote) - f_emote->set_char_image(current_char, n_real_emote, "_on"); - else - f_emote->set_char_image(current_char, n_real_emote, "_off"); + if (n_real_emote == current_emote) + f_emote->set_char_image(current_char, n_real_emote, "_on"); + else + f_emote->set_char_image(current_char, n_real_emote, "_off"); - f_emote->show(); - f_emote->setToolTip(QString::number(n_real_emote + 1) + ": " + ao_app->get_emote_comment(current_char, n_real_emote)); - } + f_emote->show(); + f_emote->setToolTip(QString::number(n_real_emote + 1) + ": " + + ao_app->get_emote_comment(current_char, n_real_emote)); + } } void Courtroom::set_emote_dropdown() { - ui_emote_dropdown->clear(); + ui_emote_dropdown->clear(); - int total_emotes = ao_app->get_emote_number(current_char); - QStringList emote_list; + int total_emotes = ao_app->get_emote_number(current_char); + QStringList emote_list; - for (int n = 0; n < total_emotes; ++n) { - emote_list.append(QString::number(n + 1) + ": " + ao_app->get_emote_comment(current_char, n)); - } + for (int n = 0; n < total_emotes; ++n) { + emote_list.append(QString::number(n + 1) + ": " + + ao_app->get_emote_comment(current_char, n)); + } - ui_emote_dropdown->addItems(emote_list); + ui_emote_dropdown->addItems(emote_list); } void Courtroom::select_emote(int p_id) { - int min = current_emote_page * max_emotes_on_page; - int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page; + int min = current_emote_page * max_emotes_on_page; + 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_char_image(current_char, current_emote, "_off"); + if (current_emote >= min && current_emote <= max) + ui_emote_list.at(current_emote % max_emotes_on_page) + ->set_char_image(current_char, current_emote, "_off"); - int old_emote = current_emote; + int old_emote = current_emote; - current_emote = p_id; + current_emote = p_id; - if (current_emote >= min && current_emote <= max) - ui_emote_list.at(current_emote % max_emotes_on_page)->set_char_image(current_char, current_emote, "_on"); + if (current_emote >= min && current_emote <= max) + ui_emote_list.at(current_emote % max_emotes_on_page) + ->set_char_image(current_char, current_emote, "_on"); - int emote_mod = ao_app->get_emote_mod(current_char, current_emote); + int emote_mod = ao_app->get_emote_mod(current_char, current_emote); - if (old_emote == current_emote) { - ui_pre->setChecked(!ui_pre->isChecked()); - } - else if (!ao_app->is_stickypres_enabled()) { - if (emote_mod == 1 || emote_mod == 4) - ui_pre->setChecked(true); - else - ui_pre->setChecked(false); - } + if (old_emote == current_emote) { + ui_pre->setChecked(!ui_pre->isChecked()); + } + else if (!ao_app->is_stickypres_enabled()) { + if (emote_mod == 1 || emote_mod == 4) + ui_pre->setChecked(true); + else + ui_pre->setChecked(false); + } - ui_emote_dropdown->setCurrentIndex(current_emote); + ui_emote_dropdown->setCurrentIndex(current_emote); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_emote_clicked(int p_id) { - select_emote(p_id + max_emotes_on_page * current_emote_page); + select_emote(p_id + max_emotes_on_page * current_emote_page); } void Courtroom::on_emote_left_clicked() { - --current_emote_page; + --current_emote_page; - set_emote_page(); + set_emote_page(); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_emote_right_clicked() { - qDebug() << "emote right clicked"; - ++current_emote_page; + qDebug() << "emote right clicked"; + ++current_emote_page; - set_emote_page(); + set_emote_page(); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_emote_dropdown_changed(int p_index) { - select_emote(p_index); + select_emote(p_index); } diff --git a/src/encryption_functions.cpp b/src/encryption_functions.cpp index f26d4d47..6669fe15 100644 --- a/src/encryption_functions.cpp +++ b/src/encryption_functions.cpp @@ -4,55 +4,55 @@ 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; - unsigned int C2 = 32618; + unsigned int key = p_key; + unsigned int C1 = 53761; + unsigned int C2 = 32618; - QVector temp_result; - std::string input = temp_input.toUtf8().constData(); + QVector temp_result; + std::string input = temp_input.toUtf8().constData(); - 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; - } + 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; + } - std::string result = ""; + std::string result = ""; - for (uint_fast8_t i_int : temp_result) { - result += omni::int_to_hex(i_int); - } + for (uint_fast8_t i_int : temp_result) { + result += omni::int_to_hex(i_int); + } - QString final_result = QString::fromStdString(result); + QString final_result = QString::fromStdString(result); - return final_result; + return final_result; } QString fanta_decrypt(QString temp_input, unsigned int key) { - std::string input = temp_input.toUtf8().constData(); + std::string input = temp_input.toUtf8().constData(); - QVector unhexed_vector; + QVector unhexed_vector; - 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); - } + 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); + } - unsigned int C1 = 53761; - unsigned int C2 = 32618; + unsigned int C1 = 53761; + unsigned int C2 = 32618; - std::string result = ""; + std::string result = ""; - 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; - } + 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); + return QString::fromStdString(result); } diff --git a/src/evidence.cpp b/src/evidence.cpp index 50ed9a4f..edfad5db 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -2,708 +2,776 @@ void Courtroom::initialize_evidence() { - ui_evidence = new AOImage(this, ao_app); - - //ui_evidence_name = new QLabel(ui_evidence); - ui_evidence_name = new AOLineEdit(ui_evidence); - ui_evidence_name->setAlignment(Qt::AlignCenter); - ui_evidence_name->setFrame(false); - - ui_evidence_buttons = new QWidget(ui_evidence); - - ui_evidence_left = new AOButton(ui_evidence, ao_app); - ui_evidence_right = new AOButton(ui_evidence, ao_app); - ui_evidence_present = new AOButton(ui_evidence, ao_app); - ui_evidence_present->setToolTip(tr("Present this piece of evidence to everyone on your next spoken message")); - - ui_evidence_switch = new AOButton(ui_evidence, ao_app); - ui_evidence_transfer = new AOButton(ui_evidence, ao_app); - - ui_evidence_save = new AOButton(ui_evidence, ao_app); - ui_evidence_save->setToolTip(tr("Save evidence to an .ini file.")); - ui_evidence_load = new AOButton(ui_evidence, ao_app); - ui_evidence_load->setToolTip(tr("Load evidence from an .ini file.")); - - ui_evidence_overlay = new AOImage(ui_evidence, ao_app); - - ui_evidence_delete = new AOButton(ui_evidence_overlay, ao_app); - ui_evidence_delete->setToolTip(tr("Destroy this piece of evidence")); - ui_evidence_image_name = new AOLineEdit(ui_evidence_overlay); - ui_evidence_image_button = new AOButton(ui_evidence_overlay, ao_app); - ui_evidence_image_button->setText(tr("Choose...")); - ui_evidence_x = new AOButton(ui_evidence_overlay, ao_app); - ui_evidence_x->setToolTip(tr("Close the evidence display/editing overlay.\n" - "You will be prompted if there's any unsaved changes.")); - ui_evidence_ok = new AOButton(ui_evidence_overlay, ao_app); - ui_evidence_ok->setToolTip(tr("Save any changes made to this piece of evidence and send them to server.")); - - ui_evidence_description = new AOTextEdit(ui_evidence_overlay); - ui_evidence_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: white;"); - ui_evidence_description->setFrameStyle(QFrame::NoFrame); - ui_evidence_description->setToolTip("Double-click to edit. Press [X] to update your changes."); - - connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited())); - connect(ui_evidence_name, SIGNAL(double_clicked()), this, SLOT(on_evidence_name_double_clicked())); - 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_switch, SIGNAL(clicked()), this, SLOT(on_evidence_switch_clicked())); - connect(ui_evidence_transfer, SIGNAL(clicked()), this, SLOT(on_evidence_transfer_clicked())); - connect(ui_evidence_save, SIGNAL(clicked()), this, SLOT(on_evidence_save_clicked())); - connect(ui_evidence_load, SIGNAL(clicked()), this, SLOT(on_evidence_load_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_name, SIGNAL(double_clicked()), this, SLOT(on_evidence_image_name_double_clicked())); - 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_ok, SIGNAL(clicked()), this, SLOT(on_evidence_ok_clicked())); - - connect(ui_evidence_name, SIGNAL(textChanged(QString)), this, SLOT(on_evidence_edited())); - connect(ui_evidence_image_name, SIGNAL(textChanged(QString)), this, SLOT(on_evidence_edited())); - connect(ui_evidence_description, SIGNAL(textChanged()), this, SLOT(on_evidence_edited())); - - ui_evidence->hide(); + ui_evidence = new AOImage(this, ao_app); + + // ui_evidence_name = new QLabel(ui_evidence); + ui_evidence_name = new AOLineEdit(ui_evidence); + ui_evidence_name->setAlignment(Qt::AlignCenter); + ui_evidence_name->setFrame(false); + + ui_evidence_buttons = new QWidget(ui_evidence); + + ui_evidence_left = new AOButton(ui_evidence, ao_app); + ui_evidence_right = new AOButton(ui_evidence, ao_app); + ui_evidence_present = new AOButton(ui_evidence, ao_app); + ui_evidence_present->setToolTip(tr("Present this piece of evidence to " + "everyone on your next spoken message")); + + ui_evidence_switch = new AOButton(ui_evidence, ao_app); + ui_evidence_transfer = new AOButton(ui_evidence, ao_app); + + ui_evidence_save = new AOButton(ui_evidence, ao_app); + ui_evidence_save->setToolTip(tr("Save evidence to an .ini file.")); + ui_evidence_load = new AOButton(ui_evidence, ao_app); + ui_evidence_load->setToolTip(tr("Load evidence from an .ini file.")); + + ui_evidence_overlay = new AOImage(ui_evidence, ao_app); + + ui_evidence_delete = new AOButton(ui_evidence_overlay, ao_app); + ui_evidence_delete->setToolTip(tr("Destroy this piece of evidence")); + ui_evidence_image_name = new AOLineEdit(ui_evidence_overlay); + ui_evidence_image_button = new AOButton(ui_evidence_overlay, ao_app); + ui_evidence_image_button->setText(tr("Choose...")); + ui_evidence_x = new AOButton(ui_evidence_overlay, ao_app); + ui_evidence_x->setToolTip( + tr("Close the evidence display/editing overlay.\n" + "You will be prompted if there's any unsaved changes.")); + ui_evidence_ok = new AOButton(ui_evidence_overlay, ao_app); + ui_evidence_ok->setToolTip(tr("Save any changes made to this piece of " + "evidence and send them to server.")); + + ui_evidence_description = new AOTextEdit(ui_evidence_overlay); + ui_evidence_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);" + "color: white;"); + ui_evidence_description->setFrameStyle(QFrame::NoFrame); + ui_evidence_description->setToolTip( + "Double-click to edit. Press [X] to update your changes."); + + connect(ui_evidence_name, SIGNAL(returnPressed()), this, + SLOT(on_evidence_name_edited())); + connect(ui_evidence_name, SIGNAL(double_clicked()), this, + SLOT(on_evidence_name_double_clicked())); + 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_switch, SIGNAL(clicked()), this, + SLOT(on_evidence_switch_clicked())); + connect(ui_evidence_transfer, SIGNAL(clicked()), this, + SLOT(on_evidence_transfer_clicked())); + connect(ui_evidence_save, SIGNAL(clicked()), this, + SLOT(on_evidence_save_clicked())); + connect(ui_evidence_load, SIGNAL(clicked()), this, + SLOT(on_evidence_load_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_name, SIGNAL(double_clicked()), this, + SLOT(on_evidence_image_name_double_clicked())); + 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_ok, SIGNAL(clicked()), this, + SLOT(on_evidence_ok_clicked())); + + connect(ui_evidence_name, SIGNAL(textChanged(QString)), this, + SLOT(on_evidence_edited())); + connect(ui_evidence_image_name, SIGNAL(textChanged(QString)), this, + SLOT(on_evidence_edited())); + connect(ui_evidence_description, SIGNAL(textChanged()), this, + SLOT(on_evidence_edited())); + + ui_evidence->hide(); } void Courtroom::refresh_evidence() { - set_font(ui_evidence_name, "", "evidence_name"); - set_font(ui_evidence_image_name, "", "evidence_image_name"); - set_font(ui_evidence_description, "", "evidence_description"); - - //Should properly refresh the evidence list - qDeleteAll(ui_evidence_list.begin(), ui_evidence_list.end()); - ui_evidence_list.clear(); - - set_size_and_pos(ui_evidence_button, "evidence_button"); - ui_evidence_button->set_image("evidence_button"); - ui_evidence_button->setToolTip(tr("Bring up the Evidence screen.")); - - set_size_and_pos(ui_evidence, "evidence_background"); - if (current_evidence_global) - ui_evidence->set_image("evidence_background"); - else - ui_evidence->set_image("evidence_background_private"); - - 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"); - - set_size_and_pos(ui_evidence_right, "evidence_right"); - ui_evidence_right->set_image("arrow_right"); - - set_size_and_pos(ui_evidence_present, "evidence_present"); - ui_evidence_present->set_image("present"); - - set_size_and_pos(ui_evidence_overlay, "evidence_overlay"); - if (current_evidence_global) - ui_evidence_overlay->set_image("evidence_overlay"); - else - ui_evidence_overlay->set_image("evidence_overlay_private"); - - set_size_and_pos(ui_evidence_delete, "evidence_delete"); - ui_evidence_delete->set_image("evidence_delete"); - - 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("evidence_x"); - - set_size_and_pos(ui_evidence_ok, "evidence_ok"); - ui_evidence_ok->set_image("evidence_ok"); - - set_size_and_pos(ui_evidence_switch, "evidence_switch"); - if (current_evidence_global) { - ui_evidence_switch->set_image("evidence_global"); - ui_evidence_switch->setToolTip(tr("Switch evidence to private inventory.")); - } - else { - ui_evidence_switch->set_image("evidence_private"); - ui_evidence_switch->setToolTip(tr("Switch evidence to global inventory.")); - } - - set_size_and_pos(ui_evidence_transfer, "evidence_transfer"); - if (current_evidence_global) { - ui_evidence_transfer->set_image("evidence_transfer"); - ui_evidence_transfer->setToolTip(tr("Transfer evidence to private inventory.")); - } - else { - ui_evidence_transfer->set_image("evidence_transfer_private"); - ui_evidence_transfer->setToolTip(tr("Transfer evidence to global inventory.")); - } - - set_size_and_pos(ui_evidence_save, "evidence_save"); - ui_evidence_save->set_image("evidence_save"); - if (current_evidence_global) - ui_evidence_save->hide(); - else - ui_evidence_save->show(); - - set_size_and_pos(ui_evidence_load, "evidence_load"); - ui_evidence_load->set_image("evidence_load"); - if (current_evidence_global) - ui_evidence_load->hide(); - else - ui_evidence_load->show(); - - set_size_and_pos(ui_evidence_description, "evidence_description"); - - QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", "courtroom_design.ini"); - QPoint p_point = ao_app->get_button_spacing("evidence_button_size", "courtroom_design.ini"); - - const int button_width = p_point.x(); - int x_spacing = f_spacing.x(); - int x_mod_count = 0; - - const int button_height = p_point.y(); - 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; - - max_evidence_on_page = evidence_columns * evidence_rows; - - 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, button_width, button_height); - - 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))); - - ++x_mod_count; - - if (x_mod_count == evidence_columns) { - ++y_mod_count; - x_mod_count = 0; - } + set_font(ui_evidence_name, "", "evidence_name"); + set_font(ui_evidence_image_name, "", "evidence_image_name"); + set_font(ui_evidence_description, "", "evidence_description"); + + // Should properly refresh the evidence list + qDeleteAll(ui_evidence_list.begin(), ui_evidence_list.end()); + ui_evidence_list.clear(); + + set_size_and_pos(ui_evidence_button, "evidence_button"); + ui_evidence_button->set_image("evidence_button"); + ui_evidence_button->setToolTip(tr("Bring up the Evidence screen.")); + + set_size_and_pos(ui_evidence, "evidence_background"); + if (current_evidence_global) + ui_evidence->set_image("evidence_background"); + else + ui_evidence->set_image("evidence_background_private"); + + 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"); + + set_size_and_pos(ui_evidence_right, "evidence_right"); + ui_evidence_right->set_image("arrow_right"); + + set_size_and_pos(ui_evidence_present, "evidence_present"); + ui_evidence_present->set_image("present"); + + set_size_and_pos(ui_evidence_overlay, "evidence_overlay"); + if (current_evidence_global) + ui_evidence_overlay->set_image("evidence_overlay"); + else + ui_evidence_overlay->set_image("evidence_overlay_private"); + + set_size_and_pos(ui_evidence_delete, "evidence_delete"); + ui_evidence_delete->set_image("evidence_delete"); + + 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("evidence_x"); + + set_size_and_pos(ui_evidence_ok, "evidence_ok"); + ui_evidence_ok->set_image("evidence_ok"); + + set_size_and_pos(ui_evidence_switch, "evidence_switch"); + if (current_evidence_global) { + ui_evidence_switch->set_image("evidence_global"); + ui_evidence_switch->setToolTip(tr("Switch evidence to private inventory.")); + } + else { + ui_evidence_switch->set_image("evidence_private"); + ui_evidence_switch->setToolTip(tr("Switch evidence to global inventory.")); + } + + set_size_and_pos(ui_evidence_transfer, "evidence_transfer"); + if (current_evidence_global) { + ui_evidence_transfer->set_image("evidence_transfer"); + ui_evidence_transfer->setToolTip( + tr("Transfer evidence to private inventory.")); + } + else { + ui_evidence_transfer->set_image("evidence_transfer_private"); + ui_evidence_transfer->setToolTip( + tr("Transfer evidence to global inventory.")); + } + + set_size_and_pos(ui_evidence_save, "evidence_save"); + ui_evidence_save->set_image("evidence_save"); + if (current_evidence_global) + ui_evidence_save->hide(); + else + ui_evidence_save->show(); + + set_size_and_pos(ui_evidence_load, "evidence_load"); + ui_evidence_load->set_image("evidence_load"); + if (current_evidence_global) + ui_evidence_load->hide(); + else + ui_evidence_load->show(); + + set_size_and_pos(ui_evidence_description, "evidence_description"); + + QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", + "courtroom_design.ini"); + QPoint p_point = ao_app->get_button_spacing("evidence_button_size", + "courtroom_design.ini"); + + const int button_width = p_point.x(); + int x_spacing = f_spacing.x(); + int x_mod_count = 0; + + const int button_height = p_point.y(); + 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; + + max_evidence_on_page = evidence_columns * evidence_rows; + + 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, button_width, button_height); + + 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))); + + ++x_mod_count; + + if (x_mod_count == evidence_columns) { + ++y_mod_count; + x_mod_count = 0; } + } } void Courtroom::set_evidence_list(QVector &p_evi_list) { - global_evidence_list = p_evi_list; - if (!current_evidence_global) - return; //We're on private evidence editing, wait for user to do their thing - - QVector old_list = local_evidence_list; - local_evidence_list.clear(); - local_evidence_list = p_evi_list; - - set_evidence_page(); - - if (ui_evidence_overlay->isVisible()) //Update the currently edited evidence for this user + global_evidence_list = p_evi_list; + if (!current_evidence_global) + return; // We're on private evidence editing, wait for user to do their + // thing + + QVector old_list = local_evidence_list; + local_evidence_list.clear(); + local_evidence_list = p_evi_list; + + set_evidence_page(); + + if (ui_evidence_overlay + ->isVisible()) // Update the currently edited evidence for this user + { + if (current_evidence >= local_evidence_list.size()) { + evidence_close(); + ui_evidence_name->setText(""); + } + else if (ui_evidence_description->isReadOnly()) // We haven't double clicked + // to edit it or anything { - if (current_evidence >= local_evidence_list.size()) { - evidence_close(); - ui_evidence_name->setText(""); - } - else if (ui_evidence_description->isReadOnly()) //We haven't double clicked to edit it or anything - { - on_evidence_double_clicked(current_evidence); - } - //Todo: make a function that compares two pieces of evidence for any differences - else if (compare_evidence_changed(old_list.at(current_evidence), local_evidence_list.at(current_evidence))) { - QMessageBox *msgBox = new QMessageBox; - - msgBox->setText("The piece of evidence you've been editing has changed."); - msgBox->setInformativeText("Do you wish to keep your changes?"); - msgBox->setDetailedText("Name: " + local_evidence_list.at(current_evidence).name + "\nImage: " + local_evidence_list.at(current_evidence).image + "\nDescription:\n" + local_evidence_list.at(current_evidence).description); - msgBox->setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msgBox->setDefaultButton(QMessageBox::LastButton); - //msgBox->setWindowModality(Qt::NonModal); - int ret = msgBox->exec(); - switch (ret) { - case QMessageBox::Yes: - // "Keep changes" - break; - case QMessageBox::No: - // "Discard changes and keep theirs" - on_evidence_double_clicked(current_evidence); - break; - default: - // should never be reached - break; - } - } + on_evidence_double_clicked(current_evidence); + } + // Todo: make a function that compares two pieces of evidence for any + // differences + else if (compare_evidence_changed( + old_list.at(current_evidence), + local_evidence_list.at(current_evidence))) { + QMessageBox *msgBox = new QMessageBox; + + msgBox->setText("The piece of evidence you've been editing has changed."); + msgBox->setInformativeText("Do you wish to keep your changes?"); + msgBox->setDetailedText( + "Name: " + local_evidence_list.at(current_evidence).name + + "\nImage: " + local_evidence_list.at(current_evidence).image + + "\nDescription:\n" + + local_evidence_list.at(current_evidence).description); + msgBox->setStandardButtons(QMessageBox::Yes | QMessageBox::No); + msgBox->setDefaultButton(QMessageBox::LastButton); + // msgBox->setWindowModality(Qt::NonModal); + int ret = msgBox->exec(); + switch (ret) { + case QMessageBox::Yes: + // "Keep changes" + break; + case QMessageBox::No: + // "Discard changes and keep theirs" + on_evidence_double_clicked(current_evidence); + break; + default: + // should never be reached + break; + } } + } } void Courtroom::set_evidence_page() { - int total_evidence = local_evidence_list.size(); - - ui_evidence_left->hide(); - ui_evidence_right->hide(); + int total_evidence = local_evidence_list.size(); - for (AOEvidenceButton *i_button : ui_evidence_list) { - i_button->hide(); - } + ui_evidence_left->hide(); + ui_evidence_right->hide(); - //to account for the "add evidence" button - ++total_evidence; + for (AOEvidenceButton *i_button : ui_evidence_list) { + i_button->hide(); + } - int total_pages = total_evidence / max_evidence_on_page; - int evidence_on_page = 0; + // to account for the "add evidence" button + ++total_evidence; - if ((total_evidence % max_evidence_on_page) != 0) { - ++total_pages; - //i. e. not on the last page - if (total_pages > current_evidence_page + 1) - evidence_on_page = max_evidence_on_page; - else - evidence_on_page = total_evidence % max_evidence_on_page; - } - else - evidence_on_page = max_evidence_on_page; + int total_pages = total_evidence / max_evidence_on_page; + int evidence_on_page = 0; + if ((total_evidence % max_evidence_on_page) != 0) { + ++total_pages; + // i. e. not on the last page if (total_pages > current_evidence_page + 1) - ui_evidence_right->show(); - - 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); - - f_evidence_button->set_selected(false); - f_evidence_button->setToolTip(""); - 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); - - if (n_real_evidence == current_evidence) - f_evidence_button->set_selected(true); + 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; + + if (total_pages > current_evidence_page + 1) + ui_evidence_right->show(); + + 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); + + f_evidence_button->set_selected(false); + f_evidence_button->setToolTip(""); + 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); - f_evidence_button->setToolTip(QString::number(n_real_evidence + 1) + ": " + local_evidence_list.at(n_real_evidence).name); - } - else - f_evidence_button->set_image(""); + if (n_real_evidence == current_evidence) + f_evidence_button->set_selected(true); - f_evidence_button->show(); + f_evidence_button->setToolTip( + QString::number(n_real_evidence + 1) + ": " + + local_evidence_list.at(n_real_evidence).name); } + else + f_evidence_button->set_image(""); + + f_evidence_button->show(); + } } void Courtroom::on_evidence_name_edited() { - ui_evidence_name->setReadOnly(true); - if (current_evidence >= local_evidence_list.size()) - return; + ui_evidence_name->setReadOnly(true); + if (current_evidence >= local_evidence_list.size()) + return; } void Courtroom::on_evidence_name_double_clicked() { - if (ui_evidence_overlay->isVisible()) { - ui_evidence_name->setReadOnly(false); - } - else { - ui_evidence_name->setReadOnly(true); - } + if (ui_evidence_overlay->isVisible()) { + ui_evidence_name->setReadOnly(false); + } + else { + ui_evidence_name->setReadOnly(true); + } } void Courtroom::on_evidence_image_name_double_clicked() { - ui_evidence_image_name->setReadOnly(false); + ui_evidence_image_name->setReadOnly(false); } void Courtroom::on_evidence_image_name_edited() { - ui_evidence_image_name->setReadOnly(true); - if (current_evidence >= local_evidence_list.size()) - return; + ui_evidence_image_name->setReadOnly(true); + if (current_evidence >= local_evidence_list.size()) + return; } void Courtroom::on_evidence_image_button_clicked() { - QDir dir(ao_app->get_base_path() + "evidence"); - QFileDialog dialog(this); - dialog.setFileMode(QFileDialog::ExistingFile); - dialog.setNameFilter(tr("Images (*.png)")); - dialog.setViewMode(QFileDialog::List); - dialog.setDirectory(dir); + QDir dir(ao_app->get_base_path() + "evidence"); + QFileDialog dialog(this); + dialog.setFileMode(QFileDialog::ExistingFile); + dialog.setNameFilter(tr("Images (*.png)")); + dialog.setViewMode(QFileDialog::List); + dialog.setDirectory(dir); - QStringList filenames; + QStringList filenames; - if (dialog.exec()) - filenames = dialog.selectedFiles(); + if (dialog.exec()) + filenames = dialog.selectedFiles(); - if (filenames.size() != 1) - return; + if (filenames.size() != 1) + return; - QString filename = filenames.at(0); - filename = dir.relativeFilePath(filename); - ui_evidence_image_name->setText(filename); - on_evidence_image_name_edited(); + QString filename = filenames.at(0); + filename = dir.relativeFilePath(filename); + ui_evidence_image_name->setText(filename); + on_evidence_image_name_edited(); } void Courtroom::on_evidence_clicked(int p_id) { - ui_evidence_name->setReadOnly(true); + ui_evidence_name->setReadOnly(true); - int f_real_id = p_id + max_evidence_on_page * current_evidence_page; - - if (f_real_id == local_evidence_list.size()) { - if (current_evidence_global) - ao_app->send_server_packet(new AOPacket("PE###empty.png#%")); - else { - evi_type f_evi; - f_evi.name = ""; - f_evi.description = ""; - f_evi.image = "empty.png"; - - local_evidence_list.append(f_evi); - private_evidence_list = local_evidence_list; - set_evidence_page(); - } - return; + int f_real_id = p_id + max_evidence_on_page * current_evidence_page; + + if (f_real_id == local_evidence_list.size()) { + if (current_evidence_global) + ao_app->send_server_packet( + new AOPacket("PE###empty.png#%")); + else { + evi_type f_evi; + f_evi.name = ""; + f_evi.description = ""; + f_evi.image = "empty.png"; + + local_evidence_list.append(f_evi); + private_evidence_list = local_evidence_list; + set_evidence_page(); } - else if (f_real_id > local_evidence_list.size()) - return; + return; + } + else if (f_real_id > local_evidence_list.size()) + return; - ui_evidence_name->setText(local_evidence_list.at(f_real_id).name); + ui_evidence_name->setText(local_evidence_list.at(f_real_id).name); - for (AOEvidenceButton *i_button : ui_evidence_list) - i_button->set_selected(false); + for (AOEvidenceButton *i_button : ui_evidence_list) + i_button->set_selected(false); - ui_evidence_list.at(p_id)->set_selected(true); + ui_evidence_list.at(p_id)->set_selected(true); - current_evidence = f_real_id; + current_evidence = f_real_id; - // ui_ic_chat_message->setFocus(); + // ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_double_clicked(int p_id) { - int f_real_id = p_id + max_evidence_on_page * current_evidence_page; + int f_real_id = p_id + max_evidence_on_page * current_evidence_page; - if (f_real_id >= local_evidence_list.size()) - return; + if (f_real_id >= local_evidence_list.size()) + return; - current_evidence = f_real_id; + current_evidence = f_real_id; - evi_type f_evi = local_evidence_list.at(f_real_id); + evi_type f_evi = local_evidence_list.at(f_real_id); - ui_evidence_description->clear(); - ui_evidence_description->appendPlainText(f_evi.description); - ui_evidence_description->setReadOnly(true); - ui_evidence_description->setToolTip("Double-click to edit..."); + ui_evidence_description->clear(); + ui_evidence_description->appendPlainText(f_evi.description); + ui_evidence_description->setReadOnly(true); + ui_evidence_description->setToolTip("Double-click to edit..."); - ui_evidence_name->setText(f_evi.name); - ui_evidence_name->setReadOnly(true); - ui_evidence_name->setToolTip("Double-click to edit..."); - ui_evidence_image_name->setText(f_evi.image); - ui_evidence_image_name->setReadOnly(true); - ui_evidence_image_name->setToolTip("Double-click to edit..."); + ui_evidence_name->setText(f_evi.name); + ui_evidence_name->setReadOnly(true); + ui_evidence_name->setToolTip("Double-click to edit..."); + ui_evidence_image_name->setText(f_evi.image); + ui_evidence_image_name->setReadOnly(true); + ui_evidence_image_name->setToolTip("Double-click to edit..."); - ui_evidence_overlay->show(); - ui_evidence_ok->hide(); + ui_evidence_overlay->show(); + ui_evidence_ok->hide(); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } 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 (final_id == local_evidence_list.size()) - ui_evidence_name->setText(tr("Add new evidence...")); - else if (final_id < local_evidence_list.size()) - ui_evidence_name->setText(local_evidence_list.at(final_id).name); - } - else if (current_evidence < local_evidence_list.size()) - ui_evidence_name->setText(local_evidence_list.at(current_evidence).name); - else - ui_evidence_name->setText(""); + ui_evidence_name->setReadOnly(true); + int final_id = p_id + max_evidence_on_page * current_evidence_page; + + 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()) + ui_evidence_name->setText(local_evidence_list.at(final_id).name); + } + else if (current_evidence < local_evidence_list.size()) + ui_evidence_name->setText(local_evidence_list.at(current_evidence).name); + else + ui_evidence_name->setText(""); } void Courtroom::on_evidence_left_clicked() { - --current_evidence_page; + --current_evidence_page; - set_evidence_page(); + set_evidence_page(); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_right_clicked() { - ++current_evidence_page; + ++current_evidence_page; - set_evidence_page(); + set_evidence_page(); - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_present_clicked() { - if (!current_evidence_global) { - ui_evidence_present->hide(); - is_presenting_evidence = false; - return; //otherwise we get force-disconnected - } - if (is_presenting_evidence) - ui_evidence_present->set_image("present"); - else - ui_evidence_present->set_image("present_disabled"); + if (!current_evidence_global) { + ui_evidence_present->hide(); + is_presenting_evidence = false; + return; // otherwise we get force-disconnected + } + if (is_presenting_evidence) + ui_evidence_present->set_image("present"); + else + ui_evidence_present->set_image("present_disabled"); - is_presenting_evidence = !is_presenting_evidence; + is_presenting_evidence = !is_presenting_evidence; - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_delete_clicked() { - evidence_close(); - if (current_evidence_global) - ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%")); - else { - local_evidence_list.remove(current_evidence); - private_evidence_list = local_evidence_list; - set_evidence_page(); - } + evidence_close(); + if (current_evidence_global) + ao_app->send_server_packet( + new AOPacket("DE#" + QString::number(current_evidence) + "#%")); + else { + local_evidence_list.remove(current_evidence); + private_evidence_list = local_evidence_list; + set_evidence_page(); + } - current_evidence = 0; + current_evidence = 0; - ui_ic_chat_message->setFocus(); + ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_x_clicked() { - if (current_evidence >= local_evidence_list.size()) //Should never happen but you never know. - return; - - evi_type fake_evidence; - fake_evidence.name = ui_evidence_name->text(); - fake_evidence.description = ui_evidence_description->toPlainText(); - fake_evidence.image = ui_evidence_image_name->text(); - if (!compare_evidence_changed(fake_evidence, local_evidence_list.at(current_evidence))) { - evidence_close(); - return; - } - QMessageBox *msgBox = new QMessageBox; - msgBox->setText("Evidence has been modified."); - msgBox->setInformativeText("Do you want to save your changes?"); - msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); - msgBox->setDefaultButton(QMessageBox::Save); - int ret = msgBox->exec(); - switch (ret) { - case QMessageBox::Save: - evidence_close(); - on_evidence_ok_clicked(); - break; - case QMessageBox::Discard: - evidence_close(); - break; - case QMessageBox::Cancel: - // Cancel was clicked, do nothing - break; - default: - // should never be reached - break; - } + if (current_evidence >= + local_evidence_list.size()) // Should never happen but you never know. + return; + + evi_type fake_evidence; + fake_evidence.name = ui_evidence_name->text(); + fake_evidence.description = ui_evidence_description->toPlainText(); + fake_evidence.image = ui_evidence_image_name->text(); + if (!compare_evidence_changed(fake_evidence, + local_evidence_list.at(current_evidence))) { + evidence_close(); + return; + } + QMessageBox *msgBox = new QMessageBox; + msgBox->setText("Evidence has been modified."); + msgBox->setInformativeText("Do you want to save your changes?"); + msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard | + QMessageBox::Cancel); + msgBox->setDefaultButton(QMessageBox::Save); + int ret = msgBox->exec(); + switch (ret) { + case QMessageBox::Save: + evidence_close(); + on_evidence_ok_clicked(); + break; + case QMessageBox::Discard: + evidence_close(); + break; + case QMessageBox::Cancel: + // Cancel was clicked, do nothing + break; + default: + // should never be reached + break; + } } void Courtroom::on_evidence_ok_clicked() { - ui_evidence_name->setReadOnly(true); - ui_evidence_description->setReadOnly(true); - ui_evidence_image_name->setReadOnly(true); - if (current_evidence < local_evidence_list.size()) { - evi_type f_evi = local_evidence_list.at(current_evidence); - if (current_evidence_global) { - QStringList f_contents; - f_contents.append(QString::number(current_evidence)); - f_contents.append(ui_evidence_name->text()); - f_contents.append(ui_evidence_description->toPlainText()); - f_contents.append(ui_evidence_image_name->text()); - - ao_app->send_server_packet(new AOPacket("EE", f_contents)); - } - else { - f_evi.name = ui_evidence_name->text(); - f_evi.description = ui_evidence_description->toPlainText(); - f_evi.image = ui_evidence_image_name->text(); - local_evidence_list.replace(current_evidence, f_evi); - private_evidence_list = local_evidence_list; - ui_evidence_ok->hide(); - set_evidence_page(); - } + ui_evidence_name->setReadOnly(true); + ui_evidence_description->setReadOnly(true); + ui_evidence_image_name->setReadOnly(true); + if (current_evidence < local_evidence_list.size()) { + evi_type f_evi = local_evidence_list.at(current_evidence); + if (current_evidence_global) { + QStringList f_contents; + f_contents.append(QString::number(current_evidence)); + f_contents.append(ui_evidence_name->text()); + f_contents.append(ui_evidence_description->toPlainText()); + f_contents.append(ui_evidence_image_name->text()); + + ao_app->send_server_packet(new AOPacket("EE", f_contents)); + } + else { + f_evi.name = ui_evidence_name->text(); + f_evi.description = ui_evidence_description->toPlainText(); + f_evi.image = ui_evidence_image_name->text(); + local_evidence_list.replace(current_evidence, f_evi); + private_evidence_list = local_evidence_list; + ui_evidence_ok->hide(); + set_evidence_page(); } + } } void Courtroom::on_evidence_switch_clicked() { - evidence_close(); - evidence_switch(!current_evidence_global); - if (current_evidence_global) { - ui_evidence_switch->set_image("evidence_global"); - ui_evidence->set_image("evidence_background"); - ui_evidence_overlay->set_image("evidence_overlay"); - ui_evidence_transfer->set_image("evidence_transfer"); - ui_evidence_transfer->setToolTip(tr("Transfer evidence to private inventory.")); - ui_evidence_switch->setToolTip(tr("Current evidence is global. Click to switch to private.")); - } - else { - ui_evidence_switch->set_image("evidence_private"); - ui_evidence->set_image("evidence_background_private"); - ui_evidence_overlay->set_image("evidence_overlay_private"); - ui_evidence_transfer->set_image("evidence_transfer_private"); - ui_evidence_transfer->setToolTip(tr("Transfer evidence to global inventory.")); - ui_evidence_switch->setToolTip(tr("Current evidence is private. Click to switch to global.")); - } + evidence_close(); + evidence_switch(!current_evidence_global); + if (current_evidence_global) { + ui_evidence_switch->set_image("evidence_global"); + ui_evidence->set_image("evidence_background"); + ui_evidence_overlay->set_image("evidence_overlay"); + ui_evidence_transfer->set_image("evidence_transfer"); + ui_evidence_transfer->setToolTip( + tr("Transfer evidence to private inventory.")); + ui_evidence_switch->setToolTip( + tr("Current evidence is global. Click to switch to private.")); + } + else { + ui_evidence_switch->set_image("evidence_private"); + ui_evidence->set_image("evidence_background_private"); + ui_evidence_overlay->set_image("evidence_overlay_private"); + ui_evidence_transfer->set_image("evidence_transfer_private"); + ui_evidence_transfer->setToolTip( + tr("Transfer evidence to global inventory.")); + ui_evidence_switch->setToolTip( + tr("Current evidence is private. Click to switch to global.")); + } } void Courtroom::on_evidence_transfer_clicked() { - if (current_evidence >= local_evidence_list.size()) - return; - - QString name; - if (!current_evidence_global) //Transfer private evidence to global - { - evi_type f_evi = local_evidence_list.at(current_evidence); - - QStringList f_contents; - f_contents.append(f_evi.name); - f_contents.append(f_evi.description); - f_contents.append(f_evi.image); - - name = f_evi.name; - ao_app->send_server_packet(new AOPacket("PE", f_contents)); - } - else //Transfer global evidence to private - { - evi_type f_evi = local_evidence_list.at(current_evidence); - name = f_evi.name; - private_evidence_list.append(f_evi); - } - - QMessageBox *msgBox = new QMessageBox; - msgBox->setText("\"" + name + "\" has been transferred."); - msgBox->setStandardButtons(QMessageBox::Ok); - msgBox->setDefaultButton(QMessageBox::Ok); - msgBox->exec(); + if (current_evidence >= local_evidence_list.size()) + return; + + QString name; + if (!current_evidence_global) // Transfer private evidence to global + { + evi_type f_evi = local_evidence_list.at(current_evidence); + + QStringList f_contents; + f_contents.append(f_evi.name); + f_contents.append(f_evi.description); + f_contents.append(f_evi.image); + + name = f_evi.name; + ao_app->send_server_packet(new AOPacket("PE", f_contents)); + } + else // Transfer global evidence to private + { + evi_type f_evi = local_evidence_list.at(current_evidence); + name = f_evi.name; + private_evidence_list.append(f_evi); + } + + QMessageBox *msgBox = new QMessageBox; + msgBox->setText("\"" + name + "\" has been transferred."); + msgBox->setStandardButtons(QMessageBox::Ok); + msgBox->setDefaultButton(QMessageBox::Ok); + msgBox->exec(); } void Courtroom::on_evidence_edited() { - if (current_evidence >= local_evidence_list.size()) //Should never happen but you never know. - return; - evi_type fake_evidence; - fake_evidence.name = ui_evidence_name->text(); - fake_evidence.description = ui_evidence_description->toPlainText(); - fake_evidence.image = ui_evidence_image_name->text(); - if (compare_evidence_changed(fake_evidence, local_evidence_list.at(current_evidence))) - ui_evidence_ok->show(); - else - ui_evidence_ok->hide(); + if (current_evidence >= + local_evidence_list.size()) // Should never happen but you never know. + return; + evi_type fake_evidence; + fake_evidence.name = ui_evidence_name->text(); + fake_evidence.description = ui_evidence_description->toPlainText(); + fake_evidence.image = ui_evidence_image_name->text(); + if (compare_evidence_changed(fake_evidence, + local_evidence_list.at(current_evidence))) + ui_evidence_ok->show(); + else + ui_evidence_ok->hide(); } void Courtroom::evidence_close() { - ui_evidence_description->setReadOnly(true); - ui_evidence_description->setToolTip(""); - ui_evidence_name->setReadOnly(true); - ui_evidence_name->setToolTip(""); - ui_evidence_image_name->setReadOnly(true); - ui_evidence_image_name->setToolTip(""); - ui_evidence_overlay->hide(); - ui_ic_chat_message->setFocus(); + ui_evidence_description->setReadOnly(true); + ui_evidence_description->setToolTip(""); + ui_evidence_name->setReadOnly(true); + ui_evidence_name->setToolTip(""); + ui_evidence_image_name->setReadOnly(true); + ui_evidence_image_name->setToolTip(""); + ui_evidence_overlay->hide(); + ui_ic_chat_message->setFocus(); } void Courtroom::evidence_switch(bool global) { - current_evidence_global = global; - is_presenting_evidence = false; - ui_evidence_present->set_image("present"); - local_evidence_list.clear(); - if (current_evidence_global) { - local_evidence_list = global_evidence_list; - ui_evidence_present->show(); - ui_evidence_save->hide(); - ui_evidence_load->hide(); - } - else { - local_evidence_list = private_evidence_list; - ui_evidence_present->hide(); - ui_evidence_save->show(); - ui_evidence_load->show(); - } - set_evidence_page(); + current_evidence_global = global; + is_presenting_evidence = false; + ui_evidence_present->set_image("present"); + local_evidence_list.clear(); + if (current_evidence_global) { + local_evidence_list = global_evidence_list; + ui_evidence_present->show(); + ui_evidence_save->hide(); + ui_evidence_load->hide(); + } + else { + local_evidence_list = private_evidence_list; + ui_evidence_present->hide(); + ui_evidence_save->show(); + ui_evidence_load->show(); + } + set_evidence_page(); } void Courtroom::on_evidence_save_clicked() { - if (current_evidence_global) - return; //Don't allow saving/loading operations when in global inventory mode for now - - QString p_path = QFileDialog::getSaveFileName(this, tr("Save Inventory"), "base/inventories/", tr("Ini Files (*.ini)")); - if (p_path.isEmpty()) - return; - - evidence_close(); - ui_evidence_name->setText(""); - - QSettings inventory(p_path, QSettings::IniFormat); - inventory.clear(); - for (int i = 0; i < local_evidence_list.size(); i++) { - inventory.beginGroup(QString::number(i)); - inventory.setValue("name", local_evidence_list[i].name); - inventory.setValue("description", local_evidence_list[i].description); - inventory.setValue("image", local_evidence_list[i].image); - inventory.endGroup(); - } - inventory.sync(); + if (current_evidence_global) + return; // Don't allow saving/loading operations when in global inventory + // mode for now + + QString p_path = QFileDialog::getSaveFileName( + this, tr("Save Inventory"), "base/inventories/", tr("Ini Files (*.ini)")); + if (p_path.isEmpty()) + return; + + evidence_close(); + ui_evidence_name->setText(""); + + QSettings inventory(p_path, QSettings::IniFormat); + inventory.clear(); + for (int i = 0; i < local_evidence_list.size(); i++) { + inventory.beginGroup(QString::number(i)); + inventory.setValue("name", local_evidence_list[i].name); + inventory.setValue("description", local_evidence_list[i].description); + inventory.setValue("image", local_evidence_list[i].image); + inventory.endGroup(); + } + inventory.sync(); } void Courtroom::on_evidence_load_clicked() { - if (current_evidence_global) - return; //Don't allow saving/loading operations when in global inventory mode for now - - QString p_path = QFileDialog::getOpenFileName(this, tr("Open Inventory"), "base/inventories/", tr("Ini Files (*.ini)")); - if (p_path.isEmpty()) - return; - - evidence_close(); - ui_evidence_name->setText(""); - - QSettings inventory(p_path, QSettings::IniFormat); - local_evidence_list.clear(); - foreach (QString evi, inventory.childGroups()) { - if (evi == "General") - continue; - - evi_type f_evi; - f_evi.name = inventory.value(evi + "/name", "UNKNOWN").value(); - f_evi.description = inventory.value(evi + "/description", "UNKNOWN").value(); - f_evi.image = inventory.value(evi + "/image", "UNKNOWN.png").value(); - local_evidence_list.append(f_evi); - } - private_evidence_list = local_evidence_list; - set_evidence_page(); + if (current_evidence_global) + return; // Don't allow saving/loading operations when in global inventory + // mode for now + + QString p_path = QFileDialog::getOpenFileName( + this, tr("Open Inventory"), "base/inventories/", tr("Ini Files (*.ini)")); + if (p_path.isEmpty()) + return; + + evidence_close(); + ui_evidence_name->setText(""); + + QSettings inventory(p_path, QSettings::IniFormat); + local_evidence_list.clear(); + foreach (QString evi, inventory.childGroups()) { + if (evi == "General") + continue; + + evi_type f_evi; + f_evi.name = inventory.value(evi + "/name", "UNKNOWN").value(); + f_evi.description = + inventory.value(evi + "/description", "UNKNOWN").value(); + f_evi.image = + inventory.value(evi + "/image", "UNKNOWN.png").value(); + local_evidence_list.append(f_evi); + } + private_evidence_list = local_evidence_list; + set_evidence_page(); } bool Courtroom::compare_evidence_changed(evi_type evi_a, evi_type evi_b) { - return evi_a.name != evi_b.name || evi_a.image != evi_b.image || evi_a.description != evi_b.description; + return evi_a.name != evi_b.name || evi_a.image != evi_b.image || + evi_a.description != evi_b.description; } diff --git a/src/file_functions.cpp b/src/file_functions.cpp index e2b28824..e64a46bf 100644 --- a/src/file_functions.cpp +++ b/src/file_functions.cpp @@ -2,21 +2,21 @@ bool file_exists(QString file_path) { - QFileInfo check_file(file_path); + QFileInfo check_file(file_path); - return check_file.exists() && check_file.isFile(); + return check_file.exists() && check_file.isFile(); } bool dir_exists(QString dir_path) { - QDir check_dir(dir_path); + QDir check_dir(dir_path); - return check_dir.exists(); + return check_dir.exists(); } bool exists(QString p_path) { - QFile file(p_path); + QFile file(p_path); - return file.exists(); + return file.exists(); } diff --git a/src/hardware_functions.cpp b/src/hardware_functions.cpp index 21d72ece..96c72eb5 100644 --- a/src/hardware_functions.cpp +++ b/src/hardware_functions.cpp @@ -10,14 +10,15 @@ static BOOL bIsRetrieved; QString get_hdid() { - 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 - return "gxsps32sa9fnwic92mfbs0"; + 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 + return "gxsps32sa9fnwic92mfbs0"; } #elif (defined(LINUX) || defined(__linux__)) @@ -27,24 +28,24 @@ QString get_hdid() QString get_hdid() { - QFile fstab_file("/etc/fstab"); - if (!fstab_file.open(QIODevice::ReadOnly)) - return "gxcps32sa9fnwic92mfbs0"; + QFile fstab_file("/etc/fstab"); + if (!fstab_file.open(QIODevice::ReadOnly)) + return "gxcps32sa9fnwic92mfbs0"; - QTextStream in(&fstab_file); + QTextStream in(&fstab_file); - while (!in.atEnd()) { - QString line = in.readLine(); + while (!in.atEnd()) { + QString line = in.readLine(); - if (line.startsWith("UUID")) { - QStringList line_elements = line.split("="); + if (line.startsWith("UUID")) { + QStringList line_elements = line.split("="); - if (line_elements.size() > 1) - return line_elements.at(1).left(23).trimmed(); - } + if (line_elements.size() > 1) + return line_elements.at(1).left(23).trimmed(); } + } - return "gxcpz32sa9fnwic92mfbs0"; + return "gxcpz32sa9fnwic92mfbs0"; } #elif defined __APPLE__ @@ -53,25 +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; - } - - IOObjectRelease(platformExpert); + 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; } - return hdid; + if (CFStringGetCString(serial, buffer, 64, kCFStringEncodingUTF8)) { + hdid = buffer; + } + + IOObjectRelease(platformExpert); + } + return hdid; } #else diff --git a/src/hex_functions.cpp b/src/hex_functions.cpp index 63293c14..1e35718f 100644 --- a/src/hex_functions.cpp +++ b/src/hex_functions.cpp @@ -1,17 +1,17 @@ #include "hex_functions.h" namespace omni { - std::string int_to_hex(unsigned int input) - { - if (input > 255) - return "FF"; +std::string int_to_hex(unsigned int input) +{ + if (input > 255) + return "FF"; - std::stringstream stream; - stream << std::setfill('0') << std::setw(sizeof(char) * 2) - << std::hex << input; - 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 30a8ed02..99172a9f 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -7,515 +7,523 @@ 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_settings = new AOButton(this, ao_app); - - ui_server_list = new QTreeWidget(this); - ui_server_list->setHeaderLabels({"#", "Name"}); //, "Players"}); - ui_server_list->hideColumn(0); - - ui_server_search = new QLineEdit(this); - ui_server_search->setFrame(false); - ui_server_search->setPlaceholderText(tr("Search")); - - ui_player_count = new QLabel(this); - ui_description = new AOTextArea(this); - ui_description->setOpenExternalLinks(true); - 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_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked())); - connect(ui_server_list, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(on_server_list_clicked(QTreeWidgetItem *, int))); - connect(ui_server_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(on_server_list_doubleclicked(QTreeWidgetItem *, int))); - connect(ui_server_search, SIGNAL(textChanged(QString)), this, SLOT(on_server_search_edited(QString))); - connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed())); - connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled())); + 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_settings = new AOButton(this, ao_app); + + ui_server_list = new QTreeWidget(this); + ui_server_list->setHeaderLabels({"#", "Name"}); //, "Players"}); + ui_server_list->hideColumn(0); + + ui_server_search = new QLineEdit(this); + ui_server_search->setFrame(false); + ui_server_search->setPlaceholderText(tr("Search")); + + ui_player_count = new QLabel(this); + ui_description = new AOTextArea(this); + ui_description->setOpenExternalLinks(true); + 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_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked())); + connect(ui_server_list, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, + SLOT(on_server_list_clicked(QTreeWidgetItem *, int))); + connect(ui_server_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), + this, SLOT(on_server_list_doubleclicked(QTreeWidgetItem *, int))); + connect(ui_server_search, SIGNAL(textChanged(QString)), this, + SLOT(on_server_search_edited(QString))); + 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(); - ui_connect->setEnabled(false); + QString filename = "lobby_design.ini"; - list_servers(); + pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename); - set_widgets(); -} + if (f_lobby.width < 0 || f_lobby.height < 0) { + qDebug() << "W: did not find lobby width or height in " << filename; -//sets images, position and size -void Lobby::set_widgets() -{ - ao_app->reload_theme(); + // 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?")); - QString filename = "lobby_design.ini"; + this->resize(517, 666); + } + else { + this->resize(f_lobby.width, f_lobby.height); + } - pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename); + set_size_and_pos(ui_background, "lobby"); + ui_background->set_image("lobbybackground"); - if (f_lobby.width < 0 || f_lobby.height < 0) { - qDebug() << "W: did not find lobby width or height in " << filename; + set_size_and_pos(ui_public_servers, "public_servers"); + ui_public_servers->set_image("publicservers_selected"); - // 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?")); + set_size_and_pos(ui_favorites, "favorites"); + ui_favorites->set_image("favorites"); - this->resize(517, 666); - } - else { - this->resize(f_lobby.width, f_lobby.height); - } + set_size_and_pos(ui_refresh, "refresh"); + ui_refresh->set_image("refresh"); - set_size_and_pos(ui_background, "lobby"); - ui_background->set_image("lobbybackground"); + set_size_and_pos(ui_add_to_fav, "add_to_fav"); + ui_add_to_fav->set_image("addtofav"); - set_size_and_pos(ui_public_servers, "public_servers"); - ui_public_servers->set_image("publicservers_selected"); + set_size_and_pos(ui_connect, "connect"); + ui_connect->set_image("connect"); - set_size_and_pos(ui_favorites, "favorites"); - ui_favorites->set_image("favorites"); + set_size_and_pos(ui_version, "version"); + ui_version->setText(tr("Version: KFO%1").arg(ao_app->get_version_string())); - set_size_and_pos(ui_refresh, "refresh"); - ui_refresh->set_image("refresh"); + set_size_and_pos(ui_about, "about"); + ui_about->set_image("about"); - set_size_and_pos(ui_add_to_fav, "add_to_fav"); - ui_add_to_fav->set_image("addtofav"); + set_size_and_pos(ui_settings, "settings"); + ui_settings->setText(tr("Settings")); + ui_settings->set_image("settings"); + ui_settings->setToolTip( + tr("Allows you to change various aspects of the client.")); - set_size_and_pos(ui_connect, "connect"); - ui_connect->set_image("connect"); + 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_version, "version"); - ui_version->setText(tr("Version: KFO%1").arg(ao_app->get_version_string())); + set_size_and_pos(ui_server_search, "server_search"); + ui_server_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); - set_size_and_pos(ui_about, "about"); - ui_about->set_image("about"); + 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_settings, "settings"); - ui_settings->setText(tr("Settings")); - ui_settings->set_image("settings"); - ui_settings->setToolTip(tr("Allows you to change various aspects of the client.")); + 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_server_list, "server_list"); - ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "font: bold;"); + 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_server_search, "server_search"); - ui_server_search->setStyleSheet("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_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"); - - 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(); - - set_fonts(); - set_stylesheets(); + 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"); + + 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(); + + set_fonts(); + set_stylesheets(); } void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier) { - QString filename = "lobby_design.ini"; + QString filename = "lobby_design.ini"; - pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); + pos_size_type design_ini_result = + ao_app->get_element_dimensions(p_identifier, filename); - if (design_ini_result.width < 0 || design_ini_result.height < 0) { - 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); - } + 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_fonts() { - set_font(ui_player_count, "player_count"); - set_font(ui_description, "description"); - set_font(ui_chatbox, "chatbox"); - set_font(ui_chatname, "chatname"); - set_font(ui_chatmessage, "chatmessage"); - set_font(ui_loading_text, "loading_text"); - set_font(ui_server_list, "server_list"); + set_font(ui_player_count, "player_count"); + set_font(ui_description, "description"); + set_font(ui_chatbox, "chatbox"); + set_font(ui_chatname, "chatname"); + set_font(ui_chatmessage, "chatmessage"); + set_font(ui_loading_text, "loading_text"); + set_font(ui_server_list, "server_list"); } void Lobby::set_stylesheet(QWidget *widget, QString target_tag) { - QString f_file = "lobby_stylesheets.css"; - QString style_sheet_string = ao_app->get_tagged_stylesheet(target_tag, f_file); - if (style_sheet_string != "") - widget->setStyleSheet(style_sheet_string); + QString f_file = "lobby_stylesheets.css"; + QString style_sheet_string = + ao_app->get_tagged_stylesheet(target_tag, f_file); + if (style_sheet_string != "") + widget->setStyleSheet(style_sheet_string); } void Lobby::set_stylesheets() { - set_stylesheet(ui_player_count, "[PLAYER COUNT]"); - set_stylesheet(ui_description, "[DESCRIPTION]"); - set_stylesheet(ui_chatbox, "[CHAT BOX]"); - set_stylesheet(ui_chatname, "[CHAT NAME]"); - set_stylesheet(ui_chatmessage, "[CHAT MESSAGE]"); - set_stylesheet(ui_loading_text, "[LOADING TEXT]"); - set_stylesheet(ui_server_list, "[SERVER LIST]"); + set_stylesheet(ui_player_count, "[PLAYER COUNT]"); + set_stylesheet(ui_description, "[DESCRIPTION]"); + set_stylesheet(ui_chatbox, "[CHAT BOX]"); + set_stylesheet(ui_chatname, "[CHAT NAME]"); + set_stylesheet(ui_chatmessage, "[CHAT MESSAGE]"); + set_stylesheet(ui_loading_text, "[LOADING TEXT]"); + set_stylesheet(ui_server_list, "[SERVER LIST]"); } void Lobby::set_font(QWidget *widget, QString p_identifier) { - QString design_file = "lobby_fonts.ini"; - int f_weight = ao_app->get_font_size(p_identifier, design_file); - QString class_name = widget->metaObject()->className(); - QString font_name = ao_app->get_font_name("font_" + p_identifier, design_file); - QFont font(font_name, f_weight); - bool use = ao_app->get_font_size("use_custom_fonts", design_file) == 1; - if (use) { - widget->setFont(font); - QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? - bool center = ao_app->get_font_size(p_identifier + "_center", design_file) == 1; // should it be centered? - QString is_bold = ""; - if (bold) - is_bold = "bold"; - QString is_center = ""; - if (center) - is_center = "qproperty-alignment: AlignCenter;"; - 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);\n" + - is_center + "\n" + - "font: " + is_bold + "; }"; - widget->setStyleSheet(style_sheet_string); - } - return; + QString design_file = "lobby_fonts.ini"; + int f_weight = ao_app->get_font_size(p_identifier, design_file); + QString class_name = widget->metaObject()->className(); + QString font_name = + ao_app->get_font_name("font_" + p_identifier, design_file); + QFont font(font_name, f_weight); + bool use = ao_app->get_font_size("use_custom_fonts", design_file) == 1; + if (use) { + widget->setFont(font); + QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); + bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == + 1; // is the font bold or not? + bool center = + ao_app->get_font_size(p_identifier + "_center", design_file) == + 1; // should it be centered? + QString is_bold = ""; + if (bold) + is_bold = "bold"; + QString is_center = ""; + if (center) + is_center = "qproperty-alignment: AlignCenter;"; + 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);\n" + is_center + "\n" + + "font: " + is_bold + "; }"; + widget->setStyleSheet(style_sheet_string); + } + return; } void Lobby::set_loading_text(QString p_text) { - ui_loading_text->clear(); - ui_loading_text->setAlignment(Qt::AlignCenter); - ui_loading_text->append(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(); + QString return_value = ui_chatbox->toPlainText(); - return return_value; + return return_value; } int Lobby::get_selected_server() { - return ui_server_list->currentItem()->text(0).toInt(); + return ui_server_list->currentItem()->text(0).toInt(); } void Lobby::set_loading_value(int p_value) { - ui_progress_bar->setValue(p_value); + ui_progress_bar->setValue(p_value); } void Lobby::on_public_servers_clicked() { - ui_public_servers->set_image("publicservers_selected"); - ui_favorites->set_image("favorites"); + ui_public_servers->set_image("publicservers_selected"); + ui_favorites->set_image("favorites"); - list_servers(); + list_servers(); - public_servers_selected = true; + public_servers_selected = true; } void Lobby::on_favorites_clicked() { - ui_favorites->set_image("favorites_selected"); - ui_public_servers->set_image("publicservers"); + ui_favorites->set_image("favorites_selected"); + ui_public_servers->set_image("publicservers"); - ao_app->set_favorite_list(); - //ao_app->favorite_list = read_serverlist_txt(); + ao_app->set_favorite_list(); + // ao_app->favorite_list = read_serverlist_txt(); - list_favorites(); + list_favorites(); - public_servers_selected = false; + public_servers_selected = false; } -void Lobby::on_refresh_pressed() -{ - ui_refresh->set_image("refresh_pressed"); -} +void Lobby::on_refresh_pressed() { ui_refresh->set_image("refresh_pressed"); } void Lobby::on_refresh_released() { - ui_refresh->set_image("refresh"); + ui_refresh->set_image("refresh"); - AOPacket *f_packet = new AOPacket("ALL#%"); + AOPacket *f_packet = new AOPacket("ALL#%"); - ao_app->send_ms_packet(f_packet); + ao_app->send_ms_packet(f_packet); } void Lobby::on_add_to_fav_pressed() { - ui_add_to_fav->set_image("addtofav_pressed"); + ui_add_to_fav->set_image("addtofav_pressed"); } void Lobby::on_add_to_fav_released() { - ui_add_to_fav->set_image("addtofav"); + ui_add_to_fav->set_image("addtofav"); - //you cant add favorites from favorites m8 - if (!public_servers_selected) - return; + // you cant add favorites from favorites m8 + if (!public_servers_selected) + return; - ao_app->add_favorite_server(get_selected_server()); + ao_app->add_favorite_server(get_selected_server()); } -void Lobby::on_connect_pressed() -{ - ui_connect->set_image("connect_pressed"); -} +void Lobby::on_connect_pressed() { ui_connect->set_image("connect_pressed"); } void Lobby::on_connect_released() { - ui_connect->set_image("connect"); + ui_connect->set_image("connect"); - AOPacket *f_packet; + AOPacket *f_packet; - f_packet = new AOPacket("askchaa#%"); + f_packet = new AOPacket("askchaa#%"); - ao_app->send_server_packet(f_packet); + 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:
" - "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter" - "

2.8 Major Release development:
" - "Crystalwarrior, Iamgoofball" - "

2.8 Quality Assurance:
" - "WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry," - "CedricDewitt, Chewable Tablets, Fantos, Futugaze," - "Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy," - "GreenBowers, Robotic Overlord, Veritas, Gin-Gi" - "

Special thanks:
" - "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), " - "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " - "Noevain, Cronnicossy, the AO2 community, server hosts, game masters," - "case makers, content creators and players!") - .arg(ao_app->get_version_string()); - QMessageBox::about(this, "About", msg); -} - -void Lobby::on_settings_clicked() -{ - ao_app->call_settings_menu(); -} - -//clicked on an item in the serverlist + 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" + "

2.8 Major Release development:
" + "Crystalwarrior, Iamgoofball" + "

2.8 Quality Assurance:
" + "WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry," + "CedricDewitt, Chewable Tablets, Fantos, Futugaze," + "Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy," + "GreenBowers, Robotic Overlord, Veritas, Gin-Gi" + "

Special thanks:
" + "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), " + "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " + "Noevain, Cronnicossy, the AO2 community, server hosts, game masters," + "case makers, content creators and players!") + .arg(ao_app->get_version_string()); + QMessageBox::about(this, "About", msg); +} + +void Lobby::on_settings_clicked() { ao_app->call_settings_menu(); } + +// clicked on an item in the serverlist void Lobby::on_server_list_clicked(QTreeWidgetItem *p_item, int column) { - column = 0; - if (p_item->text(column).toInt() != last_index) { - server_type f_server; - int n_server = p_item->text(column).toInt(); - last_index = n_server; + column = 0; + if (p_item->text(column).toInt() != last_index) { + server_type f_server; + int n_server = p_item->text(column).toInt(); + last_index = n_server; - if (n_server < 0) - return; + if (n_server < 0) + return; - if (public_servers_selected) { - QVector f_server_list = ao_app->get_server_list(); + if (public_servers_selected) { + QVector f_server_list = ao_app->get_server_list(); - if (n_server >= f_server_list.size()) - return; + if (n_server >= f_server_list.size()) + return; - f_server = f_server_list.at(n_server); - } - else { - if (n_server >= ao_app->get_favorite_list().size()) - return; + f_server = f_server_list.at(n_server); + } + else { + if (n_server >= ao_app->get_favorite_list().size()) + return; - f_server = ao_app->get_favorite_list().at(n_server); - } + f_server = ao_app->get_favorite_list().at(n_server); + } - ui_description->clear(); - ui_description->append_linked(f_server.desc); + ui_description->clear(); + ui_description->append_linked(f_server.desc); - ui_description->moveCursor(QTextCursor::Start); - ui_description->ensureCursorVisible(); + ui_description->moveCursor(QTextCursor::Start); + ui_description->ensureCursorVisible(); - ui_player_count->setText(tr("Offline")); + ui_player_count->setText(tr("Offline")); - ui_connect->setEnabled(false); + ui_connect->setEnabled(false); - ao_app->net_manager->connect_to_server(f_server); - } + ao_app->net_manager->connect_to_server(f_server); + } } -//doubleclicked on an item in the serverlist so we'll connect right away +// doubleclicked on an item in the serverlist so we'll connect right away void Lobby::on_server_list_doubleclicked(QTreeWidgetItem *p_item, int column) { - on_server_list_clicked(p_item, column); - on_connect_released(); + on_server_list_clicked(p_item, column); + on_connect_released(); } void Lobby::on_server_search_edited(QString p_text) { - // Iterate through all QTreeWidgetItem items - QTreeWidgetItemIterator it(ui_server_list); - while (*it) { - (*it)->setHidden(p_text != ""); - ++it; - } - - if (p_text != "") { - //Search in metadata - QList clist = ui_server_list->findItems(ui_server_search->text(), Qt::MatchContains | Qt::MatchRecursive, 1); - foreach (QTreeWidgetItem *item, clist) { - if (item->parent() != nullptr) //So the category shows up too - item->parent()->setHidden(false); - item->setHidden(false); - } + // Iterate through all QTreeWidgetItem items + QTreeWidgetItemIterator it(ui_server_list); + while (*it) { + (*it)->setHidden(p_text != ""); + ++it; + } + + if (p_text != "") { + // Search in metadata + QList clist = ui_server_list->findItems( + ui_server_search->text(), Qt::MatchContains | Qt::MatchRecursive, 1); + foreach (QTreeWidgetItem *item, clist) { + if (item->parent() != nullptr) // So the category shows up too + item->parent()->setHidden(false); + item->setHidden(false); } + } } void Lobby::on_chatfield_return_pressed() { - //no you can't send empty messages - if (ui_chatname->text() == "" || ui_chatmessage->text() == "") - return; + // 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()}; + QString f_header = "CT"; + QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()}; - AOPacket *f_packet = new AOPacket(f_header, f_contents); + AOPacket *f_packet = new AOPacket(f_header, f_contents); - ao_app->send_ms_packet(f_packet); + ao_app->send_ms_packet(f_packet); - ui_chatmessage->clear(); + ui_chatmessage->clear(); } void Lobby::list_servers() { - public_servers_selected = true; - ui_favorites->set_image("favorites"); - ui_public_servers->set_image("publicservers_selected"); + public_servers_selected = true; + ui_favorites->set_image("favorites"); + ui_public_servers->set_image("publicservers_selected"); - ui_server_list->setSortingEnabled(false); - ui_server_list->clear(); + ui_server_list->setSortingEnabled(false); + ui_server_list->clear(); - ui_server_search->setText(""); + ui_server_search->setText(""); - int i = 0; - for (server_type i_server : ao_app->get_server_list()) { - QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); - treeItem->setText(0, QString::number(i)); - treeItem->setText(1, i_server.name); - i++; - } - ui_server_list->setSortingEnabled(true); + int i = 0; + for (server_type i_server : ao_app->get_server_list()) { + QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); + treeItem->setText(0, QString::number(i)); + treeItem->setText(1, i_server.name); + i++; + } + ui_server_list->setSortingEnabled(true); } void Lobby::list_favorites() { - ui_server_list->setSortingEnabled(false); - ui_server_list->clear(); - - int i = 0; - for (server_type i_server : ao_app->get_favorite_list()) { - QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); - treeItem->setText(0, QString::number(i)); - treeItem->setText(1, i_server.name); - // treeItem->setText(2, "-"); - i++; - } - ui_server_list->setSortingEnabled(true); + ui_server_list->setSortingEnabled(false); + ui_server_list->clear(); + + int i = 0; + for (server_type i_server : ao_app->get_favorite_list()) { + QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); + treeItem->setText(0, QString::number(i)); + treeItem->setText(1, i_server.name); + // treeItem->setText(2, "-"); + i++; + } + ui_server_list->setSortingEnabled(true); } void Lobby::append_chatmessage(QString f_name, QString f_message) { - ui_chatbox->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name()); + ui_chatbox->append_chatmessage( + f_name, f_message, + ao_app->get_color("ooc_default_color", "courtroom_design.ini").name()); } void Lobby::append_error(QString f_message) { - ui_chatbox->append_error(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); + QString f_string = tr("Online: %1/%2") + .arg(QString::number(players_online)) + .arg(QString::number(max_players)); + ui_player_count->setText(f_string); } -void Lobby::enable_connect_button() -{ - ui_connect->setEnabled(true); -} +void Lobby::enable_connect_button() { ui_connect->setEnabled(true); } -Lobby::~Lobby() -{ -} +Lobby::~Lobby() {} diff --git a/src/main.cpp b/src/main.cpp index 9370bcea..ba5b5167 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,40 +12,41 @@ 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; - QPluginLoader apngPlugin("qapng"); - if (!apngPlugin.load()) - qCritical() << "QApng plugin could not be loaded"; + QPluginLoader apngPlugin("qapng"); + if (!apngPlugin.load()) + qCritical() << "QApng plugin could not be loaded"; - QPluginLoader webpPlugin("qwebp"); - if (!webpPlugin.load()) - qCritical() << "QWebp plugin could not be loaded"; + QPluginLoader webpPlugin("qwebp"); + if (!webpPlugin.load()) + qCritical() << "QWebp plugin could not be loaded"; - 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.net_manager->connect_to_master(); - main_app.w_lobby->show(); - return main_app.exec(); + main_app.construct_lobby(); + main_app.net_manager->connect_to_master(); + main_app.w_lobby->show(); + return main_app.exec(); } diff --git a/src/misc_functions.cpp b/src/misc_functions.cpp index fa49ba48..cc144153 100644 --- a/src/misc_functions.cpp +++ b/src/misc_functions.cpp @@ -2,8 +2,8 @@ void delay(int p_milliseconds) { - QTime dieTime = QTime::currentTime().addMSecs(p_milliseconds); + QTime dieTime = QTime::currentTime().addMSecs(p_milliseconds); - while (QTime::currentTime() < dieTime) - QCoreApplication::processEvents(QEventLoop::AllEvents, 100); + while (QTime::currentTime() < dieTime) + QCoreApplication::processEvents(QEventLoop::AllEvents, 100); } diff --git a/src/networkmanager.cpp b/src/networkmanager.cpp index 19f02415..cf89d0ab 100644 --- a/src/networkmanager.cpp +++ b/src/networkmanager.cpp @@ -6,220 +6,234 @@ NetworkManager::NetworkManager(AOApplication *parent) : QObject(parent) { - ao_app = parent; - - ms_socket = new QTcpSocket(this); - server_socket = new QTcpSocket(this); - - ms_reconnect_timer = new QTimer(this); - ms_reconnect_timer->setSingleShot(true); - QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, SLOT(retry_ms_connect())); - - QObject::connect(ms_socket, SIGNAL(readyRead()), this, SLOT(handle_ms_packet())); - QObject::connect(server_socket, SIGNAL(readyRead()), this, SLOT(handle_server_packet())); - QObject::connect(server_socket, SIGNAL(disconnected()), ao_app, SLOT(server_disconnected())); - - QString master_config = ao_app->configini->value("master", "").value(); - if (master_config != "") - ms_nosrv_hostname = master_config; + ao_app = parent; + + ms_socket = new QTcpSocket(this); + server_socket = new QTcpSocket(this); + + ms_reconnect_timer = new QTimer(this); + ms_reconnect_timer->setSingleShot(true); + QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, + SLOT(retry_ms_connect())); + + QObject::connect(ms_socket, SIGNAL(readyRead()), this, + SLOT(handle_ms_packet())); + QObject::connect(server_socket, SIGNAL(readyRead()), this, + SLOT(handle_server_packet())); + QObject::connect(server_socket, SIGNAL(disconnected()), ao_app, + SLOT(server_disconnected())); + + QString master_config = + ao_app->configini->value("master", "").value(); + if (master_config != "") + ms_nosrv_hostname = master_config; } -NetworkManager::~NetworkManager() -{ -} +NetworkManager::~NetworkManager() {} void NetworkManager::connect_to_master() { - ms_socket->close(); - ms_socket->abort(); + ms_socket->close(); + ms_socket->abort(); #ifdef MS_FAILOVER_SUPPORTED - perform_srv_lookup(); + perform_srv_lookup(); #else - connect_to_master_nosrv(); + connect_to_master_nosrv(); #endif } 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())); - ms_socket->connectToHost(ms_nosrv_hostname, ms_port); + QObject::connect(ms_socket, SIGNAL(connected()), this, + SLOT(on_ms_nosrv_connect_success())); + ms_socket->connectToHost(ms_nosrv_hostname, ms_port); } void NetworkManager::connect_to_server(server_type p_server) { - server_socket->close(); - server_socket->abort(); + server_socket->close(); + server_socket->abort(); - server_socket->connectToHost(p_server.ip, p_server.port); + server_socket->connectToHost(p_server.ip, p_server.port); } void NetworkManager::ship_ms_packet(QString p_packet) { - if (!ms_socket->isOpen()) { - retry_ms_connect(); - } - else { - ms_socket->write(p_packet.toUtf8()); - } + if (!ms_socket->isOpen()) { + retry_ms_connect(); + } + else { + ms_socket->write(p_packet.toUtf8()); + } } void NetworkManager::ship_server_packet(QString p_packet) { - server_socket->write(p_packet.toUtf8()); + server_socket->write(p_packet.toUtf8()); } void NetworkManager::handle_ms_packet() { - QByteArray buffer = ms_socket->readAll(); - QString in_data = QString::fromUtf8(buffer, buffer.size()); - - if (!in_data.endsWith("%")) { - ms_partial_packet = true; - ms_temp_packet += in_data; - return; + QByteArray buffer = ms_socket->readAll(); + QString in_data = QString::fromUtf8(buffer, buffer.size()); + + if (!in_data.endsWith("%")) { + ms_partial_packet = true; + ms_temp_packet += in_data; + return; + } + + else { + if (ms_partial_packet) { + in_data = ms_temp_packet + in_data; + ms_temp_packet = ""; + ms_partial_packet = false; } + } - 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) { + AOPacket *f_packet = new AOPacket(packet); - for (QString packet : packet_list) { - AOPacket *f_packet = new AOPacket(packet); - - ao_app->ms_packet_received(f_packet); - } + ao_app->ms_packet_received(f_packet); + } } void NetworkManager::perform_srv_lookup() { #ifdef MS_FAILOVER_SUPPORTED - ms_dns = new QDnsLookup(QDnsLookup::SRV, ms_srv_hostname, this); + ms_dns = new QDnsLookup(QDnsLookup::SRV, ms_srv_hostname, this); - connect(ms_dns, SIGNAL(finished()), this, SLOT(on_srv_lookup())); - ms_dns->lookup(); + connect(ms_dns, SIGNAL(finished()), this, SLOT(on_srv_lookup())); + ms_dns->lookup(); #endif } void NetworkManager::on_srv_lookup() { #ifdef MS_FAILOVER_SUPPORTED - bool connected = false; - if (ms_dns->error() != QDnsLookup::NoError) { - qWarning("SRV lookup of the master server DNS failed."); - ms_dns->deleteLater(); - } - else { - const auto srv_records = ms_dns->serviceRecords(); - - for (const QDnsServiceRecord &record : srv_records) { + bool connected = false; + if (ms_dns->error() != QDnsLookup::NoError) { + qWarning("SRV lookup of the master server DNS failed."); + ms_dns->deleteLater(); + } + else { + const auto srv_records = ms_dns->serviceRecords(); + + for (const QDnsServiceRecord &record : srv_records) { #ifdef DEBUG_NETWORK - qDebug() << "Connecting to " << record.target() << ":" << record.port(); + qDebug() << "Connecting to " << record.target() << ":" << record.port(); #endif - ms_socket->connectToHost(record.target(), record.port()); - QTime timer; - timer.start(); - do { - ao_app->processEvents(); - 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) { - qDebug() << ms_socket->error(); - 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))); - break; - } - else { - ms_socket->abort(); - ms_socket->close(); - } + ms_socket->connectToHost(record.target(), record.port()); + QTime timer; + timer.start(); + do { + ao_app->processEvents(); + 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) { + qDebug() << ms_socket->error(); + 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))); + break; + } + else { + ms_socket->abort(); + ms_socket->close(); + } } + } - // Failover to non-SRV connection - if (!connected) - connect_to_master_nosrv(); - else - emit ms_connect_finished(connected, false); + // Failover to non-SRV connection + if (!connected) + connect_to_master_nosrv(); + else + emit ms_connect_finished(connected, false); #endif } void NetworkManager::on_ms_nosrv_connect_success() { - emit ms_connect_finished(true, false); + 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))); + // 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))); - emit ms_connect_finished(false, true); + emit ms_connect_finished(false, true); - ms_reconnect_timer->start(ms_reconnect_delay * 1000); + ms_reconnect_timer->start(ms_reconnect_delay * 1000); } void NetworkManager::retry_ms_connect() { - if (!ms_reconnect_timer->isActive() && ms_socket->state() != QAbstractSocket::ConnectingState) - connect_to_master(); + if (!ms_reconnect_timer->isActive() && + ms_socket->state() != QAbstractSocket::ConnectingState) + connect_to_master(); } void NetworkManager::handle_server_packet() { - QByteArray buffer = server_socket->readAll(); - QString in_data = QString::fromUtf8(buffer, buffer.size()); - - if (!in_data.endsWith("%")) { - partial_packet = true; - temp_packet += in_data; - return; + QByteArray buffer = server_socket->readAll(); + QString in_data = QString::fromUtf8(buffer, buffer.size()); + + if (!in_data.endsWith("%")) { + partial_packet = true; + temp_packet += in_data; + return; + } + + else { + if (partial_packet) { + in_data = temp_packet + in_data; + temp_packet = ""; + partial_packet = false; } + } - 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) { + AOPacket *f_packet = new AOPacket(packet); - for (QString packet : packet_list) { - AOPacket *f_packet = new AOPacket(packet); - - ao_app->server_packet_received(f_packet); - } + ao_app->server_packet_received(f_packet); + } } diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 68f568ba..81a9a30f 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -9,691 +9,742 @@ void AOApplication::ms_packet_received(AOPacket *p_packet) { - p_packet->net_decode(); + p_packet->net_decode(); - QString header = p_packet->get_header(); - QStringList f_contents = p_packet->get_contents(); + 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(); + if (header != "CHECK") + qDebug() << "R(ms):" << p_packet->to_string(); #endif - if (header == "ALL") { - server_list.clear(); + if (header == "ALL") { + server_list.clear(); - for (QString i_string : p_packet->get_contents()) { - server_type f_server; - QStringList sub_contents = i_string.split("&"); + 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; - } + 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(); + 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(); - } + server_list.append(f_server); } - 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); - } + if (lobby_constructed) { + w_lobby->list_servers(); } - 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; - } - } + } + else if (header == "CT") { + QString f_name, f_message; - call_notice(tr("Outdated version! Your version: %1\n" - "Please go to aceattorneyonline.com to update.") - .arg(get_version_string())); - destruct_courtroom(); - destruct_lobby(); + if (f_contents.size() == 1) { + f_name = ""; + f_message = f_contents.at(0); } - -end: - - delete p_packet; -} - -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; - additive_enabled = false; - effects_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 (f_contents.size() >= 2) { + f_name = f_contents.at(0); + f_message = f_contents.at(1); } - else if (header == "ID") { - if (f_contents.size() < 2) - goto end; + else + 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"); - } + if (lobby_constructed) { + w_lobby->append_chatmessage(f_name, f_message); } - else if (header == "FL") { - if (f_packet.contains("yellowtext", Qt::CaseInsensitive)) - yellow_text_enabled = true; - if (f_packet.contains("prezoom", Qt::CaseInsensitive)) - prezoom_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; - if (f_packet.contains("additive", Qt::CaseInsensitive)) - additive_enabled = true; - if (f_packet.contains("effects", Qt::CaseInsensitive)) - effects_enabled = true; + if (courtroom_constructed && courtroom_loaded) { + w_courtroom->append_ms_chatmessage(f_name, f_message); } - else if (header == "PN") { - if (f_contents.size() < 2) - goto end; + } + else if (header == "AO2CHECK") { + send_ms_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%")); + send_ms_packet(new AOPacket("HI#" + get_hdid() + "#%")); - 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, QString::number(info.port)); - qDebug() << server_address; - 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 = QString("%1:%2").arg(info.ip, QString::number(info.port)); - qDebug() << server_address; - window_title += ": " + server_name; - } - } - - w_courtroom->set_window_title(window_title); + if (f_contents.size() < 1) + goto end; - w_lobby->show_loading_overlay(); - w_lobby->set_loading_text(tr("Loading")); - w_lobby->set_loading_value(0); + QStringList version_contents = f_contents.at(0).split("."); - AOPacket *f_packet; + if (version_contents.size() < 3) + goto end; - if (improved_loading_enabled) - f_packet = new AOPacket("RC#%"); - else - f_packet = new AOPacket("askchar2#%"); + int f_release = version_contents.at(0).toInt(); + int f_major = version_contents.at(1).toInt(); + int f_minor = version_contents.at(2).toInt(); - send_server_packet(f_packet); - - //Remove any characters not accepted in folder names for the server_name here - this->log_filename = QDateTime::currentDateTime().toUTC().toString("'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|\']")) + "/'ddd MMMM yyyy hh.mm.ss t'.log'"); - this->write_to_file("Joined server " + server_name + " on address " + server_address + " on " + QDateTime::currentDateTime().toUTC().toString(), log_filename, true); - QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256); - hash.addData(server_address.toUtf8()); - if (is_discord_enabled()) - discord->state_server(server_name.toStdString(), hash.result().toBase64().toStdString()); + 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; + } } - 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; + call_notice(tr("Outdated version! Your version: %1\n" + "Please go to aceattorneyonline.com to update.") + .arg(get_version_string())); + destruct_courtroom(); + destruct_lobby(); + } - QStringList sub_elements = f_contents.at(n_element + 1).split("&"); - if (sub_elements.size() < 2) - break; +end: - 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; + delete p_packet; +} - ++loaded_chars; +void AOApplication::server_packet_received(AOPacket *p_packet) +{ + p_packet->net_decode(); - w_lobby->set_loading_text("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size)); + QString header = p_packet->get_header(); + QStringList f_contents = p_packet->get_contents(); + QString f_packet = p_packet->to_string(); - w_courtroom->append_char(f_char); +#ifdef DEBUG_NETWORK + if (header != "checkconnection") + qDebug() << "R:" << f_packet; +#endif - 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 (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; + additive_enabled = false; + effects_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("prezoom", Qt::CaseInsensitive)) + prezoom_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; + if (f_packet.contains("additive", Qt::CaseInsensitive)) + additive_enabled = true; + if (f_packet.contains("effects", Qt::CaseInsensitive)) + effects_enabled = true; + } + 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, QString::number(info.port)); + qDebug() << server_address; + 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 = + QString("%1:%2").arg(info.ip, QString::number(info.port)); + qDebug() << server_address; + 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); + + // Remove any characters not accepted in folder names for the server_name + // here + this->log_filename = QDateTime::currentDateTime().toUTC().toString( + "'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|\']")) + + "/'ddd MMMM yyyy hh.mm.ss t'.log'"); + this->write_to_file("Joined server " + server_name + " on address " + + server_address + " on " + + QDateTime::currentDateTime().toUTC().toString(), + log_filename, true); + 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("Loading chars:\n" + + QString::number(loaded_chars) + "/" + + QString::number(char_list_size)); + + w_courtroom->append_char(f_char); + + int total_loading_size = + char_list_size * 2 + evidence_list_size + music_list_size; + int loading_value = int( + ((loaded_chars + generated_chars + loaded_music + loaded_evidence) / + static_cast(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 musics_time = 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))); + + if (musics_time) { + w_courtroom->append_music(f_music); + } + else { + if (f_music.endsWith(".wav") || f_music.endsWith(".mp3") || + f_music.endsWith(".mp4") || f_music.endsWith(".ogg") || + f_music.endsWith(".opus")) { + musics_time = true; + areas--; + w_courtroom->fix_last_area(); + w_courtroom->append_music(f_music); } - - 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 musics_time = 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))); - - if (musics_time) { - w_courtroom->append_music(f_music); - } - else { - if (f_music.endsWith(".wav") || - f_music.endsWith(".mp3") || - f_music.endsWith(".mp4") || - f_music.endsWith(".ogg") || - f_music.endsWith(".opus")) { - musics_time = true; - areas--; - w_courtroom->fix_last_area(); - w_courtroom->append_music(f_music); - } - else { - w_courtroom->append_area(f_music); - areas++; - } - } - - 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); + w_courtroom->append_area(f_music); + areas++; } - - 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); + } + + 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; + + bool musics_time = false; + int areas = 0; + + for (int n_element = 0; n_element < f_contents.size(); ++n_element) { + ++loaded_music; + + w_lobby->set_loading_text(tr("Loading music:\n%1/%2") + .arg(QString::number(loaded_music)) + .arg(QString::number(music_list_size))); + + if (musics_time) { + w_courtroom->append_music(f_contents.at(n_element)); + } + else { + if (f_contents.at(n_element).endsWith(".wav") || + f_contents.at(n_element).endsWith(".mp3") || + f_contents.at(n_element).endsWith(".mp4") || + f_contents.at(n_element).endsWith(".ogg") || + f_contents.at(n_element).endsWith(".opus")) { + musics_time = true; + w_courtroom->fix_last_area(); + w_courtroom->append_music(f_contents.at(n_element)); + areas--; } - } - - else 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); + else { + w_courtroom->append_area(f_contents.at(n_element)); + areas++; } + } - send_server_packet(new AOPacket("RM#%")); - } - else if (header == "SM") { - if (!courtroom_constructed) - goto end; - - bool musics_time = false; - int areas = 0; - - for (int n_element = 0; n_element < f_contents.size(); ++n_element) { - ++loaded_music; - - w_lobby->set_loading_text(tr("Loading music:\n%1/%2").arg(QString::number(loaded_music)).arg(QString::number(music_list_size))); - - if (musics_time) { - w_courtroom->append_music(f_contents.at(n_element)); - } - else { - if (f_contents.at(n_element).endsWith(".wav") || - f_contents.at(n_element).endsWith(".mp3") || - f_contents.at(n_element).endsWith(".mp4") || - f_contents.at(n_element).endsWith(".ogg") || - f_contents.at(n_element).endsWith(".opus")) { - musics_time = true; - w_courtroom->fix_last_area(); - w_courtroom->append_music(f_contents.at(n_element)); - areas--; - } - else { - w_courtroom->append_area(f_contents.at(n_element)); - areas++; - } - } - - 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); - } + for (int area_n = 0; area_n < areas; area_n++) { + w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown"); + } - send_server_packet(new AOPacket("RD#%")); + 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); } - else if (header == "FM") //Fetch music ONLY - { - if (!courtroom_constructed) - goto end; - w_courtroom->clear_music(); + send_server_packet(new AOPacket("RD#%")); + } + else if (header == "FM") // Fetch music ONLY + { + if (!courtroom_constructed) + goto end; - for (int n_element = 0; n_element < f_contents.size(); ++n_element) { - w_courtroom->append_music(f_contents.at(n_element)); - } + w_courtroom->clear_music(); - w_courtroom->list_music(); + for (int n_element = 0; n_element < f_contents.size(); ++n_element) { + w_courtroom->append_music(f_contents.at(n_element)); } - else if (header == "FA") //Fetch areas ONLY - { - if (!courtroom_constructed) - goto end; - w_courtroom->clear_areas(); + w_courtroom->list_music(); + } + else if (header == "FA") // Fetch areas ONLY + { + if (!courtroom_constructed) + goto end; - for (int n_element = 0; n_element < f_contents.size(); ++n_element) { - w_courtroom->append_area(f_contents.at(n_element)); - } + w_courtroom->clear_areas(); - w_courtroom->list_areas(); + for (int n_element = 0; n_element < f_contents.size(); ++n_element) { + w_courtroom->append_area(f_contents.at(n_element)); } - else if (header == "DONE") { - if (!courtroom_constructed) - goto end; - if (lobby_constructed) - w_courtroom->append_ms_chatmessage("", w_lobby->get_chatlog()); + w_courtroom->list_areas(); + } + else if (header == "DONE") { + if (!courtroom_constructed) + goto end; - w_courtroom->character_loading_finished(); - w_courtroom->done_received(); + if (lobby_constructed) + w_courtroom->append_ms_chatmessage("", w_lobby->get_chatlog()); - courtroom_loaded = true; + w_courtroom->character_loading_finished(); + w_courtroom->done_received(); - destruct_lobby(); - } - else if (header == "BN") { - if (f_contents.size() < 1) - goto end; - - if (courtroom_constructed) { - if (f_contents.size() >= 2) //We have a pos included in the background packet! - w_courtroom->set_side(f_contents.at(1)); - w_courtroom->set_background(f_contents.at(0), f_contents.size() >= 2); - } - } - else if (header == "SP") { - if (f_contents.size() < 1) - goto end; + courtroom_loaded = true; - if (courtroom_constructed) //We were sent a "set position" packet - { - w_courtroom->set_side(f_contents.at(0)); - } - } - else if (header == "SD") //Send pos dropdown - { - if (f_contents.size() < 1) - goto end; + destruct_lobby(); + } + else if (header == "BN") { + if (f_contents.size() < 1) + goto end; - w_courtroom->set_pos_dropdown(f_contents.at(0).split("*")); + if (courtroom_constructed) { + if (f_contents.size() >= + 2) // We have a pos included in the background packet! + w_courtroom->set_side(f_contents.at(1)); + w_courtroom->set_background(f_contents.at(0), f_contents.size() >= 2); } - //server accepting char request(CC) packet - else if (header == "PV") { - if (f_contents.size() < 3) - goto end; + } + else if (header == "SP") { + if (f_contents.size() < 1) + goto end; - if (courtroom_constructed) - w_courtroom->update_character(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); - } + if (courtroom_constructed) // We were sent a "set position" packet + { + w_courtroom->set_side(f_contents.at(0)); + } + } + else if (header == "SD") // Send pos dropdown + { + if (f_contents.size() < 1) + goto end; + + w_courtroom->set_pos_dropdown(f_contents.at(0).split("*")); + } + // server accepting char request(CC) packet + else if (header == "PV") { + if (f_contents.size() < 3) + goto end; + + if (courtroom_constructed) + w_courtroom->update_character(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; - 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 == "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() > 6) - w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", f_contents.at(2) == "1", f_contents.at(3) == "1", f_contents.at(4) == "1", f_contents.at(5) == "1"); - } + 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 == "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() > 6) + w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", + f_contents.at(2) == "1", f_contents.at(3) == "1", + f_contents.at(4) == "1", + f_contents.at(5) == "1"); + } end: - delete p_packet; + delete p_packet; } void AOApplication::send_ms_packet(AOPacket *p_packet) { - p_packet->net_encode(); + p_packet->net_encode(); - QString f_packet = p_packet->to_string(); + QString f_packet = p_packet->to_string(); - net_manager->ship_ms_packet(f_packet); + net_manager->ship_ms_packet(f_packet); #ifdef DEBUG_NETWORK - qDebug() << "S(ms):" << f_packet; + qDebug() << "S(ms):" << f_packet; #endif - delete p_packet; + delete p_packet; } void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded) { - if (encoded) - p_packet->net_encode(); + if (encoded) + p_packet->net_encode(); - QString f_packet = p_packet->to_string(); + QString f_packet = p_packet->to_string(); - if (encryption_needed) { + if (encryption_needed) { #ifdef DEBUG_NETWORK - qDebug() << "S(e):" << f_packet; + qDebug() << "S(e):" << f_packet; #endif - p_packet->encrypt_header(s_decryptor); - f_packet = p_packet->to_string(); - } - else { + p_packet->encrypt_header(s_decryptor); + f_packet = p_packet->to_string(); + } + else { #ifdef DEBUG_NETWORK - qDebug() << "S:" << f_packet; + qDebug() << "S:" << f_packet; #endif - } + } - net_manager->ship_server_packet(f_packet); + net_manager->ship_server_packet(f_packet); - delete p_packet; + delete p_packet; } diff --git a/src/path_functions.cpp b/src/path_functions.cpp index ebf4b629..07c9517c 100644 --- a/src/path_functions.cpp +++ b/src/path_functions.cpp @@ -10,157 +10,157 @@ #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 +// 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 = ""; + 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/"; - } + 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/"; + base_path = applicationDirPath() + "/../../../base/"; #else - base_path = applicationDirPath() + "/base/"; + base_path = applicationDirPath() + "/base/"; #endif - return base_path; + return base_path; } -QString AOApplication::get_data_path() -{ - return get_base_path() + "data/"; -} +QString AOApplication::get_data_path() { return get_base_path() + "data/"; } QString AOApplication::get_default_theme_path(QString p_file) { - QString path = get_base_path() + "themes/default/" + p_file; + QString path = get_base_path() + "themes/default/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + 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; + QString path = get_base_path() + "themes/" + p_theme + "/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + 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; + QString path = get_base_path() + "themes/" + current_theme + "/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + 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; + QString path = get_base_path() + "characters/" + p_char + "/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + return get_case_sensitive_path(path); #endif } QString AOApplication::get_sounds_path(QString p_file) { - QString path = get_base_path() + "sounds/general/" + p_file; + QString path = get_base_path() + "sounds/general/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + return get_case_sensitive_path(path); #endif } QString AOApplication::get_music_path(QString p_song) { - QString path = get_base_path() + "sounds/music/" + p_song; + QString path = get_base_path() + "sounds/music/" + p_song; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + return get_case_sensitive_path(path); #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) { + QString path = get_base_path() + "background/" + + w_courtroom->get_current_background() + "/" + p_file; + if (courtroom_constructed) { #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + return get_case_sensitive_path(path); #endif - } - return get_default_background_path(p_file); + } + 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; + QString path = get_base_path() + "background/default/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + return get_case_sensitive_path(path); #endif } QString AOApplication::get_evidence_path(QString p_file) { - QString path = get_base_path() + "evidence/" + p_file; + QString path = get_base_path() + "evidence/" + p_file; #ifndef CASE_SENSITIVE_FILESYSTEM - return path; + return path; #else - return get_case_sensitive_path(path); + 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; + // 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); + QFileInfo file(p_file); - QString file_basename = file.fileName(); - QString file_parent_dir = get_case_sensitive_path(file.absolutePath()); + 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; + // 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(); + // 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); + int result = files.indexOf(file_rx); - if (result != -1) - return file_parent_dir + "/" + files.at(result); + 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; + // if nothing is found, let the caller handle the missing file + return file_parent_dir + "/" + file_basename; } diff --git a/src/scrolltext.cpp b/src/scrolltext.cpp index 543f0f62..afd0aaba 100644 --- a/src/scrolltext.cpp +++ b/src/scrolltext.cpp @@ -2,124 +2,124 @@ ScrollText::ScrollText(QWidget *parent) : QWidget(parent), scrollPos(0) { - staticText.setTextFormat(Qt::PlainText); + staticText.setTextFormat(Qt::PlainText); - // setFixedHeight(fontMetrics().height()*2); //The theme sets this - leftMargin = height() / 3; + // setFixedHeight(fontMetrics().height()*2); //The theme sets this + leftMargin = height() / 3; - setSeparator(" --- "); + setSeparator(" --- "); - connect(&timer, SIGNAL(timeout()), this, SLOT(timer_timeout())); - timer.setInterval(50); + connect(&timer, SIGNAL(timeout()), this, SLOT(timer_timeout())); + timer.setInterval(50); } -QString ScrollText::text() const -{ - return _text; -} +QString ScrollText::text() const { return _text; } void ScrollText::setText(QString text) { - _text = text; - updateText(); - update(); + _text = text; + updateText(); + update(); } -QString ScrollText::separator() const -{ - return _separator; -} +QString ScrollText::separator() const { return _separator; } void ScrollText::setSeparator(QString separator) { - _separator = separator; - updateText(); - update(); + _separator = separator; + updateText(); + update(); } void ScrollText::updateText() { - timer.stop(); - - singleTextWidth = fontMetrics().horizontalAdvance(_text); - scrollEnabled = (singleTextWidth > width() - leftMargin * 2); - - if (scrollEnabled) { - scrollPos = -64; - staticText.setText(_text + _separator); - timer.start(); - } - else - staticText.setText(_text); - - staticText.prepare(QTransform(), font()); - wholeTextSize = QSize(fontMetrics().horizontalAdvance(staticText.text()), fontMetrics().height()); + timer.stop(); + + singleTextWidth = fontMetrics().horizontalAdvance(_text); + scrollEnabled = (singleTextWidth > width() - leftMargin * 2); + + if (scrollEnabled) { + scrollPos = -64; + staticText.setText(_text + _separator); + timer.start(); + } + else + staticText.setText(_text); + + staticText.prepare(QTransform(), font()); + wholeTextSize = QSize(fontMetrics().horizontalAdvance(staticText.text()), + fontMetrics().height()); } void ScrollText::paintEvent(QPaintEvent *) { - QPainter p(this); - - if (scrollEnabled) { - buffer.fill(qRgba(0, 0, 0, 0)); - QPainter pb(&buffer); - pb.setPen(p.pen()); - pb.setFont(p.font()); - - int x = qMin(-scrollPos, 0) + leftMargin; - while (x < width()) { - pb.drawStaticText(QPointF(x, (height() - wholeTextSize.height()) / 2), staticText); - x += wholeTextSize.width(); - } - - //Apply Alpha Channel - pb.setCompositionMode(QPainter::CompositionMode_DestinationIn); - pb.setClipRect(width() - 15, 0, 15, height()); - pb.drawImage(0, 0, alphaChannel); - pb.setClipRect(0, 0, 15, height()); - //initial situation: don't apply alpha channel in the left half of the image at all; apply it more and more until scrollPos gets positive - if (scrollPos < 0) - pb.setOpacity(static_cast((qMax(-8, scrollPos) + 8) / 8.0)); - pb.drawImage(0, 0, alphaChannel); - - //pb.end(); - p.drawImage(0, 0, buffer); - } - else { - p.drawStaticText(QPointF(leftMargin, (height() - wholeTextSize.height()) / 2), staticText); + QPainter p(this); + + if (scrollEnabled) { + buffer.fill(qRgba(0, 0, 0, 0)); + QPainter pb(&buffer); + pb.setPen(p.pen()); + pb.setFont(p.font()); + + int x = qMin(-scrollPos, 0) + leftMargin; + while (x < width()) { + pb.drawStaticText(QPointF(x, (height() - wholeTextSize.height()) / 2), + staticText); + x += wholeTextSize.width(); } + + // Apply Alpha Channel + pb.setCompositionMode(QPainter::CompositionMode_DestinationIn); + pb.setClipRect(width() - 15, 0, 15, height()); + pb.drawImage(0, 0, alphaChannel); + pb.setClipRect(0, 0, 15, height()); + // initial situation: don't apply alpha channel in the left half of the + // image at all; apply it more and more until scrollPos gets positive + if (scrollPos < 0) + pb.setOpacity(static_cast((qMax(-8, scrollPos) + 8) / 8.0)); + pb.drawImage(0, 0, alphaChannel); + + // pb.end(); + p.drawImage(0, 0, buffer); + } + else { + p.drawStaticText( + QPointF(leftMargin, (height() - wholeTextSize.height()) / 2), + staticText); + } } void ScrollText::resizeEvent(QResizeEvent *) { - //When the widget is resized, we need to update the alpha channel. - - alphaChannel = QImage(size(), QImage::Format_ARGB32_Premultiplied); - buffer = QImage(size(), QImage::Format_ARGB32_Premultiplied); - - //Create Alpha Channel: - if (width() > 64) { - //create first scanline - QRgb *scanline1 = reinterpret_cast(alphaChannel.scanLine(0)); - for (int x = 1; x < 16; ++x) - scanline1[x - 1] = scanline1[width() - x] = qRgba(0, 0, 0, x << 4); - for (int x = 15; x < width() - 15; ++x) - scanline1[x] = qRgb(0, 0, 0); - //copy scanline to the other ones - for (int y = 1; y < height(); ++y) - memcpy(alphaChannel.scanLine(y), scanline1, static_cast(width() * 4)); - } - else - alphaChannel.fill(qRgb(0, 0, 0)); - - //Update scrolling state - bool newScrollEnabled = (singleTextWidth > width() - leftMargin); - if (newScrollEnabled != scrollEnabled) - updateText(); + // When the widget is resized, we need to update the alpha channel. + + alphaChannel = QImage(size(), QImage::Format_ARGB32_Premultiplied); + buffer = QImage(size(), QImage::Format_ARGB32_Premultiplied); + + // Create Alpha Channel: + if (width() > 64) { + // create first scanline + QRgb *scanline1 = reinterpret_cast(alphaChannel.scanLine(0)); + for (int x = 1; x < 16; ++x) + scanline1[x - 1] = scanline1[width() - x] = qRgba(0, 0, 0, x << 4); + for (int x = 15; x < width() - 15; ++x) + scanline1[x] = qRgb(0, 0, 0); + // copy scanline to the other ones + for (int y = 1; y < height(); ++y) + memcpy(alphaChannel.scanLine(y), scanline1, + static_cast(width() * 4)); + } + else + alphaChannel.fill(qRgb(0, 0, 0)); + + // Update scrolling state + bool newScrollEnabled = (singleTextWidth > width() - leftMargin); + if (newScrollEnabled != scrollEnabled) + updateText(); } void ScrollText::timer_timeout() { - scrollPos = (scrollPos + 2) % wholeTextSize.width(); - update(); + scrollPos = (scrollPos + 2) % wholeTextSize.width(); + update(); } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 18da8538..615a6a14 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -2,1030 +2,1073 @@ QString AOApplication::read_theme() { - QString result = configini->value("theme", "default").value(); - return result; + QString result = configini->value("theme", "default").value(); + return result; } int AOApplication::read_blip_rate() { - int result = configini->value("blip_rate", 2).toInt(); + int result = configini->value("blip_rate", 2).toInt(); - if (result < 1) - return 1; + if (result < 1) + return 1; - return result; + return result; } QString AOApplication::get_ooc_name() { - QString result = configini->value("ooc_name").value(); - return result; + 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 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 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 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 result = configini->value("log_maximum", 200).toInt(); + return result; } bool AOApplication::get_log_goes_downwards() { - QString result = configini->value("log_goes_downwards", "true").value(); - return result.startsWith("true"); + QString result = + configini->value("log_goes_downwards", "true").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 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 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; + QString result = + configini->value("default_audio_device", "default").value(); + return result; } QStringList AOApplication::get_call_words() { - return get_list_file(get_base_path() + "callwords.ini"); + return get_list_file(get_base_path() + "callwords.ini"); } QStringList AOApplication::get_list_file(QString p_file) { - QStringList return_value; + QStringList return_value; - QFile p_ini; + QFile p_ini; - p_ini.setFileName(p_file); + p_ini.setFileName(p_file); - if (!p_ini.open(QIODevice::ReadOnly)) - return return_value; + if (!p_ini.open(QIODevice::ReadOnly)) + return return_value; - QTextStream in(&p_ini); + QTextStream in(&p_ini); - while (!in.atEnd()) { - QString line = in.readLine(); - return_value.append(line); - } + while (!in.atEnd()) { + QString line = in.readLine(); + return_value.append(line); + } - return return_value; + return return_value; } QString AOApplication::read_file(QString filename) { - QFile f_log(filename); + QFile f_log(filename); - if (!f_log.open(QIODevice::ReadOnly | QIODevice::Text)) { - qDebug() << "Couldn't open" << filename; - return ""; - } + if (!f_log.open(QIODevice::ReadOnly | QIODevice::Text)) { + qDebug() << "Couldn't open" << filename; + return ""; + } - QTextStream in(&f_log); - QString text = in.readAll(); - f_log.close(); - return text; + QTextStream in(&f_log); + QString text = in.readAll(); + f_log.close(); + return text; } bool AOApplication::write_to_file(QString p_text, QString p_file, bool make_dir) { - QString path = QFileInfo(p_file).path(); - if (make_dir) { - //Create the dir if it doesn't exist yet - QDir dir(path); - if (!dir.exists()) - if (!dir.mkpath(".")) - return false; - } + QString path = QFileInfo(p_file).path(); + if (make_dir) { + // Create the dir if it doesn't exist yet + QDir dir(path); + if (!dir.exists()) + if (!dir.mkpath(".")) + return false; + } - QFile f_log(p_file); - if (f_log.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { - QTextStream out(&f_log); + QFile f_log(p_file); + if (f_log.open(QIODevice::WriteOnly | QIODevice::Text | + QIODevice::Truncate)) { + QTextStream out(&f_log); - out << p_text; + out << p_text; - f_log.flush(); - f_log.close(); - return true; - } - return false; + f_log.flush(); + f_log.close(); + return true; + } + return false; } -bool AOApplication::append_to_file(QString p_text, QString p_file, bool make_dir) +bool AOApplication::append_to_file(QString p_text, QString p_file, + bool make_dir) { - QString path = QFileInfo(p_file).path(); - //Create the dir if it doesn't exist yet - if (make_dir) { - QDir dir(path); - if (!dir.exists()) - if (!dir.mkpath(".")) - return false; - } + QString path = QFileInfo(p_file).path(); + // Create the dir if it doesn't exist yet + if (make_dir) { + QDir dir(path); + if (!dir.exists()) + if (!dir.mkpath(".")) + return false; + } - QFile f_log(p_file); - if (f_log.open(QIODevice::WriteOnly | QIODevice::Append)) { - QTextStream out(&f_log); + QFile f_log(p_file); + if (f_log.open(QIODevice::WriteOnly | QIODevice::Append)) { + QTextStream out(&f_log); - out << "\r\n" - << p_text; + out << "\r\n" << p_text; - f_log.flush(); - f_log.close(); - return true; - } - return false; + f_log.flush(); + f_log.close(); + return true; + } + return false; } void AOApplication::write_to_serverlist_txt(QString p_line) { - QFile serverlist_txt; - QString serverlist_txt_path = get_base_path() + "serverlist.txt"; + QFile serverlist_txt; + QString serverlist_txt_path = get_base_path() + "serverlist.txt"; - serverlist_txt.setFileName(serverlist_txt_path); + serverlist_txt.setFileName(serverlist_txt_path); - if (!serverlist_txt.open(QIODevice::WriteOnly | QIODevice::Append)) { - return; - } + if (!serverlist_txt.open(QIODevice::WriteOnly | QIODevice::Append)) { + return; + } - QTextStream out(&serverlist_txt); + QTextStream out(&serverlist_txt); - out << "\r\n" - << p_line; + out << "\r\n" << p_line; - serverlist_txt.close(); + serverlist_txt.close(); } QVector AOApplication::read_serverlist_txt() { - QVector f_server_list; + QVector f_server_list; - QFile serverlist_txt; - QString serverlist_txt_path = get_base_path() + "serverlist.txt"; + QFile serverlist_txt; + QString serverlist_txt_path = get_base_path() + "serverlist.txt"; - serverlist_txt.setFileName(serverlist_txt_path); + serverlist_txt.setFileName(serverlist_txt_path); - if (!serverlist_txt.open(QIODevice::ReadOnly)) { - return f_server_list; - } + if (!serverlist_txt.open(QIODevice::ReadOnly)) { + return f_server_list; + } - QTextStream in(&serverlist_txt); + QTextStream in(&serverlist_txt); - while (!in.atEnd()) { - QString line = in.readLine(); - server_type f_server; - QStringList line_contents = line.split(":"); + while (!in.atEnd()) { + QString line = in.readLine(); + server_type f_server; + QStringList line_contents = line.split(":"); - if (line_contents.size() < 3) - continue; + 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.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); - } + f_server_list.append(f_server); + } - return f_server_list; + return f_server_list; } -QString AOApplication::read_design_ini(QString p_identifier, QString p_design_path) +QString AOApplication::read_design_ini(QString p_identifier, + QString p_design_path) { - QSettings settings(p_design_path, QSettings::IniFormat); - QVariant value = settings.value(p_identifier); - if (value.type() == QVariant::StringList) { - return value.toStringList().join(","); - } - else { - return value.toString(); - } + QSettings settings(p_design_path, QSettings::IniFormat); + QVariant value = settings.value(p_identifier); + 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); + 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; + QPoint return_value; - return_value.setX(0); - return_value.setY(0); + return_value.setX(0); + return_value.setY(0); - if (f_result == "") { - f_result = read_design_ini(p_identifier, default_path); + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); - if (f_result == "") - return return_value; - } + if (f_result == "") + return return_value; + } - QStringList sub_line_elements = f_result.split(","); + QStringList sub_line_elements = f_result.split(","); - if (sub_line_elements.size() < 2) - return return_value; + 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_value.setX(sub_line_elements.at(0).toInt()); + return_value.setY(sub_line_elements.at(1).toInt()); - return return_value; + return return_value; } -pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QString p_file, QString p_char) +pos_size_type AOApplication::get_element_dimensions(QString p_identifier, + QString p_file, + QString p_char) { - QString char_ini_path = get_base_path() + "misc/" + get_chat(p_char) + "/" + 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, char_ini_path); + QString char_ini_path = + get_base_path() + "misc/" + get_chat(p_char) + "/" + 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, char_ini_path); - pos_size_type return_value; + pos_size_type return_value; - return_value.x = 0; - return_value.y = 0; - return_value.width = -1; - return_value.height = -1; + 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, design_ini_path); if (f_result == "") { - f_result = read_design_ini(p_identifier, design_ini_path); - if (f_result == "") { - f_result = read_design_ini(p_identifier, default_path); + f_result = read_design_ini(p_identifier, default_path); - if (f_result == "") - return return_value; - } + if (f_result == "") + return return_value; } + } - QStringList sub_line_elements = f_result.split(","); + QStringList sub_line_elements = f_result.split(","); - if (sub_line_elements.size() < 4) - return return_value; + 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_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; + return return_value; } -QString AOApplication::get_design_element(QString p_identifier, QString p_file, QString p_char) +QString AOApplication::get_design_element(QString p_identifier, QString p_file, + QString p_char) { - QString char_ini_path = get_base_path() + "misc/" + get_chat(p_char) + "/" + 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, char_ini_path); - if (f_result == "") { - f_result = read_design_ini(p_identifier, design_ini_path); - if (f_result == "") - f_result = read_design_ini(p_identifier, default_path); - } - return f_result; + QString char_ini_path = + get_base_path() + "misc/" + get_chat(p_char) + "/" + 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, char_ini_path); + if (f_result == "") { + f_result = read_design_ini(p_identifier, design_ini_path); + if (f_result == "") + f_result = read_design_ini(p_identifier, default_path); + } + return f_result; } 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 ""; - } - return f_result; + 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 ""; + } + 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); + 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 == "") { + f_result = read_design_ini(p_identifier, default_path); - if (f_result == "") - return 10; - } + if (f_result == "") + return 10; + } - return f_result.toInt(); + 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); + 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); + QColor return_color(0, 0, 0); - if (f_result == "") { - f_result = read_design_ini(p_identifier, default_path); + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); - if (f_result == "") - return return_color; - } + if (f_result == "") + return return_color; + } - QStringList color_list = f_result.split(","); + QStringList color_list = f_result.split(","); - if (color_list.size() < 3) - return return_color; + 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_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; + return return_color; } QString AOApplication::get_stylesheet(QString p_file) { - QString design_ini_path = get_theme_path(p_file); - QString default_path = get_default_theme_path(p_file); + QString design_ini_path = get_theme_path(p_file); + QString default_path = get_default_theme_path(p_file); - QFile design_ini; + QFile design_ini; - design_ini.setFileName(design_ini_path); + design_ini.setFileName(design_ini_path); - if (!design_ini.open(QIODevice::ReadOnly)) { - design_ini.setFileName(default_path); - if (!design_ini.open(QIODevice::ReadOnly)) - return ""; - } + if (!design_ini.open(QIODevice::ReadOnly)) { + design_ini.setFileName(default_path); + if (!design_ini.open(QIODevice::ReadOnly)) + return ""; + } - QTextStream in(&design_ini); + QTextStream in(&design_ini); - QString f_text; + QString f_text; - while (!in.atEnd()) { - f_text.append(in.readLine()); - } + while (!in.atEnd()) { + f_text.append(in.readLine()); + } - design_ini.close(); - return f_text; + design_ini.close(); + return f_text; } QString AOApplication::get_tagged_stylesheet(QString target_tag, QString p_file) { - QString design_ini_path = get_theme_path(p_file); + QString design_ini_path = get_theme_path(p_file); - QFile design_ini; + QFile design_ini; - design_ini.setFileName(design_ini_path); + design_ini.setFileName(design_ini_path); - if (!design_ini.open(QIODevice::ReadOnly)) - return ""; + if (!design_ini.open(QIODevice::ReadOnly)) + return ""; - QTextStream in(&design_ini); + QTextStream in(&design_ini); - QString f_text; + QString f_text; - bool tag_found = false; + bool tag_found = false; - while (!in.atEnd()) { - QString line = in.readLine(); + while (!in.atEnd()) { + QString line = in.readLine(); - if (line.startsWith(target_tag, Qt::CaseInsensitive)) { - tag_found = true; - continue; - } + if (line.startsWith(target_tag, Qt::CaseInsensitive)) { + tag_found = true; + continue; + } - if (tag_found) { - if ((line.startsWith("[") && line.endsWith("]"))) - break; - f_text.append(line); - } + if (tag_found) { + if ((line.startsWith("[") && line.endsWith("]"))) + break; + f_text.append(line); } + } - design_ini.close(); - return f_text; + design_ini.close(); + return f_text; } QString AOApplication::get_chat_markdown(QString p_identifier, QString p_chat) { - 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); + 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 == "") + f_result = read_design_ini(p_identifier, default_path); - return f_result.toLatin1(); + return f_result.toLatin1(); } QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) { - QColor return_color(255, 255, 255); + QColor return_color(255, 255, 255); + + switch (p_identifier.toInt()) { + case 0: // White + return_color = QColor(255, 255, 255); + break; + case 1: // Green + return_color = QColor(0, 255, 0); + break; + case 2: // Red + return_color = QColor(255, 0, 0); + break; + case 3: // Orange + return_color = QColor(255, 165, 0); + break; + case 4: // Blue + return_color = QColor(45, 150, 255); + break; + case 5: // Yellow + return_color = QColor(255, 255, 0); + break; + case 6: // Pink + return_color = QColor(255, 192, 203); + break; + case 7: // Cyan + return_color = QColor(0, 255, 255); + break; + case 8: // Grey + return_color = QColor(187, 187, 187); + break; + default: + return_color = QColor(255, 255, 255); + break; + } + 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("c" + p_identifier, design_ini_path); + + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); - switch (p_identifier.toInt()) { - case 0: //White - return_color = QColor(255, 255, 255); - break; - case 1: //Green - return_color = QColor(0, 255, 0); - break; - case 2: //Red - return_color = QColor(255, 0, 0); - break; - case 3: //Orange - return_color = QColor(255, 165, 0); - break; - case 4: //Blue - return_color = QColor(45, 150, 255); - break; - case 5: //Yellow - return_color = QColor(255, 255, 0); - break; - case 6: //Pink - return_color = QColor(255, 192, 203); - break; - case 7: //Cyan - return_color = QColor(0, 255, 255); - break; - case 8: //Grey - return_color = QColor(187, 187, 187); - break; - default: - return_color = QColor(255, 255, 255); - break; - } - 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("c" + p_identifier, design_ini_path); - - if (f_result == "") { - f_result = read_design_ini(p_identifier, default_path); - - if (f_result == "") - return return_color; - } + if (f_result == "") + return return_color; + } - QStringList color_list = f_result.split(","); + QStringList color_list = f_result.split(","); - if (color_list.size() < 3) - return return_color; + 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_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; + 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 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 = ""; + QString return_sfx = ""; - if (f_result == "") { - f_result = read_design_ini(p_identifier, default_path); + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); - if (f_result == "") - return return_sfx; - } + if (f_result == "") + return return_sfx; + } - return_sfx = f_result; + return_sfx = f_result; - return return_sfx; + return return_sfx; } QString AOApplication::get_sfx_suffix(QString sound_to_check) { - if (file_exists(sound_to_check)) - return sound_to_check; - if (file_exists(sound_to_check + ".opus")) - return sound_to_check + ".opus"; - if (file_exists(sound_to_check + ".ogg")) - return sound_to_check + ".ogg"; - if (file_exists(sound_to_check + ".mp3")) - return sound_to_check + ".mp3"; - if (file_exists(sound_to_check + ".mp4")) - return sound_to_check + ".mp4"; - return sound_to_check + ".wav"; + if (file_exists(sound_to_check)) + return sound_to_check; + if (file_exists(sound_to_check + ".opus")) + return sound_to_check + ".opus"; + if (file_exists(sound_to_check + ".ogg")) + return sound_to_check + ".ogg"; + if (file_exists(sound_to_check + ".mp3")) + return sound_to_check + ".mp3"; + if (file_exists(sound_to_check + ".mp4")) + return sound_to_check + ".mp4"; + return sound_to_check + ".wav"; } QString AOApplication::get_image_suffix(QString path_to_check) { - if (file_exists(path_to_check)) - return 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 + ".png"; + if (file_exists(path_to_check)) + return 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 + ".png"; } QString AOApplication::get_static_image_suffix(QString path_to_check) { - return path_to_check + ".png"; + return path_to_check + ".png"; } -//returns whatever is to the right of "search_line =" within target_tag and terminator_tag, trimmed -//returns the empty string if the search line couldnt be found -QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QString target_tag) +// returns whatever is to the right of "search_line =" within target_tag and +// terminator_tag, trimmed returns the empty string if the search line couldnt be +// found +QString AOApplication::read_char_ini(QString p_char, QString p_search_line, + QString target_tag) { - QSettings settings(get_character_path(p_char, "char.ini"), QSettings::IniFormat); - settings.beginGroup(target_tag); - QString value = settings.value(p_search_line).toString(); - settings.endGroup(); - return value; + 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; } -void AOApplication::set_char_ini(QString p_char, QString value, QString p_search_line, QString target_tag) +void AOApplication::set_char_ini(QString p_char, QString value, + QString p_search_line, QString target_tag) { - QSettings settings(get_character_path(p_char, "char.ini"), QSettings::IniFormat); - settings.beginGroup(target_tag); - settings.setValue(p_search_line, value); - settings.endGroup(); + QSettings settings(get_character_path(p_char, "char.ini"), + QSettings::IniFormat); + settings.beginGroup(target_tag); + settings.setValue(p_search_line, value); + settings.endGroup(); } -//returns all the values of target_tag +// returns all the values of target_tag QStringList AOApplication::read_ini_tags(QString p_path, QString target_tag) { - QStringList r_values; - QSettings settings(p_path, QSettings::IniFormat); - if (!target_tag.isEmpty()) - settings.beginGroup(target_tag); - QStringList keys = settings.allKeys(); - foreach (QString key, keys) { - QString value = settings.value(key).toString(); - r_values << key + "=" + value; - } - if (!settings.group().isEmpty()) - settings.endGroup(); - return r_values; + QStringList r_values; + QSettings settings(p_path, QSettings::IniFormat); + if (!target_tag.isEmpty()) + settings.beginGroup(target_tag); + QStringList keys = settings.allKeys(); + foreach (QString key, keys) { + QString value = settings.value(key).toString(); + r_values << key + "=" + value; + } + if (!settings.group().isEmpty()) + settings.endGroup(); + return r_values; } QString AOApplication::get_char_name(QString p_char) { - QString f_result = read_char_ini(p_char, "name", "Options"); + QString f_result = read_char_ini(p_char, "name", "Options"); - if (f_result == "") - return p_char; - return f_result; + if (f_result == "") + return p_char; + 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"); + 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; - return f_result; + if (f_needed.startsWith("false")) + return ""; + if (f_result == "") + return p_char; + return f_result; } QString AOApplication::get_char_side(QString p_char) { - QString f_result = read_char_ini(p_char, "side", "Options"); + QString f_result = read_char_ini(p_char, "side", "Options"); - if (f_result == "") - return "wit"; - return f_result; + if (f_result == "") + return "wit"; + return f_result; } QString AOApplication::get_gender(QString p_char) { - QString f_result = read_char_ini(p_char, "gender", "Options"); + QString f_result = read_char_ini(p_char, "gender", "Options"); - if (f_result == "") - return "sfx-blipmale"; + if (f_result == "") + return "sfx-blipmale"; - if (!file_exists(get_sfx_suffix(get_sounds_path(f_result)))) { - if (file_exists(get_sfx_suffix(get_sounds_path("../blips/" + f_result)))) - return "../blips/" + f_result; //Return the cool kids variant + if (!file_exists(get_sfx_suffix(get_sounds_path(f_result)))) { + if (file_exists(get_sfx_suffix(get_sounds_path("../blips/" + f_result)))) + return "../blips/" + f_result; // Return the cool kids variant - return "sfx-blip" + f_result; //Return legacy variant - } - return f_result; + return "sfx-blip" + f_result; // Return legacy variant + } + return f_result; } QString AOApplication::get_chat(QString p_char) { - QString f_result = read_char_ini(p_char, "chat", "Options"); + 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; + // handling the correct order of chat is a bit complicated, we let the caller + // do it + return f_result; } QString AOApplication::get_chat_font(QString p_char) { - QString f_result = read_char_ini(p_char, "chat_font", "Options"); + QString f_result = read_char_ini(p_char, "chat_font", "Options"); - return f_result; + return f_result; } int AOApplication::get_chat_size(QString p_char) { - QString f_result = read_char_ini(p_char, "chat_size", "Options"); + QString f_result = read_char_ini(p_char, "chat_size", "Options"); - if (f_result == "") - return -1; - return f_result.toInt(); + if (f_result == "") + return -1; + return f_result.toInt(); } QString AOApplication::get_char_shouts(QString p_char) { - QString f_result = read_char_ini(p_char, "shouts", "Options"); - if (f_result == "") - return "default"; - return f_result; + QString f_result = read_char_ini(p_char, "shouts", "Options"); + if (f_result == "") + return "default"; + 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"); + QString f_result = read_char_ini(p_char, p_emote, "Time"); - if (f_result == "") - return -1; - return f_result.toInt(); + if (f_result == "") + return -1; + 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"); + QString f_result = read_char_ini(p_char, "%" + p_emote, "Time"); - if (f_result == "") - return -1; - return f_result.toInt(); + if (f_result == "") + return -1; + return f_result.toInt(); } int AOApplication::get_emote_number(QString p_char) { - QString f_result = read_char_ini(p_char, "number", "Emotions"); + QString f_result = read_char_ini(p_char, "number", "Emotions"); - if (f_result == "") - return 0; - return f_result.toInt(); + if (f_result == "") + return 0; + return f_result.toInt(); } QString AOApplication::get_emote_comment(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); - QStringList result_contents = f_result.split("#"); + QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 4) { - qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; - return "normal"; - } - return result_contents.at(0); + if (result_contents.size() < 4) { + qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; + return "normal"; + } + return result_contents.at(0); } QString AOApplication::get_pre_emote(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); - QStringList result_contents = f_result.split("#"); + QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 4) { - qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; - return ""; - } - return result_contents.at(1); + if (result_contents.size() < 4) { + qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; + return ""; + } + return result_contents.at(1); } QString AOApplication::get_emote(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); - QStringList result_contents = f_result.split("#"); + QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 4) { - qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; - return "normal"; - } - return result_contents.at(2); + if (result_contents.size() < 4) { + qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; + return "normal"; + } + return result_contents.at(2); } int AOApplication::get_emote_mod(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); - QStringList result_contents = f_result.split("#"); + QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 4) { - qDebug() << "W: misformatted char.ini: " << p_char << ", " << QString::number(p_emote); - return 0; - } - return result_contents.at(3).toInt(); + if (result_contents.size() < 4) { + qDebug() << "W: misformatted char.ini: " << p_char << ", " + << QString::number(p_emote); + return 0; + } + return result_contents.at(3).toInt(); } int AOApplication::get_desk_mod(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); - QStringList result_contents = f_result.split("#"); + QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 5) - return -1; + if (result_contents.size() < 5) + return -1; - QString string_result = result_contents.at(4); - if (string_result == "") - return -1; + QString string_result = result_contents.at(4); + if (string_result == "") + return -1; - return string_result.toInt(); + return string_result.toInt(); } QString AOApplication::get_sfx_name(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundN"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "SoundN"); - if (f_result == "") - return "1"; - return f_result; + if (f_result == "") + return "1"; + return f_result; } QString AOApplication::get_emote_blip(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundB"); - return f_result; + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "SoundB"); + return f_result; } int AOApplication::get_sfx_delay(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundT"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "SoundT"); - if (f_result == "") - return 1; - return f_result.toInt(); + if (f_result == "") + return 1; + return f_result.toInt(); } QString AOApplication::get_sfx_looping(QString p_char, QString p_sfx) { - QString f_result = read_char_ini(p_char, p_sfx, "SoundL"); + QString f_result = read_char_ini(p_char, p_sfx, "SoundL"); - if (f_result == "") - return "0"; - return f_result; + if (f_result == "") + return "0"; + return f_result; } -QString AOApplication::get_sfx_frame(QString p_char, QString p_emote, int n_frame) +QString AOApplication::get_sfx_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("_FrameSFX")); + QString f_result = read_char_ini(p_char, QString::number(n_frame), + p_emote.append("_FrameSFX")); - if (f_result == "") - return ""; - return f_result; + if (f_result == "") + return ""; + return f_result; } -QString AOApplication::get_screenshake_frame(QString p_char, QString p_emote, int n_frame) +QString AOApplication::get_screenshake_frame(QString p_char, QString p_emote, + int n_frame) { - QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameScreenshake")); + QString f_result = read_char_ini(p_char, QString::number(n_frame), + p_emote.append("_FrameScreenshake")); - if (f_result == "") - return ""; - return f_result; + if (f_result == "") + return ""; + return f_result; } -QString AOApplication::get_flash_frame(QString p_char, QString p_emote, int n_frame) +QString AOApplication::get_flash_frame(QString p_char, QString p_emote, + int n_frame) { - QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameRealization")); + QString f_result = read_char_ini(p_char, QString::number(n_frame), + p_emote.append("_FrameRealization")); - if (f_result == "") - return ""; - return f_result; + if (f_result == "") + return ""; + return f_result; } int AOApplication::get_text_delay(QString p_char, QString p_emote) { - QString f_result = read_char_ini(p_char, p_emote, "TextDelay"); + QString f_result = read_char_ini(p_char, p_emote, "TextDelay"); - if (f_result == "") - return -1; - return f_result.toInt(); + if (f_result == "") + return -1; + return f_result.toInt(); } QStringList AOApplication::get_theme_effects() { - QString p_path = get_theme_path("effects/effects.ini"); - QString default_path = get_default_theme_path("effects/effects.ini"); + QString p_path = get_theme_path("effects/effects.ini"); + QString default_path = get_default_theme_path("effects/effects.ini"); - QStringList effects; - if (!file_exists(p_path)) { - p_path = default_path; - if (!file_exists(p_path)) - return effects; - } + QStringList effects; + if (!file_exists(p_path)) { + p_path = default_path; + if (!file_exists(p_path)) + return effects; + } - QStringList lines = read_file(p_path).split("\n"); - foreach (QString effect, lines) { - effect = effect.split("=")[0].trimmed(); - if (!effect.isEmpty() && !effects.contains(effect)) - effects.append(effect); - } - return effects; + QStringList lines = read_file(p_path).split("\n"); + foreach (QString effect, lines) { + effect = effect.split("=")[0].trimmed(); + if (!effect.isEmpty() && !effects.contains(effect)) + effects.append(effect); + } + return effects; } QStringList AOApplication::get_effects(QString p_char) { - QString p_effect = read_char_ini(p_char, "effects", "Options"); - QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; + QString p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; - QStringList effects = get_theme_effects(); - if (!file_exists(p_path)) - return effects; + QStringList effects = get_theme_effects(); + if (!file_exists(p_path)) + return effects; - QStringList lines = read_file(p_path).split("\n"); - foreach (QString effect, lines) { - effect = effect.split("=")[0].trimmed(); - if (!effect.isEmpty() && !effects.contains(effect)) - effects.append(effect); - } + QStringList lines = read_file(p_path).split("\n"); + foreach (QString effect, lines) { + effect = effect.split("=")[0].trimmed(); + if (!effect.isEmpty() && !effects.contains(effect)) + effects.append(effect); + } - return effects; + return effects; } -QString AOApplication::get_effect(QString effect, QString p_char, QString p_folder) +QString AOApplication::get_effect(QString effect, QString p_char, + QString p_folder) { - QString p_effect = p_folder; - if (p_folder == "") - p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_effect = p_folder; + if (p_folder == "") + p_effect = read_char_ini(p_char, "effects", "Options"); - QString p_path = get_image_suffix(get_base_path() + "misc/" + p_effect + "/" + effect); - QString design_ini_path = get_image_suffix(get_theme_path("effects/" + effect)); - QString default_path = get_image_suffix(get_default_theme_path("effects/" + effect)); + QString p_path = + get_image_suffix(get_base_path() + "misc/" + p_effect + "/" + effect); + QString design_ini_path = + get_image_suffix(get_theme_path("effects/" + effect)); + QString default_path = + get_image_suffix(get_default_theme_path("effects/" + effect)); + if (!file_exists(p_path)) { + p_path = design_ini_path; if (!file_exists(p_path)) { - p_path = design_ini_path; - if (!file_exists(p_path)) { - p_path = default_path; - if (!file_exists(p_path)) { - return ""; - } - } + p_path = default_path; + if (!file_exists(p_path)) { + return ""; + } } + } - return p_path; + return p_path; } QString AOApplication::get_effect_sound(QString fx_name, QString p_char) { - QString p_effect = read_char_ini(p_char, "effects", "Options"); - QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; - QString design_ini_path = get_theme_path("effects/effects.ini"); - QString default_path = get_default_theme_path("effects/effects.ini"); + QString p_effect = read_char_ini(p_char, "effects", "Options"); + QString p_path = get_base_path() + "misc/" + p_effect + "/effects.ini"; + QString design_ini_path = get_theme_path("effects/effects.ini"); + QString default_path = get_default_theme_path("effects/effects.ini"); - QString f_result = read_design_ini(fx_name, p_path); + QString f_result = read_design_ini(fx_name, p_path); + if (f_result == "") { + f_result = read_design_ini(fx_name, design_ini_path); if (f_result == "") { - f_result = read_design_ini(fx_name, design_ini_path); - if (f_result == "") { - f_result = read_design_ini(fx_name, default_path); - } + f_result = read_design_ini(fx_name, default_path); } - return f_result; + } + return f_result; } QString AOApplication::get_custom_realization(QString p_char) { - QString f_result = read_char_ini(p_char, "realization", "Options"); + QString f_result = read_char_ini(p_char, "realization", "Options"); - if (f_result == "") - return get_sfx("realization"); - else - return get_sfx_suffix(get_sounds_path(f_result)); + if (f_result == "") + return get_sfx("realization"); + else + return get_sfx_suffix(get_sounds_path(f_result)); } bool AOApplication::get_blank_blip() { - QString result = configini->value("blank_blip", "false").value(); - return result.startsWith("true"); + 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"); + QString result = configini->value("looping_sfx", "true").value(); + return result.startsWith("true"); } bool AOApplication::objection_stop_music() { - QString result = configini->value("objection_stop_music", "false").value(); - return result.startsWith("true"); + QString result = + configini->value("objection_stop_music", "false").value(); + return result.startsWith("true"); } bool AOApplication::is_discord_enabled() { - QString result = configini->value("discord", "true").value(); - return result.startsWith("true"); + QString result = configini->value("discord", "true").value(); + return result.startsWith("true"); } bool AOApplication::is_shake_enabled() { - QString result = configini->value("shake", "true").value(); - return result.startsWith("true"); + QString result = configini->value("shake", "true").value(); + return result.startsWith("true"); } bool AOApplication::is_effects_enabled() { - QString result = configini->value("effects", "true").value(); - return result.startsWith("true"); + QString result = configini->value("effects", "true").value(); + return result.startsWith("true"); } bool AOApplication::is_frame_network_enabled() { - QString result = configini->value("framenetwork", "true").value(); - return result.startsWith("true"); + QString result = configini->value("framenetwork", "true").value(); + return result.startsWith("true"); } bool AOApplication::is_colorlog_enabled() { - QString result = configini->value("colorlog", "true").value(); - return result.startsWith("true"); + QString result = configini->value("colorlog", "true").value(); + return result.startsWith("true"); } bool AOApplication::is_stickysounds_enabled() { - QString result = configini->value("stickysounds", "false").value(); - return result.startsWith("true"); + QString result = configini->value("stickysounds", "false").value(); + return result.startsWith("true"); } bool AOApplication::is_stickyeffects_enabled() { - QString result = configini->value("stickyeffects", "false").value(); - return result.startsWith("true"); + QString result = configini->value("stickyeffects", "false").value(); + return result.startsWith("true"); } bool AOApplication::is_stickypres_enabled() { - QString result = configini->value("stickypres", "false").value(); - return result.startsWith("true"); + QString result = configini->value("stickypres", "false").value(); + return result.startsWith("true"); } bool AOApplication::get_casing_enabled() { - QString result = configini->value("casing_enabled", "false").value(); - return result.startsWith("true"); + 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"); + 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"); + 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"); + 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"); + 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"); + QString result = + configini->value("casing_steno_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 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; + QString result = + configini->value("casing_can_host_cases", "Turnabout Check Your Settings") + .value(); + return result; } -- cgit From a5868aa3800de43ce6f6aee903bb0fecf2fe105b Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 22 May 2020 04:53:19 +0300 Subject: Fix looping frame SFX not working w/ AOV's definitions --- include/aoapplication.h | 2 +- src/courtroom.cpp | 14 +++++++------- src/text_file_functions.cpp | 13 ++++++++----- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index d9e84fa8..471fc46e 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -371,7 +371,7 @@ public: QString get_emote_blip(QString p_char, int p_emote); // Returns if the sfx is defined as looping in char.ini - QString get_sfx_looping(QString p_char, QString p_sfx); + QString get_sfx_looping(QString p_char, int p_emote); // Returns if an emote has a frame specific SFX for it QString get_sfx_frame(QString p_char, QString p_emote, int n_frame); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 9261de33..63d7f5e4 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1637,7 +1637,7 @@ void Courtroom::on_chat_return_pressed() // emote uses it. if (ao_app->looping_sfx_support_enabled) { packet_contents.append( - "0"); // ao_app->get_sfx_looping(current_char, current_emote)); + ao_app->get_sfx_looping(current_char, current_emote)); packet_contents.append(QString::number(screenshake_state)); QString pre_emote = ao_app->get_pre_emote(current_char, current_emote); @@ -2124,10 +2124,10 @@ void Courtroom::do_effect(QString fx_name, QString fx_sound, QString p_char, void Courtroom::play_char_sfx(QString sfx_name) { sfx_player->play(sfx_name); - if (ao_app->get_looping_sfx()) - sfx_player->set_looping( - ao_app->get_sfx_looping(current_char, QString::number(current_emote)) != - "0"); + // sfx_player->set_looping(false); + // if (ao_app->get_looping_sfx()) + // sfx_player->set_looping( + // ao_app->get_sfx_looping(current_char, current_emote) == "1"); } void Courtroom::handle_chatmessage_3() @@ -2877,8 +2877,8 @@ void Courtroom::play_sfx() sfx_player->play(sfx_name); if (ao_app->get_looping_sfx()) - sfx_player->set_looping(ao_app->get_sfx_looping(current_char, sfx_name) != - "0"); + sfx_player->set_looping( + ao_app->get_sfx_looping(current_char, current_emote) == "1"); } void Courtroom::set_scene(QString f_desk_mod, QString f_side) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 615a6a14..1689cd3f 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -558,8 +558,8 @@ QString AOApplication::get_static_image_suffix(QString path_to_check) } // 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 +// 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) { @@ -805,13 +805,16 @@ int AOApplication::get_sfx_delay(QString p_char, int p_emote) return f_result.toInt(); } -QString AOApplication::get_sfx_looping(QString p_char, QString p_sfx) +QString AOApplication::get_sfx_looping(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, p_sfx, "SoundL"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "SoundL"); + qDebug() << f_result; if (f_result == "") return "0"; - return f_result; + else + return f_result; } QString AOApplication::get_sfx_frame(QString p_char, QString p_emote, -- cgit From 4617e3135ed14a28c4129154486022947fda9d82 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 22 May 2020 15:28:33 +0300 Subject: Change version number to 2.8.4 --- include/aoapplication.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 471fc46e..18f6ef24 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -428,7 +428,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 8; - const int MINOR_VERSION = 3; + const int MINOR_VERSION = 4; QString current_theme = "default"; -- cgit From 156a760ebab6839c53f9c613881f0937e814414a Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Fri, 22 May 2020 17:02:32 -0500 Subject: Full revert to tag 2.6.2 Due to a countless number of changes made to the core that were not fully understood, tested, or documented, it was decided to roll everything back to the last known stable version (2.6.2). Changes dropped include: - Witness needed - Shake - Frame SFX - Multiple custom objections - Multithreaded thumbnail generation - Looping - Various translation additions - "Mirror IC" - Color in IC log - An invocation of clang-format Next time, work together and split your big fork into independently testable feature branches. --- .github/labeler.yml | 8 - .gitignore | 4 - .gitlab-ci.yml | 69 +- .gitmodules | 3 - .travis.yml | 22 +- Attorney_Online.pro | 30 +- README.md | 18 +- android/AndroidManifest.xml | 79 - android/build.gradle | 62 - android/project.properties | 1 - android/res/drawable-ldpi/icon.png | Bin 29302 -> 0 bytes android/res/values/libs.xml | 22 - base/sounds/general/adminhelp.ogg | Bin 17220 -> 0 bytes base/sounds/general/case_announced.ogg | Bin 15790 -> 0 bytes base/sounds/music/failed_login.opus | Bin 396160 -> 0 bytes base/themes | 1 - base/themes/1.8/arrow_left.png | Bin 0 -> 742 bytes base/themes/1.8/arrow_right.png | Bin 0 -> 730 bytes base/themes/1.8/chatmed.png | Bin 0 -> 505 bytes base/themes/1.8/favorites.png | Bin 0 -> 1682 bytes base/themes/1.8/favorites_selected.png | Bin 0 -> 2238 bytes base/themes/1.8/holdit.png | Bin 0 -> 1983 bytes base/themes/1.8/holdit_selected.png | Bin 0 -> 1835 bytes base/themes/1.8/mute.png | Bin 0 -> 4984 bytes base/themes/1.8/mute_pressed.png | Bin 0 -> 4725 bytes base/themes/1.8/objection.png | Bin 0 -> 2147 bytes base/themes/1.8/objection_selected.png | Bin 0 -> 1988 bytes base/themes/1.8/publicservers.png | Bin 0 -> 1836 bytes base/themes/1.8/publicservers_selected.png | Bin 0 -> 2399 bytes base/themes/1.8/takethat.png | Bin 0 -> 2057 bytes base/themes/1.8/takethat_selected.png | Bin 0 -> 1932 bytes base/themes/default/about.png | Bin 0 -> 3298 bytes base/themes/default/addevidence.png | Bin 0 -> 403 bytes base/themes/default/addtofav.png | Bin 0 -> 972 bytes base/themes/default/addtofav_pressed.png | Bin 0 -> 938 bytes base/themes/default/arrow_left.png | Bin 0 -> 396 bytes base/themes/default/arrow_right.png | Bin 0 -> 391 bytes base/themes/default/char_passworded.png | Bin 0 -> 1904 bytes base/themes/default/char_selector.png | Bin 0 -> 285 bytes base/themes/default/char_taken.png | Bin 0 -> 215 bytes base/themes/default/charselect_background.png | Bin 0 -> 5342 bytes base/themes/default/chat.png | Bin 0 -> 1529 bytes base/themes/default/chatbig.png | Bin 0 -> 80093 bytes base/themes/default/chatmed.png | Bin 0 -> 1669 bytes base/themes/default/connect.png | Bin 0 -> 914 bytes base/themes/default/connect_pressed.png | Bin 0 -> 925 bytes base/themes/default/courtroom_design.ini | 245 + base/themes/default/courtroom_fonts.ini | 11 + base/themes/default/courtroom_sounds.ini | 8 + base/themes/default/courtroombackground.png | Bin 0 -> 63046 bytes base/themes/default/crossexamination.gif | Bin 0 -> 88834 bytes base/themes/default/crossexamination.png | Bin 0 -> 4187 bytes base/themes/default/custom.png | Bin 0 -> 2505 bytes base/themes/default/custom_selected.png | Bin 0 -> 2212 bytes base/themes/default/defense_speedlines.gif | Bin 0 -> 31308 bytes base/themes/default/defensebar0.png | Bin 0 -> 171 bytes base/themes/default/defensebar1.png | Bin 0 -> 188 bytes base/themes/default/defensebar10.png | Bin 0 -> 184 bytes base/themes/default/defensebar2.png | Bin 0 -> 187 bytes base/themes/default/defensebar3.png | Bin 0 -> 187 bytes base/themes/default/defensebar4.png | Bin 0 -> 188 bytes base/themes/default/defensebar5.png | Bin 0 -> 188 bytes base/themes/default/defensebar6.png | Bin 0 -> 188 bytes base/themes/default/defensebar7.png | Bin 0 -> 187 bytes base/themes/default/defensebar8.png | Bin 0 -> 188 bytes base/themes/default/defensebar9.png | Bin 0 -> 188 bytes base/themes/default/defminus.png | Bin 0 -> 492 bytes base/themes/default/defplus.png | Bin 0 -> 498 bytes base/themes/default/deleteevidence.png | Bin 0 -> 3280 bytes base/themes/default/emote_selected.png | Bin 0 -> 249 bytes base/themes/default/evidence_appear_left.gif | Bin 0 -> 2008 bytes base/themes/default/evidence_appear_right.gif | Bin 0 -> 2225 bytes base/themes/default/evidence_selected.png | Bin 0 -> 291 bytes base/themes/default/evidence_selector.png | Bin 0 -> 931 bytes base/themes/default/evidencebackground.png | Bin 0 -> 19927 bytes base/themes/default/evidencebutton.png | Bin 0 -> 577 bytes base/themes/default/evidenceoverlay.png | Bin 0 -> 2187 bytes base/themes/default/evidencex.png | Bin 0 -> 637 bytes base/themes/default/favorites.png | Bin 0 -> 3882 bytes base/themes/default/favorites_selected.png | Bin 0 -> 4306 bytes base/themes/default/guilty.gif | Bin 0 -> 43263 bytes base/themes/default/guilty.png | Bin 0 -> 2851 bytes base/themes/default/holdit.gif | Bin 0 -> 40518 bytes base/themes/default/holdit.png | Bin 0 -> 1983 bytes base/themes/default/holdit_selected.png | Bin 0 -> 1835 bytes base/themes/default/loadingbackground.png | Bin 0 -> 2194 bytes base/themes/default/lobby_design.ini | 17 + base/themes/default/lobbybackground.png | Bin 0 -> 29532 bytes base/themes/default/mute.png | Bin 0 -> 5037 bytes base/themes/default/mute_pressed.png | Bin 0 -> 4978 bytes base/themes/default/muted.png | Bin 0 -> 1013 bytes base/themes/default/muted_old.png | Bin 0 -> 5703 bytes base/themes/default/notguilty.gif | Bin 0 -> 34911 bytes base/themes/default/notguilty.png | Bin 0 -> 3269 bytes base/themes/default/objection.gif | Bin 0 -> 44417 bytes base/themes/default/objection.png | Bin 0 -> 2147 bytes base/themes/default/objection_selected.png | Bin 0 -> 1988 bytes base/themes/default/pair_button.png | Bin 0 -> 4677 bytes base/themes/default/pair_button_pressed.png | Bin 0 -> 4619 bytes base/themes/default/placeholder.gif | Bin 0 -> 9168 bytes base/themes/default/present.png | Bin 0 -> 3035 bytes base/themes/default/present_disabled.png | Bin 0 -> 2905 bytes base/themes/default/prominus.png | Bin 0 -> 493 bytes base/themes/default/proplus.png | Bin 0 -> 498 bytes base/themes/default/prosecution_speedlines.gif | Bin 0 -> 31252 bytes base/themes/default/prosecutionbar0.png | Bin 0 -> 200 bytes base/themes/default/prosecutionbar1.png | Bin 0 -> 237 bytes base/themes/default/prosecutionbar10.png | Bin 0 -> 173 bytes base/themes/default/prosecutionbar2.png | Bin 0 -> 241 bytes base/themes/default/prosecutionbar3.png | Bin 0 -> 230 bytes base/themes/default/prosecutionbar4.png | Bin 0 -> 243 bytes base/themes/default/prosecutionbar5.png | Bin 0 -> 241 bytes base/themes/default/prosecutionbar6.png | Bin 0 -> 241 bytes base/themes/default/prosecutionbar7.png | Bin 0 -> 242 bytes base/themes/default/prosecutionbar8.png | Bin 0 -> 240 bytes base/themes/default/prosecutionbar9.png | Bin 0 -> 237 bytes base/themes/default/publicservers.png | Bin 0 -> 3999 bytes base/themes/default/publicservers_selected.png | Bin 0 -> 4427 bytes base/themes/default/realization.png | Bin 0 -> 4259 bytes base/themes/default/realization_pressed.png | Bin 0 -> 4225 bytes base/themes/default/realizationflash.png | Bin 0 -> 646 bytes base/themes/default/refresh.png | Bin 0 -> 914 bytes base/themes/default/refresh_pressed.png | Bin 0 -> 919 bytes base/themes/default/takethat.gif | Bin 0 -> 42063 bytes base/themes/default/takethat.png | Bin 0 -> 2057 bytes base/themes/default/takethat_selected.png | Bin 0 -> 1932 bytes base/themes/default/testimony.gif | Bin 0 -> 1033 bytes base/themes/default/testimony.png | Bin 0 -> 579 bytes base/themes/default/witnesstestimony.gif | Bin 0 -> 105223 bytes base/themes/default/witnesstestimony.png | Bin 0 -> 5186 bytes include/aoapplication.h | 706 +-- include/aoblipplayer.h | 18 +- include/aobutton.h | 5 +- include/aocaseannouncerdialog.h | 14 +- include/aocharbutton.h | 8 +- include/aocharmovie.h | 43 +- include/aoemotebutton.h | 13 +- include/aoevidencebutton.h | 10 +- include/aoevidencedisplay.h | 7 +- include/aoimage.h | 7 +- include/aolineedit.h | 5 +- include/aomovie.h | 9 +- include/aomusicplayer.h | 38 +- include/aooptionsdialog.h | 268 +- include/aopacket.h | 9 +- include/aoscene.h | 7 +- include/aosfxplayer.h | 22 +- include/aotextarea.h | 15 +- include/aotextedit.h | 4 +- include/bass.h | 2224 ++++--- include/chatlogpiece.h | 14 +- include/courtroom.h | 1407 ++-- include/datatypes.h | 47 +- include/debug_functions.h | 2 +- include/discord-rpc.h | 64 +- include/discord_register.h | 26 +- include/discord_rich_presence.h | 14 +- include/discord_rpc.h | 66 +- include/encryption_functions.h | 6 +- include/file_functions.h | 2 +- include/hex_functions.h | 13 +- include/lobby.h | 23 +- include/misc_functions.h | 2 +- include/networkmanager.h | 11 +- include/text_file_functions.h | 8 +- resource/translations/ao_de.qm | Bin 23500 -> 0 bytes resource/translations/ao_de.ts | 1118 ---- resource/translations/ao_en.qm | Bin 23 -> 0 bytes resource/translations/ao_en.ts | 937 --- resource/translations/ao_es.qm | Bin 28457 -> 0 bytes resource/translations/ao_es.ts | 1048 --- resource/translations/ao_jp.qm | Bin 2004 -> 0 bytes resource/translations/ao_jp.ts | 964 --- resource/translations/ao_pl.qm | Bin 27653 -> 0 bytes resource/translations/ao_pl.ts | 987 --- resource/translations/ao_pt.qm | Bin 28605 -> 0 bytes resource/translations/ao_pt.ts | 977 --- resource/translations/ao_ru.qm | Bin 21968 -> 0 bytes resource/translations/ao_ru.ts | 999 --- resources.qrc | 7 - scripts/configure_ubuntu.sh | 6 +- scripts/macos_build.sh | 2 +- scripts/macos_post_build.sh | 4 +- scripts/release_macos.sh | 22 + scripts/wasabi_program.sh | 2 +- scripts/windows/Dockerfile | 11 +- src/aoapplication.cpp | 89 +- src/aoblipplayer.cpp | 58 +- src/aobutton.cpp | 9 +- src/aocaseannouncerdialog.cpp | 43 +- src/aocharbutton.cpp | 32 +- src/aocharmovie.cpp | 295 +- src/aoemotebutton.cpp | 18 +- src/aoevidencebutton.cpp | 23 +- src/aoevidencedisplay.cpp | 37 +- src/aoimage.cpp | 11 +- src/aolineedit.cpp | 5 +- src/aomovie.cpp | 206 +- src/aomusicplayer.cpp | 64 +- src/aooptionsdialog.cpp | 1010 ++- src/aopacket.cpp | 29 +- src/aoscene.cpp | 71 +- src/aosfxplayer.cpp | 86 +- src/aotextarea.cpp | 53 +- src/aotextedit.cpp | 8 +- src/charselect.cpp | 272 +- src/chatlogpiece.cpp | 42 +- src/courtroom.cpp | 8092 +++++++++++------------- src/debug_functions.cpp | 17 +- src/discord_rich_presence.cpp | 37 +- src/emotes.cpp | 43 +- src/encryption_functions.cpp | 19 +- src/evidence.cpp | 104 +- src/file_functions.cpp | 3 +- src/hardware_functions.cpp | 41 +- src/hex_functions.cpp | 23 +- src/lobby.cpp | 791 ++- src/main.cpp | 46 +- src/misc_functions.cpp | 2 +- src/networkmanager.cpp | 138 +- src/packet_distribution.cpp | 1427 ++--- src/path_functions.cpp | 76 +- src/text_file_functions.cpp | 1491 ++--- 223 files changed, 9450 insertions(+), 18182 deletions(-) delete mode 100644 .github/labeler.yml delete mode 100644 .gitmodules delete mode 100644 android/AndroidManifest.xml delete mode 100644 android/build.gradle delete mode 100644 android/project.properties delete mode 100644 android/res/drawable-ldpi/icon.png delete mode 100644 android/res/values/libs.xml delete mode 100644 base/sounds/general/adminhelp.ogg delete mode 100644 base/sounds/general/case_announced.ogg delete mode 100644 base/sounds/music/failed_login.opus delete mode 160000 base/themes create mode 100644 base/themes/1.8/arrow_left.png create mode 100644 base/themes/1.8/arrow_right.png create mode 100644 base/themes/1.8/chatmed.png create mode 100644 base/themes/1.8/favorites.png create mode 100644 base/themes/1.8/favorites_selected.png create mode 100644 base/themes/1.8/holdit.png create mode 100644 base/themes/1.8/holdit_selected.png create mode 100644 base/themes/1.8/mute.png create mode 100644 base/themes/1.8/mute_pressed.png create mode 100644 base/themes/1.8/objection.png create mode 100644 base/themes/1.8/objection_selected.png create mode 100644 base/themes/1.8/publicservers.png create mode 100644 base/themes/1.8/publicservers_selected.png create mode 100644 base/themes/1.8/takethat.png create mode 100644 base/themes/1.8/takethat_selected.png create mode 100644 base/themes/default/about.png create mode 100644 base/themes/default/addevidence.png create mode 100644 base/themes/default/addtofav.png create mode 100644 base/themes/default/addtofav_pressed.png create mode 100644 base/themes/default/arrow_left.png create mode 100644 base/themes/default/arrow_right.png create mode 100644 base/themes/default/char_passworded.png create mode 100644 base/themes/default/char_selector.png create mode 100644 base/themes/default/char_taken.png create mode 100644 base/themes/default/charselect_background.png create mode 100644 base/themes/default/chat.png create mode 100644 base/themes/default/chatbig.png create mode 100644 base/themes/default/chatmed.png create mode 100644 base/themes/default/connect.png create mode 100644 base/themes/default/connect_pressed.png create mode 100644 base/themes/default/courtroom_design.ini create mode 100644 base/themes/default/courtroom_fonts.ini create mode 100644 base/themes/default/courtroom_sounds.ini create mode 100644 base/themes/default/courtroombackground.png create mode 100644 base/themes/default/crossexamination.gif create mode 100644 base/themes/default/crossexamination.png create mode 100644 base/themes/default/custom.png create mode 100644 base/themes/default/custom_selected.png create mode 100644 base/themes/default/defense_speedlines.gif create mode 100644 base/themes/default/defensebar0.png create mode 100644 base/themes/default/defensebar1.png create mode 100644 base/themes/default/defensebar10.png create mode 100644 base/themes/default/defensebar2.png create mode 100644 base/themes/default/defensebar3.png create mode 100644 base/themes/default/defensebar4.png create mode 100644 base/themes/default/defensebar5.png create mode 100644 base/themes/default/defensebar6.png create mode 100644 base/themes/default/defensebar7.png create mode 100644 base/themes/default/defensebar8.png create mode 100644 base/themes/default/defensebar9.png create mode 100644 base/themes/default/defminus.png create mode 100644 base/themes/default/defplus.png create mode 100644 base/themes/default/deleteevidence.png create mode 100644 base/themes/default/emote_selected.png create mode 100644 base/themes/default/evidence_appear_left.gif create mode 100644 base/themes/default/evidence_appear_right.gif create mode 100644 base/themes/default/evidence_selected.png create mode 100644 base/themes/default/evidence_selector.png create mode 100644 base/themes/default/evidencebackground.png create mode 100644 base/themes/default/evidencebutton.png create mode 100644 base/themes/default/evidenceoverlay.png create mode 100644 base/themes/default/evidencex.png create mode 100644 base/themes/default/favorites.png create mode 100644 base/themes/default/favorites_selected.png create mode 100644 base/themes/default/guilty.gif create mode 100644 base/themes/default/guilty.png create mode 100644 base/themes/default/holdit.gif create mode 100644 base/themes/default/holdit.png create mode 100644 base/themes/default/holdit_selected.png create mode 100644 base/themes/default/loadingbackground.png create mode 100644 base/themes/default/lobby_design.ini create mode 100644 base/themes/default/lobbybackground.png create mode 100644 base/themes/default/mute.png create mode 100644 base/themes/default/mute_pressed.png create mode 100644 base/themes/default/muted.png create mode 100644 base/themes/default/muted_old.png create mode 100644 base/themes/default/notguilty.gif create mode 100644 base/themes/default/notguilty.png create mode 100644 base/themes/default/objection.gif create mode 100644 base/themes/default/objection.png create mode 100644 base/themes/default/objection_selected.png create mode 100644 base/themes/default/pair_button.png create mode 100644 base/themes/default/pair_button_pressed.png create mode 100644 base/themes/default/placeholder.gif create mode 100644 base/themes/default/present.png create mode 100644 base/themes/default/present_disabled.png create mode 100644 base/themes/default/prominus.png create mode 100644 base/themes/default/proplus.png create mode 100644 base/themes/default/prosecution_speedlines.gif create mode 100644 base/themes/default/prosecutionbar0.png create mode 100644 base/themes/default/prosecutionbar1.png create mode 100644 base/themes/default/prosecutionbar10.png create mode 100644 base/themes/default/prosecutionbar2.png create mode 100644 base/themes/default/prosecutionbar3.png create mode 100644 base/themes/default/prosecutionbar4.png create mode 100644 base/themes/default/prosecutionbar5.png create mode 100644 base/themes/default/prosecutionbar6.png create mode 100644 base/themes/default/prosecutionbar7.png create mode 100644 base/themes/default/prosecutionbar8.png create mode 100644 base/themes/default/prosecutionbar9.png create mode 100644 base/themes/default/publicservers.png create mode 100644 base/themes/default/publicservers_selected.png create mode 100644 base/themes/default/realization.png create mode 100644 base/themes/default/realization_pressed.png create mode 100644 base/themes/default/realizationflash.png create mode 100644 base/themes/default/refresh.png create mode 100644 base/themes/default/refresh_pressed.png create mode 100644 base/themes/default/takethat.gif create mode 100644 base/themes/default/takethat.png create mode 100644 base/themes/default/takethat_selected.png create mode 100644 base/themes/default/testimony.gif create mode 100644 base/themes/default/testimony.png create mode 100644 base/themes/default/witnesstestimony.gif create mode 100644 base/themes/default/witnesstestimony.png delete mode 100644 resource/translations/ao_de.qm delete mode 100644 resource/translations/ao_de.ts delete mode 100644 resource/translations/ao_en.qm delete mode 100644 resource/translations/ao_en.ts delete mode 100644 resource/translations/ao_es.qm delete mode 100644 resource/translations/ao_es.ts delete mode 100644 resource/translations/ao_jp.qm delete mode 100644 resource/translations/ao_jp.ts delete mode 100644 resource/translations/ao_pl.qm delete mode 100644 resource/translations/ao_pl.ts delete mode 100644 resource/translations/ao_pt.qm delete mode 100644 resource/translations/ao_pt.ts delete mode 100644 resource/translations/ao_ru.qm delete mode 100644 resource/translations/ao_ru.ts mode change 100755 => 100644 scripts/macos_post_build.sh create mode 100755 scripts/release_macos.sh diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 56c4cc7c..00000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,8 +0,0 @@ -translation: - - resource/translations/* - -content: - - base/**/* - -good_luck: - - src/courtroom.cpp diff --git a/.gitignore b/.gitignore index 3f8b3ae4..1adb744f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ *.dll *.so *.pro.autosave -*.pro.user base_override.h .DS_Store @@ -22,7 +21,6 @@ debug/ Makefile* object_script* -/android/gradle* /Attorney_Online_remake_resource.rc /attorney_online_remake_plugin_import.cpp @@ -33,5 +31,3 @@ discord/ moc* /Attorney_Online_CC_resource.rc /attorney_online_cc_plugin_import.cpp - -*.autosave diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e9685de0..0f68fe5a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,9 +8,6 @@ cache: paths: - lib/ -variables: - DEBIAN_FRONTEND: noninteractive - before_script: - echo Current working directory is $(pwd) @@ -25,24 +22,22 @@ build linux x86_64: - apt-get update - > apt-get install --no-install-recommends -y qt5-default qtmultimedia5-dev - clang make git sudo curl ca-certificates pkg-config upx unzip xz-utils - - git submodule init - - git submodule update + clang make git sudo curl ca-certificates pkg-config upx unzip # Print versions - qmake --version - clang --version # Extract BASS - #- mkdir bass - #- cd bass - #- curl http://www.un4seen.com/files/bass24-linux.zip -o bass.zip - #- unzip bass.zip - #- cp x64/libbass.so ../lib - #- curl http://www.un4seen.com/files/bassopus24-linux.zip -o bassopus.zip - #- unzip bassopus.zip - #- cp x64/libbassopus.so ../lib - #- cd .. + - mkdir bass + - cd bass + - curl http://www.un4seen.com/files/bass24-linux.zip -o bass.zip + - unzip bass.zip + - cp x64/libbass.so ../lib + - curl http://www.un4seen.com/files/bassopus24-linux.zip -o bassopus.zip + - unzip bassopus.zip + - cp x64/libbassopus.so ../lib + - cd .. # Extract Discord RPC - mkdir discord-rpc @@ -61,7 +56,7 @@ build linux x86_64: - cd .. # Build - - qmake -spec linux-clang "DEFINES += DISCORD QTAUDIO" + - qmake -spec linux-clang - make -j4 # Post-processing @@ -80,11 +75,6 @@ build windows i686: # Install dependencies - apt-get update - apt-get install --no-install-recommends -y make curl ca-certificates upx unzip - - git submodule init - - git submodule update - - # Print versions - - /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake --version # Extract BASS - mkdir bass @@ -97,19 +87,8 @@ build windows i686: - cp bassopus.dll ../lib - cd .. - # Extract QtApng - # - mkdir qtapng - # - cd qtapng - # - curl -L https://github.com/Skycoder42/QtApng/releases/download/1.1.2-2/qtapng_mingw73_32_5.13.0.zip -o apng.zip - # - unzip apng.zip - # - mkdir ../lib/imageformats - # - cp mingw73_32/plugins/imageformats/qapng.dll ../lib/imageformats/ - # - cd .. - - - ls lib - # Build - - /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake "DEFINES += DISCORD BASSAUDIO" + - /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake - make -j4 # Post-processing @@ -145,7 +124,7 @@ deploy linux x86_64: - *deploy_misc # Platform-specific - - cp -a ../lib/* . + - cp -a ../lib/*.so . - cp -a ../bin/Attorney_Online . - echo "#!/bin/sh" >> ./run.sh - echo "LD_LIBRARY_PATH=.:\$LD_LIBRARY_PATH ./Attorney_Online" >> ./run.sh @@ -179,8 +158,6 @@ deploy windows i686: # Platform-specific - cp -a ../lib/*.dll . - - mkdir imageformats - - 'cp -a ../lib/imageformats/*.dll imageformats/ || :' - cp -a ../bin/Attorney_Online.exe . # Zipping @@ -213,17 +190,11 @@ publish linux x86_64: - deploy linux x86_64 when: manual script: - - apt-get update - - apt-get install --no-install-recommends -y git nodejs npm awscli - - cd scripts - - npm install - - cd .. - - cd zip - - ../scripts/wasabi_program.sh + - ../scripts/wasabi.sh variables: MANIFEST: program_linux_x86_64.json - ARTIFACT_SUFFIX: linux_x64.tar.xz + ARTIFACT_SUFFIX: _linux_x64.tar.xz publish windows i686: image: ubuntu @@ -232,14 +203,8 @@ publish windows i686: - deploy windows i686 when: manual script: - - apt-get update - - apt-get install --no-install-recommends -y git nodejs npm awscli - - cd scripts - - npm install - - cd .. - - cd zip - - ../scripts/wasabi_program.sh + - ../scripts/wasabi.sh variables: MANIFEST: program_winnt_i386.json - ARTIFACT_SUFFIX: windows_x86.zip + ARTIFACT_SUFFIX: _windows_x86.zip diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 1376cc16..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "base/themes"] - path = base/themes - url = https://github.com/AttorneyOnline/AO2-Themes diff --git a/.travis.yml b/.travis.yml index dbd19cdc..4243b3b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,11 @@ language: cpp os: osx + addons: - homebrew: - update: true - packages: - - qt5 + homebrew: + packages: + - qt5 script: -- "./scripts/macos_build.sh" -- "./scripts/macos_post_build.sh" - -deploy: - provider: releases - api_key: - secure: mZCNwnqKeqJP5CqgYOanYnr/KHydxueGPRhvGLpY0Pop7MiH3CIHMN5dhHbtgJvE5GGMR4xUIEhPpmkCEJw7YiPREMqT4mkV4DR531ZLB3t/FizyvIwXuP6jFwzTofZ51qHfBpcurVc9sMFeD9Pw+rLTTgIiXL2sZxUUXc8U+ZZug1lYndgcO6P00fUJd6V9lyFQUGmbSca97YbG6KuCym0fEpyRnMqzKLjYsUUo8UKRBADtmD822O6z2FSldNZDn45Mkx0MYfHWyT5hzTb7WGa+DrTB/0un1HqqsNPlb/ahjrFQQNR2qd7HNGZa+Mvwi6egTDug+k15x8lbkacUoi34U1eFq9LSTYm8dSO5g23I1OvGvjTCkDj1jOLPqB99XlbAJ0E/9Jzw7wtlLaAzvFzTj/B63TQnO3IsgHBWR14CZlf05WMOFf2irwl+kL6ktspIHnlGgaiWYYrKeAt7QJAXiQOdYDz6SaWVC6TyOE/SszXRU6xFotmCjkP2irM5yGE8SUw2uIzKjD9uG0ZXtbLcdQEFD316+qglqFTCjnKsRfbtQs2u5spZPsZSdsOZCbLfNIn0GSTFRymFsK6gsvji8AD8AZo0zcOZ/7NMVC6A8RnF3Ve+vU/xljhsIOxoLZDvZPia7WozdV99xmnepWBwkuoQs/K0xmWcnLZDcb0= - file: "../bin/Attorney_Online_mac_x86_64.zip" - draft: true - on: - tags: true - repo: AttorneyOnline/AO2-Client + - ./scripts/macos_build.sh + - ./scripts/macos_post_build.sh diff --git a/Attorney_Online.pro b/Attorney_Online.pro index c773fb33..20a61d36 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -3,7 +3,7 @@ QT += core gui widgets network TARGET = Attorney_Online TEMPLATE = app -VERSION = 2.7.2.0 +VERSION = 2.6.2.0 INCLUDEPATH += $$PWD/include DESTDIR = $$PWD/bin @@ -16,14 +16,13 @@ HEADERS += $$files($$PWD/include/*.h) LIBS += -L$$PWD/lib - -#DEFINES += DISCORD +DEFINES += DISCORD contains(DEFINES, DISCORD) { LIBS += -ldiscord-rpc } -#DEFINES += BASSAUDIO +DEFINES += BASSAUDIO contains(DEFINES, BASSAUDIO) { LIBS += -lbass @@ -35,10 +34,6 @@ contains(DEFINES, QTAUDIO) { QT += multimedia } -contains(CONFIG, qml_debug) { -DEFINES += DEBUG_NETWORK -} - macx:LIBS += -framework CoreFoundation -framework Foundation -framework CoreServices @@ -46,24 +41,5 @@ CONFIG += c++14 RESOURCES += resources.qrc -TRANSLATIONS = resource/translations/ao_en.ts \ - resource/translations/ao_jp.ts \ - resource/translations/ao_de.ts \ - resource/translations/ao_ru.ts \ - resource/translations/ao_es.ts \ - resource/translations/ao_pt.ts \ - resource/translations/ao_pl.ts - win32:RC_ICONS = resource/logo.ico macx:ICON = resource/logo.icns - -android:DISTFILES += \ - android/AndroidManifest.xml \ - android/build.gradle \ - android/gradle/wrapper/gradle-wrapper.jar \ - android/gradle/wrapper/gradle-wrapper.properties \ - android/gradlew \ - android/gradlew.bat \ - android/res/values/libs.xml - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android diff --git a/README.md b/README.md index 1abd8dff..0416e4a3 100644 --- a/README.md +++ b/README.md @@ -100,14 +100,6 @@ If you begin a message with `~~` (two tildes), the two tildes are removed and th If two players are in the same position and select each other's characters using the in-game pair list (or with `/pair [id]`), they will appear alongside each other. You can set the offset of your character using the provided spinbox (or with `/offset [percentage]`). -### Screenflash (2.6+) - -Placing a `$` (dollar symbol) at any point in the message will cause a white flash to appear at that point, and the symbol will disappear. You can do this multiple times in one message and stack it up with any other markup symbol. The flash will be silent, unlike the equivalent button. - -### Screenshake (2.6+) - -Placing an `@` (at symbol) at any point in the message will cause the screen to shake at that point, and the symbol will disappear. You can do this multiple times in one message and stack it up with any other markup symbol (including the screenflash). - ### Non-interrupting preanimations (2.6+) When checked, this will force text to immediately begin displaying without waiting for the preanimation to finish. @@ -157,19 +149,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 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. + - `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. - `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 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. + - `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. - `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 checkbox with the text 'No Intrpt', that toggles whether preanimations should delay the text or not. + - `pre_no_interrupt` is a tickbox 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 +172,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 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'!) + - `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'!) --- diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml deleted file mode 100644 index 0792ce86..00000000 --- a/android/AndroidManifest.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android/build.gradle b/android/build.gradle deleted file mode 100644 index 3087d08c..00000000 --- a/android/build.gradle +++ /dev/null @@ -1,62 +0,0 @@ -buildscript { - repositories { - google() - jcenter() - } - - dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' - } -} - -repositories { - google() - jcenter() -} - -apply plugin: 'com.android.application' - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) -} - -android { - /******************************************************* - * The following variables: - * - androidBuildToolsVersion, - * - androidCompileSdkVersion - * - qt5AndroidDir - holds the path to qt android files - * needed to build any Qt application - * on Android. - * - * are defined in gradle.properties file. This file is - * updated by QtCreator and androiddeployqt tools. - * Changing them manually might break the compilation! - *******************************************************/ - - compileSdkVersion androidCompileSdkVersion.toInteger() - - buildToolsVersion '28.0.3' - - sourceSets { - main { - manifest.srcFile 'AndroidManifest.xml' - java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] - aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] - res.srcDirs = [qt5AndroidDir + '/res', 'res'] - resources.srcDirs = ['resources'] - renderscript.srcDirs = ['src'] - assets.srcDirs = ['assets'] - jniLibs.srcDirs = ['libs'] - } - } - - lintOptions { - abortOnError false - } - - // Do not compress Qt binary resources file - aaptOptions { - noCompress 'rcc' - } -} diff --git a/android/project.properties b/android/project.properties deleted file mode 100644 index a08f37ed..00000000 --- a/android/project.properties +++ /dev/null @@ -1 +0,0 @@ -target=android-21 \ No newline at end of file diff --git a/android/res/drawable-ldpi/icon.png b/android/res/drawable-ldpi/icon.png deleted file mode 100644 index f53fe30c..00000000 Binary files a/android/res/drawable-ldpi/icon.png and /dev/null differ diff --git a/android/res/values/libs.xml b/android/res/values/libs.xml deleted file mode 100644 index 6b1a4a2a..00000000 --- a/android/res/values/libs.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - https://download.qt.io/ministro/android/qt5/qt-5.14 - - - - - - - - - - - - - - - - - diff --git a/base/sounds/general/adminhelp.ogg b/base/sounds/general/adminhelp.ogg deleted file mode 100644 index 704c0fd6..00000000 Binary files a/base/sounds/general/adminhelp.ogg and /dev/null differ diff --git a/base/sounds/general/case_announced.ogg b/base/sounds/general/case_announced.ogg deleted file mode 100644 index 1e9c3d4e..00000000 Binary files a/base/sounds/general/case_announced.ogg and /dev/null differ diff --git a/base/sounds/music/failed_login.opus b/base/sounds/music/failed_login.opus deleted file mode 100644 index 33532ee5..00000000 Binary files a/base/sounds/music/failed_login.opus and /dev/null differ diff --git a/base/themes b/base/themes deleted file mode 160000 index 6e1317ed..00000000 --- a/base/themes +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6e1317ed93a9a4831047aa151c28742b1dd8afb5 diff --git a/base/themes/1.8/arrow_left.png b/base/themes/1.8/arrow_left.png new file mode 100644 index 00000000..f1098c49 Binary files /dev/null and b/base/themes/1.8/arrow_left.png differ diff --git a/base/themes/1.8/arrow_right.png b/base/themes/1.8/arrow_right.png new file mode 100644 index 00000000..2b5ad70d Binary files /dev/null and b/base/themes/1.8/arrow_right.png differ diff --git a/base/themes/1.8/chatmed.png b/base/themes/1.8/chatmed.png new file mode 100644 index 00000000..0c3bae1e Binary files /dev/null and b/base/themes/1.8/chatmed.png differ diff --git a/base/themes/1.8/favorites.png b/base/themes/1.8/favorites.png new file mode 100644 index 00000000..0eec6114 Binary files /dev/null and b/base/themes/1.8/favorites.png differ diff --git a/base/themes/1.8/favorites_selected.png b/base/themes/1.8/favorites_selected.png new file mode 100644 index 00000000..f6a2abf8 Binary files /dev/null and b/base/themes/1.8/favorites_selected.png differ diff --git a/base/themes/1.8/holdit.png b/base/themes/1.8/holdit.png new file mode 100644 index 00000000..09d1d370 Binary files /dev/null and b/base/themes/1.8/holdit.png differ diff --git a/base/themes/1.8/holdit_selected.png b/base/themes/1.8/holdit_selected.png new file mode 100644 index 00000000..51586e74 Binary files /dev/null and b/base/themes/1.8/holdit_selected.png differ diff --git a/base/themes/1.8/mute.png b/base/themes/1.8/mute.png new file mode 100644 index 00000000..e64f7025 Binary files /dev/null and b/base/themes/1.8/mute.png differ diff --git a/base/themes/1.8/mute_pressed.png b/base/themes/1.8/mute_pressed.png new file mode 100644 index 00000000..334b4ba7 Binary files /dev/null and b/base/themes/1.8/mute_pressed.png differ diff --git a/base/themes/1.8/objection.png b/base/themes/1.8/objection.png new file mode 100644 index 00000000..6fbcbc2f Binary files /dev/null and b/base/themes/1.8/objection.png differ diff --git a/base/themes/1.8/objection_selected.png b/base/themes/1.8/objection_selected.png new file mode 100644 index 00000000..384e4e9b Binary files /dev/null and b/base/themes/1.8/objection_selected.png differ diff --git a/base/themes/1.8/publicservers.png b/base/themes/1.8/publicservers.png new file mode 100644 index 00000000..650c20cc Binary files /dev/null and b/base/themes/1.8/publicservers.png differ diff --git a/base/themes/1.8/publicservers_selected.png b/base/themes/1.8/publicservers_selected.png new file mode 100644 index 00000000..308c79fb Binary files /dev/null and b/base/themes/1.8/publicservers_selected.png differ diff --git a/base/themes/1.8/takethat.png b/base/themes/1.8/takethat.png new file mode 100644 index 00000000..8ff2befe Binary files /dev/null and b/base/themes/1.8/takethat.png differ diff --git a/base/themes/1.8/takethat_selected.png b/base/themes/1.8/takethat_selected.png new file mode 100644 index 00000000..3fe0a8cd Binary files /dev/null and b/base/themes/1.8/takethat_selected.png differ diff --git a/base/themes/default/about.png b/base/themes/default/about.png new file mode 100644 index 00000000..50fc8213 Binary files /dev/null and b/base/themes/default/about.png differ diff --git a/base/themes/default/addevidence.png b/base/themes/default/addevidence.png new file mode 100644 index 00000000..7a432af2 Binary files /dev/null and b/base/themes/default/addevidence.png differ diff --git a/base/themes/default/addtofav.png b/base/themes/default/addtofav.png new file mode 100644 index 00000000..7d989034 Binary files /dev/null and b/base/themes/default/addtofav.png differ diff --git a/base/themes/default/addtofav_pressed.png b/base/themes/default/addtofav_pressed.png new file mode 100644 index 00000000..7b62d52d Binary files /dev/null and b/base/themes/default/addtofav_pressed.png differ diff --git a/base/themes/default/arrow_left.png b/base/themes/default/arrow_left.png new file mode 100644 index 00000000..7ed9c05d Binary files /dev/null and b/base/themes/default/arrow_left.png differ diff --git a/base/themes/default/arrow_right.png b/base/themes/default/arrow_right.png new file mode 100644 index 00000000..5acc3285 Binary files /dev/null and b/base/themes/default/arrow_right.png differ diff --git a/base/themes/default/char_passworded.png b/base/themes/default/char_passworded.png new file mode 100644 index 00000000..e79d0710 Binary files /dev/null and b/base/themes/default/char_passworded.png differ diff --git a/base/themes/default/char_selector.png b/base/themes/default/char_selector.png new file mode 100644 index 00000000..e868cdb9 Binary files /dev/null and b/base/themes/default/char_selector.png differ diff --git a/base/themes/default/char_taken.png b/base/themes/default/char_taken.png new file mode 100644 index 00000000..efad48dc Binary files /dev/null and b/base/themes/default/char_taken.png differ diff --git a/base/themes/default/charselect_background.png b/base/themes/default/charselect_background.png new file mode 100644 index 00000000..4480e6f4 Binary files /dev/null and b/base/themes/default/charselect_background.png differ diff --git a/base/themes/default/chat.png b/base/themes/default/chat.png new file mode 100644 index 00000000..e11f8c8a Binary files /dev/null and b/base/themes/default/chat.png differ diff --git a/base/themes/default/chatbig.png b/base/themes/default/chatbig.png new file mode 100644 index 00000000..177dc026 Binary files /dev/null and b/base/themes/default/chatbig.png differ diff --git a/base/themes/default/chatmed.png b/base/themes/default/chatmed.png new file mode 100644 index 00000000..d2fee4a6 Binary files /dev/null and b/base/themes/default/chatmed.png differ diff --git a/base/themes/default/connect.png b/base/themes/default/connect.png new file mode 100644 index 00000000..6a41e86f Binary files /dev/null and b/base/themes/default/connect.png differ diff --git a/base/themes/default/connect_pressed.png b/base/themes/default/connect_pressed.png new file mode 100644 index 00000000..a99d9ec1 Binary files /dev/null and b/base/themes/default/connect_pressed.png differ diff --git a/base/themes/default/courtroom_design.ini b/base/themes/default/courtroom_design.ini new file mode 100644 index 00000000..960d6e4c --- /dev/null +++ b/base/themes/default/courtroom_design.ini @@ -0,0 +1,245 @@ +; Client size. Changing it to something other than 714, 668 will stretch or +; compress courtroombackground.png accordingly. +courtroom = 0, 0, 714, 668 + +; IC Area. Changing 256, 192 will stretch or compress character gifs and the +; /bgs being used accordingly +viewport = 0, 0, 256, 192 + +; IC chatbox +chatbox = 0, 174, 256, 108 + +; IC chatbox if the current background's folder contains stand.png, +; defensedesk.png and prosecutiondesk.png +ao2_chatbox = 0, 174, 256, 108 + +; Textbox for custom IC name (the "showname") +showname = 6, 1, 256, 15 + +; IC message, positioned within the chatbox. Changing 250 affects how +; long text goes on before going onto the next line. Changing 89 affects +; how many lines you can see before the message starts scrolling, based on +; the formula of n = 25+(n-1)*16, where n is the number of lines to be +; displayed. (ie, set it to 25 for 1 line, 41 for 2, 57 for 3, 73 for 4, +; 89 for 5, 105 for 6... Less than 25 displays nothing) +message = 3, 18, 250, 89 + +; Where you type to make an IC chat message +ic_chat_message = 2, 283, 250, 23 + +; IC chat message if the current background's folder contains stand.png, +; defensedesk.png and prosecutiondesk.png +ao2_ic_chat_message = 2, 283, 250, 23 + +; IC chatlog +ic_chatlog = 260, 0, 231, 319 + +; Master server chatlog +ms_chatlog = 490, 1, 224, 277 + +; OOC Chatlog +server_chatlog = 490, 1, 224, 277 + +; Where you type to make an OOC chat message +; NOTE: THIS DOES NOT HAVE ANY VISUAL APPEARANCE +ooc_chat_message = 492, 281, 222, 19 + +; Where you enter your OOC name, and also where it shows up +ooc_chat_name = 492, 300, 85, 19 + +; Toggle between Server and Master OOC chats +ooc_toggle = 580, 300, 133, 19 + +; Where the jukebox is +music_list = 490, 342, 224, 326 + +; Jukebox search bar +music_search = 490, 319, 100, 23 + +found_song_color = 100, 255, 100 +missing_song_color = 255, 100, 100 + +; Labels and sliders for music/sfx/blips +music_label = 282, 607, 41, 16 +sfx_label = 282, 627, 41, 16 +blip_label = 282, 647, 41, 16 +music_slider = 326, 608, 140, 16 +sfx_slider = 326, 628, 140, 16 +blip_slider = 326, 648, 140, 16 + +; Emote buttons - [490, 98] determines how many columns and rows of buttons are +; displayed per page. 49, 49 is the ABSOLUTE MINIMUM, and displays 1 button per +; page. Having either number lower than 49 crashes the client when you try to +; pick a character. If you want X columns and Y rows, you would change it to +; 49X, 49Y (ie. 490, 147 if you want 10 columns and 3 rows) +emotes = 5, 342, 490, 98 +emote_button_spacing = 9, 9 + +; Page togglers for emotes +emote_left = 5, 434, 60, 32 +emote_right = 428, 434, 60, 32 + +; Emote dropdown/emote names - Change '125' to make it longer/shorter and +; display the full emote name or truncate it based on length +emote_dropdown = 5, 470, 105, 20 + +; Hold it/Take That/Objection and the "BLING!" buttons +hold_it = 10, 310, 76, 28 +objection = 90, 310, 76, 28 +take_that = 170, 310, 76, 28 +realization = 5, 515, 42, 42 + +; If the server supports it (AOV does not currently) - if a character has a +; custom.gif and custom.wav in their folder, this button acts as another +; Objection/Take That/Hold It for that character that uses the custom animation +; and sfx. (Think Satorah! Such Insolence!, Gotcha!) +custom_objection = 340, 565, 76, 28 + +; Text color dropdown menu +text_color = 115, 470, 80, 20 + +pos_dropdown = 200, 470, 80, 20 + +; Preanimation toggle +pre = 5, 490, 80, 21 + +; Flip button +flip = 104, 490, 51, 21 + +; Guard button +guard = 200, 560, 61, 21 + +pre_no_interrupt = 200, 490, 80, 21 + +; Penalty bars and judge's buttons for penalizing. Other than the bars, these +; ONLY show up on a character with /pos jud +defense_bar = 5, 566, 187, 9 +prosecution_bar = 5, 582, 187, 9 +defense_plus = 183, 566, 9, 9 +defense_minus = 5, 566, 9, 9 +prosecution_plus = 183, 582, 9, 9 +prosecution_minus = 5, 582, 9, 9 + +; Judge's buttons for WT and CE. /pos jud +witness_testimony = 290, 470, 85, 42 +cross_examination = 290, 515, 85, 42 + +; Buttons to change character/Reload theme/Call Mod +change_character = 5, 610, 120, 23 +reload_theme = 5, 637, 94, 23 +call_mod = 104, 637, 64, 23 + +; Mute button +mute_button = 150, 515, 42, 42 + +; Where the Mute list pops up when you click Mute +mute_list = 280, 469, 210, 198 + +; ???? - if there was an Area button, where the area list would show up? +; area_list = 270, 494, 224, 174 + +; ???? - where a password box appears if an area is password locked? +; area_password = 266, 471, 224, 23 + +; >Evidence meme +evidence_button = 627, 322, 85, 18 +evidence_background = 0, 385, 490, 284 +evidence_name = 112, 4, 264, 19 +evidence_buttons = 28, 27, 430, 216 +evidence_button_spacing = 2, 3 +evidence_overlay = 24, 24, 439, 222 +evidence_delete = 78, 8, 70, 20 +evidence_image_name = 150, 8, 130, 20 +evidence_image_button = 280, 8, 60, 20 +evidence_x = 341, 8, 20, 20 +evidence_description = 78, 28, 281, 166 +evidence_left = 28, 0, 60, 24 +evidence_right = 400, 0, 60, 24 +evidence_present = 165, 247, 158, 41 +left_evidence_icon = 13, 13, 70, 70 +right_evidence_icon = 173, 13, 70, 70 + +; Character select widgets +char_select = 0, 0, 714, 668 +back_to_lobby = 5, 5, 91, 23 +char_password = 297, 7, 120, 22 +char_buttons = 25, 36, 663, 596 +char_button_spacing = 7, 7 +char_select_left = 100, 5, 43, 24 +char_select_right = 146, 5, 43, 24 +spectator = 317, 640, 80, 23 + +; ------------------------- +; New in 2.6.0 +; ------------------------- + +; The log limiter explaining label. This is simply a piece of text that +; explains what the spin box is for. +; log_limit_label = 190, 612, 50, 30 + +; The spinbox allows you to set the log limit ingame inbetween 1 and 10000, +; with the option to set it to 0 as well (which is considered 'infinite' by +; the log limiter). +; log_limit_spinbox = 168, 636, 70, 25 + +; This is an input field that allows you to change your in-character showname. +ic_chat_name = 200, 534, 78, 23 + +; I am sure there are some differences between the 'ao2_' versions and the +; 'ao2_'-less versions of the IC text display and input, but I do not know +; what. Still, here you go! +ao2_ic_chat_name = 200, 534, 78, 23 + +; An in-game tickbox that allows you to set whether your client should show +; custom shownames where possible, or always keep to character names. +; This is useful if you suspect someone is impersonating others, for example, +; and they are using this in combination with ini-swapping to 'duplicate' a +; character. +showname_enable = 200, 510, 80, 21 + +; A simple button that opens up the settings menu. +; Equivalent to typing /settings in the OOC chat. +settings = 130, 610, 60, 23 + +; The character search text input in the character selecton screen. +; The moment you enter some text, it immediately starts filtering. +char_search = 420, 7, 120, 22 + +; A tickbox that filters based on if a character requires password to access or not. +; Note that this is actually only partially implemented in AO. +; The interface exists for it, but no way to actually password the characters. +char_passworded = 545, 7, 100, 22 + +; A tickbox that filters characters based on if they are taken. +char_taken = 635, 7, 80, 22 + +; These buttons are similar to the CE / WT buttons, except they show a +; Not Guilty or Guilty animation instead. +not_guilty = 380, 470, 85, 42 +guilty = 380, 515, 85, 42 + +; These are responsible for the pairing stuff. +; These work much like muting, actually. +pair_button = 104, 515, 42, 42 +pair_list = 280, 490, 210, 177 +pair_offset_spinbox = 280, 470, 210, 20 + +; This button allows switching between music and areas. +switch_area_music = 590, 319, 35, 23 + +; These are colours for the various statuses an area can be in. +area_free_color = 54, 198, 68 +area_lfp_color = 255, 255, 0 +area_casing_color = 255, 166, 0 +area_recess_color = 255, 190, 30 +area_rp_color = 200, 52, 252 +area_gaming_color = 55, 255, 255 +area_locked_color = 165, 43, 43 + +; These two are casing-related inputs. +; "casing" is a tickbox that toggles whether you should receive case alerts or +; not (you can set your preferences, and its default value, in the Settings!) +; "casing_button" is an interface to help you announce a case (you have to be +; a CM first to be able to announce cases). +casing = 200, 560, 80, 21 +casing_button = 173, 637, 60, 23 \ No newline at end of file diff --git a/base/themes/default/courtroom_fonts.ini b/base/themes/default/courtroom_fonts.ini new file mode 100644 index 00000000..16e2f41b --- /dev/null +++ b/base/themes/default/courtroom_fonts.ini @@ -0,0 +1,11 @@ +showname = 8 +message = 10 +ic_chatlog = 10 +ms_chatlog = 10 +server_chatlog = 9 +music_list = 8 + +ic_chatlog_color = 255, 255, 255 + +; Color for all labels and checkboxes +label_color = 255, 255, 255 diff --git a/base/themes/default/courtroom_sounds.ini b/base/themes/default/courtroom_sounds.ini new file mode 100644 index 00000000..b24e2ce9 --- /dev/null +++ b/base/themes/default/courtroom_sounds.ini @@ -0,0 +1,8 @@ +realization = sfx-realization.wav +witness_testimony = sfx-testimony2.wav +cross_examination = sfx-testimony.wav +evidence_present = sfx-evidenceshoop.wav +word_call = sfx-gaspen-yeah!.wav +mod_call = sfx-gallery.wav +not_guilty = sfx-notguilty.wav +guilty = sfx-guilty.wav \ No newline at end of file diff --git a/base/themes/default/courtroombackground.png b/base/themes/default/courtroombackground.png new file mode 100644 index 00000000..5ad8d51a Binary files /dev/null and b/base/themes/default/courtroombackground.png differ diff --git a/base/themes/default/crossexamination.gif b/base/themes/default/crossexamination.gif new file mode 100644 index 00000000..a7754b60 Binary files /dev/null and b/base/themes/default/crossexamination.gif differ diff --git a/base/themes/default/crossexamination.png b/base/themes/default/crossexamination.png new file mode 100644 index 00000000..044a76b9 Binary files /dev/null and b/base/themes/default/crossexamination.png differ diff --git a/base/themes/default/custom.png b/base/themes/default/custom.png new file mode 100644 index 00000000..b58d1620 Binary files /dev/null and b/base/themes/default/custom.png differ diff --git a/base/themes/default/custom_selected.png b/base/themes/default/custom_selected.png new file mode 100644 index 00000000..d8dc5253 Binary files /dev/null and b/base/themes/default/custom_selected.png differ diff --git a/base/themes/default/defense_speedlines.gif b/base/themes/default/defense_speedlines.gif new file mode 100644 index 00000000..5b454e52 Binary files /dev/null and b/base/themes/default/defense_speedlines.gif differ diff --git a/base/themes/default/defensebar0.png b/base/themes/default/defensebar0.png new file mode 100644 index 00000000..e15b7276 Binary files /dev/null and b/base/themes/default/defensebar0.png differ diff --git a/base/themes/default/defensebar1.png b/base/themes/default/defensebar1.png new file mode 100644 index 00000000..ddc7c052 Binary files /dev/null and b/base/themes/default/defensebar1.png differ diff --git a/base/themes/default/defensebar10.png b/base/themes/default/defensebar10.png new file mode 100644 index 00000000..5c955b43 Binary files /dev/null and b/base/themes/default/defensebar10.png differ diff --git a/base/themes/default/defensebar2.png b/base/themes/default/defensebar2.png new file mode 100644 index 00000000..78835aab Binary files /dev/null and b/base/themes/default/defensebar2.png differ diff --git a/base/themes/default/defensebar3.png b/base/themes/default/defensebar3.png new file mode 100644 index 00000000..8d8427af Binary files /dev/null and b/base/themes/default/defensebar3.png differ diff --git a/base/themes/default/defensebar4.png b/base/themes/default/defensebar4.png new file mode 100644 index 00000000..04416833 Binary files /dev/null and b/base/themes/default/defensebar4.png differ diff --git a/base/themes/default/defensebar5.png b/base/themes/default/defensebar5.png new file mode 100644 index 00000000..d9236c26 Binary files /dev/null and b/base/themes/default/defensebar5.png differ diff --git a/base/themes/default/defensebar6.png b/base/themes/default/defensebar6.png new file mode 100644 index 00000000..373bc1b0 Binary files /dev/null and b/base/themes/default/defensebar6.png differ diff --git a/base/themes/default/defensebar7.png b/base/themes/default/defensebar7.png new file mode 100644 index 00000000..09c8d1af Binary files /dev/null and b/base/themes/default/defensebar7.png differ diff --git a/base/themes/default/defensebar8.png b/base/themes/default/defensebar8.png new file mode 100644 index 00000000..13a45480 Binary files /dev/null and b/base/themes/default/defensebar8.png differ diff --git a/base/themes/default/defensebar9.png b/base/themes/default/defensebar9.png new file mode 100644 index 00000000..d98ab4d2 Binary files /dev/null and b/base/themes/default/defensebar9.png differ diff --git a/base/themes/default/defminus.png b/base/themes/default/defminus.png new file mode 100644 index 00000000..97093810 Binary files /dev/null and b/base/themes/default/defminus.png differ diff --git a/base/themes/default/defplus.png b/base/themes/default/defplus.png new file mode 100644 index 00000000..a3adf510 Binary files /dev/null and b/base/themes/default/defplus.png differ diff --git a/base/themes/default/deleteevidence.png b/base/themes/default/deleteevidence.png new file mode 100644 index 00000000..396d9902 Binary files /dev/null and b/base/themes/default/deleteevidence.png differ diff --git a/base/themes/default/emote_selected.png b/base/themes/default/emote_selected.png new file mode 100644 index 00000000..377dd077 Binary files /dev/null and b/base/themes/default/emote_selected.png differ diff --git a/base/themes/default/evidence_appear_left.gif b/base/themes/default/evidence_appear_left.gif new file mode 100644 index 00000000..352a7f19 Binary files /dev/null and b/base/themes/default/evidence_appear_left.gif differ diff --git a/base/themes/default/evidence_appear_right.gif b/base/themes/default/evidence_appear_right.gif new file mode 100644 index 00000000..bc45e528 Binary files /dev/null and b/base/themes/default/evidence_appear_right.gif differ diff --git a/base/themes/default/evidence_selected.png b/base/themes/default/evidence_selected.png new file mode 100644 index 00000000..6230c836 Binary files /dev/null and b/base/themes/default/evidence_selected.png differ diff --git a/base/themes/default/evidence_selector.png b/base/themes/default/evidence_selector.png new file mode 100644 index 00000000..266493dd Binary files /dev/null and b/base/themes/default/evidence_selector.png differ diff --git a/base/themes/default/evidencebackground.png b/base/themes/default/evidencebackground.png new file mode 100644 index 00000000..ca285326 Binary files /dev/null and b/base/themes/default/evidencebackground.png differ diff --git a/base/themes/default/evidencebutton.png b/base/themes/default/evidencebutton.png new file mode 100644 index 00000000..2c395ec0 Binary files /dev/null and b/base/themes/default/evidencebutton.png differ diff --git a/base/themes/default/evidenceoverlay.png b/base/themes/default/evidenceoverlay.png new file mode 100644 index 00000000..d409cc58 Binary files /dev/null and b/base/themes/default/evidenceoverlay.png differ diff --git a/base/themes/default/evidencex.png b/base/themes/default/evidencex.png new file mode 100644 index 00000000..6a6be36f Binary files /dev/null and b/base/themes/default/evidencex.png differ diff --git a/base/themes/default/favorites.png b/base/themes/default/favorites.png new file mode 100644 index 00000000..6fa31016 Binary files /dev/null and b/base/themes/default/favorites.png differ diff --git a/base/themes/default/favorites_selected.png b/base/themes/default/favorites_selected.png new file mode 100644 index 00000000..4c33d432 Binary files /dev/null and b/base/themes/default/favorites_selected.png differ diff --git a/base/themes/default/guilty.gif b/base/themes/default/guilty.gif new file mode 100644 index 00000000..3dd95d55 Binary files /dev/null and b/base/themes/default/guilty.gif differ diff --git a/base/themes/default/guilty.png b/base/themes/default/guilty.png new file mode 100644 index 00000000..efe68f70 Binary files /dev/null and b/base/themes/default/guilty.png differ diff --git a/base/themes/default/holdit.gif b/base/themes/default/holdit.gif new file mode 100644 index 00000000..5f71ac66 Binary files /dev/null and b/base/themes/default/holdit.gif differ diff --git a/base/themes/default/holdit.png b/base/themes/default/holdit.png new file mode 100644 index 00000000..09d1d370 Binary files /dev/null and b/base/themes/default/holdit.png differ diff --git a/base/themes/default/holdit_selected.png b/base/themes/default/holdit_selected.png new file mode 100644 index 00000000..51586e74 Binary files /dev/null and b/base/themes/default/holdit_selected.png differ diff --git a/base/themes/default/loadingbackground.png b/base/themes/default/loadingbackground.png new file mode 100644 index 00000000..202a8813 Binary files /dev/null and b/base/themes/default/loadingbackground.png differ diff --git a/base/themes/default/lobby_design.ini b/base/themes/default/lobby_design.ini new file mode 100644 index 00000000..ef64114f --- /dev/null +++ b/base/themes/default/lobby_design.ini @@ -0,0 +1,17 @@ +lobby = 0, 0, 517, 666 +public_servers = 46, 88, 114, 30 +favorites = 164, 88, 114, 30 +refresh = 56, 381, 132, 28 +add_to_fav = 194, 381, 132, 28 +connect = 332, 381, 132, 28 +version = 170, 1, 300, 21 +about = 428, 1, 88, 21 +server_list = 20, 125, 286, 240 +player_count = 336, 91, 173, 16 +description = 337, 109, 173, 245 +chatbox = 2, 445, 515, 198 +chatname = 3, 646, 85, 19 +chatmessage = 93, 646, 424, 19 +loading_label = 135, 92, 254, 95 +progress_bar = 135, 188, 254, 21 +cancel = 220, 220, 80, 20 diff --git a/base/themes/default/lobbybackground.png b/base/themes/default/lobbybackground.png new file mode 100644 index 00000000..094f19c3 Binary files /dev/null and b/base/themes/default/lobbybackground.png differ diff --git a/base/themes/default/mute.png b/base/themes/default/mute.png new file mode 100644 index 00000000..a184cbf8 Binary files /dev/null and b/base/themes/default/mute.png differ diff --git a/base/themes/default/mute_pressed.png b/base/themes/default/mute_pressed.png new file mode 100644 index 00000000..e9793cec Binary files /dev/null and b/base/themes/default/mute_pressed.png differ diff --git a/base/themes/default/muted.png b/base/themes/default/muted.png new file mode 100644 index 00000000..969da04e Binary files /dev/null and b/base/themes/default/muted.png differ diff --git a/base/themes/default/muted_old.png b/base/themes/default/muted_old.png new file mode 100644 index 00000000..f9878f1a Binary files /dev/null and b/base/themes/default/muted_old.png differ diff --git a/base/themes/default/notguilty.gif b/base/themes/default/notguilty.gif new file mode 100644 index 00000000..d057715d Binary files /dev/null and b/base/themes/default/notguilty.gif differ diff --git a/base/themes/default/notguilty.png b/base/themes/default/notguilty.png new file mode 100644 index 00000000..b9cfe318 Binary files /dev/null and b/base/themes/default/notguilty.png differ diff --git a/base/themes/default/objection.gif b/base/themes/default/objection.gif new file mode 100644 index 00000000..6aae2e56 Binary files /dev/null and b/base/themes/default/objection.gif differ diff --git a/base/themes/default/objection.png b/base/themes/default/objection.png new file mode 100644 index 00000000..6fbcbc2f Binary files /dev/null and b/base/themes/default/objection.png differ diff --git a/base/themes/default/objection_selected.png b/base/themes/default/objection_selected.png new file mode 100644 index 00000000..384e4e9b Binary files /dev/null and b/base/themes/default/objection_selected.png differ diff --git a/base/themes/default/pair_button.png b/base/themes/default/pair_button.png new file mode 100644 index 00000000..19f6f22a Binary files /dev/null and b/base/themes/default/pair_button.png differ diff --git a/base/themes/default/pair_button_pressed.png b/base/themes/default/pair_button_pressed.png new file mode 100644 index 00000000..aaf53fb6 Binary files /dev/null and b/base/themes/default/pair_button_pressed.png differ diff --git a/base/themes/default/placeholder.gif b/base/themes/default/placeholder.gif new file mode 100644 index 00000000..e35aaf4b Binary files /dev/null and b/base/themes/default/placeholder.gif differ diff --git a/base/themes/default/present.png b/base/themes/default/present.png new file mode 100644 index 00000000..134d7428 Binary files /dev/null and b/base/themes/default/present.png differ diff --git a/base/themes/default/present_disabled.png b/base/themes/default/present_disabled.png new file mode 100644 index 00000000..9c6a702d Binary files /dev/null and b/base/themes/default/present_disabled.png differ diff --git a/base/themes/default/prominus.png b/base/themes/default/prominus.png new file mode 100644 index 00000000..1191e1ee Binary files /dev/null and b/base/themes/default/prominus.png differ diff --git a/base/themes/default/proplus.png b/base/themes/default/proplus.png new file mode 100644 index 00000000..5e9d563d Binary files /dev/null and b/base/themes/default/proplus.png differ diff --git a/base/themes/default/prosecution_speedlines.gif b/base/themes/default/prosecution_speedlines.gif new file mode 100644 index 00000000..b48802aa Binary files /dev/null and b/base/themes/default/prosecution_speedlines.gif differ diff --git a/base/themes/default/prosecutionbar0.png b/base/themes/default/prosecutionbar0.png new file mode 100644 index 00000000..56b8d61c Binary files /dev/null and b/base/themes/default/prosecutionbar0.png differ diff --git a/base/themes/default/prosecutionbar1.png b/base/themes/default/prosecutionbar1.png new file mode 100644 index 00000000..b44323c9 Binary files /dev/null and b/base/themes/default/prosecutionbar1.png differ diff --git a/base/themes/default/prosecutionbar10.png b/base/themes/default/prosecutionbar10.png new file mode 100644 index 00000000..f0a79c3e Binary files /dev/null and b/base/themes/default/prosecutionbar10.png differ diff --git a/base/themes/default/prosecutionbar2.png b/base/themes/default/prosecutionbar2.png new file mode 100644 index 00000000..8bb51da5 Binary files /dev/null and b/base/themes/default/prosecutionbar2.png differ diff --git a/base/themes/default/prosecutionbar3.png b/base/themes/default/prosecutionbar3.png new file mode 100644 index 00000000..d0b9c4c2 Binary files /dev/null and b/base/themes/default/prosecutionbar3.png differ diff --git a/base/themes/default/prosecutionbar4.png b/base/themes/default/prosecutionbar4.png new file mode 100644 index 00000000..b4ac6bb0 Binary files /dev/null and b/base/themes/default/prosecutionbar4.png differ diff --git a/base/themes/default/prosecutionbar5.png b/base/themes/default/prosecutionbar5.png new file mode 100644 index 00000000..6bb5eb56 Binary files /dev/null and b/base/themes/default/prosecutionbar5.png differ diff --git a/base/themes/default/prosecutionbar6.png b/base/themes/default/prosecutionbar6.png new file mode 100644 index 00000000..9ee9638f Binary files /dev/null and b/base/themes/default/prosecutionbar6.png differ diff --git a/base/themes/default/prosecutionbar7.png b/base/themes/default/prosecutionbar7.png new file mode 100644 index 00000000..34e00da9 Binary files /dev/null and b/base/themes/default/prosecutionbar7.png differ diff --git a/base/themes/default/prosecutionbar8.png b/base/themes/default/prosecutionbar8.png new file mode 100644 index 00000000..5035b51e Binary files /dev/null and b/base/themes/default/prosecutionbar8.png differ diff --git a/base/themes/default/prosecutionbar9.png b/base/themes/default/prosecutionbar9.png new file mode 100644 index 00000000..b185a1a4 Binary files /dev/null and b/base/themes/default/prosecutionbar9.png differ diff --git a/base/themes/default/publicservers.png b/base/themes/default/publicservers.png new file mode 100644 index 00000000..98cf2ad8 Binary files /dev/null and b/base/themes/default/publicservers.png differ diff --git a/base/themes/default/publicservers_selected.png b/base/themes/default/publicservers_selected.png new file mode 100644 index 00000000..bcfa4c47 Binary files /dev/null and b/base/themes/default/publicservers_selected.png differ diff --git a/base/themes/default/realization.png b/base/themes/default/realization.png new file mode 100644 index 00000000..f791d29b Binary files /dev/null and b/base/themes/default/realization.png differ diff --git a/base/themes/default/realization_pressed.png b/base/themes/default/realization_pressed.png new file mode 100644 index 00000000..9a72ed3a Binary files /dev/null and b/base/themes/default/realization_pressed.png differ diff --git a/base/themes/default/realizationflash.png b/base/themes/default/realizationflash.png new file mode 100644 index 00000000..776c70d2 Binary files /dev/null and b/base/themes/default/realizationflash.png differ diff --git a/base/themes/default/refresh.png b/base/themes/default/refresh.png new file mode 100644 index 00000000..0b49cd09 Binary files /dev/null and b/base/themes/default/refresh.png differ diff --git a/base/themes/default/refresh_pressed.png b/base/themes/default/refresh_pressed.png new file mode 100644 index 00000000..80366838 Binary files /dev/null and b/base/themes/default/refresh_pressed.png differ diff --git a/base/themes/default/takethat.gif b/base/themes/default/takethat.gif new file mode 100644 index 00000000..dd033102 Binary files /dev/null and b/base/themes/default/takethat.gif differ diff --git a/base/themes/default/takethat.png b/base/themes/default/takethat.png new file mode 100644 index 00000000..8ff2befe Binary files /dev/null and b/base/themes/default/takethat.png differ diff --git a/base/themes/default/takethat_selected.png b/base/themes/default/takethat_selected.png new file mode 100644 index 00000000..3fe0a8cd Binary files /dev/null and b/base/themes/default/takethat_selected.png differ diff --git a/base/themes/default/testimony.gif b/base/themes/default/testimony.gif new file mode 100644 index 00000000..6d5898d7 Binary files /dev/null and b/base/themes/default/testimony.gif differ diff --git a/base/themes/default/testimony.png b/base/themes/default/testimony.png new file mode 100644 index 00000000..7b81fc8e Binary files /dev/null and b/base/themes/default/testimony.png differ diff --git a/base/themes/default/witnesstestimony.gif b/base/themes/default/witnesstestimony.gif new file mode 100644 index 00000000..03b4900c Binary files /dev/null and b/base/themes/default/witnesstestimony.gif differ diff --git a/base/themes/default/witnesstestimony.png b/base/themes/default/witnesstestimony.png new file mode 100644 index 00000000..47c23010 Binary files /dev/null and b/base/themes/default/witnesstestimony.png differ diff --git a/include/aoapplication.h b/include/aoapplication.h index 5646ddeb..67f9a0d5 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -1,383 +1,323 @@ -#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 - 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(); - - // 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 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 +#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 + +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(); + + 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; + + ///////////////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; + + bool courtroom_loaded = false; + + //////////////////versioning/////////////// + + const int get_release() const { return RELEASE; } + const int get_major_version() const { return MAJOR_VERSION; } + const 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 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 the maximum amount of lines the IC chatlog + // may contain, from config.ini. + int get_max_log_size(); + + // 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(); + + // 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); + + // Can we use APNG for this? If not, fall back to a gif. + QString get_image_suffix(QString path_to_check); + + //Returns the value of p_search_line within target_tag and terminator_tag + QString read_char_ini(QString p_char, QString p_search_line, QString target_tag); + + //Returns the 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); + + //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(); + + // Get the message for the CM for casing alerts. + QString get_casing_can_host_cases(); + +private: + const int RELEASE = 2; + const int MAJOR_VERSION = 6; + const int MINOR_VERSION = 2; + + 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 4520120e..102a0408 100644 --- a/include/aoblipplayer.h +++ b/include/aoblipplayer.h @@ -9,32 +9,32 @@ #include "aoapplication.h" -#include #include #include +#include -class AOBlipPlayer { + +class AOBlipPlayer +{ public: AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app); void set_blips(QString p_sfx); void blip_tick(); - void set_volume(qreal p_volume); + void set_volume(int p_volume); int m_cycle = 0; private: QWidget *m_parent; AOApplication *ao_app; - qreal m_volume; - - void set_volume_internal(qreal p_volume); -#if defined(BASSAUDIO) + int m_volume; + #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 f5758856..4b7209ae 100644 --- a/include/aobutton.h +++ b/include/aobutton.h @@ -3,10 +3,11 @@ #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 89080def..a238c3f2 100644 --- a/include/aocaseannouncerdialog.h +++ b/include/aocaseannouncerdialog.h @@ -4,21 +4,20 @@ #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; @@ -37,7 +36,6 @@ private: QCheckBox *ui_judge_needed; QCheckBox *ui_juror_needed; QCheckBox *ui_steno_needed; - QCheckBox *ui_witness_needed; public slots: void ok_pressed(); diff --git a/include/aocharbutton.h b/include/aocharbutton.h index dd27e62c..f372cdf8 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 f62820b9..7ef7da3f 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -1,17 +1,16 @@ #ifndef AOCHARMOVIE_H #define AOCHARMOVIE_H -#include "include/aosfxplayer.h" -#include "include/courtroom.h" -#include -#include -#include #include -#include +#include #include +#include +#include class AOApplication; -class AOCharMovie : public QLabel { + +class AOCharMovie : public QLabel +{ Q_OBJECT public: @@ -22,24 +21,12 @@ 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 LoadImageWithStupidMethodForFlipSupport(QImage image); - void stop(); - - void play_frame_sfx(); - - void sfx_two_network_boogaloo(); - void screenshake_two_network_boogaloo(); - void realization_two_network_boogaloo(); + void set_flipped(bool p_flipped) {m_flipped = p_flipped;} - AOSfxPlayer *frame_specific_sfx_player; - Courtroom *mycourtroom; - QString frame_sfx_hellstring = ""; - QString frame_screenshake_hellstring = ""; - QString frame_realization_hellstring = ""; - bool use_networked_framehell = false; + void stop(); void move(int ax, int ay); + void combo_resize(int w, int h); private: @@ -48,17 +35,10 @@ private: QMovie *m_movie; QVector movie_frames; QTimer *preanim_timer; - QTimer *ticker; - 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; @@ -70,7 +50,8 @@ signals: void done(); private slots: + void frame_change(int n_frame); void timer_done(); - void movie_ticker(); }; + #endif // AOCHARMOVIE_H diff --git a/include/aoemotebutton.h b/include/aoemotebutton.h index acf0b484..c99a73b0 100644 --- a/include/aoemotebutton.h +++ b/include/aoemotebutton.h @@ -3,21 +3,22 @@ #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 b56bfb1d..80b747cd 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 1d6280da..13ca00d5 100644 --- a/include/aoevidencedisplay.h +++ b/include/aoevidencedisplay.h @@ -4,18 +4,19 @@ #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 c4fdf2ee..4713be0a 100644 --- a/include/aoimage.h +++ b/include/aoimage.h @@ -1,14 +1,15 @@ -// 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 70f1f978..ce17680d 100644 --- a/include/aolineedit.h +++ b/include/aolineedit.h @@ -4,7 +4,8 @@ #include #include -class AOLineEdit : public QLineEdit { +class AOLineEdit : public QLineEdit +{ Q_OBJECT public: @@ -18,6 +19,8 @@ signals: private slots: void on_enter_pressed(); + + }; #endif // AOLINEEDIT_H diff --git a/include/aomovie.h b/include/aomovie.h index caa1baa4..1f278bf8 100644 --- a/include/aomovie.h +++ b/include/aomovie.h @@ -7,23 +7,21 @@ class Courtroom; class AOApplication; -class AOMovie : public QLabel { +class AOMovie : public QLabel +{ Q_OBJECT public: AOMovie(QWidget *p_parent, AOApplication *p_ao_app); void set_play_once(bool p_play_once); - void start_timer(int delay); - void play(QString p_gif, QString p_char = "", QString p_custom_theme = "", - int default_duration = 0); + void play(QString p_gif, QString p_char = "", QString p_custom_theme = ""); void combo_resize(int w, int h); void stop(); private: QMovie *m_movie; AOApplication *ao_app; - QTimer *timer; bool play_once = true; signals: @@ -31,7 +29,6 @@ signals: private slots: void frame_change(int n_frame); - void timer_done(); }; #endif // AOMOVIE_H diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 5181630c..b34267c9 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -6,40 +6,32 @@ #elif defined(QTAUDIO) #include #endif - #include "aoapplication.h" -#include -#include -#include #include #include +#include #if defined(BASSAUDIO) -class AOMusicPlayer : public QObject { - Q_OBJECT +class AOMusicPlayer +{ public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - virtual ~AOMusicPlayer(); + ~AOMusicPlayer(); void play(QString p_song); void set_volume(int p_value); - void kill_loop(); - QString get_path(); - bool enable_looping = true; - private: QWidget *m_parent; AOApplication *ao_app; int m_volume = 0; - QString f_path; - HSTREAM m_stream; }; #elif defined(QTAUDIO) -class AOMusicPlayer : public QObject { +class AOMusicPlayer +{ public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); ~AOMusicPlayer(); @@ -47,21 +39,16 @@ public: void play(QString p_song); void set_volume(int p_value); - void kill_loop(); - QString get_path(); - bool enable_looping = true; - private: + QMediaPlayer m_player; QWidget *m_parent; AOApplication *ao_app; - QMediaPlayer m_player; - int m_volume = 0; - QString f_path; }; #else -class AOMusicPlayer : public QObject { +class AOMusicPlayer +{ public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); ~AOMusicPlayer(); @@ -69,16 +56,9 @@ public: void play(QString p_song); void set_volume(int p_value); - void kill_loop(); - QString get_path(); - bool enable_looping = true; - private: QWidget *m_parent; AOApplication *ao_app; - - int m_volume = 0; - QString f_path; }; #endif diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 9a1429a4..a65e3f59 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -1,153 +1,115 @@ -#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; - 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; - 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; - 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 +#ifndef AOOPTIONSDIALOG_H +#define AOOPTIONSDIALOG_H + +#include "aoapplication.h" +#include "bass.h" + +#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; + QFrame *ui_log_names_divider; + QLineEdit *ui_username_textbox; + QLabel *ui_username_lbl; + QLabel *ui_showname_lbl; + QCheckBox *ui_showname_cb; + QFrame *ui_net_divider; + QLabel *ui_ms_lbl; + QLineEdit *ui_ms_textbox; + QLabel *ui_discord_lbl; + QCheckBox *ui_discord_cb; + + QWidget *ui_callwords_tab; + QWidget *ui_callwords_widget; + QVBoxLayout *ui_callwords_layout; + QPlainTextEdit *ui_callwords_textbox; + QLabel *ui_callwords_explain_lbl; + QCheckBox *ui_callwords_char_textbox; + + QWidget *ui_audio_tab; + QWidget *ui_audio_widget; + QFormLayout *ui_audio_layout; + QLabel *ui_audio_device_lbl; + QComboBox *ui_audio_device_combobox; + QFrame *ui_audio_volume_divider; + QSpinBox *ui_music_volume_spinbox; + QLabel *ui_music_volume_lbl; + QSpinBox *ui_sfx_volume_spinbox; + QSpinBox *ui_blips_volume_spinbox; + QLabel *ui_sfx_volume_lbl; + QLabel *ui_blips_volume_lbl; + QFrame *ui_volume_blip_divider; + QSpinBox *ui_bliprate_spinbox; + QLabel *ui_bliprate_lbl; + QCheckBox *ui_blank_blips_cb; + QLabel *ui_blank_blips_lbl; + QDialogButtonBox *ui_settings_buttons; + + QWidget *ui_casing_tab; + QWidget *ui_casing_widget; + QFormLayout *ui_casing_layout; + QLabel *ui_casing_supported_lbl; + QLabel *ui_casing_enabled_lbl; + QCheckBox *ui_casing_enabled_cb; + QLabel *ui_casing_def_lbl; + QCheckBox *ui_casing_def_cb; + QLabel *ui_casing_pro_lbl; + QCheckBox *ui_casing_pro_cb; + QLabel *ui_casing_jud_lbl; + QCheckBox *ui_casing_jud_cb; + QLabel *ui_casing_jur_lbl; + QCheckBox *ui_casing_jur_cb; + QLabel *ui_casing_steno_lbl; + QCheckBox *ui_casing_steno_cb; + QLabel *ui_casing_cm_lbl; + QCheckBox *ui_casing_cm_cb; + QLabel *ui_casing_cm_cases_lbl; + QLineEdit *ui_casing_cm_cases_textbox; + + bool needs_default_audiodev(); + +signals: + +public slots: + void save_pressed(); + void discard_pressed(); +}; + +#endif // AOOPTIONSDIALOG_H diff --git a/include/aopacket.h b/include/aopacket.h index 4097be86..21f6e0f4 100644 --- a/include/aopacket.h +++ b/include/aopacket.h @@ -1,18 +1,19 @@ #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 7c1ef6fd..b58c0fd0 100644 --- a/include/aoscene.h +++ b/include/aoscene.h @@ -1,14 +1,15 @@ #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); @@ -20,7 +21,7 @@ private: QWidget *m_parent; QMovie *m_movie; AOApplication *ao_app; - QString last_image; + }; #endif // AOSCENE_H diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h index af3aef6d..4b976852 100644 --- a/include/aosfxplayer.h +++ b/include/aosfxplayer.h @@ -9,34 +9,28 @@ #include "aoapplication.h" -#include -#include #include #include +#include -class AOSfxPlayer : public QObject { - Q_OBJECT +class AOSfxPlayer +{ public: AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app); void play(QString p_sfx, QString p_char = "", QString shout = ""); void stop(); - void set_volume(qreal p_volume); - void setLooping(bool is_looping); + void set_volume(int p_volume); private: QWidget *m_parent; AOApplication *ao_app; - qreal m_volume = 0; - bool looping_sfx = false; - - void set_volume_internal(qreal p_volume); - -#if defined(BASSAUDIO) + #if defined(BASSAUDIO) HSTREAM m_stream; -#elif defined(QTAUDIO) + #elif defined(QTAUDIO) QSoundEffect m_sfx; -#endif + #endif + int m_volume = 0; }; #endif // AOSFXPLAYER_H diff --git a/include/aotextarea.h b/include/aotextarea.h index b8160890..d44596b2 100644 --- a/include/aotextarea.h +++ b/include/aotextarea.h @@ -1,25 +1,24 @@ #ifndef AOTEXTAREA_H #define AOTEXTAREA_H -#include -#include -#include #include +#include #include +#include +#include -class AOTextArea : public QTextBrowser { +class AOTextArea : public QTextBrowser +{ public: AOTextArea(QWidget *p_parent = nullptr); - void append_chatmessage(QString p_name, QString p_message, QString p_colour, - bool song); + void append_chatmessage(QString p_name, QString p_message, QString p_colour); void append_error(QString p_message); 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 8d876f17..85909c6e 100644 --- a/include/aotextedit.h +++ b/include/aotextedit.h @@ -3,7 +3,8 @@ #include -class AOTextEdit : public QPlainTextEdit { +class AOTextEdit : public QPlainTextEdit +{ Q_OBJECT public: AOTextEdit(QWidget *parent); @@ -16,6 +17,7 @@ signals: private slots: void on_enter_pressed(); + }; #endif // AOTEXTEDIT_H diff --git a/include/bass.h b/include/bass.h index a3687b9f..1c50903c 100644 --- a/include/bass.h +++ b/include/bass.h @@ -1,1217 +1,1139 @@ -/* - 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 - +#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_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 { - 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; + 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 - -typedef struct { - float fTarget; - float fCurrent; - float fTime; - DWORD lCurve; -} BASS_FX_VOLUME_PARAM; - -typedef void(CALLBACK IOSNOTIFYPROC)(DWORD status); +// 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 + +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); - -#ifdef __cplusplus -} +#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); + +#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 0232666d..34c5926b 100644 --- a/include/chatlogpiece.h +++ b/include/chatlogpiece.h @@ -1,23 +1,22 @@ #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, - bool p_song, int color); - chatlogpiece(QString p_name, QString p_showname, QString p_message, - bool p_song, int color, QDateTime p_datetime); + chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song); + chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime); + QString get_name(); QString get_showname(); QString get_message(); bool get_is_song(); QDateTime get_datetime(); QString get_datetime_as_string(); - int get_chat_color(); QString get_full(); @@ -27,7 +26,6 @@ private: QString message; QDateTime datetime; bool is_song; - int color; }; #endif // CHATLOGPIECE_H diff --git a/include/courtroom.h b/include/courtroom.h index 396c4d70..99a090b0 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -1,739 +1,668 @@ -#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 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_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. - 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 = 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 - - 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 +#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 "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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class AOApplication; + +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 fix_last_area() + { + if (area_list.size() > 0) + { + QString malplaced = area_list.last(); + area_list.removeLast(); + append_music(malplaced); + } + } + + 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); + + //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); + + //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); + + //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); + + //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); + + //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); + + void check_connection_received(); + + ~Courtroom(); + +private: + AOApplication *ao_app; + + 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; + + // 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] = {30, 40, 50, 60, 75, 100, 120}; + + // 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 char_list; + QVector evidence_list; + QVector music_list; + QVector area_list; + + 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; + + // 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; + + //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; + + static const int chatmessage_size = 23; + 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; + + //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; + + //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 current_char = ""; + + int objection_state = 0; + int realization_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 current_emote = 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 the ooc chat is server or master chat, true is server + bool server_ooc = true; + + QString current_background = "default"; + + AOMusicPlayer *music_player; + AOSfxPlayer *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; + AOImage *ui_vp_testimony; + AOImage *ui_vp_realization; + AOMovie *ui_vp_wtce; + AOMovie *ui_vp_objection; + + QTextEdit *ui_ic_chatlog; + + AOTextArea *ui_ms_chatlog; + AOTextArea *ui_server_chatlog; + + QListWidget *ui_mute_list; + QListWidget *ui_area_list; + QListWidget *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; + + 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_mute; + + 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; + + //abstract widget to hold char buttons + QWidget *ui_char_buttons; + + QVector ui_char_button_list; + QVector ui_char_button_list_filtered; + 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; + + QLineEdit *ui_char_search; + QCheckBox *ui_char_passworded; + QCheckBox *ui_char_taken; + + void construct_char_select(); + void set_char_select(); + void set_char_select_page(); + void char_clicked(int n_char); + 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 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); + +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_edited(QString p_text); + void on_music_list_double_clicked(QModelIndex p_model); + 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 on_realization_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 on_switch_area_music_clicked(); + + void on_casing_clicked(); + + void ping_server(); + + void load_bass_opus_plugin(); +}; + +#endif // COURTROOM_H diff --git a/include/datatypes.h b/include/datatypes.h index 89d4a40c..aaa5de52 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -3,14 +3,16 @@ #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; @@ -20,20 +22,23 @@ 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; @@ -50,25 +55,29 @@ 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, @@ -91,14 +100,20 @@ enum CHAT_MESSAGE { SELF_OFFSET, OTHER_OFFSET, OTHER_FLIP, - NONINTERRUPTING_PRE, - LOOPING_SFX, - SCREENSHAKE, - FRAME_SCREENSHAKE, - FRAME_REALIZATION, - FRAME_SFX + NONINTERRUPTING_PRE }; -enum COLOR { WHITE = 0, GREEN, RED, ORANGE, BLUE, YELLOW, RAINBOW, PINK, CYAN }; +enum COLOR +{ + WHITE = 0, + GREEN, + RED, + ORANGE, + BLUE, + YELLOW, + RAINBOW, + PINK, + CYAN +}; #endif // DATATYPES_H diff --git a/include/debug_functions.h b/include/debug_functions.h index 383431ab..160274cc 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 455f62aa..feb874b2 100644 --- a/include/discord-rpc.h +++ b/include/discord-rpc.h @@ -24,63 +24,61 @@ 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 655a3dfb..4c16b68a 100644 --- a/include/discord_register.h +++ b/include/discord_register.h @@ -1,27 +1,25 @@ #pragma once #if defined(DISCORD_DYNAMIC_LIB) -#if defined(_WIN32) -#if defined(DISCORD_BUILDING_SDK) -#define DISCORD_EXPORT __declspec(dllexport) +# 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 #else -#define DISCORD_EXPORT __declspec(dllimport) -#endif -#else -#define DISCORD_EXPORT __attribute__((visibility("default"))) -#endif -#else -#define DISCORD_EXPORT +# 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 71c85e25..e7ecc6ef 100644 --- a/include/discord_rich_presence.h +++ b/include/discord_rich_presence.h @@ -1,12 +1,10 @@ #ifndef DISCORD_RICH_PRESENCE_H #define DISCORD_RICH_PRESENCE_H -#include -#include #include #include +#include #include - #include #include @@ -16,14 +14,12 @@ namespace AttorneyOnline { -class Discord { - Q_DECLARE_TR_FUNCTIONS(Discord) - +class Discord +{ private: - const char *APPLICATION_ID = "399779271737868288"; + const char* APPLICATION_ID = "399779271737868288"; std::string server_name, server_id; int64_t timestamp; - public: Discord(); ~Discord(); @@ -34,5 +30,5 @@ public: void state_spectate(); }; -} // namespace AttorneyOnline +} #endif // DISCORD_RICH_PRESENCE_H diff --git a/include/discord_rpc.h b/include/discord_rpc.h index 6bd44041..3e1441e0 100644 --- a/include/discord_rpc.h +++ b/include/discord_rpc.h @@ -24,65 +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 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 b70e8e65..dc67d122 100644 --- a/include/encryption_functions.h +++ b/include/encryption_functions.h @@ -3,11 +3,11 @@ #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 8bb2e5f6..6937ed8a 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 d178ba1b..285f096a 100644 --- a/include/hex_functions.h +++ b/include/hex_functions.h @@ -1,16 +1,17 @@ #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 a9b60571..19276a7d 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -1,16 +1,16 @@ #ifndef LOBBY_H #define LOBBY_H -#include "aobutton.h" #include "aoimage.h" +#include "aobutton.h" #include "aopacket.h" #include "aotextarea.h" -#include -#include -#include #include +#include +#include #include +#include #include #include @@ -19,7 +19,8 @@ class AOApplication; -class Lobby : public QMainWindow { +class Lobby : public QMainWindow +{ Q_OBJECT public: @@ -32,12 +33,12 @@ 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(); - void check_update(); + void set_loading_value(int p_value); bool public_servers_selected = true; @@ -74,11 +75,8 @@ private: QProgressBar *ui_progress_bar; AOButton *ui_cancel; - QModelIndex last_model; - void set_size_and_pos(QWidget *p_widget, QString p_identifier); -public slots: - void lobbyThreadHandler(QString loadingText); + private slots: void on_public_servers_clicked(); void on_favorites_clicked(); @@ -91,7 +89,6 @@ private slots: void on_connect_released(); void on_about_clicked(); void on_server_list_clicked(QModelIndex p_model); - void on_server_list_doubleclicked(QModelIndex p_model); void on_chatfield_return_pressed(); }; diff --git a/include/misc_functions.h b/include/misc_functions.h index 5287bee8..026c6353 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 ed57a956..08b10db8 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,16 +14,17 @@ #undef MS_FAILOVER_SUPPORTED #endif -#include "aoapplication.h" #include "aopacket.h" +#include "aoapplication.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 1da4d925..119f38e2 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/resource/translations/ao_de.qm b/resource/translations/ao_de.qm deleted file mode 100644 index 6fd250de..00000000 Binary files a/resource/translations/ao_de.qm and /dev/null differ diff --git a/resource/translations/ao_de.ts b/resource/translations/ao_de.ts deleted file mode 100644 index c4e9f300..00000000 --- a/resource/translations/ao_de.ts +++ /dev/null @@ -1,1118 +0,0 @@ - - - - - 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. - - - Error connecting to master server. Will try again in %n seconds. - 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. - Es gab einen Fehler beim Verbinden zum Master Server. -Wir verwenden mehrere Master Server um Ausfälle zu verhindern, jedoch hat der Client alle Möglichkeiten einen zu finden erschöpft. -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. -Grund: %1 - - - You have been kicked from the server. -Reason: - Du wurdest von diesem Server geschmissen. -Grund: - - - You are banned on this server. -Reason: - Du wurdest von diesem Server verbannt. -Grund: - - - You have been kicked. - Du wurdest rausgeschmissen. - - - You are banned on this server. - Du wurdest verbannt. - - - - 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 - - - - 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. - 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. - - - - 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. - - - - 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: - 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. - - - - 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. - - - - 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. - - - - 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. - - - - Courtroom - - - Password - Passwort - - - - Spectator - Zuschauer - - - - - Search - Suche - - - - Passworded - Gesperrt - - - - Taken - Benutzt - - - Generating chars: -%1/%2 - Generiere Charaktere: -%1/%2 - - - Generating chars: - - Generiere Charaktere: - - - - - Could not find %1 - Konnte %1 nicht finden - - - - Showname - Anzeigename - - - - Message - Nachricht - - - - OOC Message - OOC Nachricht - - - - Name - Name - - - - Pre - Vor - - - - Flip - Spiegeln - - - Guard - 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. - Du hast nun den "Modcall deaktivieren" Knopf. - - - - 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. - Zu viele Argumente zum Speichern! Bitte gib nur den Dateinamen ohne Erweiterung und den Saalstatus an. - - - %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. - - - 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! - - - 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: - 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: - - - - Too many arguments to load a case! You only need one filename, without extension. - Zu viele Argumente! Du brauchst nur den Dateinamen, ohne Erweiterung. - - - Case made by - Fall von - - - Navigate to - Gehe zu - - - for the CM doc. - für das CM Dokument. - - - Your case " - Dein Fall " - - - " was loaded! - " 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! - - - - 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. - - - Choose.. - Wähle.. - - - - Choose... - Wähle... - - - - Images (*.png) - Bilder (*.png) - - - - Add new evidence... - Neues Beweisstück... - - - - Discord - - Objection! - Einspruch! - - - In Lobby - In Lobby - - - Idle - Untätig - - - In a Server - In einem Server - - - Playing as %1 - Spielt als %1 - - - Spectating - Zuschauend - - - - Lobby - - - Attorney Online 2 - Attorney Online 2 - - - - Name - 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, 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 - <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 - - - Attorney Online 2 is built using Qt 5.11. - -Lead development: -longbyte1 -OmniTroid - -stonedDiscord -Supporting development: -Fiercy - -UI design: -Ruekasu -Draxirch - -Special thanks: -Unishred -Argoneus -Noevain -Cronnicossy - Attorney Online 2 wurde gemacht mit Qt 5.11. - -Leitende Entwicklung: -longbyte1 -OmniTroid -stonedDiscord - -Unterstützende Entwicklung: -Fiercy - -UI Design: -Ruekasu -Draxirch - -Speziellen Dank: -Unishred -Argoneus -Noevain -Cronnicossy - - - - - Offline - Offline - - - - debug_functions - - - Error: %1 - Fehler: %1 - - - - Error - Fehler - - - - Notice - Hinweis - - - diff --git a/resource/translations/ao_en.qm b/resource/translations/ao_en.qm deleted file mode 100644 index 9dad8dff..00000000 Binary files a/resource/translations/ao_en.qm and /dev/null differ diff --git a/resource/translations/ao_en.ts b/resource/translations/ao_en.ts deleted file mode 100644 index 9719319f..00000000 --- a/resource/translations/ao_en.ts +++ /dev/null @@ -1,937 +0,0 @@ - - - - - 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 - - - - - AOCaseAnnouncerDialog - - - Case Announcer - - - - - Case title: - - - - - Defense needed - - - - - Prosecution needed - - - - - Judge needed - - - - - Jurors needed - - - - - Stenographer needed - - - - - Witness needed - - - - - 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: - - - - - 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: - - - - - 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. - - - - - Courtroom - - - Password - - - - - Spectator - - - - - - Search - - - - - Passworded - - - - - Taken - - - - - Could not find %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 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! - - - - - 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. - - - - - Choose... - - - - - Images (*.png) - - - - - Add new evidence... - - - - - Lobby - - - Attorney Online 2 - - - - - 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? - - - - - 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, 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 - - - - - debug_functions - - - Error: %1 - - - - - Error - - - - - Notice - - - - diff --git a/resource/translations/ao_es.qm b/resource/translations/ao_es.qm deleted file mode 100644 index 42ca3a00..00000000 Binary files a/resource/translations/ao_es.qm and /dev/null differ diff --git a/resource/translations/ao_es.ts b/resource/translations/ao_es.ts deleted file mode 100644 index 2cad7ce1..00000000 --- a/resource/translations/ao_es.ts +++ /dev/null @@ -1,1048 +0,0 @@ - - - - - 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. - I translated master servers as "lista de servidores" because literally nobody will understand if i make the literal translation "servidor maestro". And in the end a master server is just a list of servers. Also removed the part about having multiple master servers, i just don't think the average user will understand this even if i do a good translation. - 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 -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 - - - - - 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. -Razón: %1 - - - You have been kicked from the server. -Reason: - Has sido expulsado del servidor. -Razón: - - - You are banned on this server. -Reason: - Has sido bloqueado en este servidor. -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 - - - - 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. - - - - 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: - - - Sets the music's default volume. - 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'. - - - - 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. - - - 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: - 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: - - - 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 - A translation wouldn't fit because of the shitty theme system. - - - - - Taken - En uso - - - - Could not find %1 - No se pudo encontrar %1 - - - Generating chars: -%1/%2 - Generando personajes: -%1/%2 - - - Generating chars: - - Generando personajes: - - - - - 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. - - - - Guard - 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. - - - You were granted the Guard button. - 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! - - - 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: - ¡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: - - - - 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. - - - Case made by - Caso hecho por - - - Navigate to - Navegue a - - - for the CM doc. - para el documento de CM. - - - Your case " - Su caso " - - - " was loaded! - " 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. - - - - 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. - - - - Choose... - Elegir... - - - - Images (*.png) - Imágenes (* .png) - - - - Add new evidence... - Añadir nueva evidencia... - - - - Lobby - - - Attorney Online 2 - - - - - Name - 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, 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 - - - - debug_functions - - - Error: %1 - - - - - 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. - - - - diff --git a/resource/translations/ao_jp.qm b/resource/translations/ao_jp.qm deleted file mode 100644 index e4fb562a..00000000 Binary files a/resource/translations/ao_jp.qm and /dev/null differ diff --git a/resource/translations/ao_jp.ts b/resource/translations/ao_jp.ts deleted file mode 100644 index 029e84ad..00000000 --- a/resource/translations/ao_jp.ts +++ /dev/null @@ -1,964 +0,0 @@ - - - - - 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 - - - - - AOCaseAnnouncerDialog - - - Case Announcer - - - - - Case title: - - - - - Defense needed - - - - - Prosecution needed - - - - - Judge needed - - - - - Jurors needed - - - - - Stenographer needed - - - - - Witness needed - - - - - 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: - - - - - 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: - 音楽: - - - - 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. - - - - - Courtroom - - - Password - - - - - Spectator - 観客 - - - - - Search - - - - - Passworded - - - - - Taken - - - - - Could not find %1 - - - - - Showname - - - - - Message - - - - - Name - 名前 - - - - Pre - - - - - Flip - フリップ - - - Guard - ガード - - - - - 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. - - - - - 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! - - - - - 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. - - - - - Choose... - 選択... - - - - Images (*.png) - イメージ (*.png) - - - - Add new evidence... - 新しい証拠を付け加える... - - - - Discord - - Objection! - 意義あり! - - - In Lobby - ロビーでいる - - - Idle - 落ちている - - - In a Server - サーバーでいます - - - Spectating - 観客している - - - - Lobby - - - Attorney Online 2 - - - - - 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? - - - - - 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, 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 - オフライン - - - - debug_functions - - - Error: %1 - エラー: %1 - - - - Error - エラー - - - - Notice - 通知 - - - diff --git a/resource/translations/ao_pl.qm b/resource/translations/ao_pl.qm deleted file mode 100644 index 995a5bc9..00000000 Binary files a/resource/translations/ao_pl.qm and /dev/null differ diff --git a/resource/translations/ao_pl.ts b/resource/translations/ao_pl.ts deleted file mode 100644 index 2662fcf3..00000000 --- a/resource/translations/ao_pl.ts +++ /dev/null @@ -1,987 +0,0 @@ - - - - - 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. - Odkryto błąd podczas łączenia się z głównym serwerem. -Używamy wielu głównych serwerów, aby zminimalizować każdą możliwą przerwę, ale klient wyczerpał jakąkolwiek możliwość znalezienia i połączenia się z jednym. -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. -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 - - - - 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. - - - - 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. - - - - 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'. - - - - 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. - - - - Courtroom - - - Password - Hasło - - - - Spectator - Widz - - - - - Search - Wyszukaj - - - - Passworded - Zahasłowany - - - - Taken - Zajęty - - - - Could not find %1 - Nie znaleziono %1 - - - Generating chars: -%1/%2 - Generowanie postaci: -%1.%2 - - - - Showname - Ksywka - - - - Message - Wiadomość - - - - Name - Nazwa - - - - Pre - przed- - - - - Flip - Odwróć - - - Guard - 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. - - - - 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! - - - - 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. - - - - Choose... - Wybierz... - - - - Images (*.png) - Plik obrazu (*.png) - - - - Add new evidence... - Dodaj nowe dowody... - - - - Lobby - - - Attorney Online 2 - - - - - Name - 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, 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 - - - - - debug_functions - - - Error: %1 - Błąd: %1 - - - - Error - Błąd - - - - Notice - Ogłoszenie - - - diff --git a/resource/translations/ao_pt.qm b/resource/translations/ao_pt.qm deleted file mode 100644 index 242917ff..00000000 Binary files a/resource/translations/ao_pt.qm and /dev/null differ diff --git a/resource/translations/ao_pt.ts b/resource/translations/ao_pt.ts deleted file mode 100644 index 824c81ee..00000000 --- a/resource/translations/ao_pt.ts +++ /dev/null @@ -1,977 +0,0 @@ - - - - - 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. -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 - - - - 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. - - - - 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: - - - Sets the music's default volume. - 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'. - - - - 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. - - - - Courtroom - - - Password - Senha - - - - Spectator - Espectador - - - - - Search - Pesquisar - - - - Passworded - A translation wouldn't fit because of the shitty theme system. - - - - - Taken - Em uso - - - - Could not find %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. - 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. - - - - Choose... - Escolha... - - - - Images (*.png) - Imagens (* .png) - - - - Add new evidence... - Adicionar nova evidência... - - - - Lobby - - - Attorney Online 2 - - - - - Name - 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, 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 - - - - debug_functions - - - Error: %1 - - - - - Error - - - - - Notice - - - - diff --git a/resource/translations/ao_ru.qm b/resource/translations/ao_ru.qm deleted file mode 100644 index 19bf0a95..00000000 Binary files a/resource/translations/ao_ru.qm and /dev/null differ diff --git a/resource/translations/ao_ru.ts b/resource/translations/ao_ru.ts deleted file mode 100644 index 93a32956..00000000 --- a/resource/translations/ao_ru.ts +++ /dev/null @@ -1,999 +0,0 @@ - - - - - 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. - Произошла ошибка соединения с главным сервером. -Пожалуйста, проверьте ваши Интернет-соединение, настройки браундмауэра, и попробуйте перезайти. - - - - 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 - Вас отправили в баню. -Причина: %1 - - - You have been kicked from the server. -Reason: - Вас выпнули с сервера. -Причина: - - - You are banned on this server. -Reason: - Вас отправили в баню. -Причина: - - - - AOCaseAnnouncerDialog - - - Case Announcer - Материалы дела - - - - Case title: - Название: - - - - Defense needed - Сторона защиты - - - - Prosecution needed - Сторона обвинения - - - - Judge needed - Без судьи никак - - - - Jurors needed - Суд присяжных - - - - Stenographer needed - Нужен стенографист? - - - - Witness needed - - - - - 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. - Будучи производителем дела (ПД), вы можете войти в зону и заниматься её оркестровкой. - - - - Courtroom - - - Password - Пароль - - - - Spectator - Наблюдатель - - - - - Search - Поиск - - - - Passworded - Ограничен паролем - - - - Taken - Занят - - - - Could not find %1 - - - - Generating chars: -%1/%2 - Генерация персонажей: -%1/%2 - - - Generating chars: - - Генерация персонажей: - - - - - Showname - Имя - - - - Message - Сообщение - - - - Name - Никнейм - - - - Pre - Пред. - - - - Flip - Разв. - - - Guard - Охрана - - - - - 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. - - - - - 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. - Слишком длинный текст. - - - - Choose... - Выбрать... - - - - Images (*.png) - Изображения (*.png) - - - - Add new evidence... - Добавить новую улику... - - - - Lobby - - - Attorney Online 2 - Attorney Online 2 - - - - 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? - Не похоже, что ваш клиент установлен правильно. -Скачали ли вы все ресурсы (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, 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 - Вне сети - - - - debug_functions - - - Error: %1 - Ошибка: %1 - - - - Error - Ошибка - - - - Notice - На заметку - - - diff --git a/resources.qrc b/resources.qrc index 1229bc80..bc9f322e 100644 --- a/resources.qrc +++ b/resources.qrc @@ -2,12 +2,5 @@ resource/fonts/Ace-Attorney.ttf resource/logo.png - resource/translations/ao_de.qm - resource/translations/ao_en.qm - resource/translations/ao_jp.qm - resource/translations/ao_es.qm - resource/translations/ao_pt.qm - resource/translations/ao_ru.qm - resource/translations/ao_pl.qm diff --git a/scripts/configure_ubuntu.sh b/scripts/configure_ubuntu.sh index 280dfdf9..1f9b8e83 100755 --- a/scripts/configure_ubuntu.sh +++ b/scripts/configure_ubuntu.sh @@ -7,13 +7,11 @@ set -eu ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" -cd "${ROOT_DIR}" - +cd ${ROOT_DIR} #need some openGL stuff sudo apt install libgl1-mesa-dev -#install curl incase of fresh vm -sudo apt install curl + mkdir tmp cd tmp diff --git a/scripts/macos_build.sh b/scripts/macos_build.sh index efb7653f..22e2d457 100755 --- a/scripts/macos_build.sh +++ b/scripts/macos_build.sh @@ -30,4 +30,4 @@ tar -xvf apng.tar.xz cp clang_64/plugins/imageformats/libqapng.dylib ../lib cd .. -/usr/local/opt/qt/bin/qmake && make -j2 +qmake && make -j2 diff --git a/scripts/macos_post_build.sh b/scripts/macos_post_build.sh old mode 100755 new mode 100644 index df1475c4..50acb408 --- a/scripts/macos_post_build.sh +++ b/scripts/macos_post_build.sh @@ -13,12 +13,10 @@ ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" cd ${ROOT_DIR} # This thing basically does all the work -/usr/local/opt/qt/bin/macdeployqt ../bin/Attorney_Online.app +macdeployqt ../bin/Attorney_Online.app # Need to add the dependencies cp ../lib/* ../bin/Attorney_Online.app/Contents/Frameworks # libbass has a funny path for some reason, just use rpath install_name_tool -change @loader_path/libbass.dylib @rpath/libbass.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online - -zip -r -9 ../bin/Attorney_Online_mac_x86_64.zip ../bin/ \ No newline at end of file diff --git a/scripts/release_macos.sh b/scripts/release_macos.sh new file mode 100755 index 00000000..50acb408 --- /dev/null +++ b/scripts/release_macos.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# This script prepares the compiled bundle for shipping as a standalone release +# Assumes the Qt bin folder is in PATH +# Should be used on a "Release" build from QT creator +# Note that this DOES NOT add the base/ folder + +# Exit on errors and unset variables +set -eu + +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" + +cd ${ROOT_DIR} + +# This thing basically does all the work +macdeployqt ../bin/Attorney_Online.app + +# Need to add the dependencies +cp ../lib/* ../bin/Attorney_Online.app/Contents/Frameworks + +# libbass has a funny path for some reason, just use rpath +install_name_tool -change @loader_path/libbass.dylib @rpath/libbass.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online diff --git a/scripts/wasabi_program.sh b/scripts/wasabi_program.sh index 37feac6e..41e2e352 100755 --- a/scripts/wasabi_program.sh +++ b/scripts/wasabi_program.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Updates the specified program manifest to a new archive and version # and uploads the new archive and manifest to S3/Wasabi. # diff --git a/scripts/windows/Dockerfile b/scripts/windows/Dockerfile index b9a12d66..f4f1a836 100644 --- a/scripts/windows/Dockerfile +++ b/scripts/windows/Dockerfile @@ -10,12 +10,5 @@ RUN /opt/mxe/usr/bin/${TARGET_SPEC}-cmake .. -DCMAKE_INSTALL_PREFIX=/opt/mxe/usr RUN /opt/mxe/usr/bin/${TARGET_SPEC}-cmake --build . --config Release --target install WORKDIR ../.. -# Build QtApng statically -RUN git clone https://github.com/Skycoder42/QtApng -WORKDIR QtApng -# libpng contains a self-test entry point that takes precedence for some reason -# over the final build's entry point. -RUN sed -i "s/^main(/libpng_main(/g" src/3rdparty/libpng/src/pngtest.c -RUN /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake -RUN make && make install -WORKDIR .. \ No newline at end of file +# NOTE: Do not build QtApng statically! libpng contains a self-test entry point that +# takes precedence for some reason over the final build's entry point. diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 3b5e836d..4ef1edd3 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -1,17 +1,17 @@ #include "aoapplication.h" -#include "aocaseannouncerdialog.h" -#include "aooptionsdialog.h" -#include "courtroom.h" -#include "debug_functions.h" #include "lobby.h" +#include "courtroom.h" #include "networkmanager.h" +#include "debug_functions.h" + +#include "aooptionsdialog.h" +#include "aocaseannouncerdialog.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,7 +28,8 @@ AOApplication::~AOApplication() void AOApplication::construct_lobby() { - if (lobby_constructed) { + if (lobby_constructed) + { qDebug() << "W: lobby was attempted constructed when it already exists"; return; } @@ -37,8 +38,8 @@ void AOApplication::construct_lobby() lobby_constructed = true; QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width() - w_lobby->width()) / 2; - int y = (geometry.height() - w_lobby->height()) / 2; + int x = (geometry.width()-w_lobby->width()) / 2; + int y = (geometry.height()-w_lobby->height()) / 2; w_lobby->move(x, y); if (is_discord_enabled()) @@ -49,7 +50,8 @@ 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; } @@ -61,7 +63,8 @@ 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; } @@ -70,14 +73,15 @@ 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; } @@ -89,11 +93,16 @@ 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() { @@ -124,9 +133,9 @@ void AOApplication::add_favorite_server(int p_server) void AOApplication::server_disconnected() { - if (courtroom_constructed) { - beep(); - call_notice(tr("Disconnected from server.")); + if (courtroom_constructed) + { + call_notice("Disconnected from server."); construct_lobby(); destruct_courtroom(); } @@ -135,44 +144,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("Error connecting to master server. Will try again in " + + QString::number(net_manager->ms_reconnect_delay) + " seconds."); } - 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.")); + else + { + call_error("There was an error connecting to the master server.\n" + "We deploy multiple master servers to mitigate any possible downtime, " + "but the client appears to have exhausted all possible methods of finding " + "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 7d598b5f..4dfb895c 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,14 +11,14 @@ 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); + set_volume(m_volume); } void AOBlipPlayer::blip_tick() @@ -34,21 +34,18 @@ void AOBlipPlayer::blip_tick() BASS_ChannelPlay(f_stream, false); } -void AOBlipPlayer::set_volume(qreal p_value) +void AOBlipPlayer::set_volume(int p_value) { - m_volume = p_value / 100; - set_volume_internal(m_volume); -} + m_volume = p_value; -void AOBlipPlayer::set_volume_internal(qreal p_value) -{ - float volume = p_value; + float volume = p_value / 100.0f; - for (int n_stream = 0; n_stream < 5; ++n_stream) { + for (int n_stream = 0 ; n_stream < 5 ; ++n_stream) + { BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); } } -#elif defined(QTAUDIO) // Using Qt's QSoundEffect class +#elif defined(QTAUDIO) //Using Qt's QSoundEffect class AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; @@ -59,16 +56,17 @@ 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)); } - set_volume_internal(m_volume); + set_volume(m_volume); } void AOBlipPlayer::blip_tick() { - m_cycle++; + int f_cycle = m_cycle++; if (m_cycle == 5) m_cycle = 0; @@ -76,28 +74,30 @@ void AOBlipPlayer::blip_tick() m_blips.play(); } -void AOBlipPlayer::set_volume(qreal p_value) -{ - m_volume = p_value / 100; - set_volume_internal(m_volume); -} - -void AOBlipPlayer::set_volume_internal(qreal p_value) +void AOBlipPlayer::set_volume(int p_value) { + m_volume = p_value; m_blips.setVolume(m_volume); } -#else // No audio +#else //No audio AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; ao_app = p_ao_app; } -void AOBlipPlayer::set_blips(QString p_sfx) {} +void AOBlipPlayer::set_blips(QString p_sfx) +{ + +} + +void AOBlipPlayer::blip_tick() +{ -void AOBlipPlayer::blip_tick() {} +} -void AOBlipPlayer::set_volume(qreal p_value) {} +void AOBlipPlayer::set_volume(int p_value) +{ -void AOBlipPlayer::set_volume_internal(qreal p_value) {} +} #endif diff --git a/src/aobutton.cpp b/src/aobutton.cpp index fee946a4..5be2e678 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -3,13 +3,15 @@ #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) { @@ -21,3 +23,4 @@ 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 0a287c37..5b82b64f 100644 --- a/src/aocaseannouncerdialog.cpp +++ b/src/aocaseannouncerdialog.cpp @@ -1,9 +1,7 @@ #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; @@ -16,27 +14,21 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, 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); @@ -62,28 +54,29 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, ui_juror_needed->setText(tr("Jurors needed")); ui_steno_needed = new QCheckBox(this); ui_steno_needed->setText(tr("Stenographer needed")); - ui_witness_needed = new QCheckBox(this); - ui_witness_needed->setText(tr("Witness needed")); ui_form_layout->setWidget(1, QFormLayout::FieldRole, ui_defense_needed); ui_form_layout->setWidget(2, QFormLayout::FieldRole, ui_prosecutor_needed); ui_form_layout->setWidget(3, QFormLayout::FieldRole, ui_judge_needed); ui_form_layout->setWidget(4, QFormLayout::FieldRole, ui_juror_needed); ui_form_layout->setWidget(5, QFormLayout::FieldRole, ui_steno_needed); - ui_form_layout->setWidget(6, QFormLayout::FieldRole, ui_witness_needed); setUpdatesEnabled(true); } 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()); 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 5c8a73bb..76610270 100644 --- a/src/aocharbutton.cpp +++ b/src/aocharbutton.cpp @@ -2,9 +2,7 @@ #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; @@ -42,35 +40,45 @@ 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(); @@ -80,8 +88,10 @@ 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 35d9b031..57487233 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -1,242 +1,150 @@ #include "aocharmovie.h" -#include "aoapplication.h" -#include "file_functions.h" #include "misc_functions.h" +#include "file_functions.h" +#include "aoapplication.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); + preanim_timer = new QTimer(this); - ticker = new QTimer(this); preanim_timer->setSingleShot(true); - ticker->setSingleShot(true); - connect(ticker, SIGNAL(timeout()), this, SLOT(movie_ticker())); - this->setUpdatesEnabled(true); + + connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); + connect(preanim_timer, SIGNAL(timeout()), this, SLOT(timer_done())); } void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { - QString original_path = - ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif"); - QString 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 original_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif"); + QString alt_path = ao_app->get_character_path(p_char, p_emote + ".png"); + QString apng_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng"); QString 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)) gif_path = apng_path; else if (file_exists(original_path)) gif_path = original_path; else if (file_exists(alt_path)) gif_path = alt_path; - else if (file_exists(alt_path_still)) - gif_path = alt_path_still; else if (file_exists(placeholder_path)) gif_path = placeholder_path; else gif_path = placeholder_default_path; - last_path = gif_path; - delete m_movie; - m_movie = new QMovie(this); + m_movie->stop(); - this->clear(); m_movie->setFileName(gif_path); - m_movie->jumpToFrame(0); - 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 (m_movie->frameCount() != 0) { - ticker->start(m_movie->nextFrameDelay()); - } -} -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) { - frame_specific_sfx_player->play(ao_app->get_sfx_suffix(sfx_to_play)); - } - else if (use_networked_framehell) { - this->sfx_two_network_boogaloo(); - } - if (screenshake_to_play != "" && !use_networked_framehell) { - mycourtroom->doScreenShake(); - } - else if (use_networked_framehell) { - this->screenshake_two_network_boogaloo(); - } - if (realization_to_play != "" && !use_networked_framehell) { - mycourtroom->doRealization(); + QImageReader *reader = new QImageReader(gif_path); + + movie_frames.clear(); + QImage f_image = reader->read(); + while (!f_image.isNull()) + { + if (m_flipped) + movie_frames.append(f_image.mirrored(true, false)); + else + movie_frames.append(f_image); + f_image = reader->read(); } - 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(); - } - } - } -} + delete reader; -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(); - } - } - } + this->show(); + m_movie->start(); } -void AOCharMovie::sfx_two_network_boogaloo() +void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) { - 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))); - } - } - } -} + QString gif_path = ao_app->get_character_path(p_char, p_emote); -void AOCharMovie::movie_ticker() -{ - 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(); - } - } - 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 + m_movie->stop(); + this->clear(); + m_movie->setFileName(gif_path); + m_movie->jumpToFrame(0); - this->play_frame_sfx(); + int full_duration = duration * time_mod; + int real_duration = 0; - if (m_movie->frameCount() == 0) { - return; - } - else { - ticker->start(m_movie->nextFrameDelay()); + play_once = false; + + for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame) + { + real_duration += m_movie->nextFrameDelay(); + m_movie->jumpToFrame(n_frame + 1); } -} -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; +#ifdef DEBUG_GIF + qDebug() << "full_duration: " << full_duration; + qDebug() << "real_duration: " << real_duration; +#endif + + double percentage_modifier = 100.0; - if (f_pixmap.size().width() > f_pixmap.size().height()) - aspect_ratio = Qt::KeepAspectRatioByExpanding; + if (real_duration != 0 && duration != 0) + { + double modifier = full_duration / static_cast(real_duration); + percentage_modifier = 100 / modifier; - if (f_pixmap.size().width() > this->size().width() || - f_pixmap.size().height() > this->size().height()) - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, - Qt::SmoothTransformation)); + if (percentage_modifier > 100.0) + percentage_modifier = 100.0; + } + +#ifdef DEBUG_GIF + qDebug() << "% mod: " << percentage_modifier; +#endif + + if (full_duration == 0 || full_duration >= real_duration) + { + play_once = true; + } else - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, - Qt::FastTransformation)); + { + play_once = false; + preanim_timer->start(full_duration); + } - QLabel::move(x + (this->width() - this->pixmap()->width()) / 2, y); + + m_movie->setSpeed(static_cast(percentage_modifier)); + play(p_char, p_emote, ""); } -void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) +void AOCharMovie::play_talking(QString p_char, QString p_emote) { - QString gif_path = ao_app->get_character_path(p_char, p_emote); + QString gif_path = ao_app->get_character_path(p_char, "(b)" + p_emote); m_movie->stop(); + this->clear(); m_movie->setFileName(gif_path); - m_movie->jumpToFrame(0); - play_once = true; - play(p_char, p_emote, ""); -} -void AOCharMovie::play_talking(QString p_char, QString p_emote) -{ play_once = false; + m_movie->setSpeed(100); play(p_char, p_emote, "(b)"); } void AOCharMovie::play_idle(QString p_char, QString p_emote) { + QString gif_path = ao_app->get_character_path(p_char, "(a)" + p_emote); + + m_movie->stop(); + this->clear(); + m_movie->setFileName(gif_path); + play_once = false; + m_movie->setSpeed(100); play(p_char, p_emote, "(a)"); } 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(); + preanim_timer->stop(); this->hide(); } @@ -244,8 +152,9 @@ void AOCharMovie::combo_resize(int w, int h) { QSize f_size(w, h); this->resize(f_size); - m_movie->setScaledSize(this->size()); + m_movie->setScaledSize(f_size); } + void AOCharMovie::move(int ax, int ay) { x = ax; @@ -253,4 +162,34 @@ void AOCharMovie::move(int ax, int ay) QLabel::move(x, y); } -void AOCharMovie::timer_done() { done(); } +void AOCharMovie::frame_change(int n_frame) +{ + + if (movie_frames.size() > n_frame) + { + QPixmap f_pixmap = QPixmap::fromImage(movie_frames.at(n_frame)); + auto aspect_ratio = Qt::KeepAspectRatio; + + if (f_pixmap.size().width() > f_pixmap.size().height()) + aspect_ratio = Qt::KeepAspectRatioByExpanding; + + if (f_pixmap.size().width() > this->size().width() || f_pixmap.size().height() > this->size().height()) + this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::SmoothTransformation)); + else + this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation)); + + QLabel::move(x + (this->width() - this->pixmap()->width())/2, y); + } + + if (m_movie->frameCount() - 1 == n_frame && play_once) + { + preanim_timer->start(m_movie->nextFrameDelay()); + m_movie->stop(); + } +} + +void AOCharMovie::timer_done() +{ + + done(); +} diff --git a/src/aoemotebutton.cpp b/src/aoemotebutton.cpp index 29329c98..9c1d3889 100644 --- a/src/aoemotebutton.cpp +++ b/src/aoemotebutton.cpp @@ -2,9 +2,7 @@ #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; @@ -18,17 +16,21 @@ AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, 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 d0a6ac1b..15b598fc 100644 --- a/src/aoevidencebutton.cpp +++ b/src/aoevidencebutton.cpp @@ -2,9 +2,7 @@ #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; @@ -41,11 +39,13 @@ 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,7 +75,10 @@ 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) { @@ -87,15 +90,19 @@ void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e) void AOEvidenceButton::dragLeaveEvent(QMouseEvent *e) { //QWidget::dragLeaveEvent(e); + + qDebug() << "drag leave event"; } void AOEvidenceButton::dragEnterEvent(QMouseEvent *e) { //QWidget::dragEnterEvent(e); + + qDebug() << "drag enter event"; } */ -void AOEvidenceButton::enterEvent(QEvent *e) +void AOEvidenceButton::enterEvent(QEvent * e) { ui_selector->show(); @@ -105,7 +112,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 9dd062b7..9ec105dd 100644 --- a/src/aoevidencedisplay.cpp +++ b/src/aoevidencedisplay.cpp @@ -1,11 +1,10 @@ #include "aoevidencedisplay.h" -#include "datatypes.h" #include "file_functions.h" +#include "datatypes.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; @@ -13,12 +12,10 @@ 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(); @@ -32,23 +29,23 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, 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); @@ -60,7 +57,7 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, evidence_movie->setFileName(final_gif_path); - if (evidence_movie->frameCount() < 1) + if(evidence_movie->frameCount() < 1) return; this->setMovie(evidence_movie); @@ -71,8 +68,9 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, 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(); @@ -90,4 +88,9 @@ 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 ffdf25aa..7bb56bb6 100644 --- a/src/aoimage.cpp +++ b/src/aoimage.cpp @@ -8,7 +8,10 @@ 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) { @@ -24,8 +27,7 @@ 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) @@ -41,6 +43,5 @@ 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 211d9f78..f6026e14 100644 --- a/src/aolineedit.cpp +++ b/src/aolineedit.cpp @@ -15,4 +15,7 @@ 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 9ffd62f0..edf5bdb0 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -1,116 +1,90 @@ -#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 "aomovie.h" + +#include "file_functions.h" +#include "courtroom.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); + + connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); +} + +void AOMovie::set_play_once(bool p_play_once) +{ + play_once = p_play_once; +} + +void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme) +{ + m_movie->stop(); + + 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)); + else + custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble")); + + QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_gif + "_bubble.gif"; + QString custom_theme_path = ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif"); + QString 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"); + + 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 = ""; + + m_movie->setFileName(gif_path); + + this->show(); + m_movie->start(); +} + +void AOMovie::stop() +{ + m_movie->stop(); + this->hide(); +} + +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()); + + this->stop(); + + //signal connected to courtroom object, let it figure out what to do + 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 3ba9cf1d..27918092 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -2,40 +2,28 @@ #if defined(BASSAUDIO) AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) - : QObject() { m_parent = parent; ao_app = p_ao_app; } -AOMusicPlayer::~AOMusicPlayer() { kill_loop(); } +AOMusicPlayer::~AOMusicPlayer() +{ + BASS_ChannelStop(m_stream); +} void AOMusicPlayer::play(QString p_song) { BASS_ChannelStop(m_stream); - f_path = ao_app->get_music_path(p_song); + QString f_path = ao_app->get_music_path(p_song); - if (p_song.startsWith("http")) { - m_stream = BASS_StreamCreateURL(f_path.toStdWString().c_str(), 0, - BASS_STREAM_AUTOFREE | BASS_UNICODE | - BASS_ASYNCFILE, NULL, NULL); - } else { - 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) { - BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); - } - else { - BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP); - } BASS_ChannelPlay(m_stream, false); } @@ -45,20 +33,17 @@ void AOMusicPlayer::set_volume(int p_value) float volume = m_volume / 100.0f; BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume); } - -QString AOMusicPlayer::get_path() { return f_path; } - -void AOMusicPlayer::kill_loop() { BASS_ChannelStop(m_stream); } - #elif defined(QTAUDIO) 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) { @@ -68,7 +53,7 @@ void AOMusicPlayer::play(QString p_song) m_player.setMedia(QUrl::fromLocalFile(f_path)); - this->set_volume(100); + this->set_volume(m_volume); m_player.play(); } @@ -76,32 +61,27 @@ void AOMusicPlayer::play(QString p_song) void AOMusicPlayer::set_volume(int p_value) { m_volume = p_value; - - qreal linearVolume = QAudio::convertVolume(m_volume / qreal(100), - QAudio::LogarithmicVolumeScale, - QAudio::LinearVolumeScale); - - m_player.setVolume(linearVolume * 100); + m_player.setVolume(m_volume); } - -QString AOMusicPlayer::get_path() { return f_path; } - -void AOMusicPlayer::kill_loop() { m_player.stop(); } #else 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) +{ -void AOMusicPlayer::kill_loop() {} +} #endif diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index e2c6ac8c..0f6a054a 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -1,722 +1,524 @@ #include "aooptionsdialog.h" #include "aoapplication.h" +#include "bass.h" -AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) - : QDialog(parent) +AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDialog(parent) { - ao_app = p_ao_app; - - // 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); + ao_app = p_ao_app; - 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); + // Setting up the basics. + // setAttribute(Qt::WA_DeleteOnClose); + setWindowTitle(tr("Settings")); + resize(398, 320); - // 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_settings_buttons = new QDialogButtonBox(this); - ui_vertical_layout->addWidget(ui_settings_tabs); - ui_vertical_layout->addWidget(ui_settings_buttons); + 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); - // Let's add the tabs one by one. + QObject::connect(ui_settings_buttons, SIGNAL(accepted()), this, SLOT(save_pressed())); + QObject::connect(ui_settings_buttons, SIGNAL(rejected()), this, SLOT(discard_pressed())); - // - // GAMEPLAY - // + // We'll stop updates so that the window won't flicker while it's being made. + setUpdatesEnabled(false); - ui_gameplay_tab = new QWidget(); - ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay")); + // 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_form_layout_widget = new QWidget(ui_gameplay_tab); - ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 240)); + ui_vertical_layout->addWidget(ui_settings_tabs); + ui_vertical_layout->addWidget(ui_settings_buttons); - 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); + // 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_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_form_layout_widget = new QWidget(ui_gameplay_tab); + ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 211)); - ui_theme_combobox = new QComboBox(ui_form_layout_widget); + 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); - // 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_theme_label = new QLabel(ui_form_layout_widget); + ui_theme_label->setText(tr("Theme:")); + ui_theme_label->setToolTip(tr("Sets the theme used in-game. If the new theme changes " + "the lobby's look as well, you'll need to reload the " + "lobby for the changes to take effect, such as by joining " + "a server and leaving it.")); + ui_gameplay_form->setWidget(0, QFormLayout::LabelRole, ui_theme_label); - ui_gameplay_form->setWidget(0, QFormLayout::FieldRole, ui_theme_combobox); - - ui_theme_log_divider = new QFrame(ui_form_layout_widget); - ui_theme_log_divider->setMidLineWidth(0); - ui_theme_log_divider->setFrameShape(QFrame::HLine); - ui_theme_log_divider->setFrameShadow(QFrame::Sunken); - - ui_gameplay_form->setWidget(1, QFormLayout::FieldRole, ui_theme_log_divider); - - - ui_username_lbl = new QLabel(ui_form_layout_widget); - ui_username_lbl->setText(tr("Default username:")); - ui_username_lbl->setToolTip( - tr("Your OOC name will be automatically set to this value " - "when you join a server.")); - - ui_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(2, QFormLayout::FieldRole, ui_username_textbox); - - 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' " - "checkbox, which in turn determines whether the client should " - "display custom in-character names.")); - - 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(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(4, 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_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(5, 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_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(6, QFormLayout::FieldRole, ui_discord_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(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(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(8, 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("pl - Polski"); - ui_language_combobox->addItem("jp - 日本語"); - ui_language_combobox->addItem("ru - Русский"); - 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_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_slower_blips()); - 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("Blip delay on punctuations:")); - 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()); - 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(); - 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_theme_combobox = new QComboBox(ui_form_layout_widget); + + // Fill the combobox with the names of the themes. + QDirIterator it(p_ao_app->get_base_path() + "themes", QDir::Dirs, QDirIterator::NoIteratorFlags); + while (it.hasNext()) + { + QString actualname = QDir(it.next()).dirName(); + if (actualname != "." && actualname != "..") + ui_theme_combobox->addItem(actualname); + if (actualname == p_ao_app->read_theme()) + ui_theme_combobox->setCurrentIndex(ui_theme_combobox->count()-1); + } + + ui_gameplay_form->setWidget(0, QFormLayout::FieldRole, ui_theme_combobox); + + ui_theme_log_divider = new QFrame(ui_form_layout_widget); + ui_theme_log_divider->setMidLineWidth(0); + ui_theme_log_divider->setFrameShape(QFrame::HLine); + ui_theme_log_divider->setFrameShadow(QFrame::Sunken); + + ui_gameplay_form->setWidget(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:")); + ui_username_lbl->setToolTip(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_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_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(6, QFormLayout::LabelRole, ui_showname_lbl); - ui_audio_volume_divider = new QFrame(ui_audio_widget); - ui_audio_volume_divider->setFrameShape(QFrame::HLine); - ui_audio_volume_divider->setFrameShadow(QFrame::Sunken); + ui_showname_cb = new QCheckBox(ui_form_layout_widget); + ui_showname_cb->setChecked(p_ao_app->get_showname_enabled_by_default()); - ui_audio_layout->setWidget(1, QFormLayout::FieldRole, - ui_audio_volume_divider); + ui_gameplay_form->setWidget(6, QFormLayout::FieldRole, ui_showname_cb); - ui_music_volume_lbl = new QLabel(ui_audio_widget); - ui_music_volume_lbl->setText(tr("Music:")); - ui_music_volume_lbl->setToolTip(tr("Sets the default volume for music.")); + 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::LabelRole, ui_music_volume_lbl); + ui_gameplay_form->setWidget(7, QFormLayout::FieldRole, ui_net_divider); - 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_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_audio_layout->setWidget(2, QFormLayout::FieldRole, - ui_music_volume_spinbox); + ui_gameplay_form->setWidget(8, QFormLayout::LabelRole, ui_ms_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 default volume for SFX sounds, " - "like interjections or other character sound effects.")); + QSettings* configini = ao_app->configini; + ui_ms_textbox = new QLineEdit(ui_form_layout_widget); + ui_ms_textbox->setText(configini->value("master", "").value()); - ui_audio_layout->setWidget(3, QFormLayout::LabelRole, ui_sfx_volume_lbl); + ui_gameplay_form->setWidget(8, QFormLayout::FieldRole, ui_ms_textbox); - 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_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_audio_layout->setWidget(3, QFormLayout::FieldRole, ui_sfx_volume_spinbox); + ui_gameplay_form->setWidget(9, QFormLayout::LabelRole, ui_discord_lbl); - 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_discord_cb = new QCheckBox(ui_form_layout_widget); + ui_discord_cb->setChecked(ao_app->is_discord_enabled()); - ui_audio_layout->setWidget(4, QFormLayout::LabelRole, ui_blips_volume_lbl); + ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_discord_cb); - 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("%"); + // Here we start the callwords tab. + ui_callwords_tab = new QWidget(); + ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords")); - ui_audio_layout->setWidget(4, QFormLayout::FieldRole, - ui_blips_volume_spinbox); + ui_callwords_widget = new QWidget(ui_callwords_tab); + ui_callwords_widget->setGeometry(QRect(10, 10, 361, 211)); - ui_volume_blip_divider = new QFrame(ui_audio_widget); - ui_volume_blip_divider->setFrameShape(QFrame::HLine); - ui_volume_blip_divider->setFrameShadow(QFrame::Sunken); + ui_callwords_layout = new QVBoxLayout(ui_callwords_widget); + ui_callwords_layout->setContentsMargins(0,0,0,0); - ui_audio_layout->setWidget(5, QFormLayout::FieldRole, ui_volume_blip_divider); + 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_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.")); + // 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_audio_layout->setWidget(6, QFormLayout::LabelRole, ui_bliprate_lbl); + ui_callwords_layout->addWidget(ui_callwords_textbox); - ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); - ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate()); - ui_bliprate_spinbox->setMinimum(1); + 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_audio_layout->setWidget(6, QFormLayout::FieldRole, ui_bliprate_spinbox); + ui_callwords_layout->addWidget(ui_callwords_explain_lbl); - 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'.")); + // The audio tab. + #ifdef BASSAUDIO + ui_audio_tab = new QWidget(); + ui_settings_tabs->addTab(ui_audio_tab, tr("Audio")); - ui_audio_layout->setWidget(7, QFormLayout::LabelRole, ui_blank_blips_lbl); + ui_audio_widget = new QWidget(ui_audio_tab); + ui_audio_widget->setGeometry(QRect(10, 10, 361, 211)); - ui_blank_blips_cb = new QCheckBox(ui_audio_widget); - ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip()); + ui_audio_layout = new QFormLayout(ui_audio_widget); + ui_audio_layout->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); + ui_audio_layout->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); + ui_audio_layout->setContentsMargins(0, 0, 0, 0); - ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb); + 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_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_audio_layout->setWidget(0, QFormLayout::LabelRole, ui_audio_device_lbl); - ui_audio_layout->setWidget(8, QFormLayout::LabelRole, ui_loopsfx_lbl); + ui_audio_device_combobox = new QComboBox(ui_audio_widget); - ui_loopsfx_cb = new QCheckBox(ui_audio_widget); - ui_loopsfx_cb->setChecked(p_ao_app->get_looping_sfx()); + // Let's fill out the combobox with the available audio devices. Or don't if there is no audio + int a = 0; + BASS_DEVICEINFO info; - ui_audio_layout->setWidget(8, QFormLayout::FieldRole, ui_loopsfx_cb); + if (needs_default_audiodev()) + { + ui_audio_device_combobox->addItem("default"); + } - 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.")); + for (a = 0; BASS_GetDeviceInfo(a, &info); a++) + { + ui_audio_device_combobox->addItem(info.name); + if (p_ao_app->get_audio_output_device() == info.name) + ui_audio_device_combobox->setCurrentIndex(ui_audio_device_combobox->count()-1); + } - ui_audio_layout->setWidget(9, QFormLayout::LabelRole, ui_objectmusic_lbl); + ui_audio_layout->setWidget(0, QFormLayout::FieldRole, ui_audio_device_combobox); - ui_objectmusic_cb = new QCheckBox(ui_audio_widget); - ui_objectmusic_cb->setChecked(p_ao_app->get_objectmusic()); + 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(9, QFormLayout::FieldRole, ui_objectmusic_cb); + ui_audio_layout->setWidget(1, QFormLayout::FieldRole, ui_audio_volume_divider); - // - // CASING - // - ui_casing_tab = new QWidget(); - ui_settings_tabs->addTab(ui_casing_tab, tr("Casing")); + 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_widget = new QWidget(ui_casing_tab); - ui_casing_widget->setGeometry(QRect(10, 10, 361, 211)); + ui_audio_layout->setWidget(2, QFormLayout::LabelRole, ui_music_volume_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_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("%"); - // -- SERVER SUPPORTS CASING + ui_audio_layout->setWidget(2, QFormLayout::FieldRole, ui_music_volume_spinbox); - 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_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_layout->setWidget(0, QFormLayout::FieldRole, - ui_casing_supported_lbl); + ui_audio_layout->setWidget(3, QFormLayout::LabelRole, ui_sfx_volume_lbl); - // -- CASE ANNOUNCEMENTS + 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_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(3, QFormLayout::FieldRole, ui_sfx_volume_spinbox); - ui_casing_layout->setWidget(1, QFormLayout::LabelRole, ui_casing_enabled_lbl); + 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_enabled_cb = new QCheckBox(ui_casing_widget); - ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled()); + ui_audio_layout->setWidget(4, QFormLayout::LabelRole, ui_blips_volume_lbl); - ui_casing_layout->setWidget(1, QFormLayout::FieldRole, ui_casing_enabled_cb); + 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("%"); - // -- DEFENSE ANNOUNCEMENTS + ui_audio_layout->setWidget(4, QFormLayout::FieldRole, ui_blips_volume_spinbox); - 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_volume_blip_divider = new QFrame(ui_audio_widget); + ui_volume_blip_divider->setFrameShape(QFrame::HLine); + ui_volume_blip_divider->setFrameShadow(QFrame::Sunken); - ui_casing_layout->setWidget(2, QFormLayout::LabelRole, ui_casing_def_lbl); + ui_audio_layout->setWidget(5, QFormLayout::FieldRole, ui_volume_blip_divider); - ui_casing_def_cb = new QCheckBox(ui_casing_widget); - ui_casing_def_cb->setChecked(ao_app->get_casing_defence_enabled()); + 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_layout->setWidget(2, QFormLayout::FieldRole, ui_casing_def_cb); + ui_audio_layout->setWidget(6, QFormLayout::LabelRole, ui_bliprate_lbl); - // -- PROSECUTOR ANNOUNCEMENTS + ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); + ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate()); + ui_bliprate_spinbox->setMinimum(1); - 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(6, QFormLayout::FieldRole, ui_bliprate_spinbox); - ui_casing_layout->setWidget(3, QFormLayout::LabelRole, ui_casing_pro_lbl); + 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_pro_cb = new QCheckBox(ui_casing_widget); - ui_casing_pro_cb->setChecked(ao_app->get_casing_prosecution_enabled()); + ui_audio_layout->setWidget(7, QFormLayout::LabelRole, ui_blank_blips_lbl); - ui_casing_layout->setWidget(3, QFormLayout::FieldRole, ui_casing_pro_cb); + ui_blank_blips_cb = new QCheckBox(ui_audio_widget); + ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip()); - // -- JUDGE ANNOUNCEMENTS + ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb); + #endif - 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.")); + // The casing tab! + ui_casing_tab = new QWidget(); + ui_settings_tabs->addTab(ui_casing_tab, tr("Casing")); - ui_casing_layout->setWidget(4, QFormLayout::LabelRole, ui_casing_jud_lbl); + ui_casing_widget = new QWidget(ui_casing_tab); + ui_casing_widget->setGeometry(QRect(10,10, 361, 211)); - ui_casing_jud_cb = new QCheckBox(ui_casing_widget); - ui_casing_jud_cb->setChecked(ao_app->get_casing_judge_enabled()); + ui_casing_layout = new QFormLayout(ui_casing_widget); + ui_casing_layout->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); + ui_casing_layout->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); + ui_casing_layout->setContentsMargins(0, 0, 0, 0); - ui_casing_layout->setWidget(4, QFormLayout::FieldRole, ui_casing_jud_cb); + // -- SERVER SUPPORTS CASING - // -- JUROR ANNOUNCEMENTS + ui_casing_supported_lbl = new QLabel(ui_casing_widget); + if (ao_app->casing_alerts_enabled) + ui_casing_supported_lbl->setText(tr("This server supports case alerts.")); + else + ui_casing_supported_lbl->setText(tr("This server does not support case alerts.")); + ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory.")); - ui_casing_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(0, QFormLayout::FieldRole, ui_casing_supported_lbl); - ui_casing_layout->setWidget(5, QFormLayout::LabelRole, ui_casing_jur_lbl); + // -- CASE ANNOUNCEMENTS - ui_casing_jur_cb = new QCheckBox(ui_casing_widget); - ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled()); + ui_casing_enabled_lbl = new QLabel(ui_casing_widget); + ui_casing_enabled_lbl->setText(tr("Casing:")); + ui_casing_enabled_lbl->setToolTip(tr("If checked, you will get alerts about case " + "announcements.")); - ui_casing_layout->setWidget(5, QFormLayout::FieldRole, ui_casing_jur_cb); + ui_casing_layout->setWidget(1, QFormLayout::LabelRole, ui_casing_enabled_lbl); - // -- STENO ANNOUNCEMENTS + ui_casing_enabled_cb = new QCheckBox(ui_casing_widget); + ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled()); - 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(1, QFormLayout::FieldRole, ui_casing_enabled_cb); - ui_casing_layout->setWidget(6, QFormLayout::LabelRole, ui_casing_steno_lbl); + // -- DEFENSE ANNOUNCEMENTS - ui_casing_steno_cb = new QCheckBox(ui_casing_widget); - ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled()); + 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(6, QFormLayout::FieldRole, ui_casing_steno_cb); + ui_casing_layout->setWidget(2, QFormLayout::LabelRole, ui_casing_def_lbl); - // -- CM ANNOUNCEMENTS + ui_casing_def_cb = new QCheckBox(ui_casing_widget); + ui_casing_def_cb->setChecked(ao_app->get_casing_defence_enabled()); - 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(2, QFormLayout::FieldRole, ui_casing_def_cb); - ui_casing_layout->setWidget(7, QFormLayout::LabelRole, ui_casing_cm_lbl); + // -- PROSECUTOR ANNOUNCEMENTS - ui_casing_cm_cb = new QCheckBox(ui_casing_widget); - ui_casing_cm_cb->setChecked(ao_app->get_casing_cm_enabled()); + 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(7, QFormLayout::FieldRole, ui_casing_cm_cb); + ui_casing_layout->setWidget(3, QFormLayout::LabelRole, ui_casing_pro_lbl); - 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_pro_cb = new QCheckBox(ui_casing_widget); + ui_casing_pro_cb->setChecked(ao_app->get_casing_prosecution_enabled()); - ui_casing_layout->setWidget(8, QFormLayout::LabelRole, ui_casing_wit_lbl); + ui_casing_layout->setWidget(3, QFormLayout::FieldRole, ui_casing_pro_cb); - ui_casing_wit_cb = new QCheckBox(ui_casing_widget); - ui_casing_wit_cb->setChecked(ao_app->get_casing_wit_enabled()); + // -- JUDGE ANNOUNCEMENTS - ui_casing_layout->setWidget(8, QFormLayout::FieldRole, ui_casing_wit_cb); + 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.")); - // -- CM CASES ANNOUNCEMENTS + ui_casing_layout->setWidget(4, QFormLayout::LabelRole, ui_casing_jud_lbl); - 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_jud_cb = new QCheckBox(ui_casing_widget); + ui_casing_jud_cb->setChecked(ao_app->get_casing_judge_enabled()); - ui_casing_layout->setWidget(9, QFormLayout::LabelRole, - ui_casing_cm_cases_lbl); + ui_casing_layout->setWidget(4, QFormLayout::FieldRole, ui_casing_jud_cb); - ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget); - ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases()); + // -- JUROR ANNOUNCEMENTS - ui_casing_layout->setWidget(9, QFormLayout::FieldRole, - ui_casing_cm_cases_textbox); + 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.")); - // ICLOG + ui_casing_layout->setWidget(5, QFormLayout::LabelRole, ui_casing_jur_lbl); - ui_other_tab = new QWidget(); - ui_settings_tabs->addTab(ui_other_tab, tr("IC Log")); + ui_casing_jur_cb = new QCheckBox(ui_casing_widget); + ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled()); - ui_other_widget = new QWidget(ui_other_tab); - ui_other_widget->setGeometry(QRect(10, 10, 361, 211)); + ui_casing_layout->setWidget(5, QFormLayout::FieldRole, ui_casing_jur_cb); - 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); + // -- STENO ANNOUNCEMENTS - 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_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_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(6, QFormLayout::LabelRole, ui_casing_steno_lbl); - 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); + ui_casing_steno_cb = new QCheckBox(ui_casing_widget); + ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled()); - 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 interrupted nobody will know what they " - "wanted to say. " - "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); - 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); + 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); + + // -- 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(8, QFormLayout::LabelRole, ui_casing_cm_cases_lbl); + + ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget); + ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases()); + + ui_casing_layout->setWidget(8, QFormLayout::FieldRole, ui_casing_cm_cases_textbox); + + // When we're done, we should continue the updates! + setUpdatesEnabled(true); } void AOOptionsDialog::save_pressed() { - // Save everything into the config.ini. - QSettings *configini = ao_app->configini; - - configini->setValue("theme", ui_theme_combobox->currentText()); - configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked()); - configini->setValue("log_maximum", ui_length_spinbox->value()); - configini->setValue("default_username", ui_username_textbox->text()); - configini->setValue("show_custom_shownames", ui_showname_cb->isChecked()); - configini->setValue("master", ui_ms_textbox->text()); - configini->setValue("discord", ui_discord_cb->isChecked()); - configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked()); - configini->setValue("language", ui_language_combobox->currentText().left(2)); - 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 | - QIODevice::Text)) { - // Nevermind! - } - else { - QTextStream out(callwordsini); - out << ui_callwords_textbox->toPlainText(); + // Save everything into the config.ini. + QSettings* configini = ao_app->configini; + + configini->setValue("theme", ui_theme_combobox->currentText()); + configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked()); + configini->setValue("log_maximum", ui_length_spinbox->value()); + configini->setValue("default_username", ui_username_textbox->text()); + configini->setValue("show_custom_shownames", ui_showname_cb->isChecked()); + configini->setValue("master", ui_ms_textbox->text()); + configini->setValue("discord", ui_discord_cb->isChecked()); + + QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); + + if (!callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) + { + // Nevermind! + } + else + { + QTextStream out(callwordsini); + out << ui_callwords_textbox->toPlainText(); + callwordsini->close(); + } + + configini->setValue("default_audio_device", ui_audio_device_combobox->currentText()); + configini->setValue("default_music", ui_music_volume_spinbox->value()); + configini->setValue("default_sfx", ui_sfx_volume_spinbox->value()); + configini->setValue("default_blip", ui_blips_volume_spinbox->value()); + configini->setValue("blip_rate", ui_bliprate_spinbox->value()); + configini->setValue("blank_blip", ui_blank_blips_cb->isChecked()); + + configini->setValue("casing_enabled", ui_casing_enabled_cb->isChecked()); + configini->setValue("casing_defence_enabled", ui_casing_def_cb->isChecked()); + configini->setValue("casing_prosecution_enabled", ui_casing_pro_cb->isChecked()); + configini->setValue("casing_judge_enabled", ui_casing_jud_cb->isChecked()); + configini->setValue("casing_juror_enabled", ui_casing_jur_cb->isChecked()); + configini->setValue("casing_steno_enabled", ui_casing_steno_cb->isChecked()); + configini->setValue("casing_cm_enabled", ui_casing_cm_cb->isChecked()); + configini->setValue("casing_can_host_cases", ui_casing_cm_cases_textbox->text()); + 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("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); + done(0); } -void AOOptionsDialog::discard_pressed() { done(0); } +void AOOptionsDialog::discard_pressed() +{ + done(0); +} -#if (defined(_WIN32) || defined(_WIN64)) -bool AOOptionsDialog::needs_default_audiodev() { return true; } -#elif (defined(LINUX) || defined(__linux__)) -bool AOOptionsDialog::needs_default_audiodev() { return false; } +#if (defined (_WIN32) || defined (_WIN64)) +bool AOOptionsDialog::needs_default_audiodev() +{ + return true; +} +#elif (defined (LINUX) || defined (__linux__)) +bool AOOptionsDialog::needs_default_audiodev() +{ + return false; +} #elif defined __APPLE__ -bool AOOptionsDialog::needs_default_audiodev() { return true; } +bool AOOptionsDialog::needs_default_audiodev() +{ + return true; +} #else #error This operating system is not supported. #endif diff --git a/src/aopacket.cpp b/src/aopacket.cpp index 6afd39e7..b957efea 100644 --- a/src/aopacket.cpp +++ b/src/aopacket.cpp @@ -8,7 +8,8 @@ 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)); } } @@ -19,18 +20,23 @@ 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 @@ -53,12 +59,10 @@ 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); @@ -67,14 +71,13 @@ 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/aoscene.cpp b/src/aoscene.cpp index fc686336..344522b6 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -7,19 +7,16 @@ 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_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 + 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"); - if (file_exists(background_path) && background_path == last_image) - return; + QPixmap background(background_path); + QPixmap default_bg(default_path); int w = this->width(); int h = this->height(); @@ -28,58 +25,52 @@ void AOScene::set_image(QString p_image) this->setMovie(nullptr); m_movie->stop(); - m_movie->setFileName(background_path); + m_movie->setFileName(animated_background_path); m_movie->setScaledSize(QSize(w, h)); - if (m_movie->isValid()) { + if (m_movie->isValid()) + { this->setMovie(m_movie); m_movie->start(); } - else { - QPixmap background(background_path); + else if (file_exists(background_path)) + { this->setPixmap(background.scaled(w, h)); } - last_image = background_path; + else + { + this->setPixmap(default_bg.scaled(w, h)); + } } void AOScene::set_legacy_desk(QString p_image) { + //vanilla desks vary in both width and height. in order to make that work with viewport rescaling, + //some INTENSE math is needed. - 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 + QString desk_path = ao_app->get_background_path(p_image); + QString default_path = ao_app->get_default_background_path(p_image); - if (file_exists(desk_path) && desk_path == last_image) - return; - QPixmap f_desk(desk_path); + QPixmap f_desk; - // vanilla desks vary in both width and height. in order to make that work - // with viewport rescaling, some INTENSE math is needed. + if (file_exists(desk_path)) + f_desk.load(desk_path); + else + f_desk.load(default_path); 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->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; + //this->resize(final_w, final_h); + //this->setPixmap(f_desk.scaled(final_w, final_h)); + this->resize(vp_width, final_h); + this->setPixmap(f_desk.scaled(vp_width, final_h)); } diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index 4684acdb..710d7a8a 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) { 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,49 +24,34 @@ 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); - set_volume_internal(m_volume); + m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + + set_volume(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()) { - BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP); - } - else { - BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP); - } -} - -void AOSfxPlayer::setLooping(bool is_looping) -{ - this->looping_sfx = is_looping; } -void AOSfxPlayer::stop() { BASS_ChannelStop(m_stream); } - -void AOSfxPlayer::set_volume(qreal p_value) +void AOSfxPlayer::stop() { - m_volume = p_value / 100; - set_volume_internal(m_volume); + BASS_ChannelStop(m_stream); } -void AOSfxPlayer::set_volume_internal(qreal p_value) +void AOSfxPlayer::set_volume(int p_value) { - float volume = p_value; + m_volume = p_value; + float volume = p_value / 100.0f; 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) { m_parent = parent; ao_app = p_ao_app; @@ -88,56 +73,51 @@ 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(m_volume); - m_sfx.play(); + m_sfx.play(); } } -void AOSfxPlayer::setLooping(bool is_looping) +void AOSfxPlayer::stop() { - this->looping_sfx = is_looping; -} - -void AOSfxPlayer::stop() { m_sfx.stop(); } - -void AOSfxPlayer::set_volume(qreal p_value) -{ - m_volume = p_value / 100; - set_volume_internal(m_volume); + m_sfx.stop(); } -void AOSfxPlayer::set_volume_internal(qreal p_value) +void AOSfxPlayer::set_volume(int p_value) { + m_volume = 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) { m_parent = parent; ao_app = p_ao_app; } -void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) {} - -void AOSfxPlayer::setLooping(bool is_looping) +void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) { - this->looping_sfx = is_looping; + } -void AOSfxPlayer::stop() {} +void AOSfxPlayer::stop() +{ -void AOSfxPlayer::set_volume(qreal p_value) {} +} -void AOSfxPlayer::set_volume_internal(qreal p_value) {} +void AOSfxPlayer::set_volume(int p_value) +{ + +} #endif diff --git a/src/aotextarea.cpp b/src/aotextarea.cpp index 04d44318..5e146326 100644 --- a/src/aotextarea.cpp +++ b/src/aotextarea.cpp @@ -1,30 +1,24 @@ #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) +void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p_colour) { const QTextCursor old_cursor = this->textCursor(); const int old_scrollbar_value = this->verticalScrollBar()->value(); - const bool is_scrolled_down = - old_scrollbar_value == this->verticalScrollBar()->maximum(); + const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum(); this->moveCursor(QTextCursor::End); this->append(""); - if (song) - this->insertHtml("" + - p_name.toHtmlEscaped() + " "); - else - this->insertHtml("" + - p_name.toHtmlEscaped() + ": "); + 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,35 +29,32 @@ 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 22d9a62e..30e48b73 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,4 +14,8 @@ 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 9dee2373..4987cf57 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -1,58 +1,10 @@ #include "courtroom.h" #include "lobby.h" -#include "debug_functions.h" #include "file_functions.h" +#include "debug_functions.h" #include "hardware_functions.h" -class AOCharSelectGenerationThreading : public QRunnable { -public: - 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, - char_num); - } -}; - -void AOCharSelectFilter(Courtroom *thisCourtroom, int 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->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); - - thisCourtroom->ui_char_button_list_filtered.append(current_char); -} - void Courtroom::construct_char_select() { ui_char_select_background = new AOImage(this, ao_app); @@ -92,36 +44,27 @@ 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(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 @@ -142,22 +85,25 @@ 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; @@ -173,25 +119,23 @@ void Courtroom::set_char_select_page() void Courtroom::char_clicked(int n_char) { - QString char_ini_path = - ao_app->get_character_path(char_list.at(n_char).name, "char.ini"); + QString char_ini_path = ao_app->get_character_path(char_list.at(n_char).name, "char.ini"); qDebug() << "char_ini_path" << char_ini_path; - if (!file_exists(char_ini_path)) { - call_notice(tr("Could not find %1").arg(char_ini_path, 1)); + if (!file_exists(char_ini_path)) + { + call_notice("Could not find " + char_ini_path); return; } - if (n_char == m_cid) { + if (n_char == m_cid) + { enter_courtroom(m_cid); } - else { - ao_app->send_server_packet( - new AOPacket("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("CC#" + QString::number(ao_app->s_pv) + "#" + QString::number(n_char) + "#" + get_hdid() + "#%")); } ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); @@ -199,94 +143,126 @@ 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; + // 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(); } - 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, - // 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(); + // First, we'll make all the character buttons in the very beginning. + // We also hide them all, so they can't be accidentally clicked. + // Later on, we'll be revealing buttons as we need them. + for (int n = 0; n < char_list.size(); n++) + { + AOCharButton* char_button = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); + char_button->reset(); + char_button->hide(); + char_button->set_image(char_list.at(n).name); + ui_char_button_list.append(char_button); + + connect(char_button, &AOCharButton::clicked, [this, n](){ + this->char_clicked(n); + }); + + // This part here serves as a way of showing to the player that the game is still running, it is + // just loading the pictures of the characters. + if (ao_app->lobby_constructed) + { + ao_app->generated_chars++; + int total_loading_size = ao_app->char_list_size * 2 + ao_app->evidence_list_size + ao_app->music_list_size; + int loading_value = int(((ao_app->loaded_chars + ao_app->generated_chars + ao_app->loaded_music + ao_app->loaded_evidence) / static_cast(total_loading_size)) * 100); + ao_app->w_lobby->set_loading_value(loading_value); + ao_app->w_lobby->set_loading_text("Generating chars:\n" + QString::number(ao_app->generated_chars) + "/" + QString::number(ao_app->char_list_size)); + } } - } - QThreadPool::globalInstance()->waitForDone(); - filter_character_list(); + + filter_character_list(); } void Courtroom::filter_character_list() { - ui_char_button_list_filtered.clear(); - for (int i = 0; i < char_list.size(); i++) { - AOCharSelectFilter(this, i); - } + ui_char_button_list_filtered.clear(); + for (int i = 0; i < char_list.size(); i++) + { + AOCharButton* current_char = ui_char_button_list.at(i); + + // It seems passwording characters is unimplemented yet? + // Until then, this will stay here, I suppose. + //if (ui_char_passworded->isChecked() && character_is_passworded??) + // continue; - current_char_page = 0; - set_char_select_page(); + if (!ui_char_taken->isChecked() && char_list.at(i).taken) + continue; + + if (!char_list.at(i).name.contains(ui_char_search->text(), Qt::CaseInsensitive)) + continue; + + // We only really need to update the fact that a character is taken + // for the buttons that actually appear. + // You'd also update the passwordedness and etc. here later. + current_char->reset(); + current_char->set_taken(char_list.at(i).taken); + + ui_char_button_list_filtered.append(current_char); + } + + current_char_page = 0; + set_char_select_page(); } -void Courtroom::on_char_search_changed() { filter_character_list(); } +void Courtroom::on_char_search_changed() +{ + filter_character_list(); +} -void Courtroom::on_char_passworded_clicked() { filter_character_list(); } +void Courtroom::on_char_passworded_clicked() +{ + filter_character_list(); +} -void Courtroom::on_char_taken_clicked() { filter_character_list(); } +void Courtroom::on_char_taken_clicked() +{ + filter_character_list(); +} diff --git a/src/chatlogpiece.cpp b/src/chatlogpiece.cpp index 9017b961..6c861f01 100644 --- a/src/chatlogpiece.cpp +++ b/src/chatlogpiece.cpp @@ -5,46 +5,58 @@ 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, int p_color) +chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song) { 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, int p_color, - QDateTime p_datetime) +chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime) { name = p_name; showname = p_showname; message = p_message; is_song = p_song; - color = p_color; 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; +} -bool chatlogpiece::get_is_song() { return is_song; } +QString chatlogpiece::get_datetime_as_string() +{ + return datetime.toString(); +} -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 11c0bdab..cd01f64b 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1,4487 +1,3605 @@ -#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); - - 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_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); - 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(); - 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(); - 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_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))); - - 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(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_custom_objection, - SIGNAL(customContextMenuRequested(const QPoint &)), this, - SLOT(ShowContextMenu(const QPoint &))); - 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->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_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_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) -{ - 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(); - } - - 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(); - - 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; - - 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)); - - 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); - - 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)) - 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; - } - } - 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(), - 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 - 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() && !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++) { - 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++) { - 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++) { - 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); - } // 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(); - // 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] == ""; - 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"); - 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(); - } - 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; - 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, 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, - 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, - shout_stay_time); - 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); - 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!"; - } - - 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_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(m_chatmessage[CHAR_NAME]); - - 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 (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->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() -{ - 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; - QString char_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; - ui_ic_chatlog->textCursor().insertHtml("" + 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]; - - 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 Courtroom::filter_ic_text(QString p_text, bool skip_filter, - int chat_color) -{ - // BMKCOMMENT - // 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. - 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; - 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 == "\\" && !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 == "{" || f_character == "}") && - !ic_next_is_not_special) { - p_text.remove(trick_check_pos, 1); - f_character = ""; - } - else if (f_character == "$" && !ic_next_is_not_special) { - p_text.remove(trick_check_pos, 1); - f_character = ""; - } - 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 == "|" && !ic_next_is_not_special) { - if (!ic_colour_stack.empty()) { - if (ic_colour_stack.top() == INLINE_ORANGE) { - ic_colour_stack.pop(); - p_text.remove(trick_check_pos, 1); - } - else { - ic_colour_stack.push(INLINE_ORANGE); - p_text.remove(trick_check_pos, 1); - } - } - else { - ic_colour_stack.push(INLINE_ORANGE); - p_text.remove(trick_check_pos, 1); - } - f_character = ""; - } - - // Blue inline colourisation. - 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 == ")" && !ic_next_is_not_special && - !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 { - ic_next_is_not_special = true; - } - } - - // Grey inline colourisation. - 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 == "]" && !ic_next_is_not_special && - !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 { - ic_next_is_not_special = true; - } - } - - // Green inline colourisation. - 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(); - p_text.remove(trick_check_pos, 1); - } - else { - ic_colour_stack.push(INLINE_GREEN); - p_text.remove(trick_check_pos, 1); - } - } - else { - ic_colour_stack.push(INLINE_GREEN); - p_text.remove(trick_check_pos, 1); - } - f_character = ""; - } - - 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 - * \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, - 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(); - - 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); - 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); - - 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 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 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) { - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); - ui_ic_chatlog->textCursor().removeSelectedText(); - ui_ic_chatlog->textCursor().deleteChar(); - // qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << - // log_maximum_blocks; - } - - if (old_cursor.hasSelection() || !is_scrolled_down) { - // The user has selected text or scrolled away from the bottom: maintain - // position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); - } - else { - // The user hasn't selected any text and the scrollbar is at the bottom: - // scroll to the bottom. - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->verticalScrollBar()->setValue( - ui_ic_chatlog->verticalScrollBar()->maximum()); - } - } - 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) { - 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); - } - 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; - } - - if (old_cursor.hasSelection() || !is_scrolled_up) { - // The user has selected text or scrolled away from the top: maintain - // position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); - } - else { - // The user hasn't selected any text and the scrollbar is at the top: - // scroll to the top. - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->verticalScrollBar()->setValue( - ui_ic_chatlog->verticalScrollBar()->minimum()); - } - } -} - -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; - 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(); - } - 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; - 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); - - 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]; - - // 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]; - 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; - - // 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; - 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(f_char, m_chatmessage[EMOTE]); - } - } - - else { - QString f_character = f_message.at(tick_pos); - - f_character = f_character.toHtmlEscaped(); - if (punctuation_chars.contains(f_character)) { - 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); - } - - if (f_character == " ") { - ui_vp_message->insertPlainText(" "); - if (mirror_iclog) - ui_ic_chatlog->insertPlainText(" "); - } - else if (f_character == "@" && !next_character_is_not_special) { - this->doScreenShake(); - formatting_char = true; - } - - else if (f_character == "^" && !next_character_is_not_special) { - this->doRealization(); - - formatting_char = true; - } - // Escape character. - 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 == "{" && !next_character_is_not_special) { - // ++, because it INCREASES delay! - current_display_speed++; - msg_delay++; - formatting_char = true; - } - else if (f_character == "}" && !next_character_is_not_special) { - current_display_speed--; - msg_delay++; - formatting_char = true; - } - - else if (f_character == "@" && !next_character_is_not_special) { - this->doScreenShake(); - formatting_char = true; - } - - else if (f_character == "$" && !next_character_is_not_special) { - this->doRealization(); - formatting_char = true; - } - - // Orange inline colourisation. - 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(); - } - else { - inline_colour_stack.push(INLINE_ORANGE); - } - } - else { - inline_colour_stack.push(INLINE_ORANGE); - } - formatting_char = true; - msg_delay++; - } - - // Blue inline colourisation. - else if (f_character == "(" && - !next_character_is_not_special) // EXAMPLE HERE - { - inline_colour_stack.push(INLINE_BLUE); - 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 && 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 == ")" && !next_character_is_not_special && - !inline_colour_stack.empty()) { - if (inline_colour_stack.top() == INLINE_BLUE) { - inline_colour_stack.pop(); - 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) { - 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 && anim_state != 4 && - !(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 { - next_character_is_not_special = true; - tick_pos--; - } - } - - // Grey inline colourisation. - else if (f_character == "[" && !next_character_is_not_special) { - inline_colour_stack.push(INLINE_GREY); - ui_vp_message->insertHtml("" + - f_character + ""); - if (mirror_iclog && colorf_iclog) - ui_ic_chatlog->insertHtml("" + f_character + ""); - } - else if (f_character == "]" && !next_character_is_not_special && - !inline_colour_stack.empty()) { - if (inline_colour_stack.top() == INLINE_GREY) { - inline_colour_stack.pop(); - 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 == "`" && !next_character_is_not_special) { - if (!inline_colour_stack.empty()) { - if (inline_colour_stack.top() == INLINE_GREEN) { - inline_colour_stack.pop(); - } - else { - inline_colour_stack.push(INLINE_GREEN); - } - } - else { - inline_colour_stack.push(INLINE_GREEN); - } - msg_delay++; - formatting_char = true; - } - else { - - next_character_is_not_special = false; - if (!inline_colour_stack.empty()) { - switch (inline_colour_stack.top()) { - case INLINE_ORANGE: - 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 + ""); - if (mirror_iclog && colorf_iclog) - ui_ic_chatlog->insertHtml( - "" + - f_character + ""); - break; - case INLINE_GREEN: - 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 + ""); - if (mirror_iclog && colorf_iclog) - ui_ic_chatlog->insertHtml("" + f_character + ""); - break; - } - } - else { - if (m_chatmessage[TEXT_COLOR].toInt() == RAINBOW) { - 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; - - 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 + ""); - } - } - - if (mirror_iclog && !colorf_iclog) { - ui_ic_chatlog->textCursor().insertHtml(f_character); - } - if (message_is_centered) { - 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"; - - 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; - - // Restart the timer, but according to the newly set speeds, if there were - // any. Keep the speed at bay. - if (current_display_speed < 0) { - current_display_speed = 0; - } - - if (current_display_speed > 6) { - current_display_speed = 6; - } - if (formatting_char) { - 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"; - } - 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_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() -{ - 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) -{ - 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); - - 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; - } - } - 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) { - 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. - { - 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") { - 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 - else if (p_wtce == "testimony2") { - 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")); - 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", "", "", 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(); - 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(); - 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; - 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() == "") { - ui_music_list->collapseAll(); - } -} - -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; - - 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); - } -} - -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(); -} - -void Courtroom::ShowContextMenu(const QPoint &pos) -{ - 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"); - } - 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(); - 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(); - 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() -{ - - 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() -{ - - 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 { - 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; -} - -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()); - } - } -} - -#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 +#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; + } + } + } + #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); + + testimony_show_timer = new QTimer(this); + testimony_show_timer->setSingleShot(true); + + testimony_hide_timer = new QTimer(this); + testimony_hide_timer->setSingleShot(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); + + 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_sideplayer_char = new AOCharMovie(ui_viewport, ao_app); + 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 AOImage(this, ao_app); + ui_vp_realization = new AOImage(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_area_list->hide(); + ui_music_list = new QListWidget(this); + + 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_name = new QLineEdit(this); + ui_ooc_chat_name->setFrame(false); + ui_ooc_chat_name->setPlaceholderText("Name"); + ui_ooc_chat_name->setMaxLength(30); + ui_ooc_chat_name->setText(p_ao_app->get_default_username()); + + //ui_area_password = new QLineEdit(this); + //ui_area_password->setFrame(false); + ui_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("Pre"); + + ui_flip = new QCheckBox(this); + ui_flip->setText("Flip"); + ui_flip->hide(); + + ui_guard = new QCheckBox(this); + ui_guard->setText("Guard"); + 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_realization = 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("White"); + ui_text_color->addItem("Green"); + ui_text_color->addItem("Red"); + ui_text_color->addItem("Orange"); + ui_text_color->addItem("Blue"); + ui_text_color->addItem("Yellow"); + ui_text_color->addItem("Rainbow"); + ui_text_color->addItem("Pink"); + ui_text_color->addItem("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("% 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(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_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_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_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(); +} + +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->resize(ui_viewport->width(), ui_viewport->height()); + ui_vp_testimony->set_image("testimony.png"); + ui_vp_testimony->hide(); + + 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_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);"); + + 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("Music"); + set_size_and_pos(ui_sfx_label, "sfx_label"); + ui_sfx_label->setText("Sfx"); + set_size_and_pos(ui_blip_label, "blip_label"); + ui_blip_label->setText("Blips"); + + set_size_and_pos(ui_log_limit_label, "log_limit_label"); + ui_log_limit_label->setText("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"); + ui_ooc_toggle->setText("Server"); + + 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"); + ui_change_character->setText("Change character"); + + set_size_and_pos(ui_reload_theme, "reload_theme"); + ui_reload_theme->setText("Reload theme"); + + set_size_and_pos(ui_call_mod, "call_mod"); + ui_call_mod->setText("Call mod"); + + set_size_and_pos(ui_settings, "settings"); + ui_settings->setText("Settings"); + + set_size_and_pos(ui_announce_casing, "casing_button"); + ui_announce_casing->setText("Casing"); + + set_size_and_pos(ui_switch_area_music, "switch_area_music"); + ui_switch_area_music->setText("A/M"); + + set_size_and_pos(ui_pre, "pre"); + ui_pre->setText("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_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("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, "music_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); + } +} + +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) +{ + testimony_in_progress = false; + + 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::enter_courtroom(int p_cid) +{ + m_cid = p_cid; + + 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(); + + current_evidence_page = 0; + current_evidence = 0; + + set_evidence_page(); + + QString side = ao_app->get_char_side(f_char); + + 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 && + (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(); + + 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()); + blip_player->set_volume(ui_blip_slider->value()); + + testimony_in_progress = false; + + 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(); + music_row_to_number.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; + + for (int n_song = 0 ; n_song < music_list.size() ; ++n_song) + { + QString i_song = music_list.at(n_song); + QString i_song_listname = i_song; + i_song_listname = i_song_listname.left(i_song_listname.lastIndexOf(".")); + + if (i_song.toLower().contains(ui_music_search->text().toLower())) + { + ui_music_list->addItem(i_song_listname); + music_row_to_number.append(n_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); + else + ui_music_list->item(n_listed_songs)->setBackground(missing_brush); + + ++n_listed_songs; + } + } +} + +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(); + + ui_server_chatlog->append_chatmessage(p_name, p_message, colour); +} + +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 = 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 + 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"); + } + } + + 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(); + 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; + realization_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_evidence_present->set_image("present_disabled.png"); + } + + chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false); + ic_chatlog_history.append(*temp); + + while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) + { + ic_chatlog_history.removeFirst(); + } + + append_ic_text(": " + m_chatmessage[MESSAGE], f_showname); + + previous_ic_message = f_message; + + int objection_mod = m_chatmessage[OBJECTION_MOD].toInt(); + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_custom_theme = ao_app->get_char_shouts(f_char); + + //if an objection is used + if (objection_mod <= 4 && objection_mod >= 1) + { + switch (objection_mod) + { + case 1: + ui_vp_objection->play("holdit", f_char, f_custom_theme); + objection_player->play("holdit.wav", f_char, f_custom_theme); + break; + case 2: + ui_vp_objection->play("objection", f_char, f_custom_theme); + objection_player->play("objection.wav", f_char, f_custom_theme); + break; + case 3: + ui_vp_objection->play("takethat", f_char, f_custom_theme); + objection_player->play("takethat.wav", f_char, f_custom_theme); + break; + //case 4 is AO2 only + case 4: + ui_vp_objection->play("custom", 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(); + ui_vp_player_char->stop(); + + if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) + { + QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; + + QString f_showname = ao_app->get_showname(real_name); + + ui_vp_showname->setText(f_showname); + } + else + { + 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]); + + if (chatbox == "") + ui_vp_chatbox->set_image("chatmed.png"); + else + { + QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png"; + ui_vp_chatbox->set_image_from_path(chatbox_path); + } + + ui_vp_showname->setStyleSheet("QLabel { color : " + get_text_color("_showname").name() + "; }"); + + 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]; + + // 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]); + } + else + { + // If the server understands other characters, but there + // really is no second character, hide 'em, and center the first. + ui_vp_sideplayer_char->hide(); + ui_vp_sideplayer_char->move(0,0); + + ui_vp_player_char->move(0,0); + } + } + } + + 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::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(); + QString 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 Courtroom::filter_ic_text(QString p_text) +{ + // Get rid of centering. + if(p_text.startsWith(": ~~")) + { + // Don't forget, the p_text part actually everything after the name! + // Hence why we check for ': ~~'. + + // 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 = 0; + 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()) + { + f_character = p_text.at(trick_check_pos); + + // Escape character. + if (f_character == "\\" and !ic_next_is_not_special) + { + ic_next_is_not_special = true; + p_text.remove(trick_check_pos,1); + } + + // Text speed modifier. + else if (f_character == "{" and !ic_next_is_not_special) + { + p_text.remove(trick_check_pos,1); + } + else if (f_character == "}" and !ic_next_is_not_special) + { + p_text.remove(trick_check_pos,1); + } + + // Orange inline colourisation. + else if (f_character == "|" and !ic_next_is_not_special) + { + if (!ic_colour_stack.empty()) + { + if (ic_colour_stack.top() == INLINE_ORANGE) + { + ic_colour_stack.pop(); + p_text.remove(trick_check_pos,1); + } + else + { + ic_colour_stack.push(INLINE_ORANGE); + p_text.remove(trick_check_pos,1); + } + } + else + { + ic_colour_stack.push(INLINE_ORANGE); + p_text.remove(trick_check_pos,1); + } + } + + // Blue inline colourisation. + else if (f_character == "(" and !ic_next_is_not_special) + { + ic_colour_stack.push(INLINE_BLUE); + trick_check_pos++; + } + else if (f_character == ")" and !ic_next_is_not_special + and !ic_colour_stack.empty()) + { + if (ic_colour_stack.top() == INLINE_BLUE) + { + ic_colour_stack.pop(); + trick_check_pos++; + } + else + { + ic_next_is_not_special = true; + } + } + + // Grey inline colourisation. + else if (f_character == "[" and !ic_next_is_not_special) + { + ic_colour_stack.push(INLINE_GREY); + trick_check_pos++; + } + else if (f_character == "]" and !ic_next_is_not_special + and !ic_colour_stack.empty()) + { + if (ic_colour_stack.top() == INLINE_GREY) + { + ic_colour_stack.pop(); + trick_check_pos++; + } + else + { + ic_next_is_not_special = true; + } + } + + // Green inline colourisation. + else if (f_character == "`" and !ic_next_is_not_special) + { + if (!ic_colour_stack.empty()) + { + if (ic_colour_stack.top() == INLINE_GREEN) + { + ic_colour_stack.pop(); + p_text.remove(trick_check_pos,1); + } + else + { + ic_colour_stack.push(INLINE_GREEN); + p_text.remove(trick_check_pos,1); + } + } + else + { + ic_colour_stack.push(INLINE_GREEN); + p_text.remove(trick_check_pos,1); + } + } + else + { + trick_check_pos++; + ic_next_is_not_special = false; + } + } + + return p_text; +} + +void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchange) +{ + 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) + p_text = filter_ic_text(p_text); + + if (log_goes_downwards) + { + const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); + + ui_ic_chatlog->moveCursor(QTextCursor::End); + + if (!first_message_sent) + { + ui_ic_chatlog->textCursor().insertText(p_name, bold); + first_message_sent = true; + } + else + { + ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); + } + + if (is_songchange) + { + ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + ".", italics); + } + else + { + ui_ic_chatlog->textCursor().insertText(p_text, normal); + } + + // If we got too many blocks in the current log, delete some from the top. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) + { + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deleteChar(); + //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; + } + + if (old_cursor.hasSelection() || !is_scrolled_down) + { + // The user has selected text or scrolled away from the bottom: maintain position. + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } + else + { + // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom. + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); + } + } + else + { + const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); + + ui_ic_chatlog->moveCursor(QTextCursor::Start); + + ui_ic_chatlog->textCursor().insertText(p_name, bold); + + if (is_songchange) + { + ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics); + } + else + { + ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); + } + + // If we got too many blocks in the current log, delete some from the bottom. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) + { + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deletePreviousChar(); + //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; + } + + if (old_cursor.hasSelection() || !is_scrolled_up) + { + // The user has selected text or scrolled away from the top: maintain position. + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } + else + { + // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); + } + } +} + +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; + + int preanim_duration; + + if (ao2_duration < 0) + preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim); + else + preanim_duration = ao2_duration; + + sfx_delay_timer->start(sfx_delay); + QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim)); + if (!file_exists(anim_to_find) || + preanim_duration < 0) + { + 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::realization_done() +{ + ui_vp_realization->hide(); +} + +void Courtroom::start_chat_ticking() +{ + //we need to ensure that the text isn't already ticking because this function can be called by two logic paths + if (text_state != 0) + return; + + if (m_chatmessage[REALIZATION] == "1") + { + realization_timer->start(60); + ui_vp_realization->show(); + sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); + } + + 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_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]); + + 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 f_message = m_chatmessage[MESSAGE]; + f_message.remove(0, tick_pos); + + // Due to our new text speed system, we always need to stop the timer now. + chat_tick_timer->stop(); + + // 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); + } + + if (f_message.size() == 0) + { + text_state = 2; + if (anim_state != 4) + { + anim_state = 3; + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + } + } + + else + { + QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_message); + QString f_character; + int f_char_length; + + tbf.toNextBoundary(); + + if (tbf.position() == -1) + f_character = f_message; + else + f_character = f_message.left(tbf.position()); + + f_char_length = f_character.length(); + f_character = f_character.toHtmlEscaped(); + + + if (f_character == " ") + ui_vp_message->insertPlainText(" "); + + // Escape character. + else if (f_character == "\\" and !next_character_is_not_special) + { + next_character_is_not_special = true; + formatting_char = true; + } + + // Text speed modifier. + else if (f_character == "{" and !next_character_is_not_special) + { + // ++, because it INCREASES delay! + current_display_speed++; + formatting_char = true; + } + else if (f_character == "}" and !next_character_is_not_special) + { + current_display_speed--; + formatting_char = true; + } + + // Orange inline colourisation. + else if (f_character == "|" and !next_character_is_not_special) + { + if (!inline_colour_stack.empty()) + { + if (inline_colour_stack.top() == INLINE_ORANGE) + { + inline_colour_stack.pop(); + } + else + { + inline_colour_stack.push(INLINE_ORANGE); + } + } + else + { + inline_colour_stack.push(INLINE_ORANGE); + } + formatting_char = true; + } + + // Blue inline colourisation. + else if (f_character == "(" and !next_character_is_not_special) + { + inline_colour_stack.push(INLINE_BLUE); + ui_vp_message->insertHtml("" + 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]; + QString f_emote = m_chatmessage[EMOTE]; + ui_vp_player_char->play_idle(f_char, f_emote); + } + } + else if (f_character == ")" and !next_character_is_not_special + and !inline_colour_stack.empty()) + { + if (inline_colour_stack.top() == INLINE_BLUE) + { + inline_colour_stack.pop(); + ui_vp_message->insertHtml("" + 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) + { + inline_blue_depth--; + // Here, we check if the entire message is blue. + // If it isn't, we start talking if we have completely climbed out of inline blues. + if (!entire_message_is_blue) + { + // We should only go back to talking if we're out of inline blues, not during a non. int. pre, and not on the last character. + if (inline_blue_depth == 0 and anim_state != 4 and !(tick_pos+1 >= f_message.size())) + { + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_emote = m_chatmessage[EMOTE]; + ui_vp_player_char->play_talking(f_char, f_emote); + } + } + } + } + else + { + next_character_is_not_special = true; + tick_pos -= f_char_length; + } + } + + // Grey inline colourisation. + 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) + { + inline_colour_stack.pop(); + ui_vp_message->insertHtml("" + f_character + ""); + } + else + { + next_character_is_not_special = true; + tick_pos -= f_char_length; + } + } + + // Green inline colourisation. + else if (f_character == "`" and !next_character_is_not_special) + { + if (!inline_colour_stack.empty()) + { + if (inline_colour_stack.top() == INLINE_GREEN) + { + inline_colour_stack.pop(); + formatting_char = true; + } + else + { + inline_colour_stack.push(INLINE_GREEN); + formatting_char = true; + } + } + else + { + inline_colour_stack.push(INLINE_GREEN); + formatting_char = true; + } + } + else + { + next_character_is_not_special = false; + if (!inline_colour_stack.empty()) + { + switch (inline_colour_stack.top()) { + case INLINE_ORANGE: + ui_vp_message->insertHtml("" + f_character + ""); + break; + case INLINE_BLUE: + ui_vp_message->insertHtml("" + f_character + ""); + break; + case INLINE_GREEN: + ui_vp_message->insertHtml("" + f_character + ""); + break; + case INLINE_GREY: + ui_vp_message->insertHtml("" + f_character + ""); + break; + } + } + else + { + if (m_chatmessage[TEXT_COLOR].toInt() == RAINBOW) + { + 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; + + ui_vp_message->insertHtml("" + f_character + ""); + } + else + ui_vp_message->insertHtml(f_character); + } + + if (message_is_centered) + { + 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"; + + if (f_character != ' ' || blank_blip) + { + + if (blip_pos % blip_rate == 0 && !formatting_char) + { + blip_pos = 0; + blip_player->blip_tick(); + } + + ++blip_pos; + } + + tick_pos += f_char_length; + + // Restart the timer, but according to the newly set speeds, if there were any. + // Keep the speed at bay. + if (current_display_speed < 0) + { + current_display_speed = 0; + } + + if (current_display_speed > 6) + { + current_display_speed = 6; + } + + // If we had a formatting char, we shouldn't wait so long again, as it won't appear! + if (formatting_char) + { + chat_tick_timer->start(1); + } + 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); +} + +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() +{ + if (testimony_in_progress) + show_testimony(); + + //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_background_path("jurystand.png")) || + file_exists(ao_app->get_background_path("jurystand.gif")))) + { + f_background = "jurystand"; + f_desk_image = "jurydesk"; + } + else if (f_side == "sea" && (file_exists(ao_app->get_background_path("seancestand.png")) || + file_exists(ao_app->get_background_path("seancestand.gif")))) + { + 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() +{ + QColor textcolor = ao_app->get_chat_color(m_chatmessage[TEXT_COLOR], ao_app->get_chat(m_chatmessage[CHAR_NAME])); + + ui_vp_message->setTextBackgroundColor(QColor(0,0,0,0)); + ui_vp_message->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) +{ + return ao_app->get_chat_color(color, ao_app->get_chat(m_chatmessage[CHAR_NAME])); +} + +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("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; + f_song_clear = f_song_clear.left(f_song_clear.lastIndexOf(".")); + int n_char = f_contents.at(1).toInt(); + + if (n_char < 0 || n_char >= char_list.size()) + { + music_player->play(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) + { + str_show = p_contents->at(2); + } + + if (!mute_map.value(n_char)) + { + chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true); + ic_chatlog_history.append(*temp); + + while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) + { + ic_chatlog_history.removeFirst(); + } + + append_ic_text(f_song_clear, str_show, true); + music_player->play(f_song); + } + } +} + +void Courtroom::handle_wtce(QString p_wtce, int variant) +{ + QString sfx_file = "courtroom_sounds.ini"; + + //witness testimony + if (p_wtce == "testimony1") + { + sfx_player->play(ao_app->get_sfx("witness_testimony")); + ui_vp_wtce->play("witnesstestimony"); + testimony_in_progress = true; + show_testimony(); + } + //cross examination + else if (p_wtce == "testimony2") + { + sfx_player->play(ao_app->get_sfx("cross_examination")); + ui_vp_wtce->play("crossexamination"); + testimony_in_progress = false; + } + else if (p_wtce == "judgeruling") + { + if (variant == 0) + { + sfx_player->play(ao_app->get_sfx("not_guilty")); + ui_vp_wtce->play("notguilty"); + testimony_in_progress = false; + } + else if (variant == 1) { + sfx_player->play(ao_app->get_sfx("guilty")); + ui_vp_wtce->play("guilty"); + testimony_in_progress = false; + } + } +} + +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) +{ + if (ui_casing->isChecked()) + { + ui_server_chatlog->append(msg); + if ((ao_app->get_casing_defence_enabled() && def) || + (ao_app->get_casing_prosecution_enabled() && pro) || + (ao_app->get_casing_judge_enabled() && jud) || + (ao_app->get_casing_juror_enabled() && jur) || + (ao_app->get_casing_steno_enabled() && steno)) + { + modcall_player->play(ao_app->get_sfx("case_call")); + ao_app->alert(this); + } + } +} + +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", "You were granted the Guard button.", "1"); + } + else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended) + { + //ui_text_color->addItem("Rainbow"); + ui_ooc_chat_message->clear(); + //rainbow_appended = true; + append_server_chatmessage("CLIENT", "This does nohing, 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", "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 = "You will now pair up with "; + msg.append(char_list.at(whom).name); + msg.append(" if they also choose your character in return."); + append_server_chatmessage("CLIENT", msg, "1"); + } + else + { + other_charid = -1; + append_server_chatmessage("CLIENT", "You are no longer paired with anyone.", "1"); + } + } + else + { + append_server_chatmessage("CLIENT", "Are you sure you typed that well? The char ID could not be recognised.", "1"); + } + 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 = "You have set your offset to "; + msg.append(QString::number(off)); + msg.append("%."); + append_server_chatmessage("CLIENT", msg, "1"); + } + else + { + append_server_chatmessage("CLIENT", "Your offset must be between -100% and 100%!", "1"); + } + } + else + { + append_server_chatmessage("CLIENT", "That offset does not look like one.", "1"); + } + return; + } + else if (ooc_message.startsWith("/switch_am")) + { + append_server_chatmessage("CLIENT", "You switched your music and area list.", "1"); + on_switch_area_music_clicked(); + ui_ooc_chat_message->clear(); + return; + } + else if (ooc_message.startsWith("/enable_blocks")) + { + append_server_chatmessage("CLIENT", "You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this.", "1"); + ao_app->cccc_ic_support_enabled = true; + ao_app->arup_enabled = true; + ao_app->modcall_reason_enabled = true; + 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", "Your pre-animations interrupt again.", "1"); + else + append_server_chatmessage("CLIENT", "Your pre-animations will not interrupt text.", "1"); + ui_pre_non_interrupt->setChecked(!ui_pre_non_interrupt->isChecked()); + ui_ooc_chat_message->clear(); + return; + } + else if (ooc_message.startsWith("/save_chatlog")) + { + QFile file("chatlog.txt"); + + if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) + { + append_server_chatmessage("CLIENT", "Couldn't open chatlog.txt to write into.", "1"); + 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", "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", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there.", "1"); + ui_ooc_chat_message->clear(); + return; + } + QStringList caseslist = casefolder.entryList(); + caseslist.removeOne("."); + caseslist.removeOne(".."); + caseslist.replaceInStrings(".ini",""); + + if (command.size() < 2) + { + append_server_chatmessage("CLIENT", "You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini.\nCases you can load: " + caseslist.join(", "), "1"); + ui_ooc_chat_message->clear(); + return; + } + + + if (command.size() > 2) + { + append_server_chatmessage("CLIENT", "Too many arguments to load a case! You only need one filename, without extension.", "1"); + 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", "Case made by " + 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", "Navigate to " + cmdoc + " for the CM doc.", "1"); + + for (int i = local_evidence_list.size() - 1; i >= 0; i--) { + ao_app->send_server_packet(new AOPacket("DE#" + QString::number(i) + "#%")); + } + + 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", "Your case \"" + command[1] + "\" was loaded!", "1"); + ui_ooc_chat_message->clear(); + return; + } + else if(ooc_message.startsWith("/save_case")) + { + QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); + + QDir casefolder("base/cases"); + if (!casefolder.exists()) + { + QDir::current().mkdir("base/" + casefolder.dirName()); + append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it.", "1"); + ui_ooc_chat_message->clear(); + return; + } + QStringList caseslist = casefolder.entryList(); + caseslist.removeOne("."); + caseslist.removeOne(".."); + caseslist.replaceInStrings(".ini",""); + + if (command.size() < 3) + { + append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!", "1"); + ui_ooc_chat_message->clear(); + return; + } + + + if (command.size() > 3) + { + append_server_chatmessage("CLIENT", "Too many arguments to save a case! You only need a filename without extension and the courtroom status!", "1"); + ui_ooc_chat_message->clear(); + return; + } + QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat); + casefile.setValue("author",ui_ooc_chat_name->text()); + casefile.setValue("cmdoc",""); + casefile.setValue("doc", ""); + casefile.setValue("status",command[2]); + casefile.sync(); + for(int i = local_evidence_list.size() - 1; i >= 0; i--) + { + QString clean_evidence_dsc = local_evidence_list[i].description.replace(QRegularExpression("..."), ""); + clean_evidence_dsc = clean_evidence_dsc.replace(clean_evidence_dsc.lastIndexOf(">"), 1, ""); + casefile.beginGroup(QString::number(i)); + casefile.sync(); + casefile.setValue("name",local_evidence_list[i].name); + casefile.setValue("description",local_evidence_list[i].description); + casefile.setValue("image",local_evidence_list[i].image); + casefile.endGroup(); + } + casefile.sync(); + append_server_chatmessage("CLIENT", "Succesfully saved, edit doc and cmdoc link on the ini!", "1"); + ui_ooc_chat_message->clear(); + return; + + } + + QStringList packet_contents; + 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("Master"); + + server_ooc = false; + } + else + { + ui_ms_chatlog->hide(); + ui_server_chatlog->show(); + ui_ooc_toggle->setText("Server"); + + server_ooc = true; + } +} + +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 > 5) + 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; + 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(QModelIndex p_model) +{ + 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); + } + 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; + } + 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::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_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); + 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(); + + //to update status on the background + set_background(current_background); + 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() +{ + enter_courtroom(-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("Reason:"); + input.setWindowTitle("Call Moderator"); + auto code = input.exec(); + + if (code != QDialog::Accepted) + return; + + QString text = input.textValue(); + if (text.isEmpty()) { + errorBox.critical(nullptr, "Error", "You must provide a reason."); + return; + } else if (text.length() > 256) { + errorBox.critical(nullptr, "Error", "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() +{ + 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()); + } + } + + 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()) + { + ui_area_list->show(); + ui_music_list->hide(); + } + else + { + ui_area_list->hide(); + ui_music_list->show(); + } +} + +void Courtroom::ping_server() +{ + ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%")); +} + +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())); + + 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#%")); + } +} + +void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno) +{ + 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)); + + ao_app->send_server_packet(new AOPacket("CASEA", f_packet)); + } +} + +Courtroom::~Courtroom() +{ + delete music_player; + delete sfx_player; + delete objection_player; + delete blip_player; +} + + +#if (defined (_WIN32) || defined (_WIN64)) +void Courtroom::load_bass_opus_plugin() +{ + #ifdef BASSAUDIO + BASS_PluginLoad("bassopus.dll", 0); + #endif +} +#elif (defined (LINUX) || defined (__linux__)) +void Courtroom::load_bass_opus_plugin() +{ + #ifdef BASSAUDIO + BASS_PluginLoad("libbassopus.so", 0); + #endif +} +#elif defined __APPLE__ +void Courtroom::load_bass_opus_plugin() +{ + QString libpath = ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib"; + QByteArray ba = libpath.toLocal8Bit(); + #ifdef BASSAUDIO + BASS_PluginLoad(ba.data(), 0); + #endif +} +#else +#error This operating system is unsupported for bass plugins. +#endif diff --git a/src/debug_functions.cpp b/src/debug_functions.cpp index 6186b9da..77f2f35a 100644 --- a/src/debug_functions.cpp +++ b/src/debug_functions.cpp @@ -1,18 +1,14 @@ -#include -#include - #include "debug_functions.h" 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("Error: " + p_message); + msgBox->setWindowTitle("Error"); + - // msgBox->setWindowModality(Qt::NonModal); + //msgBox->setWindowModality(Qt::NonModal); msgBox->exec(); } @@ -21,10 +17,9 @@ void call_notice(QString p_message) QMessageBox *msgBox = new QMessageBox; msgBox->setText(p_message); + msgBox->setWindowTitle("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 aea07e5e..95a824a1 100644 --- a/src/discord_rich_presence.cpp +++ b/src/discord_rich_presence.cpp @@ -8,18 +8,23 @@ 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() { @@ -59,12 +64,10 @@ 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)); @@ -98,11 +101,20 @@ 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) { @@ -117,6 +129,7 @@ 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 bbe2f5c9..b6a217e6 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -8,8 +8,7 @@ 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(); @@ -19,14 +18,13 @@ 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; @@ -36,12 +34,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; } @@ -58,20 +56,23 @@ 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; @@ -82,7 +83,8 @@ 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); @@ -93,6 +95,7 @@ void Courtroom::set_emote_page() f_emote->show(); } + } void Courtroom::set_emote_dropdown() @@ -102,7 +105,8 @@ 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)); } @@ -115,20 +119,19 @@ 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 6669fe15..ffbe0cdb 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,7 +14,8 @@ 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; @@ -22,7 +23,8 @@ 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); } @@ -37,8 +39,9 @@ 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); } @@ -48,11 +51,13 @@ 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 502fae76..ebef7490 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)); @@ -22,7 +22,7 @@ void Courtroom::construct_evidence() ui_evidence_delete = new AOButton(ui_evidence_overlay, ao_app); ui_evidence_image_name = new AOLineEdit(ui_evidence_overlay); ui_evidence_image_button = new AOButton(ui_evidence_overlay, ao_app); - ui_evidence_image_button->setText(tr("Choose...")); + ui_evidence_image_button->setText("Choose.."); ui_evidence_x = new AOButton(ui_evidence_overlay, ao_app); ui_evidence_description = new AOTextEdit(ui_evidence_overlay); @@ -32,8 +32,7 @@ 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(); @@ -43,57 +42,43 @@ 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(); } @@ -113,23 +98,26 @@ 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; @@ -140,19 +128,17 @@ 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); @@ -212,7 +198,7 @@ void Courtroom::on_evidence_image_button_clicked() QStringList filenames; if (dialog.exec()) - filenames = dialog.selectedFiles(); + filenames = dialog.selectedFiles(); if (filenames.size() != 1) return; @@ -229,9 +215,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()) @@ -247,6 +233,7 @@ 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) @@ -275,9 +262,10 @@ 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...")); + ui_evidence_name->setText("Add new evidence..."); else if (final_id < local_evidence_list.size()) ui_evidence_name->setText(local_evidence_list.at(final_id).name); } @@ -322,8 +310,7 @@ 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; @@ -351,3 +338,4 @@ void Courtroom::on_evidence_x_clicked() ui_ic_chat_message->setFocus(); } + diff --git a/src/file_functions.cpp b/src/file_functions.cpp index e64a46bf..f93ee15d 100644 --- a/src/file_functions.cpp +++ b/src/file_functions.cpp @@ -14,8 +14,7 @@ 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 96c72eb5..5d6b6ffa 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,18 +10,17 @@ 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 @@ -34,10 +33,12 @@ 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) @@ -49,30 +50,10 @@ QString get_hdid() } #elif defined __APPLE__ -#include -#include - 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; - } - - IOObjectRelease(platformExpert); - } - return hdid; + //hdids are broken at this point anyways + return "just a mac passing by"; } #else diff --git a/src/hex_functions.cpp b/src/hex_functions.cpp index 1e35718f..4a58d2b4 100644 --- a/src/hex_functions.cpp +++ b/src/hex_functions.cpp @@ -1,17 +1,18 @@ #include "hex_functions.h" -namespace omni { -std::string int_to_hex(unsigned int input) +namespace omni { - if (input > 255) - return "FF"; + std::string int_to_hex(unsigned int input) + { + if (input > 255) + return "FF"; - std::stringstream stream; - stream << std::setfill('0') << std::setw(sizeof(char) * 2) << std::hex - << input; - 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 853b6ae7..4a96e567 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -1,403 +1,388 @@ -#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:
" - "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, 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) -{ - 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() {} +#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("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("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_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 " << filename; + + // Most common symptom of bad config files and missing assets. + call_notice("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("Version: " + 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("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("Loading"); + + set_size_and_pos(ui_progress_bar, "progress_bar"); + set_size_and_pos(ui_cancel, "cancel"); + ui_cancel->setText("Cancel"); + + ui_loading_background->hide(); + +} + +void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier) +{ + QString filename = "lobby_design.ini"; + + pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); + + 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:
" + "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter" + "

Special thanks:
" + "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), " + "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " + "Noevain, Cronnicossy") + .arg(ao_app->get_version_string()); + QMessageBox::about(this, "About", msg); +} + +void Lobby::on_server_list_clicked(QModelIndex p_model) +{ + server_type f_server; + 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("Offline"); + + ui_connect->setEnabled(false); + + ao_app->net_manager->connect_to_server(f_server); +} + +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()); +} + +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 = "Online: " + QString::number(players_online) + "/" + 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 1b105c34..80ea93bb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,44 +1,24 @@ + #include "aoapplication.h" -#include "courtroom.h" #include "datatypes.h" -#include "lobby.h" #include "networkmanager.h" -#include -#include +#include "lobby.h" +#include "courtroom.h" #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); - - 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(); - - 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); - - main_app.construct_lobby(); - main_app.w_lobby->show(); - main_app.net_manager->connect_to_master(); - return main_app.exec(); + AOApplication main_app(argc, argv); + main_app.construct_lobby(); + main_app.net_manager->connect_to_master(); + main_app.w_lobby->show(); + return main_app.exec(); } diff --git a/src/misc_functions.cpp b/src/misc_functions.cpp index cc144153..23520551 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 cf89d0ab..a9810d49 100644 --- a/src/networkmanager.cpp +++ b/src/networkmanager.cpp @@ -13,23 +13,21 @@ NetworkManager::NetworkManager(AOApplication *parent) : QObject(parent) ms_reconnect_timer = new QTimer(this); ms_reconnect_timer->setSingleShot(true); - QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, - SLOT(retry_ms_connect())); - - QObject::connect(ms_socket, SIGNAL(readyRead()), this, - SLOT(handle_ms_packet())); - QObject::connect(server_socket, SIGNAL(readyRead()), this, - SLOT(handle_server_packet())); - QObject::connect(server_socket, SIGNAL(disconnected()), ao_app, - SLOT(server_disconnected())); - - QString master_config = - ao_app->configini->value("master", "").value(); + QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, SLOT(retry_ms_connect())); + + QObject::connect(ms_socket, SIGNAL(readyRead()), this, SLOT(handle_ms_packet())); + QObject::connect(server_socket, SIGNAL(readyRead()), this, SLOT(handle_server_packet())); + QObject::connect(server_socket, SIGNAL(disconnected()), ao_app, SLOT(server_disconnected())); + + QString master_config = ao_app->configini->value("master", "").value(); if (master_config != "") ms_nosrv_hostname = master_config; } -NetworkManager::~NetworkManager() {} +NetworkManager::~NetworkManager() +{ + +} void NetworkManager::connect_to_master() { @@ -45,11 +43,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); } @@ -63,10 +61,12 @@ 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,86 +81,93 @@ void NetworkManager::handle_ms_packet() QByteArray buffer = ms_socket->readAll(); QString in_data = QString::fromUtf8(buffer, buffer.size()); - if (!in_data.endsWith("%")) { + if (!in_data.endsWith("%")) + { ms_partial_packet = true; ms_temp_packet += in_data; return; } - else { - if (ms_partial_packet) { + else + { + if (ms_partial_packet) + { in_data = ms_temp_packet + in_data; ms_temp_packet = ""; ms_partial_packet = false; } } - QStringList packet_list = - in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts)); + QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts)); - for (QString packet : packet_list) { + for (QString packet : packet_list) + { AOPacket *f_packet = new AOPacket(packet); ao_app->ms_packet_received(f_packet); } } + void NetworkManager::perform_srv_lookup() { -#ifdef MS_FAILOVER_SUPPORTED + #ifdef MS_FAILOVER_SUPPORTED ms_dns = new QDnsLookup(QDnsLookup::SRV, ms_srv_hostname, this); connect(ms_dns, SIGNAL(finished()), this, SLOT(on_srv_lookup())); ms_dns->lookup(); -#endif + #endif } void NetworkManager::on_srv_lookup() { -#ifdef MS_FAILOVER_SUPPORTED + #ifdef MS_FAILOVER_SUPPORTED bool connected = false; - if (ms_dns->error() != QDnsLookup::NoError) { + if (ms_dns->error() != QDnsLookup::NoError) + { qWarning("SRV lookup of the master server DNS failed."); ms_dns->deleteLater(); } - else { + else + { const auto srv_records = ms_dns->serviceRecords(); - for (const QDnsServiceRecord &record : srv_records) { + for (const QDnsServiceRecord &record : srv_records) + { #ifdef DEBUG_NETWORK qDebug() << "Connecting to " << record.target() << ":" << record.port(); #endif ms_socket->connectToHost(record.target(), record.port()); QTime timer; timer.start(); - do { + do + { ao_app->processEvents(); - if (ms_socket->state() == QAbstractSocket::ConnectedState) { + if (ms_socket->state() == QAbstractSocket::ConnectedState) + { connected = true; break; } - else if (ms_socket->state() != QAbstractSocket::ConnectingState && - ms_socket->state() != QAbstractSocket::HostLookupState && - ms_socket->error() != -1) { + else if (ms_socket->state() != QAbstractSocket::ConnectingState + && ms_socket->state() != QAbstractSocket::HostLookupState + && ms_socket->error() != -1) + { qDebug() << ms_socket->error(); - qWarning() << "Error connecting to master server:" - << ms_socket->errorString(); + qWarning() << "Error connecting to master server:" << ms_socket->errorString(); ms_socket->abort(); ms_socket->close(); break; } - } while (timer.elapsed() < - timeout_milliseconds); // Very expensive spin-wait loop - it will - // bring CPU to 100%! - if (connected) { - // Connect a one-shot signal in case the master server disconnects - // randomly - QObject::connect( - ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, - SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); + } while (timer.elapsed() < timeout_milliseconds); // Very expensive spin-wait loop - it will bring CPU to 100%! + if (connected) + { + // Connect a one-shot signal in case the master server disconnects randomly + QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), + this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); break; } - else { + else + { ms_socket->abort(); ms_socket->close(); } @@ -172,30 +179,29 @@ 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); @@ -204,8 +210,7 @@ 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(); } @@ -214,24 +219,27 @@ 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 a110ec4b..942c275d 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -1,710 +1,717 @@ -#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#%")); - } - - else if (header == "SM") { - if (!courtroom_constructed) - goto end; - - bool musics_time = false; - 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()) { - 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; - } - - // 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); - 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 { - qDebug() << "S:" << f_packet; -#ifdef DEBUG_NETWORK - qDebug() << "S:" << f_packet; -#endif - } - - net_manager->ship_server_packet(f_packet); - - delete p_packet; -} +#include "aoapplication.h" + +#include "lobby.h" +#include "courtroom.h" +#include "networkmanager.h" +#include "encryption_functions.h" +#include "hardware_functions.h" +#include "debug_functions.h" + +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("Outdated version! Your version: " + get_version_string() + + "\nPlease go to aceattorneyonline.com to update."); + destruct_courtroom(); + destruct_lobby(); + } + else if (header == "DOOM") + { + call_notice("You have been exiled from AO." + "Have a nice day."); + destruct_courtroom(); + destruct_lobby(); + } + + end: + + delete p_packet; +} + +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; + + //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); + + 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; + + 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 = "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("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("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size)); + + w_courtroom->append_char(f_char); + + int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size; + int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast(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("Loading evidence:\n" + QString::number(loaded_evidence) + "/" + QString::number(evidence_list_size)); + + w_courtroom->append_evidence(f_evi); + + int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size; + int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast(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 musics_time = 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("Loading music:\n" + QString::number(loaded_music) + "/" + QString::number(music_list_size)); + + if (musics_time) + { + w_courtroom->append_music(f_music); + } + else + { + if (f_music.endsWith(".wav") || + f_music.endsWith(".mp3") || + f_music.endsWith(".mp4") || + f_music.endsWith(".ogg") || + f_music.endsWith(".opus")) + { + musics_time = true; + areas--; + w_courtroom->fix_last_area(); + w_courtroom->append_music(f_music); + } + else + { + w_courtroom->append_area(f_music); + areas++; + } + } + + 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("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size)); + + w_courtroom->append_char(f_char); + + int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size; + int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast(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; + + bool musics_time = false; + int areas = 0; + + for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element) + { + ++loaded_music; + + w_lobby->set_loading_text("Loading music:\n" + QString::number(loaded_music) + "/" + QString::number(music_list_size)); + + if (musics_time) + { + w_courtroom->append_music(f_contents.at(n_element)); + } + else + { + if (f_contents.at(n_element).endsWith(".wav") || + f_contents.at(n_element).endsWith(".mp3") || + f_contents.at(n_element).endsWith(".mp4") || + f_contents.at(n_element).endsWith(".ogg") || + f_contents.at(n_element).endsWith(".opus")) + { + musics_time = true; + w_courtroom->fix_last_area(); + w_courtroom->append_music(f_contents.at(n_element)); + areas--; + } + else + { + w_courtroom->append_area(f_contents.at(n_element)); + areas++; + } + } + + 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); + } + + 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 == "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 (courtroom_constructed) + 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 == "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("You have been kicked from the server.\nReason: " + f_contents.at(0)); + construct_lobby(); + destruct_courtroom(); + } + } + else if (header == "KB") + { + if (courtroom_constructed && f_contents.size() >= 1) + { + call_notice("You have been banned from the server.\nReason: " + f_contents.at(0)); + construct_lobby(); + destruct_courtroom(); + } + + } + else if (header == "BD") + { + call_notice("You are banned on this server.\nReason: " + 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() > 6) + w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", f_contents.at(2) == "1", f_contents.at(3) == "1", f_contents.at(4) == "1", f_contents.at(5) == "1"); + } + + 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 + { +#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 358f146b..c51cfde3 100644 --- a/src/path_functions.cpp +++ b/src/path_functions.cpp @@ -3,18 +3,18 @@ #include "file_functions.h" #include -#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__)) +//this is a quite broad generalization +//the most common OSes(mac and windows) are _usually_ case insensitive +//however, there do exist mac installations with case sensitive filesystems +//in that case, define CASE_SENSITIVE_FILESYSTEM and compile on a mac +#if (defined (LINUX) || defined (__linux__)) #define CASE_SENSITIVE_FILESYSTEM #endif @@ -23,15 +23,13 @@ QString AOApplication::get_base_path() QString base_path = ""; #ifdef ANDROID QString sdcard_storage = getenv("SECONDARY_STORAGE"); - if (dir_exists(sdcard_storage + "/AO2/")) { + if (dir_exists(sdcard_storage + "/AO2/")){ base_path = sdcard_storage + "/AO2/"; } else { QString external_storage = getenv("EXTERNAL_STORAGE"); base_path = external_storage + "/AO2/"; } -#elif defined __APPLE__ - base_path = applicationDirPath() + "/../../../base/"; #else base_path = applicationDirPath() + "/base/"; #endif @@ -39,7 +37,10 @@ QString AOApplication::get_base_path() return base_path; } -QString AOApplication::get_data_path() { return get_base_path() + "data/"; } +QString AOApplication::get_data_path() +{ + return get_base_path() + "data/"; +} QString AOApplication::get_default_theme_path(QString p_file) { @@ -93,46 +94,17 @@ QString AOApplication::get_sounds_path(QString p_file) 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 (p_song.startsWith("http")) { - //it's an URL - return p_song; - } - else 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 - } + QString path = get_base_path() + "sounds/music/" + p_song; #ifndef CASE_SENSITIVE_FILESYSTEM - return get_base_path() + "sounds/music/" + p_song + ".wav"; + return path; #else - return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song + - ".wav"); + return get_case_sensitive_path(path); #endif } QString AOApplication::get_background_path(QString p_file) { - QString path = get_base_path() + "background/" + - w_courtroom->get_current_background() + "/" + p_file; + QString path = get_base_path() + "background/" + w_courtroom->get_current_background() + "/" + p_file; if (courtroom_constructed) { #ifndef CASE_SENSITIVE_FILESYSTEM return path; @@ -163,25 +135,21 @@ QString AOApplication::get_evidence_path(QString p_file) #endif } -QString AOApplication::get_case_sensitive_path(QString p_file) -{ - // first, check to see if it's actually there (also serves as base case for - // recursion) - if (exists(p_file)) - return p_file; +QString AOApplication::get_case_sensitive_path(QString p_file) { + //first, check to see if it's actually there (also serves as base case for recursion) + if (exists(p_file)) return p_file; QFileInfo file(p_file); QString file_basename = file.fileName(); QString file_parent_dir = get_case_sensitive_path(file.absolutePath()); - // second, does it exist in the new parent dir? + //second, does it exist in the new parent dir? if (exists(file_parent_dir + "/" + file_basename)) return file_parent_dir + "/" + file_basename; - // last resort, dirlist parent dir and find case insensitive match - QRegExp file_rx = - QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString); + //last resort, dirlist parent dir and find case insensitive match + QRegExp file_rx = QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString); QStringList files = QDir(file_parent_dir).entryList(); int result = files.indexOf(file_rx); @@ -189,6 +157,6 @@ QString AOApplication::get_case_sensitive_path(QString p_file) if (result != -1) return file_parent_dir + "/" + files.at(result); - // if nothing is found, let the caller handle the missing file + //if nothing is found, let the caller handle the missing file return file_parent_dir + "/" + file_basename; } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index f2bec87f..5a34ac8b 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -1,835 +1,656 @@ -#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; -} - -bool AOApplication::get_slower_blips() -{ - 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() -{ - 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); - settings.setIniCodec("UTF-8"); - 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 { - 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))) { - 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)) { - 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) -{ - 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"; -} - -// 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.setIniCodec("UTF-8"); - 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; -} - -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"); -} +#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", 1).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; +} + +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.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_sfx_suffix(QString sound_to_check) +{ + QString mp3_check = get_sounds_path(sound_to_check + ".mp3"); + QString opus_check = get_sounds_path(sound_to_check + ".opus"); + if (file_exists(opus_check)) + { + return sound_to_check + ".opus"; + } + else if (file_exists(mp3_check)) + { + return sound_to_check + ".mp3"; + } + return sound_to_check + ".wav"; +} + +QString AOApplication::get_image_suffix(QString path_to_check) +{ + QString apng_check = path_to_check + ".apng"; + if (file_exists(apng_check)) + { + return apng_check; + } + return path_to_check + ".gif"; +} + + +//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; +} + +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::is_discord_enabled() +{ + QString result = configini->value("discord", "true").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_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; +} -- cgit From 8928aa2718378bc42d20d5bbe6c17be68d65d6f3 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Fri, 22 May 2020 17:13:17 -0500 Subject: Perform clang-format If you don't want to see this commit on blames, use the hidden whitespace option on GitHub, or use `-w` in git-blame. --- .clang-format | 2 + include/aoapplication.h | 103 +- include/aoblipplayer.h | 12 +- include/aobutton.h | 5 +- include/aocaseannouncerdialog.h | 13 +- include/aocharbutton.h | 8 +- include/aocharmovie.h | 14 +- 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 | 11 +- include/aooptionsdialog.h | 148 +-- include/aopacket.h | 9 +- include/aoscene.h | 6 +- include/aosfxplayer.h | 11 +- include/aotextarea.h | 12 +- include/aotextedit.h | 4 +- include/bass.h | 1732 ++++++++++++++++--------------- include/chatlogpiece.h | 11 +- include/courtroom.h | 245 ++--- 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 | 6 +- 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 +- src/aoapplication.cpp | 77 +- src/aoblipplayer.cpp | 33 +- src/aobutton.cpp | 9 +- src/aocaseannouncerdialog.cpp | 39 +- src/aocharbutton.cpp | 31 +- src/aocharmovie.cpp | 60 +- src/aoemotebutton.cpp | 18 +- src/aoevidencebutton.cpp | 19 +- src/aoevidencedisplay.cpp | 37 +- src/aoimage.cpp | 11 +- src/aolineedit.cpp | 5 +- src/aomovie.cpp | 29 +- src/aomusicplayer.cpp | 29 +- src/aooptionsdialog.cpp | 801 ++++++++------- src/aopacket.cpp | 29 +- src/aoscene.cpp | 28 +- src/aosfxplayer.cpp | 47 +- src/aotextarea.cpp | 49 +- src/aotextedit.cpp | 8 +- src/charselect.cpp | 237 ++--- src/chatlogpiece.cpp | 37 +- src/courtroom.cpp | 2157 +++++++++++++++++++-------------------- src/debug_functions.cpp | 6 +- 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 | 19 +- src/hex_functions.cpp | 23 +- src/lobby.cpp | 112 +- src/main.cpp | 24 +- src/misc_functions.cpp | 2 +- src/networkmanager.cpp | 138 ++- src/packet_distribution.cpp | 425 ++++---- src/path_functions.cpp | 40 +- src/text_file_functions.cpp | 292 +++--- 73 files changed, 3788 insertions(+), 3943 deletions(-) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..a0505826 --- /dev/null +++ b/.clang-format @@ -0,0 +1,2 @@ +BasedOnStyle: LLVM +BreakBeforeBraces: Stroustrup diff --git a/include/aoapplication.h b/include/aoapplication.h index 67f9a0d5..ef1a1686 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -6,30 +6,29 @@ #include "discord_rich_presence.h" #include -#include #include #include +#include #include -#include #include +#include #include #include #include -#include -#include #include #include +#include +#include class NetworkManager; class Lobby; class Courtroom; -class AOApplication : public QApplication -{ +class AOApplication : public QApplication { Q_OBJECT public: @@ -78,7 +77,7 @@ public: ///////////////loading info/////////////////// - //player number, it's hardly used but might be needed for some old servers + // player number, it's hardly used but might be needed for some old servers int s_pv = 0; QString server_software = ""; @@ -103,19 +102,19 @@ public: /////////////////////////////////////////// void set_favorite_list(); - QVector& get_favorite_list() {return 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;} + QVector &get_server_list() { return server_list; } - //reads the theme from config.ini and sets it accordingly + // reads the theme from config.ini and sets it accordingly void reload_theme(); - //Returns the character the player has currently selected + // Returns the character the player has currently selected QString get_current_char(); - //implementation in path_functions.cpp + // implementation in path_functions.cpp QString get_base_path(); QString get_data_path(); QString get_theme_path(QString p_file); @@ -135,25 +134,26 @@ public: // Instead of reinventing the wheel, we'll use a QSettings class. QSettings *configini; - //Reads the theme from config.ini and loads it into the current_theme variable + // Reads the theme from config.ini and loads it into the current_theme + // variable QString read_theme(); - //Returns the value of ooc_name in config.ini + // Returns the value of ooc_name in config.ini QString get_ooc_name(); - //Returns the blip rate from config.ini + // Returns the blip rate from config.ini int read_blip_rate(); - //Returns true if blank blips is enabled in config.ini and false otherwise + // Returns true if blank blips is enabled in config.ini and false otherwise bool get_blank_blip(); - //Returns the value of default_music in config.ini + // Returns the value of default_music in config.ini int get_default_music(); - //Returns the value of default_sfx in config.ini + // Returns the value of default_sfx in config.ini int get_default_sfx(); - //Returns the value of default_blip in config.ini + // Returns the value of default_blip in config.ini int get_default_blip(); // Returns the value of whether Discord should be enabled on startup @@ -177,101 +177,102 @@ public: // Returns whether the user would like to have custom shownames on by default. bool get_showname_enabled_by_default(); - //Returns the list of words in callwords.ini + // Returns the list of words in callwords.ini QStringList get_call_words(); - //Appends the argument string to serverlist.txt + // Appends the argument string to serverlist.txt void write_to_serverlist_txt(QString p_line); - //Returns the contents of serverlist.txt + // Returns the contents of serverlist.txt QVector read_serverlist_txt(); - //Returns the value of p_identifier in the design.ini file in p_design_path + // Returns the value of p_identifier in the design.ini file in p_design_path QString read_design_ini(QString p_identifier, QString p_design_path); - //Returns the coordinates of widget with p_identifier from p_file + // Returns the coordinates of widget with p_identifier from p_file QPoint get_button_spacing(QString p_identifier, QString p_file); - //Returns the dimensions of widget with specified identifier from p_file + // Returns the dimensions of widget with specified identifier from p_file pos_size_type get_element_dimensions(QString p_identifier, QString p_file); - //Returns the name of the font with p_identifier from p_file - QString get_font_name(QString p_identifier, QString p_file); - + // Returns the name of the font with p_identifier from p_file + QString get_font_name(QString p_identifier, QString p_file); - //Returns the value of font_size with p_identifier from p_file + // Returns the value of font_size with p_identifier from p_file int get_font_size(QString p_identifier, QString p_file); - //Returns the color with p_identifier from p_file + // Returns the color with p_identifier from p_file QColor get_color(QString p_identifier, QString p_file); // Returns the colour from the misc folder. QColor get_chat_color(QString p_identifier, QString p_chat); - //Returns the sfx with p_identifier from sounds.ini in the current theme path + // Returns the sfx with p_identifier from sounds.ini in the current theme path QString get_sfx(QString p_identifier); - //Figure out if we can opus this or if we should fall back to wav + // Figure out if we can opus this or if we should fall back to wav QString get_sfx_suffix(QString sound_to_check); // Can we use APNG for this? If not, fall back to a gif. QString get_image_suffix(QString path_to_check); - //Returns the value of p_search_line within target_tag and terminator_tag - QString read_char_ini(QString p_char, QString p_search_line, QString target_tag); + // Returns the value of p_search_line within target_tag and terminator_tag + QString read_char_ini(QString p_char, QString p_search_line, + QString target_tag); - //Returns the side of the p_char character from that characters ini file + // Returns the side of the p_char character from that characters ini file QString get_char_side(QString p_char); - //Returns the showname from the ini of p_char + // Returns the showname from the ini of p_char QString get_showname(QString p_char); - //Returns the value of chat from the specific p_char's ini file + // Returns the value of chat from the specific p_char's ini file QString get_chat(QString p_char); - //Returns the value of shouts from the specified p_char's ini file + // Returns the value of shouts from the specified p_char's ini file QString get_char_shouts(QString p_char); - //Returns the preanim duration of p_char's p_emote + // Returns the preanim duration of p_char's p_emote int get_preanim_duration(QString p_char, QString p_emote); - //Same as above, but only returns if it has a % in front(refer to Preanims section in the manual) + // Same as above, but only returns if it has a % in front(refer to Preanims + // section in the manual) int get_ao2_preanim_duration(QString p_char, QString p_emote); - //Not in use + // Not in use int get_text_delay(QString p_char, QString p_emote); // Returns the custom realisation used by the character. QString get_custom_realization(QString p_char); - //Returns the name of p_char + // Returns the name of p_char QString get_char_name(QString p_char); - //Returns the total amount of emotes of p_char + // Returns the total amount of emotes of p_char int get_emote_number(QString p_char); - //Returns the emote comment of p_char's p_emote + // Returns the emote comment of p_char's p_emote QString get_emote_comment(QString p_char, int p_emote); - //Returns the base name of p_char's p_emote + // Returns the base name of p_char's p_emote QString get_emote(QString p_char, int p_emote); - //Returns the preanimation name of p_char's p_emote + // Returns the preanimation name of p_char's p_emote QString get_pre_emote(QString p_char, int p_emote); - //Returns the sfx of p_char's p_emote + // Returns the sfx of p_char's p_emote QString get_sfx_name(QString p_char, int p_emote); - //Not in use + // Not in use int get_sfx_delay(QString p_char, int p_emote); - //Returns the modifier for p_char's p_emote + // Returns the modifier for p_char's p_emote int get_emote_mod(QString p_char, int p_emote); - //Returns the desk modifier for p_char's p_emote + // Returns the desk modifier for p_char's p_emote int get_desk_mod(QString p_char, int p_emote); - //Returns p_char's gender + // Returns p_char's gender QString get_gender(QString p_char); // ====== diff --git a/include/aoblipplayer.h b/include/aoblipplayer.h index 102a0408..02bd3c66 100644 --- a/include/aoblipplayer.h +++ b/include/aoblipplayer.h @@ -9,13 +9,11 @@ #include "aoapplication.h" +#include #include #include -#include - -class AOBlipPlayer -{ +class AOBlipPlayer { public: AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app); @@ -30,11 +28,11 @@ private: AOApplication *ao_app; int m_volume; - #if defined(BASSAUDIO) +#if defined(BASSAUDIO) HSTREAM m_stream_list[5]; - #elif defined(QTAUDIO) +#elif defined(QTAUDIO) QSoundEffect m_blips; - #endif +#endif }; #endif // AOBLIPPLAYER_H diff --git a/include/aobutton.h b/include/aobutton.h index 4b7209ae..f5758856 100644 --- a/include/aobutton.h +++ b/include/aobutton.h @@ -3,11 +3,10 @@ #include "aoapplication.h" -#include #include +#include -class AOButton : public QPushButton -{ +class AOButton : public QPushButton { Q_OBJECT public: diff --git a/include/aocaseannouncerdialog.h b/include/aocaseannouncerdialog.h index a238c3f2..0ac8f074 100644 --- a/include/aocaseannouncerdialog.h +++ b/include/aocaseannouncerdialog.h @@ -4,20 +4,21 @@ #include "aoapplication.h" #include "courtroom.h" -#include #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 f372cdf8..dd27e62c 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 7ef7da3f..b4a8be2c 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -1,16 +1,15 @@ #ifndef AOCHARMOVIE_H #define AOCHARMOVIE_H -#include -#include -#include #include #include +#include +#include +#include class AOApplication; -class AOCharMovie : public QLabel -{ +class AOCharMovie : public QLabel { Q_OBJECT public: @@ -21,7 +20,7 @@ public: void play_talking(QString p_char, QString p_emote); void play_idle(QString p_char, QString p_emote); - void set_flipped(bool p_flipped) {m_flipped = p_flipped;} + void set_flipped(bool p_flipped) { m_flipped = p_flipped; } void stop(); @@ -38,7 +37,8 @@ private: const int time_mod = 62; - // These are the X and Y values before they are fixed based on the sprite's width. + // These are the X and Y values before they are fixed based on the sprite's + // width. int x = 0; int y = 0; diff --git a/include/aoemotebutton.h b/include/aoemotebutton.h index c99a73b0..acf0b484 100644 --- a/include/aoemotebutton.h +++ b/include/aoemotebutton.h @@ -3,22 +3,21 @@ #include "aoapplication.h" -#include #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 80b747cd..b56bfb1d 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 13ca00d5..1d6280da 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 4713be0a..c4fdf2ee 100644 --- a/include/aoimage.h +++ b/include/aoimage.h @@ -1,15 +1,14 @@ -//This class represents a static theme-dependent image +// This class represents a static theme-dependent image #ifndef AOIMAGE_H #define AOIMAGE_H #include "aoapplication.h" -#include #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 ce17680d..70f1f978 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 1f278bf8..d22f725a 100644 --- a/include/aomovie.h +++ b/include/aomovie.h @@ -7,8 +7,7 @@ class Courtroom; class AOApplication; -class AOMovie : public QLabel -{ +class AOMovie : public QLabel { Q_OBJECT public: diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index b34267c9..fd6b2548 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -8,13 +8,12 @@ #endif #include "aoapplication.h" +#include #include #include -#include #if defined(BASSAUDIO) -class AOMusicPlayer -{ +class AOMusicPlayer { public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); ~AOMusicPlayer(); @@ -30,8 +29,7 @@ private: HSTREAM m_stream; }; #elif defined(QTAUDIO) -class AOMusicPlayer -{ +class AOMusicPlayer { public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); ~AOMusicPlayer(); @@ -47,8 +45,7 @@ private: int m_volume = 0; }; #else -class AOMusicPlayer -{ +class AOMusicPlayer { public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); ~AOMusicPlayer(); diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index a65e3f59..ec0889ba 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -23,93 +23,93 @@ #include #include -class AOOptionsDialog: public QDialog -{ - Q_OBJECT +class AOOptionsDialog : public QDialog { + Q_OBJECT public: - explicit AOOptionsDialog(QWidget *parent = nullptr, AOApplication *p_ao_app = nullptr); + explicit AOOptionsDialog(QWidget *parent = nullptr, + AOApplication *p_ao_app = nullptr); private: - AOApplication *ao_app; + AOApplication *ao_app; - QVBoxLayout *ui_vertical_layout; - QTabWidget *ui_settings_tabs; + QVBoxLayout *ui_vertical_layout; + QTabWidget *ui_settings_tabs; - QWidget *ui_gameplay_tab; - QWidget *ui_form_layout_widget; - QFormLayout *ui_gameplay_form; - QLabel *ui_theme_label; - QComboBox *ui_theme_combobox; - QFrame *ui_theme_log_divider; - QLabel *ui_downwards_lbl; - QCheckBox *ui_downwards_cb; - QLabel *ui_length_lbl; - QSpinBox *ui_length_spinbox; - QFrame *ui_log_names_divider; - QLineEdit *ui_username_textbox; - QLabel *ui_username_lbl; - QLabel *ui_showname_lbl; - QCheckBox *ui_showname_cb; - QFrame *ui_net_divider; - QLabel *ui_ms_lbl; - QLineEdit *ui_ms_textbox; - QLabel *ui_discord_lbl; - QCheckBox *ui_discord_cb; + QWidget *ui_gameplay_tab; + QWidget *ui_form_layout_widget; + QFormLayout *ui_gameplay_form; + QLabel *ui_theme_label; + QComboBox *ui_theme_combobox; + QFrame *ui_theme_log_divider; + QLabel *ui_downwards_lbl; + QCheckBox *ui_downwards_cb; + QLabel *ui_length_lbl; + QSpinBox *ui_length_spinbox; + QFrame *ui_log_names_divider; + QLineEdit *ui_username_textbox; + QLabel *ui_username_lbl; + QLabel *ui_showname_lbl; + QCheckBox *ui_showname_cb; + QFrame *ui_net_divider; + QLabel *ui_ms_lbl; + QLineEdit *ui_ms_textbox; + QLabel *ui_discord_lbl; + QCheckBox *ui_discord_cb; - QWidget *ui_callwords_tab; - QWidget *ui_callwords_widget; - QVBoxLayout *ui_callwords_layout; - QPlainTextEdit *ui_callwords_textbox; - QLabel *ui_callwords_explain_lbl; - QCheckBox *ui_callwords_char_textbox; + QWidget *ui_callwords_tab; + QWidget *ui_callwords_widget; + QVBoxLayout *ui_callwords_layout; + QPlainTextEdit *ui_callwords_textbox; + QLabel *ui_callwords_explain_lbl; + QCheckBox *ui_callwords_char_textbox; - QWidget *ui_audio_tab; - QWidget *ui_audio_widget; - QFormLayout *ui_audio_layout; - QLabel *ui_audio_device_lbl; - QComboBox *ui_audio_device_combobox; - QFrame *ui_audio_volume_divider; - QSpinBox *ui_music_volume_spinbox; - QLabel *ui_music_volume_lbl; - QSpinBox *ui_sfx_volume_spinbox; - QSpinBox *ui_blips_volume_spinbox; - QLabel *ui_sfx_volume_lbl; - QLabel *ui_blips_volume_lbl; - QFrame *ui_volume_blip_divider; - QSpinBox *ui_bliprate_spinbox; - QLabel *ui_bliprate_lbl; - QCheckBox *ui_blank_blips_cb; - QLabel *ui_blank_blips_lbl; - QDialogButtonBox *ui_settings_buttons; + QWidget *ui_audio_tab; + QWidget *ui_audio_widget; + QFormLayout *ui_audio_layout; + QLabel *ui_audio_device_lbl; + QComboBox *ui_audio_device_combobox; + QFrame *ui_audio_volume_divider; + QSpinBox *ui_music_volume_spinbox; + QLabel *ui_music_volume_lbl; + QSpinBox *ui_sfx_volume_spinbox; + QSpinBox *ui_blips_volume_spinbox; + QLabel *ui_sfx_volume_lbl; + QLabel *ui_blips_volume_lbl; + QFrame *ui_volume_blip_divider; + QSpinBox *ui_bliprate_spinbox; + QLabel *ui_bliprate_lbl; + QCheckBox *ui_blank_blips_cb; + QLabel *ui_blank_blips_lbl; + QDialogButtonBox *ui_settings_buttons; - QWidget *ui_casing_tab; - QWidget *ui_casing_widget; - QFormLayout *ui_casing_layout; - QLabel *ui_casing_supported_lbl; - QLabel *ui_casing_enabled_lbl; - QCheckBox *ui_casing_enabled_cb; - QLabel *ui_casing_def_lbl; - QCheckBox *ui_casing_def_cb; - QLabel *ui_casing_pro_lbl; - QCheckBox *ui_casing_pro_cb; - QLabel *ui_casing_jud_lbl; - QCheckBox *ui_casing_jud_cb; - QLabel *ui_casing_jur_lbl; - QCheckBox *ui_casing_jur_cb; - QLabel *ui_casing_steno_lbl; - QCheckBox *ui_casing_steno_cb; - QLabel *ui_casing_cm_lbl; - QCheckBox *ui_casing_cm_cb; - QLabel *ui_casing_cm_cases_lbl; - QLineEdit *ui_casing_cm_cases_textbox; + QWidget *ui_casing_tab; + QWidget *ui_casing_widget; + QFormLayout *ui_casing_layout; + QLabel *ui_casing_supported_lbl; + QLabel *ui_casing_enabled_lbl; + QCheckBox *ui_casing_enabled_cb; + QLabel *ui_casing_def_lbl; + QCheckBox *ui_casing_def_cb; + QLabel *ui_casing_pro_lbl; + QCheckBox *ui_casing_pro_cb; + QLabel *ui_casing_jud_lbl; + QCheckBox *ui_casing_jud_cb; + QLabel *ui_casing_jur_lbl; + QCheckBox *ui_casing_jur_cb; + QLabel *ui_casing_steno_lbl; + QCheckBox *ui_casing_steno_cb; + QLabel *ui_casing_cm_lbl; + QCheckBox *ui_casing_cm_cb; + QLabel *ui_casing_cm_cases_lbl; + QLineEdit *ui_casing_cm_cases_textbox; - bool needs_default_audiodev(); + bool needs_default_audiodev(); signals: public slots: - void save_pressed(); - void discard_pressed(); + void save_pressed(); + void discard_pressed(); }; #endif // AOOPTIONSDIALOG_H diff --git a/include/aopacket.h b/include/aopacket.h index 21f6e0f4..4097be86 100644 --- a/include/aopacket.h +++ b/include/aopacket.h @@ -1,19 +1,18 @@ #ifndef AOPACKET_H #define AOPACKET_H +#include #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 b58c0fd0..1c258f2f 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); @@ -21,7 +20,6 @@ private: QWidget *m_parent; QMovie *m_movie; AOApplication *ao_app; - }; #endif // AOSCENE_H diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h index 4b976852..b6dce85d 100644 --- a/include/aosfxplayer.h +++ b/include/aosfxplayer.h @@ -9,12 +9,11 @@ #include "aoapplication.h" +#include #include #include -#include -class AOSfxPlayer -{ +class AOSfxPlayer { public: AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app); @@ -25,11 +24,11 @@ public: private: QWidget *m_parent; AOApplication *ao_app; - #if defined(BASSAUDIO) +#if defined(BASSAUDIO) HSTREAM m_stream; - #elif defined(QTAUDIO) +#elif defined(QTAUDIO) QSoundEffect m_sfx; - #endif +#endif int m_volume = 0; }; diff --git a/include/aotextarea.h b/include/aotextarea.h index d44596b2..13532d29 100644 --- a/include/aotextarea.h +++ b/include/aotextarea.h @@ -1,14 +1,13 @@ #ifndef AOTEXTAREA_H #define AOTEXTAREA_H -#include +#include +#include #include +#include #include -#include -#include -class AOTextArea : public QTextBrowser -{ +class AOTextArea : public QTextBrowser { public: AOTextArea(QWidget *p_parent = nullptr); @@ -18,7 +17,8 @@ public: private: const QRegExp omnis_dank_url_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b"); - void auto_scroll(QTextCursor old_cursor, int scrollbar_value, bool is_scrolled_down); + void auto_scroll(QTextCursor old_cursor, int scrollbar_value, + bool is_scrolled_down); }; #endif // AOTEXTAREA_H diff --git a/include/aotextedit.h b/include/aotextedit.h index 85909c6e..8d876f17 100644 --- a/include/aotextedit.h +++ b/include/aotextedit.h @@ -3,8 +3,7 @@ #include -class AOTextEdit : public QPlainTextEdit -{ +class AOTextEdit : public QPlainTextEdit { Q_OBJECT public: AOTextEdit(QWidget *parent); @@ -17,7 +16,6 @@ signals: private slots: void on_enter_pressed(); - }; #endif // AOTEXTEDIT_H diff --git a/include/bass.h b/include/bass.h index 1c50903c..068b963c 100644 --- a/include/bass.h +++ b/include/bass.h @@ -1,8 +1,8 @@ /* - BASS 2.4 C/C++ header file - Copyright (c) 1999-2018 Un4seen Developments Ltd. + BASS 2.4 C/C++ header file + Copyright (c) 1999-2018 Un4seen Developments Ltd. - See the BASS.CHM file for more detailed documentation + See the BASS.CHM file for more detailed documentation */ #ifndef BASS_H @@ -27,19 +27,19 @@ typedef int BOOL; #define FALSE 0 #endif #define LOBYTE(a) (BYTE)(a) -#define HIBYTE(a) (BYTE)((a)>>8) +#define HIBYTE(a) (BYTE)((a) >> 8) #define LOWORD(a) (WORD)(a) -#define HIWORD(a) (WORD)((a)>>16) -#define MAKEWORD(a,b) (WORD)(((a)&0xff)|((b)<<8)) -#define MAKELONG(a,b) (DWORD)(((a)&0xffff)|((b)<<16)) +#define HIWORD(a) (WORD)((a) >> 16) +#define MAKEWORD(a, b) (WORD)(((a)&0xff) | ((b) << 8)) +#define MAKELONG(a, b) (DWORD)(((a)&0xffff) | ((b) << 16)) #endif #ifdef __cplusplus extern "C" { #endif -#define BASSVERSION 0x204 // API version -#define BASSVERSIONTEXT "2.4" +#define BASSVERSION 0x204 // API version +#define BASSVERSIONTEXT "2.4" #ifndef BASSDEF #define BASSDEF(f) WINAPI f @@ -47,524 +47,548 @@ extern "C" { #define NOBASSOVERLOADS #endif -typedef DWORD HMUSIC; // MOD music handle -typedef DWORD HSAMPLE; // sample handle -typedef DWORD HCHANNEL; // playing sample's channel handle -typedef DWORD HSTREAM; // sample stream handle -typedef DWORD HRECORD; // recording handle -typedef DWORD HSYNC; // synchronizer handle -typedef DWORD HDSP; // DSP handle -typedef DWORD HFX; // DX8 effect handle -typedef DWORD HPLUGIN; // Plugin handle +typedef DWORD HMUSIC; // MOD music handle +typedef DWORD HSAMPLE; // sample handle +typedef DWORD HCHANNEL; // playing sample's channel handle +typedef DWORD HSTREAM; // sample stream handle +typedef DWORD HRECORD; // recording handle +typedef DWORD HSYNC; // synchronizer handle +typedef DWORD HDSP; // DSP handle +typedef DWORD HFX; // DX8 effect handle +typedef DWORD HPLUGIN; // Plugin handle // Error codes returned by BASS_ErrorGetCode -#define BASS_OK 0 // all is OK -#define BASS_ERROR_MEM 1 // memory error -#define BASS_ERROR_FILEOPEN 2 // can't open the file -#define BASS_ERROR_DRIVER 3 // can't find a free/valid driver -#define BASS_ERROR_BUFLOST 4 // the sample buffer was lost -#define BASS_ERROR_HANDLE 5 // invalid handle -#define BASS_ERROR_FORMAT 6 // unsupported sample format -#define BASS_ERROR_POSITION 7 // invalid position -#define BASS_ERROR_INIT 8 // BASS_Init has not been successfully called -#define BASS_ERROR_START 9 // BASS_Start has not been successfully called -#define BASS_ERROR_SSL 10 // SSL/HTTPS support isn't available -#define BASS_ERROR_ALREADY 14 // already initialized/paused/whatever -#define BASS_ERROR_NOCHAN 18 // can't get a free channel -#define BASS_ERROR_ILLTYPE 19 // an illegal type was specified -#define BASS_ERROR_ILLPARAM 20 // an illegal parameter was specified -#define BASS_ERROR_NO3D 21 // no 3D support -#define BASS_ERROR_NOEAX 22 // no EAX support -#define BASS_ERROR_DEVICE 23 // illegal device number -#define BASS_ERROR_NOPLAY 24 // not playing -#define BASS_ERROR_FREQ 25 // illegal sample rate -#define BASS_ERROR_NOTFILE 27 // the stream is not a file stream -#define BASS_ERROR_NOHW 29 // no hardware voices available -#define BASS_ERROR_EMPTY 31 // the MOD music has no sequence data -#define BASS_ERROR_NONET 32 // no internet connection could be opened -#define BASS_ERROR_CREATE 33 // couldn't create the file -#define BASS_ERROR_NOFX 34 // effects are not available -#define BASS_ERROR_NOTAVAIL 37 // requested data/action is not available -#define BASS_ERROR_DECODE 38 // the channel is/isn't a "decoding channel" -#define BASS_ERROR_DX 39 // a sufficient DirectX version is not installed -#define BASS_ERROR_TIMEOUT 40 // connection timedout -#define BASS_ERROR_FILEFORM 41 // unsupported file format -#define BASS_ERROR_SPEAKER 42 // unavailable speaker -#define BASS_ERROR_VERSION 43 // invalid BASS version (used by add-ons) -#define BASS_ERROR_CODEC 44 // codec is not available/supported -#define BASS_ERROR_ENDED 45 // the channel/file has ended -#define BASS_ERROR_BUSY 46 // the device is busy -#define BASS_ERROR_UNKNOWN -1 // some other mystery problem +#define BASS_OK 0 // all is OK +#define BASS_ERROR_MEM 1 // memory error +#define BASS_ERROR_FILEOPEN 2 // can't open the file +#define BASS_ERROR_DRIVER 3 // can't find a free/valid driver +#define BASS_ERROR_BUFLOST 4 // the sample buffer was lost +#define BASS_ERROR_HANDLE 5 // invalid handle +#define BASS_ERROR_FORMAT 6 // unsupported sample format +#define BASS_ERROR_POSITION 7 // invalid position +#define BASS_ERROR_INIT 8 // BASS_Init has not been successfully called +#define BASS_ERROR_START 9 // BASS_Start has not been successfully called +#define BASS_ERROR_SSL 10 // SSL/HTTPS support isn't available +#define BASS_ERROR_ALREADY 14 // already initialized/paused/whatever +#define BASS_ERROR_NOCHAN 18 // can't get a free channel +#define BASS_ERROR_ILLTYPE 19 // an illegal type was specified +#define BASS_ERROR_ILLPARAM 20 // an illegal parameter was specified +#define BASS_ERROR_NO3D 21 // no 3D support +#define BASS_ERROR_NOEAX 22 // no EAX support +#define BASS_ERROR_DEVICE 23 // illegal device number +#define BASS_ERROR_NOPLAY 24 // not playing +#define BASS_ERROR_FREQ 25 // illegal sample rate +#define BASS_ERROR_NOTFILE 27 // the stream is not a file stream +#define BASS_ERROR_NOHW 29 // no hardware voices available +#define BASS_ERROR_EMPTY 31 // the MOD music has no sequence data +#define BASS_ERROR_NONET 32 // no internet connection could be opened +#define BASS_ERROR_CREATE 33 // couldn't create the file +#define BASS_ERROR_NOFX 34 // effects are not available +#define BASS_ERROR_NOTAVAIL 37 // requested data/action is not available +#define BASS_ERROR_DECODE 38 // the channel is/isn't a "decoding channel" +#define BASS_ERROR_DX 39 // a sufficient DirectX version is not installed +#define BASS_ERROR_TIMEOUT 40 // connection timedout +#define BASS_ERROR_FILEFORM 41 // unsupported file format +#define BASS_ERROR_SPEAKER 42 // unavailable speaker +#define BASS_ERROR_VERSION 43 // invalid BASS version (used by add-ons) +#define BASS_ERROR_CODEC 44 // codec is not available/supported +#define BASS_ERROR_ENDED 45 // the channel/file has ended +#define BASS_ERROR_BUSY 46 // the device is busy +#define BASS_ERROR_UNKNOWN -1 // some other mystery problem // BASS_SetConfig options -#define BASS_CONFIG_BUFFER 0 -#define BASS_CONFIG_UPDATEPERIOD 1 -#define BASS_CONFIG_GVOL_SAMPLE 4 -#define BASS_CONFIG_GVOL_STREAM 5 -#define BASS_CONFIG_GVOL_MUSIC 6 -#define BASS_CONFIG_CURVE_VOL 7 -#define BASS_CONFIG_CURVE_PAN 8 -#define BASS_CONFIG_FLOATDSP 9 -#define BASS_CONFIG_3DALGORITHM 10 -#define BASS_CONFIG_NET_TIMEOUT 11 -#define BASS_CONFIG_NET_BUFFER 12 -#define BASS_CONFIG_PAUSE_NOPLAY 13 -#define BASS_CONFIG_NET_PREBUF 15 -#define BASS_CONFIG_NET_PASSIVE 18 -#define BASS_CONFIG_REC_BUFFER 19 -#define BASS_CONFIG_NET_PLAYLIST 21 -#define BASS_CONFIG_MUSIC_VIRTUAL 22 -#define BASS_CONFIG_VERIFY 23 -#define BASS_CONFIG_UPDATETHREADS 24 -#define BASS_CONFIG_DEV_BUFFER 27 -#define BASS_CONFIG_VISTA_TRUEPOS 30 -#define BASS_CONFIG_IOS_MIXAUDIO 34 -#define BASS_CONFIG_DEV_DEFAULT 36 -#define BASS_CONFIG_NET_READTIMEOUT 37 -#define BASS_CONFIG_VISTA_SPEAKERS 38 -#define BASS_CONFIG_IOS_SPEAKER 39 -#define BASS_CONFIG_MF_DISABLE 40 -#define BASS_CONFIG_HANDLES 41 -#define BASS_CONFIG_UNICODE 42 -#define BASS_CONFIG_SRC 43 -#define BASS_CONFIG_SRC_SAMPLE 44 -#define BASS_CONFIG_ASYNCFILE_BUFFER 45 -#define BASS_CONFIG_OGG_PRESCAN 47 -#define BASS_CONFIG_MF_VIDEO 48 -#define BASS_CONFIG_AIRPLAY 49 -#define BASS_CONFIG_DEV_NONSTOP 50 -#define BASS_CONFIG_IOS_NOCATEGORY 51 -#define BASS_CONFIG_VERIFY_NET 52 -#define BASS_CONFIG_DEV_PERIOD 53 -#define BASS_CONFIG_FLOAT 54 -#define BASS_CONFIG_NET_SEEK 56 -#define BASS_CONFIG_AM_DISABLE 58 -#define BASS_CONFIG_NET_PLAYLIST_DEPTH 59 -#define BASS_CONFIG_NET_PREBUF_WAIT 60 +#define BASS_CONFIG_BUFFER 0 +#define BASS_CONFIG_UPDATEPERIOD 1 +#define BASS_CONFIG_GVOL_SAMPLE 4 +#define BASS_CONFIG_GVOL_STREAM 5 +#define BASS_CONFIG_GVOL_MUSIC 6 +#define BASS_CONFIG_CURVE_VOL 7 +#define BASS_CONFIG_CURVE_PAN 8 +#define BASS_CONFIG_FLOATDSP 9 +#define BASS_CONFIG_3DALGORITHM 10 +#define BASS_CONFIG_NET_TIMEOUT 11 +#define BASS_CONFIG_NET_BUFFER 12 +#define BASS_CONFIG_PAUSE_NOPLAY 13 +#define BASS_CONFIG_NET_PREBUF 15 +#define BASS_CONFIG_NET_PASSIVE 18 +#define BASS_CONFIG_REC_BUFFER 19 +#define BASS_CONFIG_NET_PLAYLIST 21 +#define BASS_CONFIG_MUSIC_VIRTUAL 22 +#define BASS_CONFIG_VERIFY 23 +#define BASS_CONFIG_UPDATETHREADS 24 +#define BASS_CONFIG_DEV_BUFFER 27 +#define BASS_CONFIG_VISTA_TRUEPOS 30 +#define BASS_CONFIG_IOS_MIXAUDIO 34 +#define BASS_CONFIG_DEV_DEFAULT 36 +#define BASS_CONFIG_NET_READTIMEOUT 37 +#define BASS_CONFIG_VISTA_SPEAKERS 38 +#define BASS_CONFIG_IOS_SPEAKER 39 +#define BASS_CONFIG_MF_DISABLE 40 +#define BASS_CONFIG_HANDLES 41 +#define BASS_CONFIG_UNICODE 42 +#define BASS_CONFIG_SRC 43 +#define BASS_CONFIG_SRC_SAMPLE 44 +#define BASS_CONFIG_ASYNCFILE_BUFFER 45 +#define BASS_CONFIG_OGG_PRESCAN 47 +#define BASS_CONFIG_MF_VIDEO 48 +#define BASS_CONFIG_AIRPLAY 49 +#define BASS_CONFIG_DEV_NONSTOP 50 +#define BASS_CONFIG_IOS_NOCATEGORY 51 +#define BASS_CONFIG_VERIFY_NET 52 +#define BASS_CONFIG_DEV_PERIOD 53 +#define BASS_CONFIG_FLOAT 54 +#define BASS_CONFIG_NET_SEEK 56 +#define BASS_CONFIG_AM_DISABLE 58 +#define BASS_CONFIG_NET_PLAYLIST_DEPTH 59 +#define BASS_CONFIG_NET_PREBUF_WAIT 60 // BASS_SetConfigPtr options -#define BASS_CONFIG_NET_AGENT 16 -#define BASS_CONFIG_NET_PROXY 17 -#define BASS_CONFIG_IOS_NOTIFY 46 +#define BASS_CONFIG_NET_AGENT 16 +#define BASS_CONFIG_NET_PROXY 17 +#define BASS_CONFIG_IOS_NOTIFY 46 // BASS_Init flags -#define BASS_DEVICE_8BITS 1 // 8 bit -#define BASS_DEVICE_MONO 2 // mono -#define BASS_DEVICE_3D 4 // enable 3D functionality -#define BASS_DEVICE_16BITS 8 // limit output to 16 bit -#define BASS_DEVICE_LATENCY 0x100 // calculate device latency (BASS_INFO struct) -#define BASS_DEVICE_CPSPEAKERS 0x400 // detect speakers via Windows control panel -#define BASS_DEVICE_SPEAKERS 0x800 // force enabling of speaker assignment -#define BASS_DEVICE_NOSPEAKER 0x1000 // ignore speaker arrangement -#define BASS_DEVICE_DMIX 0x2000 // use ALSA "dmix" plugin -#define BASS_DEVICE_FREQ 0x4000 // set device sample rate -#define BASS_DEVICE_STEREO 0x8000 // limit output to stereo -#define BASS_DEVICE_HOG 0x10000 // hog/exclusive mode -#define BASS_DEVICE_AUDIOTRACK 0x20000 // use AudioTrack output -#define BASS_DEVICE_DSOUND 0x40000 // use DirectSound output +#define BASS_DEVICE_8BITS 1 // 8 bit +#define BASS_DEVICE_MONO 2 // mono +#define BASS_DEVICE_3D 4 // enable 3D functionality +#define BASS_DEVICE_16BITS 8 // limit output to 16 bit +#define BASS_DEVICE_LATENCY 0x100 // calculate device latency (BASS_INFO struct) +#define BASS_DEVICE_CPSPEAKERS \ + 0x400 // detect speakers via Windows control panel +#define BASS_DEVICE_SPEAKERS 0x800 // force enabling of speaker assignment +#define BASS_DEVICE_NOSPEAKER 0x1000 // ignore speaker arrangement +#define BASS_DEVICE_DMIX 0x2000 // use ALSA "dmix" plugin +#define BASS_DEVICE_FREQ 0x4000 // set device sample rate +#define BASS_DEVICE_STEREO 0x8000 // limit output to stereo +#define BASS_DEVICE_HOG 0x10000 // hog/exclusive mode +#define BASS_DEVICE_AUDIOTRACK 0x20000 // use AudioTrack output +#define BASS_DEVICE_DSOUND 0x40000 // use DirectSound output // DirectSound interfaces (for use with BASS_GetDSoundObject) -#define BASS_OBJECT_DS 1 // IDirectSound -#define BASS_OBJECT_DS3DL 2 // IDirectSound3DListener +#define BASS_OBJECT_DS 1 // IDirectSound +#define BASS_OBJECT_DS3DL 2 // IDirectSound3DListener // Device info structure typedef struct { -#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) - const wchar_t *name; // description - const wchar_t *driver; // driver +#if defined(_WIN32_WCE) || \ + (WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) + const wchar_t *name; // description + const wchar_t *driver; // driver #else - const char *name; // description - const char *driver; // driver + const char *name; // description + const char *driver; // driver #endif - DWORD flags; + DWORD flags; } BASS_DEVICEINFO; // BASS_DEVICEINFO flags -#define BASS_DEVICE_ENABLED 1 -#define BASS_DEVICE_DEFAULT 2 -#define BASS_DEVICE_INIT 4 -#define BASS_DEVICE_LOOPBACK 8 - -#define BASS_DEVICE_TYPE_MASK 0xff000000 -#define BASS_DEVICE_TYPE_NETWORK 0x01000000 -#define BASS_DEVICE_TYPE_SPEAKERS 0x02000000 -#define BASS_DEVICE_TYPE_LINE 0x03000000 -#define BASS_DEVICE_TYPE_HEADPHONES 0x04000000 -#define BASS_DEVICE_TYPE_MICROPHONE 0x05000000 -#define BASS_DEVICE_TYPE_HEADSET 0x06000000 -#define BASS_DEVICE_TYPE_HANDSET 0x07000000 -#define BASS_DEVICE_TYPE_DIGITAL 0x08000000 -#define BASS_DEVICE_TYPE_SPDIF 0x09000000 -#define BASS_DEVICE_TYPE_HDMI 0x0a000000 -#define BASS_DEVICE_TYPE_DISPLAYPORT 0x40000000 - -// BASS_GetDeviceInfo flags -#define BASS_DEVICES_AIRPLAY 0x1000000 - +#define BASS_DEVICE_ENABLED 1 +#define BASS_DEVICE_DEFAULT 2 +#define BASS_DEVICE_INIT 4 +#define BASS_DEVICE_LOOPBACK 8 + +#define BASS_DEVICE_TYPE_MASK 0xff000000 +#define BASS_DEVICE_TYPE_NETWORK 0x01000000 +#define BASS_DEVICE_TYPE_SPEAKERS 0x02000000 +#define BASS_DEVICE_TYPE_LINE 0x03000000 +#define BASS_DEVICE_TYPE_HEADPHONES 0x04000000 +#define BASS_DEVICE_TYPE_MICROPHONE 0x05000000 +#define BASS_DEVICE_TYPE_HEADSET 0x06000000 +#define BASS_DEVICE_TYPE_HANDSET 0x07000000 +#define BASS_DEVICE_TYPE_DIGITAL 0x08000000 +#define BASS_DEVICE_TYPE_SPDIF 0x09000000 +#define BASS_DEVICE_TYPE_HDMI 0x0a000000 +#define BASS_DEVICE_TYPE_DISPLAYPORT 0x40000000 + +// BASS_GetDeviceInfo flags +#define BASS_DEVICES_AIRPLAY 0x1000000 + typedef struct { - DWORD flags; // device capabilities (DSCAPS_xxx flags) - DWORD hwsize; // size of total device hardware memory - DWORD hwfree; // size of free device hardware memory - DWORD freesam; // number of free sample slots in the hardware - DWORD free3d; // number of free 3D sample slots in the hardware - DWORD minrate; // min sample rate supported by the hardware - DWORD maxrate; // max sample rate supported by the hardware - BOOL eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used) - DWORD minbuf; // recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY) - DWORD dsver; // DirectSound version - DWORD latency; // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY) - DWORD initflags; // BASS_Init "flags" parameter - DWORD speakers; // number of speakers available - DWORD freq; // current output rate + DWORD flags; // device capabilities (DSCAPS_xxx flags) + DWORD hwsize; // size of total device hardware memory + DWORD hwfree; // size of free device hardware memory + DWORD freesam; // number of free sample slots in the hardware + DWORD free3d; // number of free 3D sample slots in the hardware + DWORD minrate; // min sample rate supported by the hardware + DWORD maxrate; // max sample rate supported by the hardware + BOOL + eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used) + DWORD minbuf; // recommended minimum buffer length in ms (requires + // BASS_DEVICE_LATENCY) + DWORD dsver; // DirectSound version + DWORD latency; // delay (in ms) before start of playback (requires + // BASS_DEVICE_LATENCY) + DWORD initflags; // BASS_Init "flags" parameter + DWORD speakers; // number of speakers available + DWORD freq; // current output rate } BASS_INFO; // BASS_INFO flags (from DSOUND.H) -#define DSCAPS_CONTINUOUSRATE 0x00000010 // supports all sample rates between min/maxrate -#define DSCAPS_EMULDRIVER 0x00000020 // device does NOT have hardware DirectSound support -#define DSCAPS_CERTIFIED 0x00000040 // device driver has been certified by Microsoft -#define DSCAPS_SECONDARYMONO 0x00000100 // mono -#define DSCAPS_SECONDARYSTEREO 0x00000200 // stereo -#define DSCAPS_SECONDARY8BIT 0x00000400 // 8 bit -#define DSCAPS_SECONDARY16BIT 0x00000800 // 16 bit +#define DSCAPS_CONTINUOUSRATE \ + 0x00000010 // supports all sample rates between min/maxrate +#define DSCAPS_EMULDRIVER \ + 0x00000020 // device does NOT have hardware DirectSound support +#define DSCAPS_CERTIFIED \ + 0x00000040 // device driver has been certified by Microsoft +#define DSCAPS_SECONDARYMONO 0x00000100 // mono +#define DSCAPS_SECONDARYSTEREO 0x00000200 // stereo +#define DSCAPS_SECONDARY8BIT 0x00000400 // 8 bit +#define DSCAPS_SECONDARY16BIT 0x00000800 // 16 bit // Recording device info structure typedef struct { - DWORD flags; // device capabilities (DSCCAPS_xxx flags) - DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags) - DWORD inputs; // number of inputs - BOOL singlein; // TRUE = only 1 input can be set at a time - DWORD freq; // current input rate + DWORD flags; // device capabilities (DSCCAPS_xxx flags) + DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags) + DWORD inputs; // number of inputs + BOOL singlein; // TRUE = only 1 input can be set at a time + DWORD freq; // current input rate } BASS_RECORDINFO; // BASS_RECORDINFO flags (from DSOUND.H) -#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER // device does NOT have hardware DirectSound recording support -#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED // device driver has been certified by Microsoft +#define DSCCAPS_EMULDRIVER \ + DSCAPS_EMULDRIVER // device does NOT have hardware DirectSound recording + // support +#define DSCCAPS_CERTIFIED \ + DSCAPS_CERTIFIED // device driver has been certified by Microsoft // defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H) #ifndef WAVE_FORMAT_1M08 -#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */ -#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */ -#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */ -#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */ -#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */ -#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */ -#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */ -#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */ -#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */ -#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */ -#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */ -#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */ +#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */ +#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */ +#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */ +#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */ +#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */ +#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */ +#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */ +#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */ +#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */ +#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */ +#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */ +#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */ #endif // Sample info structure typedef struct { - DWORD freq; // default playback rate - float volume; // default volume (0-1) - float pan; // default pan (-1=left, 0=middle, 1=right) - DWORD flags; // BASS_SAMPLE_xxx flags - DWORD length; // length (in bytes) - DWORD max; // maximum simultaneous playbacks - DWORD origres; // original resolution - DWORD chans; // number of channels - DWORD mingap; // minimum gap (ms) between creating channels - DWORD mode3d; // BASS_3DMODE_xxx mode - float mindist; // minimum distance - float maxdist; // maximum distance - DWORD iangle; // angle of inside projection cone - DWORD oangle; // angle of outside projection cone - float outvol; // delta-volume outside the projection cone - DWORD vam; // voice allocation/management flags (BASS_VAM_xxx) - DWORD priority; // priority (0=lowest, 0xffffffff=highest) + DWORD freq; // default playback rate + float volume; // default volume (0-1) + float pan; // default pan (-1=left, 0=middle, 1=right) + DWORD flags; // BASS_SAMPLE_xxx flags + DWORD length; // length (in bytes) + DWORD max; // maximum simultaneous playbacks + DWORD origres; // original resolution + DWORD chans; // number of channels + DWORD mingap; // minimum gap (ms) between creating channels + DWORD mode3d; // BASS_3DMODE_xxx mode + float mindist; // minimum distance + float maxdist; // maximum distance + DWORD iangle; // angle of inside projection cone + DWORD oangle; // angle of outside projection cone + float outvol; // delta-volume outside the projection cone + DWORD vam; // voice allocation/management flags (BASS_VAM_xxx) + DWORD priority; // priority (0=lowest, 0xffffffff=highest) } BASS_SAMPLE; -#define BASS_SAMPLE_8BITS 1 // 8 bit -#define BASS_SAMPLE_FLOAT 256 // 32 bit floating-point -#define BASS_SAMPLE_MONO 2 // mono -#define BASS_SAMPLE_LOOP 4 // looped -#define BASS_SAMPLE_3D 8 // 3D functionality -#define BASS_SAMPLE_SOFTWARE 16 // not using hardware mixing -#define BASS_SAMPLE_MUTEMAX 32 // mute at max distance (3D only) -#define BASS_SAMPLE_VAM 64 // DX7 voice allocation & management -#define BASS_SAMPLE_FX 128 // old implementation of DX8 effects -#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume -#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing -#define BASS_SAMPLE_OVER_DIST 0x30000 // override furthest from listener (3D only) - -#define BASS_STREAM_PRESCAN 0x20000 // enable pin-point seeking/length (MP3/MP2/MP1) -#define BASS_STREAM_AUTOFREE 0x40000 // automatically free the stream when it stop/ends -#define BASS_STREAM_RESTRATE 0x80000 // restrict the download rate of internet file streams -#define BASS_STREAM_BLOCK 0x100000 // download/play internet file stream in small blocks -#define BASS_STREAM_DECODE 0x200000 // don't play the stream, only decode (BASS_ChannelGetData) -#define BASS_STREAM_STATUS 0x800000 // give server status info (HTTP/ICY tags) in DOWNLOADPROC - -#define BASS_MP3_IGNOREDELAY 0x200 // ignore LAME/Xing/VBRI/iTunes delay & padding info -#define BASS_MP3_SETPOS BASS_STREAM_PRESCAN - -#define BASS_MUSIC_FLOAT BASS_SAMPLE_FLOAT -#define BASS_MUSIC_MONO BASS_SAMPLE_MONO -#define BASS_MUSIC_LOOP BASS_SAMPLE_LOOP -#define BASS_MUSIC_3D BASS_SAMPLE_3D -#define BASS_MUSIC_FX BASS_SAMPLE_FX -#define BASS_MUSIC_AUTOFREE BASS_STREAM_AUTOFREE -#define BASS_MUSIC_DECODE BASS_STREAM_DECODE -#define BASS_MUSIC_PRESCAN BASS_STREAM_PRESCAN // calculate playback length -#define BASS_MUSIC_CALCLEN BASS_MUSIC_PRESCAN -#define BASS_MUSIC_RAMP 0x200 // normal ramping -#define BASS_MUSIC_RAMPS 0x400 // sensitive ramping -#define BASS_MUSIC_SURROUND 0x800 // surround sound -#define BASS_MUSIC_SURROUND2 0x1000 // surround sound (mode 2) -#define BASS_MUSIC_FT2PAN 0x2000 // apply FastTracker 2 panning to XM files -#define BASS_MUSIC_FT2MOD 0x2000 // play .MOD as FastTracker 2 does -#define BASS_MUSIC_PT1MOD 0x4000 // play .MOD as ProTracker 1 does -#define BASS_MUSIC_NONINTER 0x10000 // non-interpolated sample mixing -#define BASS_MUSIC_SINCINTER 0x800000 // sinc interpolated sample mixing -#define BASS_MUSIC_POSRESET 0x8000 // stop all notes when moving position -#define BASS_MUSIC_POSRESETEX 0x400000 // stop all notes and reset bmp/etc when moving position -#define BASS_MUSIC_STOPBACK 0x80000 // stop the music on a backwards jump effect -#define BASS_MUSIC_NOSAMPLE 0x100000 // don't load the samples +#define BASS_SAMPLE_8BITS 1 // 8 bit +#define BASS_SAMPLE_FLOAT 256 // 32 bit floating-point +#define BASS_SAMPLE_MONO 2 // mono +#define BASS_SAMPLE_LOOP 4 // looped +#define BASS_SAMPLE_3D 8 // 3D functionality +#define BASS_SAMPLE_SOFTWARE 16 // not using hardware mixing +#define BASS_SAMPLE_MUTEMAX 32 // mute at max distance (3D only) +#define BASS_SAMPLE_VAM 64 // DX7 voice allocation & management +#define BASS_SAMPLE_FX 128 // old implementation of DX8 effects +#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume +#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing +#define BASS_SAMPLE_OVER_DIST \ + 0x30000 // override furthest from listener (3D only) + +#define BASS_STREAM_PRESCAN \ + 0x20000 // enable pin-point seeking/length (MP3/MP2/MP1) +#define BASS_STREAM_AUTOFREE \ + 0x40000 // automatically free the stream when it stop/ends +#define BASS_STREAM_RESTRATE \ + 0x80000 // restrict the download rate of internet file streams +#define BASS_STREAM_BLOCK \ + 0x100000 // download/play internet file stream in small blocks +#define BASS_STREAM_DECODE \ + 0x200000 // don't play the stream, only decode (BASS_ChannelGetData) +#define BASS_STREAM_STATUS \ + 0x800000 // give server status info (HTTP/ICY tags) in DOWNLOADPROC + +#define BASS_MP3_IGNOREDELAY \ + 0x200 // ignore LAME/Xing/VBRI/iTunes delay & padding info +#define BASS_MP3_SETPOS BASS_STREAM_PRESCAN + +#define BASS_MUSIC_FLOAT BASS_SAMPLE_FLOAT +#define BASS_MUSIC_MONO BASS_SAMPLE_MONO +#define BASS_MUSIC_LOOP BASS_SAMPLE_LOOP +#define BASS_MUSIC_3D BASS_SAMPLE_3D +#define BASS_MUSIC_FX BASS_SAMPLE_FX +#define BASS_MUSIC_AUTOFREE BASS_STREAM_AUTOFREE +#define BASS_MUSIC_DECODE BASS_STREAM_DECODE +#define BASS_MUSIC_PRESCAN BASS_STREAM_PRESCAN // calculate playback length +#define BASS_MUSIC_CALCLEN BASS_MUSIC_PRESCAN +#define BASS_MUSIC_RAMP 0x200 // normal ramping +#define BASS_MUSIC_RAMPS 0x400 // sensitive ramping +#define BASS_MUSIC_SURROUND 0x800 // surround sound +#define BASS_MUSIC_SURROUND2 0x1000 // surround sound (mode 2) +#define BASS_MUSIC_FT2PAN 0x2000 // apply FastTracker 2 panning to XM files +#define BASS_MUSIC_FT2MOD 0x2000 // play .MOD as FastTracker 2 does +#define BASS_MUSIC_PT1MOD 0x4000 // play .MOD as ProTracker 1 does +#define BASS_MUSIC_NONINTER 0x10000 // non-interpolated sample mixing +#define BASS_MUSIC_SINCINTER 0x800000 // sinc interpolated sample mixing +#define BASS_MUSIC_POSRESET 0x8000 // stop all notes when moving position +#define BASS_MUSIC_POSRESETEX \ + 0x400000 // stop all notes and reset bmp/etc when moving position +#define BASS_MUSIC_STOPBACK 0x80000 // stop the music on a backwards jump effect +#define BASS_MUSIC_NOSAMPLE 0x100000 // don't load the samples // Speaker assignment flags -#define BASS_SPEAKER_FRONT 0x1000000 // front speakers -#define BASS_SPEAKER_REAR 0x2000000 // rear/side speakers -#define BASS_SPEAKER_CENLFE 0x3000000 // center & LFE speakers (5.1) -#define BASS_SPEAKER_REAR2 0x4000000 // rear center speakers (7.1) -#define BASS_SPEAKER_N(n) ((n)<<24) // n'th pair of speakers (max 15) -#define BASS_SPEAKER_LEFT 0x10000000 // modifier: left -#define BASS_SPEAKER_RIGHT 0x20000000 // modifier: right -#define BASS_SPEAKER_FRONTLEFT BASS_SPEAKER_FRONT|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_FRONTRIGHT BASS_SPEAKER_FRONT|BASS_SPEAKER_RIGHT -#define BASS_SPEAKER_REARLEFT BASS_SPEAKER_REAR|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_REARRIGHT BASS_SPEAKER_REAR|BASS_SPEAKER_RIGHT -#define BASS_SPEAKER_CENTER BASS_SPEAKER_CENLFE|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_LFE BASS_SPEAKER_CENLFE|BASS_SPEAKER_RIGHT -#define BASS_SPEAKER_REAR2LEFT BASS_SPEAKER_REAR2|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_REAR2RIGHT BASS_SPEAKER_REAR2|BASS_SPEAKER_RIGHT - -#define BASS_ASYNCFILE 0x40000000 -#define BASS_UNICODE 0x80000000 - -#define BASS_RECORD_PAUSE 0x8000 // start recording paused -#define BASS_RECORD_ECHOCANCEL 0x2000 -#define BASS_RECORD_AGC 0x4000 +#define BASS_SPEAKER_FRONT 0x1000000 // front speakers +#define BASS_SPEAKER_REAR 0x2000000 // rear/side speakers +#define BASS_SPEAKER_CENLFE 0x3000000 // center & LFE speakers (5.1) +#define BASS_SPEAKER_REAR2 0x4000000 // rear center speakers (7.1) +#define BASS_SPEAKER_N(n) ((n) << 24) // n'th pair of speakers (max 15) +#define BASS_SPEAKER_LEFT 0x10000000 // modifier: left +#define BASS_SPEAKER_RIGHT 0x20000000 // modifier: right +#define BASS_SPEAKER_FRONTLEFT BASS_SPEAKER_FRONT | BASS_SPEAKER_LEFT +#define BASS_SPEAKER_FRONTRIGHT BASS_SPEAKER_FRONT | BASS_SPEAKER_RIGHT +#define BASS_SPEAKER_REARLEFT BASS_SPEAKER_REAR | BASS_SPEAKER_LEFT +#define BASS_SPEAKER_REARRIGHT BASS_SPEAKER_REAR | BASS_SPEAKER_RIGHT +#define BASS_SPEAKER_CENTER BASS_SPEAKER_CENLFE | BASS_SPEAKER_LEFT +#define BASS_SPEAKER_LFE BASS_SPEAKER_CENLFE | BASS_SPEAKER_RIGHT +#define BASS_SPEAKER_REAR2LEFT BASS_SPEAKER_REAR2 | BASS_SPEAKER_LEFT +#define BASS_SPEAKER_REAR2RIGHT BASS_SPEAKER_REAR2 | BASS_SPEAKER_RIGHT + +#define BASS_ASYNCFILE 0x40000000 +#define BASS_UNICODE 0x80000000 + +#define BASS_RECORD_PAUSE 0x8000 // start recording paused +#define BASS_RECORD_ECHOCANCEL 0x2000 +#define BASS_RECORD_AGC 0x4000 // DX7 voice allocation & management flags -#define BASS_VAM_HARDWARE 1 -#define BASS_VAM_SOFTWARE 2 -#define BASS_VAM_TERM_TIME 4 -#define BASS_VAM_TERM_DIST 8 -#define BASS_VAM_TERM_PRIO 16 +#define BASS_VAM_HARDWARE 1 +#define BASS_VAM_SOFTWARE 2 +#define BASS_VAM_TERM_TIME 4 +#define BASS_VAM_TERM_DIST 8 +#define BASS_VAM_TERM_PRIO 16 // Channel info structure typedef struct { - DWORD freq; // default playback rate - DWORD chans; // channels - DWORD flags; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags - DWORD ctype; // type of channel - DWORD origres; // original resolution - HPLUGIN plugin; // plugin - HSAMPLE sample; // sample - const char *filename; // filename + DWORD freq; // default playback rate + DWORD chans; // channels + DWORD flags; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags + DWORD ctype; // type of channel + DWORD origres; // original resolution + HPLUGIN plugin; // plugin + HSAMPLE sample; // sample + const char *filename; // filename } BASS_CHANNELINFO; -#define BASS_ORIGRES_FLOAT 0x10000 +#define BASS_ORIGRES_FLOAT 0x10000 // BASS_CHANNELINFO types -#define BASS_CTYPE_SAMPLE 1 -#define BASS_CTYPE_RECORD 2 -#define BASS_CTYPE_STREAM 0x10000 -#define BASS_CTYPE_STREAM_OGG 0x10002 -#define BASS_CTYPE_STREAM_MP1 0x10003 -#define BASS_CTYPE_STREAM_MP2 0x10004 -#define BASS_CTYPE_STREAM_MP3 0x10005 -#define BASS_CTYPE_STREAM_AIFF 0x10006 -#define BASS_CTYPE_STREAM_CA 0x10007 -#define BASS_CTYPE_STREAM_MF 0x10008 -#define BASS_CTYPE_STREAM_AM 0x10009 -#define BASS_CTYPE_STREAM_DUMMY 0x18000 -#define BASS_CTYPE_STREAM_DEVICE 0x18001 -#define BASS_CTYPE_STREAM_WAV 0x40000 // WAVE flag, LOWORD=codec -#define BASS_CTYPE_STREAM_WAV_PCM 0x50001 -#define BASS_CTYPE_STREAM_WAV_FLOAT 0x50003 -#define BASS_CTYPE_MUSIC_MOD 0x20000 -#define BASS_CTYPE_MUSIC_MTM 0x20001 -#define BASS_CTYPE_MUSIC_S3M 0x20002 -#define BASS_CTYPE_MUSIC_XM 0x20003 -#define BASS_CTYPE_MUSIC_IT 0x20004 -#define BASS_CTYPE_MUSIC_MO3 0x00100 // MO3 flag +#define BASS_CTYPE_SAMPLE 1 +#define BASS_CTYPE_RECORD 2 +#define BASS_CTYPE_STREAM 0x10000 +#define BASS_CTYPE_STREAM_OGG 0x10002 +#define BASS_CTYPE_STREAM_MP1 0x10003 +#define BASS_CTYPE_STREAM_MP2 0x10004 +#define BASS_CTYPE_STREAM_MP3 0x10005 +#define BASS_CTYPE_STREAM_AIFF 0x10006 +#define BASS_CTYPE_STREAM_CA 0x10007 +#define BASS_CTYPE_STREAM_MF 0x10008 +#define BASS_CTYPE_STREAM_AM 0x10009 +#define BASS_CTYPE_STREAM_DUMMY 0x18000 +#define BASS_CTYPE_STREAM_DEVICE 0x18001 +#define BASS_CTYPE_STREAM_WAV 0x40000 // WAVE flag, LOWORD=codec +#define BASS_CTYPE_STREAM_WAV_PCM 0x50001 +#define BASS_CTYPE_STREAM_WAV_FLOAT 0x50003 +#define BASS_CTYPE_MUSIC_MOD 0x20000 +#define BASS_CTYPE_MUSIC_MTM 0x20001 +#define BASS_CTYPE_MUSIC_S3M 0x20002 +#define BASS_CTYPE_MUSIC_XM 0x20003 +#define BASS_CTYPE_MUSIC_IT 0x20004 +#define BASS_CTYPE_MUSIC_MO3 0x00100 // MO3 flag typedef struct { - DWORD ctype; // channel type -#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) - const wchar_t *name; // format description - const wchar_t *exts; // file extension filter (*.ext1;*.ext2;etc...) + DWORD ctype; // channel type +#if defined(_WIN32_WCE) || \ + (WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) + const wchar_t *name; // format description + const wchar_t *exts; // file extension filter (*.ext1;*.ext2;etc...) #else - const char *name; // format description - const char *exts; // file extension filter (*.ext1;*.ext2;etc...) + const char *name; // format description + const char *exts; // file extension filter (*.ext1;*.ext2;etc...) #endif } BASS_PLUGINFORM; typedef struct { - DWORD version; // version (same form as BASS_GetVersion) - DWORD formatc; // number of formats - const BASS_PLUGINFORM *formats; // the array of formats + DWORD version; // version (same form as BASS_GetVersion) + DWORD formatc; // number of formats + const BASS_PLUGINFORM *formats; // the array of formats } BASS_PLUGININFO; // 3D vector (for 3D positions/velocities/orientations) typedef struct BASS_3DVECTOR { #ifdef __cplusplus - BASS_3DVECTOR() {}; - BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {}; + BASS_3DVECTOR(){}; + BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z){}; #endif - float x; // +=right, -=left - float y; // +=up, -=down - float z; // +=front, -=behind + float x; // +=right, -=left + float y; // +=up, -=down + float z; // +=front, -=behind } BASS_3DVECTOR; // 3D channel modes -#define BASS_3DMODE_NORMAL 0 // normal 3D processing -#define BASS_3DMODE_RELATIVE 1 // position is relative to the listener -#define BASS_3DMODE_OFF 2 // no 3D processing +#define BASS_3DMODE_NORMAL 0 // normal 3D processing +#define BASS_3DMODE_RELATIVE 1 // position is relative to the listener +#define BASS_3DMODE_OFF 2 // no 3D processing // software 3D mixing algorithms (used with BASS_CONFIG_3DALGORITHM) -#define BASS_3DALG_DEFAULT 0 -#define BASS_3DALG_OFF 1 -#define BASS_3DALG_FULL 2 -#define BASS_3DALG_LIGHT 3 +#define BASS_3DALG_DEFAULT 0 +#define BASS_3DALG_OFF 1 +#define BASS_3DALG_FULL 2 +#define BASS_3DALG_LIGHT 3 // EAX environments, use with BASS_SetEAXParameters -enum -{ - EAX_ENVIRONMENT_GENERIC, - EAX_ENVIRONMENT_PADDEDCELL, - EAX_ENVIRONMENT_ROOM, - EAX_ENVIRONMENT_BATHROOM, - EAX_ENVIRONMENT_LIVINGROOM, - EAX_ENVIRONMENT_STONEROOM, - EAX_ENVIRONMENT_AUDITORIUM, - EAX_ENVIRONMENT_CONCERTHALL, - EAX_ENVIRONMENT_CAVE, - EAX_ENVIRONMENT_ARENA, - EAX_ENVIRONMENT_HANGAR, - EAX_ENVIRONMENT_CARPETEDHALLWAY, - EAX_ENVIRONMENT_HALLWAY, - EAX_ENVIRONMENT_STONECORRIDOR, - EAX_ENVIRONMENT_ALLEY, - EAX_ENVIRONMENT_FOREST, - EAX_ENVIRONMENT_CITY, - EAX_ENVIRONMENT_MOUNTAINS, - EAX_ENVIRONMENT_QUARRY, - EAX_ENVIRONMENT_PLAIN, - EAX_ENVIRONMENT_PARKINGLOT, - EAX_ENVIRONMENT_SEWERPIPE, - EAX_ENVIRONMENT_UNDERWATER, - EAX_ENVIRONMENT_DRUGGED, - EAX_ENVIRONMENT_DIZZY, - EAX_ENVIRONMENT_PSYCHOTIC, - - EAX_ENVIRONMENT_COUNT // total number of environments +enum { + EAX_ENVIRONMENT_GENERIC, + EAX_ENVIRONMENT_PADDEDCELL, + EAX_ENVIRONMENT_ROOM, + EAX_ENVIRONMENT_BATHROOM, + EAX_ENVIRONMENT_LIVINGROOM, + EAX_ENVIRONMENT_STONEROOM, + EAX_ENVIRONMENT_AUDITORIUM, + EAX_ENVIRONMENT_CONCERTHALL, + EAX_ENVIRONMENT_CAVE, + EAX_ENVIRONMENT_ARENA, + EAX_ENVIRONMENT_HANGAR, + EAX_ENVIRONMENT_CARPETEDHALLWAY, + EAX_ENVIRONMENT_HALLWAY, + EAX_ENVIRONMENT_STONECORRIDOR, + EAX_ENVIRONMENT_ALLEY, + EAX_ENVIRONMENT_FOREST, + EAX_ENVIRONMENT_CITY, + EAX_ENVIRONMENT_MOUNTAINS, + EAX_ENVIRONMENT_QUARRY, + EAX_ENVIRONMENT_PLAIN, + EAX_ENVIRONMENT_PARKINGLOT, + EAX_ENVIRONMENT_SEWERPIPE, + EAX_ENVIRONMENT_UNDERWATER, + EAX_ENVIRONMENT_DRUGGED, + EAX_ENVIRONMENT_DIZZY, + EAX_ENVIRONMENT_PSYCHOTIC, + + EAX_ENVIRONMENT_COUNT // total number of environments }; // EAX presets, usage: BASS_SetEAXParameters(EAX_PRESET_xxx) -#define EAX_PRESET_GENERIC EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F -#define EAX_PRESET_PADDEDCELL EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F -#define EAX_PRESET_ROOM EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F -#define EAX_PRESET_BATHROOM EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F -#define EAX_PRESET_LIVINGROOM EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F -#define EAX_PRESET_STONEROOM EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F -#define EAX_PRESET_AUDITORIUM EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F -#define EAX_PRESET_CONCERTHALL EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F -#define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F -#define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F -#define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F -#define EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F -#define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F -#define EAX_PRESET_STONECORRIDOR EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F -#define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F -#define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F -#define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F -#define EAX_PRESET_MOUNTAINS EAX_ENVIRONMENT_MOUNTAINS,0.194F,7.841F,0.472F -#define EAX_PRESET_QUARRY EAX_ENVIRONMENT_QUARRY,1.0F,1.499F,0.5F -#define EAX_PRESET_PLAIN EAX_ENVIRONMENT_PLAIN,0.097F,2.767F,0.224F -#define EAX_PRESET_PARKINGLOT EAX_ENVIRONMENT_PARKINGLOT,0.208F,1.652F,1.5F -#define EAX_PRESET_SEWERPIPE EAX_ENVIRONMENT_SEWERPIPE,0.652F,2.886F,0.25F -#define EAX_PRESET_UNDERWATER EAX_ENVIRONMENT_UNDERWATER,1.0F,1.499F,0.0F -#define EAX_PRESET_DRUGGED EAX_ENVIRONMENT_DRUGGED,0.875F,8.392F,1.388F -#define EAX_PRESET_DIZZY EAX_ENVIRONMENT_DIZZY,0.139F,17.234F,0.666F -#define EAX_PRESET_PSYCHOTIC EAX_ENVIRONMENT_PSYCHOTIC,0.486F,7.563F,0.806F - -typedef DWORD (CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, void *user); -/* User stream callback function. NOTE: A stream function should obviously be as quick -as possible, other streams (and MOD musics) can't be mixed until it's finished. -handle : The stream that needs writing -buffer : Buffer to write the samples in -length : Number of bytes to write -user : The 'user' parameter value given when calling BASS_StreamCreate -RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end the stream. */ - -#define BASS_STREAMPROC_END 0x80000000 // end of user stream flag +#define EAX_PRESET_GENERIC EAX_ENVIRONMENT_GENERIC, 0.5F, 1.493F, 0.5F +#define EAX_PRESET_PADDEDCELL EAX_ENVIRONMENT_PADDEDCELL, 0.25F, 0.1F, 0.0F +#define EAX_PRESET_ROOM EAX_ENVIRONMENT_ROOM, 0.417F, 0.4F, 0.666F +#define EAX_PRESET_BATHROOM EAX_ENVIRONMENT_BATHROOM, 0.653F, 1.499F, 0.166F +#define EAX_PRESET_LIVINGROOM EAX_ENVIRONMENT_LIVINGROOM, 0.208F, 0.478F, 0.0F +#define EAX_PRESET_STONEROOM EAX_ENVIRONMENT_STONEROOM, 0.5F, 2.309F, 0.888F +#define EAX_PRESET_AUDITORIUM EAX_ENVIRONMENT_AUDITORIUM, 0.403F, 4.279F, 0.5F +#define EAX_PRESET_CONCERTHALL EAX_ENVIRONMENT_CONCERTHALL, 0.5F, 3.961F, 0.5F +#define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE, 0.5F, 2.886F, 1.304F +#define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA, 0.361F, 7.284F, 0.332F +#define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR, 0.5F, 10.0F, 0.3F +#define EAX_PRESET_CARPETEDHALLWAY \ + EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153F, 0.259F, 2.0F +#define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY, 0.361F, 1.493F, 0.0F +#define EAX_PRESET_STONECORRIDOR \ + EAX_ENVIRONMENT_STONECORRIDOR, 0.444F, 2.697F, 0.638F +#define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY, 0.25F, 1.752F, 0.776F +#define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST, 0.111F, 3.145F, 0.472F +#define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY, 0.111F, 2.767F, 0.224F +#define EAX_PRESET_MOUNTAINS EAX_ENVIRONMENT_MOUNTAINS, 0.194F, 7.841F, 0.472F +#define EAX_PRESET_QUARRY EAX_ENVIRONMENT_QUARRY, 1.0F, 1.499F, 0.5F +#define EAX_PRESET_PLAIN EAX_ENVIRONMENT_PLAIN, 0.097F, 2.767F, 0.224F +#define EAX_PRESET_PARKINGLOT EAX_ENVIRONMENT_PARKINGLOT, 0.208F, 1.652F, 1.5F +#define EAX_PRESET_SEWERPIPE EAX_ENVIRONMENT_SEWERPIPE, 0.652F, 2.886F, 0.25F +#define EAX_PRESET_UNDERWATER EAX_ENVIRONMENT_UNDERWATER, 1.0F, 1.499F, 0.0F +#define EAX_PRESET_DRUGGED EAX_ENVIRONMENT_DRUGGED, 0.875F, 8.392F, 1.388F +#define EAX_PRESET_DIZZY EAX_ENVIRONMENT_DIZZY, 0.139F, 17.234F, 0.666F +#define EAX_PRESET_PSYCHOTIC EAX_ENVIRONMENT_PSYCHOTIC, 0.486F, 7.563F, 0.806F + +typedef DWORD(CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, + void *user); +/* User stream callback function. NOTE: A stream function should obviously be as +quick as possible, other streams (and MOD musics) can't be mixed until it's +finished. handle : The stream that needs writing buffer : Buffer to write the +samples in length : Number of bytes to write user : The 'user' parameter value +given when calling BASS_StreamCreate RETURN : Number of bytes written. Set the +BASS_STREAMPROC_END flag to end the stream. */ + +#define BASS_STREAMPROC_END 0x80000000 // end of user stream flag // special STREAMPROCs -#define STREAMPROC_DUMMY (STREAMPROC*)0 // "dummy" stream -#define STREAMPROC_PUSH (STREAMPROC*)-1 // push stream -#define STREAMPROC_DEVICE (STREAMPROC*)-2 // device mix stream +#define STREAMPROC_DUMMY (STREAMPROC *)0 // "dummy" stream +#define STREAMPROC_PUSH (STREAMPROC *)-1 // push stream +#define STREAMPROC_DEVICE (STREAMPROC *)-2 // device mix stream // BASS_StreamCreateFileUser file systems -#define STREAMFILE_NOBUFFER 0 -#define STREAMFILE_BUFFER 1 -#define STREAMFILE_BUFFERPUSH 2 +#define STREAMFILE_NOBUFFER 0 +#define STREAMFILE_BUFFER 1 +#define STREAMFILE_BUFFERPUSH 2 // User file stream callback functions -typedef void (CALLBACK FILECLOSEPROC)(void *user); -typedef QWORD (CALLBACK FILELENPROC)(void *user); -typedef DWORD (CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user); -typedef BOOL (CALLBACK FILESEEKPROC)(QWORD offset, void *user); +typedef void(CALLBACK FILECLOSEPROC)(void *user); +typedef QWORD(CALLBACK FILELENPROC)(void *user); +typedef DWORD(CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user); +typedef BOOL(CALLBACK FILESEEKPROC)(QWORD offset, void *user); typedef struct { - FILECLOSEPROC *close; - FILELENPROC *length; - FILEREADPROC *read; - FILESEEKPROC *seek; + FILECLOSEPROC *close; + FILELENPROC *length; + FILEREADPROC *read; + FILESEEKPROC *seek; } BASS_FILEPROCS; // BASS_StreamPutFileData options -#define BASS_FILEDATA_END 0 // end & close the file +#define BASS_FILEDATA_END 0 // end & close the file // BASS_StreamGetFilePosition modes -#define BASS_FILEPOS_CURRENT 0 -#define BASS_FILEPOS_DECODE BASS_FILEPOS_CURRENT -#define BASS_FILEPOS_DOWNLOAD 1 -#define BASS_FILEPOS_END 2 -#define BASS_FILEPOS_START 3 -#define BASS_FILEPOS_CONNECTED 4 -#define BASS_FILEPOS_BUFFER 5 -#define BASS_FILEPOS_SOCKET 6 -#define BASS_FILEPOS_ASYNCBUF 7 -#define BASS_FILEPOS_SIZE 8 -#define BASS_FILEPOS_BUFFERING 9 - -typedef void (CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, void *user); +#define BASS_FILEPOS_CURRENT 0 +#define BASS_FILEPOS_DECODE BASS_FILEPOS_CURRENT +#define BASS_FILEPOS_DOWNLOAD 1 +#define BASS_FILEPOS_END 2 +#define BASS_FILEPOS_START 3 +#define BASS_FILEPOS_CONNECTED 4 +#define BASS_FILEPOS_BUFFER 5 +#define BASS_FILEPOS_SOCKET 6 +#define BASS_FILEPOS_ASYNCBUF 7 +#define BASS_FILEPOS_SIZE 8 +#define BASS_FILEPOS_BUFFERING 9 + +typedef void(CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, + void *user); /* Internet stream download callback function. buffer : Buffer containing the downloaded data... NULL=end of download length : Number of bytes in the buffer user : The 'user' parameter value given when calling BASS_StreamCreateURL */ // BASS_ChannelSetSync types -#define BASS_SYNC_POS 0 -#define BASS_SYNC_END 2 -#define BASS_SYNC_META 4 -#define BASS_SYNC_SLIDE 5 -#define BASS_SYNC_STALL 6 -#define BASS_SYNC_DOWNLOAD 7 -#define BASS_SYNC_FREE 8 -#define BASS_SYNC_SETPOS 11 -#define BASS_SYNC_MUSICPOS 10 -#define BASS_SYNC_MUSICINST 1 -#define BASS_SYNC_MUSICFX 3 -#define BASS_SYNC_OGG_CHANGE 12 -#define BASS_SYNC_MIXTIME 0x40000000 // flag: sync at mixtime, else at playtime -#define BASS_SYNC_ONETIME 0x80000000 // flag: sync only once, else continuously - -typedef void (CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, void *user); +#define BASS_SYNC_POS 0 +#define BASS_SYNC_END 2 +#define BASS_SYNC_META 4 +#define BASS_SYNC_SLIDE 5 +#define BASS_SYNC_STALL 6 +#define BASS_SYNC_DOWNLOAD 7 +#define BASS_SYNC_FREE 8 +#define BASS_SYNC_SETPOS 11 +#define BASS_SYNC_MUSICPOS 10 +#define BASS_SYNC_MUSICINST 1 +#define BASS_SYNC_MUSICFX 3 +#define BASS_SYNC_OGG_CHANGE 12 +#define BASS_SYNC_MIXTIME 0x40000000 // flag: sync at mixtime, else at playtime +#define BASS_SYNC_ONETIME 0x80000000 // flag: sync only once, else continuously + +typedef void(CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, + void *user); /* Sync callback function. NOTE: a sync callback function should be very quick as other syncs can't be processed until it has finished. If the sync is a "mixtime" sync, then other streams and MOD musics can't be mixed until @@ -574,7 +598,8 @@ channel: Channel that the sync occured in data : Additional data associated with the sync's occurance user : The 'user' parameter given when calling BASS_ChannelSetSync */ -typedef void (CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user); +typedef void(CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, + DWORD length, void *user); /* DSP callback function. NOTE: A DSP function should obviously be as quick as possible... other DSP functions, streams and MOD musics can not be processed until it's finished. @@ -584,7 +609,8 @@ buffer : Buffer to apply the DSP to length : Number of bytes in the buffer user : The 'user' parameter given when calling BASS_ChannelSetDSP */ -typedef BOOL (CALLBACK RECORDPROC)(HRECORD handle, const void *buffer, DWORD length, void *user); +typedef BOOL(CALLBACK RECORDPROC)(HRECORD handle, const void *buffer, + DWORD length, void *user); /* Recording callback function. handle : The recording handle buffer : Buffer containing the recorded sample data @@ -593,394 +619,398 @@ user : The 'user' parameter value given when calling BASS_RecordStart RETURN : TRUE = continue recording, FALSE = stop */ // BASS_ChannelIsActive return values -#define BASS_ACTIVE_STOPPED 0 -#define BASS_ACTIVE_PLAYING 1 -#define BASS_ACTIVE_STALLED 2 -#define BASS_ACTIVE_PAUSED 3 +#define BASS_ACTIVE_STOPPED 0 +#define BASS_ACTIVE_PLAYING 1 +#define BASS_ACTIVE_STALLED 2 +#define BASS_ACTIVE_PAUSED 3 // Channel attributes -#define BASS_ATTRIB_FREQ 1 -#define BASS_ATTRIB_VOL 2 -#define BASS_ATTRIB_PAN 3 -#define BASS_ATTRIB_EAXMIX 4 -#define BASS_ATTRIB_NOBUFFER 5 -#define BASS_ATTRIB_VBR 6 -#define BASS_ATTRIB_CPU 7 -#define BASS_ATTRIB_SRC 8 -#define BASS_ATTRIB_NET_RESUME 9 -#define BASS_ATTRIB_SCANINFO 10 -#define BASS_ATTRIB_NORAMP 11 -#define BASS_ATTRIB_BITRATE 12 -#define BASS_ATTRIB_BUFFER 13 -#define BASS_ATTRIB_MUSIC_AMPLIFY 0x100 -#define BASS_ATTRIB_MUSIC_PANSEP 0x101 -#define BASS_ATTRIB_MUSIC_PSCALER 0x102 -#define BASS_ATTRIB_MUSIC_BPM 0x103 -#define BASS_ATTRIB_MUSIC_SPEED 0x104 +#define BASS_ATTRIB_FREQ 1 +#define BASS_ATTRIB_VOL 2 +#define BASS_ATTRIB_PAN 3 +#define BASS_ATTRIB_EAXMIX 4 +#define BASS_ATTRIB_NOBUFFER 5 +#define BASS_ATTRIB_VBR 6 +#define BASS_ATTRIB_CPU 7 +#define BASS_ATTRIB_SRC 8 +#define BASS_ATTRIB_NET_RESUME 9 +#define BASS_ATTRIB_SCANINFO 10 +#define BASS_ATTRIB_NORAMP 11 +#define BASS_ATTRIB_BITRATE 12 +#define BASS_ATTRIB_BUFFER 13 +#define BASS_ATTRIB_MUSIC_AMPLIFY 0x100 +#define BASS_ATTRIB_MUSIC_PANSEP 0x101 +#define BASS_ATTRIB_MUSIC_PSCALER 0x102 +#define BASS_ATTRIB_MUSIC_BPM 0x103 +#define BASS_ATTRIB_MUSIC_SPEED 0x104 #define BASS_ATTRIB_MUSIC_VOL_GLOBAL 0x105 -#define BASS_ATTRIB_MUSIC_ACTIVE 0x106 -#define BASS_ATTRIB_MUSIC_VOL_CHAN 0x200 // + channel # -#define BASS_ATTRIB_MUSIC_VOL_INST 0x300 // + instrument # +#define BASS_ATTRIB_MUSIC_ACTIVE 0x106 +#define BASS_ATTRIB_MUSIC_VOL_CHAN 0x200 // + channel # +#define BASS_ATTRIB_MUSIC_VOL_INST 0x300 // + instrument # // BASS_ChannelSlideAttribute flags -#define BASS_SLIDE_LOG 0x1000000 +#define BASS_SLIDE_LOG 0x1000000 // BASS_ChannelGetData flags -#define BASS_DATA_AVAILABLE 0 // query how much data is buffered -#define BASS_DATA_FIXED 0x20000000 // flag: return 8.24 fixed-point data -#define BASS_DATA_FLOAT 0x40000000 // flag: return floating-point sample data -#define BASS_DATA_FFT256 0x80000000 // 256 sample FFT -#define BASS_DATA_FFT512 0x80000001 // 512 FFT -#define BASS_DATA_FFT1024 0x80000002 // 1024 FFT -#define BASS_DATA_FFT2048 0x80000003 // 2048 FFT -#define BASS_DATA_FFT4096 0x80000004 // 4096 FFT -#define BASS_DATA_FFT8192 0x80000005 // 8192 FFT -#define BASS_DATA_FFT16384 0x80000006 // 16384 FFT -#define BASS_DATA_FFT32768 0x80000007 // 32768 FFT -#define BASS_DATA_FFT_INDIVIDUAL 0x10 // FFT flag: FFT for each channel, else all combined -#define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window -#define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias -#define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data +#define BASS_DATA_AVAILABLE 0 // query how much data is buffered +#define BASS_DATA_FIXED 0x20000000 // flag: return 8.24 fixed-point data +#define BASS_DATA_FLOAT 0x40000000 // flag: return floating-point sample data +#define BASS_DATA_FFT256 0x80000000 // 256 sample FFT +#define BASS_DATA_FFT512 0x80000001 // 512 FFT +#define BASS_DATA_FFT1024 0x80000002 // 1024 FFT +#define BASS_DATA_FFT2048 0x80000003 // 2048 FFT +#define BASS_DATA_FFT4096 0x80000004 // 4096 FFT +#define BASS_DATA_FFT8192 0x80000005 // 8192 FFT +#define BASS_DATA_FFT16384 0x80000006 // 16384 FFT +#define BASS_DATA_FFT32768 0x80000007 // 32768 FFT +#define BASS_DATA_FFT_INDIVIDUAL \ + 0x10 // FFT flag: FFT for each channel, else all combined +#define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window +#define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias +#define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data // BASS_ChannelGetLevelEx flags -#define BASS_LEVEL_MONO 1 -#define BASS_LEVEL_STEREO 2 -#define BASS_LEVEL_RMS 4 -#define BASS_LEVEL_VOLPAN 8 +#define BASS_LEVEL_MONO 1 +#define BASS_LEVEL_STEREO 2 +#define BASS_LEVEL_RMS 4 +#define BASS_LEVEL_VOLPAN 8 // BASS_ChannelGetTags types : what's returned -#define BASS_TAG_ID3 0 // ID3v1 tags : TAG_ID3 structure -#define BASS_TAG_ID3V2 1 // ID3v2 tags : variable length block -#define BASS_TAG_OGG 2 // OGG comments : series of null-terminated UTF-8 strings -#define BASS_TAG_HTTP 3 // HTTP headers : series of null-terminated ANSI strings -#define BASS_TAG_ICY 4 // ICY headers : series of null-terminated ANSI strings -#define BASS_TAG_META 5 // ICY metadata : ANSI string -#define BASS_TAG_APE 6 // APE tags : series of null-terminated UTF-8 strings -#define BASS_TAG_MP4 7 // MP4/iTunes metadata : series of null-terminated UTF-8 strings -#define BASS_TAG_WMA 8 // WMA tags : series of null-terminated UTF-8 strings -#define BASS_TAG_VENDOR 9 // OGG encoder : UTF-8 string -#define BASS_TAG_LYRICS3 10 // Lyric3v2 tag : ASCII string -#define BASS_TAG_CA_CODEC 11 // CoreAudio codec info : TAG_CA_CODEC structure -#define BASS_TAG_MF 13 // Media Foundation tags : series of null-terminated UTF-8 strings -#define BASS_TAG_WAVEFORMAT 14 // WAVE format : WAVEFORMATEEX structure -#define BASS_TAG_AM_MIME 15 // Android Media MIME type : ASCII string -#define BASS_TAG_AM_NAME 16 // Android Media codec name : ASCII string -#define BASS_TAG_RIFF_INFO 0x100 // RIFF "INFO" tags : series of null-terminated ANSI strings -#define BASS_TAG_RIFF_BEXT 0x101 // RIFF/BWF "bext" tags : TAG_BEXT structure -#define BASS_TAG_RIFF_CART 0x102 // RIFF/BWF "cart" tags : TAG_CART structure -#define BASS_TAG_RIFF_DISP 0x103 // RIFF "DISP" text tag : ANSI string -#define BASS_TAG_RIFF_CUE 0x104 // RIFF "cue " chunk : TAG_CUE structure -#define BASS_TAG_RIFF_SMPL 0x105 // RIFF "smpl" chunk : TAG_SMPL structure -#define BASS_TAG_APE_BINARY 0x1000 // + index #, binary APE tag : TAG_APE_BINARY structure -#define BASS_TAG_MUSIC_NAME 0x10000 // MOD music name : ANSI string -#define BASS_TAG_MUSIC_MESSAGE 0x10001 // MOD message : ANSI string -#define BASS_TAG_MUSIC_ORDERS 0x10002 // MOD order list : BYTE array of pattern numbers -#define BASS_TAG_MUSIC_AUTH 0x10003 // MOD author : UTF-8 string -#define BASS_TAG_MUSIC_INST 0x10100 // + instrument #, MOD instrument name : ANSI string -#define BASS_TAG_MUSIC_SAMPLE 0x10300 // + sample #, MOD sample name : ANSI string - +#define BASS_TAG_ID3 0 // ID3v1 tags : TAG_ID3 structure +#define BASS_TAG_ID3V2 1 // ID3v2 tags : variable length block +#define BASS_TAG_OGG 2 // OGG comments : series of null-terminated UTF-8 strings +#define BASS_TAG_HTTP 3 // HTTP headers : series of null-terminated ANSI strings +#define BASS_TAG_ICY 4 // ICY headers : series of null-terminated ANSI strings +#define BASS_TAG_META 5 // ICY metadata : ANSI string +#define BASS_TAG_APE 6 // APE tags : series of null-terminated UTF-8 strings +#define BASS_TAG_MP4 \ + 7 // MP4/iTunes metadata : series of null-terminated UTF-8 strings +#define BASS_TAG_WMA 8 // WMA tags : series of null-terminated UTF-8 strings +#define BASS_TAG_VENDOR 9 // OGG encoder : UTF-8 string +#define BASS_TAG_LYRICS3 10 // Lyric3v2 tag : ASCII string +#define BASS_TAG_CA_CODEC 11 // CoreAudio codec info : TAG_CA_CODEC structure +#define BASS_TAG_MF \ + 13 // Media Foundation tags : series of null-terminated UTF-8 strings +#define BASS_TAG_WAVEFORMAT 14 // WAVE format : WAVEFORMATEEX structure +#define BASS_TAG_AM_MIME 15 // Android Media MIME type : ASCII string +#define BASS_TAG_AM_NAME 16 // Android Media codec name : ASCII string +#define BASS_TAG_RIFF_INFO \ + 0x100 // RIFF "INFO" tags : series of null-terminated ANSI strings +#define BASS_TAG_RIFF_BEXT 0x101 // RIFF/BWF "bext" tags : TAG_BEXT structure +#define BASS_TAG_RIFF_CART 0x102 // RIFF/BWF "cart" tags : TAG_CART structure +#define BASS_TAG_RIFF_DISP 0x103 // RIFF "DISP" text tag : ANSI string +#define BASS_TAG_RIFF_CUE 0x104 // RIFF "cue " chunk : TAG_CUE structure +#define BASS_TAG_RIFF_SMPL 0x105 // RIFF "smpl" chunk : TAG_SMPL structure +#define BASS_TAG_APE_BINARY \ + 0x1000 // + index #, binary APE tag : TAG_APE_BINARY structure +#define BASS_TAG_MUSIC_NAME 0x10000 // MOD music name : ANSI string +#define BASS_TAG_MUSIC_MESSAGE 0x10001 // MOD message : ANSI string +#define BASS_TAG_MUSIC_ORDERS \ + 0x10002 // MOD order list : BYTE array of pattern numbers +#define BASS_TAG_MUSIC_AUTH 0x10003 // MOD author : UTF-8 string +#define BASS_TAG_MUSIC_INST \ + 0x10100 // + instrument #, MOD instrument name : ANSI string +#define BASS_TAG_MUSIC_SAMPLE \ + 0x10300 // + sample #, MOD sample name : ANSI string + // ID3v1 tag structure typedef struct { - char id[3]; - char title[30]; - char artist[30]; - char album[30]; - char year[4]; - char comment[30]; - BYTE genre; + char id[3]; + char title[30]; + char artist[30]; + char album[30]; + char year[4]; + char comment[30]; + BYTE genre; } TAG_ID3; - + // Binary APE tag structure -typedef struct { - const char *key; - const void *data; - DWORD length; -} TAG_APE_BINARY; - -// BWF "bext" tag structure +typedef struct { + const char *key; + const void *data; + DWORD length; +} TAG_APE_BINARY; + +// BWF "bext" tag structure #ifdef _MSC_VER #pragma warning(push) -#pragma warning(disable:4200) +#pragma warning(disable : 4200) #endif -#pragma pack(push,1) +#pragma pack(push, 1) typedef struct { - char Description[256]; // description - char Originator[32]; // name of the originator - char OriginatorReference[32]; // reference of the originator - char OriginationDate[10]; // date of creation (yyyy-mm-dd) - char OriginationTime[8]; // time of creation (hh-mm-ss) - QWORD TimeReference; // first sample count since midnight (little-endian) - WORD Version; // BWF version (little-endian) - BYTE UMID[64]; // SMPTE UMID - BYTE Reserved[190]; -#if defined(__GNUC__) && __GNUC__<3 - char CodingHistory[0]; // history -#elif 1 // change to 0 if compiler fails the following line - char CodingHistory[]; // history + char Description[256]; // description + char Originator[32]; // name of the originator + char OriginatorReference[32]; // reference of the originator + char OriginationDate[10]; // date of creation (yyyy-mm-dd) + char OriginationTime[8]; // time of creation (hh-mm-ss) + QWORD TimeReference; // first sample count since midnight (little-endian) + WORD Version; // BWF version (little-endian) + BYTE UMID[64]; // SMPTE UMID + BYTE Reserved[190]; +#if defined(__GNUC__) && __GNUC__ < 3 + char CodingHistory[0]; // history +#elif 1 // change to 0 if compiler fails the following line + char CodingHistory[]; // history #else - char CodingHistory[1]; // history + char CodingHistory[1]; // history #endif } TAG_BEXT; -#pragma pack(pop) - -// BWF "cart" tag structures -typedef struct -{ - DWORD dwUsage; // FOURCC timer usage ID - DWORD dwValue; // timer value in samples from head -} TAG_CART_TIMER; - -typedef struct -{ - char Version[4]; // version of the data structure - char Title[64]; // title of cart audio sequence - char Artist[64]; // artist or creator name - char CutID[64]; // cut number identification - char ClientID[64]; // client identification - char Category[64]; // category ID, PSA, NEWS, etc - char Classification[64]; // classification or auxiliary key - char OutCue[64]; // out cue text - char StartDate[10]; // yyyy-mm-dd - char StartTime[8]; // hh:mm:ss - char EndDate[10]; // yyyy-mm-dd - char EndTime[8]; // hh:mm:ss - char ProducerAppID[64]; // name of vendor or application - char ProducerAppVersion[64]; // version of producer application - char UserDef[64]; // user defined text - DWORD dwLevelReference; // sample value for 0 dB reference - TAG_CART_TIMER PostTimer[8]; // 8 time markers after head - char Reserved[276]; - char URL[1024]; // uniform resource locator -#if defined(__GNUC__) && __GNUC__<3 - char TagText[0]; // free form text for scripts or tags -#elif 1 // change to 0 if compiler fails the following line - char TagText[]; // free form text for scripts or tags -#else - char TagText[1]; // free form text for scripts or tags -#endif -} TAG_CART; - -// RIFF "cue " tag structures -typedef struct -{ - DWORD dwName; - DWORD dwPosition; - DWORD fccChunk; - DWORD dwChunkStart; - DWORD dwBlockStart; - DWORD dwSampleOffset; -} TAG_CUE_POINT; - -typedef struct -{ - DWORD dwCuePoints; -#if defined(__GNUC__) && __GNUC__<3 - TAG_CUE_POINT CuePoints[0]; -#elif 1 // change to 0 if compiler fails the following line - TAG_CUE_POINT CuePoints[]; -#else - TAG_CUE_POINT CuePoints[1]; -#endif -} TAG_CUE; - -// RIFF "smpl" tag structures -typedef struct -{ - DWORD dwIdentifier; - DWORD dwType; - DWORD dwStart; - DWORD dwEnd; - DWORD dwFraction; - DWORD dwPlayCount; -} TAG_SMPL_LOOP; - -typedef struct -{ - DWORD dwManufacturer; - DWORD dwProduct; - DWORD dwSamplePeriod; - DWORD dwMIDIUnityNote; - DWORD dwMIDIPitchFraction; - DWORD dwSMPTEFormat; - DWORD dwSMPTEOffset; - DWORD cSampleLoops; - DWORD cbSamplerData; -#if defined(__GNUC__) && __GNUC__<3 - TAG_SMPL_LOOP SampleLoops[0]; -#elif 1 // change to 0 if compiler fails the following line - TAG_SMPL_LOOP SampleLoops[]; -#else - TAG_SMPL_LOOP SampleLoops[1]; -#endif -} TAG_SMPL; -#ifdef _MSC_VER -#pragma warning(pop) -#endif - +#pragma pack(pop) + +// BWF "cart" tag structures +typedef struct { + DWORD dwUsage; // FOURCC timer usage ID + DWORD dwValue; // timer value in samples from head +} TAG_CART_TIMER; + +typedef struct { + char Version[4]; // version of the data structure + char Title[64]; // title of cart audio sequence + char Artist[64]; // artist or creator name + char CutID[64]; // cut number identification + char ClientID[64]; // client identification + char Category[64]; // category ID, PSA, NEWS, etc + char Classification[64]; // classification or auxiliary key + char OutCue[64]; // out cue text + char StartDate[10]; // yyyy-mm-dd + char StartTime[8]; // hh:mm:ss + char EndDate[10]; // yyyy-mm-dd + char EndTime[8]; // hh:mm:ss + char ProducerAppID[64]; // name of vendor or application + char ProducerAppVersion[64]; // version of producer application + char UserDef[64]; // user defined text + DWORD dwLevelReference; // sample value for 0 dB reference + TAG_CART_TIMER PostTimer[8]; // 8 time markers after head + char Reserved[276]; + char URL[1024]; // uniform resource locator +#if defined(__GNUC__) && __GNUC__ < 3 + char TagText[0]; // free form text for scripts or tags +#elif 1 // change to 0 if compiler fails the following line + char TagText[]; // free form text for scripts or tags +#else + char TagText[1]; // free form text for scripts or tags +#endif +} TAG_CART; + +// RIFF "cue " tag structures +typedef struct { + DWORD dwName; + DWORD dwPosition; + DWORD fccChunk; + DWORD dwChunkStart; + DWORD dwBlockStart; + DWORD dwSampleOffset; +} TAG_CUE_POINT; + +typedef struct { + DWORD dwCuePoints; +#if defined(__GNUC__) && __GNUC__ < 3 + TAG_CUE_POINT CuePoints[0]; +#elif 1 // change to 0 if compiler fails the following line + TAG_CUE_POINT CuePoints[]; +#else + TAG_CUE_POINT CuePoints[1]; +#endif +} TAG_CUE; + +// RIFF "smpl" tag structures +typedef struct { + DWORD dwIdentifier; + DWORD dwType; + DWORD dwStart; + DWORD dwEnd; + DWORD dwFraction; + DWORD dwPlayCount; +} TAG_SMPL_LOOP; + +typedef struct { + DWORD dwManufacturer; + DWORD dwProduct; + DWORD dwSamplePeriod; + DWORD dwMIDIUnityNote; + DWORD dwMIDIPitchFraction; + DWORD dwSMPTEFormat; + DWORD dwSMPTEOffset; + DWORD cSampleLoops; + DWORD cbSamplerData; +#if defined(__GNUC__) && __GNUC__ < 3 + TAG_SMPL_LOOP SampleLoops[0]; +#elif 1 // change to 0 if compiler fails the following line + TAG_SMPL_LOOP SampleLoops[]; +#else + TAG_SMPL_LOOP SampleLoops[1]; +#endif +} TAG_SMPL; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + // CoreAudio codec info structure typedef struct { - DWORD ftype; // file format - DWORD atype; // audio format - const char *name; // description + DWORD ftype; // file format + DWORD atype; // audio format + const char *name; // description } TAG_CA_CODEC; -#ifndef _WAVEFORMATEX_ -#define _WAVEFORMATEX_ -#pragma pack(push,1) -typedef struct tWAVEFORMATEX -{ - WORD wFormatTag; - WORD nChannels; - DWORD nSamplesPerSec; - DWORD nAvgBytesPerSec; - WORD nBlockAlign; - WORD wBitsPerSample; - WORD cbSize; -} WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX; -typedef const WAVEFORMATEX *LPCWAVEFORMATEX; -#pragma pack(pop) -#endif - +#ifndef _WAVEFORMATEX_ +#define _WAVEFORMATEX_ +#pragma pack(push, 1) +typedef struct tWAVEFORMATEX { + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; + WORD wBitsPerSample; + WORD cbSize; +} WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX; +typedef const WAVEFORMATEX *LPCWAVEFORMATEX; +#pragma pack(pop) +#endif + // BASS_ChannelGetLength/GetPosition/SetPosition modes -#define BASS_POS_BYTE 0 // byte position -#define BASS_POS_MUSIC_ORDER 1 // order.row position, MAKELONG(order,row) -#define BASS_POS_OGG 3 // OGG bitstream number -#define BASS_POS_RESET 0x2000000 // flag: reset user file buffers -#define BASS_POS_RELATIVE 0x4000000 // flag: seek relative to the current position -#define BASS_POS_INEXACT 0x8000000 // flag: allow seeking to inexact position -#define BASS_POS_DECODE 0x10000000 // flag: get the decoding (not playing) position -#define BASS_POS_DECODETO 0x20000000 // flag: decode to the position instead of seeking -#define BASS_POS_SCAN 0x40000000 // flag: scan to the position +#define BASS_POS_BYTE 0 // byte position +#define BASS_POS_MUSIC_ORDER 1 // order.row position, MAKELONG(order,row) +#define BASS_POS_OGG 3 // OGG bitstream number +#define BASS_POS_RESET 0x2000000 // flag: reset user file buffers +#define BASS_POS_RELATIVE \ + 0x4000000 // flag: seek relative to the current position +#define BASS_POS_INEXACT 0x8000000 // flag: allow seeking to inexact position +#define BASS_POS_DECODE \ + 0x10000000 // flag: get the decoding (not playing) position +#define BASS_POS_DECODETO \ + 0x20000000 // flag: decode to the position instead of seeking +#define BASS_POS_SCAN 0x40000000 // flag: scan to the position // BASS_ChannelSetDevice/GetDevice option -#define BASS_NODEVICE 0x20000 +#define BASS_NODEVICE 0x20000 // BASS_RecordSetInput flags -#define BASS_INPUT_OFF 0x10000 -#define BASS_INPUT_ON 0x20000 - -#define BASS_INPUT_TYPE_MASK 0xff000000 -#define BASS_INPUT_TYPE_UNDEF 0x00000000 -#define BASS_INPUT_TYPE_DIGITAL 0x01000000 -#define BASS_INPUT_TYPE_LINE 0x02000000 -#define BASS_INPUT_TYPE_MIC 0x03000000 -#define BASS_INPUT_TYPE_SYNTH 0x04000000 -#define BASS_INPUT_TYPE_CD 0x05000000 -#define BASS_INPUT_TYPE_PHONE 0x06000000 -#define BASS_INPUT_TYPE_SPEAKER 0x07000000 -#define BASS_INPUT_TYPE_WAVE 0x08000000 -#define BASS_INPUT_TYPE_AUX 0x09000000 -#define BASS_INPUT_TYPE_ANALOG 0x0a000000 +#define BASS_INPUT_OFF 0x10000 +#define BASS_INPUT_ON 0x20000 + +#define BASS_INPUT_TYPE_MASK 0xff000000 +#define BASS_INPUT_TYPE_UNDEF 0x00000000 +#define BASS_INPUT_TYPE_DIGITAL 0x01000000 +#define BASS_INPUT_TYPE_LINE 0x02000000 +#define BASS_INPUT_TYPE_MIC 0x03000000 +#define BASS_INPUT_TYPE_SYNTH 0x04000000 +#define BASS_INPUT_TYPE_CD 0x05000000 +#define BASS_INPUT_TYPE_PHONE 0x06000000 +#define BASS_INPUT_TYPE_SPEAKER 0x07000000 +#define BASS_INPUT_TYPE_WAVE 0x08000000 +#define BASS_INPUT_TYPE_AUX 0x09000000 +#define BASS_INPUT_TYPE_ANALOG 0x0a000000 // BASS_ChannelSetFX effect types -#define BASS_FX_DX8_CHORUS 0 -#define BASS_FX_DX8_COMPRESSOR 1 -#define BASS_FX_DX8_DISTORTION 2 -#define BASS_FX_DX8_ECHO 3 -#define BASS_FX_DX8_FLANGER 4 -#define BASS_FX_DX8_GARGLE 5 -#define BASS_FX_DX8_I3DL2REVERB 6 -#define BASS_FX_DX8_PARAMEQ 7 -#define BASS_FX_DX8_REVERB 8 -#define BASS_FX_VOLUME 9 +#define BASS_FX_DX8_CHORUS 0 +#define BASS_FX_DX8_COMPRESSOR 1 +#define BASS_FX_DX8_DISTORTION 2 +#define BASS_FX_DX8_ECHO 3 +#define BASS_FX_DX8_FLANGER 4 +#define BASS_FX_DX8_GARGLE 5 +#define BASS_FX_DX8_I3DL2REVERB 6 +#define BASS_FX_DX8_PARAMEQ 7 +#define BASS_FX_DX8_REVERB 8 +#define BASS_FX_VOLUME 9 typedef struct { - float fWetDryMix; - float fDepth; - float fFeedback; - float fFrequency; - DWORD lWaveform; // 0=triangle, 1=sine - float fDelay; - DWORD lPhase; // BASS_DX8_PHASE_xxx + float fWetDryMix; + float fDepth; + float fFeedback; + float fFrequency; + DWORD lWaveform; // 0=triangle, 1=sine + float fDelay; + DWORD lPhase; // BASS_DX8_PHASE_xxx } BASS_DX8_CHORUS; typedef struct { - float fGain; - float fAttack; - float fRelease; - float fThreshold; - float fRatio; - float fPredelay; + float fGain; + float fAttack; + float fRelease; + float fThreshold; + float fRatio; + float fPredelay; } BASS_DX8_COMPRESSOR; typedef struct { - float fGain; - float fEdge; - float fPostEQCenterFrequency; - float fPostEQBandwidth; - float fPreLowpassCutoff; + float fGain; + float fEdge; + float fPostEQCenterFrequency; + float fPostEQBandwidth; + float fPreLowpassCutoff; } BASS_DX8_DISTORTION; typedef struct { - float fWetDryMix; - float fFeedback; - float fLeftDelay; - float fRightDelay; - BOOL lPanDelay; + float fWetDryMix; + float fFeedback; + float fLeftDelay; + float fRightDelay; + BOOL lPanDelay; } BASS_DX8_ECHO; typedef struct { - float fWetDryMix; - float fDepth; - float fFeedback; - float fFrequency; - DWORD lWaveform; // 0=triangle, 1=sine - float fDelay; - DWORD lPhase; // BASS_DX8_PHASE_xxx + float fWetDryMix; + float fDepth; + float fFeedback; + float fFrequency; + DWORD lWaveform; // 0=triangle, 1=sine + float fDelay; + DWORD lPhase; // BASS_DX8_PHASE_xxx } BASS_DX8_FLANGER; typedef struct { - DWORD dwRateHz; // Rate of modulation in hz - DWORD dwWaveShape; // 0=triangle, 1=square + DWORD dwRateHz; // Rate of modulation in hz + DWORD dwWaveShape; // 0=triangle, 1=square } BASS_DX8_GARGLE; typedef struct { - int lRoom; // [-10000, 0] default: -1000 mB - int lRoomHF; // [-10000, 0] default: 0 mB - float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0 - float flDecayTime; // [0.1, 20.0] default: 1.49s - float flDecayHFRatio; // [0.1, 2.0] default: 0.83 - int lReflections; // [-10000, 1000] default: -2602 mB - float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s - int lReverb; // [-10000, 2000] default: 200 mB - float flReverbDelay; // [0.0, 0.1] default: 0.011 s - float flDiffusion; // [0.0, 100.0] default: 100.0 % - float flDensity; // [0.0, 100.0] default: 100.0 % - float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz + int lRoom; // [-10000, 0] default: -1000 mB + int lRoomHF; // [-10000, 0] default: 0 mB + float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0 + float flDecayTime; // [0.1, 20.0] default: 1.49s + float flDecayHFRatio; // [0.1, 2.0] default: 0.83 + int lReflections; // [-10000, 1000] default: -2602 mB + float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s + int lReverb; // [-10000, 2000] default: 200 mB + float flReverbDelay; // [0.0, 0.1] default: 0.011 s + float flDiffusion; // [0.0, 100.0] default: 100.0 % + float flDensity; // [0.0, 100.0] default: 100.0 % + float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz } BASS_DX8_I3DL2REVERB; typedef struct { - float fCenter; - float fBandwidth; - float fGain; + float fCenter; + float fBandwidth; + float fGain; } BASS_DX8_PARAMEQ; typedef struct { - float fInGain; // [-96.0,0.0] default: 0.0 dB - float fReverbMix; // [-96.0,0.0] default: 0.0 db - float fReverbTime; // [0.001,3000.0] default: 1000.0 ms - float fHighFreqRTRatio; // [0.001,0.999] default: 0.001 + float fInGain; // [-96.0,0.0] default: 0.0 dB + float fReverbMix; // [-96.0,0.0] default: 0.0 db + float fReverbTime; // [0.001,3000.0] default: 1000.0 ms + float fHighFreqRTRatio; // [0.001,0.999] default: 0.001 } BASS_DX8_REVERB; -#define BASS_DX8_PHASE_NEG_180 0 -#define BASS_DX8_PHASE_NEG_90 1 -#define BASS_DX8_PHASE_ZERO 2 -#define BASS_DX8_PHASE_90 3 -#define BASS_DX8_PHASE_180 4 - +#define BASS_DX8_PHASE_NEG_180 0 +#define BASS_DX8_PHASE_NEG_90 1 +#define BASS_DX8_PHASE_ZERO 2 +#define BASS_DX8_PHASE_90 3 +#define BASS_DX8_PHASE_180 4 + typedef struct { - float fTarget; - float fCurrent; - float fTime; - DWORD lCurve; + float fTarget; + float fCurrent; + float fTime; + DWORD lCurve; } BASS_FX_VOLUME_PARAM; - -typedef void (CALLBACK IOSNOTIFYPROC)(DWORD status); -/* iOS notification callback function. -status : The notification (BASS_IOSNOTIFY_xxx) */ - -#define BASS_IOSNOTIFY_INTERRUPT 1 // interruption started -#define BASS_IOSNOTIFY_INTERRUPT_END 2 // interruption ended + +typedef void(CALLBACK IOSNOTIFYPROC)(DWORD status); +/* iOS notification callback function. +status : The notification (BASS_IOSNOTIFY_xxx) */ + +#define BASS_IOSNOTIFY_INTERRUPT 1 // interruption started +#define BASS_IOSNOTIFY_INTERRUPT_END 2 // interruption ended BOOL BASSDEF(BASS_SetConfig)(DWORD option, DWORD value); DWORD BASSDEF(BASS_GetConfig)(DWORD option); @@ -989,15 +1019,19 @@ void *BASSDEF(BASS_GetConfigPtr)(DWORD option); DWORD BASSDEF(BASS_GetVersion)(); int BASSDEF(BASS_ErrorGetCode)(); BOOL BASSDEF(BASS_GetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info); -#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) -BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, HWND win, const GUID *dsguid); +#if defined(_WIN32) && !defined(_WIN32_WCE) && \ + !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) +BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, HWND win, + const GUID *dsguid); #else -BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, void *win, void *dsguid); +BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, void *win, + void *dsguid); #endif BOOL BASSDEF(BASS_SetDevice)(DWORD device); DWORD BASSDEF(BASS_GetDevice)(); BOOL BASSDEF(BASS_Free)(); -#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) +#if defined(_WIN32) && !defined(_WIN32_WCE) && \ + !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) void *BASSDEF(BASS_GetDSoundObject)(DWORD object); #endif BOOL BASSDEF(BASS_GetInfo)(BASS_INFO *info); @@ -1015,19 +1049,29 @@ const BASS_PLUGININFO *BASSDEF(BASS_PluginGetInfo)(HPLUGIN handle); BOOL BASSDEF(BASS_Set3DFactors)(float distf, float rollf, float doppf); BOOL BASSDEF(BASS_Get3DFactors)(float *distf, float *rollf, float *doppf); -BOOL BASSDEF(BASS_Set3DPosition)(const BASS_3DVECTOR *pos, const BASS_3DVECTOR *vel, const BASS_3DVECTOR *front, const BASS_3DVECTOR *top); -BOOL BASSDEF(BASS_Get3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, BASS_3DVECTOR *front, BASS_3DVECTOR *top); +BOOL BASSDEF(BASS_Set3DPosition)(const BASS_3DVECTOR *pos, + const BASS_3DVECTOR *vel, + const BASS_3DVECTOR *front, + const BASS_3DVECTOR *top); +BOOL BASSDEF(BASS_Get3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, + BASS_3DVECTOR *front, BASS_3DVECTOR *top); void BASSDEF(BASS_Apply3D)(); -#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) -BOOL BASSDEF(BASS_SetEAXParameters)(int env, float vol, float decay, float damp); -BOOL BASSDEF(BASS_GetEAXParameters)(DWORD *env, float *vol, float *decay, float *damp); +#if defined(_WIN32) && !defined(_WIN32_WCE) && \ + !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) +BOOL BASSDEF(BASS_SetEAXParameters)(int env, float vol, float decay, + float damp); +BOOL BASSDEF(BASS_GetEAXParameters)(DWORD *env, float *vol, float *decay, + float *damp); #endif -HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, const void *file, QWORD offset, DWORD length, DWORD flags, DWORD freq); +HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, const void *file, QWORD offset, + DWORD length, DWORD flags, DWORD freq); BOOL BASSDEF(BASS_MusicFree)(HMUSIC handle); -HSAMPLE BASSDEF(BASS_SampleLoad)(BOOL mem, const void *file, QWORD offset, DWORD length, DWORD max, DWORD flags); -HSAMPLE BASSDEF(BASS_SampleCreate)(DWORD length, DWORD freq, DWORD chans, DWORD max, DWORD flags); +HSAMPLE BASSDEF(BASS_SampleLoad)(BOOL mem, const void *file, QWORD offset, + DWORD length, DWORD max, DWORD flags); +HSAMPLE BASSDEF(BASS_SampleCreate)(DWORD length, DWORD freq, DWORD chans, + DWORD max, DWORD flags); BOOL BASSDEF(BASS_SampleFree)(HSAMPLE handle); BOOL BASSDEF(BASS_SampleSetData)(HSAMPLE handle, const void *buffer); BOOL BASSDEF(BASS_SampleGetData)(HSAMPLE handle, void *buffer); @@ -1037,14 +1081,22 @@ HCHANNEL BASSDEF(BASS_SampleGetChannel)(HSAMPLE handle, BOOL onlynew); DWORD BASSDEF(BASS_SampleGetChannels)(HSAMPLE handle, HCHANNEL *channels); BOOL BASSDEF(BASS_SampleStop)(HSAMPLE handle); -HSTREAM BASSDEF(BASS_StreamCreate)(DWORD freq, DWORD chans, DWORD flags, STREAMPROC *proc, void *user); -HSTREAM BASSDEF(BASS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags); -HSTREAM BASSDEF(BASS_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user); -HSTREAM BASSDEF(BASS_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *proc, void *user); +HSTREAM BASSDEF(BASS_StreamCreate)(DWORD freq, DWORD chans, DWORD flags, + STREAMPROC *proc, void *user); +HSTREAM BASSDEF(BASS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, + QWORD length, DWORD flags); +HSTREAM BASSDEF(BASS_StreamCreateURL)(const char *url, DWORD offset, + DWORD flags, DOWNLOADPROC *proc, + void *user); +HSTREAM BASSDEF(BASS_StreamCreateFileUser)(DWORD system, DWORD flags, + const BASS_FILEPROCS *proc, + void *user); BOOL BASSDEF(BASS_StreamFree)(HSTREAM handle); QWORD BASSDEF(BASS_StreamGetFilePosition)(HSTREAM handle, DWORD mode); -DWORD BASSDEF(BASS_StreamPutData)(HSTREAM handle, const void *buffer, DWORD length); -DWORD BASSDEF(BASS_StreamPutFileData)(HSTREAM handle, const void *buffer, DWORD length); +DWORD BASSDEF(BASS_StreamPutData)(HSTREAM handle, const void *buffer, + DWORD length); +DWORD BASSDEF(BASS_StreamPutFileData)(HSTREAM handle, const void *buffer, + DWORD length); BOOL BASSDEF(BASS_RecordGetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info); BOOL BASSDEF(BASS_RecordInit)(int device); @@ -1055,7 +1107,8 @@ BOOL BASSDEF(BASS_RecordGetInfo)(BASS_RECORDINFO *info); const char *BASSDEF(BASS_RecordGetInputName)(int input); BOOL BASSDEF(BASS_RecordSetInput)(int input, DWORD flags, float volume); DWORD BASSDEF(BASS_RecordGetInput)(int input, float *volume); -HRECORD BASSDEF(BASS_RecordStart)(DWORD freq, DWORD chans, DWORD flags, RECORDPROC *proc, void *user); +HRECORD BASSDEF(BASS_RecordStart)(DWORD freq, DWORD chans, DWORD flags, + RECORDPROC *proc, void *user); double BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos); QWORD BASSDEF(BASS_ChannelSeconds2Bytes)(DWORD handle, double pos); @@ -1071,24 +1124,39 @@ BOOL BASSDEF(BASS_ChannelPlay)(DWORD handle, BOOL restart); BOOL BASSDEF(BASS_ChannelStop)(DWORD handle); BOOL BASSDEF(BASS_ChannelPause)(DWORD handle); BOOL BASSDEF(BASS_ChannelSetAttribute)(DWORD handle, DWORD attrib, float value); -BOOL BASSDEF(BASS_ChannelGetAttribute)(DWORD handle, DWORD attrib, float *value); -BOOL BASSDEF(BASS_ChannelSlideAttribute)(DWORD handle, DWORD attrib, float value, DWORD time); +BOOL BASSDEF(BASS_ChannelGetAttribute)(DWORD handle, DWORD attrib, + float *value); +BOOL BASSDEF(BASS_ChannelSlideAttribute)(DWORD handle, DWORD attrib, + float value, DWORD time); BOOL BASSDEF(BASS_ChannelIsSliding)(DWORD handle, DWORD attrib); -BOOL BASSDEF(BASS_ChannelSetAttributeEx)(DWORD handle, DWORD attrib, void *value, DWORD size); -DWORD BASSDEF(BASS_ChannelGetAttributeEx)(DWORD handle, DWORD attrib, void *value, DWORD size); -BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min, float max, int iangle, int oangle, float outvol); -BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min, float *max, DWORD *iangle, DWORD *oangle, float *outvol); -BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, const BASS_3DVECTOR *pos, const BASS_3DVECTOR *orient, const BASS_3DVECTOR *vel); -BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel); +BOOL BASSDEF(BASS_ChannelSetAttributeEx)(DWORD handle, DWORD attrib, + void *value, DWORD size); +DWORD BASSDEF(BASS_ChannelGetAttributeEx)(DWORD handle, DWORD attrib, + void *value, DWORD size); +BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min, + float max, int iangle, int oangle, + float outvol); +BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min, + float *max, DWORD *iangle, + DWORD *oangle, float *outvol); +BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, const BASS_3DVECTOR *pos, + const BASS_3DVECTOR *orient, + const BASS_3DVECTOR *vel); +BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, + BASS_3DVECTOR *orient, + BASS_3DVECTOR *vel); QWORD BASSDEF(BASS_ChannelGetLength)(DWORD handle, DWORD mode); BOOL BASSDEF(BASS_ChannelSetPosition)(DWORD handle, QWORD pos, DWORD mode); QWORD BASSDEF(BASS_ChannelGetPosition)(DWORD handle, DWORD mode); DWORD BASSDEF(BASS_ChannelGetLevel)(DWORD handle); -BOOL BASSDEF(BASS_ChannelGetLevelEx)(DWORD handle, float *levels, float length, DWORD flags); +BOOL BASSDEF(BASS_ChannelGetLevelEx)(DWORD handle, float *levels, float length, + DWORD flags); DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length); -HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param, SYNCPROC *proc, void *user); +HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param, + SYNCPROC *proc, void *user); BOOL BASSDEF(BASS_ChannelRemoveSync)(DWORD handle, HSYNC sync); -HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, void *user, int priority); +HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, void *user, + int priority); BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp); BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan); BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan); @@ -1099,41 +1167,51 @@ BOOL BASSDEF(BASS_FXSetParameters)(HFX handle, const void *params); BOOL BASSDEF(BASS_FXGetParameters)(HFX handle, void *params); BOOL BASSDEF(BASS_FXReset)(HFX handle); BOOL BASSDEF(BASS_FXSetPriority)(HFX handle, int priority); - + #ifdef __cplusplus } - -#if defined(_WIN32) && !defined(NOBASSOVERLOADS) -static inline HPLUGIN BASS_PluginLoad(const WCHAR *file, DWORD flags) -{ - return BASS_PluginLoad((const char*)file, flags|BASS_UNICODE); -} - -static inline HMUSIC BASS_MusicLoad(BOOL mem, const WCHAR *file, QWORD offset, DWORD length, DWORD flags, DWORD freq) -{ - return BASS_MusicLoad(mem, (const void*)file, offset, length, flags|BASS_UNICODE, freq); -} - -static inline HSAMPLE BASS_SampleLoad(BOOL mem, const WCHAR *file, QWORD offset, DWORD length, DWORD max, DWORD flags) -{ - return BASS_SampleLoad(mem, (const void*)file, offset, length, max, flags|BASS_UNICODE); -} - -static inline HSTREAM BASS_StreamCreateFile(BOOL mem, const WCHAR *file, QWORD offset, QWORD length, DWORD flags) -{ - return BASS_StreamCreateFile(mem, (const void*)file, offset, length, flags|BASS_UNICODE); -} - -static inline HSTREAM BASS_StreamCreateURL(const WCHAR *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user) -{ - return BASS_StreamCreateURL((const char*)url, offset, flags|BASS_UNICODE, proc, user); -} - -static inline BOOL BASS_SetConfigPtr(DWORD option, const WCHAR *value) -{ - return BASS_SetConfigPtr(option|BASS_UNICODE, (const void*)value); -} -#endif + +#if defined(_WIN32) && !defined(NOBASSOVERLOADS) +static inline HPLUGIN BASS_PluginLoad(const WCHAR *file, DWORD flags) +{ + return BASS_PluginLoad((const char *)file, flags | BASS_UNICODE); +} + +static inline HMUSIC BASS_MusicLoad(BOOL mem, const WCHAR *file, QWORD offset, + DWORD length, DWORD flags, DWORD freq) +{ + return BASS_MusicLoad(mem, (const void *)file, offset, length, + flags | BASS_UNICODE, freq); +} + +static inline HSAMPLE BASS_SampleLoad(BOOL mem, const WCHAR *file, QWORD offset, + DWORD length, DWORD max, DWORD flags) +{ + return BASS_SampleLoad(mem, (const void *)file, offset, length, max, + flags | BASS_UNICODE); +} + +static inline HSTREAM BASS_StreamCreateFile(BOOL mem, const WCHAR *file, + QWORD offset, QWORD length, + DWORD flags) +{ + return BASS_StreamCreateFile(mem, (const void *)file, offset, length, + flags | BASS_UNICODE); +} + +static inline HSTREAM BASS_StreamCreateURL(const WCHAR *url, DWORD offset, + DWORD flags, DOWNLOADPROC *proc, + void *user) +{ + return BASS_StreamCreateURL((const char *)url, offset, flags | BASS_UNICODE, + proc, user); +} + +static inline BOOL BASS_SetConfigPtr(DWORD option, const WCHAR *value) +{ + return BASS_SetConfigPtr(option | BASS_UNICODE, (const void *)value); +} +#endif #endif #endif diff --git a/include/chatlogpiece.h b/include/chatlogpiece.h index 34c5926b..1fbca250 100644 --- a/include/chatlogpiece.h +++ b/include/chatlogpiece.h @@ -1,15 +1,16 @@ #ifndef CHATLOGPIECE_H #define CHATLOGPIECE_H -#include #include +#include -class chatlogpiece -{ +class chatlogpiece { public: chatlogpiece(); - chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song); - chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime); + chatlogpiece(QString p_name, QString p_showname, QString p_message, + bool p_song); + chatlogpiece(QString p_name, QString p_showname, QString p_message, + bool p_song, QDateTime p_datetime); QString get_name(); QString get_showname(); diff --git a/include/courtroom.h b/include/courtroom.h index 99a090b0..5d9a4b84 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -1,73 +1,70 @@ #ifndef COURTROOM_H #define COURTROOM_H -#include "aoimage.h" +#include "aoapplication.h" +#include "aoblipplayer.h" #include "aobutton.h" #include "aocharbutton.h" +#include "aocharmovie.h" #include "aoemotebutton.h" -#include "aopacket.h" -#include "aoscene.h" +#include "aoevidencebutton.h" +#include "aoevidencedisplay.h" +#include "aoimage.h" +#include "aolineedit.h" #include "aomovie.h" -#include "aocharmovie.h" #include "aomusicplayer.h" +#include "aopacket.h" +#include "aoscene.h" #include "aosfxplayer.h" -#include "aoblipplayer.h" -#include "aoevidencebutton.h" #include "aotextarea.h" -#include "aolineedit.h" #include "aotextedit.h" -#include "aoevidencedisplay.h" -#include "datatypes.h" -#include "aoapplication.h" -#include "lobby.h" -#include "hardware_functions.h" -#include "file_functions.h" +#include "chatlogpiece.h" #include "datatypes.h" #include "debug_functions.h" -#include "chatlogpiece.h" +#include "file_functions.h" +#include "hardware_functions.h" +#include "lobby.h" -#include -#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 Courtroom : public QMainWindow -{ +class Courtroom : public QMainWindow { Q_OBJECT public: explicit Courtroom(AOApplication *p_ao_app); - void append_char(char_type p_char){char_list.append(p_char);} - void append_evidence(evi_type p_evi){evidence_list.append(p_evi);} - void append_music(QString f_music){music_list.append(f_music);} - void append_area(QString f_area){area_list.append(f_area);} + void append_char(char_type p_char) { char_list.append(p_char); } + void append_evidence(evi_type p_evi) { evidence_list.append(p_evi); } + void append_music(QString f_music) { music_list.append(f_music); } + void append_area(QString f_area) { area_list.append(f_area); } void fix_last_area() { - if (area_list.size() > 0) - { + if (area_list.size() > 0) { QString malplaced = area_list.last(); area_list.removeLast(); append_music(malplaced); @@ -76,31 +73,27 @@ public: void arup_append(int players, QString status, QString cm, QString locked) { - arup_players.append(players); - arup_statuses.append(status); - arup_cms.append(cm); - arup_locks.append(locked); + arup_players.append(players); + arup_statuses.append(status); + arup_cms.append(cm); + arup_locks.append(locked); } void arup_modify(int type, int place, QString value) { - if (type == 0) - { + if (type == 0) { if (arup_players.size() > place) arup_players[place] = value.toInt(); } - else if (type == 1) - { + else if (type == 1) { if (arup_statuses.size() > place) arup_statuses[place] = value; } - else if (type == 2) - { + else if (type == 2) { if (arup_cms.size() > place) arup_cms[place] = value; } - else if (type == 3) - { + else if (type == 3) { if (arup_locks.size() > place) arup_locks[place] = value; } @@ -109,105 +102,114 @@ public: void character_loading_finished(); - //sets position of widgets based on theme ini files + // sets position of widgets based on theme ini files void set_widgets(); - //sets font size based on theme ini files + // sets font size based on theme ini files void set_font(QWidget *widget, QString p_identifier); - //helper function that calls above function on the relevant widgets + // helper function that calls above function on the relevant widgets void set_fonts(); void set_window_title(QString p_title); - //reads theme inis and sets size and pos based on the identifier + // reads theme inis and sets size and pos based on the identifier void set_size_and_pos(QWidget *p_widget, QString p_identifier); - //sets status as taken on character with cid n_char and places proper shading on charselect + // sets status as taken on character with cid n_char and places proper shading + // on charselect void set_taken(int n_char, bool p_taken); - //sets the current background to argument. also does some checks to see if it's a legacy bg + // sets the current background to argument. also does some checks to see if + // it's a legacy bg void set_background(QString p_background); - //sets the evidence list member variable to argument + // sets the evidence list member variable to argument void set_evidence_list(QVector &p_evi_list); - //called when a DONE#% from the server was received + // called when a DONE#% from the server was received void done_received(); - //sets the local mute list based on characters available on the server + // sets the local mute list based on characters available on the server void set_mute_list(); // Sets the local pair list based on the characters available on the server. void set_pair_list(); - //sets desk and bg based on pos in chatmessage + // sets desk and bg based on pos in chatmessage void set_scene(); - //sets text color based on text color in chatmessage + // sets text color based on text color in chatmessage void set_text_color(); // And gets the colour, too! QColor get_text_color(QString color); - //takes in serverD-formatted IP list as prints a converted version to server OOC - //admittedly poorly named + // takes in serverD-formatted IP list as prints a converted version to server + // OOC admittedly poorly named void set_ip_list(QString p_list); - //disables chat if current cid matches second argument - //enables if p_muted is false + // disables chat if current cid matches second argument + // enables if p_muted is false void set_mute(bool p_muted, int p_cid); - //send a message that the player is banned and quits the server + // send a message that the player is banned and quits the server void set_ban(int p_cid); - //cid = character id, returns the cid of the currently selected character - int get_cid() {return m_cid;} - QString get_current_char() {return current_char;} - QString get_current_background() {return current_background;} + // cid = character id, returns the cid of the currently selected character + int get_cid() { return m_cid; } + QString get_current_char() { return current_char; } + QString get_current_background() { return current_background; } - //properly sets up some varibles: resets user state + // properly sets up some varibles: resets user state void enter_courtroom(int p_cid); - //helper function that populates ui_music_list with the contents of music_list + // helper function that populates ui_music_list with the contents of + // music_list void list_music(); void list_areas(); - //these are for OOC chat + // these are for OOC chat void append_ms_chatmessage(QString f_name, QString f_message); - void append_server_chatmessage(QString p_name, QString p_message, QString p_colour); + void append_server_chatmessage(QString p_name, QString p_message, + QString p_colour); - //these functions handle chatmessages sequentially. - //The process itself is very convoluted and merits separate documentation - //But the general idea is objection animation->pre animation->talking->idle + // these functions handle chatmessages sequentially. + // The process itself is very convoluted and merits separate documentation + // But the general idea is objection animation->pre animation->talking->idle void handle_chatmessage(QStringList *p_contents); void handle_chatmessage_2(); void handle_chatmessage_3(); - //This function filters out the common CC inline text trickery, for appending to - //the IC chatlog. + // This function filters out the common CC inline text trickery, for appending + // to the IC chatlog. QString filter_ic_text(QString p_text); - //adds text to the IC chatlog. p_name first as bold then p_text then a newlin - //this function keeps the chatlog scrolled to the top unless there's text selected + // adds text to the IC chatlog. p_name first as bold then p_text then a newlin + // this function keeps the chatlog scrolled to the top unless there's text + // selected // or the user isn't already scrolled to the top - void append_ic_text(QString p_text, QString p_name = "", bool is_songchange = false); + void append_ic_text(QString p_text, QString p_name = "", + bool is_songchange = false); - //prints who played the song to IC chat and plays said song(if found on local filesystem) - //takes in a list where the first element is the song name and the second is the char id of who played it + // prints who played the song to IC chat and plays said song(if found on local + // filesystem) takes in a list where the first element is the song name and the + // second is the char id of who played it void handle_song(QStringList *p_contents); void play_preanim(bool noninterrupting); - //plays the witness testimony or cross examination animation based on argument + // plays the witness testimony or cross examination animation based on + // argument void handle_wtce(QString p_wtce, int variant); - //sets the hp bar of defense(p_bar 1) or pro(p_bar 2) - //state is an number between 0 and 10 inclusive + // sets the hp bar of defense(p_bar 1) or pro(p_bar 2) + // state is an number between 0 and 10 inclusive void set_hp_bar(int p_bar, int p_state); - //Toggles the judge buttons, whether they should appear or not. + // Toggles the judge buttons, whether they should appear or not. void toggle_judge_buttons(bool is_on); - void announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno); + void announce_case(QString title, bool def, bool pro, bool jud, bool jur, + bool steno); void check_connection_received(); @@ -230,18 +232,13 @@ private: // This is for inline message-colouring. - enum INLINE_COLOURS { - INLINE_BLUE, - INLINE_GREEN, - INLINE_ORANGE, - INLINE_GREY - }; + enum INLINE_COLOURS { INLINE_BLUE, INLINE_GREEN, INLINE_ORANGE, INLINE_GREY }; // A stack of inline colours. std::stack inline_colour_stack; bool next_character_is_not_special = false; // If true, write the - // next character as it is. + // next character as it is. bool message_is_centered = false; @@ -278,15 +275,15 @@ private: QVector music_row_to_number; QVector area_row_to_number; - //triggers ping_server() every 60 seconds + // triggers ping_server() every 60 seconds QTimer *keepalive_timer; - //determines how fast messages tick onto screen + // determines how fast messages tick onto screen QTimer *chat_tick_timer; - //int chat_tick_interval = 60; - //which tick position(character in chat message) we are at + // int chat_tick_interval = 60; + // which tick position(character in chat message) we are at int tick_pos = 0; - //used to determine how often blips sound + // used to determine how often blips sound int blip_pos = 0; int blip_rate = 1; int rainbow_counter = 0; @@ -299,21 +296,23 @@ private: // True, if the log should go downwards. bool log_goes_downwards = false; - //delay before chat messages starts ticking + // delay before chat messages starts ticking QTimer *text_delay_timer; - //delay before sfx plays + // delay before sfx plays QTimer *sfx_delay_timer; - //keeps track of how long realization is visible(it's just a white square and should be visible less than a second) + // keeps track of how long realization is visible(it's just a white square and + // should be visible less than a second) QTimer *realization_timer; - //times how long the blinking testimony should be shown(green one in the corner) + // times how long the blinking testimony should be shown(green one in the + // corner) QTimer *testimony_show_timer; - //times how long the blinking testimony should be hidden + // times how long the blinking testimony should be hidden QTimer *testimony_hide_timer; - //every time point in char.inis times this equals the final time + // every time point in char.inis times this equals the final time const int time_mod = 40; static const int chatmessage_size = 23; @@ -324,28 +323,30 @@ private: bool testimony_in_progress = false; - //in milliseconds + // in milliseconds const int testimony_show_time = 1500; - //in milliseconds + // in milliseconds const int testimony_hide_time = 500; - //char id, muted or not + // char id, muted or not QMap mute_map; - //QVector muted_cids; + // QVector muted_cids; bool is_muted = false; - //state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle, 4 = noniterrupting preanim + // state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle, 4 = + // noniterrupting preanim int anim_state = 3; - //state of text ticking, 0 = not yet ticking, 1 = ticking in progress, 2 = ticking done + // state of text ticking, 0 = not yet ticking, 1 = ticking in progress, 2 = + // ticking done int text_state = 2; - //character id, which index of the char_list the player is + // character id, which index of the char_list the player is int m_cid = -1; - //cid and this may differ in cases of ini-editing + // cid and this may differ in cases of ini-editing QString current_char = ""; int objection_state = 0; @@ -378,10 +379,11 @@ private: int evidence_rows = 3; int max_evidence_on_page = 18; - //is set to true if the bg folder contains defensedesk.png, prosecutiondesk.png and stand.png + // is set to true if the bg folder contains defensedesk.png, + // prosecutiondesk.png and stand.png bool is_ao2_bg = false; - //whether the ooc chat is server or master chat, true is server + // whether the ooc chat is server or master chat, true is server bool server_ooc = true; QString current_background = "default"; @@ -430,11 +432,11 @@ private: QLineEdit *ui_ooc_chat_message; QLineEdit *ui_ooc_chat_name; - //QLineEdit *ui_area_password; + // QLineEdit *ui_area_password; QLineEdit *ui_music_search; QWidget *ui_emotes; - QVector ui_emote_list; + QVector ui_emote_list; AOButton *ui_emote_left; AOButton *ui_emote_right; @@ -499,7 +501,7 @@ private: AOImage *ui_evidence; AOLineEdit *ui_evidence_name; QWidget *ui_evidence_buttons; - QVector ui_evidence_list; + QVector ui_evidence_list; AOButton *ui_evidence_left; AOButton *ui_evidence_right; AOButton *ui_evidence_present; @@ -512,11 +514,11 @@ private: AOImage *ui_char_select_background; - //abstract widget to hold char buttons + // abstract widget to hold char buttons QWidget *ui_char_buttons; - QVector ui_char_button_list; - QVector ui_char_button_list_filtered; + QVector ui_char_button_list; + QVector ui_char_button_list_filtered; AOImage *ui_selector; AOButton *ui_back_to_lobby; @@ -557,7 +559,8 @@ public slots: void mod_called(QString p_ip); - void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno); + void case_called(QString msg, bool def, bool pro, bool jud, bool jur, + bool steno); private slots: void start_chat_ticking(); diff --git a/include/datatypes.h b/include/datatypes.h index aaa5de52..207f5062 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -3,16 +3,14 @@ #include -struct server_type -{ +struct server_type { QString name; QString desc; QString ip; int port; }; -struct emote_type -{ +struct emote_type { QString comment; QString preanim; QString anim; @@ -22,23 +20,20 @@ struct emote_type int sfx_duration; }; -struct char_type -{ +struct char_type { QString name; QString description; QString evidence_string; bool taken; }; -struct evi_type -{ +struct evi_type { QString name; QString description; QString image; }; -struct chatmessage_type -{ +struct chatmessage_type { QString message; QString character; QString side; @@ -55,29 +50,25 @@ struct chatmessage_type int flip; }; -struct area_type -{ +struct area_type { QString name; QString background; bool passworded; }; -struct pos_type -{ +struct pos_type { int x; int y; }; -struct pos_size_type -{ +struct pos_size_type { int x = 0; int y = 0; int width = 0; int height = 0; }; -enum CHAT_MESSAGE -{ +enum CHAT_MESSAGE { DESK_MOD = 0, PRE_EMOTE, CHAR_NAME, @@ -103,17 +94,6 @@ enum CHAT_MESSAGE NONINTERRUPTING_PRE }; -enum COLOR -{ - WHITE = 0, - GREEN, - RED, - ORANGE, - BLUE, - YELLOW, - RAINBOW, - PINK, - CYAN -}; +enum COLOR { WHITE = 0, GREEN, RED, ORANGE, BLUE, YELLOW, RAINBOW, PINK, CYAN }; #endif // DATATYPES_H diff --git a/include/debug_functions.h b/include/debug_functions.h index 160274cc..383431ab 100644 --- a/include/debug_functions.h +++ b/include/debug_functions.h @@ -1,8 +1,8 @@ #ifndef DEBUG_FUNCTIONS_H #define DEBUG_FUNCTIONS_H -#include #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 feb874b2..455f62aa 100644 --- a/include/discord-rpc.h +++ b/include/discord-rpc.h @@ -24,61 +24,63 @@ extern "C" { #endif typedef struct DiscordRichPresence { - const char* state; /* max 128 bytes */ - const char* details; /* max 128 bytes */ - int64_t startTimestamp; - int64_t endTimestamp; - const char* largeImageKey; /* max 32 bytes */ - const char* largeImageText; /* max 128 bytes */ - const char* smallImageKey; /* max 32 bytes */ - const char* smallImageText; /* max 128 bytes */ - const char* partyId; /* max 128 bytes */ - int partySize; - int partyMax; - const char* matchSecret; /* max 128 bytes */ - const char* joinSecret; /* max 128 bytes */ - const char* spectateSecret; /* max 128 bytes */ - int8_t instance; + const char *state; /* max 128 bytes */ + const char *details; /* max 128 bytes */ + int64_t startTimestamp; + int64_t endTimestamp; + const char *largeImageKey; /* max 32 bytes */ + const char *largeImageText; /* max 128 bytes */ + const char *smallImageKey; /* max 32 bytes */ + const char *smallImageText; /* max 128 bytes */ + const char *partyId; /* max 128 bytes */ + int partySize; + int partyMax; + const char *matchSecret; /* max 128 bytes */ + const char *joinSecret; /* max 128 bytes */ + const char *spectateSecret; /* max 128 bytes */ + int8_t instance; } DiscordRichPresence; typedef struct DiscordJoinRequest { - const char* userId; - const char* username; - const char* discriminator; - const char* avatar; + const char *userId; + const char *username; + const char *discriminator; + const char *avatar; } DiscordJoinRequest; typedef struct DiscordEventHandlers { - void (*ready)(void); - void (*disconnected)(int errorCode, const char* message); - void (*errored)(int errorCode, const char* message); - void (*joinGame)(const char* joinSecret); - void (*spectateGame)(const char* spectateSecret); - void (*joinRequest)(const DiscordJoinRequest* request); + void (*ready)(void); + void (*disconnected)(int errorCode, const char *message); + void (*errored)(int errorCode, const char *message); + void (*joinGame)(const char *joinSecret); + void (*spectateGame)(const char *spectateSecret); + void (*joinRequest)(const DiscordJoinRequest *request); } DiscordEventHandlers; #define DISCORD_REPLY_NO 0 #define DISCORD_REPLY_YES 1 #define DISCORD_REPLY_IGNORE 2 -DISCORD_EXPORT void Discord_Initialize(const char* applicationId, - DiscordEventHandlers* handlers, +DISCORD_EXPORT void Discord_Initialize(const char *applicationId, + DiscordEventHandlers *handlers, int autoRegister, - const char* optionalSteamId); + const char *optionalSteamId); DISCORD_EXPORT void Discord_Shutdown(void); /* checks for incoming messages, dispatches callbacks */ DISCORD_EXPORT void Discord_RunCallbacks(void); -/* If you disable the lib starting its own io thread, you'll need to call this from your own */ +/* If you disable the lib starting its own io thread, you'll need to call this + * from your own */ #ifdef DISCORD_DISABLE_IO_THREAD DISCORD_EXPORT void Discord_UpdateConnection(void); #endif -DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence); +DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence); DISCORD_EXPORT void Discord_ClearPresence(void); -DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply); +DISCORD_EXPORT void Discord_Respond(const char *userid, + /* DISCORD_REPLY_ */ int reply); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/discord_register.h b/include/discord_register.h index 4c16b68a..655a3dfb 100644 --- a/include/discord_register.h +++ b/include/discord_register.h @@ -1,25 +1,27 @@ #pragma once #if defined(DISCORD_DYNAMIC_LIB) -# if defined(_WIN32) -# if defined(DISCORD_BUILDING_SDK) -# define DISCORD_EXPORT __declspec(dllexport) -# else -# define DISCORD_EXPORT __declspec(dllimport) -# endif -# else -# define DISCORD_EXPORT __attribute__((visibility("default"))) -# endif +#if defined(_WIN32) +#if defined(DISCORD_BUILDING_SDK) +#define DISCORD_EXPORT __declspec(dllexport) #else -# define DISCORD_EXPORT +#define DISCORD_EXPORT __declspec(dllimport) +#endif +#else +#define DISCORD_EXPORT __attribute__((visibility("default"))) +#endif +#else +#define DISCORD_EXPORT #endif #ifdef __cplusplus extern "C" { #endif -DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command); -DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId); +DISCORD_EXPORT void Discord_Register(const char *applicationId, + const char *command); +DISCORD_EXPORT void Discord_RegisterSteamGame(const char *applicationId, + const char *steamId); #ifdef __cplusplus } diff --git a/include/discord_rich_presence.h b/include/discord_rich_presence.h index e7ecc6ef..77c0eff7 100644 --- a/include/discord_rich_presence.h +++ b/include/discord_rich_presence.h @@ -1,11 +1,11 @@ #ifndef DISCORD_RICH_PRESENCE_H #define DISCORD_RICH_PRESENCE_H +#include #include #include -#include -#include #include +#include #include #include @@ -14,12 +14,12 @@ namespace AttorneyOnline { -class Discord -{ +class Discord { private: - const char* APPLICATION_ID = "399779271737868288"; + const char *APPLICATION_ID = "399779271737868288"; std::string server_name, server_id; int64_t timestamp; + public: Discord(); ~Discord(); @@ -30,5 +30,5 @@ public: void state_spectate(); }; -} +} // namespace AttorneyOnline #endif // DISCORD_RICH_PRESENCE_H diff --git a/include/discord_rpc.h b/include/discord_rpc.h index 3e1441e0..6bd44041 100644 --- a/include/discord_rpc.h +++ b/include/discord_rpc.h @@ -24,63 +24,65 @@ extern "C" { #endif typedef struct DiscordRichPresence { - const char* state; /* max 128 bytes */ - const char* details; /* max 128 bytes */ - int64_t startTimestamp; - int64_t endTimestamp; - const char* largeImageKey; /* max 32 bytes */ - const char* largeImageText; /* max 128 bytes */ - const char* smallImageKey; /* max 32 bytes */ - const char* smallImageText; /* max 128 bytes */ - const char* partyId; /* max 128 bytes */ - int partySize; - int partyMax; - const char* matchSecret; /* max 128 bytes */ - const char* joinSecret; /* max 128 bytes */ - const char* spectateSecret; /* max 128 bytes */ - int8_t instance; + const char *state; /* max 128 bytes */ + const char *details; /* max 128 bytes */ + int64_t startTimestamp; + int64_t endTimestamp; + const char *largeImageKey; /* max 32 bytes */ + const char *largeImageText; /* max 128 bytes */ + const char *smallImageKey; /* max 32 bytes */ + const char *smallImageText; /* max 128 bytes */ + const char *partyId; /* max 128 bytes */ + int partySize; + int partyMax; + const char *matchSecret; /* max 128 bytes */ + const char *joinSecret; /* max 128 bytes */ + const char *spectateSecret; /* max 128 bytes */ + int8_t instance; } DiscordRichPresence; typedef struct DiscordUser { - const char* userId; - const char* username; - const char* discriminator; - const char* avatar; + const char *userId; + const char *username; + const char *discriminator; + const char *avatar; } DiscordUser; typedef struct DiscordEventHandlers { - void (*ready)(const DiscordUser* request); - void (*disconnected)(int errorCode, const char* message); - void (*errored)(int errorCode, const char* message); - void (*joinGame)(const char* joinSecret); - void (*spectateGame)(const char* spectateSecret); - void (*joinRequest)(const DiscordUser* request); + void (*ready)(const DiscordUser *request); + void (*disconnected)(int errorCode, const char *message); + void (*errored)(int errorCode, const char *message); + void (*joinGame)(const char *joinSecret); + void (*spectateGame)(const char *spectateSecret); + void (*joinRequest)(const DiscordUser *request); } DiscordEventHandlers; #define DISCORD_REPLY_NO 0 #define DISCORD_REPLY_YES 1 #define DISCORD_REPLY_IGNORE 2 -DISCORD_EXPORT void Discord_Initialize(const char* applicationId, - DiscordEventHandlers* handlers, +DISCORD_EXPORT void Discord_Initialize(const char *applicationId, + DiscordEventHandlers *handlers, int autoRegister, - const char* optionalSteamId); + const char *optionalSteamId); DISCORD_EXPORT void Discord_Shutdown(void); /* checks for incoming messages, dispatches callbacks */ DISCORD_EXPORT void Discord_RunCallbacks(void); -/* If you disable the lib starting its own io thread, you'll need to call this from your own */ +/* If you disable the lib starting its own io thread, you'll need to call this + * from your own */ #ifdef DISCORD_DISABLE_IO_THREAD DISCORD_EXPORT void Discord_UpdateConnection(void); #endif -DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence); +DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence); DISCORD_EXPORT void Discord_ClearPresence(void); -DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply); +DISCORD_EXPORT void Discord_Respond(const char *userid, + /* DISCORD_REPLY_ */ int reply); -DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers* handlers); +DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers *handlers); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/encryption_functions.h b/include/encryption_functions.h index dc67d122..b70e8e65 100644 --- a/include/encryption_functions.h +++ b/include/encryption_functions.h @@ -3,11 +3,11 @@ #include +#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 6937ed8a..8bb2e5f6 100644 --- a/include/file_functions.h +++ b/include/file_functions.h @@ -1,8 +1,8 @@ #ifndef FILE_FUNCTIONS_H #define FILE_FUNCTIONS_H -#include #include +#include #include bool file_exists(QString file_path); diff --git a/include/hex_functions.h b/include/hex_functions.h index 285f096a..d178ba1b 100644 --- a/include/hex_functions.h +++ b/include/hex_functions.h @@ -1,17 +1,16 @@ #ifndef HEX_OPERATIONS_H #define HEX_OPERATIONS_H +#include #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 19276a7d..833450d4 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -1,16 +1,16 @@ #ifndef LOBBY_H #define LOBBY_H -#include "aoimage.h" #include "aobutton.h" +#include "aoimage.h" #include "aopacket.h" #include "aotextarea.h" -#include -#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 026c6353..5287bee8 100644 --- a/include/misc_functions.h +++ b/include/misc_functions.h @@ -1,8 +1,8 @@ #ifndef MISC_FUNCTIONS_H #define MISC_FUNCTIONS_H -#include #include +#include void delay(int p_milliseconds); diff --git a/include/networkmanager.h b/include/networkmanager.h index 08b10db8..ed57a956 100644 --- a/include/networkmanager.h +++ b/include/networkmanager.h @@ -1,8 +1,8 @@ #ifndef NETWORKMANAGER_H #define NETWORKMANAGER_H -// Qt for Android has stubbed QDnsLookup. This is not documented in any part of their wiki. -// This prevents SRV lookup/failover behavior from functioning. +// Qt for Android has stubbed QDnsLookup. This is not documented in any part of +// their wiki. This prevents SRV lookup/failover behavior from functioning. // https://bugreports.qt.io/browse/QTBUG-56143 #ifndef ANDROID #define MS_FAILOVER_SUPPORTED @@ -14,17 +14,16 @@ #undef MS_FAILOVER_SUPPORTED #endif -#include "aopacket.h" #include "aoapplication.h" +#include "aopacket.h" -#include #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 119f38e2..1da4d925 100644 --- a/include/text_file_functions.h +++ b/include/text_file_functions.h @@ -3,11 +3,11 @@ #include "aoapplication.h" #include "file_functions.h" -#include -#include -#include -#include #include +#include #include +#include +#include +#include #endif // TEXT_FILE_FUNCTIONS_H diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 4ef1edd3..9bed218d 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -1,17 +1,18 @@ #include "aoapplication.h" -#include "lobby.h" #include "courtroom.h" -#include "networkmanager.h" #include "debug_functions.h" +#include "lobby.h" +#include "networkmanager.h" -#include "aooptionsdialog.h" #include "aocaseannouncerdialog.h" +#include "aooptionsdialog.h" AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv) { // Create the QSettings class that points to the config.ini. - configini = new QSettings(get_base_path() + "config.ini", QSettings::IniFormat); + configini = + new QSettings(get_base_path() + "config.ini", QSettings::IniFormat); net_manager = new NetworkManager(this); discord = new AttorneyOnline::Discord(); @@ -28,8 +29,7 @@ AOApplication::~AOApplication() void AOApplication::construct_lobby() { - if (lobby_constructed) - { + if (lobby_constructed) { qDebug() << "W: lobby was attempted constructed when it already exists"; return; } @@ -38,8 +38,8 @@ void AOApplication::construct_lobby() lobby_constructed = true; QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width()-w_lobby->width()) / 2; - int y = (geometry.height()-w_lobby->height()) / 2; + int x = (geometry.width() - w_lobby->width()) / 2; + int y = (geometry.height() - w_lobby->height()) / 2; w_lobby->move(x, y); if (is_discord_enabled()) @@ -50,8 +50,7 @@ void AOApplication::construct_lobby() void AOApplication::destruct_lobby() { - if(!lobby_constructed) - { + if (!lobby_constructed) { qDebug() << "W: lobby was attempted destructed when it did not exist"; return; } @@ -63,8 +62,7 @@ void AOApplication::destruct_lobby() void AOApplication::construct_courtroom() { - if (courtroom_constructed) - { + if (courtroom_constructed) { qDebug() << "W: courtroom was attempted constructed when it already exists"; return; } @@ -73,15 +71,14 @@ void AOApplication::construct_courtroom() courtroom_constructed = true; QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width()-w_courtroom->width()) / 2; - int y = (geometry.height()-w_courtroom->height()) / 2; + int x = (geometry.width() - w_courtroom->width()) / 2; + int y = (geometry.height() - w_courtroom->height()) / 2; w_courtroom->move(x, y); } void AOApplication::destruct_courtroom() { - if (!courtroom_constructed) - { + if (!courtroom_constructed) { qDebug() << "W: courtroom was attempted destructed when it did not exist"; return; } @@ -93,16 +90,11 @@ void AOApplication::destruct_courtroom() QString AOApplication::get_version_string() { - return - QString::number(RELEASE) + "." + - QString::number(MAJOR_VERSION) + "." + - QString::number(MINOR_VERSION); + return QString::number(RELEASE) + "." + QString::number(MAJOR_VERSION) + "." + + QString::number(MINOR_VERSION); } -void AOApplication::reload_theme() -{ - current_theme = read_theme(); -} +void AOApplication::reload_theme() { current_theme = read_theme(); } void AOApplication::set_favorite_list() { @@ -133,8 +125,7 @@ void AOApplication::add_favorite_server(int p_server) void AOApplication::server_disconnected() { - if (courtroom_constructed) - { + if (courtroom_constructed) { call_notice("Disconnected from server."); construct_lobby(); destruct_courtroom(); @@ -150,38 +141,38 @@ void AOApplication::loading_cancelled() void AOApplication::ms_connect_finished(bool connected, bool will_retry) { - if (connected) - { + if (connected) { AOPacket *f_packet = new AOPacket("ALL#%"); send_ms_packet(f_packet); } - else - { - if (will_retry) - { + else { + if (will_retry) { if (lobby_constructed) - w_lobby->append_error("Error connecting to master server. Will try again in " - + QString::number(net_manager->ms_reconnect_delay) + " seconds."); + w_lobby->append_error( + "Error connecting to master server. Will try again in " + + QString::number(net_manager->ms_reconnect_delay) + " seconds."); } - else - { + else { call_error("There was an error connecting to the master server.\n" - "We deploy multiple master servers to mitigate any possible downtime, " - "but the client appears to have exhausted all possible methods of finding " + "We deploy multiple master servers to mitigate any possible " + "downtime, " + "but the client appears to have exhausted all possible " + "methods of finding " "and connecting to one.\n" - "Please check your Internet connection and firewall, and please try again."); + "Please check your Internet connection and firewall, and " + "please try again."); } } } void AOApplication::call_settings_menu() { - AOOptionsDialog settings(nullptr, this); - settings.exec(); + AOOptionsDialog settings(nullptr, this); + settings.exec(); } void AOApplication::call_announce_menu(Courtroom *court) { - AOCaseAnnouncerDialog announcer(nullptr, this, court); - announcer.exec(); + AOCaseAnnouncerDialog announcer(nullptr, this, court); + announcer.exec(); } diff --git a/src/aoblipplayer.cpp b/src/aoblipplayer.cpp index 4dfb895c..0355414d 100644 --- a/src/aoblipplayer.cpp +++ b/src/aoblipplayer.cpp @@ -1,6 +1,6 @@ #include "aoblipplayer.h" -#if defined(BASSAUDIO) //Using bass.dll for the blips +#if defined(BASSAUDIO) // Using bass.dll for the blips AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; @@ -11,11 +11,11 @@ void AOBlipPlayer::set_blips(QString p_sfx) { QString f_path = ao_app->get_sounds_path(p_sfx); - for (int n_stream = 0 ; n_stream < 5 ; ++n_stream) - { + for (int n_stream = 0; n_stream < 5; ++n_stream) { BASS_StreamFree(m_stream_list[n_stream]); - m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); + m_stream_list[n_stream] = BASS_StreamCreateFile( + FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); } set_volume(m_volume); @@ -40,12 +40,11 @@ void AOBlipPlayer::set_volume(int p_value) float volume = p_value / 100.0f; - for (int n_stream = 0 ; n_stream < 5 ; ++n_stream) - { + for (int n_stream = 0; n_stream < 5; ++n_stream) { BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume); } } -#elif defined(QTAUDIO) //Using Qt's QSoundEffect class +#elif defined(QTAUDIO) // Using Qt's QSoundEffect class AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; @@ -56,8 +55,7 @@ void AOBlipPlayer::set_blips(QString p_sfx) { QString f_path = ao_app->get_sounds_path(p_sfx); - for (int n_stream = 0 ; n_stream < 5 ; ++n_stream) - { + for (int n_stream = 0; n_stream < 5; ++n_stream) { m_blips.setSource(QUrl::fromLocalFile(f_path)); } @@ -79,25 +77,16 @@ void AOBlipPlayer::set_volume(int p_value) m_volume = p_value; m_blips.setVolume(m_volume); } -#else //No audio +#else // No audio AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; ao_app = p_ao_app; } -void AOBlipPlayer::set_blips(QString p_sfx) -{ - -} - -void AOBlipPlayer::blip_tick() -{ - -} +void AOBlipPlayer::set_blips(QString p_sfx) {} -void AOBlipPlayer::set_volume(int p_value) -{ +void AOBlipPlayer::blip_tick() {} -} +void AOBlipPlayer::set_volume(int p_value) {} #endif diff --git a/src/aobutton.cpp b/src/aobutton.cpp index 5be2e678..fee946a4 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -3,15 +3,13 @@ #include "debug_functions.h" #include "file_functions.h" -AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) : QPushButton(parent) +AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) + : QPushButton(parent) { ao_app = p_ao_app; } -AOButton::~AOButton() -{ - -} +AOButton::~AOButton() {} void AOButton::set_image(QString p_image) { @@ -23,4 +21,3 @@ void AOButton::set_image(QString p_image) else this->setStyleSheet("border-image:url(\"" + default_image_path + "\")"); } - diff --git a/src/aocaseannouncerdialog.cpp b/src/aocaseannouncerdialog.cpp index 5b82b64f..d91433a6 100644 --- a/src/aocaseannouncerdialog.cpp +++ b/src/aocaseannouncerdialog.cpp @@ -1,7 +1,9 @@ #include "aocaseannouncerdialog.h" -AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_ao_app, Courtroom *p_court) - : QDialog(parent) +AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, + AOApplication *p_ao_app, + Courtroom *p_court) + : QDialog(parent) { ao_app = p_ao_app; court = p_court; @@ -14,21 +16,27 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a QSizePolicy sizepolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); sizepolicy.setHorizontalStretch(0); sizepolicy.setVerticalStretch(0); - sizepolicy.setHeightForWidth(ui_announcer_buttons->sizePolicy().hasHeightForWidth()); + sizepolicy.setHeightForWidth( + ui_announcer_buttons->sizePolicy().hasHeightForWidth()); ui_announcer_buttons->setSizePolicy(sizepolicy); ui_announcer_buttons->setOrientation(Qt::Horizontal); - ui_announcer_buttons->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + ui_announcer_buttons->setStandardButtons(QDialogButtonBox::Ok | + QDialogButtonBox::Cancel); - QObject::connect(ui_announcer_buttons, SIGNAL(accepted()), this, SLOT(ok_pressed())); - QObject::connect(ui_announcer_buttons, SIGNAL(rejected()), this, SLOT(cancel_pressed())); + QObject::connect(ui_announcer_buttons, SIGNAL(accepted()), this, + SLOT(ok_pressed())); + QObject::connect(ui_announcer_buttons, SIGNAL(rejected()), this, + SLOT(cancel_pressed())); setUpdatesEnabled(false); ui_vbox_layout = new QVBoxLayout(this); ui_form_layout = new QFormLayout(this); - ui_form_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter); - ui_form_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop); + ui_form_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignVCenter); + ui_form_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignTop); ui_form_layout->setContentsMargins(6, 6, 6, 6); ui_vbox_layout->addItem(ui_form_layout); @@ -66,17 +74,12 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a void AOCaseAnnouncerDialog::ok_pressed() { - court->announce_case(ui_case_title_textbox->text(), - ui_defense_needed->isChecked(), - ui_prosecutor_needed->isChecked(), - ui_judge_needed->isChecked(), - ui_juror_needed->isChecked(), - ui_steno_needed->isChecked()); + court->announce_case( + ui_case_title_textbox->text(), ui_defense_needed->isChecked(), + ui_prosecutor_needed->isChecked(), ui_judge_needed->isChecked(), + ui_juror_needed->isChecked(), ui_steno_needed->isChecked()); done(0); } -void AOCaseAnnouncerDialog::cancel_pressed() -{ - done(0); -} +void AOCaseAnnouncerDialog::cancel_pressed() { done(0); } diff --git a/src/aocharbutton.cpp b/src/aocharbutton.cpp index 76610270..6c27e3ea 100644 --- a/src/aocharbutton.cpp +++ b/src/aocharbutton.cpp @@ -2,7 +2,9 @@ #include "file_functions.h" -AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, bool is_taken) : QPushButton(parent) +AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, + int y_pos, bool is_taken) + : QPushButton(parent) { m_parent = parent; @@ -40,28 +42,20 @@ void AOCharButton::reset() ui_selector->hide(); } -void AOCharButton::set_taken(bool is_taken) -{ - taken = is_taken; -} +void AOCharButton::set_taken(bool is_taken) { taken = is_taken; } void AOCharButton::apply_taken_image() { - if (taken) - { - ui_taken->move(0,0); + if (taken) { + ui_taken->move(0, 0); ui_taken->show(); } - else - { + else { ui_taken->hide(); } } -void AOCharButton::set_passworded() -{ - ui_passworded->show(); -} +void AOCharButton::set_passworded() { ui_passworded->show(); } void AOCharButton::set_image(QString p_character) { @@ -71,14 +65,13 @@ void AOCharButton::set_image(QString p_character) if (file_exists(image_path)) this->setStyleSheet("border-image:url(\"" + image_path + "\")"); - else - { + else { this->setStyleSheet("border-image:url()"); this->setText(p_character); } } -void AOCharButton::enterEvent(QEvent * e) +void AOCharButton::enterEvent(QEvent *e) { ui_selector->move(this->x() - 1, this->y() - 1); ui_selector->raise(); @@ -88,10 +81,8 @@ void AOCharButton::enterEvent(QEvent * e) QPushButton::enterEvent(e); } -void AOCharButton::leaveEvent(QEvent * e) +void AOCharButton::leaveEvent(QEvent *e) { ui_selector->hide(); QPushButton::leaveEvent(e); } - - diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 57487233..3e0a4de8 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -1,10 +1,11 @@ #include "aocharmovie.h" -#include "misc_functions.h" -#include "file_functions.h" #include "aoapplication.h" +#include "file_functions.h" +#include "misc_functions.h" -AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) +AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) + : QLabel(p_parent) { ao_app = p_ao_app; @@ -19,11 +20,14 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) { - QString original_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif"); + QString original_path = + ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif"); QString alt_path = ao_app->get_character_path(p_char, p_emote + ".png"); - QString apng_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng"); + QString apng_path = + ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng"); QString placeholder_path = ao_app->get_theme_path("placeholder.gif"); - QString placeholder_default_path = ao_app->get_default_theme_path("placeholder.gif"); + QString placeholder_default_path = + ao_app->get_default_theme_path("placeholder.gif"); QString gif_path; if (file_exists(apng_path)) @@ -44,8 +48,7 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) movie_frames.clear(); QImage f_image = reader->read(); - while (!f_image.isNull()) - { + while (!f_image.isNull()) { if (m_flipped) movie_frames.append(f_image.mirrored(true, false)); else @@ -73,8 +76,7 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) play_once = false; - for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame) - { + for (int n_frame = 0; n_frame < m_movie->frameCount(); ++n_frame) { real_duration += m_movie->nextFrameDelay(); m_movie->jumpToFrame(n_frame + 1); } @@ -86,8 +88,7 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) double percentage_modifier = 100.0; - if (real_duration != 0 && duration != 0) - { + if (real_duration != 0 && duration != 0) { double modifier = full_duration / static_cast(real_duration); percentage_modifier = 100 / modifier; @@ -99,17 +100,14 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) qDebug() << "% mod: " << percentage_modifier; #endif - if (full_duration == 0 || full_duration >= real_duration) - { + if (full_duration == 0 || full_duration >= real_duration) { play_once = true; } - else - { + else { play_once = false; preanim_timer->start(full_duration); } - m_movie->setSpeed(static_cast(percentage_modifier)); play(p_char, p_emote, ""); } @@ -142,7 +140,8 @@ void AOCharMovie::play_idle(QString p_char, QString p_emote) void AOCharMovie::stop() { - //for all intents and purposes, stopping is the same as hiding. at no point do we want a frozen gif to display + // for all intents and purposes, stopping is the same as hiding. at no point + // do we want a frozen gif to display m_movie->stop(); preanim_timer->stop(); this->hide(); @@ -165,31 +164,28 @@ void AOCharMovie::move(int ax, int ay) void AOCharMovie::frame_change(int n_frame) { - if (movie_frames.size() > n_frame) - { + if (movie_frames.size() > n_frame) { QPixmap f_pixmap = QPixmap::fromImage(movie_frames.at(n_frame)); auto aspect_ratio = Qt::KeepAspectRatio; if (f_pixmap.size().width() > f_pixmap.size().height()) aspect_ratio = Qt::KeepAspectRatioByExpanding; - if (f_pixmap.size().width() > this->size().width() || f_pixmap.size().height() > this->size().height()) - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::SmoothTransformation)); + if (f_pixmap.size().width() > this->size().width() || + f_pixmap.size().height() > this->size().height()) + this->setPixmap(f_pixmap.scaled(this->width(), this->height(), + aspect_ratio, Qt::SmoothTransformation)); else - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation)); + this->setPixmap(f_pixmap.scaled(this->width(), this->height(), + aspect_ratio, Qt::FastTransformation)); - QLabel::move(x + (this->width() - this->pixmap()->width())/2, y); - } + QLabel::move(x + (this->width() - this->pixmap()->width()) / 2, y); + } - if (m_movie->frameCount() - 1 == n_frame && play_once) - { + if (m_movie->frameCount() - 1 == n_frame && play_once) { preanim_timer->start(m_movie->nextFrameDelay()); m_movie->stop(); } } -void AOCharMovie::timer_done() -{ - - done(); -} +void AOCharMovie::timer_done() { done(); } diff --git a/src/aoemotebutton.cpp b/src/aoemotebutton.cpp index 9c1d3889..29329c98 100644 --- a/src/aoemotebutton.cpp +++ b/src/aoemotebutton.cpp @@ -2,7 +2,9 @@ #include "file_functions.h" -AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent) +AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, + int p_x, int p_y) + : QPushButton(p_parent) { parent = p_parent; ao_app = p_ao_app; @@ -16,21 +18,17 @@ AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix) { QString emotion_number = QString::number(p_emote + 1); - QString image_path = ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix); + QString image_path = ao_app->get_character_path( + p_char, "emotions/button" + emotion_number + suffix); - if (file_exists(image_path)) - { + if (file_exists(image_path)) { this->setText(""); this->setStyleSheet("border-image:url(\"" + image_path + "\")"); } - else - { + else { this->setText(ao_app->get_emote_comment(p_char, p_emote)); this->setStyleSheet("border-image:url(\"\")"); } } -void AOEmoteButton::on_clicked() -{ - emote_clicked(m_id); -} +void AOEmoteButton::on_clicked() { emote_clicked(m_id); } diff --git a/src/aoevidencebutton.cpp b/src/aoevidencebutton.cpp index 15b598fc..a94519e0 100644 --- a/src/aoevidencebutton.cpp +++ b/src/aoevidencebutton.cpp @@ -2,7 +2,9 @@ #include "file_functions.h" -AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent) +AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, + int p_x, int p_y) + : QPushButton(p_parent) { ao_app = p_ao_app; m_parent = p_parent; @@ -39,13 +41,11 @@ void AOEvidenceButton::set_image(QString p_image) { QString image_path = ao_app->get_evidence_path(p_image); - if (file_exists(image_path)) - { + if (file_exists(image_path)) { this->setText(""); this->setStyleSheet("border-image:url(\"" + image_path + "\")"); } - else - { + else { this->setText(p_image); this->setStyleSheet(""); } @@ -75,10 +75,7 @@ void AOEvidenceButton::set_selected(bool p_selected) ui_selected->hide(); } -void AOEvidenceButton::on_clicked() -{ - evidence_clicked(m_id); -} +void AOEvidenceButton::on_clicked() { evidence_clicked(m_id); } void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e) { @@ -102,7 +99,7 @@ void AOEvidenceButton::dragEnterEvent(QMouseEvent *e) } */ -void AOEvidenceButton::enterEvent(QEvent * e) +void AOEvidenceButton::enterEvent(QEvent *e) { ui_selector->show(); @@ -112,7 +109,7 @@ void AOEvidenceButton::enterEvent(QEvent * e) QPushButton::enterEvent(e); } -void AOEvidenceButton::leaveEvent(QEvent * e) +void AOEvidenceButton::leaveEvent(QEvent *e) { ui_selector->hide(); diff --git a/src/aoevidencedisplay.cpp b/src/aoevidencedisplay.cpp index 9ec105dd..9dd062b7 100644 --- a/src/aoevidencedisplay.cpp +++ b/src/aoevidencedisplay.cpp @@ -1,10 +1,11 @@ #include "aoevidencedisplay.h" -#include "file_functions.h" #include "datatypes.h" +#include "file_functions.h" #include "misc_functions.h" -AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) +AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app) + : QLabel(p_parent) { ao_app = p_ao_app; @@ -12,10 +13,12 @@ AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app) evidence_icon = new QLabel(this); sfx_player = new AOSfxPlayer(this, ao_app); - connect(evidence_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); + connect(evidence_movie, SIGNAL(frameChanged(int)), this, + SLOT(frame_change(int))); } -void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_side, int p_volume) +void AOEvidenceDisplay::show_evidence(QString p_evidence_image, + bool is_left_side, int p_volume) { this->reset(); @@ -29,23 +32,23 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid QString gif_name; QString icon_identifier; - if (is_left_side) - { + if (is_left_side) { icon_identifier = "left_evidence_icon"; gif_name = "evidence_appear_left.gif"; } - else - { + else { icon_identifier = "right_evidence_icon"; gif_name = "evidence_appear_right.gif"; } - pos_size_type icon_dimensions = ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini"); + pos_size_type icon_dimensions = + ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini"); evidence_icon->move(icon_dimensions.x, icon_dimensions.y); evidence_icon->resize(icon_dimensions.width, icon_dimensions.height); - evidence_icon->setPixmap(f_pixmap.scaled(evidence_icon->width(), evidence_icon->height(), Qt::IgnoreAspectRatio)); + evidence_icon->setPixmap(f_pixmap.scaled( + evidence_icon->width(), evidence_icon->height(), Qt::IgnoreAspectRatio)); QString f_default_gif_path = ao_app->get_default_theme_path(gif_name); QString f_gif_path = ao_app->get_theme_path(gif_name); @@ -57,7 +60,7 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid evidence_movie->setFileName(final_gif_path); - if(evidence_movie->frameCount() < 1) + if (evidence_movie->frameCount() < 1) return; this->setMovie(evidence_movie); @@ -68,9 +71,8 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid void AOEvidenceDisplay::frame_change(int p_frame) { - if (p_frame == (evidence_movie->frameCount() - 1)) - { - //we need this or else the last frame wont show + if (p_frame == (evidence_movie->frameCount() - 1)) { + // we need this or else the last frame wont show delay(evidence_movie->nextFrameDelay()); evidence_movie->stop(); @@ -88,9 +90,4 @@ void AOEvidenceDisplay::reset() this->clear(); } -QLabel* AOEvidenceDisplay::get_evidence_icon() -{ - return evidence_icon; -} - - +QLabel *AOEvidenceDisplay::get_evidence_icon() { return evidence_icon; } diff --git a/src/aoimage.cpp b/src/aoimage.cpp index 7bb56bb6..ffdf25aa 100644 --- a/src/aoimage.cpp +++ b/src/aoimage.cpp @@ -8,10 +8,7 @@ AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) ao_app = p_ao_app; } -AOImage::~AOImage() -{ - -} +AOImage::~AOImage() {} void AOImage::set_image(QString p_image) { @@ -27,7 +24,8 @@ void AOImage::set_image(QString p_image) QPixmap f_pixmap(final_image_path); - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + this->setPixmap( + f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); } void AOImage::set_image_from_path(QString p_path) @@ -43,5 +41,6 @@ void AOImage::set_image_from_path(QString p_path) QPixmap f_pixmap(final_path); - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + this->setPixmap( + f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); } diff --git a/src/aolineedit.cpp b/src/aolineedit.cpp index f6026e14..211d9f78 100644 --- a/src/aolineedit.cpp +++ b/src/aolineedit.cpp @@ -15,7 +15,4 @@ void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e) this->setReadOnly(false); } -void AOLineEdit::on_enter_pressed() -{ - this->setReadOnly(true); -} +void AOLineEdit::on_enter_pressed() { this->setReadOnly(true); } diff --git a/src/aomovie.cpp b/src/aomovie.cpp index edf5bdb0..86426882 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -1,7 +1,7 @@ #include "aomovie.h" -#include "file_functions.h" #include "courtroom.h" +#include "file_functions.h" #include "misc_functions.h" AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) @@ -15,10 +15,7 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); } -void AOMovie::set_play_once(bool p_play_once) -{ - play_once = p_play_once; -} +void AOMovie::set_play_once(bool p_play_once) { play_once = p_play_once; } void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme) { @@ -28,16 +25,21 @@ void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme) QString custom_path; if (p_gif == "custom") - custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif)); + custom_path = + ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif)); else - custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble")); + custom_path = ao_app->get_image_suffix( + ao_app->get_character_path(p_char, p_gif + "_bubble")); - QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_gif + "_bubble.gif"; - QString custom_theme_path = ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif"); + QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + + p_gif + "_bubble.gif"; + QString custom_theme_path = + ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif"); QString theme_path = ao_app->get_theme_path(p_gif + ".gif"); QString default_theme_path = ao_app->get_default_theme_path(p_gif + ".gif"); QString placeholder_path = ao_app->get_theme_path("placeholder.gif"); - QString default_placeholder_path = ao_app->get_default_theme_path("placeholder.gif"); + QString default_placeholder_path = + ao_app->get_default_theme_path("placeholder.gif"); if (file_exists(custom_path)) gif_path = custom_path; @@ -70,14 +72,13 @@ void AOMovie::stop() void AOMovie::frame_change(int n_frame) { - if (n_frame == (m_movie->frameCount() - 1) && play_once) - { - //we need this or else the last frame wont show + if (n_frame == (m_movie->frameCount() - 1) && play_once) { + // we need this or else the last frame wont show delay(m_movie->nextFrameDelay()); this->stop(); - //signal connected to courtroom object, let it figure out what to do + // signal connected to courtroom object, let it figure out what to do done(); } } diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 27918092..e61555a5 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -7,10 +7,7 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) ao_app = p_ao_app; } -AOMusicPlayer::~AOMusicPlayer() -{ - BASS_ChannelStop(m_stream); -} +AOMusicPlayer::~AOMusicPlayer() { BASS_ChannelStop(m_stream); } void AOMusicPlayer::play(QString p_song) { @@ -18,7 +15,9 @@ void AOMusicPlayer::play(QString p_song) QString f_path = ao_app->get_music_path(p_song); - m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, + BASS_STREAM_AUTOFREE | BASS_UNICODE | + BASS_ASYNCFILE); this->set_volume(m_volume); @@ -40,10 +39,7 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) ao_app = p_ao_app; } -AOMusicPlayer::~AOMusicPlayer() -{ - m_player.stop(); -} +AOMusicPlayer::~AOMusicPlayer() { m_player.stop(); } void AOMusicPlayer::play(QString p_song) { @@ -70,18 +66,9 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) ao_app = p_ao_app; } -AOMusicPlayer::~AOMusicPlayer() -{ +AOMusicPlayer::~AOMusicPlayer() {} -} +void AOMusicPlayer::play(QString p_song) {} -void AOMusicPlayer::play(QString p_song) -{ - -} - -void AOMusicPlayer::set_volume(int p_value) -{ - -} +void AOMusicPlayer::set_volume(int p_value) {} #endif diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 0f6a054a..5653fd90 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -2,523 +2,554 @@ #include "aoapplication.h" #include "bass.h" -AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDialog(parent) +AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) + : QDialog(parent) { - ao_app = p_ao_app; + ao_app = p_ao_app; + + // Setting up the basics. + // setAttribute(Qt::WA_DeleteOnClose); + setWindowTitle(tr("Settings")); + resize(398, 320); + + ui_settings_buttons = new QDialogButtonBox(this); + + QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Fixed); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth( + ui_settings_buttons->sizePolicy().hasHeightForWidth()); + ui_settings_buttons->setSizePolicy(sizePolicy1); + ui_settings_buttons->setOrientation(Qt::Horizontal); + ui_settings_buttons->setStandardButtons(QDialogButtonBox::Cancel | + QDialogButtonBox::Save); + + QObject::connect(ui_settings_buttons, SIGNAL(accepted()), this, + SLOT(save_pressed())); + QObject::connect(ui_settings_buttons, SIGNAL(rejected()), this, + SLOT(discard_pressed())); + + // We'll stop updates so that the window won't flicker while it's being made. + setUpdatesEnabled(false); + + // First of all, we want a tabbed dialog, so let's add some layout. + ui_vertical_layout = new QVBoxLayout(this); + ui_settings_tabs = new QTabWidget(this); + + ui_vertical_layout->addWidget(ui_settings_tabs); + ui_vertical_layout->addWidget(ui_settings_buttons); + + // Let's add the tabs one by one. + // First, we'll start with 'Gameplay'. + ui_gameplay_tab = new QWidget(); + ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay")); + + ui_form_layout_widget = new QWidget(ui_gameplay_tab); + ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 211)); - // Setting up the basics. - // setAttribute(Qt::WA_DeleteOnClose); - setWindowTitle(tr("Settings")); - resize(398, 320); + ui_gameplay_form = new QFormLayout(ui_form_layout_widget); + ui_gameplay_form->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignVCenter); + ui_gameplay_form->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignTop); + ui_gameplay_form->setContentsMargins(0, 0, 0, 0); - ui_settings_buttons = new QDialogButtonBox(this); + ui_theme_label = new QLabel(ui_form_layout_widget); + ui_theme_label->setText(tr("Theme:")); + ui_theme_label->setToolTip( + tr("Sets the theme used in-game. If the new theme changes " + "the lobby's look as well, you'll need to reload the " + "lobby for the changes to take effect, such as by joining " + "a server and leaving it.")); + ui_gameplay_form->setWidget(0, QFormLayout::LabelRole, ui_theme_label); - QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Fixed); - sizePolicy1.setHorizontalStretch(0); - sizePolicy1.setVerticalStretch(0); - sizePolicy1.setHeightForWidth(ui_settings_buttons->sizePolicy().hasHeightForWidth()); - ui_settings_buttons->setSizePolicy(sizePolicy1); - ui_settings_buttons->setOrientation(Qt::Horizontal); - ui_settings_buttons->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save); + ui_theme_combobox = new QComboBox(ui_form_layout_widget); - QObject::connect(ui_settings_buttons, SIGNAL(accepted()), this, SLOT(save_pressed())); - QObject::connect(ui_settings_buttons, SIGNAL(rejected()), this, SLOT(discard_pressed())); + // Fill the combobox with the names of the themes. + QDirIterator it(p_ao_app->get_base_path() + "themes", QDir::Dirs, + QDirIterator::NoIteratorFlags); + while (it.hasNext()) { + QString actualname = QDir(it.next()).dirName(); + if (actualname != "." && actualname != "..") + ui_theme_combobox->addItem(actualname); + if (actualname == p_ao_app->read_theme()) + ui_theme_combobox->setCurrentIndex(ui_theme_combobox->count() - 1); + } - // We'll stop updates so that the window won't flicker while it's being made. - setUpdatesEnabled(false); + ui_gameplay_form->setWidget(0, QFormLayout::FieldRole, ui_theme_combobox); - // First of all, we want a tabbed dialog, so let's add some layout. - ui_vertical_layout = new QVBoxLayout(this); - ui_settings_tabs = new QTabWidget(this); + ui_theme_log_divider = new QFrame(ui_form_layout_widget); + ui_theme_log_divider->setMidLineWidth(0); + ui_theme_log_divider->setFrameShape(QFrame::HLine); + ui_theme_log_divider->setFrameShadow(QFrame::Sunken); - ui_vertical_layout->addWidget(ui_settings_tabs); - ui_vertical_layout->addWidget(ui_settings_buttons); + ui_gameplay_form->setWidget(1, QFormLayout::FieldRole, ui_theme_log_divider); - // Let's add the tabs one by one. - // First, we'll start with 'Gameplay'. - ui_gameplay_tab = new QWidget(); - ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay")); + ui_downwards_lbl = new QLabel(ui_form_layout_widget); + ui_downwards_lbl->setText(tr("Log goes downwards:")); + ui_downwards_lbl->setToolTip( + tr("If ticked, new messages will appear at " + "the bottom (like the OOC chatlog). The traditional " + "(AO1) behaviour is equivalent to this being unticked.")); - ui_form_layout_widget = new QWidget(ui_gameplay_tab); - ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 211)); + ui_gameplay_form->setWidget(2, QFormLayout::LabelRole, ui_downwards_lbl); - ui_gameplay_form = new QFormLayout(ui_form_layout_widget); - ui_gameplay_form->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); - ui_gameplay_form->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); - ui_gameplay_form->setContentsMargins(0, 0, 0, 0); + ui_downwards_cb = new QCheckBox(ui_form_layout_widget); + ui_downwards_cb->setChecked(p_ao_app->get_log_goes_downwards()); - ui_theme_label = new QLabel(ui_form_layout_widget); - ui_theme_label->setText(tr("Theme:")); - ui_theme_label->setToolTip(tr("Sets the theme used in-game. If the new theme changes " - "the lobby's look as well, you'll need to reload the " - "lobby for the changes to take effect, such as by joining " - "a server and leaving it.")); - ui_gameplay_form->setWidget(0, QFormLayout::LabelRole, ui_theme_label); + ui_gameplay_form->setWidget(2, QFormLayout::FieldRole, ui_downwards_cb); - ui_theme_combobox = new QComboBox(ui_form_layout_widget); + ui_length_lbl = new QLabel(ui_form_layout_widget); + ui_length_lbl->setText(tr("Log length:")); + ui_length_lbl->setToolTip(tr( + "The amount of messages the IC chatlog will keep before " + "deleting older messages. A value of 0 or below counts as 'infinite'.")); - // Fill the combobox with the names of the themes. - QDirIterator it(p_ao_app->get_base_path() + "themes", QDir::Dirs, QDirIterator::NoIteratorFlags); - while (it.hasNext()) - { - QString actualname = QDir(it.next()).dirName(); - if (actualname != "." && actualname != "..") - ui_theme_combobox->addItem(actualname); - if (actualname == p_ao_app->read_theme()) - ui_theme_combobox->setCurrentIndex(ui_theme_combobox->count()-1); - } + ui_gameplay_form->setWidget(3, QFormLayout::LabelRole, ui_length_lbl); - ui_gameplay_form->setWidget(0, QFormLayout::FieldRole, ui_theme_combobox); + ui_length_spinbox = new QSpinBox(ui_form_layout_widget); + ui_length_spinbox->setMaximum(10000); + ui_length_spinbox->setValue(p_ao_app->get_max_log_size()); - ui_theme_log_divider = new QFrame(ui_form_layout_widget); - ui_theme_log_divider->setMidLineWidth(0); - ui_theme_log_divider->setFrameShape(QFrame::HLine); - ui_theme_log_divider->setFrameShadow(QFrame::Sunken); + ui_gameplay_form->setWidget(3, QFormLayout::FieldRole, ui_length_spinbox); + + ui_log_names_divider = new QFrame(ui_form_layout_widget); + ui_log_names_divider->setFrameShape(QFrame::HLine); + ui_log_names_divider->setFrameShadow(QFrame::Sunken); + + ui_gameplay_form->setWidget(4, QFormLayout::FieldRole, ui_log_names_divider); - ui_gameplay_form->setWidget(1, QFormLayout::FieldRole, ui_theme_log_divider); + ui_username_lbl = new QLabel(ui_form_layout_widget); + ui_username_lbl->setText(tr("Default username:")); + ui_username_lbl->setToolTip( + tr("Your OOC name will be automatically set to this value " + "when you join a server.")); - ui_downwards_lbl = new QLabel(ui_form_layout_widget); - ui_downwards_lbl->setText(tr("Log goes downwards:")); - ui_downwards_lbl->setToolTip(tr("If ticked, new messages will appear at " - "the bottom (like the OOC chatlog). The traditional " - "(AO1) behaviour is equivalent to this being unticked.")); + ui_gameplay_form->setWidget(5, QFormLayout::LabelRole, ui_username_lbl); - ui_gameplay_form->setWidget(2, QFormLayout::LabelRole, ui_downwards_lbl); + ui_username_textbox = new QLineEdit(ui_form_layout_widget); + ui_username_textbox->setMaxLength(30); + ui_username_textbox->setText(p_ao_app->get_default_username()); - ui_downwards_cb = new QCheckBox(ui_form_layout_widget); - ui_downwards_cb->setChecked(p_ao_app->get_log_goes_downwards()); + ui_gameplay_form->setWidget(5, QFormLayout::FieldRole, ui_username_textbox); - ui_gameplay_form->setWidget(2, QFormLayout::FieldRole, ui_downwards_cb); + ui_showname_lbl = new QLabel(ui_form_layout_widget); + ui_showname_lbl->setText(tr("Custom shownames:")); + ui_showname_lbl->setToolTip( + tr("Gives the default value for the in-game 'Custom shownames' " + "tickbox, which in turn determines whether the client should " + "display custom in-character names.")); - ui_length_lbl = new QLabel(ui_form_layout_widget); - ui_length_lbl->setText(tr("Log length:")); - ui_length_lbl->setToolTip(tr("The amount of messages the IC chatlog will keep before " - "deleting older messages. A value of 0 or below counts as 'infinite'.")); + ui_gameplay_form->setWidget(6, QFormLayout::LabelRole, ui_showname_lbl); - ui_gameplay_form->setWidget(3, QFormLayout::LabelRole, ui_length_lbl); + ui_showname_cb = new QCheckBox(ui_form_layout_widget); + ui_showname_cb->setChecked(p_ao_app->get_showname_enabled_by_default()); - ui_length_spinbox = new QSpinBox(ui_form_layout_widget); - ui_length_spinbox->setMaximum(10000); - ui_length_spinbox->setValue(p_ao_app->get_max_log_size()); + ui_gameplay_form->setWidget(6, QFormLayout::FieldRole, ui_showname_cb); - ui_gameplay_form->setWidget(3, QFormLayout::FieldRole, ui_length_spinbox); + ui_net_divider = new QFrame(ui_form_layout_widget); + ui_net_divider->setFrameShape(QFrame::HLine); + ui_net_divider->setFrameShadow(QFrame::Sunken); - ui_log_names_divider = new QFrame(ui_form_layout_widget); - ui_log_names_divider->setFrameShape(QFrame::HLine); - ui_log_names_divider->setFrameShadow(QFrame::Sunken); + ui_gameplay_form->setWidget(7, QFormLayout::FieldRole, ui_net_divider); - ui_gameplay_form->setWidget(4, QFormLayout::FieldRole, ui_log_names_divider); + ui_ms_lbl = new QLabel(ui_form_layout_widget); + ui_ms_lbl->setText(tr("Backup MS:")); + ui_ms_lbl->setToolTip( + tr("If the built-in server lookups fail, the game will try the " + "address given here and use it as a backup master server address.")); - ui_username_lbl = new QLabel(ui_form_layout_widget); - ui_username_lbl->setText(tr("Default username:")); - ui_username_lbl->setToolTip(tr("Your OOC name will be automatically set to this value " - "when you join a server.")); + ui_gameplay_form->setWidget(8, QFormLayout::LabelRole, ui_ms_lbl); - ui_gameplay_form->setWidget(5, QFormLayout::LabelRole, ui_username_lbl); + QSettings *configini = ao_app->configini; + ui_ms_textbox = new QLineEdit(ui_form_layout_widget); + ui_ms_textbox->setText(configini->value("master", "").value()); - ui_username_textbox = new QLineEdit(ui_form_layout_widget); - ui_username_textbox->setMaxLength(30); - ui_username_textbox->setText(p_ao_app->get_default_username()); + ui_gameplay_form->setWidget(8, QFormLayout::FieldRole, ui_ms_textbox); - ui_gameplay_form->setWidget(5, QFormLayout::FieldRole, ui_username_textbox); + ui_discord_lbl = new QLabel(ui_form_layout_widget); + ui_discord_lbl->setText(tr("Discord:")); + ui_discord_lbl->setToolTip( + tr("Allows others on Discord to see what server you are in, " + "what character are you playing, and how long you have " + "been playing for.")); - ui_showname_lbl = new QLabel(ui_form_layout_widget); - ui_showname_lbl->setText(tr("Custom shownames:")); - ui_showname_lbl->setToolTip(tr("Gives the default value for the in-game 'Custom shownames' " - "tickbox, which in turn determines whether the client should " - "display custom in-character names.")); + ui_gameplay_form->setWidget(9, QFormLayout::LabelRole, ui_discord_lbl); - ui_gameplay_form->setWidget(6, QFormLayout::LabelRole, ui_showname_lbl); + ui_discord_cb = new QCheckBox(ui_form_layout_widget); + ui_discord_cb->setChecked(ao_app->is_discord_enabled()); - ui_showname_cb = new QCheckBox(ui_form_layout_widget); - ui_showname_cb->setChecked(p_ao_app->get_showname_enabled_by_default()); + ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_discord_cb); - ui_gameplay_form->setWidget(6, QFormLayout::FieldRole, ui_showname_cb); + // Here we start the callwords tab. + ui_callwords_tab = new QWidget(); + ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords")); - ui_net_divider = new QFrame(ui_form_layout_widget); - ui_net_divider->setFrameShape(QFrame::HLine); - ui_net_divider->setFrameShadow(QFrame::Sunken); + ui_callwords_widget = new QWidget(ui_callwords_tab); + ui_callwords_widget->setGeometry(QRect(10, 10, 361, 211)); - ui_gameplay_form->setWidget(7, QFormLayout::FieldRole, ui_net_divider); + ui_callwords_layout = new QVBoxLayout(ui_callwords_widget); + ui_callwords_layout->setContentsMargins(0, 0, 0, 0); - ui_ms_lbl = new QLabel(ui_form_layout_widget); - ui_ms_lbl->setText(tr("Backup MS:")); - ui_ms_lbl->setToolTip(tr("If the built-in server lookups fail, the game will try the " - "address given here and use it as a backup master server address.")); + ui_callwords_textbox = new QPlainTextEdit(ui_callwords_widget); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth( + ui_callwords_textbox->sizePolicy().hasHeightForWidth()); + ui_callwords_textbox->setSizePolicy(sizePolicy); - ui_gameplay_form->setWidget(8, QFormLayout::LabelRole, ui_ms_lbl); + // Let's fill the callwords text edit with the already present callwords. + ui_callwords_textbox->document()->clear(); + foreach (QString callword, p_ao_app->get_call_words()) { + ui_callwords_textbox->appendPlainText(callword); + } - QSettings* configini = ao_app->configini; - ui_ms_textbox = new QLineEdit(ui_form_layout_widget); - ui_ms_textbox->setText(configini->value("master", "").value()); + ui_callwords_layout->addWidget(ui_callwords_textbox); - ui_gameplay_form->setWidget(8, QFormLayout::FieldRole, ui_ms_textbox); + ui_callwords_explain_lbl = new QLabel(ui_callwords_widget); + ui_callwords_explain_lbl->setWordWrap(true); + ui_callwords_explain_lbl->setText( + tr("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_discord_lbl = new QLabel(ui_form_layout_widget); - ui_discord_lbl->setText(tr("Discord:")); - ui_discord_lbl->setToolTip(tr("Allows others on Discord to see what server you are in, " - "what character are you playing, and how long you have " - "been playing for.")); + ui_callwords_layout->addWidget(ui_callwords_explain_lbl); - ui_gameplay_form->setWidget(9, QFormLayout::LabelRole, ui_discord_lbl); +// The audio tab. +#ifdef BASSAUDIO + ui_audio_tab = new QWidget(); + ui_settings_tabs->addTab(ui_audio_tab, tr("Audio")); - ui_discord_cb = new QCheckBox(ui_form_layout_widget); - ui_discord_cb->setChecked(ao_app->is_discord_enabled()); + ui_audio_widget = new QWidget(ui_audio_tab); + ui_audio_widget->setGeometry(QRect(10, 10, 361, 211)); - ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_discord_cb); + ui_audio_layout = new QFormLayout(ui_audio_widget); + ui_audio_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignVCenter); + ui_audio_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignTop); + ui_audio_layout->setContentsMargins(0, 0, 0, 0); - // Here we start the callwords tab. - ui_callwords_tab = new QWidget(); - ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords")); + ui_audio_device_lbl = new QLabel(ui_audio_widget); + ui_audio_device_lbl->setText(tr("Audio device:")); + ui_audio_device_lbl->setToolTip(tr("Sets the audio device for all sounds.")); - ui_callwords_widget = new QWidget(ui_callwords_tab); - ui_callwords_widget->setGeometry(QRect(10, 10, 361, 211)); + ui_audio_layout->setWidget(0, QFormLayout::LabelRole, ui_audio_device_lbl); - ui_callwords_layout = new QVBoxLayout(ui_callwords_widget); - ui_callwords_layout->setContentsMargins(0,0,0,0); + ui_audio_device_combobox = new QComboBox(ui_audio_widget); - ui_callwords_textbox = new QPlainTextEdit(ui_callwords_widget); - QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - sizePolicy.setHorizontalStretch(0); - sizePolicy.setVerticalStretch(0); - sizePolicy.setHeightForWidth(ui_callwords_textbox->sizePolicy().hasHeightForWidth()); - ui_callwords_textbox->setSizePolicy(sizePolicy); + // Let's fill out the combobox with the available audio devices. Or don't if + // there is no audio + int a = 0; + BASS_DEVICEINFO info; - // Let's fill the callwords text edit with the already present callwords. - ui_callwords_textbox->document()->clear(); - foreach (QString callword, p_ao_app->get_call_words()) { - ui_callwords_textbox->appendPlainText(callword); - } + if (needs_default_audiodev()) { + ui_audio_device_combobox->addItem("default"); + } - ui_callwords_layout->addWidget(ui_callwords_textbox); + for (a = 0; BASS_GetDeviceInfo(a, &info); a++) { + ui_audio_device_combobox->addItem(info.name); + if (p_ao_app->get_audio_output_device() == info.name) + ui_audio_device_combobox->setCurrentIndex( + ui_audio_device_combobox->count() - 1); + } - ui_callwords_explain_lbl = new QLabel(ui_callwords_widget); - ui_callwords_explain_lbl->setWordWrap(true); - ui_callwords_explain_lbl->setText(tr("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_audio_layout->setWidget(0, QFormLayout::FieldRole, + ui_audio_device_combobox); - ui_callwords_layout->addWidget(ui_callwords_explain_lbl); + ui_audio_volume_divider = new QFrame(ui_audio_widget); + ui_audio_volume_divider->setFrameShape(QFrame::HLine); + ui_audio_volume_divider->setFrameShadow(QFrame::Sunken); - // The audio tab. - #ifdef BASSAUDIO - ui_audio_tab = new QWidget(); - ui_settings_tabs->addTab(ui_audio_tab, tr("Audio")); + ui_audio_layout->setWidget(1, QFormLayout::FieldRole, + ui_audio_volume_divider); - ui_audio_widget = new QWidget(ui_audio_tab); - ui_audio_widget->setGeometry(QRect(10, 10, 361, 211)); + ui_music_volume_lbl = new QLabel(ui_audio_widget); + ui_music_volume_lbl->setText(tr("Music:")); + ui_music_volume_lbl->setToolTip(tr("Sets the music's default volume.")); - ui_audio_layout = new QFormLayout(ui_audio_widget); - ui_audio_layout->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); - ui_audio_layout->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); - ui_audio_layout->setContentsMargins(0, 0, 0, 0); + ui_audio_layout->setWidget(2, QFormLayout::LabelRole, ui_music_volume_lbl); - ui_audio_device_lbl = new QLabel(ui_audio_widget); - ui_audio_device_lbl->setText(tr("Audio device:")); - ui_audio_device_lbl->setToolTip(tr("Sets the audio device for all sounds.")); + ui_music_volume_spinbox = new QSpinBox(ui_audio_widget); + ui_music_volume_spinbox->setValue(p_ao_app->get_default_music()); + ui_music_volume_spinbox->setMaximum(100); + ui_music_volume_spinbox->setSuffix("%"); - ui_audio_layout->setWidget(0, QFormLayout::LabelRole, ui_audio_device_lbl); + ui_audio_layout->setWidget(2, QFormLayout::FieldRole, + ui_music_volume_spinbox); - ui_audio_device_combobox = new QComboBox(ui_audio_widget); + ui_sfx_volume_lbl = new QLabel(ui_audio_widget); + ui_sfx_volume_lbl->setText(tr("SFX:")); + ui_sfx_volume_lbl->setToolTip( + tr("Sets the SFX's default volume. " + "Interjections and actual sound effects count as 'SFX'.")); - // Let's fill out the combobox with the available audio devices. Or don't if there is no audio - int a = 0; - BASS_DEVICEINFO info; + ui_audio_layout->setWidget(3, QFormLayout::LabelRole, ui_sfx_volume_lbl); - if (needs_default_audiodev()) - { - ui_audio_device_combobox->addItem("default"); - } + ui_sfx_volume_spinbox = new QSpinBox(ui_audio_widget); + ui_sfx_volume_spinbox->setValue(p_ao_app->get_default_sfx()); + ui_sfx_volume_spinbox->setMaximum(100); + ui_sfx_volume_spinbox->setSuffix("%"); - for (a = 0; BASS_GetDeviceInfo(a, &info); a++) - { - ui_audio_device_combobox->addItem(info.name); - if (p_ao_app->get_audio_output_device() == info.name) - ui_audio_device_combobox->setCurrentIndex(ui_audio_device_combobox->count()-1); - } + ui_audio_layout->setWidget(3, QFormLayout::FieldRole, ui_sfx_volume_spinbox); - ui_audio_layout->setWidget(0, QFormLayout::FieldRole, ui_audio_device_combobox); + ui_blips_volume_lbl = new QLabel(ui_audio_widget); + ui_blips_volume_lbl->setText(tr("Blips:")); + ui_blips_volume_lbl->setToolTip( + tr("Sets the volume of the blips, the talking sound effects.")); - ui_audio_volume_divider = new QFrame(ui_audio_widget); - ui_audio_volume_divider->setFrameShape(QFrame::HLine); - ui_audio_volume_divider->setFrameShadow(QFrame::Sunken); + ui_audio_layout->setWidget(4, QFormLayout::LabelRole, ui_blips_volume_lbl); - ui_audio_layout->setWidget(1, QFormLayout::FieldRole, ui_audio_volume_divider); + ui_blips_volume_spinbox = new QSpinBox(ui_audio_widget); + ui_blips_volume_spinbox->setValue(p_ao_app->get_default_blip()); + ui_blips_volume_spinbox->setMaximum(100); + ui_blips_volume_spinbox->setSuffix("%"); - ui_music_volume_lbl = new QLabel(ui_audio_widget); - ui_music_volume_lbl->setText(tr("Music:")); - ui_music_volume_lbl->setToolTip(tr("Sets the music's default volume.")); + ui_audio_layout->setWidget(4, QFormLayout::FieldRole, + ui_blips_volume_spinbox); - ui_audio_layout->setWidget(2, QFormLayout::LabelRole, ui_music_volume_lbl); + ui_volume_blip_divider = new QFrame(ui_audio_widget); + ui_volume_blip_divider->setFrameShape(QFrame::HLine); + ui_volume_blip_divider->setFrameShadow(QFrame::Sunken); - ui_music_volume_spinbox = new QSpinBox(ui_audio_widget); - ui_music_volume_spinbox->setValue(p_ao_app->get_default_music()); - ui_music_volume_spinbox->setMaximum(100); - ui_music_volume_spinbox->setSuffix("%"); + ui_audio_layout->setWidget(5, QFormLayout::FieldRole, ui_volume_blip_divider); - ui_audio_layout->setWidget(2, QFormLayout::FieldRole, ui_music_volume_spinbox); + ui_bliprate_lbl = new QLabel(ui_audio_widget); + ui_bliprate_lbl->setText(tr("Blip rate:")); + ui_bliprate_lbl->setToolTip( + tr("Sets the delay between playing the blip sounds.")); - ui_sfx_volume_lbl = new QLabel(ui_audio_widget); - ui_sfx_volume_lbl->setText(tr("SFX:")); - ui_sfx_volume_lbl->setToolTip(tr("Sets the SFX's default volume. " - "Interjections and actual sound effects count as 'SFX'.")); + ui_audio_layout->setWidget(6, QFormLayout::LabelRole, ui_bliprate_lbl); - ui_audio_layout->setWidget(3, QFormLayout::LabelRole, ui_sfx_volume_lbl); + ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); + ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate()); + ui_bliprate_spinbox->setMinimum(1); - ui_sfx_volume_spinbox = new QSpinBox(ui_audio_widget); - ui_sfx_volume_spinbox->setValue(p_ao_app->get_default_sfx()); - ui_sfx_volume_spinbox->setMaximum(100); - ui_sfx_volume_spinbox->setSuffix("%"); + ui_audio_layout->setWidget(6, QFormLayout::FieldRole, ui_bliprate_spinbox); - ui_audio_layout->setWidget(3, QFormLayout::FieldRole, ui_sfx_volume_spinbox); + ui_blank_blips_lbl = new QLabel(ui_audio_widget); + ui_blank_blips_lbl->setText(tr("Blank blips:")); + ui_blank_blips_lbl->setToolTip( + tr("If true, the game will play a blip sound even " + "when a space is 'being said'.")); - ui_blips_volume_lbl = new QLabel(ui_audio_widget); - ui_blips_volume_lbl->setText(tr("Blips:")); - ui_blips_volume_lbl->setToolTip(tr("Sets the volume of the blips, the talking sound effects.")); + ui_audio_layout->setWidget(7, QFormLayout::LabelRole, ui_blank_blips_lbl); - ui_audio_layout->setWidget(4, QFormLayout::LabelRole, ui_blips_volume_lbl); + ui_blank_blips_cb = new QCheckBox(ui_audio_widget); + ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip()); - ui_blips_volume_spinbox = new QSpinBox(ui_audio_widget); - ui_blips_volume_spinbox->setValue(p_ao_app->get_default_blip()); - ui_blips_volume_spinbox->setMaximum(100); - ui_blips_volume_spinbox->setSuffix("%"); - - ui_audio_layout->setWidget(4, QFormLayout::FieldRole, ui_blips_volume_spinbox); - - ui_volume_blip_divider = new QFrame(ui_audio_widget); - ui_volume_blip_divider->setFrameShape(QFrame::HLine); - ui_volume_blip_divider->setFrameShadow(QFrame::Sunken); - - ui_audio_layout->setWidget(5, QFormLayout::FieldRole, ui_volume_blip_divider); - - ui_bliprate_lbl = new QLabel(ui_audio_widget); - ui_bliprate_lbl->setText(tr("Blip rate:")); - ui_bliprate_lbl->setToolTip(tr("Sets the delay between playing the blip sounds.")); - - ui_audio_layout->setWidget(6, QFormLayout::LabelRole, ui_bliprate_lbl); - - ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); - ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate()); - ui_bliprate_spinbox->setMinimum(1); - - ui_audio_layout->setWidget(6, QFormLayout::FieldRole, ui_bliprate_spinbox); - - ui_blank_blips_lbl = new QLabel(ui_audio_widget); - ui_blank_blips_lbl->setText(tr("Blank blips:")); - ui_blank_blips_lbl->setToolTip(tr("If true, the game will play a blip sound even " - "when a space is 'being said'.")); - - ui_audio_layout->setWidget(7, QFormLayout::LabelRole, ui_blank_blips_lbl); - - ui_blank_blips_cb = new QCheckBox(ui_audio_widget); - ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip()); - - ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb); - #endif + ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb); +#endif - // The casing tab! - ui_casing_tab = new QWidget(); - ui_settings_tabs->addTab(ui_casing_tab, tr("Casing")); + // The casing tab! + ui_casing_tab = new QWidget(); + ui_settings_tabs->addTab(ui_casing_tab, tr("Casing")); - ui_casing_widget = new QWidget(ui_casing_tab); - ui_casing_widget->setGeometry(QRect(10,10, 361, 211)); + ui_casing_widget = new QWidget(ui_casing_tab); + ui_casing_widget->setGeometry(QRect(10, 10, 361, 211)); - ui_casing_layout = new QFormLayout(ui_casing_widget); - ui_casing_layout->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); - ui_casing_layout->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); - ui_casing_layout->setContentsMargins(0, 0, 0, 0); + ui_casing_layout = new QFormLayout(ui_casing_widget); + ui_casing_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignVCenter); + ui_casing_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignTop); + ui_casing_layout->setContentsMargins(0, 0, 0, 0); - // -- SERVER SUPPORTS CASING + // -- SERVER SUPPORTS CASING - ui_casing_supported_lbl = new QLabel(ui_casing_widget); - if (ao_app->casing_alerts_enabled) - ui_casing_supported_lbl->setText(tr("This server supports case alerts.")); - else - ui_casing_supported_lbl->setText(tr("This server does not support case alerts.")); - ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory.")); + ui_casing_supported_lbl = new QLabel(ui_casing_widget); + if (ao_app->casing_alerts_enabled) + ui_casing_supported_lbl->setText(tr("This server supports case alerts.")); + else + ui_casing_supported_lbl->setText( + tr("This server does not support case alerts.")); + ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory.")); - ui_casing_layout->setWidget(0, QFormLayout::FieldRole, ui_casing_supported_lbl); + ui_casing_layout->setWidget(0, QFormLayout::FieldRole, + ui_casing_supported_lbl); - // -- CASE ANNOUNCEMENTS + // -- CASE ANNOUNCEMENTS - ui_casing_enabled_lbl = new QLabel(ui_casing_widget); - ui_casing_enabled_lbl->setText(tr("Casing:")); - ui_casing_enabled_lbl->setToolTip(tr("If checked, you will get alerts about case " - "announcements.")); + ui_casing_enabled_lbl = new QLabel(ui_casing_widget); + ui_casing_enabled_lbl->setText(tr("Casing:")); + ui_casing_enabled_lbl->setToolTip( + tr("If checked, you will get alerts about case " + "announcements.")); - ui_casing_layout->setWidget(1, QFormLayout::LabelRole, ui_casing_enabled_lbl); + ui_casing_layout->setWidget(1, QFormLayout::LabelRole, ui_casing_enabled_lbl); - ui_casing_enabled_cb = new QCheckBox(ui_casing_widget); - ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled()); + ui_casing_enabled_cb = new QCheckBox(ui_casing_widget); + ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled()); - ui_casing_layout->setWidget(1, QFormLayout::FieldRole, ui_casing_enabled_cb); + ui_casing_layout->setWidget(1, QFormLayout::FieldRole, ui_casing_enabled_cb); - // -- DEFENSE ANNOUNCEMENTS + // -- DEFENSE ANNOUNCEMENTS - ui_casing_def_lbl = new QLabel(ui_casing_widget); - ui_casing_def_lbl->setText(tr("Defense:")); - ui_casing_def_lbl->setToolTip(tr("If checked, you will get alerts about case " - "announcements if a defense spot is open.")); + ui_casing_def_lbl = new QLabel(ui_casing_widget); + ui_casing_def_lbl->setText(tr("Defense:")); + ui_casing_def_lbl->setToolTip(tr("If checked, you will get alerts about case " + "announcements if a defense spot is open.")); - ui_casing_layout->setWidget(2, QFormLayout::LabelRole, ui_casing_def_lbl); + ui_casing_layout->setWidget(2, QFormLayout::LabelRole, ui_casing_def_lbl); - ui_casing_def_cb = new QCheckBox(ui_casing_widget); - ui_casing_def_cb->setChecked(ao_app->get_casing_defence_enabled()); + ui_casing_def_cb = new QCheckBox(ui_casing_widget); + ui_casing_def_cb->setChecked(ao_app->get_casing_defence_enabled()); - ui_casing_layout->setWidget(2, QFormLayout::FieldRole, ui_casing_def_cb); + ui_casing_layout->setWidget(2, QFormLayout::FieldRole, ui_casing_def_cb); - // -- PROSECUTOR ANNOUNCEMENTS + // -- PROSECUTOR ANNOUNCEMENTS - ui_casing_pro_lbl = new QLabel(ui_casing_widget); - ui_casing_pro_lbl->setText(tr("Prosecution:")); - ui_casing_pro_lbl->setToolTip(tr("If checked, you will get alerts about case " - "announcements if a prosecutor spot is open.")); + ui_casing_pro_lbl = new QLabel(ui_casing_widget); + ui_casing_pro_lbl->setText(tr("Prosecution:")); + ui_casing_pro_lbl->setToolTip( + tr("If checked, you will get alerts about case " + "announcements if a prosecutor spot is open.")); - ui_casing_layout->setWidget(3, QFormLayout::LabelRole, ui_casing_pro_lbl); + ui_casing_layout->setWidget(3, QFormLayout::LabelRole, ui_casing_pro_lbl); - ui_casing_pro_cb = new QCheckBox(ui_casing_widget); - ui_casing_pro_cb->setChecked(ao_app->get_casing_prosecution_enabled()); + ui_casing_pro_cb = new QCheckBox(ui_casing_widget); + ui_casing_pro_cb->setChecked(ao_app->get_casing_prosecution_enabled()); - ui_casing_layout->setWidget(3, QFormLayout::FieldRole, ui_casing_pro_cb); + ui_casing_layout->setWidget(3, QFormLayout::FieldRole, ui_casing_pro_cb); - // -- JUDGE ANNOUNCEMENTS + // -- JUDGE ANNOUNCEMENTS - ui_casing_jud_lbl = new QLabel(ui_casing_widget); - ui_casing_jud_lbl->setText(tr("Judge:")); - ui_casing_jud_lbl->setToolTip(tr("If checked, you will get alerts about case " - "announcements if the judge spot is open.")); + ui_casing_jud_lbl = new QLabel(ui_casing_widget); + ui_casing_jud_lbl->setText(tr("Judge:")); + ui_casing_jud_lbl->setToolTip(tr("If checked, you will get alerts about case " + "announcements if the judge spot is open.")); - ui_casing_layout->setWidget(4, QFormLayout::LabelRole, ui_casing_jud_lbl); + ui_casing_layout->setWidget(4, QFormLayout::LabelRole, ui_casing_jud_lbl); - ui_casing_jud_cb = new QCheckBox(ui_casing_widget); - ui_casing_jud_cb->setChecked(ao_app->get_casing_judge_enabled()); + ui_casing_jud_cb = new QCheckBox(ui_casing_widget); + ui_casing_jud_cb->setChecked(ao_app->get_casing_judge_enabled()); - ui_casing_layout->setWidget(4, QFormLayout::FieldRole, ui_casing_jud_cb); + ui_casing_layout->setWidget(4, QFormLayout::FieldRole, ui_casing_jud_cb); - // -- JUROR ANNOUNCEMENTS + // -- JUROR ANNOUNCEMENTS - ui_casing_jur_lbl = new QLabel(ui_casing_widget); - ui_casing_jur_lbl->setText(tr("Juror:")); - ui_casing_jur_lbl->setToolTip(tr("If checked, you will get alerts about case " - "announcements if a juror spot is open.")); + ui_casing_jur_lbl = new QLabel(ui_casing_widget); + ui_casing_jur_lbl->setText(tr("Juror:")); + ui_casing_jur_lbl->setToolTip(tr("If checked, you will get alerts about case " + "announcements if a juror spot is open.")); - ui_casing_layout->setWidget(5, QFormLayout::LabelRole, ui_casing_jur_lbl); + ui_casing_layout->setWidget(5, QFormLayout::LabelRole, ui_casing_jur_lbl); - ui_casing_jur_cb = new QCheckBox(ui_casing_widget); - ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled()); + ui_casing_jur_cb = new QCheckBox(ui_casing_widget); + ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled()); - ui_casing_layout->setWidget(5, QFormLayout::FieldRole, ui_casing_jur_cb); + ui_casing_layout->setWidget(5, QFormLayout::FieldRole, ui_casing_jur_cb); - // -- STENO ANNOUNCEMENTS + // -- STENO ANNOUNCEMENTS - ui_casing_steno_lbl = new QLabel(ui_casing_widget); - ui_casing_steno_lbl->setText(tr("Stenographer:")); - ui_casing_steno_lbl->setToolTip(tr("If checked, you will get alerts about case " - "announcements if a stenographer spot is open.")); + ui_casing_steno_lbl = new QLabel(ui_casing_widget); + ui_casing_steno_lbl->setText(tr("Stenographer:")); + ui_casing_steno_lbl->setToolTip( + tr("If checked, you will get alerts about case " + "announcements if a stenographer spot is open.")); - ui_casing_layout->setWidget(6, QFormLayout::LabelRole, ui_casing_steno_lbl); + ui_casing_layout->setWidget(6, QFormLayout::LabelRole, ui_casing_steno_lbl); - ui_casing_steno_cb = new QCheckBox(ui_casing_widget); - ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled()); + ui_casing_steno_cb = new QCheckBox(ui_casing_widget); + ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled()); - ui_casing_layout->setWidget(6, QFormLayout::FieldRole, ui_casing_steno_cb); + ui_casing_layout->setWidget(6, QFormLayout::FieldRole, ui_casing_steno_cb); - // -- CM ANNOUNCEMENTS + // -- CM ANNOUNCEMENTS - ui_casing_cm_lbl = new QLabel(ui_casing_widget); - ui_casing_cm_lbl->setText(tr("CM:")); - ui_casing_cm_lbl->setToolTip(tr("If checked, you will appear amongst the potential " - "CMs on the server.")); + ui_casing_cm_lbl = new QLabel(ui_casing_widget); + ui_casing_cm_lbl->setText(tr("CM:")); + ui_casing_cm_lbl->setToolTip( + tr("If checked, you will appear amongst the potential " + "CMs on the server.")); - ui_casing_layout->setWidget(7, QFormLayout::LabelRole, ui_casing_cm_lbl); + ui_casing_layout->setWidget(7, QFormLayout::LabelRole, ui_casing_cm_lbl); - ui_casing_cm_cb = new QCheckBox(ui_casing_widget); - ui_casing_cm_cb->setChecked(ao_app->get_casing_cm_enabled()); + ui_casing_cm_cb = new QCheckBox(ui_casing_widget); + ui_casing_cm_cb->setChecked(ao_app->get_casing_cm_enabled()); - ui_casing_layout->setWidget(7, QFormLayout::FieldRole, ui_casing_cm_cb); + ui_casing_layout->setWidget(7, QFormLayout::FieldRole, ui_casing_cm_cb); - // -- CM CASES ANNOUNCEMENTS + // -- CM CASES ANNOUNCEMENTS - ui_casing_cm_cases_lbl = new QLabel(ui_casing_widget); - ui_casing_cm_cases_lbl->setText(tr("Hosting cases:")); - ui_casing_cm_cases_lbl->setToolTip(tr("If you're a CM, enter what cases you are " - "willing to host.")); + ui_casing_cm_cases_lbl = new QLabel(ui_casing_widget); + ui_casing_cm_cases_lbl->setText(tr("Hosting cases:")); + ui_casing_cm_cases_lbl->setToolTip( + tr("If you're a CM, enter what cases you are " + "willing to host.")); - ui_casing_layout->setWidget(8, QFormLayout::LabelRole, ui_casing_cm_cases_lbl); + ui_casing_layout->setWidget(8, QFormLayout::LabelRole, + ui_casing_cm_cases_lbl); - ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget); - ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases()); + ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget); + ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases()); - ui_casing_layout->setWidget(8, QFormLayout::FieldRole, ui_casing_cm_cases_textbox); + ui_casing_layout->setWidget(8, QFormLayout::FieldRole, + ui_casing_cm_cases_textbox); - // When we're done, we should continue the updates! - setUpdatesEnabled(true); + // When we're done, we should continue the updates! + setUpdatesEnabled(true); } void AOOptionsDialog::save_pressed() { - // Save everything into the config.ini. - QSettings* configini = ao_app->configini; - - configini->setValue("theme", ui_theme_combobox->currentText()); - configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked()); - configini->setValue("log_maximum", ui_length_spinbox->value()); - configini->setValue("default_username", ui_username_textbox->text()); - configini->setValue("show_custom_shownames", ui_showname_cb->isChecked()); - configini->setValue("master", ui_ms_textbox->text()); - configini->setValue("discord", ui_discord_cb->isChecked()); - - QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); - - if (!callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) - { - // Nevermind! - } - else - { - QTextStream out(callwordsini); - out << ui_callwords_textbox->toPlainText(); - callwordsini->close(); - } - - configini->setValue("default_audio_device", ui_audio_device_combobox->currentText()); - configini->setValue("default_music", ui_music_volume_spinbox->value()); - configini->setValue("default_sfx", ui_sfx_volume_spinbox->value()); - configini->setValue("default_blip", ui_blips_volume_spinbox->value()); - configini->setValue("blip_rate", ui_bliprate_spinbox->value()); - configini->setValue("blank_blip", ui_blank_blips_cb->isChecked()); - - configini->setValue("casing_enabled", ui_casing_enabled_cb->isChecked()); - configini->setValue("casing_defence_enabled", ui_casing_def_cb->isChecked()); - configini->setValue("casing_prosecution_enabled", ui_casing_pro_cb->isChecked()); - configini->setValue("casing_judge_enabled", ui_casing_jud_cb->isChecked()); - configini->setValue("casing_juror_enabled", ui_casing_jur_cb->isChecked()); - configini->setValue("casing_steno_enabled", ui_casing_steno_cb->isChecked()); - configini->setValue("casing_cm_enabled", ui_casing_cm_cb->isChecked()); - configini->setValue("casing_can_host_cases", ui_casing_cm_cases_textbox->text()); - + // Save everything into the config.ini. + QSettings *configini = ao_app->configini; + + configini->setValue("theme", ui_theme_combobox->currentText()); + configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked()); + configini->setValue("log_maximum", ui_length_spinbox->value()); + configini->setValue("default_username", ui_username_textbox->text()); + configini->setValue("show_custom_shownames", ui_showname_cb->isChecked()); + configini->setValue("master", ui_ms_textbox->text()); + configini->setValue("discord", ui_discord_cb->isChecked()); + + QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); + + if (!callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | + QIODevice::Text)) { + // Nevermind! + } + else { + QTextStream out(callwordsini); + out << ui_callwords_textbox->toPlainText(); callwordsini->close(); - done(0); + } + + configini->setValue("default_audio_device", + ui_audio_device_combobox->currentText()); + configini->setValue("default_music", ui_music_volume_spinbox->value()); + configini->setValue("default_sfx", ui_sfx_volume_spinbox->value()); + configini->setValue("default_blip", ui_blips_volume_spinbox->value()); + configini->setValue("blip_rate", ui_bliprate_spinbox->value()); + configini->setValue("blank_blip", ui_blank_blips_cb->isChecked()); + + configini->setValue("casing_enabled", ui_casing_enabled_cb->isChecked()); + configini->setValue("casing_defence_enabled", ui_casing_def_cb->isChecked()); + configini->setValue("casing_prosecution_enabled", + ui_casing_pro_cb->isChecked()); + configini->setValue("casing_judge_enabled", ui_casing_jud_cb->isChecked()); + configini->setValue("casing_juror_enabled", ui_casing_jur_cb->isChecked()); + configini->setValue("casing_steno_enabled", ui_casing_steno_cb->isChecked()); + configini->setValue("casing_cm_enabled", ui_casing_cm_cb->isChecked()); + configini->setValue("casing_can_host_cases", + ui_casing_cm_cases_textbox->text()); + + callwordsini->close(); + done(0); } -void AOOptionsDialog::discard_pressed() -{ - done(0); -} +void AOOptionsDialog::discard_pressed() { done(0); } -#if (defined (_WIN32) || defined (_WIN64)) -bool AOOptionsDialog::needs_default_audiodev() -{ - return true; -} -#elif (defined (LINUX) || defined (__linux__)) -bool AOOptionsDialog::needs_default_audiodev() -{ - return false; -} +#if (defined(_WIN32) || defined(_WIN64)) +bool AOOptionsDialog::needs_default_audiodev() { return true; } +#elif (defined(LINUX) || defined(__linux__)) +bool AOOptionsDialog::needs_default_audiodev() { return false; } #elif defined __APPLE__ -bool AOOptionsDialog::needs_default_audiodev() -{ - return true; -} +bool AOOptionsDialog::needs_default_audiodev() { return true; } #else #error This operating system is not supported. #endif diff --git a/src/aopacket.cpp b/src/aopacket.cpp index b957efea..6afd39e7 100644 --- a/src/aopacket.cpp +++ b/src/aopacket.cpp @@ -8,8 +8,7 @@ AOPacket::AOPacket(QString p_packet_string) m_header = packet_contents.at(0); - for(int n_string = 1 ; n_string < packet_contents.size() - 1 ; ++n_string) - { + for (int n_string = 1; n_string < packet_contents.size() - 1; ++n_string) { m_contents.append(packet_contents.at(n_string)); } } @@ -20,23 +19,18 @@ AOPacket::AOPacket(QString p_header, QStringList &p_contents) m_contents = p_contents; } -AOPacket::~AOPacket() -{ - -} +AOPacket::~AOPacket() {} QString AOPacket::to_string() { QString f_string = m_header; - for (QString i_string : m_contents) - { + for (QString i_string : m_contents) { f_string += ("#" + i_string); } f_string += "#%"; - if (encrypted) return "#" + f_string; else @@ -59,10 +53,12 @@ void AOPacket::decrypt_header(unsigned int p_key) void AOPacket::net_encode() { - for (int n_element = 0 ; n_element < m_contents.size() ; ++n_element) - { + for (int n_element = 0; n_element < m_contents.size(); ++n_element) { QString f_element = m_contents.at(n_element); - f_element.replace("#", "").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/aoscene.cpp b/src/aoscene.cpp index 344522b6..aad6c103 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -12,7 +12,8 @@ AOScene::AOScene(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) void AOScene::set_image(QString p_image) { QString background_path = ao_app->get_background_path(p_image + ".png"); - QString animated_background_path = ao_app->get_background_path(p_image + ".gif"); + QString animated_background_path = + ao_app->get_background_path(p_image + ".gif"); QString default_path = ao_app->get_default_background_path(p_image + ".png"); QPixmap background(background_path); @@ -28,25 +29,22 @@ void AOScene::set_image(QString p_image) m_movie->setFileName(animated_background_path); m_movie->setScaledSize(QSize(w, h)); - if (m_movie->isValid()) - { + if (m_movie->isValid()) { this->setMovie(m_movie); m_movie->start(); } - else if (file_exists(background_path)) - { + else if (file_exists(background_path)) { this->setPixmap(background.scaled(w, h)); } - else - { + else { this->setPixmap(default_bg.scaled(w, h)); } } void AOScene::set_legacy_desk(QString p_image) { - //vanilla desks vary in both width and height. in order to make that work with viewport rescaling, - //some INTENSE math is needed. + // vanilla desks vary in both width and height. in order to make that work + // with viewport rescaling, some INTENSE math is needed. QString desk_path = ao_app->get_background_path(p_image); QString default_path = ao_app->get_default_background_path(p_image); @@ -61,16 +59,16 @@ void AOScene::set_legacy_desk(QString p_image) int vp_width = m_parent->width(); int vp_height = m_parent->height(); - //double y_modifier = 147 / 192; - //double w_modifier = vp_width / 256; + // double y_modifier = 147 / 192; + // double w_modifier = vp_width / 256; double h_modifier = vp_height / 192; - //int final_y = y_modifier * vp_height; - //int final_w = w_modifier * f_desk.width(); + // int final_y = y_modifier * vp_height; + // int final_w = w_modifier * f_desk.width(); int final_h = static_cast(h_modifier * f_desk.height()); - //this->resize(final_w, final_h); - //this->setPixmap(f_desk.scaled(final_w, final_h)); + // this->resize(final_w, final_h); + // this->setPixmap(f_desk.scaled(final_w, final_h)); this->resize(vp_width, final_h); this->setPixmap(f_desk.scaled(vp_width, final_h)); } diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index 710d7a8a..543da5ca 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -1,7 +1,7 @@ #include "aosfxplayer.h" #include "file_functions.h" -#if defined(BASSAUDIO) //Using bass.dll for sfx +#if defined(BASSAUDIO) // Using bass.dll for sfx AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; @@ -11,7 +11,7 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) { BASS_ChannelStop(m_stream); - + QString misc_path = ""; QString char_path = ""; QString sound_path = ao_app->get_sounds_path(p_sfx); @@ -24,13 +24,15 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) QString f_path; if (file_exists(char_path)) - f_path = char_path; + f_path = char_path; else if (file_exists(misc_path)) f_path = misc_path; else f_path = sound_path; - m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, + BASS_STREAM_AUTOFREE | BASS_UNICODE | + BASS_ASYNCFILE); set_volume(m_volume); @@ -39,10 +41,7 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) BASS_ChannelPlay(m_stream, false); } -void AOSfxPlayer::stop() -{ - BASS_ChannelStop(m_stream); -} +void AOSfxPlayer::stop() { BASS_ChannelStop(m_stream); } void AOSfxPlayer::set_volume(int p_value) { @@ -50,7 +49,7 @@ void AOSfxPlayer::set_volume(int p_value) float volume = p_value / 100.0f; BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume); } -#elif defined(QTAUDIO) //Using Qt's QSoundEffect class +#elif defined(QTAUDIO) // Using Qt's QSoundEffect class AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; @@ -73,26 +72,23 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) QString f_path; if (file_exists(char_path)) - f_path = char_path; + f_path = char_path; else if (file_exists(misc_path)) f_path = misc_path; else f_path = sound_path; - if (file_exists(f_path)) //if its missing, it will glitch out + if (file_exists(f_path)) // if its missing, it will glitch out { - m_sfx.setSource(QUrl::fromLocalFile(f_path)); + m_sfx.setSource(QUrl::fromLocalFile(f_path)); - set_volume(m_volume); + set_volume(m_volume); - m_sfx.play(); + m_sfx.play(); } } -void AOSfxPlayer::stop() -{ - m_sfx.stop(); -} +void AOSfxPlayer::stop() { m_sfx.stop(); } void AOSfxPlayer::set_volume(int p_value) { @@ -106,18 +102,9 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) ao_app = p_ao_app; } -void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) -{ +void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) {} -} - -void AOSfxPlayer::stop() -{ - -} +void AOSfxPlayer::stop() {} -void AOSfxPlayer::set_volume(int p_value) -{ - -} +void AOSfxPlayer::set_volume(int p_value) {} #endif diff --git a/src/aotextarea.cpp b/src/aotextarea.cpp index 5e146326..ebc75e28 100644 --- a/src/aotextarea.cpp +++ b/src/aotextarea.cpp @@ -1,24 +1,26 @@ #include "aotextarea.h" -AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) -{ - -} +AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) {} -void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p_colour) +void AOTextArea::append_chatmessage(QString p_name, QString p_message, + QString p_colour) { const QTextCursor old_cursor = this->textCursor(); const int old_scrollbar_value = this->verticalScrollBar()->value(); - const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum(); + const bool is_scrolled_down = + old_scrollbar_value == this->verticalScrollBar()->maximum(); this->moveCursor(QTextCursor::End); this->append(""); - this->insertHtml("" + p_name.toHtmlEscaped() + ": "); + 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); @@ -29,32 +31,35 @@ void AOTextArea::append_error(QString p_message) { const QTextCursor old_cursor = this->textCursor(); const int old_scrollbar_value = this->verticalScrollBar()->value(); - const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum(); + const bool is_scrolled_down = + old_scrollbar_value == this->verticalScrollBar()->maximum(); this->moveCursor(QTextCursor::End); this->append(""); p_message += " "; - QString result = p_message.replace("\n", "
").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 30e48b73..22d9a62e 100644 --- a/src/aotextedit.cpp +++ b/src/aotextedit.cpp @@ -4,7 +4,7 @@ AOTextEdit::AOTextEdit(QWidget *parent) : QPlainTextEdit(parent) { this->setReadOnly(true); - //connect(this, SIGNAL(returnPressed()), this, SLOT(on_enter_pressed())); + // connect(this, SIGNAL(returnPressed()), this, SLOT(on_enter_pressed())); } void AOTextEdit::mouseDoubleClickEvent(QMouseEvent *e) @@ -14,8 +14,4 @@ void AOTextEdit::mouseDoubleClickEvent(QMouseEvent *e) this->setReadOnly(false); } -void AOTextEdit::on_enter_pressed() -{ - this->setReadOnly(true); -} - +void AOTextEdit::on_enter_pressed() { this->setReadOnly(true); } diff --git a/src/charselect.cpp b/src/charselect.cpp index 4987cf57..c207d572 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -1,8 +1,8 @@ #include "courtroom.h" #include "lobby.h" -#include "file_functions.h" #include "debug_functions.h" +#include "file_functions.h" #include "hardware_functions.h" void Courtroom::construct_char_select() @@ -44,27 +44,34 @@ void Courtroom::construct_char_select() set_size_and_pos(ui_char_buttons, "char_buttons"); - connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked())); + connect(ui_back_to_lobby, SIGNAL(clicked()), this, + SLOT(on_back_to_lobby_clicked())); - connect(ui_char_select_left, SIGNAL(clicked()), this, SLOT(on_char_select_left_clicked())); - connect(ui_char_select_right, SIGNAL(clicked()), this, SLOT(on_char_select_right_clicked())); + connect(ui_char_select_left, SIGNAL(clicked()), this, + SLOT(on_char_select_left_clicked())); + connect(ui_char_select_right, SIGNAL(clicked()), this, + SLOT(on_char_select_right_clicked())); connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked())); - connect(ui_char_search, SIGNAL(textEdited(const QString&)), this, SLOT(on_char_search_changed())); - connect(ui_char_passworded, SIGNAL(stateChanged(int)), this, SLOT(on_char_passworded_clicked())); - connect(ui_char_taken, SIGNAL(stateChanged(int)), this, SLOT(on_char_taken_clicked())); + connect(ui_char_search, SIGNAL(textEdited(const QString &)), this, + SLOT(on_char_search_changed())); + connect(ui_char_passworded, SIGNAL(stateChanged(int)), this, + SLOT(on_char_passworded_clicked())); + connect(ui_char_taken, SIGNAL(stateChanged(int)), this, + SLOT(on_char_taken_clicked())); } void Courtroom::set_char_select() { QString filename = "courtroom_design.ini"; - pos_size_type f_charselect = ao_app->get_element_dimensions("char_select", filename); + pos_size_type f_charselect = + ao_app->get_element_dimensions("char_select", filename); - if (f_charselect.width < 0 || f_charselect.height < 0) - { - qDebug() << "W: did not find courtroom width or height in courtroom_design.ini!"; + if (f_charselect.width < 0 || f_charselect.height < 0) { + qDebug() + << "W: did not find courtroom width or height in courtroom_design.ini!"; this->resize(714, 668); } else @@ -85,25 +92,22 @@ void Courtroom::set_char_select_page() ui_char_select_left->hide(); ui_char_select_right->hide(); - for (AOCharButton *i_button : ui_char_button_list) - { + for (AOCharButton *i_button : ui_char_button_list) { i_button->reset(); i_button->hide(); - i_button->move(0,0); + i_button->move(0, 0); } int total_pages = ui_char_button_list_filtered.size() / max_chars_on_page; int chars_on_page = 0; - if (ui_char_button_list_filtered.size() % max_chars_on_page != 0) - { + if (ui_char_button_list_filtered.size() % max_chars_on_page != 0) { ++total_pages; - //i. e. not on the last page + // i. e. not on the last page if (total_pages > current_char_page + 1) chars_on_page = max_chars_on_page; else chars_on_page = ui_char_button_list_filtered.size() % max_chars_on_page; - } else chars_on_page = max_chars_on_page; @@ -119,23 +123,23 @@ void Courtroom::set_char_select_page() void Courtroom::char_clicked(int n_char) { - QString char_ini_path = ao_app->get_character_path(char_list.at(n_char).name, "char.ini"); + QString char_ini_path = + ao_app->get_character_path(char_list.at(n_char).name, "char.ini"); qDebug() << "char_ini_path" << char_ini_path; - if (!file_exists(char_ini_path)) - { + if (!file_exists(char_ini_path)) { call_notice("Could not find " + char_ini_path); return; } - if (n_char == m_cid) - { + if (n_char == m_cid) { enter_courtroom(m_cid); } - else - { - ao_app->send_server_packet(new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" + QString::number(n_char) + "#" + get_hdid() + "#%")); + else { + ao_app->send_server_packet( + new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" + + QString::number(n_char) + "#" + get_hdid() + "#%")); } ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); @@ -143,126 +147,125 @@ void Courtroom::char_clicked(int n_char) void Courtroom::put_button_in_place(int starting, int chars_on_this_page) { - if (ui_char_button_list_filtered.size() == 0) - return; + if (ui_char_button_list_filtered.size() == 0) + return; - QPoint f_spacing = ao_app->get_button_spacing("char_button_spacing", "courtroom_design.ini"); + QPoint f_spacing = + ao_app->get_button_spacing("char_button_spacing", "courtroom_design.ini"); - int x_spacing = f_spacing.x(); - int x_mod_count = 0; + int x_spacing = f_spacing.x(); + int x_mod_count = 0; - int y_spacing = f_spacing.y(); - int y_mod_count = 0; + int y_spacing = f_spacing.y(); + int y_mod_count = 0; - char_columns = ((ui_char_buttons->width() - button_width) / (x_spacing + button_width)) + 1; - char_rows = ((ui_char_buttons->height() - button_height) / (y_spacing + button_height)) + 1; + char_columns = + ((ui_char_buttons->width() - button_width) / (x_spacing + button_width)) + + 1; + char_rows = ((ui_char_buttons->height() - button_height) / + (y_spacing + button_height)) + + 1; - max_chars_on_page = char_columns * char_rows; + max_chars_on_page = char_columns * char_rows; - int startout = starting; - for (int n = starting ; n < startout+chars_on_this_page ; ++n) - { - int x_pos = (button_width + x_spacing) * x_mod_count; - int y_pos = (button_height + y_spacing) * y_mod_count; + int startout = starting; + for (int n = starting; n < startout + chars_on_this_page; ++n) { + int x_pos = (button_width + x_spacing) * x_mod_count; + int y_pos = (button_height + y_spacing) * y_mod_count; - ui_char_button_list_filtered.at(n)->move(x_pos, y_pos); - ui_char_button_list_filtered.at(n)->show(); - ui_char_button_list_filtered.at(n)->apply_taken_image(); + ui_char_button_list_filtered.at(n)->move(x_pos, y_pos); + ui_char_button_list_filtered.at(n)->show(); + ui_char_button_list_filtered.at(n)->apply_taken_image(); - ++x_mod_count; + ++x_mod_count; - if (x_mod_count == char_columns) - { - ++y_mod_count; - x_mod_count = 0; - } + if (x_mod_count == char_columns) { + ++y_mod_count; + x_mod_count = 0; } + } } void Courtroom::character_loading_finished() { - // Zeroeth, we'll clear any leftover characters from previous server visits. - ao_app->generated_chars = 0; - if (ui_char_button_list.size() > 0) - { - foreach (AOCharButton* item, ui_char_button_list) { - delete item; - } - ui_char_button_list.clear(); + // Zeroeth, we'll clear any leftover characters from previous server visits. + ao_app->generated_chars = 0; + if (ui_char_button_list.size() > 0) { + foreach (AOCharButton *item, ui_char_button_list) { + delete item; } + ui_char_button_list.clear(); + } - // First, we'll make all the character buttons in the very beginning. - // We also hide them all, so they can't be accidentally clicked. - // Later on, we'll be revealing buttons as we need them. - for (int n = 0; n < char_list.size(); n++) - { - AOCharButton* char_button = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); - char_button->reset(); - char_button->hide(); - char_button->set_image(char_list.at(n).name); - ui_char_button_list.append(char_button); - - connect(char_button, &AOCharButton::clicked, [this, n](){ - this->char_clicked(n); - }); - - // This part here serves as a way of showing to the player that the game is still running, it is - // just loading the pictures of the characters. - if (ao_app->lobby_constructed) - { - ao_app->generated_chars++; - int total_loading_size = ao_app->char_list_size * 2 + ao_app->evidence_list_size + ao_app->music_list_size; - int loading_value = int(((ao_app->loaded_chars + ao_app->generated_chars + ao_app->loaded_music + ao_app->loaded_evidence) / static_cast(total_loading_size)) * 100); - ao_app->w_lobby->set_loading_value(loading_value); - ao_app->w_lobby->set_loading_text("Generating chars:\n" + QString::number(ao_app->generated_chars) + "/" + QString::number(ao_app->char_list_size)); - } + // First, we'll make all the character buttons in the very beginning. + // We also hide them all, so they can't be accidentally clicked. + // Later on, we'll be revealing buttons as we need them. + for (int n = 0; n < char_list.size(); n++) { + AOCharButton *char_button = + new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); + char_button->reset(); + char_button->hide(); + char_button->set_image(char_list.at(n).name); + ui_char_button_list.append(char_button); + + connect(char_button, &AOCharButton::clicked, + [this, n]() { this->char_clicked(n); }); + + // This part here serves as a way of showing to the player that the game is + // still running, it is just loading the pictures of the characters. + if (ao_app->lobby_constructed) { + ao_app->generated_chars++; + int total_loading_size = ao_app->char_list_size * 2 + + ao_app->evidence_list_size + + ao_app->music_list_size; + int loading_value = + int(((ao_app->loaded_chars + ao_app->generated_chars + + ao_app->loaded_music + ao_app->loaded_evidence) / + static_cast(total_loading_size)) * + 100); + ao_app->w_lobby->set_loading_value(loading_value); + ao_app->w_lobby->set_loading_text( + "Generating chars:\n" + QString::number(ao_app->generated_chars) + + "/" + QString::number(ao_app->char_list_size)); } + } - filter_character_list(); + filter_character_list(); } void Courtroom::filter_character_list() { - ui_char_button_list_filtered.clear(); - for (int i = 0; i < char_list.size(); i++) - { - AOCharButton* current_char = ui_char_button_list.at(i); + ui_char_button_list_filtered.clear(); + for (int i = 0; i < char_list.size(); i++) { + AOCharButton *current_char = ui_char_button_list.at(i); - // It seems passwording characters is unimplemented yet? - // Until then, this will stay here, I suppose. - //if (ui_char_passworded->isChecked() && character_is_passworded??) - // continue; + // It seems passwording characters is unimplemented yet? + // Until then, this will stay here, I suppose. + // if (ui_char_passworded->isChecked() && character_is_passworded??) + // continue; - if (!ui_char_taken->isChecked() && char_list.at(i).taken) - continue; + if (!ui_char_taken->isChecked() && char_list.at(i).taken) + continue; - if (!char_list.at(i).name.contains(ui_char_search->text(), Qt::CaseInsensitive)) - continue; + if (!char_list.at(i).name.contains(ui_char_search->text(), + Qt::CaseInsensitive)) + continue; - // We only really need to update the fact that a character is taken - // for the buttons that actually appear. - // You'd also update the passwordedness and etc. here later. - current_char->reset(); - current_char->set_taken(char_list.at(i).taken); + // We only really need to update the fact that a character is taken + // for the buttons that actually appear. + // You'd also update the passwordedness and etc. here later. + current_char->reset(); + current_char->set_taken(char_list.at(i).taken); - ui_char_button_list_filtered.append(current_char); - } + ui_char_button_list_filtered.append(current_char); + } - current_char_page = 0; - set_char_select_page(); + current_char_page = 0; + set_char_select_page(); } -void Courtroom::on_char_search_changed() -{ - filter_character_list(); -} +void Courtroom::on_char_search_changed() { filter_character_list(); } -void Courtroom::on_char_passworded_clicked() -{ - filter_character_list(); -} +void Courtroom::on_char_passworded_clicked() { filter_character_list(); } -void Courtroom::on_char_taken_clicked() -{ - filter_character_list(); -} +void Courtroom::on_char_taken_clicked() { filter_character_list(); } diff --git a/src/chatlogpiece.cpp b/src/chatlogpiece.cpp index 6c861f01..be3be4a2 100644 --- a/src/chatlogpiece.cpp +++ b/src/chatlogpiece.cpp @@ -9,7 +9,8 @@ chatlogpiece::chatlogpiece() datetime = QDateTime::currentDateTime().toUTC(); } -chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song) +chatlogpiece::chatlogpiece(QString p_name, QString p_showname, + QString p_message, bool p_song) { name = p_name; showname = p_showname; @@ -18,7 +19,8 @@ chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message datetime = QDateTime::currentDateTime().toUTC(); } -chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime) +chatlogpiece::chatlogpiece(QString p_name, QString p_showname, + QString p_message, bool p_song, QDateTime p_datetime) { name = p_name; showname = p_showname; @@ -27,36 +29,17 @@ chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message datetime = p_datetime.toUTC(); } -QString chatlogpiece::get_name() -{ - return name; -} +QString chatlogpiece::get_name() { return name; } -QString chatlogpiece::get_showname() -{ - return showname; -} +QString chatlogpiece::get_showname() { return showname; } -QString chatlogpiece::get_message() -{ - return message; -} +QString chatlogpiece::get_message() { return message; } -QDateTime chatlogpiece::get_datetime() -{ - return datetime; -} - -bool chatlogpiece::get_is_song() -{ - return is_song; -} +QDateTime chatlogpiece::get_datetime() { return datetime; } -QString chatlogpiece::get_datetime_as_string() -{ - return datetime.toString(); -} +bool chatlogpiece::get_is_song() { return is_song; } +QString chatlogpiece::get_datetime_as_string() { return datetime.toString(); } QString chatlogpiece::get_full() { diff --git a/src/courtroom.cpp b/src/courtroom.cpp index cd01f64b..25b4826c 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3,32 +3,29 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() { ao_app = p_ao_app; - #ifdef BASSAUDIO +#ifdef BASSAUDIO // Change the default audio output device to be the one the user has given // in his config.ini file for now. unsigned int a = 0; BASS_DEVICEINFO info; - if (ao_app->get_audio_output_device() == "default") - { - BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); - load_bass_opus_plugin(); - } - else - { - for (a = 0; BASS_GetDeviceInfo(a, &info); a++) - { - if (ao_app->get_audio_output_device() == info.name) - { - BASS_SetDevice(a); - BASS_Init(static_cast(a), 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); - load_bass_opus_plugin(); - qDebug() << info.name << "was set as the default audio output device."; - break; - } + if (ao_app->get_audio_output_device() == "default") { + BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); + load_bass_opus_plugin(); + } + else { + for (a = 0; BASS_GetDeviceInfo(a, &info); a++) { + if (ao_app->get_audio_output_device() == info.name) { + BASS_SetDevice(a); + BASS_Init(static_cast(a), 48000, BASS_DEVICE_LATENCY, nullptr, + nullptr); + load_bass_opus_plugin(); + qDebug() << info.name << "was set as the default audio output device."; + break; } + } } - #endif +#endif keepalive_timer = new QTimer(this); keepalive_timer->start(60000); @@ -131,8 +128,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ooc_chat_name->setMaxLength(30); ui_ooc_chat_name->setText(p_ao_app->get_default_username()); - //ui_area_password = new QLineEdit(this); - //ui_area_password->setFrame(false); + // ui_area_password = new QLineEdit(this); + // ui_area_password->setFrame(false); ui_music_search = new QLineEdit(this); ui_music_search->setFrame(false); ui_music_search->setPlaceholderText(tr("Search")); @@ -154,7 +151,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_pos_dropdown->addItem("sea"); ui_defense_bar = new AOImage(this, ao_app); - ui_prosecution_bar = new AOImage(this, ao_app); + ui_prosecution_bar = new AOImage(this, ao_app); ui_music_label = new QLabel(this); ui_sfx_label = new QLabel(this); @@ -244,7 +241,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_pair_list = new QListWidget(this); ui_pair_offset_spinbox = new QSpinBox(this); - ui_pair_offset_spinbox->setRange(-100,100); + ui_pair_offset_spinbox->setRange(-100, 100); ui_pair_offset_spinbox->setSuffix("% offset"); ui_pair_button = new AOButton(this, ao_app); @@ -259,81 +256,117 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_vp_objection, SIGNAL(done()), this, SLOT(objection_done())); connect(ui_vp_player_char, SIGNAL(done()), this, SLOT(preanim_done())); - connect(text_delay_timer, SIGNAL(timeout()), this, SLOT(start_chat_ticking())); + connect(text_delay_timer, SIGNAL(timeout()), this, + SLOT(start_chat_ticking())); connect(sfx_delay_timer, SIGNAL(timeout()), this, SLOT(play_sfx())); connect(chat_tick_timer, SIGNAL(timeout()), this, SLOT(chat_tick())); connect(realization_timer, SIGNAL(timeout()), this, SLOT(realization_done())); - connect(testimony_show_timer, SIGNAL(timeout()), this, SLOT(hide_testimony())); - connect(testimony_hide_timer, SIGNAL(timeout()), this, SLOT(show_testimony())); + connect(testimony_show_timer, SIGNAL(timeout()), this, + SLOT(hide_testimony())); + connect(testimony_hide_timer, SIGNAL(timeout()), this, + SLOT(show_testimony())); - connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked())); - connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked())); + connect(ui_emote_left, SIGNAL(clicked()), this, + SLOT(on_emote_left_clicked())); + connect(ui_emote_right, SIGNAL(clicked()), this, + SLOT(on_emote_right_clicked())); - connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int))); - connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pos_dropdown_changed(int))); + connect(ui_emote_dropdown, SIGNAL(activated(int)), this, + SLOT(on_emote_dropdown_changed(int))); + connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, + SLOT(on_pos_dropdown_changed(int))); - connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); + connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, + SLOT(on_mute_list_clicked(QModelIndex))); - connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, SLOT(on_chat_return_pressed())); + connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, + SLOT(on_chat_return_pressed())); - connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, SLOT(on_ooc_return_pressed())); + connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, + SLOT(on_ooc_return_pressed())); - connect(ui_music_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_music_list_double_clicked(QModelIndex))); - connect(ui_area_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_area_list_double_clicked(QModelIndex))); + connect(ui_music_list, SIGNAL(doubleClicked(QModelIndex)), this, + SLOT(on_music_list_double_clicked(QModelIndex))); + connect(ui_area_list, SIGNAL(doubleClicked(QModelIndex)), this, + SLOT(on_area_list_double_clicked(QModelIndex))); connect(ui_hold_it, SIGNAL(clicked()), this, SLOT(on_hold_it_clicked())); connect(ui_objection, SIGNAL(clicked()), this, SLOT(on_objection_clicked())); connect(ui_take_that, SIGNAL(clicked()), this, SLOT(on_take_that_clicked())); - connect(ui_custom_objection, SIGNAL(clicked()), this, SLOT(on_custom_objection_clicked())); + connect(ui_custom_objection, SIGNAL(clicked()), this, + SLOT(on_custom_objection_clicked())); - connect(ui_realization, SIGNAL(clicked()), this, SLOT(on_realization_clicked())); + connect(ui_realization, SIGNAL(clicked()), this, + SLOT(on_realization_clicked())); connect(ui_mute, SIGNAL(clicked()), this, SLOT(on_mute_clicked())); - connect(ui_defense_minus, SIGNAL(clicked()), this, SLOT(on_defense_minus_clicked())); - connect(ui_defense_plus, SIGNAL(clicked()), this, SLOT(on_defense_plus_clicked())); - connect(ui_prosecution_minus, SIGNAL(clicked()), this, SLOT(on_prosecution_minus_clicked())); - connect(ui_prosecution_plus, SIGNAL(clicked()), this, SLOT(on_prosecution_plus_clicked())); - - connect(ui_text_color, SIGNAL(currentIndexChanged(int)), this, SLOT(on_text_color_changed(int))); - - connect(ui_music_slider, SIGNAL(valueChanged(int)), this, SLOT(on_music_slider_moved(int))); - connect(ui_sfx_slider, SIGNAL(valueChanged(int)), this, SLOT(on_sfx_slider_moved(int))); - connect(ui_blip_slider, SIGNAL(valueChanged(int)), this, SLOT(on_blip_slider_moved(int))); - - connect(ui_log_limit_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_log_limit_changed(int))); - - connect(ui_ooc_toggle, SIGNAL(clicked()), this, SLOT(on_ooc_toggle_clicked())); - - connect(ui_music_search, SIGNAL(textChanged(QString)), this, SLOT(on_music_search_edited(QString))); - - connect(ui_witness_testimony, SIGNAL(clicked()), this, SLOT(on_witness_testimony_clicked())); - connect(ui_cross_examination, SIGNAL(clicked()), this, SLOT(on_cross_examination_clicked())); + connect(ui_defense_minus, SIGNAL(clicked()), this, + SLOT(on_defense_minus_clicked())); + connect(ui_defense_plus, SIGNAL(clicked()), this, + SLOT(on_defense_plus_clicked())); + connect(ui_prosecution_minus, SIGNAL(clicked()), this, + SLOT(on_prosecution_minus_clicked())); + connect(ui_prosecution_plus, SIGNAL(clicked()), this, + SLOT(on_prosecution_plus_clicked())); + + connect(ui_text_color, SIGNAL(currentIndexChanged(int)), this, + SLOT(on_text_color_changed(int))); + + connect(ui_music_slider, SIGNAL(valueChanged(int)), this, + SLOT(on_music_slider_moved(int))); + connect(ui_sfx_slider, SIGNAL(valueChanged(int)), this, + SLOT(on_sfx_slider_moved(int))); + connect(ui_blip_slider, SIGNAL(valueChanged(int)), this, + SLOT(on_blip_slider_moved(int))); + + connect(ui_log_limit_spinbox, SIGNAL(valueChanged(int)), this, + SLOT(on_log_limit_changed(int))); + + connect(ui_ooc_toggle, SIGNAL(clicked()), this, + SLOT(on_ooc_toggle_clicked())); + + connect(ui_music_search, SIGNAL(textChanged(QString)), this, + SLOT(on_music_search_edited(QString))); + + connect(ui_witness_testimony, SIGNAL(clicked()), this, + SLOT(on_witness_testimony_clicked())); + connect(ui_cross_examination, SIGNAL(clicked()), this, + SLOT(on_cross_examination_clicked())); connect(ui_guilty, SIGNAL(clicked()), this, SLOT(on_guilty_clicked())); - connect(ui_not_guilty, SIGNAL(clicked()), this, SLOT(on_not_guilty_clicked())); + connect(ui_not_guilty, SIGNAL(clicked()), this, + SLOT(on_not_guilty_clicked())); - connect(ui_change_character, SIGNAL(clicked()), this, SLOT(on_change_character_clicked())); - connect(ui_reload_theme, SIGNAL(clicked()), this, SLOT(on_reload_theme_clicked())); + connect(ui_change_character, SIGNAL(clicked()), this, + SLOT(on_change_character_clicked())); + connect(ui_reload_theme, SIGNAL(clicked()), this, + SLOT(on_reload_theme_clicked())); connect(ui_call_mod, SIGNAL(clicked()), this, SLOT(on_call_mod_clicked())); connect(ui_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked())); - connect(ui_announce_casing, SIGNAL(clicked()), this, SLOT(on_announce_casing_clicked())); - connect(ui_switch_area_music, SIGNAL(clicked()), this, SLOT(on_switch_area_music_clicked())); + connect(ui_announce_casing, SIGNAL(clicked()), this, + SLOT(on_announce_casing_clicked())); + connect(ui_switch_area_music, SIGNAL(clicked()), this, + SLOT(on_switch_area_music_clicked())); connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked())); connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked())); connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked())); connect(ui_casing, SIGNAL(clicked()), this, SLOT(on_casing_clicked())); - connect(ui_showname_enable, SIGNAL(clicked()), this, SLOT(on_showname_enable_clicked())); + connect(ui_showname_enable, SIGNAL(clicked()), this, + SLOT(on_showname_enable_clicked())); connect(ui_pair_button, SIGNAL(clicked()), this, SLOT(on_pair_clicked())); - connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_pair_list_clicked(QModelIndex))); - connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_pair_offset_changed(int))); + connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this, + SLOT(on_pair_list_clicked(QModelIndex))); + connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this, + SLOT(on_pair_offset_changed(int))); - connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked())); + connect(ui_evidence_button, SIGNAL(clicked()), this, + SLOT(on_evidence_button_clicked())); set_widgets(); @@ -344,9 +377,8 @@ void Courtroom::set_mute_list() { mute_map.clear(); - //maps which characters are muted based on cid, none are muted by default - for (int n_cid = 0 ; n_cid < char_list.size() ; n_cid++) - { + // maps which characters are muted based on cid, none are muted by default + for (int n_cid = 0; n_cid < char_list.size(); n_cid++) { mute_map.insert(n_cid, false); } @@ -357,9 +389,8 @@ void Courtroom::set_mute_list() sorted_mute_list.sort(); - for (QString i_name : sorted_mute_list) - { - //mute_map.insert(i_name, false); + for (QString i_name : sorted_mute_list) { + // mute_map.insert(i_name, false); ui_mute_list->addItem(i_name); } } @@ -373,8 +404,7 @@ void Courtroom::set_pair_list() sorted_pair_list.sort(); - for (QString i_name : sorted_pair_list) - { + for (QString i_name : sorted_pair_list) { ui_pair_list->addItem(i_name); } } @@ -386,16 +416,15 @@ void Courtroom::set_widgets() QString filename = "courtroom_design.ini"; - pos_size_type f_courtroom = ao_app->get_element_dimensions("courtroom", filename); + pos_size_type f_courtroom = + ao_app->get_element_dimensions("courtroom", filename); - if (f_courtroom.width < 0 || f_courtroom.height < 0) - { + if (f_courtroom.width < 0 || f_courtroom.height < 0) { qDebug() << "W: did not find courtroom width or height in " << filename; this->resize(714, 668); } - else - { + else { m_courtroom_width = f_courtroom.width; m_courtroom_height = f_courtroom.height; @@ -411,17 +440,16 @@ void Courtroom::set_widgets() set_size_and_pos(ui_viewport, "viewport"); // If there is a point to it, show all CCCC features. - // We also do this this soon so that set_size_and_pos can hide them all later, if needed. - if (ao_app->cccc_ic_support_enabled) - { + // We also do this this soon so that set_size_and_pos can hide them all later, + // if needed. + if (ao_app->cccc_ic_support_enabled) { ui_pair_button->show(); ui_pre_non_interrupt->show(); ui_showname_enable->show(); ui_ic_chat_name->show(); ui_ic_chat_name->setEnabled(true); } - else - { + else { ui_pair_button->hide(); ui_pre_non_interrupt->hide(); ui_showname_enable->hide(); @@ -429,17 +457,16 @@ void Courtroom::set_widgets() ui_ic_chat_name->setEnabled(false); } - if (ao_app->casing_alerts_enabled) - { + if (ao_app->casing_alerts_enabled) { ui_announce_casing->show(); } - else - { + else { ui_announce_casing->hide(); } // We also show the non-server-dependent client additions. - // Once again, if the theme can't display it, set_move_and_pos will catch them. + // Once again, if the theme can't display it, set_move_and_pos will catch + // them. ui_settings->show(); ui_log_limit_label->show(); ui_log_limit_spinbox->show(); @@ -454,13 +481,15 @@ void Courtroom::set_widgets() ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height()); ui_vp_sideplayer_char->move(0, 0); - ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), ui_viewport->height()); + ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), + ui_viewport->height()); - //the AO2 desk element + // the AO2 desk element ui_vp_desk->move(0, 0); ui_vp_desk->resize(ui_viewport->width(), ui_viewport->height()); - //the size of the ui_vp_legacy_desk element relies on various factors and is set in set_scene() + // the size of the ui_vp_legacy_desk element relies on various factors and is + // set in set_scene() double y_modifier = 147.0 / 192.0; int final_y = static_cast(y_modifier * ui_viewport->height()); @@ -514,21 +543,21 @@ void Courtroom::set_widgets() set_size_and_pos(ui_music_list, "music_list"); - if (is_ao2_bg) - { + if (is_ao2_bg) { set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message"); set_size_and_pos(ui_vp_chatbox, "ao2_chatbox"); set_size_and_pos(ui_ic_chat_name, "ao2_ic_chat_name"); } - else - { + else { set_size_and_pos(ui_ic_chat_message, "ic_chat_message"); set_size_and_pos(ui_vp_chatbox, "chatbox"); set_size_and_pos(ui_ic_chat_name, "ic_chat_name"); } - ui_ic_chat_message->setStyleSheet("QLineEdit{background-color: rgba(100, 100, 100, 255);}"); - ui_ic_chat_name->setStyleSheet("QLineEdit{background-color: rgba(180, 180, 180, 255);}"); + ui_ic_chat_message->setStyleSheet( + "QLineEdit{background-color: rgba(100, 100, 100, 255);}"); + ui_ic_chat_name->setStyleSheet( + "QLineEdit{background-color: rgba(180, 180, 180, 255);}"); ui_vp_chatbox->set_image("chatmed.png"); ui_vp_chatbox->hide(); @@ -542,7 +571,7 @@ void Courtroom::set_widgets() set_size_and_pos(ui_ooc_chat_name, "ooc_chat_name"); ui_ooc_chat_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); - //set_size_and_pos(ui_area_password, "area_password"); + // set_size_and_pos(ui_area_password, "area_password"); set_size_and_pos(ui_music_search, "music_search"); set_size_and_pos(ui_emotes, "emotes"); @@ -557,10 +586,12 @@ void Courtroom::set_widgets() set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); set_size_and_pos(ui_defense_bar, "defense_bar"); - ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state) + ".png"); + ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state) + + ".png"); set_size_and_pos(ui_prosecution_bar, "prosecution_bar"); - ui_prosecution_bar->set_image("prosecutionbar" + QString::number(prosecution_bar_state) + ".png"); + ui_prosecution_bar->set_image( + "prosecutionbar" + QString::number(prosecution_bar_state) + ".png"); set_size_and_pos(ui_music_label, "music_label"); ui_music_label->setText("Music"); @@ -717,12 +748,13 @@ void Courtroom::set_fonts() // Set color of labels and checkboxes const QString design_file = "courtroom_fonts.ini"; QColor f_color = ao_app->get_color("label_color", design_file); - QString color_string = "color: rgba(" + - QString::number(f_color.red()) + ", " + - QString::number(f_color.green()) + ", " + - QString::number(f_color.blue()) + ", 255); }"; - QString style_sheet_string = "QLabel {" + color_string + "}" - "QCheckBox {" + color_string + "}"; + QString color_string = "color: rgba(" + QString::number(f_color.red()) + + ", " + QString::number(f_color.green()) + ", " + + QString::number(f_color.blue()) + ", 255); }"; + QString style_sheet_string = "QLabel {" + color_string + + "}" + "QCheckBox {" + + color_string + "}"; setStyleSheet(style_sheet_string); } @@ -733,16 +765,14 @@ void Courtroom::set_font(QWidget *widget, QString p_identifier) QString class_name = widget->metaObject()->className(); QString fontt = ao_app->get_font_name(p_identifier + "_font", design_file); - widget->setFont(QFont(fontt, f_weight)); - + widget->setFont(QFont(fontt, f_weight)); QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - QString style_sheet_string = class_name + " { background-color: rgba(0, 0, 0, 0);\n" + - "color: rgba(" + - QString::number(f_color.red()) + ", " + - QString::number(f_color.green()) + ", " + - QString::number(f_color.blue()) + ", 255); }"; + QString style_sheet_string = + class_name + " { background-color: rgba(0, 0, 0, 0);\n" + "color: rgba(" + + QString::number(f_color.red()) + ", " + QString::number(f_color.green()) + + ", " + QString::number(f_color.blue()) + ", 255); }"; widget->setStyleSheet(style_sheet_string); } @@ -756,15 +786,14 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier) { QString filename = "courtroom_design.ini"; - pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); + pos_size_type design_ini_result = + ao_app->get_element_dimensions(p_identifier, filename); - if (design_ini_result.width < 0 || design_ini_result.height < 0) - { + if (design_ini_result.width < 0 || design_ini_result.height < 0) { qDebug() << "W: could not find \"" << p_identifier << "\" in " << filename; p_widget->hide(); } - else - { + else { p_widget->move(design_ini_result.x, design_ini_result.y); p_widget->resize(design_ini_result.width, design_ini_result.height); } @@ -772,9 +801,9 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier) void Courtroom::set_taken(int n_char, bool p_taken) { - if (n_char >= char_list.size()) - { - qDebug() << "W: set_taken attempted to set an index bigger than char_list size"; + if (n_char >= char_list.size()) { + qDebug() + << "W: set_taken attempted to set an index bigger than char_list size"; return; } @@ -818,32 +847,28 @@ void Courtroom::set_background(QString p_background) file_exists(ao_app->get_background_path("prosecutiondesk.png")) && file_exists(ao_app->get_background_path("stand.png")); - if (is_ao2_bg) - { + if (is_ao2_bg) { set_size_and_pos(ui_vp_chatbox, "ao2_chatbox"); set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message"); } - else - { + else { set_size_and_pos(ui_vp_chatbox, "chatbox"); set_size_and_pos(ui_ic_chat_message, "ic_chat_message"); } } void Courtroom::enter_courtroom(int p_cid) -{ +{ m_cid = p_cid; QString f_char; - if (m_cid == -1) - { + if (m_cid == -1) { if (ao_app->is_discord_enabled()) ao_app->discord->state_spectate(); f_char = ""; } - else - { + else { f_char = ao_app->get_char_name(char_list.at(m_cid).name); if (ao_app->is_discord_enabled()) @@ -870,8 +895,7 @@ void Courtroom::enter_courtroom(int p_cid) QString side = ao_app->get_char_side(f_char); - if (side == "jud") - { + if (side == "jud") { ui_witness_testimony->show(); ui_cross_examination->show(); ui_not_guilty->show(); @@ -881,8 +905,7 @@ void Courtroom::enter_courtroom(int p_cid) ui_prosecution_minus->show(); ui_prosecution_plus->show(); } - else - { + else { ui_witness_testimony->hide(); ui_cross_examination->hide(); ui_guilty->hide(); @@ -895,7 +918,7 @@ void Courtroom::enter_courtroom(int p_cid) if (ao_app->custom_objection_enabled && (file_exists(ao_app->get_character_path(current_char, "custom.gif")) || - file_exists(ao_app->get_character_path(current_char, "custom.apng"))) && + file_exists(ao_app->get_character_path(current_char, "custom.apng"))) && file_exists(ao_app->get_character_path(current_char, "custom.wav"))) ui_custom_objection->show(); else @@ -923,7 +946,7 @@ void Courtroom::enter_courtroom(int p_cid) set_widgets(); - //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); + // ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); ui_char_select_background->hide(); @@ -943,14 +966,12 @@ void Courtroom::list_music() int n_listed_songs = 0; - for (int n_song = 0 ; n_song < music_list.size() ; ++n_song) - { + for (int n_song = 0; n_song < music_list.size(); ++n_song) { QString i_song = music_list.at(n_song); QString i_song_listname = i_song; i_song_listname = i_song_listname.left(i_song_listname.lastIndexOf(".")); - if (i_song.toLower().contains(ui_music_search->text().toLower())) - { + if (i_song.toLower().contains(ui_music_search->text().toLower())) { ui_music_list->addItem(i_song_listname); music_row_to_number.append(n_song); @@ -983,8 +1004,7 @@ void Courtroom::list_areas() int n_listed_areas = 0; - for (int n_area = 0 ; n_area < area_list.size() ; ++n_area) - { + for (int n_area = 0; n_area < area_list.size(); ++n_area) { QString i_area = ""; i_area.append("["); i_area.append(QString::number(n_area)); @@ -992,8 +1012,7 @@ void Courtroom::list_areas() i_area.append(area_list.at(n_area)); - if (ao_app->arup_enabled) - { + if (ao_app->arup_enabled) { i_area.append("\n "); i_area.append(arup_statuses.at(n_area)); @@ -1008,35 +1027,30 @@ void Courtroom::list_areas() i_area.append(arup_locks.at(n_area)); } - if (i_area.toLower().contains(ui_music_search->text().toLower())) - { + if (i_area.toLower().contains(ui_music_search->text().toLower())) { ui_area_list->addItem(i_area); area_row_to_number.append(n_area); - if (ao_app->arup_enabled) - { + if (ao_app->arup_enabled) { // Colouring logic here. ui_area_list->item(n_listed_areas)->setBackground(free_brush); - if (arup_locks.at(n_area) == "LOCKED") - { - ui_area_list->item(n_listed_areas)->setBackground(locked_brush); + if (arup_locks.at(n_area) == "LOCKED") { + ui_area_list->item(n_listed_areas)->setBackground(locked_brush); } - else - { - if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") - ui_area_list->item(n_listed_areas)->setBackground(lfp_brush); - else if (arup_statuses.at(n_area) == "CASING") - ui_area_list->item(n_listed_areas)->setBackground(casing_brush); - else if (arup_statuses.at(n_area) == "RECESS") - ui_area_list->item(n_listed_areas)->setBackground(recess_brush); - else if (arup_statuses.at(n_area) == "RP") - ui_area_list->item(n_listed_areas)->setBackground(rp_brush); - else if (arup_statuses.at(n_area) == "GAMING") - ui_area_list->item(n_listed_areas)->setBackground(gaming_brush); + else { + if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") + ui_area_list->item(n_listed_areas)->setBackground(lfp_brush); + else if (arup_statuses.at(n_area) == "CASING") + ui_area_list->item(n_listed_areas)->setBackground(casing_brush); + else if (arup_statuses.at(n_area) == "RECESS") + ui_area_list->item(n_listed_areas)->setBackground(recess_brush); + else if (arup_statuses.at(n_area) == "RP") + ui_area_list->item(n_listed_areas)->setBackground(rp_brush); + else if (arup_statuses.at(n_area) == "GAMING") + ui_area_list->item(n_listed_areas)->setBackground(gaming_brush); } } - else - { + else { ui_area_list->item(n_listed_areas)->setBackground(free_brush); } @@ -1047,17 +1061,22 @@ void Courtroom::list_areas() void Courtroom::append_ms_chatmessage(QString f_name, QString f_message) { - ui_ms_chatlog->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name()); + ui_ms_chatlog->append_chatmessage( + f_name, f_message, + ao_app->get_color("ooc_default_color", "courtroom_design.ini").name()); } -void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QString p_colour) +void Courtroom::append_server_chatmessage(QString p_name, QString p_message, + QString p_colour) { QString colour = "#000000"; if (p_colour == "0") - colour = ao_app->get_color("ooc_default_color", "courtroom_design.ini").name(); + colour = + ao_app->get_color("ooc_default_color", "courtroom_design.ini").name(); if (p_colour == "1") - colour = ao_app->get_color("ooc_server_color", "courtroom_design.ini").name(); + colour = + ao_app->get_color("ooc_server_color", "courtroom_design.ini").name(); ui_server_chatlog->append_chatmessage(p_name, p_message, colour); } @@ -1067,33 +1086,32 @@ void Courtroom::on_chat_return_pressed() if (ui_ic_chat_message->text() == "" || is_muted) return; - if ((anim_state < 3 || text_state < 2) && - objection_state == 0) + if ((anim_state < 3 || text_state < 2) && objection_state == 0) return; - //MS# - //deskmod# - //pre-emote# - //character# - //emote# - //message# - //side# - //sfx-name# - //emote_modifier# - //char_id# - //sfx_delay# - //objection_modifier# - //evidence# - //placeholder# - //realization# - //text_color#% + // MS# + // deskmod# + // pre-emote# + // character# + // emote# + // message# + // side# + // sfx-name# + // emote_modifier# + // char_id# + // sfx_delay# + // objection_modifier# + // evidence# + // placeholder# + // realization# + // text_color#% // Additionally, in our case: - //showname# - //other_charid# - //self_offset# - //noninterrupting_preanim#% + // showname# + // other_charid# + // self_offset# + // noninterrupting_preanim#% QStringList packet_contents; @@ -1101,9 +1119,9 @@ void Courtroom::on_chat_return_pressed() QString f_desk_mod = "chat"; - if (ao_app->desk_mod_enabled) - { - f_desk_mod = QString::number(ao_app->get_desk_mod(current_char, current_emote)); + if (ao_app->desk_mod_enabled) { + f_desk_mod = + QString::number(ao_app->get_desk_mod(current_char, current_emote)); if (f_desk_mod == "-1") f_desk_mod = "chat"; } @@ -1124,26 +1142,22 @@ void Courtroom::on_chat_return_pressed() int f_emote_mod = ao_app->get_emote_mod(current_char, current_emote); - //needed or else legacy won't understand what we're saying - if (objection_state > 0) - { - if (ui_pre->isChecked()) - { + // needed or else legacy won't understand what we're saying + if (objection_state > 0) { + if (ui_pre->isChecked()) { if (f_emote_mod == 5) f_emote_mod = 6; else f_emote_mod = 2; } } - else if (ui_pre->isChecked() and !ui_pre_non_interrupt->isChecked()) - { + else if (ui_pre->isChecked() and !ui_pre_non_interrupt->isChecked()) { if (f_emote_mod == 0) f_emote_mod = 1; else if (f_emote_mod == 5 && ao_app->prezoom_enabled) f_emote_mod = 4; } - else - { + else { if (f_emote_mod == 1) f_emote_mod = 0; else if (f_emote_mod == 4) @@ -1153,12 +1167,13 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(QString::number(f_emote_mod)); packet_contents.append(QString::number(m_cid)); - packet_contents.append(QString::number(ao_app->get_sfx_delay(current_char, current_emote))); + packet_contents.append( + QString::number(ao_app->get_sfx_delay(current_char, current_emote))); QString f_obj_state; if ((objection_state == 4 && !ao_app->custom_objection_enabled) || - (objection_state < 0)) + (objection_state < 0)) f_obj_state = "0"; else f_obj_state = QString::number(objection_state); @@ -1166,16 +1181,15 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(f_obj_state); if (is_presenting_evidence) - //the evidence index is shifted by 1 because 0 is no evidence per legacy standards - //besides, older clients crash if we pass -1 + // the evidence index is shifted by 1 because 0 is no evidence per legacy + // standards besides, older clients crash if we pass -1 packet_contents.append(QString::number(current_evidence + 1)); else packet_contents.append("0"); QString f_flip; - if (ao_app->flipping_enabled) - { + if (ao_app->flipping_enabled) { if (ui_flip->isChecked()) f_flip = "1"; else @@ -1200,38 +1214,32 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(f_text_color); // If the server we're on supports CCCC stuff, we should use it! - if (ao_app->cccc_ic_support_enabled) - { - // If there is a showname entered, use that -- else, just send an empty packet-part. - if (!ui_ic_chat_name->text().isEmpty()) - { + if (ao_app->cccc_ic_support_enabled) { + // If there is a showname entered, use that -- else, just send an empty + // packet-part. + if (!ui_ic_chat_name->text().isEmpty()) { packet_contents.append(ui_ic_chat_name->text()); } - else - { + else { packet_contents.append(""); } - // Similarly, we send over whom we're paired with, unless we have chosen ourselves. - // Or a charid of -1 or lower, through some means. - if (other_charid > -1 && other_charid != m_cid) - { + // Similarly, we send over whom we're paired with, unless we have chosen + // ourselves. Or a charid of -1 or lower, through some means. + if (other_charid > -1 && other_charid != m_cid) { packet_contents.append(QString::number(other_charid)); packet_contents.append(QString::number(offset_with_pair)); } - else - { + else { packet_contents.append("-1"); packet_contents.append("0"); } // Finally, we send over if we want our pres to not interrupt. - if (ui_pre_non_interrupt->isChecked() && ui_pre->isChecked()) - { + if (ui_pre_non_interrupt->isChecked() && ui_pre->isChecked()) { packet_contents.append("1"); } - else - { + else { packet_contents.append("0"); } } @@ -1247,21 +1255,19 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) if (p_contents->size() < 15) return; - for (int n_string = 0 ; n_string < chatmessage_size ; ++n_string) - { - //m_chatmessage[n_string] = p_contents->at(n_string); + for (int n_string = 0; n_string < chatmessage_size; ++n_string) { + // m_chatmessage[n_string] = p_contents->at(n_string); - // Note that we have added stuff that vanilla clients and servers simply won't send. - // So now, we have to check if the thing we want even exists amongst the packet's content. - // We also have to check if the server even supports CCCC's IC features, or if it's just japing us. - // Also, don't forget! A size 15 message will have indices from 0 to 14. + // Note that we have added stuff that vanilla clients and servers simply + // won't send. So now, we have to check if the thing we want even exists + // amongst the packet's content. We also have to check if the server even + // supports CCCC's IC features, or if it's just japing us. Also, don't + // forget! A size 15 message will have indices from 0 to 14. if (n_string < p_contents->size() && - (n_string < 15 || ao_app->cccc_ic_support_enabled)) - { + (n_string < 15 || ao_app->cccc_ic_support_enabled)) { m_chatmessage[n_string] = p_contents->at(n_string); } - else - { + else { m_chatmessage[n_string] = ""; } } @@ -1275,16 +1281,13 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) return; QString f_showname; - if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) - { - f_showname = ao_app->get_showname(char_list.at(f_char_id).name); + if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) { + f_showname = ao_app->get_showname(char_list.at(f_char_id).name); } - else - { - f_showname = m_chatmessage[SHOWNAME]; + else { + f_showname = m_chatmessage[SHOWNAME]; } - QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n'; if (f_message == previous_ic_message) @@ -1297,10 +1300,11 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) chat_tick_timer->stop(); ui_vp_evidence_display->reset(); - chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; + chatmessage_is_empty = + m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; - if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() && m_chatmessage[CHAR_ID].toInt() == m_cid) - { + if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() && + m_chatmessage[CHAR_ID].toInt() == m_cid) { ui_ic_chat_message->clear(); objection_state = 0; realization_state = 0; @@ -1314,11 +1318,13 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_evidence_present->set_image("present_disabled.png"); } - chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false); + chatlogpiece *temp = + new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), + f_showname, ": " + m_chatmessage[MESSAGE], false); ic_chatlog_history.append(*temp); - while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) - { + while (ic_chatlog_history.size() > log_maximum_blocks && + log_maximum_blocks > 0) { ic_chatlog_history.removeFirst(); } @@ -1330,11 +1336,9 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) QString f_char = m_chatmessage[CHAR_NAME]; QString f_custom_theme = ao_app->get_char_shouts(f_char); - //if an objection is used - if (objection_mod <= 4 && objection_mod >= 1) - { - switch (objection_mod) - { + // if an objection is used + if (objection_mod <= 4 && objection_mod >= 1) { + switch (objection_mod) { case 1: ui_vp_objection->play("holdit", f_char, f_custom_theme); objection_player->play("holdit.wav", f_char, f_custom_theme); @@ -1347,7 +1351,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_vp_objection->play("takethat", f_char, f_custom_theme); objection_player->play("takethat.wav", f_char, f_custom_theme); break; - //case 4 is AO2 only + // case 4 is AO2 only case 4: ui_vp_objection->play("custom", f_char, f_custom_theme); objection_player->play("custom.wav", f_char, f_custom_theme); @@ -1365,27 +1369,22 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) handle_chatmessage_2(); } -void Courtroom::objection_done() -{ - handle_chatmessage_2(); -} +void Courtroom::objection_done() { handle_chatmessage_2(); } void Courtroom::handle_chatmessage_2() { ui_vp_speedlines->stop(); ui_vp_player_char->stop(); - if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) - { - QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; + if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) { + QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; - QString f_showname = ao_app->get_showname(real_name); + QString f_showname = ao_app->get_showname(real_name); - ui_vp_showname->setText(f_showname); + ui_vp_showname->setText(f_showname); } - else - { - ui_vp_showname->setText(m_chatmessage[SHOWNAME]); + else { + ui_vp_showname->setText(m_chatmessage[SHOWNAME]); } ui_vp_message->clear(); @@ -1395,36 +1394,32 @@ void Courtroom::handle_chatmessage_2() if (chatbox == "") ui_vp_chatbox->set_image("chatmed.png"); - else - { - QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png"; + else { + QString chatbox_path = + ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png"; ui_vp_chatbox->set_image_from_path(chatbox_path); } - ui_vp_showname->setStyleSheet("QLabel { color : " + get_text_color("_showname").name() + "; }"); + ui_vp_showname->setStyleSheet( + "QLabel { color : " + get_text_color("_showname").name() + "; }"); set_scene(); set_text_color(); // Check if the message needs to be centered. QString f_message = m_chatmessage[MESSAGE]; - if (f_message.size() >= 2) - { - if (f_message.startsWith("~~")) - { - message_is_centered = true; - } - else - { - message_is_centered = false; - } + if (f_message.size() >= 2) { + if (f_message.startsWith("~~")) { + message_is_centered = true; + } + else { + message_is_centered = false; + } } - else - { - ui_vp_message->setAlignment(Qt::AlignLeft); + else { + ui_vp_message->setAlignment(Qt::AlignLeft); } - int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); if (ao_app->flipping_enabled && m_chatmessage[FLIP].toInt() == 1) @@ -1435,98 +1430,91 @@ void Courtroom::handle_chatmessage_2() QString side = m_chatmessage[SIDE]; // Making the second character appear. - if (m_chatmessage[OTHER_CHARID].isEmpty()) - { + if (m_chatmessage[OTHER_CHARID].isEmpty()) { // If there is no second character, hide 'em, and center the first. ui_vp_sideplayer_char->hide(); - ui_vp_sideplayer_char->move(0,0); + ui_vp_sideplayer_char->move(0, 0); - ui_vp_player_char->move(0,0); + ui_vp_player_char->move(0, 0); } - else - { + else { bool ok; int got_other_charid = m_chatmessage[OTHER_CHARID].toInt(&ok); - if (ok) - { - if (got_other_charid > -1) - { + if (ok) { + if (got_other_charid > -1) { // If there is, show them! ui_vp_sideplayer_char->show(); - // Depending on where we are, we offset the characters, and reorder their stacking. - if (side == "def") - { - // We also move the character down depending on how far the are to the right. + // Depending on where we are, we offset the characters, and reorder + // their stacking. + if (side == "def") { + // We also move the character down depending on how far the are to the + // right. int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); int vert_offset = 0; - if (hor_offset > 0) - { + if (hor_offset > 0) { vert_offset = hor_offset / 10; } - ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, ui_viewport->height() * vert_offset / 100); + ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, + ui_viewport->height() * vert_offset / 100); // We do the same with the second character. int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt(); int vert2_offset = 0; - if (hor2_offset > 0) - { + if (hor2_offset > 0) { vert2_offset = hor2_offset / 10; } - ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100); + ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, + ui_viewport->height() * vert2_offset / + 100); // Finally, we reorder them based on who is more to the left. // The person more to the left is more in the front. - if (hor2_offset >= hor_offset) - { + if (hor2_offset >= hor_offset) { ui_vp_sideplayer_char->raise(); ui_vp_player_char->raise(); } - else - { + else { ui_vp_player_char->raise(); ui_vp_sideplayer_char->raise(); } ui_vp_desk->raise(); ui_vp_legacy_desk->raise(); } - else if (side == "pro") - { + else if (side == "pro") { // Almost the same thing happens here, but in reverse. int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); int vert_offset = 0; - if (hor_offset < 0) - { + if (hor_offset < 0) { // We don't want to RAISE the char off the floor. vert_offset = -1 * hor_offset / 10; } - ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, ui_viewport->height() * vert_offset / 100); + ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, + ui_viewport->height() * vert_offset / 100); // We do the same with the second character. int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt(); int vert2_offset = 0; - if (hor2_offset < 0) - { + if (hor2_offset < 0) { vert2_offset = -1 * hor2_offset / 10; } - ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100); + ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, + ui_viewport->height() * vert2_offset / + 100); // Finally, we reorder them based on who is more to the right. - if (hor2_offset <= hor_offset) - { + if (hor2_offset <= hor_offset) { ui_vp_sideplayer_char->raise(); ui_vp_player_char->raise(); } - else - { + else { ui_vp_player_char->raise(); ui_vp_sideplayer_char->raise(); } ui_vp_desk->raise(); ui_vp_legacy_desk->raise(); } - else - { + else { // In every other case, the person more to the left is on top. // These cases also don't move the characters down. int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); @@ -1534,17 +1522,16 @@ void Courtroom::handle_chatmessage_2() // We do the same with the second character. int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt(); - ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, 0); + ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, + 0); // Finally, we reorder them based on who is more to the left. // The person more to the left is more in the front. - if (hor2_offset >= hor_offset) - { + if (hor2_offset >= hor_offset) { ui_vp_sideplayer_char->raise(); ui_vp_player_char->raise(); } - else - { + else { ui_vp_player_char->raise(); ui_vp_sideplayer_char->raise(); } @@ -1556,26 +1543,28 @@ void Courtroom::handle_chatmessage_2() ui_vp_sideplayer_char->set_flipped(true); else ui_vp_sideplayer_char->set_flipped(false); - ui_vp_sideplayer_char->play_idle(m_chatmessage[OTHER_NAME], m_chatmessage[OTHER_EMOTE]); + ui_vp_sideplayer_char->play_idle(m_chatmessage[OTHER_NAME], + m_chatmessage[OTHER_EMOTE]); } - else - { - // If the server understands other characters, but there - // really is no second character, hide 'em, and center the first. - ui_vp_sideplayer_char->hide(); - ui_vp_sideplayer_char->move(0,0); + else { + // If the server understands other characters, but there + // really is no second character, hide 'em, and center the first. + ui_vp_sideplayer_char->hide(); + ui_vp_sideplayer_char->move(0, 0); - ui_vp_player_char->move(0,0); + ui_vp_player_char->move(0, 0); } } } - switch (emote_mod) - { - case 1: case 2: case 6: + switch (emote_mod) { + case 1: + case 2: + case 6: play_preanim(false); break; - case 0: case 5: + case 0: + case 5: if (m_chatmessage[NONINTERRUPTING_PRE].toInt() == 0) handle_chatmessage_3(); else @@ -1593,51 +1582,45 @@ void Courtroom::handle_chatmessage_3() int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt(); QString f_side = m_chatmessage[SIDE]; - if (f_evi_id > 0 && f_evi_id <= local_evidence_list.size()) - { - //shifted by 1 because 0 is no evidence per legacy standards + if (f_evi_id > 0 && f_evi_id <= local_evidence_list.size()) { + // shifted by 1 because 0 is no evidence per legacy standards QString f_image = local_evidence_list.at(f_evi_id - 1).image; - //def jud and hlp should display the evidence icon on the RIGHT side - bool is_left_side = !(f_side == "def" || f_side == "hlp" || f_side == "jud" || f_side == "jur"); - ui_vp_evidence_display->show_evidence(f_image, is_left_side, ui_sfx_slider->value()); + // def jud and hlp should display the evidence icon on the RIGHT side + bool is_left_side = !(f_side == "def" || f_side == "hlp" || + f_side == "jud" || f_side == "jur"); + ui_vp_evidence_display->show_evidence(f_image, is_left_side, + ui_sfx_slider->value()); } int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); QString side = m_chatmessage[SIDE]; - if (emote_mod == 5 || - emote_mod == 6) - { + if (emote_mod == 5 || emote_mod == 6) { ui_vp_desk->hide(); ui_vp_legacy_desk->hide(); // Since we're zooming, hide the second character, and centre the first. - ui_vp_sideplayer_char->hide(); - ui_vp_player_char->move(0,0); + ui_vp_sideplayer_char->hide(); + ui_vp_player_char->move(0, 0); - if (side == "pro" || - side == "hlp" || - side == "wit") + if (side == "pro" || side == "hlp" || side == "wit") ui_vp_speedlines->play("prosecution_speedlines"); else ui_vp_speedlines->play("defense_speedlines"); - } int f_anim_state = 0; - //BLUE is from an enum in datatypes.h + // BLUE is from an enum in datatypes.h bool text_is_blue = m_chatmessage[TEXT_COLOR].toInt() == BLUE; - if (!text_is_blue && text_state == 1) - { - //talking + if (!text_is_blue && text_state == 1) { + // talking f_anim_state = 2; entire_message_is_blue = false; } - else - { - //idle + else { + // idle f_anim_state = 3; entire_message_is_blue = true; } @@ -1653,8 +1636,7 @@ void Courtroom::handle_chatmessage_3() ui_vp_player_char->play_talking(f_char, f_emote); anim_state = 2; } - else - { + else { ui_vp_player_char->play_idle(f_char, f_emote); anim_state = 3; } @@ -1662,31 +1644,27 @@ void Courtroom::handle_chatmessage_3() QString f_message = m_chatmessage[MESSAGE]; QStringList call_words = ao_app->get_call_words(); - for (QString word : call_words) - { - if (f_message.contains(word, Qt::CaseInsensitive)) - { + for (QString word : call_words) { + if (f_message.contains(word, Qt::CaseInsensitive)) { modcall_player->play(ao_app->get_sfx("word_call")); ao_app->alert(this); break; } } - } QString Courtroom::filter_ic_text(QString p_text) { // Get rid of centering. - if(p_text.startsWith(": ~~")) - { - // Don't forget, the p_text part actually everything after the name! - // Hence why we check for ': ~~'. + if (p_text.startsWith(": ~~")) { + // Don't forget, the p_text part actually everything after the name! + // Hence why we check for ': ~~'. - // Let's remove those two tildes, then. - // : _ ~ ~ - // 0 1 2 3 - p_text.remove(2,2); + // Let's remove those two tildes, then. + // : _ ~ ~ + // 0 1 2 3 + p_text.remove(2, 2); } // Get rid of the inline-colouring. @@ -1696,123 +1674,101 @@ QString Courtroom::filter_ic_text(QString p_text) bool ic_next_is_not_special = false; QString f_character = p_text.at(trick_check_pos); std::stack ic_colour_stack; - while (trick_check_pos < p_text.size()) - { - f_character = p_text.at(trick_check_pos); - - // Escape character. - if (f_character == "\\" and !ic_next_is_not_special) - { - ic_next_is_not_special = true; - p_text.remove(trick_check_pos,1); - } + while (trick_check_pos < p_text.size()) { + f_character = p_text.at(trick_check_pos); - // Text speed modifier. - else if (f_character == "{" and !ic_next_is_not_special) - { - p_text.remove(trick_check_pos,1); - } - else if (f_character == "}" and !ic_next_is_not_special) - { - p_text.remove(trick_check_pos,1); - } + // Escape character. + if (f_character == "\\" and !ic_next_is_not_special) { + ic_next_is_not_special = true; + p_text.remove(trick_check_pos, 1); + } - // Orange inline colourisation. - else if (f_character == "|" and !ic_next_is_not_special) - { - if (!ic_colour_stack.empty()) - { - if (ic_colour_stack.top() == INLINE_ORANGE) - { - ic_colour_stack.pop(); - p_text.remove(trick_check_pos,1); - } - else - { - ic_colour_stack.push(INLINE_ORANGE); - p_text.remove(trick_check_pos,1); - } - } - else - { - ic_colour_stack.push(INLINE_ORANGE); - p_text.remove(trick_check_pos,1); - } + // Text speed modifier. + else if (f_character == "{" and !ic_next_is_not_special) { + p_text.remove(trick_check_pos, 1); + } + else if (f_character == "}" and !ic_next_is_not_special) { + p_text.remove(trick_check_pos, 1); + } + + // Orange inline colourisation. + else if (f_character == "|" and !ic_next_is_not_special) { + if (!ic_colour_stack.empty()) { + if (ic_colour_stack.top() == INLINE_ORANGE) { + ic_colour_stack.pop(); + p_text.remove(trick_check_pos, 1); + } + else { + ic_colour_stack.push(INLINE_ORANGE); + p_text.remove(trick_check_pos, 1); + } + } + else { + ic_colour_stack.push(INLINE_ORANGE); + p_text.remove(trick_check_pos, 1); } + } - // Blue inline colourisation. - else if (f_character == "(" and !ic_next_is_not_special) - { - ic_colour_stack.push(INLINE_BLUE); - trick_check_pos++; + // Blue inline colourisation. + else if (f_character == "(" and !ic_next_is_not_special) { + ic_colour_stack.push(INLINE_BLUE); + trick_check_pos++; + } + else if (f_character == ")" and !ic_next_is_not_special and + !ic_colour_stack.empty()) { + if (ic_colour_stack.top() == INLINE_BLUE) { + ic_colour_stack.pop(); + trick_check_pos++; } - else if (f_character == ")" and !ic_next_is_not_special - and !ic_colour_stack.empty()) - { - if (ic_colour_stack.top() == INLINE_BLUE) - { - ic_colour_stack.pop(); - trick_check_pos++; - } - else - { - ic_next_is_not_special = true; - } + else { + ic_next_is_not_special = true; } + } - // Grey inline colourisation. - else if (f_character == "[" and !ic_next_is_not_special) - { - ic_colour_stack.push(INLINE_GREY); - trick_check_pos++; + // Grey inline colourisation. + else if (f_character == "[" and !ic_next_is_not_special) { + ic_colour_stack.push(INLINE_GREY); + trick_check_pos++; + } + else if (f_character == "]" and !ic_next_is_not_special and + !ic_colour_stack.empty()) { + if (ic_colour_stack.top() == INLINE_GREY) { + ic_colour_stack.pop(); + trick_check_pos++; } - else if (f_character == "]" and !ic_next_is_not_special - and !ic_colour_stack.empty()) - { - if (ic_colour_stack.top() == INLINE_GREY) - { - ic_colour_stack.pop(); - trick_check_pos++; - } - else - { - ic_next_is_not_special = true; - } + else { + ic_next_is_not_special = true; } + } - // Green inline colourisation. - else if (f_character == "`" and !ic_next_is_not_special) - { - if (!ic_colour_stack.empty()) - { - if (ic_colour_stack.top() == INLINE_GREEN) - { - ic_colour_stack.pop(); - p_text.remove(trick_check_pos,1); - } - else - { - ic_colour_stack.push(INLINE_GREEN); - p_text.remove(trick_check_pos,1); - } - } - else - { - ic_colour_stack.push(INLINE_GREEN); - p_text.remove(trick_check_pos,1); - } + // Green inline colourisation. + else if (f_character == "`" and !ic_next_is_not_special) { + if (!ic_colour_stack.empty()) { + if (ic_colour_stack.top() == INLINE_GREEN) { + ic_colour_stack.pop(); + p_text.remove(trick_check_pos, 1); + } + else { + ic_colour_stack.push(INLINE_GREEN); + p_text.remove(trick_check_pos, 1); + } } - else - { - trick_check_pos++; - ic_next_is_not_special = false; + else { + ic_colour_stack.push(INLINE_GREEN); + p_text.remove(trick_check_pos, 1); } + } + else { + trick_check_pos++; + ic_next_is_not_special = false; + } } return p_text; } -void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchange) +void Courtroom::append_ic_text(QString p_text, QString p_name, + bool is_songchange) { QTextCharFormat bold; QTextCharFormat normal; @@ -1826,95 +1782,94 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang if (!is_songchange) p_text = filter_ic_text(p_text); - if (log_goes_downwards) - { - const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); + if (log_goes_downwards) { + const bool is_scrolled_down = + old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); - ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->moveCursor(QTextCursor::End); - if (!first_message_sent) - { - ui_ic_chatlog->textCursor().insertText(p_name, bold); - first_message_sent = true; - } - else - { - ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); - } + if (!first_message_sent) { + ui_ic_chatlog->textCursor().insertText(p_name, bold); + first_message_sent = true; + } + else { + ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); + } - if (is_songchange) - { - ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); - ui_ic_chatlog->textCursor().insertText(p_text + ".", italics); - } - else - { - ui_ic_chatlog->textCursor().insertText(p_text, normal); - } + if (is_songchange) { + ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + ".", italics); + } + else { + ui_ic_chatlog->textCursor().insertText(p_text, normal); + } - // If we got too many blocks in the current log, delete some from the top. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) - { - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); - ui_ic_chatlog->textCursor().removeSelectedText(); - ui_ic_chatlog->textCursor().deleteChar(); - //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; - } + // If we got too many blocks in the current log, delete some from the top. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && + log_maximum_blocks > 0) { + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deleteChar(); + // qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << + // log_maximum_blocks; + } - if (old_cursor.hasSelection() || !is_scrolled_down) - { - // The user has selected text or scrolled away from the bottom: maintain position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); - } - else - { - // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom. - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); - } + if (old_cursor.hasSelection() || !is_scrolled_down) { + // The user has selected text or scrolled away from the bottom: maintain + // position. + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } + else { + // The user hasn't selected any text and the scrollbar is at the bottom: + // scroll to the bottom. + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->verticalScrollBar()->setValue( + ui_ic_chatlog->verticalScrollBar()->maximum()); + } } - else - { - const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); + else { + const bool is_scrolled_up = + old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); - ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->textCursor().insertText(p_name, bold); + ui_ic_chatlog->textCursor().insertText(p_name, bold); - if (is_songchange) - { - ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); - ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics); - } - else - { - ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); - } + if (is_songchange) { + ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics); + } + else { + ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); + } - // If we got too many blocks in the current log, delete some from the bottom. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) - { - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); - ui_ic_chatlog->textCursor().removeSelectedText(); - ui_ic_chatlog->textCursor().deletePreviousChar(); - //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; - } + // If we got too many blocks in the current log, delete some from the + // bottom. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && + log_maximum_blocks > 0) { + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deletePreviousChar(); + // qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << + // log_maximum_blocks; + } - if (old_cursor.hasSelection() || !is_scrolled_up) - { - // The user has selected text or scrolled away from the top: maintain position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); - } - else - { - // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); - } + if (old_cursor.hasSelection() || !is_scrolled_up) { + // The user has selected text or scrolled away from the top: maintain + // position. + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } + else { + // The user hasn't selected any text and the scrollbar is at the top: + // scroll to the top. + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->verticalScrollBar()->setValue( + ui_ic_chatlog->verticalScrollBar()->minimum()); + } } } @@ -1923,7 +1878,8 @@ void Courtroom::play_preanim(bool noninterrupting) QString f_char = m_chatmessage[CHAR_NAME]; QString f_preanim = m_chatmessage[PRE_EMOTE]; - //all time values in char.inis are multiplied by a constant(time_mod) to get the actual time + // all time values in char.inis are multiplied by a constant(time_mod) to get + // the actual time int ao2_duration = ao_app->get_ao2_preanim_duration(f_char, f_preanim); int text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod; int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * 60; @@ -1936,10 +1892,9 @@ void Courtroom::play_preanim(bool noninterrupting) preanim_duration = ao2_duration; sfx_delay_timer->start(sfx_delay); - QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim)); - if (!file_exists(anim_to_find) || - preanim_duration < 0) - { + QString anim_to_find = + ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim)); + if (!file_exists(anim_to_find) || preanim_duration < 0) { if (noninterrupting) anim_state = 4; else @@ -1969,19 +1924,16 @@ void Courtroom::preanim_done() handle_chatmessage_3(); } -void Courtroom::realization_done() -{ - ui_vp_realization->hide(); -} +void Courtroom::realization_done() { ui_vp_realization->hide(); } void Courtroom::start_chat_ticking() { - //we need to ensure that the text isn't already ticking because this function can be called by two logic paths + // we need to ensure that the text isn't already ticking because this function + // can be called by two logic paths if (text_state != 0) return; - if (m_chatmessage[REALIZATION] == "1") - { + if (m_chatmessage[REALIZATION] == "1") { realization_timer->start(60); ui_vp_realization->show(); sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); @@ -1991,18 +1943,16 @@ void Courtroom::start_chat_ticking() set_text_color(); rainbow_counter = 0; - if (chatmessage_is_empty) - { - //since the message is empty, it's technically done ticking + if (chatmessage_is_empty) { + // since the message is empty, it's technically done ticking text_state = 2; return; } // At this point, we'd do well to clear the inline colour stack. // This stops it from flowing into next messages. - while (!inline_colour_stack.empty()) - { - inline_colour_stack.pop(); + while (!inline_colour_stack.empty()) { + inline_colour_stack.pop(); } ui_vp_chatbox->show(); @@ -2010,8 +1960,8 @@ void Courtroom::start_chat_ticking() tick_pos = 0; blip_pos = 0; - // Just in case we somehow got inline blue text left over from a previous message, - // let's set it to false. + // Just in case we somehow got inline blue text left over from a previous + // message, let's set it to false. inline_blue_depth = 0; // At the start of every new message, we set the text speed to the default. @@ -2022,14 +1972,14 @@ void Courtroom::start_chat_ticking() blip_player->set_blips(ao_app->get_sfx_suffix("sfx-blip" + f_gender)); - //means text is currently ticking + // means text is currently ticking text_state = 1; } void Courtroom::chat_tick() { - //note: this is called fairly often(every 60 ms when char is talking) - //do not perform heavy operations here + // note: this is called fairly often(every 60 ms when char is talking) + // do not perform heavy operations here QString f_message = m_chatmessage[MESSAGE]; f_message.remove(0, tick_pos); @@ -2042,23 +1992,20 @@ void Courtroom::chat_tick() // If previously, we have detected that the message is centered, now // is the time to remove those two tildes at the start. - if (message_is_centered) - { - f_message.remove(0,2); + if (message_is_centered) { + f_message.remove(0, 2); } - if (f_message.size() == 0) - { + if (f_message.size() == 0) { text_state = 2; - if (anim_state != 4) - { + if (anim_state != 4) { anim_state = 3; - ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], + m_chatmessage[EMOTE]); } } - else - { + else { QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_message); QString f_character; int f_char_length; @@ -2073,174 +2020,163 @@ void Courtroom::chat_tick() f_char_length = f_character.length(); f_character = f_character.toHtmlEscaped(); - if (f_character == " ") ui_vp_message->insertPlainText(" "); // Escape character. - else if (f_character == "\\" and !next_character_is_not_special) - { - next_character_is_not_special = true; - formatting_char = true; + else if (f_character == "\\" and !next_character_is_not_special) { + next_character_is_not_special = true; + formatting_char = true; } // Text speed modifier. - else if (f_character == "{" and !next_character_is_not_special) - { - // ++, because it INCREASES delay! - current_display_speed++; - formatting_char = true; + else if (f_character == "{" and !next_character_is_not_special) { + // ++, because it INCREASES delay! + current_display_speed++; + formatting_char = true; } - else if (f_character == "}" and !next_character_is_not_special) - { - current_display_speed--; - formatting_char = true; + else if (f_character == "}" and !next_character_is_not_special) { + current_display_speed--; + formatting_char = true; } // Orange inline colourisation. - else if (f_character == "|" and !next_character_is_not_special) - { - if (!inline_colour_stack.empty()) - { - if (inline_colour_stack.top() == INLINE_ORANGE) - { - inline_colour_stack.pop(); - } - else - { - inline_colour_stack.push(INLINE_ORANGE); - } + else if (f_character == "|" and !next_character_is_not_special) { + if (!inline_colour_stack.empty()) { + if (inline_colour_stack.top() == INLINE_ORANGE) { + inline_colour_stack.pop(); } - else - { - inline_colour_stack.push(INLINE_ORANGE); + else { + inline_colour_stack.push(INLINE_ORANGE); } - formatting_char = true; + } + else { + inline_colour_stack.push(INLINE_ORANGE); + } + formatting_char = true; } // Blue inline colourisation. - else if (f_character == "(" and !next_character_is_not_special) - { - inline_colour_stack.push(INLINE_BLUE); - ui_vp_message->insertHtml("" + 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]; - QString f_emote = m_chatmessage[EMOTE]; - ui_vp_player_char->play_idle(f_char, f_emote); - } + else if (f_character == "(" and !next_character_is_not_special) { + inline_colour_stack.push(INLINE_BLUE); + ui_vp_message->insertHtml("" + 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]; + QString f_emote = m_chatmessage[EMOTE]; + ui_vp_player_char->play_idle(f_char, f_emote); + } } - else if (f_character == ")" and !next_character_is_not_special - and !inline_colour_stack.empty()) - { - if (inline_colour_stack.top() == INLINE_BLUE) - { - inline_colour_stack.pop(); - ui_vp_message->insertHtml("" + 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) - { - inline_blue_depth--; - // Here, we check if the entire message is blue. - // If it isn't, we start talking if we have completely climbed out of inline blues. - if (!entire_message_is_blue) - { - // We should only go back to talking if we're out of inline blues, not during a non. int. pre, and not on the last character. - if (inline_blue_depth == 0 and anim_state != 4 and !(tick_pos+1 >= f_message.size())) - { - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_emote = m_chatmessage[EMOTE]; - ui_vp_player_char->play_talking(f_char, f_emote); - } - } + else if (f_character == ")" and !next_character_is_not_special and + !inline_colour_stack.empty()) { + if (inline_colour_stack.top() == INLINE_BLUE) { + inline_colour_stack.pop(); + ui_vp_message->insertHtml("" + 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) { + inline_blue_depth--; + // Here, we check if the entire message is blue. + // If it isn't, we start talking if we have completely climbed out of + // inline blues. + if (!entire_message_is_blue) { + // We should only go back to talking if we're out of inline blues, + // not during a non. int. pre, and not on the last character. + if (inline_blue_depth == 0 and anim_state != 4 and + !(tick_pos + 1 >= f_message.size())) { + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_emote = m_chatmessage[EMOTE]; + ui_vp_player_char->play_talking(f_char, f_emote); } + } } - else - { - next_character_is_not_special = true; - tick_pos -= f_char_length; - } + } + else { + next_character_is_not_special = true; + tick_pos -= f_char_length; + } } // Grey inline colourisation. - else if (f_character == "[" and !next_character_is_not_special) - { - inline_colour_stack.push(INLINE_GREY); - ui_vp_message->insertHtml("" + 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 - { - next_character_is_not_special = true; - tick_pos -= f_char_length; - } + else if (f_character == "[" and !next_character_is_not_special) { + inline_colour_stack.push(INLINE_GREY); + ui_vp_message->insertHtml("" + + 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 { + next_character_is_not_special = true; + tick_pos -= f_char_length; + } } // Green inline colourisation. - else if (f_character == "`" and !next_character_is_not_special) - { - if (!inline_colour_stack.empty()) - { - if (inline_colour_stack.top() == INLINE_GREEN) - { - inline_colour_stack.pop(); - formatting_char = true; - } - else - { - inline_colour_stack.push(INLINE_GREEN); - formatting_char = true; - } + else if (f_character == "`" and !next_character_is_not_special) { + if (!inline_colour_stack.empty()) { + if (inline_colour_stack.top() == INLINE_GREEN) { + inline_colour_stack.pop(); + formatting_char = true; } - else - { - inline_colour_stack.push(INLINE_GREEN); - formatting_char = true; + else { + inline_colour_stack.push(INLINE_GREEN); + formatting_char = true; } + } + else { + inline_colour_stack.push(INLINE_GREEN); + formatting_char = true; + } } - else - { + else { next_character_is_not_special = false; - if (!inline_colour_stack.empty()) - { - switch (inline_colour_stack.top()) { - case INLINE_ORANGE: - ui_vp_message->insertHtml("" + f_character + ""); - break; - case INLINE_BLUE: - ui_vp_message->insertHtml("" + f_character + ""); - break; - case INLINE_GREEN: - ui_vp_message->insertHtml("" + f_character + ""); - break; - case INLINE_GREY: - ui_vp_message->insertHtml("" + f_character + ""); - break; - } + if (!inline_colour_stack.empty()) { + switch (inline_colour_stack.top()) { + case INLINE_ORANGE: + ui_vp_message->insertHtml( + "" + + f_character + ""); + break; + case INLINE_BLUE: + ui_vp_message->insertHtml( + "" + f_character + ""); + break; + case INLINE_GREEN: + ui_vp_message->insertHtml( + "" + f_character + ""); + break; + case INLINE_GREY: + ui_vp_message->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; @@ -2260,33 +2196,30 @@ void Courtroom::chat_tick() ++rainbow_counter; - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml("" + + f_character + ""); } else ui_vp_message->insertHtml(f_character); } - if (message_is_centered) - { - ui_vp_message->setAlignment(Qt::AlignCenter); + if (message_is_centered) { + ui_vp_message->setAlignment(Qt::AlignCenter); } - else - { - ui_vp_message->setAlignment(Qt::AlignLeft); + else { + ui_vp_message->setAlignment(Qt::AlignLeft); } } QScrollBar *scroll = ui_vp_message->verticalScrollBar(); scroll->setValue(scroll->maximum()); - if(blank_blip) + if (blank_blip) qDebug() << "blank_blip found true"; - if (f_character != ' ' || blank_blip) - { + if (f_character != ' ' || blank_blip) { - if (blip_pos % blip_rate == 0 && !formatting_char) - { + if (blip_pos % blip_rate == 0 && !formatting_char) { blip_pos = 0; blip_player->blip_tick(); } @@ -2296,32 +2229,27 @@ void Courtroom::chat_tick() tick_pos += f_char_length; - // Restart the timer, but according to the newly set speeds, if there were any. - // Keep the speed at bay. - if (current_display_speed < 0) - { - current_display_speed = 0; + // Restart the timer, but according to the newly set speeds, if there were + // any. Keep the speed at bay. + if (current_display_speed < 0) { + current_display_speed = 0; } - if (current_display_speed > 6) - { - current_display_speed = 6; + if (current_display_speed > 6) { + current_display_speed = 6; } - // If we had a formatting char, we shouldn't wait so long again, as it won't appear! - if (formatting_char) - { - chat_tick_timer->start(1); + // If we had a formatting char, we shouldn't wait so long again, as it won't + // appear! + if (formatting_char) { + chat_tick_timer->start(1); } - else - { - chat_tick_timer->start(message_display_speed[current_display_speed]); + else { + chat_tick_timer->start(message_display_speed[current_display_speed]); } - } } - void Courtroom::show_testimony() { if (!testimony_in_progress || m_chatmessage[SIDE] != "wit") @@ -2357,57 +2285,51 @@ void Courtroom::set_scene() if (testimony_in_progress) show_testimony(); - //witness is default if pos is invalid + // witness is default if pos is invalid QString f_background = "witnessempty"; QString f_desk_image = "stand"; QString f_desk_mod = m_chatmessage[DESK_MOD]; QString f_side = m_chatmessage[SIDE]; - if (f_side == "def") - { + if (f_side == "def") { f_background = "defenseempty"; if (is_ao2_bg) f_desk_image = "defensedesk"; else f_desk_image = "bancodefensa"; } - else if (f_side == "pro") - { + else if (f_side == "pro") { f_background = "prosecutorempty"; if (is_ao2_bg) f_desk_image = "prosecutiondesk"; else f_desk_image = "bancoacusacion"; } - else if (f_side == "jud") - { + else if (f_side == "jud") { f_background = "judgestand"; f_desk_image = "judgedesk"; } - else if (f_side == "hld") - { + else if (f_side == "hld") { f_background = "helperstand"; f_desk_image = "helperdesk"; } - else if (f_side == "hlp") - { + else if (f_side == "hlp") { f_background = "prohelperstand"; f_desk_image = "prohelperdesk"; } - else if (f_side == "jur" && (file_exists(ao_app->get_background_path("jurystand.png")) || - file_exists(ao_app->get_background_path("jurystand.gif")))) - { + else if (f_side == "jur" && + (file_exists(ao_app->get_background_path("jurystand.png")) || + file_exists(ao_app->get_background_path("jurystand.gif")))) { f_background = "jurystand"; f_desk_image = "jurydesk"; } - else if (f_side == "sea" && (file_exists(ao_app->get_background_path("seancestand.png")) || - file_exists(ao_app->get_background_path("seancestand.gif")))) - { + else if (f_side == "sea" && + (file_exists(ao_app->get_background_path("seancestand.png")) || + file_exists(ao_app->get_background_path("seancestand.gif")))) { f_background = "seancestand"; f_desk_image = "seancedesk"; } - else - { + else { if (is_ao2_bg) f_desk_image = "stand"; else @@ -2418,30 +2340,23 @@ void Courtroom::set_scene() ui_vp_desk->set_image(f_desk_image); ui_vp_legacy_desk->set_legacy_desk(f_desk_image); - if (f_desk_mod == "0" || (f_desk_mod != "1" && - (f_side == "jud" || - f_side == "hld" || - f_side == "hlp"))) - { + if (f_desk_mod == "0" || + (f_desk_mod != "1" && + (f_side == "jud" || f_side == "hld" || f_side == "hlp"))) { ui_vp_desk->hide(); ui_vp_legacy_desk->hide(); } - else if (is_ao2_bg || (f_side == "jud" || - f_side == "hld" || - f_side == "hlp")) - { + else if (is_ao2_bg || + (f_side == "jud" || f_side == "hld" || f_side == "hlp")) { ui_vp_legacy_desk->hide(); ui_vp_desk->show(); } - else - { - if (f_side == "wit") - { + else { + if (f_side == "wit") { ui_vp_desk->show(); ui_vp_legacy_desk->hide(); } - else - { + else { ui_vp_desk->hide(); ui_vp_legacy_desk->show(); } @@ -2450,9 +2365,10 @@ void Courtroom::set_scene() void Courtroom::set_text_color() { - QColor textcolor = ao_app->get_chat_color(m_chatmessage[TEXT_COLOR], ao_app->get_chat(m_chatmessage[CHAR_NAME])); + QColor textcolor = ao_app->get_chat_color( + m_chatmessage[TEXT_COLOR], ao_app->get_chat(m_chatmessage[CHAR_NAME])); - ui_vp_message->setTextBackgroundColor(QColor(0,0,0,0)); + ui_vp_message->setTextBackgroundColor(QColor(0, 0, 0, 0)); ui_vp_message->setTextColor(textcolor); QString style = "background-color: rgba(0, 0, 0, 0);"; @@ -2469,7 +2385,8 @@ void Courtroom::set_text_color() QColor Courtroom::get_text_color(QString color) { - return ao_app->get_chat_color(color, ao_app->get_chat(m_chatmessage[CHAR_NAME])); + return ao_app->get_chat_color(color, + ao_app->get_chat(m_chatmessage[CHAR_NAME])); } void Courtroom::set_ip_list(QString p_list) @@ -2486,8 +2403,7 @@ void Courtroom::set_mute(bool p_muted, int p_cid) if (p_muted) ui_muted->show(); - else - { + else { ui_muted->hide(); ui_ic_chat_message->setFocus(); } @@ -2522,27 +2438,23 @@ void Courtroom::handle_song(QStringList *p_contents) f_song_clear = f_song_clear.left(f_song_clear.lastIndexOf(".")); int n_char = f_contents.at(1).toInt(); - if (n_char < 0 || n_char >= char_list.size()) - { + if (n_char < 0 || n_char >= char_list.size()) { music_player->play(f_song); } - else - { + else { QString str_char = char_list.at(n_char).name; QString str_show = char_list.at(n_char).name; - if (p_contents->length() > 2) - { - str_show = p_contents->at(2); + if (p_contents->length() > 2) { + str_show = p_contents->at(2); } - if (!mute_map.value(n_char)) - { - chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true); + if (!mute_map.value(n_char)) { + chatlogpiece *temp = new chatlogpiece(str_char, str_show, f_song, true); ic_chatlog_history.append(*temp); - while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) - { + while (ic_chatlog_history.size() > log_maximum_blocks && + log_maximum_blocks > 0) { ic_chatlog_history.removeFirst(); } @@ -2556,33 +2468,29 @@ void Courtroom::handle_wtce(QString p_wtce, int variant) { QString sfx_file = "courtroom_sounds.ini"; - //witness testimony - if (p_wtce == "testimony1") - { + // witness testimony + if (p_wtce == "testimony1") { sfx_player->play(ao_app->get_sfx("witness_testimony")); ui_vp_wtce->play("witnesstestimony"); testimony_in_progress = true; show_testimony(); } - //cross examination - else if (p_wtce == "testimony2") - { + // cross examination + else if (p_wtce == "testimony2") { sfx_player->play(ao_app->get_sfx("cross_examination")); ui_vp_wtce->play("crossexamination"); testimony_in_progress = false; } - else if (p_wtce == "judgeruling") - { - if (variant == 0) - { - sfx_player->play(ao_app->get_sfx("not_guilty")); - ui_vp_wtce->play("notguilty"); - testimony_in_progress = false; + else if (p_wtce == "judgeruling") { + if (variant == 0) { + sfx_player->play(ao_app->get_sfx("not_guilty")); + ui_vp_wtce->play("notguilty"); + testimony_in_progress = false; } else if (variant == 1) { - sfx_player->play(ao_app->get_sfx("guilty")); - ui_vp_wtce->play("guilty"); - testimony_in_progress = false; + sfx_player->play(ao_app->get_sfx("guilty")); + ui_vp_wtce->play("guilty"); + testimony_in_progress = false; } } } @@ -2592,22 +2500,20 @@ void Courtroom::set_hp_bar(int p_bar, int p_state) if (p_state < 0 || p_state > 10) return; - if (p_bar == 1) - { + if (p_bar == 1) { ui_defense_bar->set_image("defensebar" + QString::number(p_state) + ".png"); defense_bar_state = p_state; } - else if (p_bar == 2) - { - ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state) + ".png"); + else if (p_bar == 2) { + ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state) + + ".png"); prosecution_bar_state = p_state; } } void Courtroom::toggle_judge_buttons(bool is_on) { - if (is_on) - { + if (is_on) { ui_witness_testimony->show(); ui_cross_examination->show(); ui_guilty->show(); @@ -2617,8 +2523,7 @@ void Courtroom::toggle_judge_buttons(bool is_on) ui_prosecution_minus->show(); ui_prosecution_plus->show(); } - else - { + else { ui_witness_testimony->hide(); ui_cross_examination->hide(); ui_guilty->hide(); @@ -2633,26 +2538,24 @@ void Courtroom::toggle_judge_buttons(bool is_on) void Courtroom::mod_called(QString p_ip) { ui_server_chatlog->append(p_ip); - if (ui_guard->isChecked()) - { + if (ui_guard->isChecked()) { modcall_player->play(ao_app->get_sfx("mod_call")); ao_app->alert(this); } } -void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno) +void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, + bool steno) { - if (ui_casing->isChecked()) - { + if (ui_casing->isChecked()) { ui_server_chatlog->append(msg); if ((ao_app->get_casing_defence_enabled() && def) || (ao_app->get_casing_prosecution_enabled() && pro) || (ao_app->get_casing_judge_enabled() && jud) || (ao_app->get_casing_juror_enabled() && jur) || - (ao_app->get_casing_steno_enabled() && steno)) - { - modcall_player->play(ao_app->get_sfx("case_call")); - ao_app->alert(this); + (ao_app->get_casing_steno_enabled() && steno)) { + modcall_player->play(ao_app->get_sfx("case_call")); + ao_app->alert(this); } } } @@ -2664,104 +2567,100 @@ void Courtroom::on_ooc_return_pressed() if (ooc_message == "" || ui_ooc_chat_name->text() == "") return; - if (ooc_message.startsWith("/pos")) - { - if (ooc_message == "/pos jud") - { + if (ooc_message.startsWith("/pos")) { + if (ooc_message == "/pos jud") { toggle_judge_buttons(true); } - else - { + else { toggle_judge_buttons(false); } } - else if (ooc_message.startsWith("/login")) - { + else if (ooc_message.startsWith("/login")) { ui_guard->show(); - append_server_chatmessage("CLIENT", "You were granted the Guard button.", "1"); + append_server_chatmessage("CLIENT", "You were granted the Guard button.", + "1"); } - else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended) - { - //ui_text_color->addItem("Rainbow"); + else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && + !rainbow_appended) { + // ui_text_color->addItem("Rainbow"); ui_ooc_chat_message->clear(); - //rainbow_appended = true; - append_server_chatmessage("CLIENT", "This does nohing, but there you go.", "1"); + // rainbow_appended = true; + append_server_chatmessage("CLIENT", "This does nohing, but there you go.", + "1"); return; } - else if (ooc_message.startsWith("/settings")) - { + else if (ooc_message.startsWith("/settings")) { ui_ooc_chat_message->clear(); ao_app->call_settings_menu(); append_server_chatmessage("CLIENT", "You opened the settings menu.", "1"); return; } - else if (ooc_message.startsWith("/pair")) - { + else if (ooc_message.startsWith("/pair")) { ui_ooc_chat_message->clear(); - ooc_message.remove(0,6); - + ooc_message.remove(0, 6); + bool ok; int whom = ooc_message.toInt(&ok); - if (ok) - { - if (whom > -1) - { + if (ok) { + if (whom > -1) { other_charid = whom; QString msg = "You will now pair up with "; msg.append(char_list.at(whom).name); msg.append(" if they also choose your character in return."); append_server_chatmessage("CLIENT", msg, "1"); } - else - { + else { other_charid = -1; - append_server_chatmessage("CLIENT", "You are no longer paired with anyone.", "1"); + append_server_chatmessage("CLIENT", + "You are no longer paired with anyone.", "1"); } } - else - { - append_server_chatmessage("CLIENT", "Are you sure you typed that well? The char ID could not be recognised.", "1"); + else { + append_server_chatmessage("CLIENT", + "Are you sure you typed that well? The char ID " + "could not be recognised.", + "1"); } return; } - else if (ooc_message.startsWith("/offset")) - { + else if (ooc_message.startsWith("/offset")) { ui_ooc_chat_message->clear(); - ooc_message.remove(0,8); - + ooc_message.remove(0, 8); + bool ok; int off = ooc_message.toInt(&ok); - if (ok) - { - if (off >= -100 && off <= 100) - { + if (ok) { + if (off >= -100 && off <= 100) { offset_with_pair = off; QString msg = "You have set your offset to "; msg.append(QString::number(off)); msg.append("%."); append_server_chatmessage("CLIENT", msg, "1"); } - else - { - append_server_chatmessage("CLIENT", "Your offset must be between -100% and 100%!", "1"); + else { + append_server_chatmessage( + "CLIENT", "Your offset must be between -100% and 100%!", "1"); } } - else - { - append_server_chatmessage("CLIENT", "That offset does not look like one.", "1"); + else { + append_server_chatmessage("CLIENT", "That offset does not look like one.", + "1"); } return; } - else if (ooc_message.startsWith("/switch_am")) - { - append_server_chatmessage("CLIENT", "You switched your music and area list.", "1"); - on_switch_area_music_clicked(); - ui_ooc_chat_message->clear(); - return; + else if (ooc_message.startsWith("/switch_am")) { + append_server_chatmessage("CLIENT", + "You switched your music and area list.", "1"); + on_switch_area_music_clicked(); + ui_ooc_chat_message->clear(); + return; } - else if (ooc_message.startsWith("/enable_blocks")) - { - append_server_chatmessage("CLIENT", "You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this.", "1"); + else if (ooc_message.startsWith("/enable_blocks")) { + append_server_chatmessage( + "CLIENT", + "You have forcefully enabled features that the server may not support. " + "You may not be able to talk IC, or worse, because of this.", + "1"); ao_app->cccc_ic_support_enabled = true; ao_app->arup_enabled = true; ao_app->modcall_reason_enabled = true; @@ -2769,23 +2668,24 @@ void Courtroom::on_ooc_return_pressed() ui_ooc_chat_message->clear(); return; } - else if (ooc_message.startsWith("/non_int_pre")) - { + else if (ooc_message.startsWith("/non_int_pre")) { if (ui_pre_non_interrupt->isChecked()) - append_server_chatmessage("CLIENT", "Your pre-animations interrupt again.", "1"); + append_server_chatmessage("CLIENT", + "Your pre-animations interrupt again.", "1"); else - append_server_chatmessage("CLIENT", "Your pre-animations will not interrupt text.", "1"); + append_server_chatmessage( + "CLIENT", "Your pre-animations will not interrupt text.", "1"); ui_pre_non_interrupt->setChecked(!ui_pre_non_interrupt->isChecked()); ui_ooc_chat_message->clear(); return; } - else if (ooc_message.startsWith("/save_chatlog")) - { + else if (ooc_message.startsWith("/save_chatlog")) { QFile file("chatlog.txt"); - if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) - { - append_server_chatmessage("CLIENT", "Couldn't open chatlog.txt to write into.", "1"); + if (!file.open(QIODevice::WriteOnly | QIODevice::Text | + QIODevice::Truncate)) { + append_server_chatmessage( + "CLIENT", "Couldn't open chatlog.txt to write into.", "1"); ui_ooc_chat_message->clear(); return; } @@ -2793,8 +2693,8 @@ void Courtroom::on_ooc_return_pressed() QTextStream out(&file); foreach (chatlogpiece item, ic_chatlog_history) { - out << item.get_full() << '\n'; - } + out << item.get_full() << '\n'; + } file.close(); @@ -2802,39 +2702,49 @@ void Courtroom::on_ooc_return_pressed() ui_ooc_chat_message->clear(); return; } - else if (ooc_message.startsWith("/load_case")) - { + else if (ooc_message.startsWith("/load_case")) { QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); QDir casefolder("base/cases"); - if (!casefolder.exists()) - { - QDir::current().mkdir("base/" + casefolder.dirName()); - append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there.", "1"); - ui_ooc_chat_message->clear(); - return; + if (!casefolder.exists()) { + QDir::current().mkdir("base/" + casefolder.dirName()); + append_server_chatmessage( + "CLIENT", + "You don't have a `base/cases/` folder! It was just made for you, " + "but seeing as it WAS just made for you, it's likely the case file " + "you're looking for can't be found in there.", + "1"); + ui_ooc_chat_message->clear(); + return; } QStringList caseslist = casefolder.entryList(); caseslist.removeOne("."); caseslist.removeOne(".."); - caseslist.replaceInStrings(".ini",""); - - if (command.size() < 2) - { - append_server_chatmessage("CLIENT", "You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini.\nCases you can load: " + caseslist.join(", "), "1"); + caseslist.replaceInStrings(".ini", ""); + + if (command.size() < 2) { + append_server_chatmessage( + "CLIENT", + "You need to give a filename to load (extension not needed)! Make " + "sure that it is in the `base/cases/` folder, and that it is a " + "correctly formatted ini.\nCases you can load: " + + caseslist.join(", "), + "1"); ui_ooc_chat_message->clear(); return; } - - if (command.size() > 2) - { - append_server_chatmessage("CLIENT", "Too many arguments to load a case! You only need one filename, without extension.", "1"); + if (command.size() > 2) { + append_server_chatmessage("CLIENT", + "Too many arguments to load a case! You only " + "need one filename, without extension.", + "1"); ui_ooc_chat_message->clear(); return; } - QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat); + QSettings casefile("base/cases/" + command[1] + ".ini", + QSettings::IniFormat); QString caseauth = casefile.value("author", "").value(); QString casedoc = casefile.value("doc", "").value(); @@ -2842,88 +2752,108 @@ void Courtroom::on_ooc_return_pressed() QString casestatus = casefile.value("status", "").value(); if (!caseauth.isEmpty()) - append_server_chatmessage("CLIENT", "Case made by " + caseauth + ".", "1"); + append_server_chatmessage("CLIENT", "Case made by " + caseauth + ".", + "1"); if (!casedoc.isEmpty()) - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/doc " + casedoc + "#%")); + ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + + "#/doc " + casedoc + "#%")); if (!casestatus.isEmpty()) - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/status " + casestatus + "#%")); + ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + + "#/status " + casestatus + "#%")); if (!cmdoc.isEmpty()) - append_server_chatmessage("CLIENT", "Navigate to " + cmdoc + " for the CM doc.", "1"); + append_server_chatmessage( + "CLIENT", "Navigate to " + cmdoc + " for the CM doc.", "1"); for (int i = local_evidence_list.size() - 1; i >= 0; i--) { - ao_app->send_server_packet(new AOPacket("DE#" + QString::number(i) + "#%")); + ao_app->send_server_packet( + new AOPacket("DE#" + QString::number(i) + "#%")); } foreach (QString evi, casefile.childGroups()) { - if (evi == "General") - continue; + if (evi == "General") + continue; - QStringList f_contents; + QStringList f_contents; - f_contents.append(casefile.value(evi + "/name", "UNKNOWN").value()); - f_contents.append(casefile.value(evi + "/description", "UNKNOWN").value()); - f_contents.append(casefile.value(evi + "/image", "UNKNOWN.png").value()); + 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)); - } + ao_app->send_server_packet(new AOPacket("PE", f_contents)); + } - append_server_chatmessage("CLIENT", "Your case \"" + command[1] + "\" was loaded!", "1"); + append_server_chatmessage( + "CLIENT", "Your case \"" + command[1] + "\" was loaded!", "1"); ui_ooc_chat_message->clear(); return; } - else if(ooc_message.startsWith("/save_case")) - { - QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); - - QDir casefolder("base/cases"); - if (!casefolder.exists()) - { - QDir::current().mkdir("base/" + casefolder.dirName()); - append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it.", "1"); - ui_ooc_chat_message->clear(); - return; - } - QStringList caseslist = casefolder.entryList(); - caseslist.removeOne("."); - caseslist.removeOne(".."); - caseslist.replaceInStrings(".ini",""); - - if (command.size() < 3) - { - append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!", "1"); - ui_ooc_chat_message->clear(); - return; - } - + else if (ooc_message.startsWith("/save_case")) { + QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); - if (command.size() > 3) - { - append_server_chatmessage("CLIENT", "Too many arguments to save a case! You only need a filename without extension and the courtroom status!", "1"); - ui_ooc_chat_message->clear(); - return; - } - QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat); - casefile.setValue("author",ui_ooc_chat_name->text()); - casefile.setValue("cmdoc",""); - casefile.setValue("doc", ""); - casefile.setValue("status",command[2]); - casefile.sync(); - for(int i = local_evidence_list.size() - 1; i >= 0; i--) - { - QString clean_evidence_dsc = local_evidence_list[i].description.replace(QRegularExpression("..."), ""); - clean_evidence_dsc = clean_evidence_dsc.replace(clean_evidence_dsc.lastIndexOf(">"), 1, ""); - casefile.beginGroup(QString::number(i)); - casefile.sync(); - casefile.setValue("name",local_evidence_list[i].name); - casefile.setValue("description",local_evidence_list[i].description); - casefile.setValue("image",local_evidence_list[i].image); - casefile.endGroup(); - } - casefile.sync(); - append_server_chatmessage("CLIENT", "Succesfully saved, edit doc and cmdoc link on the ini!", "1"); + QDir casefolder("base/cases"); + if (!casefolder.exists()) { + QDir::current().mkdir("base/" + casefolder.dirName()); + append_server_chatmessage( + "CLIENT", + "You don't have a `base/cases/` folder! It was just made for you, " + "but seeing as it WAS just made for you, it's likely that you " + "somehow deleted it.", + "1"); + ui_ooc_chat_message->clear(); + return; + } + QStringList caseslist = casefolder.entryList(); + caseslist.removeOne("."); + caseslist.removeOne(".."); + caseslist.replaceInStrings(".ini", ""); + + if (command.size() < 3) { + append_server_chatmessage( + "CLIENT", + "You need to give a filename to save (extension not needed) and the " + "courtroom status!", + "1"); ui_ooc_chat_message->clear(); return; + } + if (command.size() > 3) { + append_server_chatmessage( + "CLIENT", + "Too many arguments to save a case! You only need a filename without " + "extension and the courtroom status!", + "1"); + ui_ooc_chat_message->clear(); + return; + } + QSettings casefile("base/cases/" + command[1] + ".ini", + QSettings::IniFormat); + casefile.setValue("author", ui_ooc_chat_name->text()); + casefile.setValue("cmdoc", ""); + casefile.setValue("doc", ""); + casefile.setValue("status", command[2]); + casefile.sync(); + for (int i = local_evidence_list.size() - 1; i >= 0; i--) { + QString clean_evidence_dsc = local_evidence_list[i].description.replace( + QRegularExpression("..."), ""); + clean_evidence_dsc = clean_evidence_dsc.replace( + clean_evidence_dsc.lastIndexOf(">"), 1, ""); + casefile.beginGroup(QString::number(i)); + casefile.sync(); + casefile.setValue("name", local_evidence_list[i].name); + casefile.setValue("description", local_evidence_list[i].description); + casefile.setValue("image", local_evidence_list[i].image); + casefile.endGroup(); + } + casefile.sync(); + append_server_chatmessage( + "CLIENT", "Succesfully saved, edit doc and cmdoc link on the ini!", + "1"); + ui_ooc_chat_message->clear(); + return; } QStringList packet_contents; @@ -2944,16 +2874,14 @@ void Courtroom::on_ooc_return_pressed() void Courtroom::on_ooc_toggle_clicked() { - if (server_ooc) - { + if (server_ooc) { ui_ms_chatlog->show(); ui_server_chatlog->hide(); ui_ooc_toggle->setText("Master"); server_ooc = false; } - else - { + else { ui_ms_chatlog->hide(); ui_server_chatlog->show(); ui_ooc_toggle->setText("Server"); @@ -2964,7 +2892,7 @@ void Courtroom::on_ooc_toggle_clicked() void Courtroom::on_music_search_edited(QString p_text) { - //preventing compiler warnings + // preventing compiler warnings p_text += "a"; list_music(); list_areas(); @@ -2981,8 +2909,7 @@ void Courtroom::on_pos_dropdown_changed(int p_index) QString f_pos; - switch (p_index) - { + switch (p_index) { case 0: f_pos = "wit"; break; @@ -3009,7 +2936,8 @@ void Courtroom::on_pos_dropdown_changed(int p_index) if (f_pos == "" || ui_ooc_chat_name->text() == "") return; - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/pos " + f_pos + "#%")); + ao_app->send_server_packet( + new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/pos " + f_pos + "#%")); } void Courtroom::on_mute_list_clicked(QModelIndex p_index) @@ -3025,25 +2953,21 @@ void Courtroom::on_mute_list_clicked(QModelIndex p_index) int f_cid = -1; - for (int n_char = 0 ; n_char < char_list.size() ; n_char++) - { + for (int n_char = 0; n_char < char_list.size(); n_char++) { if (char_list.at(n_char).name == real_char) f_cid = n_char; } - if (f_cid < 0 || f_cid >= char_list.size()) - { + if (f_cid < 0 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; return; } - if (mute_map.value(f_cid)) - { + if (mute_map.value(f_cid)) { mute_map.insert(f_cid, false); f_item->setText(real_char); } - else - { + else { mute_map.insert(f_cid, true); f_item->setText(real_char + " [x]"); } @@ -3056,26 +2980,19 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) QString real_char; int f_cid = -1; - if (f_char.endsWith(" [x]")) - { + if (f_char.endsWith(" [x]")) { real_char = f_char.left(f_char.size() - 4); f_item->setText(real_char); } - else - { - real_char = f_char; - for (int n_char = 0 ; n_char < char_list.size() ; n_char++) - { - if (char_list.at(n_char).name == real_char) - f_cid = n_char; - } + else { + real_char = f_char; + for (int n_char = 0; n_char < char_list.size(); n_char++) { + if (char_list.at(n_char).name == real_char) + f_cid = n_char; + } } - - - - if (f_cid < -2 || f_cid >= char_list.size()) - { + if (f_cid < -2 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; return; } @@ -3093,9 +3010,8 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) for (int i = 0; i < ui_pair_list->count(); i++) { ui_pair_list->item(i)->setText(sorted_pair_list.at(i)); } - if(other_charid != -1) - { - f_item->setText(real_char + " [x]"); + if (other_charid != -1) { + f_item->setText(real_char + " [x]"); } } @@ -3106,31 +3022,34 @@ void Courtroom::on_music_list_double_clicked(QModelIndex p_model) QString p_song = music_list.at(music_row_to_number.at(p_model.row())); - if (!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) - { - ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#" + ui_ic_chat_name->text() + "#%"), false); + if (!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) { + ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + + QString::number(m_cid) + "#" + + ui_ic_chat_name->text() + "#%"), + false); } - else - { - ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), false); + else { + ao_app->send_server_packet( + new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), + false); } } void Courtroom::on_area_list_double_clicked(QModelIndex p_model) { - QString p_area = area_list.at(area_row_to_number.at(p_model.row())); - ao_app->send_server_packet(new AOPacket("MC#" + p_area + "#" + QString::number(m_cid) + "#%"), false); + QString p_area = area_list.at(area_row_to_number.at(p_model.row())); + ao_app->send_server_packet( + new AOPacket("MC#" + p_area + "#" + QString::number(m_cid) + "#%"), + false); } void Courtroom::on_hold_it_clicked() { - if (objection_state == 1) - { + if (objection_state == 1) { ui_hold_it->set_image("holdit.png"); objection_state = 0; } - else - { + else { ui_objection->set_image("objection.png"); ui_take_that->set_image("takethat.png"); ui_custom_objection->set_image("custom.png"); @@ -3144,13 +3063,11 @@ void Courtroom::on_hold_it_clicked() void Courtroom::on_objection_clicked() { - if (objection_state == 2) - { + if (objection_state == 2) { ui_objection->set_image("objection.png"); objection_state = 0; } - else - { + else { ui_hold_it->set_image("holdit.png"); ui_take_that->set_image("takethat.png"); ui_custom_objection->set_image("custom.png"); @@ -3164,13 +3081,11 @@ void Courtroom::on_objection_clicked() void Courtroom::on_take_that_clicked() { - if (objection_state == 3) - { + if (objection_state == 3) { ui_take_that->set_image("takethat.png"); objection_state = 0; } - else - { + else { ui_objection->set_image("objection.png"); ui_hold_it->set_image("holdit.png"); ui_custom_objection->set_image("custom.png"); @@ -3184,13 +3099,11 @@ void Courtroom::on_take_that_clicked() void Courtroom::on_custom_objection_clicked() { - if (objection_state == 4) - { + if (objection_state == 4) { ui_custom_objection->set_image("custom.png"); objection_state = 0; } - else - { + else { ui_objection->set_image("objection.png"); ui_take_that->set_image("takethat.png"); ui_hold_it->set_image("holdit.png"); @@ -3204,13 +3117,11 @@ void Courtroom::on_custom_objection_clicked() void Courtroom::on_realization_clicked() { - if (realization_state == 0) - { + if (realization_state == 0) { realization_state = 1; ui_realization->set_image("realization_pressed.png"); } - else - { + else { realization_state = 0; ui_realization->set_image("realization.png"); } @@ -3220,16 +3131,14 @@ void Courtroom::on_realization_clicked() void Courtroom::on_mute_clicked() { - if (ui_mute_list->isHidden()) - { + if (ui_mute_list->isHidden()) { ui_mute_list->show(); ui_pair_list->hide(); ui_pair_offset_spinbox->hide(); ui_pair_button->set_image("pair_button.png"); ui_mute->set_image("mute_pressed.png"); } - else - { + else { ui_mute_list->hide(); ui_mute->set_image("mute.png"); } @@ -3237,16 +3146,14 @@ void Courtroom::on_mute_clicked() void Courtroom::on_pair_clicked() { - if (ui_pair_list->isHidden()) - { + if (ui_pair_list->isHidden()) { ui_pair_list->show(); ui_pair_offset_spinbox->show(); ui_mute_list->hide(); ui_mute->set_image("mute.png"); ui_pair_button->set_image("pair_button_pressed.png"); } - else - { + else { ui_pair_list->hide(); ui_pair_offset_spinbox->hide(); ui_pair_button->set_image("pair_button.png"); @@ -3258,7 +3165,8 @@ void Courtroom::on_defense_minus_clicked() int f_state = defense_bar_state - 1; if (f_state >= 0) - ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%")); + ao_app->send_server_packet( + new AOPacket("HP#1#" + QString::number(f_state) + "#%")); } void Courtroom::on_defense_plus_clicked() @@ -3266,7 +3174,8 @@ void Courtroom::on_defense_plus_clicked() int f_state = defense_bar_state + 1; if (f_state <= 10) - ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%")); + ao_app->send_server_packet( + new AOPacket("HP#1#" + QString::number(f_state) + "#%")); } void Courtroom::on_prosecution_minus_clicked() @@ -3274,7 +3183,8 @@ void Courtroom::on_prosecution_minus_clicked() int f_state = prosecution_bar_state - 1; if (f_state >= 0) - ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%")); + ao_app->send_server_packet( + new AOPacket("HP#2#" + QString::number(f_state) + "#%")); } void Courtroom::on_prosecution_plus_clicked() @@ -3282,7 +3192,8 @@ void Courtroom::on_prosecution_plus_clicked() int f_state = prosecution_bar_state + 1; if (f_state <= 10) - ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%")); + ao_app->send_server_packet( + new AOPacket("HP#2#" + QString::number(f_state) + "#%")); } void Courtroom::on_text_color_changed(int p_color) @@ -3310,15 +3221,9 @@ void Courtroom::on_blip_slider_moved(int p_value) ui_ic_chat_message->setFocus(); } -void Courtroom::on_log_limit_changed(int value) -{ - log_maximum_blocks = value; -} +void Courtroom::on_log_limit_changed(int value) { log_maximum_blocks = value; } -void Courtroom::on_pair_offset_changed(int value) -{ - offset_with_pair = value; -} +void Courtroom::on_pair_offset_changed(int value) { offset_with_pair = value; } void Courtroom::on_witness_testimony_clicked() { @@ -3374,10 +3279,10 @@ void Courtroom::on_change_character_clicked() } void Courtroom::on_reload_theme_clicked() -{ +{ ao_app->reload_theme(); - //to update status on the background + // to update status on the background set_background(current_background); enter_courtroom(m_cid); @@ -3430,7 +3335,8 @@ void Courtroom::on_call_mod_clicked() if (text.isEmpty()) { errorBox.critical(nullptr, "Error", "You must provide a reason."); return; - } else if (text.length() > 256) { + } + else if (text.length() > 256) { errorBox.critical(nullptr, "Error", "The message is too long."); return; } @@ -3439,37 +3345,26 @@ void Courtroom::on_call_mod_clicked() mod_reason.append(text); ao_app->send_server_packet(new AOPacket("ZZ", mod_reason)); - } else { + } + else { ao_app->send_server_packet(new AOPacket("ZZ#%")); } ui_ic_chat_message->setFocus(); } -void Courtroom::on_settings_clicked() -{ - ao_app->call_settings_menu(); -} +void Courtroom::on_settings_clicked() { ao_app->call_settings_menu(); } void Courtroom::on_announce_casing_clicked() { - ao_app->call_announce_menu(this); + ao_app->call_announce_menu(this); } -void Courtroom::on_pre_clicked() -{ - ui_ic_chat_message->setFocus(); -} +void Courtroom::on_pre_clicked() { ui_ic_chat_message->setFocus(); } -void Courtroom::on_flip_clicked() -{ - ui_ic_chat_message->setFocus(); -} +void Courtroom::on_flip_clicked() { ui_ic_chat_message->setFocus(); } -void Courtroom::on_guard_clicked() -{ - ui_ic_chat_message->setFocus(); -} +void Courtroom::on_guard_clicked() { ui_ic_chat_message->setFocus(); } void Courtroom::on_showname_enable_clicked() { @@ -3477,69 +3372,63 @@ void Courtroom::on_showname_enable_clicked() first_message_sent = false; foreach (chatlogpiece item, ic_chatlog_history) { - if (ui_showname_enable->isChecked()) - { - if (item.get_is_song()) - append_ic_text(item.get_message(), item.get_showname(), true); - else - append_ic_text(item.get_message(), item.get_showname()); - } + if (ui_showname_enable->isChecked()) { + if (item.get_is_song()) + append_ic_text(item.get_message(), item.get_showname(), true); else - { - if (item.get_is_song()) - append_ic_text(item.get_message(), item.get_name(), true); - else - append_ic_text(item.get_message(), item.get_name()); - } + append_ic_text(item.get_message(), item.get_showname()); } + else { + if (item.get_is_song()) + append_ic_text(item.get_message(), item.get_name(), true); + else + append_ic_text(item.get_message(), item.get_name()); + } + } ui_ic_chat_message->setFocus(); } void Courtroom::on_evidence_button_clicked() { - if (ui_evidence->isHidden()) - { + if (ui_evidence->isHidden()) { ui_evidence->show(); ui_evidence_overlay->hide(); } - else - { + else { ui_evidence->hide(); } } void Courtroom::on_switch_area_music_clicked() { - if (ui_area_list->isHidden()) - { - ui_area_list->show(); - ui_music_list->hide(); - } - else - { - ui_area_list->hide(); - ui_music_list->show(); - } + if (ui_area_list->isHidden()) { + ui_area_list->show(); + ui_music_list->hide(); + } + else { + ui_area_list->hide(); + ui_music_list->show(); + } } void Courtroom::ping_server() { - ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%")); + ao_app->send_server_packet( + new AOPacket("CH#" + QString::number(m_cid) + "#%")); } void Courtroom::on_casing_clicked() { - if (ao_app->casing_alerts_enabled) - { - if (ui_casing->isChecked()) - { + if (ao_app->casing_alerts_enabled) { + if (ui_casing->isChecked()) { QStringList f_packet; f_packet.append(ao_app->get_casing_can_host_cases()); f_packet.append(QString::number(ao_app->get_casing_cm_enabled())); f_packet.append(QString::number(ao_app->get_casing_defence_enabled())); - f_packet.append(QString::number(ao_app->get_casing_prosecution_enabled())); + f_packet.append( + QString::number(ao_app->get_casing_prosecution_enabled())); f_packet.append(QString::number(ao_app->get_casing_judge_enabled())); f_packet.append(QString::number(ao_app->get_casing_juror_enabled())); f_packet.append(QString::number(ao_app->get_casing_steno_enabled())); @@ -3551,10 +3440,10 @@ void Courtroom::on_casing_clicked() } } -void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno) +void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, + bool jur, bool steno) { - if (ao_app->casing_alerts_enabled) - { + if (ao_app->casing_alerts_enabled) { QStringList f_packet; f_packet.append(title); @@ -3565,7 +3454,7 @@ void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool f_packet.append(QString::number(steno)); ao_app->send_server_packet(new AOPacket("CASEA", f_packet)); - } + } } Courtroom::~Courtroom() @@ -3576,29 +3465,29 @@ Courtroom::~Courtroom() delete blip_player; } - -#if (defined (_WIN32) || defined (_WIN64)) +#if (defined(_WIN32) || defined(_WIN64)) void Courtroom::load_bass_opus_plugin() { - #ifdef BASSAUDIO +#ifdef BASSAUDIO BASS_PluginLoad("bassopus.dll", 0); - #endif +#endif } -#elif (defined (LINUX) || defined (__linux__)) +#elif (defined(LINUX) || defined(__linux__)) void Courtroom::load_bass_opus_plugin() { - #ifdef BASSAUDIO +#ifdef BASSAUDIO BASS_PluginLoad("libbassopus.so", 0); - #endif +#endif } #elif defined __APPLE__ void Courtroom::load_bass_opus_plugin() { - QString libpath = ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib"; + QString libpath = + ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib"; QByteArray ba = libpath.toLocal8Bit(); - #ifdef BASSAUDIO +#ifdef BASSAUDIO BASS_PluginLoad(ba.data(), 0); - #endif +#endif } #else #error This operating system is unsupported for bass plugins. diff --git a/src/debug_functions.cpp b/src/debug_functions.cpp index 77f2f35a..f33a2c65 100644 --- a/src/debug_functions.cpp +++ b/src/debug_functions.cpp @@ -7,8 +7,7 @@ void call_error(QString p_message) msgBox->setText("Error: " + p_message); msgBox->setWindowTitle("Error"); - - //msgBox->setWindowModality(Qt::NonModal); + // msgBox->setWindowModality(Qt::NonModal); msgBox->exec(); } @@ -19,7 +18,6 @@ void call_notice(QString p_message) msgBox->setText(p_message); msgBox->setWindowTitle("Notice"); - - //msgBox->setWindowModality(Qt::NonModal); + // msgBox->setWindowModality(Qt::NonModal); msgBox->exec(); } diff --git a/src/discord_rich_presence.cpp b/src/discord_rich_presence.cpp index 95a824a1..aea07e5e 100644 --- a/src/discord_rich_presence.cpp +++ b/src/discord_rich_presence.cpp @@ -8,23 +8,18 @@ Discord::Discord() DiscordEventHandlers handlers; std::memset(&handlers, 0, sizeof(handlers)); handlers = {}; - handlers.ready = [] { - qInfo() << "Discord RPC ready"; - }; - handlers.disconnected = [](int errorCode, const char* message) { + handlers.ready = [] { qInfo() << "Discord RPC ready"; }; + handlers.disconnected = [](int errorCode, const char *message) { qInfo() << "Discord RPC disconnected! " << message << errorCode; }; - handlers.errored = [](int errorCode, const char* message) { + handlers.errored = [](int errorCode, const char *message) { qWarning() << "Discord RPC errored out! " << message << errorCode; }; qInfo() << "Initializing Discord RPC"; Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr); } -Discord::~Discord() -{ - Discord_Shutdown(); -} +Discord::~Discord() { Discord_Shutdown(); } void Discord::state_lobby() { @@ -64,10 +59,12 @@ void Discord::state_server(std::string name, std::string server_id) void Discord::state_character(std::string name) { - auto name_internal = QString(name.c_str()).toLower().replace(' ', '_').toStdString(); + auto name_internal = + QString(name.c_str()).toLower().replace(' ', '_').toStdString(); auto name_friendly = QString(name.c_str()).replace('_', ' ').toStdString(); const std::string playing_as = "Playing as " + name_friendly; - qDebug() << "Discord RPC: Setting character state (" << playing_as.c_str() << ")"; + qDebug() << "Discord RPC: Setting character state (" << playing_as.c_str() + << ")"; DiscordRichPresence presence; std::memset(&presence, 0, sizeof(presence)); @@ -101,20 +98,11 @@ void Discord::state_spectate() Discord_UpdatePresence(&presence); } #else -Discord::Discord() -{ - -} - -Discord::~Discord() -{ - -} +Discord::Discord() {} -void Discord::state_lobby() -{ +Discord::~Discord() {} -} +void Discord::state_lobby() {} void Discord::state_server(std::string name, std::string server_id) { @@ -129,7 +117,6 @@ void Discord::state_character(std::string name) void Discord::state_spectate() { qDebug() << "Discord RPC: Setting specator state"; - } #endif -} +} // namespace AttorneyOnline diff --git a/src/emotes.cpp b/src/emotes.cpp index b6a217e6..bbe2f5c9 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -8,7 +8,8 @@ void Courtroom::construct_emotes() set_size_and_pos(ui_emotes, "emotes"); - QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini"); + QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", + "courtroom_design.ini"); const int button_width = 40; int x_spacing = f_spacing.x(); @@ -18,13 +19,14 @@ void Courtroom::construct_emotes() int y_spacing = f_spacing.y(); int y_mod_count = 0; - emote_columns = ((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1; - emote_rows = ((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1; + emote_columns = + ((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1; + emote_rows = + ((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1; max_emotes_on_page = emote_columns * emote_rows; - for (int n = 0 ; n < max_emotes_on_page ; ++n) - { + for (int n = 0; n < max_emotes_on_page; ++n) { int x_pos = (button_width + x_spacing) * x_mod_count; int y_pos = (button_height + y_spacing) * y_mod_count; @@ -34,12 +36,12 @@ void Courtroom::construct_emotes() f_emote->set_id(n); - connect(f_emote, SIGNAL(emote_clicked(int)), this, SLOT(on_emote_clicked(int))); + connect(f_emote, SIGNAL(emote_clicked(int)), this, + SLOT(on_emote_clicked(int))); ++x_mod_count; - if (x_mod_count == emote_columns) - { + if (x_mod_count == emote_columns) { ++y_mod_count; x_mod_count = 0; } @@ -56,23 +58,20 @@ void Courtroom::set_emote_page() ui_emote_left->hide(); ui_emote_right->hide(); - for (AOEmoteButton *i_button : ui_emote_list) - { + for (AOEmoteButton *i_button : ui_emote_list) { i_button->hide(); } int total_pages = total_emotes / max_emotes_on_page; int emotes_on_page = 0; - if (total_emotes % max_emotes_on_page != 0) - { + if (total_emotes % max_emotes_on_page != 0) { ++total_pages; - //i. e. not on the last page + // i. e. not on the last page if (total_pages > current_emote_page + 1) emotes_on_page = max_emotes_on_page; else emotes_on_page = total_emotes % max_emotes_on_page; - } else emotes_on_page = max_emotes_on_page; @@ -83,8 +82,7 @@ void Courtroom::set_emote_page() if (current_emote_page > 0) ui_emote_left->show(); - for (int n_emote = 0 ; n_emote < emotes_on_page ; ++n_emote) - { + for (int n_emote = 0; n_emote < emotes_on_page; ++n_emote) { int n_real_emote = n_emote + current_emote_page * max_emotes_on_page; AOEmoteButton *f_emote = ui_emote_list.at(n_emote); @@ -95,7 +93,6 @@ void Courtroom::set_emote_page() f_emote->show(); } - } void Courtroom::set_emote_dropdown() @@ -105,8 +102,7 @@ void Courtroom::set_emote_dropdown() int total_emotes = ao_app->get_emote_number(current_char); QStringList emote_list; - for (int n = 0 ; n < total_emotes ; ++n) - { + for (int n = 0; n < total_emotes; ++n) { emote_list.append(ao_app->get_emote_comment(current_char, n)); } @@ -119,19 +115,20 @@ void Courtroom::select_emote(int p_id) int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page; if (current_emote >= min && current_emote <= max) - ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_off.png"); + ui_emote_list.at(current_emote % max_emotes_on_page) + ->set_image(current_char, current_emote, "_off.png"); int old_emote = current_emote; current_emote = p_id; if (current_emote >= min && current_emote <= max) - ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_on.png"); + ui_emote_list.at(current_emote % max_emotes_on_page) + ->set_image(current_char, current_emote, "_on.png"); int emote_mod = ao_app->get_emote_mod(current_char, current_emote); - if (old_emote == current_emote) - { + if (old_emote == current_emote) { ui_pre->setChecked(!ui_pre->isChecked()); } else if (emote_mod == 1) diff --git a/src/encryption_functions.cpp b/src/encryption_functions.cpp index ffbe0cdb..6669fe15 100644 --- a/src/encryption_functions.cpp +++ b/src/encryption_functions.cpp @@ -4,8 +4,8 @@ QString fanta_encrypt(QString temp_input, unsigned int p_key) { - //using standard stdlib types is actually easier here because of implicit char<->int conversion - //which in turn makes encryption arithmetic easier + // using standard stdlib types is actually easier here because of implicit + // char<->int conversion which in turn makes encryption arithmetic easier unsigned int key = p_key; unsigned int C1 = 53761; @@ -14,8 +14,7 @@ QString fanta_encrypt(QString temp_input, unsigned int p_key) QVector 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 ebef7490..128156cb 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -4,7 +4,7 @@ void Courtroom::construct_evidence() { ui_evidence = new AOImage(this, ao_app); - //ui_evidence_name = new QLabel(ui_evidence); + // ui_evidence_name = new QLabel(ui_evidence); ui_evidence_name = new AOLineEdit(ui_evidence); ui_evidence_name->setAlignment(Qt::AlignCenter); ui_evidence_name->setFont(QFont("Arial", 14, QFont::Bold)); @@ -32,7 +32,8 @@ void Courtroom::construct_evidence() set_size_and_pos(ui_evidence, "evidence_background"); set_size_and_pos(ui_evidence_buttons, "evidence_buttons"); - QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", "courtroom_design.ini"); + QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", + "courtroom_design.ini"); const int button_width = 70; int x_spacing = f_spacing.x(); @@ -42,43 +43,57 @@ void Courtroom::construct_evidence() int y_spacing = f_spacing.y(); int y_mod_count = 0; - evidence_columns = ((ui_evidence_buttons->width() - button_width) / (x_spacing + button_width)) + 1; - evidence_rows = ((ui_evidence_buttons->height() - button_height) / (y_spacing + button_height)) + 1; + evidence_columns = ((ui_evidence_buttons->width() - button_width) / + (x_spacing + button_width)) + + 1; + evidence_rows = ((ui_evidence_buttons->height() - button_height) / + (y_spacing + button_height)) + + 1; max_evidence_on_page = evidence_columns * evidence_rows; - for (int n = 0 ; n < max_evidence_on_page ; ++n) - { + for (int n = 0; n < max_evidence_on_page; ++n) { int x_pos = (button_width + x_spacing) * x_mod_count; int y_pos = (button_height + y_spacing) * y_mod_count; - AOEvidenceButton *f_evidence = new AOEvidenceButton(ui_evidence_buttons, ao_app, x_pos, y_pos); + AOEvidenceButton *f_evidence = + new AOEvidenceButton(ui_evidence_buttons, ao_app, x_pos, y_pos); ui_evidence_list.append(f_evidence); f_evidence->set_id(n); - connect(f_evidence, SIGNAL(evidence_clicked(int)), this, SLOT(on_evidence_clicked(int))); - connect(f_evidence, SIGNAL(evidence_double_clicked(int)), this, SLOT(on_evidence_double_clicked(int))); - connect(f_evidence, SIGNAL(on_hover(int, bool)), this, SLOT(on_evidence_hover(int, bool))); + connect(f_evidence, SIGNAL(evidence_clicked(int)), this, + SLOT(on_evidence_clicked(int))); + connect(f_evidence, SIGNAL(evidence_double_clicked(int)), this, + SLOT(on_evidence_double_clicked(int))); + connect(f_evidence, SIGNAL(on_hover(int, bool)), this, + SLOT(on_evidence_hover(int, bool))); ++x_mod_count; - if (x_mod_count == evidence_columns) - { + if (x_mod_count == evidence_columns) { ++y_mod_count; x_mod_count = 0; } } - connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited())); - connect(ui_evidence_left, SIGNAL(clicked()), this, SLOT(on_evidence_left_clicked())); - connect(ui_evidence_right, SIGNAL(clicked()), this, SLOT(on_evidence_right_clicked())); - connect(ui_evidence_present, SIGNAL(clicked()), this, SLOT(on_evidence_present_clicked())); - connect(ui_evidence_delete, SIGNAL(clicked()), this, SLOT(on_evidence_delete_clicked())); - connect(ui_evidence_image_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_image_name_edited())); - connect(ui_evidence_image_button, SIGNAL(clicked()), this, SLOT(on_evidence_image_button_clicked())); - connect(ui_evidence_x, SIGNAL(clicked()), this, SLOT(on_evidence_x_clicked())); + connect(ui_evidence_name, SIGNAL(returnPressed()), this, + SLOT(on_evidence_name_edited())); + connect(ui_evidence_left, SIGNAL(clicked()), this, + SLOT(on_evidence_left_clicked())); + connect(ui_evidence_right, SIGNAL(clicked()), this, + SLOT(on_evidence_right_clicked())); + connect(ui_evidence_present, SIGNAL(clicked()), this, + SLOT(on_evidence_present_clicked())); + connect(ui_evidence_delete, SIGNAL(clicked()), this, + SLOT(on_evidence_delete_clicked())); + connect(ui_evidence_image_name, SIGNAL(returnPressed()), this, + SLOT(on_evidence_image_name_edited())); + connect(ui_evidence_image_button, SIGNAL(clicked()), this, + SLOT(on_evidence_image_button_clicked())); + connect(ui_evidence_x, SIGNAL(clicked()), this, + SLOT(on_evidence_x_clicked())); ui_evidence->hide(); } @@ -98,26 +113,23 @@ void Courtroom::set_evidence_page() ui_evidence_left->hide(); ui_evidence_right->hide(); - for (AOEvidenceButton *i_button : ui_evidence_list) - { + for (AOEvidenceButton *i_button : ui_evidence_list) { i_button->reset(); } - //to account for the "add evidence" button + // to account for the "add evidence" button ++total_evidence; int total_pages = total_evidence / max_evidence_on_page; int evidence_on_page = 0; - if ((total_evidence % max_evidence_on_page) != 0) - { + if ((total_evidence % max_evidence_on_page) != 0) { ++total_pages; - //i. e. not on the last page + // i. e. not on the last page if (total_pages > current_evidence_page + 1) evidence_on_page = max_evidence_on_page; else evidence_on_page = total_evidence % max_evidence_on_page; - } else evidence_on_page = max_evidence_on_page; @@ -128,17 +140,19 @@ void Courtroom::set_evidence_page() if (current_evidence_page > 0) ui_evidence_left->show(); - for (int n_evidence_button = 0 ; n_evidence_button < evidence_on_page ; ++n_evidence_button) - { - int n_real_evidence = n_evidence_button + current_evidence_page * max_evidence_on_page; - AOEvidenceButton *f_evidence_button = ui_evidence_list.at(n_evidence_button); + for (int n_evidence_button = 0; n_evidence_button < evidence_on_page; + ++n_evidence_button) { + int n_real_evidence = + n_evidence_button + current_evidence_page * max_evidence_on_page; + AOEvidenceButton *f_evidence_button = + ui_evidence_list.at(n_evidence_button); - //ie. the add evidence button + // ie. the add evidence button if (n_real_evidence == (total_evidence - 1)) f_evidence_button->set_theme_image("addevidence.png"); - else if (n_real_evidence < (total_evidence - 1)) - { - f_evidence_button->set_image(local_evidence_list.at(n_real_evidence).image); + else if (n_real_evidence < (total_evidence - 1)) { + f_evidence_button->set_image( + local_evidence_list.at(n_real_evidence).image); if (n_real_evidence == current_evidence) f_evidence_button->set_selected(true); @@ -198,7 +212,7 @@ void Courtroom::on_evidence_image_button_clicked() QStringList filenames; if (dialog.exec()) - filenames = dialog.selectedFiles(); + filenames = dialog.selectedFiles(); if (filenames.size() != 1) return; @@ -215,9 +229,9 @@ void Courtroom::on_evidence_clicked(int p_id) int f_real_id = p_id + max_evidence_on_page * current_evidence_page; - if (f_real_id == local_evidence_list.size()) - { - ao_app->send_server_packet(new AOPacket("PE###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("Add new evidence..."); else if (final_id < local_evidence_list.size()) @@ -310,7 +322,8 @@ void Courtroom::on_evidence_delete_clicked() ui_evidence_description->setReadOnly(true); ui_evidence_overlay->hide(); - ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%")); + ao_app->send_server_packet( + new AOPacket("DE#" + QString::number(current_evidence) + "#%")); current_evidence = 0; @@ -338,4 +351,3 @@ void Courtroom::on_evidence_x_clicked() ui_ic_chat_message->setFocus(); } - diff --git a/src/file_functions.cpp b/src/file_functions.cpp index f93ee15d..e64a46bf 100644 --- a/src/file_functions.cpp +++ b/src/file_functions.cpp @@ -14,7 +14,8 @@ bool dir_exists(QString dir_path) return check_dir.exists(); } -bool exists(QString p_path) { +bool exists(QString p_path) +{ QFile file(p_path); return file.exists(); diff --git a/src/hardware_functions.cpp b/src/hardware_functions.cpp index 5d6b6ffa..4dbc4380 100644 --- a/src/hardware_functions.cpp +++ b/src/hardware_functions.cpp @@ -2,7 +2,7 @@ #include -#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) @@ -52,7 +51,7 @@ QString get_hdid() #elif defined __APPLE__ QString get_hdid() { - //hdids are broken at this point anyways + // hdids are broken at this point anyways return "just a mac passing by"; } diff --git a/src/hex_functions.cpp b/src/hex_functions.cpp index 4a58d2b4..1e35718f 100644 --- a/src/hex_functions.cpp +++ b/src/hex_functions.cpp @@ -1,18 +1,17 @@ #include "hex_functions.h" -namespace omni +namespace omni { +std::string int_to_hex(unsigned int input) { - std::string int_to_hex(unsigned int input) - { - if (input > 255) - return "FF"; + if (input > 255) + return "FF"; - std::stringstream stream; - stream << std::setfill('0') << std::setw(sizeof(char)*2) - << std::hex << input; - std::string result(stream.str()); - std::transform(result.begin(), result.end(), result.begin(), ::toupper); + std::stringstream stream; + stream << std::setfill('0') << std::setw(sizeof(char) * 2) << std::hex + << input; + std::string result(stream.str()); + std::transform(result.begin(), result.end(), result.begin(), ::toupper); - return result; - } + return result; } +} // namespace omni diff --git a/src/lobby.cpp b/src/lobby.cpp index 4a96e567..79a37bea 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -1,9 +1,9 @@ #include "lobby.h" -#include "debug_functions.h" #include "aoapplication.h" -#include "networkmanager.h" #include "aosfxplayer.h" +#include "debug_functions.h" +#include "networkmanager.h" Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() { @@ -37,17 +37,22 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() ui_progress_bar->setStyleSheet("QProgressBar{ color: white; }"); ui_cancel = new AOButton(ui_loading_background, ao_app); - connect(ui_public_servers, SIGNAL(clicked()), this, SLOT(on_public_servers_clicked())); + connect(ui_public_servers, SIGNAL(clicked()), this, + SLOT(on_public_servers_clicked())); connect(ui_favorites, SIGNAL(clicked()), this, SLOT(on_favorites_clicked())); connect(ui_refresh, SIGNAL(pressed()), this, SLOT(on_refresh_pressed())); connect(ui_refresh, SIGNAL(released()), this, SLOT(on_refresh_released())); - connect(ui_add_to_fav, SIGNAL(pressed()), this, SLOT(on_add_to_fav_pressed())); - connect(ui_add_to_fav, SIGNAL(released()), this, SLOT(on_add_to_fav_released())); + connect(ui_add_to_fav, SIGNAL(pressed()), this, + SLOT(on_add_to_fav_pressed())); + connect(ui_add_to_fav, SIGNAL(released()), this, + SLOT(on_add_to_fav_released())); connect(ui_connect, SIGNAL(pressed()), this, SLOT(on_connect_pressed())); connect(ui_connect, SIGNAL(released()), this, SLOT(on_connect_released())); connect(ui_about, SIGNAL(clicked()), this, SLOT(on_about_clicked())); - connect(ui_server_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_server_list_clicked(QModelIndex))); - connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed())); + connect(ui_server_list, SIGNAL(clicked(QModelIndex)), this, + SLOT(on_server_list_clicked(QModelIndex))); + connect(ui_chatmessage, SIGNAL(returnPressed()), this, + SLOT(on_chatfield_return_pressed())); connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled())); ui_connect->setEnabled(false); @@ -57,7 +62,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() set_widgets(); } -//sets images, position and size +// sets images, position and size void Lobby::set_widgets() { ao_app->reload_theme(); @@ -66,8 +71,7 @@ void Lobby::set_widgets() pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename); - if (f_lobby.width < 0 || f_lobby.height < 0) - { + if (f_lobby.width < 0 || f_lobby.height < 0) { qDebug() << "W: did not find lobby width or height in " << filename; // Most common symptom of bad config files and missing assets. @@ -77,8 +81,7 @@ void Lobby::set_widgets() this->resize(517, 666); } - else - { + else { this->resize(f_lobby.width, f_lobby.height); } @@ -108,7 +111,7 @@ void Lobby::set_widgets() set_size_and_pos(ui_server_list, "server_list"); ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "font: bold;"); + "font: bold;"); set_size_and_pos(ui_player_count, "player_count"); ui_player_count->setText("Offline"); @@ -123,20 +126,21 @@ void Lobby::set_widgets() set_size_and_pos(ui_chatbox, "chatbox"); ui_chatbox->setReadOnly(true); - ui_chatbox->setStyleSheet("QTextBrowser{background-color: rgba(0, 0, 0, 0);}"); + ui_chatbox->setStyleSheet( + "QTextBrowser{background-color: rgba(0, 0, 0, 0);}"); set_size_and_pos(ui_chatname, "chatname"); ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);" "selection-background-color: rgba(0, 0, 0, 0);"); set_size_and_pos(ui_chatmessage, "chatmessage"); - ui_chatmessage->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "selection-background-color: rgba(0, 0, 0, 0);"); + ui_chatmessage->setStyleSheet( + "background-color: rgba(0, 0, 0, 0);" + "selection-background-color: rgba(0, 0, 0, 0);"); ui_loading_background->resize(this->width(), this->height()); ui_loading_background->set_image("loadingbackground.png"); - set_size_and_pos(ui_loading_text, "loading_label"); ui_loading_text->setFont(QFont("Arial", 20, QFont::Bold)); ui_loading_text->setReadOnly(true); @@ -151,22 +155,20 @@ void Lobby::set_widgets() ui_cancel->setText("Cancel"); ui_loading_background->hide(); - } void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier) { QString filename = "lobby_design.ini"; - pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); + pos_size_type design_ini_result = + ao_app->get_element_dimensions(p_identifier, filename); - if (design_ini_result.width < 0 || design_ini_result.height < 0) - { + if (design_ini_result.width < 0 || design_ini_result.height < 0) { qDebug() << "W: could not find " << p_identifier << " in " << filename; p_widget->hide(); } - else - { + else { p_widget->move(design_ini_result.x, design_ini_result.y); p_widget->resize(design_ini_result.width, design_ini_result.height); } @@ -186,10 +188,7 @@ QString Lobby::get_chatlog() return return_value; } -int Lobby::get_selected_server() -{ - return ui_server_list->currentRow(); -} +int Lobby::get_selected_server() { return ui_server_list->currentRow(); } void Lobby::set_loading_value(int p_value) { @@ -212,7 +211,7 @@ void Lobby::on_favorites_clicked() ui_public_servers->set_image("publicservers.png"); ao_app->set_favorite_list(); - //ao_app->favorite_list = read_serverlist_txt(); + // ao_app->favorite_list = read_serverlist_txt(); list_favorites(); @@ -242,7 +241,7 @@ void Lobby::on_add_to_fav_released() { ui_add_to_fav->set_image("addtofav.png"); - //you cant add favorites from favorites m8 + // you cant add favorites from favorites m8 if (!public_servers_selected) return; @@ -267,17 +266,18 @@ void Lobby::on_connect_released() void Lobby::on_about_clicked() { - QString msg = tr("

Attorney Online %1

" - "The courtroom drama simulator" - "

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

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

Special thanks:
" - "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), " - "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " - "Noevain, Cronnicossy") + 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" + "

Special thanks:
" + "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), " + "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " + "Noevain, Cronnicossy") .arg(ao_app->get_version_string()); QMessageBox::about(this, "About", msg); } @@ -290,8 +290,7 @@ void Lobby::on_server_list_clicked(QModelIndex p_model) if (n_server < 0) return; - if (public_servers_selected) - { + if (public_servers_selected) { QVector f_server_list = ao_app->get_server_list(); if (n_server >= f_server_list.size()) @@ -299,8 +298,7 @@ void Lobby::on_server_list_clicked(QModelIndex p_model) f_server = f_server_list.at(p_model.row()); } - else - { + else { if (n_server >= ao_app->get_favorite_list().size()) return; @@ -322,11 +320,10 @@ void Lobby::on_server_list_clicked(QModelIndex p_model) void Lobby::on_chatfield_return_pressed() { - //no you can't send empty messages + // no you can't send empty messages if (ui_chatname->text() == "" || ui_chatmessage->text() == "") return; - QString f_header = "CT"; QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()}; @@ -345,8 +342,7 @@ void Lobby::list_servers() ui_server_list->clear(); - for (server_type i_server : ao_app->get_server_list()) - { + for (server_type i_server : ao_app->get_server_list()) { ui_server_list->addItem(i_server.name); } } @@ -355,15 +351,16 @@ void Lobby::list_favorites() { ui_server_list->clear(); - for (server_type i_server : ao_app->get_favorite_list()) - { + for (server_type i_server : ao_app->get_favorite_list()) { ui_server_list->addItem(i_server.name); } } void Lobby::append_chatmessage(QString f_name, QString f_message) { - ui_chatbox->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name()); + ui_chatbox->append_chatmessage( + f_name, f_message, + ao_app->get_color("ooc_default_color", "courtroom_design.ini").name()); } void Lobby::append_error(QString f_message) @@ -373,16 +370,11 @@ void Lobby::append_error(QString f_message) void Lobby::set_player_count(int players_online, int max_players) { - QString f_string = "Online: " + QString::number(players_online) + "/" + QString::number(max_players); + QString f_string = "Online: " + QString::number(players_online) + "/" + + QString::number(max_players); ui_player_count->setText(f_string); } -void Lobby::enable_connect_button() -{ - ui_connect->setEnabled(true); -} +void Lobby::enable_connect_button() { ui_connect->setEnabled(true); } -Lobby::~Lobby() -{ - -} +Lobby::~Lobby() {} diff --git a/src/main.cpp b/src/main.cpp index 80ea93bb..1caa3945 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,24 +1,24 @@ #include "aoapplication.h" +#include "courtroom.h" #include "datatypes.h" -#include "networkmanager.h" #include "lobby.h" -#include "courtroom.h" -#include +#include "networkmanager.h" #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); - main_app.construct_lobby(); - main_app.net_manager->connect_to_master(); - main_app.w_lobby->show(); - return main_app.exec(); + AOApplication main_app(argc, argv); + main_app.construct_lobby(); + main_app.net_manager->connect_to_master(); + main_app.w_lobby->show(); + return main_app.exec(); } diff --git a/src/misc_functions.cpp b/src/misc_functions.cpp index 23520551..cc144153 100644 --- a/src/misc_functions.cpp +++ b/src/misc_functions.cpp @@ -4,6 +4,6 @@ void delay(int p_milliseconds) { QTime dieTime = QTime::currentTime().addMSecs(p_milliseconds); - while(QTime::currentTime() < dieTime) + while (QTime::currentTime() < dieTime) QCoreApplication::processEvents(QEventLoop::AllEvents, 100); } diff --git a/src/networkmanager.cpp b/src/networkmanager.cpp index a9810d49..cf89d0ab 100644 --- a/src/networkmanager.cpp +++ b/src/networkmanager.cpp @@ -13,21 +13,23 @@ NetworkManager::NetworkManager(AOApplication *parent) : QObject(parent) ms_reconnect_timer = new QTimer(this); ms_reconnect_timer->setSingleShot(true); - QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, SLOT(retry_ms_connect())); - - QObject::connect(ms_socket, SIGNAL(readyRead()), this, SLOT(handle_ms_packet())); - QObject::connect(server_socket, SIGNAL(readyRead()), this, SLOT(handle_server_packet())); - QObject::connect(server_socket, SIGNAL(disconnected()), ao_app, SLOT(server_disconnected())); - - QString master_config = ao_app->configini->value("master", "").value(); + QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, + SLOT(retry_ms_connect())); + + QObject::connect(ms_socket, SIGNAL(readyRead()), this, + SLOT(handle_ms_packet())); + QObject::connect(server_socket, SIGNAL(readyRead()), this, + SLOT(handle_server_packet())); + QObject::connect(server_socket, SIGNAL(disconnected()), ao_app, + SLOT(server_disconnected())); + + QString master_config = + ao_app->configini->value("master", "").value(); if (master_config != "") ms_nosrv_hostname = master_config; } -NetworkManager::~NetworkManager() -{ - -} +NetworkManager::~NetworkManager() {} void NetworkManager::connect_to_master() { @@ -43,11 +45,11 @@ void NetworkManager::connect_to_master() void NetworkManager::connect_to_master_nosrv() { - QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), - this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); + QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, + SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); - QObject::connect(ms_socket, SIGNAL(connected()), - this, SLOT(on_ms_nosrv_connect_success())); + QObject::connect(ms_socket, SIGNAL(connected()), this, + SLOT(on_ms_nosrv_connect_success())); ms_socket->connectToHost(ms_nosrv_hostname, ms_port); } @@ -61,12 +63,10 @@ void NetworkManager::connect_to_server(server_type p_server) void NetworkManager::ship_ms_packet(QString p_packet) { - if (!ms_socket->isOpen()) - { + if (!ms_socket->isOpen()) { retry_ms_connect(); } - else - { + else { ms_socket->write(p_packet.toUtf8()); } } @@ -81,93 +81,86 @@ void NetworkManager::handle_ms_packet() QByteArray buffer = ms_socket->readAll(); QString in_data = QString::fromUtf8(buffer, buffer.size()); - if (!in_data.endsWith("%")) - { + if (!in_data.endsWith("%")) { ms_partial_packet = true; ms_temp_packet += in_data; return; } - else - { - if (ms_partial_packet) - { + else { + if (ms_partial_packet) { in_data = ms_temp_packet + in_data; ms_temp_packet = ""; ms_partial_packet = false; } } - QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts)); + QStringList packet_list = + in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts)); - for (QString packet : packet_list) - { + for (QString packet : packet_list) { AOPacket *f_packet = new AOPacket(packet); ao_app->ms_packet_received(f_packet); } } - void NetworkManager::perform_srv_lookup() { - #ifdef MS_FAILOVER_SUPPORTED +#ifdef MS_FAILOVER_SUPPORTED ms_dns = new QDnsLookup(QDnsLookup::SRV, ms_srv_hostname, this); connect(ms_dns, SIGNAL(finished()), this, SLOT(on_srv_lookup())); ms_dns->lookup(); - #endif +#endif } void NetworkManager::on_srv_lookup() { - #ifdef MS_FAILOVER_SUPPORTED +#ifdef MS_FAILOVER_SUPPORTED bool connected = false; - if (ms_dns->error() != QDnsLookup::NoError) - { + if (ms_dns->error() != QDnsLookup::NoError) { qWarning("SRV lookup of the master server DNS failed."); ms_dns->deleteLater(); } - else - { + else { const auto srv_records = ms_dns->serviceRecords(); - for (const QDnsServiceRecord &record : srv_records) - { + for (const QDnsServiceRecord &record : srv_records) { #ifdef DEBUG_NETWORK qDebug() << "Connecting to " << record.target() << ":" << record.port(); #endif ms_socket->connectToHost(record.target(), record.port()); QTime timer; timer.start(); - do - { + do { ao_app->processEvents(); - if (ms_socket->state() == QAbstractSocket::ConnectedState) - { + if (ms_socket->state() == QAbstractSocket::ConnectedState) { connected = true; break; } - else if (ms_socket->state() != QAbstractSocket::ConnectingState - && ms_socket->state() != QAbstractSocket::HostLookupState - && ms_socket->error() != -1) - { + else if (ms_socket->state() != QAbstractSocket::ConnectingState && + ms_socket->state() != QAbstractSocket::HostLookupState && + ms_socket->error() != -1) { qDebug() << ms_socket->error(); - qWarning() << "Error connecting to master server:" << ms_socket->errorString(); + qWarning() << "Error connecting to master server:" + << ms_socket->errorString(); ms_socket->abort(); ms_socket->close(); break; } - } while (timer.elapsed() < timeout_milliseconds); // Very expensive spin-wait loop - it will bring CPU to 100%! - if (connected) - { - // Connect a one-shot signal in case the master server disconnects randomly - QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), - this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); + } while (timer.elapsed() < + timeout_milliseconds); // Very expensive spin-wait loop - it will + // bring CPU to 100%! + if (connected) { + // Connect a one-shot signal in case the master server disconnects + // randomly + QObject::connect( + ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, + SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); break; } - else - { + else { ms_socket->abort(); ms_socket->close(); } @@ -179,29 +172,30 @@ void NetworkManager::on_srv_lookup() connect_to_master_nosrv(); else emit ms_connect_finished(connected, false); - #endif +#endif } void NetworkManager::on_ms_nosrv_connect_success() { emit ms_connect_finished(true, false); - QObject::disconnect(ms_socket, SIGNAL(connected()), - this, SLOT(on_ms_nosrv_connect_success())); + QObject::disconnect(ms_socket, SIGNAL(connected()), this, + SLOT(on_ms_nosrv_connect_success())); - QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), - this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); + QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, + SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); } void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error) { - qWarning() << "Master server socket error:" << ms_socket->errorString() - << "(" << error << ")"; + qWarning() << "Master server socket error:" << ms_socket->errorString() << "(" + << error << ")"; // Disconnect the one-shot signal - this way, failover connect attempts // don't trigger a full retry QObject::disconnect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), - this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); + this, + SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); emit ms_connect_finished(false, true); @@ -210,7 +204,8 @@ void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error) void NetworkManager::retry_ms_connect() { - if (!ms_reconnect_timer->isActive() && ms_socket->state() != QAbstractSocket::ConnectingState) + if (!ms_reconnect_timer->isActive() && + ms_socket->state() != QAbstractSocket::ConnectingState) connect_to_master(); } @@ -219,27 +214,24 @@ void NetworkManager::handle_server_packet() QByteArray buffer = server_socket->readAll(); QString in_data = QString::fromUtf8(buffer, buffer.size()); - if (!in_data.endsWith("%")) - { + if (!in_data.endsWith("%")) { partial_packet = true; temp_packet += in_data; return; } - else - { - if (partial_packet) - { + else { + if (partial_packet) { in_data = temp_packet + in_data; temp_packet = ""; partial_packet = false; } } - QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts)); + QStringList packet_list = + in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts)); - for (QString packet : packet_list) - { + for (QString packet : packet_list) { AOPacket *f_packet = new AOPacket(packet); ao_app->server_packet_received(f_packet); diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 942c275d..baba0eac 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -1,11 +1,11 @@ #include "aoapplication.h" -#include "lobby.h" #include "courtroom.h" -#include "networkmanager.h" +#include "debug_functions.h" #include "encryption_functions.h" #include "hardware_functions.h" -#include "debug_functions.h" +#include "lobby.h" +#include "networkmanager.h" void AOApplication::ms_packet_received(AOPacket *p_packet) { @@ -19,17 +19,14 @@ void AOApplication::ms_packet_received(AOPacket *p_packet) qDebug() << "R(ms):" << p_packet->to_string(); #endif - if (header == "ALL") - { + if (header == "ALL") { server_list.clear(); - for (QString i_string : p_packet->get_contents()) - { + for (QString i_string : p_packet->get_contents()) { server_type f_server; QStringList sub_contents = i_string.split("&"); - if (sub_contents.size() < 4) - { + if (sub_contents.size() < 4) { qDebug() << "W: malformed packet"; continue; } @@ -42,39 +39,32 @@ void AOApplication::ms_packet_received(AOPacket *p_packet) server_list.append(f_server); } - if (lobby_constructed) - { + if (lobby_constructed) { w_lobby->list_servers(); } } - else if (header == "CT") - { + else if (header == "CT") { QString f_name, f_message; - if (f_contents.size() == 1) - { + if (f_contents.size() == 1) { f_name = ""; f_message = f_contents.at(0); } - else if (f_contents.size() >= 2) - { + else if (f_contents.size() >= 2) { f_name = f_contents.at(0); f_message = f_contents.at(1); } else goto end; - if (lobby_constructed) - { + if (lobby_constructed) { w_lobby->append_chatmessage(f_name, f_message); } - if (courtroom_constructed && courtroom_loaded) - { + if (courtroom_constructed && courtroom_loaded) { w_courtroom->append_ms_chatmessage(f_name, f_message); } } - else if (header == "AO2CHECK") - { + else if (header == "AO2CHECK") { send_ms_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%")); send_ms_packet(new AOPacket("HI#" + get_hdid() + "#%")); @@ -92,31 +82,28 @@ void AOApplication::ms_packet_received(AOPacket *p_packet) if (get_release() > f_release) goto end; - else if (get_release() == f_release) - { + else if (get_release() == f_release) { if (get_major_version() > f_major) goto end; - else if (get_major_version() == f_major) - { + else if (get_major_version() == f_major) { if (get_minor_version() >= f_minor) goto end; } } - call_notice("Outdated version! Your version: " + get_version_string() - + "\nPlease go to aceattorneyonline.com to update."); + call_notice("Outdated version! Your version: " + get_version_string() + + "\nPlease go to aceattorneyonline.com to update."); destruct_courtroom(); destruct_lobby(); } - else if (header == "DOOM") - { + else if (header == "DOOM") { call_notice("You have been exiled from AO." "Have a nice day."); destruct_courtroom(); destruct_lobby(); } - end: +end: delete p_packet; } @@ -134,15 +121,14 @@ void AOApplication::server_packet_received(AOPacket *p_packet) qDebug() << "R:" << f_packet; #endif - if (header == "decryptor") - { + if (header == "decryptor") { if (f_contents.size() == 0) goto end; - //you may ask where 322 comes from. that would be a good question. + // you may ask where 322 comes from. that would be a good question. s_decryptor = fanta_decrypt(f_contents.at(0), 322).toUInt(); - //default(legacy) values + // default(legacy) values encryption_needed = true; yellow_text_enabled = false; prezoom_enabled = false; @@ -156,7 +142,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) casing_alerts_enabled = false; modcall_reason_enabled = false; - //workaround for tsuserver4 + // workaround for tsuserver4 if (f_contents.at(0) == "NOENCRYPT") encryption_needed = false; @@ -166,8 +152,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) AOPacket *hi_packet = new AOPacket("HI#" + f_hdid + "#%"); send_server_packet(hi_packet); } - else if (header == "ID") - { + else if (header == "ID") { if (f_contents.size() < 2) goto end; @@ -176,55 +161,53 @@ void AOApplication::server_packet_received(AOPacket *p_packet) send_server_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%")); } - else if (header == "CT") - { + else if (header == "CT") { if (f_contents.size() < 2) goto end; - if (courtroom_constructed) - { + if (courtroom_constructed) { if (f_contents.size() == 3) - w_courtroom->append_server_chatmessage(f_contents.at(0), f_contents.at(1), f_contents.at(2)); + w_courtroom->append_server_chatmessage( + f_contents.at(0), f_contents.at(1), f_contents.at(2)); else - w_courtroom->append_server_chatmessage(f_contents.at(0), f_contents.at(1), "0"); + w_courtroom->append_server_chatmessage(f_contents.at(0), + f_contents.at(1), "0"); } } - else if (header == "FL") - { - if (f_packet.contains("yellowtext",Qt::CaseInsensitive)) + else if (header == "FL") { + if (f_packet.contains("yellowtext", Qt::CaseInsensitive)) yellow_text_enabled = true; - if (f_packet.contains("flipping",Qt::CaseInsensitive)) + if (f_packet.contains("flipping", Qt::CaseInsensitive)) flipping_enabled = true; - if (f_packet.contains("customobjections",Qt::CaseInsensitive)) + if (f_packet.contains("customobjections", Qt::CaseInsensitive)) custom_objection_enabled = true; - if (f_packet.contains("fastloading",Qt::CaseInsensitive)) + if (f_packet.contains("fastloading", Qt::CaseInsensitive)) improved_loading_enabled = true; - if (f_packet.contains("noencryption",Qt::CaseInsensitive)) + if (f_packet.contains("noencryption", Qt::CaseInsensitive)) encryption_needed = false; - if (f_packet.contains("deskmod",Qt::CaseInsensitive)) + if (f_packet.contains("deskmod", Qt::CaseInsensitive)) desk_mod_enabled = true; - if (f_packet.contains("evidence",Qt::CaseInsensitive)) + if (f_packet.contains("evidence", Qt::CaseInsensitive)) evidence_enabled = true; - if (f_packet.contains("cccc_ic_support",Qt::CaseInsensitive)) + if (f_packet.contains("cccc_ic_support", Qt::CaseInsensitive)) cccc_ic_support_enabled = true; - if (f_packet.contains("arup",Qt::CaseInsensitive)) + if (f_packet.contains("arup", Qt::CaseInsensitive)) arup_enabled = true; - if (f_packet.contains("casing_alerts",Qt::CaseInsensitive)) + if (f_packet.contains("casing_alerts", Qt::CaseInsensitive)) casing_alerts_enabled = true; - if (f_packet.contains("modcall_reason",Qt::CaseInsensitive)) + if (f_packet.contains("modcall_reason", Qt::CaseInsensitive)) modcall_reason_enabled = true; w_lobby->enable_connect_button(); } - else if (header == "PN") - { + else if (header == "PN") { if (f_contents.size() < 2) goto end; - w_lobby->set_player_count(f_contents.at(0).toInt(), f_contents.at(1).toInt()); + w_lobby->set_player_count(f_contents.at(0).toInt(), + f_contents.at(1).toInt()); } - else if (header == "SI") - { + else if (header == "SI") { if (f_contents.size() != 3) goto end; @@ -249,8 +232,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) int selected_server = w_lobby->get_selected_server(); QString server_address = "", server_name = ""; - if (w_lobby->public_servers_selected) - { + if (w_lobby->public_servers_selected) { if (selected_server >= 0 && selected_server < server_list.size()) { auto info = server_list.at(selected_server); server_name = info.name; @@ -258,8 +240,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) window_title += ": " + server_name; } } - else - { + else { if (selected_server >= 0 && selected_server < favorite_list.size()) { auto info = favorite_list.at(selected_server); server_name = info.name; @@ -276,7 +257,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) AOPacket *f_packet; - if(improved_loading_enabled) + if (improved_loading_enabled) f_packet = new AOPacket("RC#%"); else f_packet = new AOPacket("askchar2#%"); @@ -286,19 +267,19 @@ void AOApplication::server_packet_received(AOPacket *p_packet) QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256); hash.addData(server_address.toUtf8()); if (is_discord_enabled()) - discord->state_server(server_name.toStdString(), hash.result().toBase64().toStdString()); + discord->state_server(server_name.toStdString(), + hash.result().toBase64().toStdString()); } - else if (header == "CI") - { + else if (header == "CI") { if (!courtroom_constructed) goto end; - for (int n_element = 0 ; n_element < f_contents.size() ; n_element += 2) - { + for (int n_element = 0; n_element < f_contents.size(); n_element += 2) { if (f_contents.at(n_element).toInt() != loaded_chars) break; - //this means we are on the last element and checking n + 1 element will be game over so + // this means we are on the last element and checking n + 1 element will + // be game over so if (n_element == f_contents.size() - 1) break; @@ -310,37 +291,40 @@ void AOApplication::server_packet_received(AOPacket *p_packet) f_char.name = sub_elements.at(0); f_char.description = sub_elements.at(1); f_char.evidence_string = sub_elements.at(3); - //temporary. the CharsCheck packet sets this properly + // temporary. the CharsCheck packet sets this properly f_char.taken = false; ++loaded_chars; - w_lobby->set_loading_text("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size)); + w_lobby->set_loading_text("Loading chars:\n" + + QString::number(loaded_chars) + "/" + + QString::number(char_list_size)); w_courtroom->append_char(f_char); - int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size; - int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast(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); } if (improved_loading_enabled) send_server_packet(new AOPacket("RE#%")); - else - { - QString next_packet_number = QString::number(((loaded_chars - 1) / 10) + 1); + else { + QString next_packet_number = + QString::number(((loaded_chars - 1) / 10) + 1); send_server_packet(new AOPacket("AN#" + next_packet_number + "#%")); } - } - else if (header == "EI") - { + else if (header == "EI") { if (!courtroom_constructed) goto end; - // +1 because evidence starts at 1 rather than 0 for whatever reason - //enjoy fanta + // enjoy fanta if (f_contents.at(0).toInt() != loaded_evidence + 1) goto end; @@ -354,33 +338,36 @@ void AOApplication::server_packet_received(AOPacket *p_packet) evi_type f_evi; f_evi.name = sub_elements.at(0); f_evi.description = sub_elements.at(1); - //no idea what the number at position 2 is. probably an identifier? + // no idea what the number at position 2 is. probably an identifier? f_evi.image = sub_elements.at(3); ++loaded_evidence; - w_lobby->set_loading_text("Loading evidence:\n" + QString::number(loaded_evidence) + "/" + QString::number(evidence_list_size)); + w_lobby->set_loading_text("Loading evidence:\n" + + QString::number(loaded_evidence) + "/" + + QString::number(evidence_list_size)); w_courtroom->append_evidence(f_evi); - int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size; - int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast(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); QString next_packet_number = QString::number(loaded_evidence); send_server_packet(new AOPacket("AE#" + next_packet_number + "#%")); - } - else if (header == "EM") - { + else if (header == "EM") { if (!courtroom_constructed) goto end; bool musics_time = false; int areas = 0; - for (int n_element = 0 ; n_element < f_contents.size() ; n_element += 2) - { + for (int n_element = 0; n_element < f_contents.size(); n_element += 2) { if (f_contents.at(n_element).toInt() != loaded_music) break; @@ -391,52 +378,49 @@ void AOApplication::server_packet_received(AOPacket *p_packet) ++loaded_music; - w_lobby->set_loading_text("Loading music:\n" + QString::number(loaded_music) + "/" + QString::number(music_list_size)); + w_lobby->set_loading_text("Loading music:\n" + + QString::number(loaded_music) + "/" + + QString::number(music_list_size)); - if (musics_time) - { - w_courtroom->append_music(f_music); + if (musics_time) { + w_courtroom->append_music(f_music); } - else - { - if (f_music.endsWith(".wav") || - f_music.endsWith(".mp3") || - f_music.endsWith(".mp4") || - f_music.endsWith(".ogg") || - f_music.endsWith(".opus")) - { - musics_time = true; - areas--; - w_courtroom->fix_last_area(); - w_courtroom->append_music(f_music); - } - else - { - w_courtroom->append_area(f_music); - areas++; - } + else { + if (f_music.endsWith(".wav") || f_music.endsWith(".mp3") || + f_music.endsWith(".mp4") || f_music.endsWith(".ogg") || + f_music.endsWith(".opus")) { + musics_time = true; + areas--; + w_courtroom->fix_last_area(); + w_courtroom->append_music(f_music); + } + else { + w_courtroom->append_area(f_music); + areas++; + } } - for (int area_n = 0; area_n < areas; area_n++) - { - w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown"); + for (int area_n = 0; area_n < areas; area_n++) { + w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown"); } - int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size; - int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast(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); } QString next_packet_number = QString::number(((loaded_music - 1) / 10) + 1); send_server_packet(new AOPacket("AM#" + next_packet_number + "#%")); } - else if (header == "CharsCheck") - { + else if (header == "CharsCheck") { if (!courtroom_constructed) goto end; - for (int n_char = 0 ; n_char < f_contents.size() ; ++n_char) - { + for (int n_char = 0; n_char < f_contents.size(); ++n_char) { if (f_contents.at(n_char) == "-1") w_courtroom->set_taken(n_char, true); else @@ -444,13 +428,11 @@ void AOApplication::server_packet_received(AOPacket *p_packet) } } - else if (header == "SC") - { + else if (header == "SC") { if (!courtroom_constructed) goto end; - for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element) - { + for (int n_element = 0; n_element < f_contents.size(); ++n_element) { QStringList sub_elements = f_contents.at(n_element).split("&"); char_type f_char; @@ -458,74 +440,78 @@ void AOApplication::server_packet_received(AOPacket *p_packet) if (sub_elements.size() >= 2) f_char.description = sub_elements.at(1); - //temporary. the CharsCheck packet sets this properly + // temporary. the CharsCheck packet sets this properly f_char.taken = false; ++loaded_chars; - w_lobby->set_loading_text("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size)); + w_lobby->set_loading_text("Loading chars:\n" + + QString::number(loaded_chars) + "/" + + QString::number(char_list_size)); w_courtroom->append_char(f_char); - int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size; - int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast(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); } send_server_packet(new AOPacket("RM#%")); } - else if (header == "SM") - { + else if (header == "SM") { if (!courtroom_constructed) goto end; bool musics_time = false; int areas = 0; - for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element) - { + for (int n_element = 0; n_element < f_contents.size(); ++n_element) { ++loaded_music; - w_lobby->set_loading_text("Loading music:\n" + QString::number(loaded_music) + "/" + QString::number(music_list_size)); + w_lobby->set_loading_text("Loading music:\n" + + QString::number(loaded_music) + "/" + + QString::number(music_list_size)); - if (musics_time) - { - w_courtroom->append_music(f_contents.at(n_element)); + if (musics_time) { + w_courtroom->append_music(f_contents.at(n_element)); } - else - { - if (f_contents.at(n_element).endsWith(".wav") || - f_contents.at(n_element).endsWith(".mp3") || - f_contents.at(n_element).endsWith(".mp4") || - f_contents.at(n_element).endsWith(".ogg") || - f_contents.at(n_element).endsWith(".opus")) - { - musics_time = true; - w_courtroom->fix_last_area(); - w_courtroom->append_music(f_contents.at(n_element)); - areas--; - } - else - { - w_courtroom->append_area(f_contents.at(n_element)); - areas++; - } + else { + if (f_contents.at(n_element).endsWith(".wav") || + f_contents.at(n_element).endsWith(".mp3") || + f_contents.at(n_element).endsWith(".mp4") || + f_contents.at(n_element).endsWith(".ogg") || + f_contents.at(n_element).endsWith(".opus")) { + musics_time = true; + w_courtroom->fix_last_area(); + w_courtroom->append_music(f_contents.at(n_element)); + areas--; + } + else { + w_courtroom->append_area(f_contents.at(n_element)); + areas++; + } } - for (int area_n = 0; area_n < areas; area_n++) - { - w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown"); + for (int area_n = 0; area_n < areas; area_n++) { + w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown"); } - int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size; - int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast(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); } send_server_packet(new AOPacket("RD#%")); } - else if (header == "DONE") - { + else if (header == "DONE") { if (!courtroom_constructed) goto end; @@ -539,59 +525,50 @@ void AOApplication::server_packet_received(AOPacket *p_packet) destruct_lobby(); } - else if (header == "BN") - { + else if (header == "BN") { if (f_contents.size() < 1) goto end; if (courtroom_constructed) w_courtroom->set_background(f_contents.at(0)); } - //server accepting char request(CC) packet - else if (header == "PV") - { + // server accepting char request(CC) packet + else if (header == "PV") { if (f_contents.size() < 3) goto end; if (courtroom_constructed) w_courtroom->enter_courtroom(f_contents.at(2).toInt()); } - else if (header == "MS") - { + else if (header == "MS") { if (courtroom_constructed && courtroom_loaded) w_courtroom->handle_chatmessage(&p_packet->get_contents()); } - else if (header == "MC") - { + else if (header == "MC") { if (courtroom_constructed && courtroom_loaded) w_courtroom->handle_song(&p_packet->get_contents()); } - else if (header == "RT") - { + else if (header == "RT") { if (f_contents.size() < 1) goto end; - if (courtroom_constructed) - { + if (courtroom_constructed) { if (f_contents.size() == 1) - w_courtroom->handle_wtce(f_contents.at(0), 0); + w_courtroom->handle_wtce(f_contents.at(0), 0); else if (f_contents.size() == 2) { - w_courtroom->handle_wtce(f_contents.at(0), f_contents.at(1).toInt()); + w_courtroom->handle_wtce(f_contents.at(0), f_contents.at(1).toInt()); } } } - else if (header == "HP") - { + else if (header == "HP") { if (courtroom_constructed && f_contents.size() > 1) - w_courtroom->set_hp_bar(f_contents.at(0).toInt(), f_contents.at(1).toInt()); + w_courtroom->set_hp_bar(f_contents.at(0).toInt(), + f_contents.at(1).toInt()); } - else if (header == "LE") - { - if (courtroom_constructed) - { + else if (header == "LE") { + if (courtroom_constructed) { QVector f_evi_list; - for (QString f_string : f_contents) - { + for (QString f_string : f_contents) { QStringList sub_contents = f_string.split("&"); if (sub_contents.size() < 3) @@ -608,67 +585,59 @@ void AOApplication::server_packet_received(AOPacket *p_packet) w_courtroom->set_evidence_list(f_evi_list); } } - else if (header == "ARUP") - { - if (courtroom_constructed) - { - int arup_type = f_contents.at(0).toInt(); - for (int n_element = 1 ; n_element < f_contents.size() ; n_element++) - { - w_courtroom->arup_modify(arup_type, n_element - 1, f_contents.at(n_element)); - } + else if (header == "ARUP") { + if (courtroom_constructed) { + int arup_type = f_contents.at(0).toInt(); + for (int n_element = 1; n_element < f_contents.size(); n_element++) { + w_courtroom->arup_modify(arup_type, n_element - 1, + f_contents.at(n_element)); } + } } - else if (header == "IL") - { + else if (header == "IL") { if (courtroom_constructed && f_contents.size() > 0) w_courtroom->set_ip_list(f_contents.at(0)); } - else if (header == "MU") - { + else if (header == "MU") { if (courtroom_constructed && f_contents.size() > 0) w_courtroom->set_mute(true, f_contents.at(0).toInt()); } - else if (header == "UM") - { + else if (header == "UM") { if (courtroom_constructed && f_contents.size() > 0) w_courtroom->set_mute(false, f_contents.at(0).toInt()); } - else if (header == "KK") - { - if (courtroom_constructed && f_contents.size() >= 1) - { - call_notice("You have been kicked from the server.\nReason: " + f_contents.at(0)); + else if (header == "KK") { + if (courtroom_constructed && f_contents.size() >= 1) { + call_notice("You have been kicked from the server.\nReason: " + + f_contents.at(0)); construct_lobby(); destruct_courtroom(); } } - else if (header == "KB") - { - if (courtroom_constructed && f_contents.size() >= 1) - { - call_notice("You have been banned from the server.\nReason: " + f_contents.at(0)); + else if (header == "KB") { + if (courtroom_constructed && f_contents.size() >= 1) { + call_notice("You have been banned from the server.\nReason: " + + f_contents.at(0)); construct_lobby(); destruct_courtroom(); } - } - else if (header == "BD") - { + else if (header == "BD") { call_notice("You are banned on this server.\nReason: " + f_contents.at(0)); } - else if (header == "ZZ") - { + else if (header == "ZZ") { if (courtroom_constructed && f_contents.size() > 0) w_courtroom->mod_called(f_contents.at(0)); } - else if (header == "CASEA") - { + else if (header == "CASEA") { if (courtroom_constructed && f_contents.size() > 6) - w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", f_contents.at(2) == "1", f_contents.at(3) == "1", f_contents.at(4) == "1", f_contents.at(5) == "1"); + w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", + f_contents.at(2) == "1", f_contents.at(3) == "1", + f_contents.at(4) == "1", + f_contents.at(5) == "1"); } - end: +end: delete p_packet; } @@ -695,8 +664,7 @@ void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded) QString f_packet = p_packet->to_string(); - if (encryption_needed) - { + if (encryption_needed) { #ifdef DEBUG_NETWORK qDebug() << "S(e):" << f_packet; #endif @@ -704,8 +672,7 @@ void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded) p_packet->encrypt_header(s_decryptor); f_packet = p_packet->to_string(); } - else - { + else { #ifdef DEBUG_NETWORK qDebug() << "S:" << f_packet; #endif diff --git a/src/path_functions.cpp b/src/path_functions.cpp index c51cfde3..811ca76f 100644 --- a/src/path_functions.cpp +++ b/src/path_functions.cpp @@ -3,18 +3,18 @@ #include "file_functions.h" #include -#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__)) +// this is a quite broad generalization +// the most common OSes(mac and windows) are _usually_ case insensitive +// however, there do exist mac installations with case sensitive filesystems +// in that case, define CASE_SENSITIVE_FILESYSTEM and compile on a mac +#if (defined(LINUX) || defined(__linux__)) #define CASE_SENSITIVE_FILESYSTEM #endif @@ -23,7 +23,7 @@ QString AOApplication::get_base_path() QString base_path = ""; #ifdef ANDROID QString sdcard_storage = getenv("SECONDARY_STORAGE"); - if (dir_exists(sdcard_storage + "/AO2/")){ + if (dir_exists(sdcard_storage + "/AO2/")) { base_path = sdcard_storage + "/AO2/"; } else { @@ -37,10 +37,7 @@ QString AOApplication::get_base_path() return base_path; } -QString AOApplication::get_data_path() -{ - return get_base_path() + "data/"; -} +QString AOApplication::get_data_path() { return get_base_path() + "data/"; } QString AOApplication::get_default_theme_path(QString p_file) { @@ -104,7 +101,8 @@ QString AOApplication::get_music_path(QString p_song) QString AOApplication::get_background_path(QString p_file) { - QString path = get_base_path() + "background/" + w_courtroom->get_current_background() + "/" + p_file; + QString path = get_base_path() + "background/" + + w_courtroom->get_current_background() + "/" + p_file; if (courtroom_constructed) { #ifndef CASE_SENSITIVE_FILESYSTEM return path; @@ -135,21 +133,25 @@ QString AOApplication::get_evidence_path(QString p_file) #endif } -QString AOApplication::get_case_sensitive_path(QString p_file) { - //first, check to see if it's actually there (also serves as base case for recursion) - if (exists(p_file)) return p_file; +QString AOApplication::get_case_sensitive_path(QString p_file) +{ + // first, check to see if it's actually there (also serves as base case for + // recursion) + if (exists(p_file)) + return p_file; QFileInfo file(p_file); QString file_basename = file.fileName(); QString file_parent_dir = get_case_sensitive_path(file.absolutePath()); - //second, does it exist in the new parent dir? + // second, does it exist in the new parent dir? if (exists(file_parent_dir + "/" + file_basename)) return file_parent_dir + "/" + file_basename; - //last resort, dirlist parent dir and find case insensitive match - QRegExp file_rx = QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString); + // last resort, dirlist parent dir and find case insensitive match + QRegExp file_rx = + QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString); QStringList files = QDir(file_parent_dir).entryList(); int result = files.indexOf(file_rx); @@ -157,6 +159,6 @@ QString AOApplication::get_case_sensitive_path(QString p_file) { if (result != -1) return file_parent_dir + "/" + files.at(result); - //if nothing is found, let the caller handle the missing file + // if nothing is found, let the caller handle the missing file return file_parent_dir + "/" + file_basename; } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 5a34ac8b..18f0e4cf 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -48,13 +48,15 @@ int AOApplication::get_max_log_size() bool AOApplication::get_log_goes_downwards() { - QString result = configini->value("log_goes_downwards", "false").value(); + QString 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(); + QString result = + configini->value("show_custom_shownames", "true").value(); return result.startsWith("true"); } @@ -62,14 +64,15 @@ QString AOApplication::get_default_username() { QString result = configini->value("default_username", "").value(); if (result.isEmpty()) - return get_ooc_name(); + return get_ooc_name(); else - return result; + return result; } QString AOApplication::get_audio_output_device() { - QString result = configini->value("default_audio_device", "default").value(); + QString result = + configini->value("default_audio_device", "default").value(); return result; } @@ -86,8 +89,7 @@ QStringList AOApplication::get_call_words() QTextStream in(&callwords_ini); - while (!in.atEnd()) - { + while (!in.atEnd()) { QString line = in.readLine(); return_value.append(line); } @@ -102,8 +104,7 @@ void AOApplication::write_to_serverlist_txt(QString p_line) serverlist_txt.setFileName(serverlist_txt_path); - if (!serverlist_txt.open(QIODevice::WriteOnly | QIODevice::Append)) - { + if (!serverlist_txt.open(QIODevice::WriteOnly | QIODevice::Append)) { return; } @@ -123,21 +124,19 @@ QVector AOApplication::read_serverlist_txt() serverlist_txt.setFileName(serverlist_txt_path); - if (!serverlist_txt.open(QIODevice::ReadOnly)) - { + if (!serverlist_txt.open(QIODevice::ReadOnly)) { return f_server_list; } QTextStream in(&serverlist_txt); - while(!in.atEnd()) - { + while (!in.atEnd()) { QString line = in.readLine(); server_type f_server; QStringList line_contents = line.split(":"); if (line_contents.size() < 3) - continue; + continue; f_server.ip = line_contents.at(0); f_server.port = line_contents.at(1).toInt(); @@ -150,13 +149,15 @@ QVector AOApplication::read_serverlist_txt() return f_server_list; } -QString AOApplication::read_design_ini(QString p_identifier, QString p_design_path) +QString AOApplication::read_design_ini(QString p_identifier, + QString p_design_path) { QSettings settings(p_design_path, QSettings::IniFormat); QVariant value = settings.value(p_identifier); if (value.type() == QVariant::StringList) { return value.toStringList().join(","); - } else { + } + else { return value.toString(); } } @@ -172,8 +173,7 @@ QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file) return_value.setX(0); return_value.setY(0); - if (f_result == "") - { + if (f_result == "") { f_result = read_design_ini(p_identifier, default_path); if (f_result == "") @@ -191,7 +191,8 @@ QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file) return return_value; } -pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QString p_file) +pos_size_type AOApplication::get_element_dimensions(QString p_identifier, + QString p_file) { QString design_ini_path = get_theme_path(p_file); QString default_path = get_default_theme_path(p_file); @@ -204,8 +205,7 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QStrin return_value.width = -1; return_value.height = -1; - if (f_result == "") - { + if (f_result == "") { f_result = read_design_ini(p_identifier, default_path); if (f_result == "") @@ -229,8 +229,7 @@ QString AOApplication::get_font_name(QString p_identifier, QString p_file) QString design_ini_path = get_theme_path(p_file); QString f_result = read_design_ini(p_identifier, design_ini_path); QString default_path = get_default_theme_path(p_file); - if (f_result == "") - { + if (f_result == "") { f_result = read_design_ini(p_identifier, default_path); if (f_result == "") return "Sans"; @@ -243,8 +242,7 @@ int AOApplication::get_font_size(QString p_identifier, QString p_file) QString default_path = get_default_theme_path(p_file); QString f_result = read_design_ini(p_identifier, design_ini_path); - if (f_result == "") - { + if (f_result == "") { f_result = read_design_ini(p_identifier, default_path); if (f_result == "") @@ -262,8 +260,7 @@ QColor AOApplication::get_color(QString p_identifier, QString p_file) QColor return_color(0, 0, 0); - if (f_result == "") - { + if (f_result == "") { f_result = read_design_ini(p_identifier, default_path); if (f_result == "") @@ -286,39 +283,37 @@ QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) { QColor return_color(255, 255, 255); - if (p_identifier == "_inline_grey") - { + if (p_identifier == "_inline_grey") { return_color = QColor(187, 187, 187); } - else - { + else { switch (p_identifier.toInt()) { - case 1: - return_color = QColor(0, 255, 0); - break; - case 2: - return_color = QColor(255, 0, 0); - break; - case 3: - return_color = QColor(255, 165, 0); - break; - case 4: - return_color = QColor(45, 150, 255); - break; - case 5: - return_color = QColor(255, 255, 0); - break; - case 7: - return_color = QColor(255, 192, 203); - break; - case 8: - return_color = QColor(0, 255, 255); - break; - case 0: - case 6: // 6 is rainbow. - default: - return_color = QColor(255, 255, 255); - break; + case 1: + return_color = QColor(0, 255, 0); + break; + case 2: + return_color = QColor(255, 0, 0); + break; + case 3: + return_color = QColor(255, 165, 0); + break; + case 4: + return_color = QColor(45, 150, 255); + break; + case 5: + return_color = QColor(255, 255, 0); + break; + case 7: + return_color = QColor(255, 192, 203); + break; + case 8: + return_color = QColor(0, 255, 255); + break; + case 0: + case 6: // 6 is rainbow. + default: + return_color = QColor(255, 255, 255); + break; } } @@ -327,8 +322,7 @@ QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) QString default_path = get_base_path() + "misc/default/config.ini"; QString f_result = read_design_ini(p_identifier, design_ini_path); - if (f_result == "") - { + if (f_result == "") { f_result = read_design_ini(p_identifier, default_path); if (f_result == "") @@ -355,8 +349,7 @@ QString AOApplication::get_sfx(QString p_identifier) QString return_sfx = ""; - if (f_result == "") - { + if (f_result == "") { f_result = read_design_ini(p_identifier, default_path); if (f_result == "") @@ -370,35 +363,34 @@ QString AOApplication::get_sfx(QString p_identifier) QString AOApplication::get_sfx_suffix(QString sound_to_check) { - QString mp3_check = get_sounds_path(sound_to_check + ".mp3"); - QString opus_check = get_sounds_path(sound_to_check + ".opus"); - if (file_exists(opus_check)) - { - return sound_to_check + ".opus"; - } - else if (file_exists(mp3_check)) - { - return sound_to_check + ".mp3"; - } - return sound_to_check + ".wav"; + QString mp3_check = get_sounds_path(sound_to_check + ".mp3"); + QString opus_check = get_sounds_path(sound_to_check + ".opus"); + if (file_exists(opus_check)) { + return sound_to_check + ".opus"; + } + else if (file_exists(mp3_check)) { + return sound_to_check + ".mp3"; + } + return sound_to_check + ".wav"; } QString AOApplication::get_image_suffix(QString path_to_check) { - QString apng_check = path_to_check + ".apng"; - if (file_exists(apng_check)) - { - return apng_check; - } - return path_to_check + ".gif"; + QString apng_check = path_to_check + ".apng"; + if (file_exists(apng_check)) { + return apng_check; + } + return path_to_check + ".gif"; } - -//returns whatever is to the right of "search_line =" within target_tag and terminator_tag, trimmed -//returns the empty string if the search line couldnt be found -QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QString target_tag) +// returns whatever is to the right of "search_line =" within target_tag and +// terminator_tag, trimmed returns the empty string if the search line couldnt +// be found +QString AOApplication::read_char_ini(QString p_char, QString p_search_line, + QString target_tag) { - QSettings settings(get_character_path(p_char, "char.ini"), QSettings::IniFormat); + QSettings settings(get_character_path(p_char, "char.ini"), + QSettings::IniFormat); settings.beginGroup(target_tag); QString value = settings.value(p_search_line).toString(); settings.endGroup(); @@ -411,7 +403,8 @@ QString AOApplication::get_char_name(QString p_char) if (f_result == "") return p_char; - else return f_result; + else + return f_result; } QString AOApplication::get_showname(QString p_char) @@ -423,7 +416,8 @@ QString AOApplication::get_showname(QString p_char) return ""; if (f_result == "") return p_char; - else return f_result; + else + return f_result; } QString AOApplication::get_char_side(QString p_char) @@ -432,7 +426,8 @@ QString AOApplication::get_char_side(QString p_char) if (f_result == "") return "wit"; - else return f_result; + else + return f_result; } QString AOApplication::get_gender(QString p_char) @@ -441,14 +436,16 @@ QString AOApplication::get_gender(QString p_char) if (f_result == "") return "male"; - else return f_result; + else + return f_result; } QString AOApplication::get_chat(QString p_char) { QString f_result = read_char_ini(p_char, "chat", "Options"); - //handling the correct order of chat is a bit complicated, we let the caller do it + // handling the correct order of chat is a bit complicated, we let the caller + // do it return f_result; } @@ -457,7 +454,8 @@ QString AOApplication::get_char_shouts(QString p_char) QString f_result = read_char_ini(p_char, "shouts", "Options"); if (f_result == "") return "default"; - else return f_result; + else + return f_result; } int AOApplication::get_preanim_duration(QString p_char, QString p_emote) @@ -466,7 +464,8 @@ int AOApplication::get_preanim_duration(QString p_char, QString p_emote) if (f_result == "") return -1; - else return f_result.toInt(); + else + return f_result.toInt(); } int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote) @@ -475,7 +474,8 @@ int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote) if (f_result == "") return -1; - else return f_result.toInt(); + else + return f_result.toInt(); } int AOApplication::get_emote_number(QString p_char) @@ -484,68 +484,75 @@ int AOApplication::get_emote_number(QString p_char) if (f_result == "") return 0; - else return f_result.toInt(); + else + return f_result.toInt(); } QString AOApplication::get_emote_comment(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 4) - { + if (result_contents.size() < 4) { qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; return "normal"; } - else return result_contents.at(0); + else + return result_contents.at(0); } QString AOApplication::get_pre_emote(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 4) - { + if (result_contents.size() < 4) { qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; return ""; } - else return result_contents.at(1); + else + return result_contents.at(1); } QString AOApplication::get_emote(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 4) - { + if (result_contents.size() < 4) { qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; return "normal"; } - else return result_contents.at(2); + else + return result_contents.at(2); } int AOApplication::get_emote_mod(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); QStringList result_contents = f_result.split("#"); - if (result_contents.size() < 4) - { - qDebug() << "W: misformatted char.ini: " << p_char << ", " << QString::number(p_emote); + if (result_contents.size() < 4) { + qDebug() << "W: misformatted char.ini: " << p_char << ", " + << QString::number(p_emote); return 0; } - else return result_contents.at(3).toInt(); + else + return result_contents.at(3).toInt(); } int AOApplication::get_desk_mod(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "Emotions"); QStringList result_contents = f_result.split("#"); @@ -556,25 +563,30 @@ int AOApplication::get_desk_mod(QString p_char, int p_emote) if (string_result == "") return -1; - else return string_result.toInt(); + else + return string_result.toInt(); } QString AOApplication::get_sfx_name(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundN"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "SoundN"); if (f_result == "") return "1"; - else return f_result; + else + return f_result; } int AOApplication::get_sfx_delay(QString p_char, int p_emote) { - QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundT"); + QString f_result = + read_char_ini(p_char, QString::number(p_emote + 1), "SoundT"); if (f_result == "") return 1; - else return f_result.toInt(); + else + return f_result.toInt(); } int AOApplication::get_text_delay(QString p_char, QString p_emote) @@ -583,7 +595,8 @@ int AOApplication::get_text_delay(QString p_char, QString p_emote) if (f_result == "") return -1; - else return f_result.toInt(); + else + return f_result.toInt(); } QString AOApplication::get_custom_realization(QString p_char) @@ -592,65 +605,74 @@ QString AOApplication::get_custom_realization(QString p_char) if (f_result == "") return get_sfx("realization"); - else return f_result; + else + return f_result; } bool AOApplication::get_blank_blip() { - QString result = configini->value("blank_blip", "false").value(); - return result.startsWith("true"); + QString result = configini->value("blank_blip", "false").value(); + return result.startsWith("true"); } bool AOApplication::is_discord_enabled() { - QString result = configini->value("discord", "true").value(); - return result.startsWith("true"); + QString result = configini->value("discord", "true").value(); + return result.startsWith("true"); } bool AOApplication::get_casing_enabled() { - QString result = configini->value("casing_enabled", "false").value(); - return result.startsWith("true"); + 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"); + 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"); + 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"); + 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"); + 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(); + QString result = + configini->value("casing_steno_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 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(); + QString result = + configini->value("casing_can_host_cases", "Turnabout Check Your Settings") + .value(); return result; } -- cgit From df8f19320b3a37521a7f93a578bf31c81f885238 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Fri, 22 May 2020 19:35:49 -0500 Subject: Bring back CI changes and macOS support --- .github/labeler.yml | 8 ++++++ .gitignore | 4 +++ .gitlab-ci.yml | 69 ++++++++++++++++++++++++++++++++++----------- .travis.yml | 22 +++++++++++---- scripts/configure_ubuntu.sh | 6 ++-- scripts/macos_build.sh | 2 +- scripts/macos_post_build.sh | 4 ++- scripts/wasabi_program.sh | 2 +- scripts/windows/Dockerfile | 11 ++++++-- src/hardware_functions.cpp | 4 +++ src/path_functions.cpp | 2 ++ 11 files changed, 104 insertions(+), 30 deletions(-) create mode 100644 .github/labeler.yml mode change 100644 => 100755 scripts/macos_post_build.sh diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..56c4cc7c --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,8 @@ +translation: + - resource/translations/* + +content: + - base/**/* + +good_luck: + - src/courtroom.cpp diff --git a/.gitignore b/.gitignore index 1adb744f..3f8b3ae4 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.dll *.so *.pro.autosave +*.pro.user base_override.h .DS_Store @@ -21,6 +22,7 @@ debug/ Makefile* object_script* +/android/gradle* /Attorney_Online_remake_resource.rc /attorney_online_remake_plugin_import.cpp @@ -31,3 +33,5 @@ discord/ moc* /Attorney_Online_CC_resource.rc /attorney_online_cc_plugin_import.cpp + +*.autosave diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0f68fe5a..e9685de0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,9 @@ cache: paths: - lib/ +variables: + DEBIAN_FRONTEND: noninteractive + before_script: - echo Current working directory is $(pwd) @@ -22,22 +25,24 @@ build linux x86_64: - apt-get update - > apt-get install --no-install-recommends -y qt5-default qtmultimedia5-dev - clang make git sudo curl ca-certificates pkg-config upx unzip + clang make git sudo curl ca-certificates pkg-config upx unzip xz-utils + - git submodule init + - git submodule update # Print versions - qmake --version - clang --version # Extract BASS - - mkdir bass - - cd bass - - curl http://www.un4seen.com/files/bass24-linux.zip -o bass.zip - - unzip bass.zip - - cp x64/libbass.so ../lib - - curl http://www.un4seen.com/files/bassopus24-linux.zip -o bassopus.zip - - unzip bassopus.zip - - cp x64/libbassopus.so ../lib - - cd .. + #- mkdir bass + #- cd bass + #- curl http://www.un4seen.com/files/bass24-linux.zip -o bass.zip + #- unzip bass.zip + #- cp x64/libbass.so ../lib + #- curl http://www.un4seen.com/files/bassopus24-linux.zip -o bassopus.zip + #- unzip bassopus.zip + #- cp x64/libbassopus.so ../lib + #- cd .. # Extract Discord RPC - mkdir discord-rpc @@ -56,7 +61,7 @@ build linux x86_64: - cd .. # Build - - qmake -spec linux-clang + - qmake -spec linux-clang "DEFINES += DISCORD QTAUDIO" - make -j4 # Post-processing @@ -75,6 +80,11 @@ build windows i686: # Install dependencies - apt-get update - apt-get install --no-install-recommends -y make curl ca-certificates upx unzip + - git submodule init + - git submodule update + + # Print versions + - /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake --version # Extract BASS - mkdir bass @@ -87,8 +97,19 @@ build windows i686: - cp bassopus.dll ../lib - cd .. + # Extract QtApng + # - mkdir qtapng + # - cd qtapng + # - curl -L https://github.com/Skycoder42/QtApng/releases/download/1.1.2-2/qtapng_mingw73_32_5.13.0.zip -o apng.zip + # - unzip apng.zip + # - mkdir ../lib/imageformats + # - cp mingw73_32/plugins/imageformats/qapng.dll ../lib/imageformats/ + # - cd .. + + - ls lib + # Build - - /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake + - /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake "DEFINES += DISCORD BASSAUDIO" - make -j4 # Post-processing @@ -124,7 +145,7 @@ deploy linux x86_64: - *deploy_misc # Platform-specific - - cp -a ../lib/*.so . + - cp -a ../lib/* . - cp -a ../bin/Attorney_Online . - echo "#!/bin/sh" >> ./run.sh - echo "LD_LIBRARY_PATH=.:\$LD_LIBRARY_PATH ./Attorney_Online" >> ./run.sh @@ -158,6 +179,8 @@ deploy windows i686: # Platform-specific - cp -a ../lib/*.dll . + - mkdir imageformats + - 'cp -a ../lib/imageformats/*.dll imageformats/ || :' - cp -a ../bin/Attorney_Online.exe . # Zipping @@ -190,11 +213,17 @@ publish linux x86_64: - deploy linux x86_64 when: manual script: + - apt-get update + - apt-get install --no-install-recommends -y git nodejs npm awscli + - cd scripts + - npm install + - cd .. + - cd zip - - ../scripts/wasabi.sh + - ../scripts/wasabi_program.sh variables: MANIFEST: program_linux_x86_64.json - ARTIFACT_SUFFIX: _linux_x64.tar.xz + ARTIFACT_SUFFIX: linux_x64.tar.xz publish windows i686: image: ubuntu @@ -203,8 +232,14 @@ publish windows i686: - deploy windows i686 when: manual script: + - apt-get update + - apt-get install --no-install-recommends -y git nodejs npm awscli + - cd scripts + - npm install + - cd .. + - cd zip - - ../scripts/wasabi.sh + - ../scripts/wasabi_program.sh variables: MANIFEST: program_winnt_i386.json - ARTIFACT_SUFFIX: _windows_x86.zip + ARTIFACT_SUFFIX: windows_x86.zip diff --git a/.travis.yml b/.travis.yml index 4243b3b9..dbd19cdc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,21 @@ language: cpp os: osx - addons: - homebrew: - packages: - - qt5 + homebrew: + update: true + packages: + - qt5 script: - - ./scripts/macos_build.sh - - ./scripts/macos_post_build.sh +- "./scripts/macos_build.sh" +- "./scripts/macos_post_build.sh" + +deploy: + provider: releases + api_key: + secure: mZCNwnqKeqJP5CqgYOanYnr/KHydxueGPRhvGLpY0Pop7MiH3CIHMN5dhHbtgJvE5GGMR4xUIEhPpmkCEJw7YiPREMqT4mkV4DR531ZLB3t/FizyvIwXuP6jFwzTofZ51qHfBpcurVc9sMFeD9Pw+rLTTgIiXL2sZxUUXc8U+ZZug1lYndgcO6P00fUJd6V9lyFQUGmbSca97YbG6KuCym0fEpyRnMqzKLjYsUUo8UKRBADtmD822O6z2FSldNZDn45Mkx0MYfHWyT5hzTb7WGa+DrTB/0un1HqqsNPlb/ahjrFQQNR2qd7HNGZa+Mvwi6egTDug+k15x8lbkacUoi34U1eFq9LSTYm8dSO5g23I1OvGvjTCkDj1jOLPqB99XlbAJ0E/9Jzw7wtlLaAzvFzTj/B63TQnO3IsgHBWR14CZlf05WMOFf2irwl+kL6ktspIHnlGgaiWYYrKeAt7QJAXiQOdYDz6SaWVC6TyOE/SszXRU6xFotmCjkP2irM5yGE8SUw2uIzKjD9uG0ZXtbLcdQEFD316+qglqFTCjnKsRfbtQs2u5spZPsZSdsOZCbLfNIn0GSTFRymFsK6gsvji8AD8AZo0zcOZ/7NMVC6A8RnF3Ve+vU/xljhsIOxoLZDvZPia7WozdV99xmnepWBwkuoQs/K0xmWcnLZDcb0= + file: "../bin/Attorney_Online_mac_x86_64.zip" + draft: true + on: + tags: true + repo: AttorneyOnline/AO2-Client diff --git a/scripts/configure_ubuntu.sh b/scripts/configure_ubuntu.sh index 1f9b8e83..280dfdf9 100755 --- a/scripts/configure_ubuntu.sh +++ b/scripts/configure_ubuntu.sh @@ -7,11 +7,13 @@ set -eu ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" -cd ${ROOT_DIR} +cd "${ROOT_DIR}" + #need some openGL stuff sudo apt install libgl1-mesa-dev - +#install curl incase of fresh vm +sudo apt install curl mkdir tmp cd tmp diff --git a/scripts/macos_build.sh b/scripts/macos_build.sh index 22e2d457..efb7653f 100755 --- a/scripts/macos_build.sh +++ b/scripts/macos_build.sh @@ -30,4 +30,4 @@ tar -xvf apng.tar.xz cp clang_64/plugins/imageformats/libqapng.dylib ../lib cd .. -qmake && make -j2 +/usr/local/opt/qt/bin/qmake && make -j2 diff --git a/scripts/macos_post_build.sh b/scripts/macos_post_build.sh old mode 100644 new mode 100755 index 50acb408..df1475c4 --- a/scripts/macos_post_build.sh +++ b/scripts/macos_post_build.sh @@ -13,10 +13,12 @@ ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" cd ${ROOT_DIR} # This thing basically does all the work -macdeployqt ../bin/Attorney_Online.app +/usr/local/opt/qt/bin/macdeployqt ../bin/Attorney_Online.app # Need to add the dependencies cp ../lib/* ../bin/Attorney_Online.app/Contents/Frameworks # libbass has a funny path for some reason, just use rpath install_name_tool -change @loader_path/libbass.dylib @rpath/libbass.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online + +zip -r -9 ../bin/Attorney_Online_mac_x86_64.zip ../bin/ \ No newline at end of file diff --git a/scripts/wasabi_program.sh b/scripts/wasabi_program.sh index 41e2e352..37feac6e 100755 --- a/scripts/wasabi_program.sh +++ b/scripts/wasabi_program.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Updates the specified program manifest to a new archive and version # and uploads the new archive and manifest to S3/Wasabi. # diff --git a/scripts/windows/Dockerfile b/scripts/windows/Dockerfile index f4f1a836..b9a12d66 100644 --- a/scripts/windows/Dockerfile +++ b/scripts/windows/Dockerfile @@ -10,5 +10,12 @@ RUN /opt/mxe/usr/bin/${TARGET_SPEC}-cmake .. -DCMAKE_INSTALL_PREFIX=/opt/mxe/usr RUN /opt/mxe/usr/bin/${TARGET_SPEC}-cmake --build . --config Release --target install WORKDIR ../.. -# NOTE: Do not build QtApng statically! libpng contains a self-test entry point that -# takes precedence for some reason over the final build's entry point. +# Build QtApng statically +RUN git clone https://github.com/Skycoder42/QtApng +WORKDIR QtApng +# libpng contains a self-test entry point that takes precedence for some reason +# over the final build's entry point. +RUN sed -i "s/^main(/libpng_main(/g" src/3rdparty/libpng/src/pngtest.c +RUN /opt/mxe/usr/${TARGET_SPEC}/qt5/bin/qmake +RUN make && make install +WORKDIR .. \ No newline at end of file diff --git a/src/hardware_functions.cpp b/src/hardware_functions.cpp index c898aefe..82b4f0c7 100644 --- a/src/hardware_functions.cpp +++ b/src/hardware_functions.cpp @@ -49,6 +49,10 @@ QString get_hdid() } #elif defined __APPLE__ + +#include +#include + QString get_hdid() { CFStringRef serial; diff --git a/src/path_functions.cpp b/src/path_functions.cpp index 811ca76f..10c8ae53 100644 --- a/src/path_functions.cpp +++ b/src/path_functions.cpp @@ -30,6 +30,8 @@ QString AOApplication::get_base_path() QString external_storage = getenv("EXTERNAL_STORAGE"); base_path = external_storage + "/AO2/"; } +#elif defined(__APPLE__) + base_path = applicationDirPath() + "/../../../base/"; #else base_path = applicationDirPath() + "/base/"; #endif -- cgit From 25ae8071fb18c000804660f671b1cb0f9d69b3f9 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Fri, 22 May 2020 19:37:12 -0500 Subject: Bring back Android project files --- Attorney_Online.pro | 11 ++++++ android/AndroidManifest.xml | 79 +++++++++++++++++++++++++++++++++++++ android/build.gradle | 62 +++++++++++++++++++++++++++++ android/project.properties | 1 + android/res/drawable-ldpi/icon.png | Bin 0 -> 29302 bytes android/res/values/libs.xml | 22 +++++++++++ 6 files changed, 175 insertions(+) create mode 100644 android/AndroidManifest.xml create mode 100644 android/build.gradle create mode 100644 android/project.properties create mode 100644 android/res/drawable-ldpi/icon.png create mode 100644 android/res/values/libs.xml diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 7eda5487..f04c22a0 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -43,3 +43,14 @@ RESOURCES += resources.qrc win32:RC_ICONS = resource/logo.ico macx:ICON = resource/logo.icns + +android:DISTFILES += \ + android/AndroidManifest.xml \ + android/build.gradle \ + android/gradle/wrapper/gradle-wrapper.jar \ + android/gradle/wrapper/gradle-wrapper.properties \ + android/gradlew \ + android/gradlew.bat \ + android/res/values/libs.xml + +ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml new file mode 100644 index 00000000..0792ce86 --- /dev/null +++ b/android/AndroidManifest.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 00000000..3087d08c --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,62 @@ +buildscript { + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:3.5.0' + } +} + +repositories { + google() + jcenter() +} + +apply plugin: 'com.android.application' + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) +} + +android { + /******************************************************* + * The following variables: + * - androidBuildToolsVersion, + * - androidCompileSdkVersion + * - qt5AndroidDir - holds the path to qt android files + * needed to build any Qt application + * on Android. + * + * are defined in gradle.properties file. This file is + * updated by QtCreator and androiddeployqt tools. + * Changing them manually might break the compilation! + *******************************************************/ + + compileSdkVersion androidCompileSdkVersion.toInteger() + + buildToolsVersion '28.0.3' + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] + aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] + res.srcDirs = [qt5AndroidDir + '/res', 'res'] + resources.srcDirs = ['resources'] + renderscript.srcDirs = ['src'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] + } + } + + lintOptions { + abortOnError false + } + + // Do not compress Qt binary resources file + aaptOptions { + noCompress 'rcc' + } +} diff --git a/android/project.properties b/android/project.properties new file mode 100644 index 00000000..a08f37ed --- /dev/null +++ b/android/project.properties @@ -0,0 +1 @@ +target=android-21 \ No newline at end of file diff --git a/android/res/drawable-ldpi/icon.png b/android/res/drawable-ldpi/icon.png new file mode 100644 index 00000000..f53fe30c Binary files /dev/null and b/android/res/drawable-ldpi/icon.png differ diff --git a/android/res/values/libs.xml b/android/res/values/libs.xml new file mode 100644 index 00000000..6b1a4a2a --- /dev/null +++ b/android/res/values/libs.xml @@ -0,0 +1,22 @@ + + + + https://download.qt.io/ministro/android/qt5/qt-5.14 + + + + + + + + + + + + + + + + + -- cgit From 392cefbee43c667ca21244f08f5d97814f282327 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Fri, 22 May 2020 19:42:47 -0500 Subject: Bring back translation files Note that there are some strings that had the tr() qualification removed, and also a LOT of strings that were never wrapped with tr() to begin with. It will take some work to bring back i18n support. --- Attorney_Online.pro | 8 + resource/translations/ao_de.qm | Bin 0 -> 23500 bytes resource/translations/ao_de.ts | 1118 ++++++++++++++++++++++++++++++++++++++++ resource/translations/ao_en.qm | Bin 0 -> 23 bytes resource/translations/ao_en.ts | 937 +++++++++++++++++++++++++++++++++ resource/translations/ao_es.qm | Bin 0 -> 28457 bytes resource/translations/ao_es.ts | 1048 +++++++++++++++++++++++++++++++++++++ resource/translations/ao_jp.qm | Bin 0 -> 2004 bytes resource/translations/ao_jp.ts | 964 ++++++++++++++++++++++++++++++++++ resource/translations/ao_pl.qm | Bin 0 -> 27653 bytes resource/translations/ao_pl.ts | 987 +++++++++++++++++++++++++++++++++++ resource/translations/ao_pt.qm | Bin 0 -> 28605 bytes resource/translations/ao_pt.ts | 977 +++++++++++++++++++++++++++++++++++ resource/translations/ao_ru.qm | Bin 0 -> 21968 bytes resource/translations/ao_ru.ts | 999 +++++++++++++++++++++++++++++++++++ 15 files changed, 7038 insertions(+) create mode 100644 resource/translations/ao_de.qm create mode 100644 resource/translations/ao_de.ts create mode 100644 resource/translations/ao_en.qm create mode 100644 resource/translations/ao_en.ts create mode 100644 resource/translations/ao_es.qm create mode 100644 resource/translations/ao_es.ts create mode 100644 resource/translations/ao_jp.qm create mode 100644 resource/translations/ao_jp.ts create mode 100644 resource/translations/ao_pl.qm create mode 100644 resource/translations/ao_pl.ts create mode 100644 resource/translations/ao_pt.qm create mode 100644 resource/translations/ao_pt.ts create mode 100644 resource/translations/ao_ru.qm create mode 100644 resource/translations/ao_ru.ts diff --git a/Attorney_Online.pro b/Attorney_Online.pro index f04c22a0..4b06b225 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -41,6 +41,14 @@ CONFIG += c++14 RESOURCES += resources.qrc +TRANSLATIONS = resource/translations/ao_en.ts \ + resource/translations/ao_jp.ts \ + resource/translations/ao_de.ts \ + resource/translations/ao_ru.ts \ + resource/translations/ao_es.ts \ + resource/translations/ao_pt.ts \ + resource/translations/ao_pl.ts + win32:RC_ICONS = resource/logo.ico macx:ICON = resource/logo.icns diff --git a/resource/translations/ao_de.qm b/resource/translations/ao_de.qm new file mode 100644 index 00000000..6fd250de Binary files /dev/null and b/resource/translations/ao_de.qm differ diff --git a/resource/translations/ao_de.ts b/resource/translations/ao_de.ts new file mode 100644 index 00000000..c4e9f300 --- /dev/null +++ b/resource/translations/ao_de.ts @@ -0,0 +1,1118 @@ + + + + + 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. + + + Error connecting to master server. Will try again in %n seconds. + 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. + Es gab einen Fehler beim Verbinden zum Master Server. +Wir verwenden mehrere Master Server um Ausfälle zu verhindern, jedoch hat der Client alle Möglichkeiten einen zu finden erschöpft. +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. +Grund: %1 + + + You have been kicked from the server. +Reason: + Du wurdest von diesem Server geschmissen. +Grund: + + + You are banned on this server. +Reason: + Du wurdest von diesem Server verbannt. +Grund: + + + You have been kicked. + Du wurdest rausgeschmissen. + + + You are banned on this server. + Du wurdest verbannt. + + + + 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 + + + + 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. + 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. + + + + 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. + + + + 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: + 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. + + + + 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. + + + + 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. + + + + 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. + + + + Courtroom + + + Password + Passwort + + + + Spectator + Zuschauer + + + + + Search + Suche + + + + Passworded + Gesperrt + + + + Taken + Benutzt + + + Generating chars: +%1/%2 + Generiere Charaktere: +%1/%2 + + + Generating chars: + + Generiere Charaktere: + + + + + Could not find %1 + Konnte %1 nicht finden + + + + Showname + Anzeigename + + + + Message + Nachricht + + + + OOC Message + OOC Nachricht + + + + Name + Name + + + + Pre + Vor + + + + Flip + Spiegeln + + + Guard + 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. + Du hast nun den "Modcall deaktivieren" Knopf. + + + + 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. + Zu viele Argumente zum Speichern! Bitte gib nur den Dateinamen ohne Erweiterung und den Saalstatus an. + + + %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. + + + 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! + + + 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: + 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: + + + + Too many arguments to load a case! You only need one filename, without extension. + Zu viele Argumente! Du brauchst nur den Dateinamen, ohne Erweiterung. + + + Case made by + Fall von + + + Navigate to + Gehe zu + + + for the CM doc. + für das CM Dokument. + + + Your case " + Dein Fall " + + + " was loaded! + " 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! + + + + 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. + + + Choose.. + Wähle.. + + + + Choose... + Wähle... + + + + Images (*.png) + Bilder (*.png) + + + + Add new evidence... + Neues Beweisstück... + + + + Discord + + Objection! + Einspruch! + + + In Lobby + In Lobby + + + Idle + Untätig + + + In a Server + In einem Server + + + Playing as %1 + Spielt als %1 + + + Spectating + Zuschauend + + + + Lobby + + + Attorney Online 2 + Attorney Online 2 + + + + Name + 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, 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 + <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 + + + Attorney Online 2 is built using Qt 5.11. + +Lead development: +longbyte1 +OmniTroid + +stonedDiscord +Supporting development: +Fiercy + +UI design: +Ruekasu +Draxirch + +Special thanks: +Unishred +Argoneus +Noevain +Cronnicossy + Attorney Online 2 wurde gemacht mit Qt 5.11. + +Leitende Entwicklung: +longbyte1 +OmniTroid +stonedDiscord + +Unterstützende Entwicklung: +Fiercy + +UI Design: +Ruekasu +Draxirch + +Speziellen Dank: +Unishred +Argoneus +Noevain +Cronnicossy + + + + + Offline + Offline + + + + debug_functions + + + Error: %1 + Fehler: %1 + + + + Error + Fehler + + + + Notice + Hinweis + + + diff --git a/resource/translations/ao_en.qm b/resource/translations/ao_en.qm new file mode 100644 index 00000000..9dad8dff Binary files /dev/null and b/resource/translations/ao_en.qm differ diff --git a/resource/translations/ao_en.ts b/resource/translations/ao_en.ts new file mode 100644 index 00000000..9719319f --- /dev/null +++ b/resource/translations/ao_en.ts @@ -0,0 +1,937 @@ + + + + + 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 + + + + + AOCaseAnnouncerDialog + + + Case Announcer + + + + + Case title: + + + + + Defense needed + + + + + Prosecution needed + + + + + Judge needed + + + + + Jurors needed + + + + + Stenographer needed + + + + + Witness needed + + + + + 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: + + + + + 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: + + + + + 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. + + + + + Courtroom + + + Password + + + + + Spectator + + + + + + Search + + + + + Passworded + + + + + Taken + + + + + Could not find %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 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! + + + + + 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. + + + + + Choose... + + + + + Images (*.png) + + + + + Add new evidence... + + + + + Lobby + + + Attorney Online 2 + + + + + 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? + + + + + 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, 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 + + + + + debug_functions + + + Error: %1 + + + + + Error + + + + + Notice + + + + diff --git a/resource/translations/ao_es.qm b/resource/translations/ao_es.qm new file mode 100644 index 00000000..42ca3a00 Binary files /dev/null and b/resource/translations/ao_es.qm differ diff --git a/resource/translations/ao_es.ts b/resource/translations/ao_es.ts new file mode 100644 index 00000000..2cad7ce1 --- /dev/null +++ b/resource/translations/ao_es.ts @@ -0,0 +1,1048 @@ + + + + + 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. + I translated master servers as "lista de servidores" because literally nobody will understand if i make the literal translation "servidor maestro". And in the end a master server is just a list of servers. Also removed the part about having multiple master servers, i just don't think the average user will understand this even if i do a good translation. + 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 +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 + + + + + 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. +Razón: %1 + + + You have been kicked from the server. +Reason: + Has sido expulsado del servidor. +Razón: + + + You are banned on this server. +Reason: + Has sido bloqueado en este servidor. +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 + + + + 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. + + + + 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: + + + Sets the music's default volume. + 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'. + + + + 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. + + + 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: + 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: + + + 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 + A translation wouldn't fit because of the shitty theme system. + + + + + Taken + En uso + + + + Could not find %1 + No se pudo encontrar %1 + + + Generating chars: +%1/%2 + Generando personajes: +%1/%2 + + + Generating chars: + + Generando personajes: + + + + + 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. + + + + Guard + 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. + + + You were granted the Guard button. + 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! + + + 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: + ¡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: + + + + 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. + + + Case made by + Caso hecho por + + + Navigate to + Navegue a + + + for the CM doc. + para el documento de CM. + + + Your case " + Su caso " + + + " was loaded! + " 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. + + + + 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. + + + + Choose... + Elegir... + + + + Images (*.png) + Imágenes (* .png) + + + + Add new evidence... + Añadir nueva evidencia... + + + + Lobby + + + Attorney Online 2 + + + + + Name + 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, 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 + + + + debug_functions + + + Error: %1 + + + + + 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. + + + + diff --git a/resource/translations/ao_jp.qm b/resource/translations/ao_jp.qm new file mode 100644 index 00000000..e4fb562a Binary files /dev/null and b/resource/translations/ao_jp.qm differ diff --git a/resource/translations/ao_jp.ts b/resource/translations/ao_jp.ts new file mode 100644 index 00000000..029e84ad --- /dev/null +++ b/resource/translations/ao_jp.ts @@ -0,0 +1,964 @@ + + + + + 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 + + + + + AOCaseAnnouncerDialog + + + Case Announcer + + + + + Case title: + + + + + Defense needed + + + + + Prosecution needed + + + + + Judge needed + + + + + Jurors needed + + + + + Stenographer needed + + + + + Witness needed + + + + + 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: + + + + + 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: + 音楽: + + + + 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. + + + + + Courtroom + + + Password + + + + + Spectator + 観客 + + + + + Search + + + + + Passworded + + + + + Taken + + + + + Could not find %1 + + + + + Showname + + + + + Message + + + + + Name + 名前 + + + + Pre + + + + + Flip + フリップ + + + Guard + ガード + + + + + 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. + + + + + 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! + + + + + 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. + + + + + Choose... + 選択... + + + + Images (*.png) + イメージ (*.png) + + + + Add new evidence... + 新しい証拠を付け加える... + + + + Discord + + Objection! + 意義あり! + + + In Lobby + ロビーでいる + + + Idle + 落ちている + + + In a Server + サーバーでいます + + + Spectating + 観客している + + + + Lobby + + + Attorney Online 2 + + + + + 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? + + + + + 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, 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 + オフライン + + + + debug_functions + + + Error: %1 + エラー: %1 + + + + Error + エラー + + + + Notice + 通知 + + + diff --git a/resource/translations/ao_pl.qm b/resource/translations/ao_pl.qm new file mode 100644 index 00000000..995a5bc9 Binary files /dev/null and b/resource/translations/ao_pl.qm differ diff --git a/resource/translations/ao_pl.ts b/resource/translations/ao_pl.ts new file mode 100644 index 00000000..2662fcf3 --- /dev/null +++ b/resource/translations/ao_pl.ts @@ -0,0 +1,987 @@ + + + + + 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. + Odkryto błąd podczas łączenia się z głównym serwerem. +Używamy wielu głównych serwerów, aby zminimalizować każdą możliwą przerwę, ale klient wyczerpał jakąkolwiek możliwość znalezienia i połączenia się z jednym. +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. +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 + + + + 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. + + + + 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. + + + + 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'. + + + + 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. + + + + Courtroom + + + Password + Hasło + + + + Spectator + Widz + + + + + Search + Wyszukaj + + + + Passworded + Zahasłowany + + + + Taken + Zajęty + + + + Could not find %1 + Nie znaleziono %1 + + + Generating chars: +%1/%2 + Generowanie postaci: +%1.%2 + + + + Showname + Ksywka + + + + Message + Wiadomość + + + + Name + Nazwa + + + + Pre + przed- + + + + Flip + Odwróć + + + Guard + 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. + + + + 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! + + + + 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. + + + + Choose... + Wybierz... + + + + Images (*.png) + Plik obrazu (*.png) + + + + Add new evidence... + Dodaj nowe dowody... + + + + Lobby + + + Attorney Online 2 + + + + + Name + 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, 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 + + + + + debug_functions + + + Error: %1 + Błąd: %1 + + + + Error + Błąd + + + + Notice + Ogłoszenie + + + diff --git a/resource/translations/ao_pt.qm b/resource/translations/ao_pt.qm new file mode 100644 index 00000000..242917ff Binary files /dev/null and b/resource/translations/ao_pt.qm differ diff --git a/resource/translations/ao_pt.ts b/resource/translations/ao_pt.ts new file mode 100644 index 00000000..824c81ee --- /dev/null +++ b/resource/translations/ao_pt.ts @@ -0,0 +1,977 @@ + + + + + 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. +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 + + + + 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. + + + + 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: + + + Sets the music's default volume. + 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'. + + + + 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. + + + + Courtroom + + + Password + Senha + + + + Spectator + Espectador + + + + + Search + Pesquisar + + + + Passworded + A translation wouldn't fit because of the shitty theme system. + + + + + Taken + Em uso + + + + Could not find %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. + 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. + + + + Choose... + Escolha... + + + + Images (*.png) + Imagens (* .png) + + + + Add new evidence... + Adicionar nova evidência... + + + + Lobby + + + Attorney Online 2 + + + + + Name + 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, 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 + + + + debug_functions + + + Error: %1 + + + + + Error + + + + + Notice + + + + diff --git a/resource/translations/ao_ru.qm b/resource/translations/ao_ru.qm new file mode 100644 index 00000000..19bf0a95 Binary files /dev/null and b/resource/translations/ao_ru.qm differ diff --git a/resource/translations/ao_ru.ts b/resource/translations/ao_ru.ts new file mode 100644 index 00000000..93a32956 --- /dev/null +++ b/resource/translations/ao_ru.ts @@ -0,0 +1,999 @@ + + + + + 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. + Произошла ошибка соединения с главным сервером. +Пожалуйста, проверьте ваши Интернет-соединение, настройки браундмауэра, и попробуйте перезайти. + + + + 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 + Вас отправили в баню. +Причина: %1 + + + You have been kicked from the server. +Reason: + Вас выпнули с сервера. +Причина: + + + You are banned on this server. +Reason: + Вас отправили в баню. +Причина: + + + + AOCaseAnnouncerDialog + + + Case Announcer + Материалы дела + + + + Case title: + Название: + + + + Defense needed + Сторона защиты + + + + Prosecution needed + Сторона обвинения + + + + Judge needed + Без судьи никак + + + + Jurors needed + Суд присяжных + + + + Stenographer needed + Нужен стенографист? + + + + Witness needed + + + + + 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. + Будучи производителем дела (ПД), вы можете войти в зону и заниматься её оркестровкой. + + + + Courtroom + + + Password + Пароль + + + + Spectator + Наблюдатель + + + + + Search + Поиск + + + + Passworded + Ограничен паролем + + + + Taken + Занят + + + + Could not find %1 + + + + Generating chars: +%1/%2 + Генерация персонажей: +%1/%2 + + + Generating chars: + + Генерация персонажей: + + + + + Showname + Имя + + + + Message + Сообщение + + + + Name + Никнейм + + + + Pre + Пред. + + + + Flip + Разв. + + + Guard + Охрана + + + + + 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. + + + + + 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. + Слишком длинный текст. + + + + Choose... + Выбрать... + + + + Images (*.png) + Изображения (*.png) + + + + Add new evidence... + Добавить новую улику... + + + + Lobby + + + Attorney Online 2 + Attorney Online 2 + + + + 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? + Не похоже, что ваш клиент установлен правильно. +Скачали ли вы все ресурсы (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, 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 + Вне сети + + + + debug_functions + + + Error: %1 + Ошибка: %1 + + + + Error + Ошибка + + + + Notice + На заметку + + + -- cgit From 75453510e080978681ec5603e283c36638f155cc Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Fri, 22 May 2020 21:14:37 -0500 Subject: Fix compile errors from merge --- include/aoapplication.h | 6 +++--- src/aoblipplayer.cpp | 6 ++++-- src/aosfxplayer.cpp | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index fa1757b9..18f6ef24 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -100,9 +100,9 @@ public: //////////////////versioning/////////////// - const int get_release() const { return RELEASE; } - const int get_major_version() const { return MAJOR_VERSION; } - const int get_minor_version() const { return MINOR_VERSION; } + 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(); /////////////////////////////////////////// diff --git a/src/aoblipplayer.cpp b/src/aoblipplayer.cpp index 39158fd2..b67f9c36 100644 --- a/src/aoblipplayer.cpp +++ b/src/aoblipplayer.cpp @@ -22,7 +22,7 @@ void AOBlipPlayer::set_blips(QString p_sfx) FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); } - set_volume(m_volume); + set_volume_internal(m_volume); } void AOBlipPlayer::blip_tick() @@ -44,7 +44,9 @@ void AOBlipPlayer::blip_tick() void AOBlipPlayer::set_volume(int p_value) { - m_volume = p_value; + m_volume = static_cast(p_value) / 100; + set_volume_internal(m_volume); +} void AOBlipPlayer::set_volume_internal(qreal p_value) { diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index 6db6f375..607d605a 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -86,7 +86,7 @@ void AOSfxPlayer::set_volume(qreal p_value) set_volume_internal(m_volume); } -void AOSfxPlayer::set_volume(int p_value) +void AOSfxPlayer::set_volume_internal(qreal p_value) { float volume = static_cast(p_value); for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { -- cgit From 80daf94895d90afd89d9ebd80a517dbcde8e132f Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Fri, 22 May 2020 21:55:09 -0500 Subject: Fix Linux build trying to use BASS --- Attorney_Online.pro | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 4b06b225..79f534a7 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -15,23 +15,28 @@ HEADERS += $$files($$PWD/include/*.h) LIBS += -L$$PWD/lib -DEFINES += DISCORD +# Uncomment to enable Discord Rich Presence +# DEFINES += DISCORD contains(DEFINES, DISCORD) { -LIBS += -ldiscord-rpc + LIBS += -ldiscord-rpc } -DEFINES += BASSAUDIO +# Uncomment to enable the BASS audio engine +# (Recommended for Windows) +# DEFINES += BASSAUDIO contains(DEFINES, BASSAUDIO) { -LIBS += -lbass -LIBS += -lbassopus + LIBS += -lbass + LIBS += -lbassopus } -#DEFINES += QTAUDIO +# Uncomment to enable the Qt audio engine +# (Recommended for non-Windows platforms) +# DEFINES += QTAUDIO contains(DEFINES, QTAUDIO) { -QT += multimedia + QT += multimedia } macx:LIBS += -framework CoreFoundation -framework Foundation -framework CoreServices -- cgit From 52736498b15a7464a2a395eb1984f9aa6578736d Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 17:21:22 +0200 Subject: fix up nomusic --- include/aomusicplayer.h | 20 +++++++++++++++++--- src/aoblipplayer.cpp | 2 +- src/aomusicplayer.cpp | 5 +++-- src/aosfxplayer.cpp | 5 +++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 5c72649f..f08b7d21 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -67,14 +67,28 @@ private: class AOMusicPlayer { public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - ~AOMusicPlayer(); + virtual ~AOMusicPlayer(); + void set_volume(int p_value, int channel = -1); + void set_looping(bool toggle, int channel = 0); - void play(QString p_song); - void set_volume(int p_value); + const int m_channelmax = 4; + +public slots: + void play(QString p_song, int channel = 0, bool loop = false, + int effect_flags = 0); + void stop(int channel = 0); private: QWidget *m_parent; AOApplication *ao_app; + + bool m_looping = false; + int m_volume[4] = {0, 0, 0, 0}; + + // Channel 0 = music + // Channel 1 = ambience + // Channel 2 = extra + // Channel 3 = extra }; #endif diff --git a/src/aoblipplayer.cpp b/src/aoblipplayer.cpp index b67f9c36..57b2d278 100644 --- a/src/aoblipplayer.cpp +++ b/src/aoblipplayer.cpp @@ -100,7 +100,7 @@ void AOBlipPlayer::set_blips(QString p_sfx) {} void AOBlipPlayer::blip_tick() {} -void AOBlipPlayer::set_volume(qreal p_value) {} +void AOBlipPlayer::set_volume(int p_value) {} void AOBlipPlayer::set_volume_internal(qreal p_value) {} #endif diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index bc1ab235..60b1c7cb 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -205,7 +205,8 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) AOMusicPlayer::~AOMusicPlayer() {} -void AOMusicPlayer::play(QString p_song) {} +void AOMusicPlayer::play(QString p_song, int channel, bool loop, + int effect_flags) {} -void AOMusicPlayer::set_volume(int p_value) {} +void AOMusicPlayer::set_volume(int p_value, int channel) {} #endif diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index 607d605a..d23d5f98 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -170,9 +170,10 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) ao_app = p_ao_app; } -void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) {} +void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, + int channel) {} -void AOSfxPlayer::stop() {} +void AOSfxPlayer::stop(int channel) {} void AOSfxPlayer::set_volume(qreal p_value) {} -- cgit From 5922bf748aa65f085d28b3a91e5961793aabd0c9 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 17:28:27 +0200 Subject: no and zone --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index bcd3b47a..caab3a5e 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1537,7 +1537,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) -- cgit From 68bd38b7fe7be6bdbb3d6ccd52e6207eac5b983a Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 17:28:54 +0200 Subject: forgot those on noaudio --- src/aomusicplayer.cpp | 6 ++++++ src/aosfxplayer.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 60b1c7cb..68af9611 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -208,5 +208,11 @@ AOMusicPlayer::~AOMusicPlayer() {} void AOMusicPlayer::play(QString p_song, int channel, bool loop, int effect_flags) {} +void AOMusicPlayer::stop(int channel) {} + void AOMusicPlayer::set_volume(int p_value, int channel) {} + +void loopProc(int handle, int channel, int data, int *user) {} + +void AOMusicPlayer::set_looping(bool toggle, int channel) {} #endif diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index d23d5f98..121ac0b3 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -170,6 +170,10 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) ao_app = p_ao_app; } +void AOSfxPlayer::clear() {} + +void AOSfxPlayer::loop_clear() {} + void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, int channel) {} @@ -178,4 +182,6 @@ void AOSfxPlayer::stop(int channel) {} void AOSfxPlayer::set_volume(qreal p_value) {} void AOSfxPlayer::set_volume_internal(qreal p_value) {} + +void AOSfxPlayer::set_looping(bool toggle, int channel) {} #endif -- cgit From 86cc7950061f3efb346cc7510d71dfb681a26172 Mon Sep 17 00:00:00 2001 From: cents Date: Sat, 23 May 2020 09:23:42 -0700 Subject: Other image formats now support the present evidence --- src/aoevidencedisplay.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/aoevidencedisplay.cpp b/src/aoevidencedisplay.cpp index 9dd062b7..64e4e24d 100644 --- a/src/aoevidencedisplay.cpp +++ b/src/aoevidencedisplay.cpp @@ -34,11 +34,11 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, if (is_left_side) { icon_identifier = "left_evidence_icon"; - gif_name = "evidence_appear_left.gif"; + gif_name = "evidence_appear_left"; } else { icon_identifier = "right_evidence_icon"; - gif_name = "evidence_appear_right.gif"; + gif_name = "evidence_appear_right"; } pos_size_type icon_dimensions = @@ -49,9 +49,8 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, 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); + QString f_default_gif_path = ao_app->get_image_suffix(ao_app->get_default_theme_path(gif_name)); + QString f_gif_path = ao_app->get_image_suffix(ao_app->get_theme_path(gif_name)); if (file_exists(f_gif_path)) final_gif_path = f_gif_path; -- cgit From ba9aebec57d231236642f9e58329b1d87b264dbd Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 18:32:05 +0200 Subject: translate stuff that got run over --- include/chatlogpiece.h | 2 ++ src/aooptionsdialog.cpp | 4 ++-- src/chatlogpiece.cpp | 8 +++---- src/courtroom.cpp | 54 ++++++++++++++++++++++----------------------- src/evidence.cpp | 35 ++++++++++++++--------------- src/lobby.cpp | 12 +++++----- src/packet_distribution.cpp | 10 ++++----- 7 files changed, 62 insertions(+), 63 deletions(-) diff --git a/include/chatlogpiece.h b/include/chatlogpiece.h index e6f77c74..f3a9dc8b 100644 --- a/include/chatlogpiece.h +++ b/include/chatlogpiece.h @@ -1,10 +1,12 @@ #ifndef CHATLOGPIECE_H #define CHATLOGPIECE_H +#include #include #include class chatlogpiece { + Q_DECLARE_TR_FUNCTIONS(chatlogpiece) public: chatlogpiece(); chatlogpiece(QString p_name, QString p_showname, QString p_message, diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index e911963b..80746f79 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -205,7 +205,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_language_combobox = new QComboBox(ui_form_layout_widget); ui_language_combobox->addItem( configini->value("language", " ").value() + - " - Keep current setting"); + tr(" - Keep current setting")); ui_language_combobox->addItem(" - Default"); ui_language_combobox->addItem("en - English"); ui_language_combobox->addItem("de - Deutsch"); @@ -384,7 +384,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) int a = 0; if (needs_default_audiodev()) { - ui_audio_device_combobox->addItem("default"); + ui_audio_device_combobox->addItem("default"); //TODO translate this without breaking the default audio device } #ifdef BASSAUDIO BASS_DEVICEINFO info; diff --git a/src/chatlogpiece.cpp b/src/chatlogpiece.cpp index 34a2fea4..ec964b91 100644 --- a/src/chatlogpiece.cpp +++ b/src/chatlogpiece.cpp @@ -2,9 +2,9 @@ chatlogpiece::chatlogpiece() { - name = "UNKNOWN"; - showname = "UNKNOWN"; - message = "UNKNOWN"; + name = tr("UNKNOWN"); + showname = tr("UNKNOWN"); + message = tr("UNKNOWN"); p_is_song = false; datetime = QDateTime::currentDateTime().toUTC(); } @@ -52,7 +52,7 @@ QString chatlogpiece::get_full() full.append(get_name()); full.append(")"); if (p_is_song) - full.append(" has played a song: "); + full.append(tr(" has played a song: ")); else full.append(": "); full.append(get_message()); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index caab3a5e..e3eeb599 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -164,7 +164,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ooc_chat_name = new QLineEdit(this); ui_ooc_chat_name->setFrame(false); - ui_ooc_chat_name->setPlaceholderText("Name"); + ui_ooc_chat_name->setPlaceholderText(tr("Name")); ui_ooc_chat_name->setMaxLength(30); ui_ooc_chat_name->setText(p_ao_app->get_default_username()); @@ -214,14 +214,14 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_switch_area_music = new AOButton(this, ao_app); ui_pre = new QCheckBox(this); - ui_pre->setText("Pre"); + ui_pre->setText(tr("Pre")); ui_flip = new QCheckBox(this); - ui_flip->setText("Flip"); + ui_flip->setText(tr("Flip")); ui_flip->hide(); ui_guard = new QCheckBox(this); - ui_guard->setText("Guard"); + ui_guard->setText(tr("Guard")); ui_guard->hide(); ui_additive = new QCheckBox(this); @@ -274,8 +274,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_pair_offset_spinbox->setSuffix(tr("% offset")); ui_pair_order_dropdown = new QComboBox(this); - ui_pair_order_dropdown->addItem("To front"); - ui_pair_order_dropdown->addItem("To behind"); + ui_pair_order_dropdown->addItem(tr("To front")); + ui_pair_order_dropdown->addItem(tr("To behind")); ui_pair_button = new AOButton(this, ao_app); @@ -739,11 +739,11 @@ void Courtroom::set_widgets() QString::number(prosecution_bar_state)); set_size_and_pos(ui_music_label, "music_label"); - ui_music_label->setText("Music"); + ui_music_label->setText(tr("Music")); set_size_and_pos(ui_sfx_label, "sfx_label"); - ui_sfx_label->setText("Sfx"); + ui_sfx_label->setText(tr("Sfx")); set_size_and_pos(ui_blip_label, "blip_label"); - ui_blip_label->setText("Blips"); + ui_blip_label->setText(tr("Blips")); set_size_and_pos(ui_hold_it, "hold_it"); ui_hold_it->setText(tr("Hold It!")); @@ -1454,7 +1454,7 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message, if (p_message == "Logged in as a moderator.") { ui_guard->show(); append_server_chatmessage( - "CLIENT", "You were granted the Disable Modcalls button.", "1"); + tr("CLIENT"), tr("You were granted the Disable Modcalls button."), "1"); } ui_server_chatlog->append_chatmessage(p_name, p_message, color); @@ -2981,7 +2981,7 @@ void Courtroom::set_ban(int p_cid) if (p_cid != m_cid && p_cid != -1) return; - call_notice("You have been banned."); + call_notice(tr("You have been banned.")); ao_app->construct_lobby(); ao_app->destruct_courtroom(); @@ -3058,7 +3058,7 @@ void Courtroom::handle_song(QStringList *p_contents) ic_chatlog_history.removeFirst(); } - append_ic_text(f_song_clear, str_show, "has played a song"); + append_ic_text(f_song_clear, str_show, tr("has played a song")); music_player->play(f_song, channel, looping, effect_flags); if (channel == 0) @@ -3192,9 +3192,7 @@ void Courtroom::on_ooc_return_pressed() if (ok) { if (whom > -1) { other_charid = whom; - QString msg = "You will now pair up with "; - msg.append(char_list.at(whom).name); - msg.append(" if they also choose your character in return."); + QString msg = tr("You will now pair up with %1 if they also choose your character in return.").arg(char_list.at(whom).name); append_server_chatmessage("CLIENT", msg, "1"); } else { @@ -3342,7 +3340,7 @@ void Courtroom::on_ooc_return_pressed() QString casestatus = casefile.value("status", "").value(); if (!caseauth.isEmpty()) - append_server_chatmessage("CLIENT", tr("Case made by %1.").arg(caseauth), + append_server_chatmessage(tr("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() + @@ -3366,9 +3364,9 @@ void Courtroom::on_ooc_return_pressed() QStringList f_contents; f_contents.append( - casefile.value(evi + "/name", "UNKNOWN").value()); + casefile.value(evi + "/name", tr("UNKNOWN")).value()); f_contents.append( - casefile.value(evi + "/description", "UNKNOWN").value()); + casefile.value(evi + "/description", tr("UNKNOWN")).value()); f_contents.append( casefile.value(evi + "/image", "UNKNOWN.png").value()); @@ -3967,25 +3965,25 @@ void Courtroom::on_music_list_context_menu_requested(const QPoint &pos) { QMenu *menu = new QMenu(); - menu->addAction(QString("Expand All Categories"), this, + menu->addAction(QString(tr("Expand All Categories")), this, SLOT(music_list_expand_all())); - menu->addAction(QString("Collapse All Categories"), this, + menu->addAction(QString(tr("Collapse All Categories")), this, SLOT(music_list_collapse_all())); menu->addSeparator(); - menu->addAction(new QAction("Fade Out Previous", this)); + menu->addAction(new QAction(tr("Fade Out Previous"), this)); menu->actions().back()->setCheckable(true); menu->actions().back()->setChecked(music_flags & FADE_OUT); connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_fade_out(bool))); - menu->addAction(new QAction("Fade In", this)); + menu->addAction(new QAction(tr("Fade In"), this)); menu->actions().back()->setCheckable(true); menu->actions().back()->setChecked(music_flags & FADE_IN); connect(menu->actions().back(), SIGNAL(toggled(bool)), this, SLOT(music_fade_in(bool))); - menu->addAction(new QAction("Synchronize", this)); + menu->addAction(new QAction(tr("Synchronize"), this)); menu->actions().back()->setCheckable(true); menu->actions().back()->setChecked(music_flags & SYNC_POS); connect(menu->actions().back(), SIGNAL(toggled(bool)), this, @@ -4416,8 +4414,8 @@ void Courtroom::on_call_mod_clicked() QInputDialog input; input.setWindowFlags(Qt::WindowSystemMenuHint); - input.setLabelText("Reason:"); - input.setWindowTitle("Call Moderator"); + input.setLabelText(tr("Reason:")); + input.setWindowTitle(tr("Call Moderator")); auto code = input.exec(); if (code != QDialog::Accepted) @@ -4425,7 +4423,7 @@ void Courtroom::on_call_mod_clicked() QString text = input.textValue(); if (text.isEmpty()) { - errorBox.critical(nullptr, "Error", "You must provide a reason."); + errorBox.critical(nullptr, tr("Error"), tr("You must provide a reason.")); return; } else if (text.length() > 256) { @@ -4478,14 +4476,14 @@ void Courtroom::on_showname_enable_clicked() if (ui_showname_enable->isChecked()) { if (item.is_song()) append_ic_text(item.get_message(), item.get_showname(), - "has played a song"); + tr("has played a song")); else append_ic_text(item.get_message(), item.get_showname()); } else { if (item.is_song()) append_ic_text(item.get_message(), item.get_name(), - "has played a song"); + tr("has played a song")); else append_ic_text(item.get_message(), item.get_name()); } diff --git a/src/evidence.cpp b/src/evidence.cpp index dffe8486..99d365da 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -31,7 +31,7 @@ void Courtroom::initialize_evidence() ui_evidence_delete->setToolTip(tr("Destroy this piece of evidence")); ui_evidence_image_name = new AOLineEdit(ui_evidence_overlay); ui_evidence_image_button = new AOButton(ui_evidence_overlay, ao_app); - ui_evidence_image_button->setText("Choose.."); + ui_evidence_image_button->setText(tr("Choose..")); ui_evidence_x = new AOButton(ui_evidence_overlay, ao_app); ui_evidence_x->setToolTip( tr("Close the evidence display/editing overlay.\n" @@ -45,7 +45,7 @@ void Courtroom::initialize_evidence() "color: white;"); ui_evidence_description->setFrameStyle(QFrame::NoFrame); ui_evidence_description->setToolTip( - "Double-click to edit. Press [X] to update your changes."); + tr("Double-click to edit. Press [X] to update your changes.")); connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited())); @@ -260,13 +260,12 @@ void Courtroom::set_evidence_list(QVector &p_evi_list) local_evidence_list.at(current_evidence))) { QMessageBox *msgBox = new QMessageBox; - msgBox->setText("The piece of evidence you've been editing has changed."); - msgBox->setInformativeText("Do you wish to keep your changes?"); - msgBox->setDetailedText( - "Name: " + local_evidence_list.at(current_evidence).name + - "\nImage: " + local_evidence_list.at(current_evidence).image + - "\nDescription:\n" + - local_evidence_list.at(current_evidence).description); + msgBox->setText(tr("The piece of evidence you've been editing has changed.")); + msgBox->setInformativeText(tr("Do you wish to keep your changes?")); + msgBox->setDetailedText(tr( + "Name: %1\n" + "Image: %2\n" + "Description:\n%3").arg(local_evidence_list.at(current_evidence).name).arg(local_evidence_list.at(current_evidence).image).arg(local_evidence_list.at(current_evidence).description)); msgBox->setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox->setDefaultButton(QMessageBox::LastButton); // msgBox->setWindowModality(Qt::NonModal); @@ -454,14 +453,14 @@ void Courtroom::on_evidence_double_clicked(int p_id) ui_evidence_description->clear(); ui_evidence_description->appendPlainText(f_evi.description); ui_evidence_description->setReadOnly(true); - ui_evidence_description->setToolTip("Double-click to edit..."); + ui_evidence_description->setToolTip(tr("Double-click to edit...")); ui_evidence_name->setText(f_evi.name); ui_evidence_name->setReadOnly(true); - ui_evidence_name->setToolTip("Double-click to edit..."); + ui_evidence_name->setToolTip(tr("Double-click to edit...")); ui_evidence_image_name->setText(f_evi.image); ui_evidence_image_name->setReadOnly(true); - ui_evidence_image_name->setToolTip("Double-click to edit..."); + ui_evidence_image_name->setToolTip(tr("Double-click to edit...")); ui_evidence_overlay->show(); ui_evidence_ok->hide(); @@ -476,7 +475,7 @@ void Courtroom::on_evidence_hover(int p_id, bool p_state) if (p_state) { if (final_id == local_evidence_list.size()) - ui_evidence_name->setText("Add new evidence..."); + ui_evidence_name->setText(tr("Add new evidence...")); else if (final_id < local_evidence_list.size()) ui_evidence_name->setText(local_evidence_list.at(final_id).name); } @@ -554,8 +553,8 @@ void Courtroom::on_evidence_x_clicked() return; } QMessageBox *msgBox = new QMessageBox; - msgBox->setText("Evidence has been modified."); - msgBox->setInformativeText("Do you want to save your changes?"); + msgBox->setText(tr("Evidence has been modified.")); + msgBox->setInformativeText(tr("Do you want to save your changes?")); msgBox->setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); msgBox->setDefaultButton(QMessageBox::Save); @@ -657,7 +656,7 @@ void Courtroom::on_evidence_transfer_clicked() } QMessageBox *msgBox = new QMessageBox; - msgBox->setText("\"" + name + "\" has been transferred."); + msgBox->setText(tr("\"%1\" has been transferred.").arg(name)); msgBox->setStandardButtons(QMessageBox::Ok); msgBox->setDefaultButton(QMessageBox::Ok); msgBox->exec(); @@ -759,9 +758,9 @@ void Courtroom::on_evidence_load_clicked() continue; evi_type f_evi; - f_evi.name = inventory.value(evi + "/name", "UNKNOWN").value(); + f_evi.name = inventory.value(evi + "/name", tr("UNKNOWN")).value(); f_evi.description = - inventory.value(evi + "/description", "UNKNOWN").value(); + inventory.value(evi + "/description", tr("UNKNOWN")).value(); f_evi.image = inventory.value(evi + "/image", "UNKNOWN.png").value(); local_evidence_list.append(f_evi); diff --git a/src/lobby.cpp b/src/lobby.cpp index 81e4086b..91c4b7cc 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -9,7 +9,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() { ao_app = p_ao_app; - this->setWindowTitle("Attorney Online 2"); + this->setWindowTitle(tr("Attorney Online 2")); this->setWindowIcon(QIcon(":/logo.png")); ui_background = new AOImage(this, ao_app); @@ -36,7 +36,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() ui_chatbox = new AOTextArea(this); ui_chatbox->setOpenExternalLinks(true); ui_chatname = new QLineEdit(this); - ui_chatname->setPlaceholderText("Name"); + 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); @@ -139,7 +139,7 @@ void Lobby::set_widgets() ui_server_search->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); set_size_and_pos(ui_player_count, "player_count"); - ui_player_count->setText("Offline"); + ui_player_count->setText(tr("Offline")); ui_player_count->setStyleSheet("font: bold;" "color: white;" "qproperty-alignment: AlignCenter;"); @@ -173,11 +173,11 @@ void Lobby::set_widgets() 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("Loading"); + 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("Cancel"); + ui_cancel->setText(tr("Cancel")); ui_loading_background->hide(); @@ -377,7 +377,7 @@ void Lobby::on_about_clicked() "Noevain, Cronnicossy, the AO2 community, server hosts, game masters," "case makers, content creators and players!") .arg(ao_app->get_version_string()); - QMessageBox::about(this, "About", msg); + QMessageBox::about(this, tr("About"), msg); } void Lobby::on_settings_clicked() { ao_app->call_settings_menu(); } diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index a7bdbab8..44e28165 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -232,7 +232,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) courtroom_loaded = false; - QString window_title = "Attorney Online 2"; + QString window_title = tr("Attorney Online 2"); int selected_server = w_lobby->get_selected_server(); QString server_address = "", server_name = ""; @@ -260,7 +260,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet) w_courtroom->set_window_title(window_title); w_lobby->show_loading_overlay(); - w_lobby->set_loading_text("Loading"); + w_lobby->set_loading_text(tr("Loading")); w_lobby->set_loading_value(0); AOPacket *f_packet; @@ -313,9 +313,9 @@ void AOApplication::server_packet_received(AOPacket *p_packet) ++loaded_chars; - w_lobby->set_loading_text("Loading chars:\n" + - QString::number(loaded_chars) + "/" + - QString::number(char_list_size)); + w_lobby->set_loading_text(tr("Loading chars:\n%1/%2") + .arg(QString::number(loaded_chars)) + .arg(QString::number(char_list_size))); w_courtroom->append_char(f_char); -- cgit From 3329ce1416dbdf6fa9d1136468efa12fd40c7815 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 18:32:45 +0200 Subject: use new hdid method if supported --- src/hardware_functions.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/hardware_functions.cpp b/src/hardware_functions.cpp index 82b4f0c7..6da642a5 100644 --- a/src/hardware_functions.cpp +++ b/src/hardware_functions.cpp @@ -1,6 +1,9 @@ #include "hardware_functions.h" #include +#include + +#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) #if (defined(_WIN32) || defined(_WIN64)) #include @@ -81,3 +84,16 @@ QString get_hdid() #error This operating system is unsupported for hardware functions. #endif + +#else +#include + +QByteArray machineId; + +QString get_hdid() +{ + machineId = QSysInfo::machineUniqueId(); + return QString(machineId); +} + +#endif -- cgit From 7166b50f4b8ebdeb6bfcfd114e8ad2df60cbd21d Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 18:36:28 +0200 Subject: rename logo files --- resource/logo.ico | Bin 99678 -> 0 bytes resource/logo.png | Bin 22609 -> 0 bytes resource/logo_kfo.ico | Bin 0 -> 99678 bytes resource/logo_kfo.png | Bin 0 -> 22609 bytes 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 resource/logo.ico delete mode 100644 resource/logo.png create mode 100644 resource/logo_kfo.ico create mode 100644 resource/logo_kfo.png diff --git a/resource/logo.ico b/resource/logo.ico deleted file mode 100644 index 3c68adff..00000000 Binary files a/resource/logo.ico and /dev/null differ diff --git a/resource/logo.png b/resource/logo.png deleted file mode 100644 index d8001233..00000000 Binary files a/resource/logo.png and /dev/null differ diff --git a/resource/logo_kfo.ico b/resource/logo_kfo.ico new file mode 100644 index 00000000..3c68adff Binary files /dev/null and b/resource/logo_kfo.ico differ diff --git a/resource/logo_kfo.png b/resource/logo_kfo.png new file mode 100644 index 00000000..d8001233 Binary files /dev/null and b/resource/logo_kfo.png differ -- cgit From e7ec42f977eb1681f20d6b5f68625cda088597e1 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 18:41:27 +0200 Subject: undo branding --- Attorney_Online.pro | 4 ++-- resource/logo.icns | Bin 1129414 -> 0 bytes resource/logo_ao2.icns | Bin 0 -> 1129414 bytes resources.qrc | 2 +- src/lobby.cpp | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 resource/logo.icns create mode 100644 resource/logo_ao2.icns diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 79f534a7..2a47afd2 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -54,8 +54,8 @@ TRANSLATIONS = resource/translations/ao_en.ts \ resource/translations/ao_pt.ts \ resource/translations/ao_pl.ts -win32:RC_ICONS = resource/logo.ico -macx:ICON = resource/logo.icns +win32:RC_ICONS = resource/logo_ao2.ico +macx:ICON = resource/logo_ao2.icns android:DISTFILES += \ android/AndroidManifest.xml \ diff --git a/resource/logo.icns b/resource/logo.icns deleted file mode 100644 index fb2456c8..00000000 Binary files a/resource/logo.icns and /dev/null differ diff --git a/resource/logo_ao2.icns b/resource/logo_ao2.icns new file mode 100644 index 00000000..fb2456c8 Binary files /dev/null and b/resource/logo_ao2.icns differ diff --git a/resources.qrc b/resources.qrc index bc9f322e..974f797c 100644 --- a/resources.qrc +++ b/resources.qrc @@ -1,6 +1,6 @@ resource/fonts/Ace-Attorney.ttf - resource/logo.png + resource/logo_ao2.png diff --git a/src/lobby.cpp b/src/lobby.cpp index 91c4b7cc..98048556 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -120,7 +120,7 @@ void Lobby::set_widgets() ui_connect->set_image("connect"); set_size_and_pos(ui_version, "version"); - ui_version->setText(tr("Version: KFO%1").arg(ao_app->get_version_string())); + ui_version->setText(tr("Version: %1").arg(ao_app->get_version_string())); set_size_and_pos(ui_about, "about"); ui_about->set_image("about"); -- cgit From f0a0ecb983a5e160adaefca139f0fe034cb11062 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 18:53:31 +0200 Subject: ignore the logs --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3f8b3ae4..212daeca 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ base_override.h base-full/ base/ +logs/ bass.lib bin/ -- cgit From 53c72227c4ade7c3e28bf0051346d297f56e51be Mon Sep 17 00:00:00 2001 From: cents Date: Sat, 23 May 2020 09:54:33 -0700 Subject: Disable html injection --- src/courtroom.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 11c0bdab..4d73507c 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2293,12 +2293,10 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, 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 == "\\" && !ic_next_is_not_special) { ic_next_is_not_special = true; @@ -2511,10 +2509,9 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, * \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 - * \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 + * \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 html filter + * \param chat_color The color of the message sent */ void Courtroom::append_ic_text(QString p_text, QString p_name, -- cgit From 8a4fc4516c406a2fa63039310914c6a5514e7c04 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 19:18:35 +0200 Subject: fix qt music player --- include/aomusicplayer.h | 54 +++++++------------------------------------------ src/aomusicplayer.cpp | 34 ++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 57 deletions(-) diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index f08b7d21..de673e5e 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -8,13 +8,13 @@ #elif defined(QTAUDIO) #include #endif + #include "aoapplication.h" #include #include #include -#if defined(BASSAUDIO) class AOMusicPlayer { public: AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); @@ -25,8 +25,8 @@ public: const int m_channelmax = 4; // These have to be public for the stupid sync thing - QWORD loop_start = 0; - QWORD loop_end = 0; + int loop_start = 0; + int loop_end = 0; public slots: void play(QString p_song, int channel = 0, bool loop = false, @@ -44,52 +44,12 @@ private: // Channel 1 = ambience // Channel 2 = extra // Channel 3 = extra + #if defined(BASSAUDIO) HSTREAM m_stream_list[4]; HSYNC loop_sync[4]; + #elif defined(QTAUDIO) + QMediaPlayer m_stream_list[4]; + #endif }; -#elif defined(QTAUDIO) -class AOMusicPlayer { -public: - AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - ~AOMusicPlayer(); - - void play(QString p_song); - void set_volume(int p_value); - -private: - QMediaPlayer m_player; - QWidget *m_parent; - AOApplication *ao_app; - - int m_volume = 0; -}; -#else -class AOMusicPlayer { -public: - AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app); - virtual ~AOMusicPlayer(); - void set_volume(int p_value, int channel = -1); - void set_looping(bool toggle, int channel = 0); - - const int m_channelmax = 4; - -public slots: - void play(QString p_song, int channel = 0, bool loop = false, - int effect_flags = 0); - void stop(int channel = 0); - -private: - QWidget *m_parent; - AOApplication *ao_app; - - bool m_looping = false; - int m_volume[4] = {0, 0, 0, 0}; - - // Channel 0 = music - // Channel 1 = ambience - // Channel 2 = extra - // Channel 3 = extra -}; -#endif #endif // AOMUSICPLAYER_H diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 68af9611..5878dcdc 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -176,26 +176,40 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) ao_app = p_ao_app; } -AOMusicPlayer::~AOMusicPlayer() { m_player.stop(); } +AOMusicPlayer::~AOMusicPlayer() { + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + m_stream_list[n_stream].stop(); + } +} -void AOMusicPlayer::play(QString p_song) +void AOMusicPlayer::play(QString p_song, int channel, bool loop, + int effect_flags) { - m_player.stop(); - + channel = channel % m_channelmax; + if (channel < 0) // wtf? + return; QString f_path = ao_app->get_music_path(p_song); - m_player.setMedia(QUrl::fromLocalFile(f_path)); + m_stream_list[channel].stop(); - this->set_volume(m_volume); + m_stream_list[channel].setMedia(QUrl::fromLocalFile(f_path)); - m_player.play(); + this->set_volume(m_volume[channel], channel); + + m_stream_list[channel].play(); +} + +void AOMusicPlayer::stop(int channel) +{ + m_stream_list[channel].stop(); } -void AOMusicPlayer::set_volume(int p_value) +void AOMusicPlayer::set_volume(int p_value, int channel) { - m_volume = p_value; - m_player.setVolume(m_volume); + m_volume[channel] = p_value; + m_stream_list[channel].setVolume(m_volume[channel]); } + #else AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) { -- cgit From 7a7dd25459f19796e38fde2148304376389a7a16 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 19:21:25 +0200 Subject: i don't need this 3 times --- src/aomusicplayer.cpp | 14 +++----------- src/aosfxplayer.cpp | 14 ++------------ 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 5878dcdc..8ba16418 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -1,12 +1,14 @@ #include "aomusicplayer.h" -#ifdef BASSAUDIO + AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; ao_app = p_ao_app; } +#ifdef BASSAUDIO + AOMusicPlayer::~AOMusicPlayer() { for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { @@ -170,11 +172,6 @@ void AOMusicPlayer::set_looping(bool toggle, int channel) } } #elif defined(QTAUDIO) -AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) -{ - m_parent = parent; - ao_app = p_ao_app; -} AOMusicPlayer::~AOMusicPlayer() { for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { @@ -211,11 +208,6 @@ void AOMusicPlayer::set_volume(int p_value, int channel) } #else -AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app) -{ - m_parent = parent; - ao_app = p_ao_app; -} AOMusicPlayer::~AOMusicPlayer() {} diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index 121ac0b3..6fb5becf 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -1,13 +1,14 @@ #include "aosfxplayer.h" #include "file_functions.h" -#if defined(BASSAUDIO) // Using bass.dll for sfx + AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; ao_app = p_ao_app; } +#if defined(BASSAUDIO) // Using bass.dll for sfx void AOSfxPlayer::clear() { for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { @@ -112,11 +113,6 @@ void AOSfxPlayer::set_looping(bool toggle, int channel) } } #elif defined(QTAUDIO) // Using Qt's QSoundEffect class -AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) -{ - m_parent = parent; - ao_app = p_ao_app; -} void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) { @@ -164,12 +160,6 @@ void AOSfxPlayer::set_volume_internal(qreal p_value) m_sfx.setVolume(m_volume); } #else -AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) -{ - m_parent = parent; - ao_app = p_ao_app; -} - void AOSfxPlayer::clear() {} void AOSfxPlayer::loop_clear() {} -- cgit From e81fac7e07cdeca4682e712ec4c9b9585942f50a Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 19:28:34 +0200 Subject: fix qt sfx player --- include/aosfxplayer.h | 5 +++-- src/aosfxplayer.cpp | 48 +++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h index 9c9824ab..99188719 100644 --- a/include/aosfxplayer.h +++ b/include/aosfxplayer.h @@ -35,11 +35,12 @@ private: bool m_looping = true; void set_volume_internal(qreal p_volume); -#if defined(BASSAUDIO) const int m_channelmax = 5; + +#if defined(BASSAUDIO) HSTREAM m_stream_list[5]; #elif defined(QTAUDIO) - QSoundEffect m_sfx; + QSoundEffect m_stream_list[5]; #endif }; diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index 6fb5becf..0fdba1b2 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -114,9 +114,26 @@ void AOSfxPlayer::set_looping(bool toggle, int channel) } #elif defined(QTAUDIO) // Using Qt's QSoundEffect class -void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) +void AOSfxPlayer::clear() { - m_sfx.stop(); + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + m_stream_list[n_stream].stop(); + } + set_volume_internal(m_volume); +} + +void AOSfxPlayer::loop_clear() +{ + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + m_stream_list[n_stream].stop(); + } + set_volume_internal(m_volume); +} + +void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, + int channel) +{ + m_stream_list[channel].stop(); QString misc_path = ""; QString char_path = ""; @@ -138,15 +155,21 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) if (file_exists(f_path)) // if its missing, it will glitch out { - m_sfx.setSource(QUrl::fromLocalFile(f_path)); + m_stream_list[channel].setSource(QUrl::fromLocalFile(f_path)); set_volume_internal(m_volume); - m_sfx.play(); + m_stream_list[channel].play(); } } -void AOSfxPlayer::stop() { m_sfx.stop(); } +void AOSfxPlayer::stop(int channel) +{ + if (channel == -1) { + channel = m_channel; + } + m_stream_list[channel].stop(); +} void AOSfxPlayer::set_volume(qreal p_value) { @@ -156,8 +179,19 @@ void AOSfxPlayer::set_volume(qreal p_value) void AOSfxPlayer::set_volume_internal(qreal p_value) { - m_volume = p_value; - m_sfx.setVolume(m_volume); + float volume = static_cast(p_value); + for (int n_stream = 0; n_stream < m_channelmax; ++n_stream) { + m_stream_list[n_stream].setVolume(volume); + } +} + +void AOSfxPlayer::set_looping(bool toggle, int channel) +{ + if (channel == -1) { + channel = m_channel; + } + m_looping = toggle; + // TODO } #else void AOSfxPlayer::clear() {} -- cgit From c83fd9f7323464493b76af915e974c1dc2262686 Mon Sep 17 00:00:00 2001 From: cents Date: Sat, 23 May 2020 10:41:20 -0700 Subject: Added backwards compatibility for the music list --- src/packet_distribution.cpp | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index a110ec4b..36593d6e 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -478,19 +478,39 @@ void AOApplication::server_packet_received(AOPacket *p_packet) bool musics_time = false; area_count = 0; - + bool legacy_system = false; + int element_ahead = 0; 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 + element_ahead = n_element + 1; + if (!musics_time && f_contents.at(n_element).startsWith("==") && ( + f_contents.at(element_ahead).endsWith(".wav") || + f_contents.at(element_ahead).endsWith(".mp3") || + f_contents.at(element_ahead).endsWith(".mp4") || + f_contents.at(element_ahead).endsWith(".ogg") || + f_contents.at(element_ahead).endsWith(".opus"))) { + legacy_system = true; + + } + if(!legacy_system) { + if (!musics_time && (f_contents.at(n_element).startsWith("==") || + f_contents.at(element_ahead).endsWith(".wav") || + f_contents.at(element_ahead).endsWith(".mp3") || + f_contents.at(element_ahead).endsWith(".mp4") || + f_contents.at(element_ahead).endsWith(".ogg") || + f_contents.at(element_ahead).endsWith(".opus"))) { + musics_time = true; } - 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; + } + else{ + if (!musics_time && (f_contents.at(n_element).startsWith("==") || + f_contents.at(n_element).endsWith(".wav") || + f_contents.at(n_element).endsWith(".mp3") || + f_contents.at(n_element).endsWith(".mp4") || + f_contents.at(n_element).endsWith(".ogg") || + f_contents.at(n_element).endsWith(".opus"))) { + musics_time = true; + } + } // Not everything needs to have a thread. -- cgit From 8ea01d4c3139e27e84091c0b24266d9fb50ddf38 Mon Sep 17 00:00:00 2001 From: cents Date: Sat, 23 May 2020 10:44:36 -0700 Subject: Clanged changes --- src/courtroom.cpp | 24 +++++++++++---------- src/packet_distribution.cpp | 52 ++++++++++++++++++++++----------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 4d73507c..f5361efc 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2170,8 +2170,7 @@ void Courtroom::handle_chatmessage_3() else first_message_sent = true; QString char_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; - ui_ic_chatlog->textCursor().insertHtml("" + char_name + - ": "); + ui_ic_chatlog->textCursor().insertHtml("" + char_name + ": "); } else { if (first_message_sent && log_goes_downwards) @@ -2293,10 +2292,10 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, bool delay_pop = false; while (trick_check_pos < p_text.size()) { f_character = p_text.at(trick_check_pos); - if (f_character == "<") - f_character = "<"; - else if (f_character == ">") - f_character = ">"; + if (f_character == "<") + f_character = "<"; + else if (f_character == ">") + f_character = ">"; // Escape character. if (f_character == "\\" && !ic_next_is_not_special) { ic_next_is_not_special = true; @@ -2509,9 +2508,10 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, * \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 html filter - * \param chat_color The color of the message sent + * \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 html + * filter \param chat_color The color of the message sent */ void Courtroom::append_ic_text(QString p_text, QString p_name, @@ -2795,7 +2795,7 @@ void Courtroom::chat_tick() 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]; + msg_delay = message_display_speed_slow[current_display_speed]; // Stops blips from playing when we have a formatting option. bool formatting_char = false; @@ -2832,7 +2832,9 @@ void Courtroom::chat_tick() f_character = f_character.toHtmlEscaped(); if (punctuation_chars.contains(f_character)) { - msg_delay *= punctuation_modifier + 1; // Since we are handling a boolean, if its true its double (1 + 1) or false (1 + 0). + 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/packet_distribution.cpp b/src/packet_distribution.cpp index 36593d6e..37231d85 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -482,35 +482,33 @@ void AOApplication::server_packet_received(AOPacket *p_packet) int element_ahead = 0; for (int n_element = 0; n_element < f_contents.size(); ++n_element) { element_ahead = n_element + 1; - if (!musics_time && f_contents.at(n_element).startsWith("==") && ( - f_contents.at(element_ahead).endsWith(".wav") || - f_contents.at(element_ahead).endsWith(".mp3") || - f_contents.at(element_ahead).endsWith(".mp4") || - f_contents.at(element_ahead).endsWith(".ogg") || - f_contents.at(element_ahead).endsWith(".opus"))) { - legacy_system = true; - - } - if(!legacy_system) { - if (!musics_time && (f_contents.at(n_element).startsWith("==") || - f_contents.at(element_ahead).endsWith(".wav") || - f_contents.at(element_ahead).endsWith(".mp3") || - f_contents.at(element_ahead).endsWith(".mp4") || - f_contents.at(element_ahead).endsWith(".ogg") || - f_contents.at(element_ahead).endsWith(".opus"))) { - musics_time = true; - } + if (!musics_time && f_contents.at(n_element).startsWith("==") && + (f_contents.at(element_ahead).endsWith(".wav") || + f_contents.at(element_ahead).endsWith(".mp3") || + f_contents.at(element_ahead).endsWith(".mp4") || + f_contents.at(element_ahead).endsWith(".ogg") || + f_contents.at(element_ahead).endsWith(".opus"))) { + legacy_system = true; } - else{ - if (!musics_time && (f_contents.at(n_element).startsWith("==") || - f_contents.at(n_element).endsWith(".wav") || - f_contents.at(n_element).endsWith(".mp3") || - f_contents.at(n_element).endsWith(".mp4") || - f_contents.at(n_element).endsWith(".ogg") || - f_contents.at(n_element).endsWith(".opus"))) { - musics_time = true; + if (!legacy_system) { + if (!musics_time && (f_contents.at(n_element).startsWith("==") || + f_contents.at(element_ahead).endsWith(".wav") || + f_contents.at(element_ahead).endsWith(".mp3") || + f_contents.at(element_ahead).endsWith(".mp4") || + f_contents.at(element_ahead).endsWith(".ogg") || + f_contents.at(element_ahead).endsWith(".opus"))) { + musics_time = true; + } } - + else { + if (!musics_time && (f_contents.at(n_element).startsWith("==") || + f_contents.at(n_element).endsWith(".wav") || + f_contents.at(n_element).endsWith(".mp3") || + f_contents.at(n_element).endsWith(".mp4") || + f_contents.at(n_element).endsWith(".ogg") || + f_contents.at(n_element).endsWith(".opus"))) { + musics_time = true; + } } // Not everything needs to have a thread. -- cgit From 5636ddf449eaa570466133d66c79b799ebea8eb0 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 20:32:12 +0200 Subject: give the translators something to do --- resource/translations/ao_de.ts | 962 ++++++++++++++++++++++++++++++---------- resource/translations/ao_en.ts | 944 +++++++++++++++++++++++++++------------ resource/translations/ao_es.ts | 970 ++++++++++++++++++++++++++++++---------- resource/translations/ao_jp.ts | 964 ++++++++++++++++++++++++++++------------ resource/translations/ao_pl.ts | 962 +++++++++++++++++++++++++++++----------- resource/translations/ao_pt.ts | 975 +++++++++++++++++++++++++++++++---------- resource/translations/ao_ru.ts | 960 ++++++++++++++++++++++++++++------------ 7 files changed, 4975 insertions(+), 1762 deletions(-) diff --git a/resource/translations/ao_de.ts b/resource/translations/ao_de.ts index c4e9f300..b4090bfe 100644 --- a/resource/translations/ao_de.ts +++ b/resource/translations/ao_de.ts @@ -9,7 +9,7 @@ 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,67 @@ 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. + 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. @@ -153,382 +152,450 @@ Grund: Stenograph benötigt - Witness needed - Zeuge benötigt + Zeuge benötigt 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. - Setzt den Standardwerd für den eigenen Anzeigenamen. + Setzt den Standardwerd für den eigenen Anzeigenamen. - Sets the default volume for music. - Standardlautstärke für die Musik. + 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. + Standardlautstärke für Soundeffekte. - IC Log - Log + Log - Colorful IC log: - Farbiges Log: + Farbiges Log: - Enables colored text in the log. - Aktiviert farbigen Text im Log. + Aktiviert farbigen Text im Log. - Only inline coloring: - Nur in-Zeilen Farben: + Nur in-Zeilen Farben: - Only inline coloring will be shown such as <>,|| etc. - Nur die in-Zeilen Farben wie <>,|| etc. werden gezeigt. + Nur die in-Zeilen Farben wie <>,|| etc. werden gezeigt. - Mirror IC log: - Log spiegeln: + 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. + Das Log spiegelt die Nachrichten. Bedeutet dass wenn jemand unterbrochen wird, kann man nicht sehen was derjenige sagen wollte. Für ein realistischeres Spielerlebnis. - + 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: + 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. + 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: - Langsamerer Text: + 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. + Setzt den Text auf die gleiche Geschwindigkeit wie in den AA Spielen. - Blip delay on punctuations: - Blip Pausen bei Satzzeichen: + 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. + Aktivieren damit die Blips bei Satzzeichen langsamer werden. + + + + - Keep current setting + + + + + Allow Screenshake: + + + + + Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. + + + + + Allow Effects: + + + + + Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. + + + + + Network Frame Effects: + + + + + Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. + + + + + Colors in IC Log: + + + + + Use the markup colors in the server IC chatlog. + + + + + Sticky Sounds: + + + + + Turn this on to prevent the sound dropdown from clearing the sound after playing it. + - + + Sticky Effects: + + + + + Turn this on to prevent the effects dropdown from clearing the effect after playing it. + + + + + Sticky Preanims: + + + + + Turn this on to prevent preanimation checkbox from clearing after playing the emote. + + + + 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. - + + Play a blip sound "once per every X symbols", where X is the blip rate. + + + + 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, AO2 will stop the music for you when you or someone else does 'Objection!'. + + + 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. + 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: + Zeuge: - If checked, you will appear amongst the potential witnesses on the server. - Wenn angehakt wirst du als potentielle Zeuge angezeigt. + 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. @@ -536,35 +603,36 @@ Grund: Courtroom - + Password Passwort - + Spectator Zuschauer - - + + Search Suche - + Passworded Gesperrt - + Taken Benutzt + Generating chars: %1/%2 - Generiere Charaktere: + Generiere Charaktere: %1/%2 @@ -574,193 +642,179 @@ Grund: - Could not find %1 - Konnte %1 nicht finden + Konnte %1 nicht finden - + Showname Anzeigename - + Message Nachricht - OOC Message - OOC Nachricht + OOC Nachricht - + Name Name - + Pre Vor - + Flip Spiegeln + Guard - Wache + Wache - Disable Modcalls - Deaktiviere Moderatorenrufe + Deaktiviere Moderatorenrufe - - + + Casing Fall - + Shownames Anzeigenamen - + No Interrupt Keine Unterbrechung - White - Weiß + Weiß - Green - Grün + Grün - Red - Rot + Rot - Orange - Orange + Orange - Blue - Blau + Blau - Yellow - Gelb + Gelb - + Music Musik - + Sfx Sfx - + Blips Blips - Log limit - Verlaufsgrenze + 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. Du hast nun den "Modcall deaktivieren" Knopf. - + 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. - Zu viele Argumente zum Speichern! Bitte gib nur den Dateinamen ohne Erweiterung und den Saalstatus an. + Zu viele Argumente zum Speichern! Bitte gib nur den Dateinamen ohne Erweiterung und den Saalstatus an. %1 has played a song: %2 %1 hat ein Lied gespielt: %2 - Rainbow - Regenbogen + Regenbogen - Pink - Pink + Pink - Cyan - Cyan + Cyan - + % offset % Abstand @@ -773,104 +827,367 @@ Grund: Dies bewirkt nichts, aber egal. - This does nothing, but there you go. - Dies bewirkt nichts, aber egal. + 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 + Du wirst nun mit - if they also choose your character in return. - gepaart, wenn der andere dies auch tut. + gepaart, wenn der andere dies auch tut. + + + + None + + + + + Additive + + + + + To front + + + + + To behind + + + + + Select a character you wish to pair with. + + + + + Change the percentage offset of your character's position from the center of the screen. + + + + + Change the order of appearance for your character. + + + + + Display the list of characters to pair with. + + + + + Oops, you're muted! + + + + + Set your character's emote to play on your next message. + + + + + Set your character's supplementary background. + + + + + Set an 'iniswap', or an alternative character folder to refer to from your current character. +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/iniswaps.ini + + + + + + Remove the currently selected iniswap from the list and return to the original character folder. + + + + + Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any). +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/soundlist.ini + + + + + Choose an effect to play on your next spoken message. +The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by +char.ini [Options] category, effects = 'miscname' where it referes to misc/<miscname>/effects.ini to read the effects. + + + + + Hold It! + + + + + + + When this is turned on, your next in-character message will be a shout! + + + + + Objection! + Einspruch! + + + + Take That! + + + + + Toggle between server chat and global AO2 chat. + + + + + + + + This will display the animation in the viewport as soon as it is pressed. + + + + + Guilty! + + + + + Bring up the Character Select Screen and change your character. + + + + + Refresh the theme and update all of the ui elements to match. + + + + + Request the attention of the current server's moderator. + + + + + Allows you to change various aspects of the client. + + + + + An interface to help you announce a case (you have to be a CM first to be able to announce cases) + + + + + Switch between Areas and Music lists + - + + Play a single-shot animation as defined by the emote when checked. + + + + + If preanim is checked, display the input text immediately as the animation plays concurrently. + + + + + Mirror your character's emotes when checked. + + + + + Add text to your last spoken message when checked. + + + + + Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window. + + + + + Lets you receive case alerts when enabled. +(You can set your preferences in the Settings!) + + + + + Display customized shownames for all users when checked. + + + + + Custom Shout! + + + + + This will display the custom character-defined animation in the viewport as soon as it is pressed. +To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect + + + + + Play realization sound and animation in the viewport on the next spoken message when checked. + + + + + Shake the screen on next spoken message when checked. + + + + + Display the list of character folders you wish to mute. + + + + + + Increase the health bar. + + + + + + Decrease the health bar. + + + + + Change the text color of the spoken message. +You can also select a part of your currently typed message and use the dropdown to change its color! + + + + + Return back to the server list. + + + + + Become a spectator. You won't be able to interact with the in-character screen. + + + + + + CLIENT + + + + + + + has played a song + + + + + You will now pair up with %1 if they also choose your character in return. + + + + 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. - + + + + + UNKNOWN + + + + Your case "%1" was loaded! Dein Fall "%1" wurde geladen! @@ -881,7 +1198,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. @@ -906,74 +1223,234 @@ 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 - + + Expand All Categories + + + + + Collapse All Categories + + + + + Fade Out Previous + + + + + Fade In + + + + + Synchronize + + + + + Default + + + + 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. + Choose.. - Wähle.. + Wähle.. - Choose... - Wähle... + Wähle... + + + + Present this piece of evidence to everyone on your next spoken message + + + + + Save evidence to an .ini file. + + + + + Load evidence from an .ini file. + - + + Destroy this piece of evidence + + + + + Close the evidence display/editing overlay. +You will be prompted if there's any unsaved changes. + + + + + Save any changes made to this piece of evidence and send them to server. + + + + + Double-click to edit. Press [X] to update your changes. + + + + + Bring up the Evidence screen. + + + + + Switch evidence to private inventory. + + + + + Switch evidence to global inventory. + + + + + + Transfer evidence to private inventory. + + + + + + Transfer evidence to global inventory. + + + + + The piece of evidence you've been editing has changed. + + + + + Do you wish to keep your changes? + + + + + Name: %1 +Image: %2 +Description: +%3 + + + + Images (*.png) Bilder (*.png) - + + + + Double-click to edit... + + + + Add new evidence... Neues Beweisstück... + + + Evidence has been modified. + + + + + Do you want to save your changes? + + + + + Current evidence is global. Click to switch to private. + + + + + Current evidence is private. Click to switch to global. + + + + + "%1" has been transferred. + + + + + Save Inventory + + + + + + Ini Files (*.ini) + + + + + Open Inventory + + Discord @@ -1010,43 +1487,67 @@ Verfügbare Fälle: Attorney Online 2 - + + Search + Suche + + + Name 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 - + + Settings + Einstellungen + + + + Allows you to change various aspects of the client. + + + + 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>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! + + + + + About + + + <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>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 <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 @@ -1091,12 +1592,27 @@ Noevain Cronnicossy - - + + Offline Offline + + chatlogpiece + + + + + UNKNOWN + + + + + has played a song: + + + debug_functions @@ -1110,7 +1626,7 @@ Cronnicossy Fehler - + Notice Hinweis diff --git a/resource/translations/ao_en.ts b/resource/translations/ao_en.ts index 9719319f..ee104b9f 100644 --- a/resource/translations/ao_en.ts +++ b/resource/translations/ao_en.ts @@ -9,73 +9,67 @@ - + 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 @@ -118,371 +112,371 @@ Reason: %1 Stenographer needed - - - Witness needed - - 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. + + Log goes downwards: - - Sets the default volume for music. + + If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. - - Sets the default volume for SFX sounds, like interjections or other character sound effects. + + Log length: - - IC Log + + The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. - - Colorful IC log: + + Default username: - - Enables colored text in the log. + + Your OOC name will be automatically set to this value when you join a server. - - Only inline coloring: + + Custom shownames: - - Only inline coloring will be shown such as <>,|| etc. + + Gives the default value for the in-game 'Custom shownames' tickbox, which in turn determines whether the client should display custom in-character names. - - Mirror IC log: + + Backup MS: - - 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. + + If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. - - Log goes downwards: + + Discord: - - If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. + + Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. - - Log length: + + Language: - - The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. + + Sets the language if you don't want to use your system language. - - Default username: + + Callwords - - Your OOC name will be automatically set to this value when you join a server. + + <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> - - Custom shownames: + + Audio - - Backup MS: + + Audio device: - - If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. + + Sets the audio device for all sounds. - - Discord: + + Music: - - Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. + + SFX: - - Allow Shake/Flash: + + Blips: - - Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures. + + Sets the volume of the blips, the talking sound effects. - - Language: + + Blip rate: - - Sets the language if you don't want to use your system language. + + Sets the delay between playing the blip sounds. - - Slower text speed: + + Blank blips: - - Set the text speed to be the same as the AA games. + + If true, the game will play a blip sound even when a space is 'being said'. - - Blip delay on punctuations: + + Enable Looping SFX: - - Punctuation delay modifier. Enable it for the blips to slow down on punctuations. + + If true, the game will allow looping sound effects to play on preanimations. - - Callwords + + Kill Music On Objection: - - <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> + + - Keep current setting - - Audio + + Allow Screenshake: - - Audio device: + + Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. - - Sets the audio device for all sounds. + + Allow Effects: - - Music: + + Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. - - SFX: + + Network Frame Effects: - - Blips: + + Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. - - Sets the volume of the blips, the talking sound effects. + + Colors in IC Log: - - Blip rate: + + Use the markup colors in the server IC chatlog. - - Sets the delay between playing the blip sounds. + + Sticky Sounds: - - Blank blips: + + Turn this on to prevent the sound dropdown from clearing the sound after playing it. - - If true, the game will play a blip sound even when a space is 'being said'. + + Sticky Effects: - - Enable Looping SFX: + + Turn this on to prevent the effects dropdown from clearing the effect after playing it. - - If true, the game will allow looping sound effects to play on preanimations. + + Sticky Preanims: - - Kill Music On Objection: + + Turn this on to prevent preanimation checkbox from clearing after playing the emote. + + + + + Sets the music's default volume. - - If true, the game will stop music when someone objects, like in the actual games. + + Sets the SFX's default volume. Interjections and actual sound effects count as 'SFX'. - + + Play a blip sound "once per every X symbols", where X is the blip rate. + + + + + If true, AO2 will stop the music for you when you or someone else does 'Objection!'. + + + + 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. @@ -490,381 +484,736 @@ Reason: %1 Courtroom - + Password - + Spectator - - + + Search - + Passworded - + Taken - - Could not find %1 + + Generating chars: +%1/%2 - + Showname - + Message - - OOC Message - - - - + Name - + Pre - + Flip - - + + Casing - + Shownames - + No Interrupt - - White + + You were granted the Disable Modcalls button. - - Green + + 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 - - Red + + Case made by %1. - - Orange + + Navigate to %1 for the CM doc. - - Blue + + Your case "%1" was loaded! - - Yellow + + + Server - - - You were granted the Disable Modcalls button. + + Back to Lobby - - This does nothing, but there you go. + + % offset - - 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 + + Music - - Case made by %1. + + Sfx - - Navigate to %1 for the CM doc. + + Blips - - Your case "%1" was loaded! + + Change character - - Too many arguments to save a case! You only need a filename without extension and the courtroom status. + + Reload theme - - - Server + + Call mod - - Back to Lobby + + Settings - - Rainbow + + A/M - - Disable Modcalls + + Preanim - - Pink + + You have been banned. - - Cyan + + You opened the settings menu. - - % offset + + None - - Music + + Guard - - Sfx + + Additive - - Blips + + To front + + + + + To behind + + + + + Select a character you wish to pair with. + + + + + Change the percentage offset of your character's position from the center of the screen. - - Log limit + + Change the order of appearance for your character. + + + + + Display the list of characters to pair with. + + + + + Oops, you're muted! + + + + + Set your character's emote to play on your next message. - Change character + Set your character's supplementary background. - - Reload theme + + Set an 'iniswap', or an alternative character folder to refer to from your current character. +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/iniswaps.ini - - Call mod + + + Remove the currently selected iniswap from the list and return to the original character folder. - - Settings + + Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any). +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/soundlist.ini - - A/M + + Choose an effect to play on your next spoken message. +The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by +char.ini [Options] category, effects = 'miscname' where it referes to misc/<miscname>/effects.ini to read the effects. - - Preanim + + Hold It! - - You have been banned. + + + + When this is turned on, your next in-character message will be a shout! - - You opened the settings menu. + + Objection! + + + + + Take That! + + + + + Toggle between server chat and global AO2 chat. - - You will now pair up with + + + + + This will display the animation in the viewport as soon as it is pressed. - - if they also choose your character in return. + + Guilty! - + + Bring up the Character Select Screen and change your character. + + + + + Refresh the theme and update all of the ui elements to match. + + + + + Request the attention of the current server's moderator. + + + + + Allows you to change various aspects of the client. + + + + + An interface to help you announce a case (you have to be a CM first to be able to announce cases) + + + + + Switch between Areas and Music lists + + + + + Play a single-shot animation as defined by the emote when checked. + + + + + If preanim is checked, display the input text immediately as the animation plays concurrently. + + + + + Mirror your character's emotes when checked. + + + + + Add text to your last spoken message when checked. + + + + + Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window. + + + + + Lets you receive case alerts when enabled. +(You can set your preferences in the Settings!) + + + + + Display customized shownames for all users when checked. + + + + + Custom Shout! + + + + + This will display the custom character-defined animation in the viewport as soon as it is pressed. +To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect + + + + + Play realization sound and animation in the viewport on the next spoken message when checked. + + + + + Shake the screen on next spoken message when checked. + + + + + Display the list of character folders you wish to mute. + + + + + + Increase the health bar. + + + + + + Decrease the health bar. + + + + + Change the text color of the spoken message. +You can also select a part of your currently typed message and use the dropdown to change its color! + + + + + Return back to the server list. + + + + + Become a spectator. You won't be able to interact with the in-character screen. + + + + + + CLIENT + + + + + + + has played a song + + + + + You will now pair up with %1 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. - + + + + + UNKNOWN + + + + 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 - + + Expand All Categories + + + + + Collapse All Categories + + + + + Fade Out Previous + + + + + Fade In + + + + + Synchronize + + + + + Default + + + + Reason: - + Call Moderator - - + + Error - + You must provide a reason. - + The message is too long. - - Choose... + + Present this piece of evidence to everyone on your next spoken message + + + + + Save evidence to an .ini file. + + + + + Load evidence from an .ini file. + + + + + Destroy this piece of evidence + + + + + Choose.. + + + + + Close the evidence display/editing overlay. +You will be prompted if there's any unsaved changes. + + + + + Save any changes made to this piece of evidence and send them to server. + + + + + Double-click to edit. Press [X] to update your changes. + + + + + Bring up the Evidence screen. + + + + + Switch evidence to private inventory. + + + + + Switch evidence to global inventory. + + + + + + Transfer evidence to private inventory. + + + + + + Transfer evidence to global inventory. - + + The piece of evidence you've been editing has changed. + + + + + Do you wish to keep your changes? + + + + + Name: %1 +Image: %2 +Description: +%3 + + + + Images (*.png) - + + + + Double-click to edit... + + + + Add new evidence... + + + Evidence has been modified. + + + + + Do you want to save your changes? + + + + + Current evidence is global. Click to switch to private. + + + + + Current evidence is private. Click to switch to global. + + + + + "%1" has been transferred. + + + + + Save Inventory + + + + + + Ini Files (*.ini) + + + + + Open Inventory + + Lobby @@ -874,48 +1223,83 @@ Cases you can load: %1 - + + Search + + + + 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? - + Version: %1 - + + Settings + + + + + Allows you to change various aspects of the client. + + + + 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, 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>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! - + + About + + + + Online: %1/%2 - - + + Offline + + chatlogpiece + + + + + UNKNOWN + + + + + has played a song: + + + debug_functions @@ -929,7 +1313,7 @@ Did you download all resources correctly from tiny.cc/getao, including the large - + Notice diff --git a/resource/translations/ao_es.ts b/resource/translations/ao_es.ts index 2cad7ce1..3d456a54 100644 --- a/resource/translations/ao_es.ts +++ b/resource/translations/ao_es.ts @@ -9,12 +9,12 @@ 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,68 +22,67 @@ 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 Ingrese a aceattorneyonline.com para actualizar. - You have been exiled from AO. Have a nice day. - Has sido exiliado de AO. + Has sido exiliado de AO. Que tengas un buen día. - + 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. @@ -140,392 +139,456 @@ Razón: Se necesita taquígrafo - Witness needed - Se necesita testigo + Se necesita testigo 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: + 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. + 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. + 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: + 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. + 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: + 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. + La velocidad del texto será la misma que en los juegos de AA. - Blip delay on punctuations: - Retraso en puntuación: + Retraso en puntuación: - Sets the default volume for music. - Establece el volumen predeterminado de la música. + 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. + 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. + Si está habilitado, el juego detendrá la música cuando alguien haga una objeción, como en los juegos. + + + + - Keep current setting + + + + + Allow Screenshake: + + + + + Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. + + + + + Allow Effects: + + + + + Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. + + + + + Network Frame Effects: + + + + + Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. + + + + + Colors in IC Log: + + + + + Use the markup colors in the server IC chatlog. + - + + Sticky Sounds: + + + + + Turn this on to prevent the sound dropdown from clearing the sound after playing it. + + + + + Sticky Effects: + + + + + Turn this on to prevent the effects dropdown from clearing the effect after playing it. + + + + + Sticky Preanims: + + + + + Turn this on to prevent preanimation checkbox from clearing after playing the emote. + + + + + Play a blip sound "once per every X symbols", where X is the blip rate. + + + + + If true, AO2 will stop the music for you when you or someone else does 'Objection!'. + + + + 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: + Testigo: - If checked, you will appear amongst the potential witnesses on the server. - Si está marcado, aparecerá entre los posibles testigos en el servidor. + 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. + 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. + 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: - Log IC colorido: + Log IC colorido: - Enables colored text in the log. - Habilita texto con color en el log. + Habilita texto con color en el log. - Only inline coloring: - Solo coloración en línea: + 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 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 @@ -535,41 +598,41 @@ Razón: Courtroom - + Password Contraseña - + Spectator Espectador - - + + Search Buscar - + Passworded A translation wouldn't fit because of the shitty theme system. - + Taken En uso - Could not find %1 - No se pudo encontrar %1 + No se pudo encontrar %1 + Generating chars: %1/%2 - Generando personajes: + Generando personajes: %1/%2 @@ -579,170 +642,156 @@ 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. + Guard - Guardia + 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 + Blanco - Green - Verde + Verde - Red - Rojo + Rojo - Orange - Naranja + Naranja - Blue - Azul + Azul - Yellow - Amarillo + Amarillo - Rainbow - Arcoíris + Arcoíris - Pink - Rosado + Rosado - Cyan - Cian + 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. @@ -751,107 +800,400 @@ 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. + 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 + Ahora te emparejarás con - if they also choose your character in return. - si ellos también eligen a tu personaje a cambio. + si ellos también eligen a tu personaje a cambio. + + + + None + + + + + Additive + + + + + To front + + + + + To behind + + + + + Select a character you wish to pair with. + + + + + Change the percentage offset of your character's position from the center of the screen. + + + + + Change the order of appearance for your character. + + + + + Display the list of characters to pair with. + + + + + Oops, you're muted! + + + + + Set your character's emote to play on your next message. + + + + + Set your character's supplementary background. + + + + + Set an 'iniswap', or an alternative character folder to refer to from your current character. +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/iniswaps.ini + + + + + + Remove the currently selected iniswap from the list and return to the original character folder. + + + + + Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any). +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/soundlist.ini + + + + + Choose an effect to play on your next spoken message. +The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by +char.ini [Options] category, effects = 'miscname' where it referes to misc/<miscname>/effects.ini to read the effects. + + + + + Hold It! + + + + + + + When this is turned on, your next in-character message will be a shout! + + + + + Objection! + + + + + Take That! + + + + + Toggle between server chat and global AO2 chat. + + + + + + + + This will display the animation in the viewport as soon as it is pressed. + + + + + Guilty! + + + + + Bring up the Character Select Screen and change your character. + + + + + Refresh the theme and update all of the ui elements to match. + + + + + Request the attention of the current server's moderator. + + + + + Allows you to change various aspects of the client. + + + + + An interface to help you announce a case (you have to be a CM first to be able to announce cases) + + + + + Switch between Areas and Music lists + - + + Play a single-shot animation as defined by the emote when checked. + + + + + If preanim is checked, display the input text immediately as the animation plays concurrently. + + + + + Mirror your character's emotes when checked. + + + + + Add text to your last spoken message when checked. + + + + + Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window. + + + + + Lets you receive case alerts when enabled. +(You can set your preferences in the Settings!) + + + + + Display customized shownames for all users when checked. + + + + + Custom Shout! + + + + + This will display the custom character-defined animation in the viewport as soon as it is pressed. +To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect + + + + + Play realization sound and animation in the viewport on the next spoken message when checked. + + + + + Shake the screen on next spoken message when checked. + + + + + Display the list of character folders you wish to mute. + + + + + + Increase the health bar. + + + + + + Decrease the health bar. + + + + + Change the text color of the spoken message. +You can also select a part of your currently typed message and use the dropdown to change its color! + + + + + Return back to the server list. + + + + + Become a spectator. You won't be able to interact with the in-character screen. + + + + + + CLIENT + + + + + + + has played a song + + + + + You will now pair up with %1 if they also choose your character in return. + + + + 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. - + + + + + UNKNOWN + + + + Your case "%1" was loaded! Su caso "%1" fue cargado! + + + Expand All Categories + + + + + Collapse All Categories + + + + + Fade Out Previous + + + + + Fade In + + + + + Synchronize + + + + + Default + + 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: @@ -859,7 +1201,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. @@ -884,92 +1226,219 @@ 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 + 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. + ¡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. - Choose... - Elegir... + Elegir... + + + + Present this piece of evidence to everyone on your next spoken message + + + + + Save evidence to an .ini file. + + + + + Load evidence from an .ini file. + - + + Destroy this piece of evidence + + + + + Choose.. + + + + + Close the evidence display/editing overlay. +You will be prompted if there's any unsaved changes. + + + + + Save any changes made to this piece of evidence and send them to server. + + + + + Double-click to edit. Press [X] to update your changes. + + + + + Bring up the Evidence screen. + + + + + Switch evidence to private inventory. + + + + + Switch evidence to global inventory. + + + + + + Transfer evidence to private inventory. + + + + + + Transfer evidence to global inventory. + + + + + The piece of evidence you've been editing has changed. + + + + + Do you wish to keep your changes? + + + + + Name: %1 +Image: %2 +Description: +%3 + + + + Images (*.png) Imágenes (* .png) - + + + + Double-click to edit... + + + + Add new evidence... Añadir nueva evidencia... + + + Evidence has been modified. + + + + + Do you want to save your changes? + + + + + Current evidence is global. Click to switch to private. + + + + + Current evidence is private. Click to switch to global. + + + + + "%1" has been transferred. + + + + + Save Inventory + + + + + + Ini Files (*.ini) + + + + + Open Inventory + + Lobby @@ -979,53 +1448,92 @@ Casos que puede cargar: - + + Search + Buscar + + + Name 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 - + + Settings + Ajustes + + + + Allows you to change various aspects of the client. + + + + 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>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! + + + + + About + + + <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, 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 + + chatlogpiece + + + + + UNKNOWN + + + + + has played a song: + + + debug_functions @@ -1039,7 +1547,7 @@ Did you download all resources correctly from tiny.cc/getao, including the large - + 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. diff --git a/resource/translations/ao_jp.ts b/resource/translations/ao_jp.ts index 029e84ad..a6594dec 100644 --- a/resource/translations/ao_jp.ts +++ b/resource/translations/ao_jp.ts @@ -9,73 +9,67 @@ - + 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 @@ -118,371 +112,371 @@ Reason: %1 Stenographer needed - - - Witness needed - - 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. + + Log goes downwards: - - Sets the default volume for music. + + If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. - - Sets the default volume for SFX sounds, like interjections or other character sound effects. + + Log length: - - IC Log + + The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. - - Colorful IC log: + + Default username: - - Enables colored text in the log. + + Your OOC name will be automatically set to this value when you join a server. - - Only inline coloring: + + Custom shownames: - - Only inline coloring will be shown such as <>,|| etc. + + Gives the default value for the in-game 'Custom shownames' tickbox, which in turn determines whether the client should display custom in-character names. - - Mirror IC log: + + Backup MS: - - 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. + + If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. - - Log goes downwards: + + Discord: - - If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. + + Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. - - Log length: + + Language: - - The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. + + Sets the language if you don't want to use your system language. - - Default username: + + Callwords - - Your OOC name will be automatically set to this value when you join a server. + + <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> - - Custom shownames: + + Audio - - Backup MS: + + Audio device: - - If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. + + Sets the audio device for all sounds. - - Discord: + + Music: + 音楽: + + + + SFX: + 効果音: + + + + Blips: + ブリップ: + + + + Sets the volume of the blips, the talking sound effects. - - Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. + + Blip rate: - - Allow Shake/Flash: + + Sets the delay between playing the blip sounds. - - Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures. + + Blank blips: - - Language: + + If true, the game will play a blip sound even when a space is 'being said'. - - Sets the language if you don't want to use your system language. + + Enable Looping SFX: - - Slower text speed: + + If true, the game will allow looping sound effects to play on preanimations. - - Set the text speed to be the same as the AA games. + + Kill Music On Objection: - - Blip delay on punctuations: + + - Keep current setting - - Punctuation delay modifier. Enable it for the blips to slow down on punctuations. + + Allow Screenshake: - - Callwords + + Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. - - <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> + + Allow Effects: - - Audio + + Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. - - Audio device: + + Network Frame Effects: - - Sets the audio device for all sounds. + + Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. - - Music: - 音楽: + + Colors in IC Log: + - - SFX: - 効果音: + + Use the markup colors in the server IC chatlog. + - - Blips: - ブリップ: + + Sticky Sounds: + - - Sets the volume of the blips, the talking sound effects. + + Turn this on to prevent the sound dropdown from clearing the sound after playing it. - - Blip rate: + + Sticky Effects: - - Sets the delay between playing the blip sounds. + + Turn this on to prevent the effects dropdown from clearing the effect after playing it. - - Blank blips: + + Sticky Preanims: - - If true, the game will play a blip sound even when a space is 'being said'. + + Turn this on to prevent preanimation checkbox from clearing after playing the emote. - - Enable Looping SFX: + + Sets the music's default volume. - - If true, the game will allow looping sound effects to play on preanimations. + + Sets the SFX's default volume. Interjections and actual sound effects count as 'SFX'. - - Kill Music On Objection: + + Play a blip sound "once per every X symbols", where X is the blip rate. - - If true, the game will stop music when someone objects, like in the actual games. + + If true, AO2 will stop the music for you when you or someone else does 'Objection!'. - + 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. @@ -490,385 +484,776 @@ Reason: %1 Courtroom - + Password - + Spectator 観客 - - + + Search - + Passworded - + Taken - - Could not find %1 + + Generating chars: +%1/%2 - + Showname - + Message - + Name 名前 - + Pre - + Flip フリップ + Guard - ガード + ガード - - + + Additive + + + + + 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 + + + None + + + + + Hold It! + + + + + + + When this is turned on, your next in-character message will be a shout! + + + + + Objection! + 意義あり! + + + + Take That! + + + + + Toggle between server chat and global AO2 chat. + + + + + + + + This will display the animation in the viewport as soon as it is pressed. + + + + + Guilty! + + + + + Bring up the Character Select Screen and change your character. + + + + + Refresh the theme and update all of the ui elements to match. + + + + + Request the attention of the current server's moderator. + + + + + Allows you to change various aspects of the client. + + + An interface to help you announce a case (you have to be a CM first to be able to announce cases) + + + + + Switch between Areas and Music lists + + + + + Play a single-shot animation as defined by the emote when checked. + + + + + If preanim is checked, display the input text immediately as the animation plays concurrently. + + + + + Mirror your character's emotes when checked. + + + + + Add text to your last spoken message when checked. + + + + + Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window. + + + + + Lets you receive case alerts when enabled. +(You can set your preferences in the Settings!) + + + + + Display customized shownames for all users when checked. + + + + + Custom Shout! + + + + + This will display the custom character-defined animation in the viewport as soon as it is pressed. +To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect + + + + + Play realization sound and animation in the viewport on the next spoken message when checked. + + + + + Shake the screen on next spoken message when checked. + + + + + Display the list of character folders you wish to mute. + + + + + + Increase the health bar. + + + + + + Decrease the health bar. + + + + + Change the text color of the spoken message. +You can also select a part of your currently typed message and use the dropdown to change its color! + + + + Back to Lobby ロビーに戻る - - Rainbow - + + + + has played a song + - - OOC Message + + You will now pair up with %1 if they also choose your character in return. - - Disable Modcalls - + Rainbow + - Pink - ピンク + ピンク - Cyan - シアン + シアン - + % offset - + + To front + + + + + To behind + + + + + Select a character you wish to pair with. + + + + + Change the percentage offset of your character's position from the center of the screen. + + + + + Change the order of appearance for your character. + + + + + Display the list of characters to pair with. + + + + + Oops, you're muted! + + + + + Set your character's emote to play on your next message. + + + + + Set your character's supplementary background. + + + + + Set an 'iniswap', or an alternative character folder to refer to from your current character. +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/iniswaps.ini + + + + + + Remove the currently selected iniswap from the list and return to the original character folder. + + + + + Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any). +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/soundlist.ini + + + + + Choose an effect to play on your next spoken message. +The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by +char.ini [Options] category, effects = 'miscname' where it referes to misc/<miscname>/effects.ini to read the effects. + + + + Music 音楽 - + Sfx 効果音 - + Blips ブリップ - - Log limit - - - - + Change character - + Reload theme - + Call mod - + Settings - + A/M - + Preanim - - - You were granted the Disable Modcalls button. + + Return back to the server list. - - You have been banned. + + Become a spectator. You won't be able to interact with the in-character screen. - - Too many arguments to save a case! You only need a filename without extension and the courtroom status. + + You were granted the Disable Modcalls button. - - You opened the settings menu. + + + CLIENT - - You will now pair up with + + You have been banned. - - if they also choose your character in return. + + You opened the settings menu. - + 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. - + + + + + UNKNOWN + + + + 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 マスター - + + Expand All Categories + + + + + Collapse All Categories + + + + + Fade Out Previous + + + + + Fade In + + + + + Synchronize + + + + + Default + + + + Reason: - + Call Moderator モデレーターを呼ぶ - - + + Error エラー - + You must provide a reason. - + The message is too long. - Choose... - 選択... + 選択... + + + + Present this piece of evidence to everyone on your next spoken message + - + + Save evidence to an .ini file. + + + + + Load evidence from an .ini file. + + + + + Destroy this piece of evidence + + + + + Choose.. + + + + + Close the evidence display/editing overlay. +You will be prompted if there's any unsaved changes. + + + + + Save any changes made to this piece of evidence and send them to server. + + + + + Double-click to edit. Press [X] to update your changes. + + + + + Bring up the Evidence screen. + + + + + Switch evidence to private inventory. + + + + + Switch evidence to global inventory. + + + + + + Transfer evidence to private inventory. + + + + + + Transfer evidence to global inventory. + + + + + The piece of evidence you've been editing has changed. + + + + + Do you wish to keep your changes? + + + + + Name: %1 +Image: %2 +Description: +%3 + + + + Images (*.png) イメージ (*.png) - + + + + Double-click to edit... + + + + Add new evidence... 新しい証拠を付け加える... + + + Evidence has been modified. + + + + + Do you want to save your changes? + + + + + Current evidence is global. Click to switch to private. + + + + + Current evidence is private. Click to switch to global. + + + + + "%1" has been transferred. + + + + + Save Inventory + + + + + + Ini Files (*.ini) + + + + + Open Inventory + + Discord @@ -901,48 +1286,83 @@ Cases you can load: %1 - + + Search + + + + 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? - + Version: %1 - + + Settings + + + + + Allows you to change various aspects of the client. + + + + 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, 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>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! - + + About + + + + Online: %1/%2 - - + + Offline オフライン + + chatlogpiece + + + + + UNKNOWN + + + + + has played a song: + + + debug_functions @@ -956,7 +1376,7 @@ Did you download all resources correctly from tiny.cc/getao, including the large エラー - + Notice 通知 diff --git a/resource/translations/ao_pl.ts b/resource/translations/ao_pl.ts index 2662fcf3..009a1f7b 100644 --- a/resource/translations/ao_pl.ts +++ b/resource/translations/ao_pl.ts @@ -9,12 +9,12 @@ 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,68 @@ 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. + 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. @@ -130,383 +129,395 @@ Powód: %1 Potrzebny stenograf - Witness needed - Potrzebny świadek + Potrzebny świadek 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: + 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. + 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: + + - Keep current setting - - Set the text speed to be the same as the AA games. + + Allow Screenshake: - - Blip delay on punctuations: + + Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. - - Punctuation delay modifier. Enable it for the blips to slow down on punctuations. + + Allow Effects: + + + + + Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. + + + + + Network Frame Effects: + + + + + Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. + + + + + Colors in IC Log: + + + + + Use the markup colors in the server IC chatlog. + + + + + Sticky Sounds: - + + Turn this on to prevent the sound dropdown from clearing the sound after playing it. + + + + + Sticky Effects: + + + + + Turn this on to prevent the effects dropdown from clearing the effect after playing it. + + + + + Sticky Preanims: + + + + + Turn this on to prevent preanimation checkbox from clearing after playing the emote. + + + + 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. - + + Play a blip sound "once per every X symbols", where X is the blip rate. + + + + 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, AO2 will stop the music for you when you or someone else does 'Objection!'. + + + 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. + 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: + Ś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. + 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. @@ -514,402 +525,808 @@ Powód: %1 Courtroom - + Password Hasło - + Spectator Widz - - + + Search Wyszukaj - + Passworded Zahasłowany - + Taken Zajęty - Could not find %1 - Nie znaleziono %1 + Nie znaleziono %1 + Generating chars: %1/%2 - Generowanie postaci: + Generowanie postaci: %1.%2 - + Showname Ksywka - + Message Wiadomość - + Name Nazwa - + Pre przed- - + Flip Odwróć + Guard - Na Służbie (mod) + Na Służbie (mod) - - + + Additive + + + + + Casing Rozprawa - + Shownames Ksywki - + No Interrupt Bez ociągania się - White - Biały + Biały - Green - Zielony + Zielony - Red - Czerwony + Czerwony - Orange - Pomarańczowy + Pomarańczowy - Blue - Niebieski + Niebieski - Yellow - Żółty + Żółty - This does nothing, but there you go. - To nic nie robi, ale proszę bardzo. + 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 + + + None + + + + + Hold It! + + + + + + + When this is turned on, your next in-character message will be a shout! + + + + + Objection! + + + + + Take That! + + + + + Toggle between server chat and global AO2 chat. + + + + + + + + This will display the animation in the viewport as soon as it is pressed. + + + + + Guilty! + + + + + Bring up the Character Select Screen and change your character. + + + + + Refresh the theme and update all of the ui elements to match. + + + + + Request the attention of the current server's moderator. + + + + + Allows you to change various aspects of the client. + + + An interface to help you announce a case (you have to be a CM first to be able to announce cases) + + + + + Switch between Areas and Music lists + + + + + Play a single-shot animation as defined by the emote when checked. + + + + + If preanim is checked, display the input text immediately as the animation plays concurrently. + + + + + Mirror your character's emotes when checked. + + + + + Add text to your last spoken message when checked. + + + + + Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window. + + + + + Lets you receive case alerts when enabled. +(You can set your preferences in the Settings!) + + + + + Display customized shownames for all users when checked. + + + + + Custom Shout! + + + + + This will display the custom character-defined animation in the viewport as soon as it is pressed. +To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect + + + + + Play realization sound and animation in the viewport on the next spoken message when checked. + + + + + Shake the screen on next spoken message when checked. + + + + + Display the list of character folders you wish to mute. + + + + + + Increase the health bar. + + + + + + Decrease the health bar. + + + + + Change the text color of the spoken message. +You can also select a part of your currently typed message and use the dropdown to change its color! + + + + Back to Lobby Powrót do poczekalni - - Rainbow - Tęczowy + + + + has played a song + - - OOC Message + + You will now pair up with %1 if they also choose your character in return. - + Rainbow + Tęczowy + + Disable Modcalls - Wyłącz wezwania moda + Wyłącz wezwania moda - Pink - Różowy + Różowy - Cyan - Turkusowy + Turkusowy - + % offset % wyrówanie - + + To front + + + + + To behind + + + + + Select a character you wish to pair with. + + + + + Change the percentage offset of your character's position from the center of the screen. + + + + + Change the order of appearance for your character. + + + + + Display the list of characters to pair with. + + + + + Oops, you're muted! + + + + + Set your character's emote to play on your next message. + + + + + Set your character's supplementary background. + + + + + Set an 'iniswap', or an alternative character folder to refer to from your current character. +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/iniswaps.ini + + + + + + Remove the currently selected iniswap from the list and return to the original character folder. + + + + + Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any). +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/soundlist.ini + + + + + Choose an effect to play on your next spoken message. +The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by +char.ini [Options] category, effects = 'miscname' where it referes to misc/<miscname>/effects.ini to read the effects. + + + + Music Muzyka - + Sfx Sfx - + Blips Blipy - Log limit - Limit dziennika + 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. + + Return back to the server list. - - You have been banned. - Zostałeś zbanowany. + + Become a spectator. You won't be able to interact with the in-character screen. + + + + + You were granted the Disable Modcalls button. + - - Too many arguments to save a case! You only need a filename without extension and the courtroom status. + + + CLIENT + + + You have been banned. + Zostałeś zbanowany. + 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 + Będzie teraz w parze z - if they also choose your character in return. - jeżeli oni również wybiorą ciebie spowrotem. + 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. - + + + + + UNKNOWN + + + + 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 - + + Expand All Categories + + + + + Collapse All Categories + + + + + Fade Out Previous + + + + + Fade In + + + + + Synchronize + + + + + Default + + + + 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. - Choose... - Wybierz... + Wybierz... + + + + Present this piece of evidence to everyone on your next spoken message + + + + + Save evidence to an .ini file. + - + + Load evidence from an .ini file. + + + + + Destroy this piece of evidence + + + + + Choose.. + + + + + Close the evidence display/editing overlay. +You will be prompted if there's any unsaved changes. + + + + + Save any changes made to this piece of evidence and send them to server. + + + + + Double-click to edit. Press [X] to update your changes. + + + + + Bring up the Evidence screen. + + + + + Switch evidence to private inventory. + + + + + Switch evidence to global inventory. + + + + + + Transfer evidence to private inventory. + + + + + + Transfer evidence to global inventory. + + + + + The piece of evidence you've been editing has changed. + + + + + Do you wish to keep your changes? + + + + + Name: %1 +Image: %2 +Description: +%3 + + + + Images (*.png) Plik obrazu (*.png) - + + + + Double-click to edit... + + + + Add new evidence... Dodaj nowe dowody... + + + Evidence has been modified. + + + + + Do you want to save your changes? + + + + + Current evidence is global. Click to switch to private. + + + + + Current evidence is private. Click to switch to global. + + + + + "%1" has been transferred. + + + + + Save Inventory + + + + + + Ini Files (*.ini) + + + + + Open Inventory + + Lobby @@ -919,35 +1336,55 @@ Rozprawy które możesz załadować: %1 - + + Search + Wyszukaj + + + Name 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 - + + Settings + Ustawienia + + + + Allows you to change various aspects of the client. + + + + 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, 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>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! + + + + + About @@ -955,17 +1392,32 @@ Czy pobrałeś wszystkie zasoby poprawnie z tiny.cc/getao, włączając duży fo <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 + + chatlogpiece + + + + + UNKNOWN + + + + + has played a song: + + + debug_functions @@ -979,7 +1431,7 @@ Czy pobrałeś wszystkie zasoby poprawnie z tiny.cc/getao, włączając duży fo Błąd - + Notice Ogłoszenie diff --git a/resource/translations/ao_pt.ts b/resource/translations/ao_pt.ts index 824c81ee..7a69475c 100644 --- a/resource/translations/ao_pt.ts +++ b/resource/translations/ao_pt.ts @@ -9,80 +9,79 @@ 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. + 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. @@ -127,779 +126,1258 @@ Motivo: %1 Precisa-se de Estenógrafo - Witness needed - Precisa-se de Testemunha + Precisa-se de Testemunha 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: + 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. + 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. + 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: + 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. + 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: + 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. + A velocidade do texto será a mesma dos jogos AA. - Blip delay on punctuations: - Atraso na pontuação: + Atraso na pontuação: - Sets the default volume for music. - Define o volume padrão da música. + 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. + 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. + Se ativado, o jogo interrompe a música quando alguém protestar , como nos jogos reais. + + + + - Keep current setting + + + + + Allow Screenshake: + + + + + Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. + + + + + Allow Effects: + + + + + Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. + + + + + Network Frame Effects: + + + + + Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. + + + + + Colors in IC Log: + + + + + Use the markup colors in the server IC chatlog. + + + + + Sticky Sounds: + + + + + Turn this on to prevent the sound dropdown from clearing the sound after playing it. + + + + + Sticky Effects: + + + + + Turn this on to prevent the effects dropdown from clearing the effect after playing it. + + + + + Sticky Preanims: + + + + + Turn this on to prevent preanimation checkbox from clearing after playing the emote. + + + + + Play a blip sound "once per every X symbols", where X is the blip rate. + + + + + If true, AO2 will stop the music for you when you or someone else does 'Objection!'. + - + 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: + Testemunha: - If checked, you will appear amongst the potential witnesses on the server. - Se marcado, você aparecerá entre as testemunhas em potencial no servidor. + 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: + Log IC colorido: - Enables colored text in the log. - Ativa o texto colorido no log. + Ativa o texto colorido no log. - Only inline coloring: - Somente coloração em linha: + Somente coloração em linha: - Only inline coloring will be shown such as <>,|| etc. - Somente a coloração em linha será mostrada como <>, ||, etc. + Somente a coloração em linha será mostrada como <>, ||, etc. - Mirror IC log: - O log IC reflete interrupções: + 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. + 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 - + + Generating chars: +%1/%2 + + + Could not find %1 - Não foi possível encontrar %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 + 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 + Branco - Green - Verde + Verde - Red - Vermelho + Vermelho - Orange - Laranja + Laranja - Blue - Azul + Azul - Yellow - Amarelo + Amarelo - Rainbow - Arco Iris + Arco Iris - Pink - Rosa + Rosa - Cyan - Ciano + 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ê. + 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 + Agora você vai fazer par com - if they also choose your character in return. - se eles também escolherem seu personagem em troca. + se eles também escolherem seu personagem em troca. + + + + None + + + + + Guard + + + + + Additive + + + + + To front + + + + + To behind + + + + + Select a character you wish to pair with. + + + + + Change the percentage offset of your character's position from the center of the screen. + + + + + Change the order of appearance for your character. + + + + + Display the list of characters to pair with. + + + + + Oops, you're muted! + + + + + Set your character's emote to play on your next message. + + + + + Set your character's supplementary background. + + + + + Set an 'iniswap', or an alternative character folder to refer to from your current character. +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/iniswaps.ini + + + + + + Remove the currently selected iniswap from the list and return to the original character folder. + + + + + Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any). +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/soundlist.ini + + + + + Choose an effect to play on your next spoken message. +The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by +char.ini [Options] category, effects = 'miscname' where it referes to misc/<miscname>/effects.ini to read the effects. + + + + + Hold It! + + + + + + + When this is turned on, your next in-character message will be a shout! + + + + + Objection! + + + + + Take That! + + + + + Toggle between server chat and global AO2 chat. + + + + + + + + This will display the animation in the viewport as soon as it is pressed. + + + + + Guilty! + + + + + Bring up the Character Select Screen and change your character. + + + + + Refresh the theme and update all of the ui elements to match. + + + + + Request the attention of the current server's moderator. + + + + + Allows you to change various aspects of the client. + - + + An interface to help you announce a case (you have to be a CM first to be able to announce cases) + + + + + Switch between Areas and Music lists + + + + + Play a single-shot animation as defined by the emote when checked. + + + + + If preanim is checked, display the input text immediately as the animation plays concurrently. + + + + + Mirror your character's emotes when checked. + + + + + Add text to your last spoken message when checked. + + + + + Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window. + + + + + Lets you receive case alerts when enabled. +(You can set your preferences in the Settings!) + + + + + Display customized shownames for all users when checked. + + + + + Custom Shout! + + + + + This will display the custom character-defined animation in the viewport as soon as it is pressed. +To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect + + + + + Play realization sound and animation in the viewport on the next spoken message when checked. + + + + + Shake the screen on next spoken message when checked. + + + + + Display the list of character folders you wish to mute. + + + + + + Increase the health bar. + + + + + + Decrease the health bar. + + + + + Change the text color of the spoken message. +You can also select a part of your currently typed message and use the dropdown to change its color! + + + + + Return back to the server list. + + + + + Become a spectator. You won't be able to interact with the in-character screen. + + + + + + CLIENT + + + + + + + has played a song + + + + + You will now pair up with %1 if they also choose your character in return. + + + + 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. - + + + + + UNKNOWN + + + + 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. + 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. + 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 - + + Expand All Categories + + + + + Collapse All Categories + + + + + Fade Out Previous + + + + + Fade In + + + + + Synchronize + + + + + Default + + + + 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. - Choose... - Escolha... + Escolha... + + + + Present this piece of evidence to everyone on your next spoken message + + + + + Save evidence to an .ini file. + - + + Load evidence from an .ini file. + + + + + Destroy this piece of evidence + + + + + Choose.. + + + + + Close the evidence display/editing overlay. +You will be prompted if there's any unsaved changes. + + + + + Save any changes made to this piece of evidence and send them to server. + + + + + Double-click to edit. Press [X] to update your changes. + + + + + Bring up the Evidence screen. + + + + + Switch evidence to private inventory. + + + + + Switch evidence to global inventory. + + + + + + Transfer evidence to private inventory. + + + + + + Transfer evidence to global inventory. + + + + + The piece of evidence you've been editing has changed. + + + + + Do you wish to keep your changes? + + + + + Name: %1 +Image: %2 +Description: +%3 + + + + Images (*.png) Imagens (* .png) - + + + + Double-click to edit... + + + + Add new evidence... Adicionar nova evidência... + + + Evidence has been modified. + + + + + Do you want to save your changes? + + + + + Current evidence is global. Click to switch to private. + + + + + Current evidence is private. Click to switch to global. + + + + + "%1" has been transferred. + + + + + Save Inventory + + + + + + Ini Files (*.ini) + + + + + Open Inventory + + Lobby @@ -909,53 +1387,92 @@ Casos que você pode carregar: %1 - + + Search + Pesquisar + + + Name 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 - - + + Settings + Configurações + + + + Allows you to change various aspects of the client. + + + + + 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>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! + + + + + About + + + <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, 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 + + chatlogpiece + + + + + UNKNOWN + + + + + has played a song: + + + debug_functions @@ -969,7 +1486,7 @@ Você baixou todos os recursos corretamente do tiny.cc/getao, incluindo a grande - + Notice diff --git a/resource/translations/ao_ru.ts b/resource/translations/ao_ru.ts index 93a32956..3b0af42f 100644 --- a/resource/translations/ao_ru.ts +++ b/resource/translations/ao_ru.ts @@ -9,12 +9,12 @@ Соединение с сервером прервано. - + 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,66 @@ 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 вас отправили в жизнь. + Из 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 Вас отправили в баню. @@ -138,383 +137,371 @@ Reason: Stenographer needed Нужен стенографист? - - - Witness needed - - 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: + + Language: + Язык: + + + + Sets the language if you don't want to use your system language. - - Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures. + + - Keep current setting - - Language: - Язык: + + Allow Screenshake: + - - Sets the language if you don't want to use your system language. + + Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. - - Slower text speed: + + Allow Effects: - - Set the text speed to be the same as the AA games. + + Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. - - Blip delay on punctuations: + + Network Frame Effects: - - Punctuation delay modifier. Enable it for the blips to slow down on punctuations. + + Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. + + + + + Colors in IC Log: + + + + + Use the markup colors in the server IC chatlog. + + + + + Sticky Sounds: + + + + + Turn this on to prevent the sound dropdown from clearing the sound after playing it. + + + + + Sticky Effects: + + + + + Turn this on to prevent the effects dropdown from clearing the effect after playing it. - + + Sticky Preanims: + + + + + Turn this on to prevent preanimation checkbox from clearing after playing the emote. + + + + 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. Период между сигналами, заменяющими голос, по умолчанию. - + + Play a blip sound "once per every X symbols", where X is the blip rate. + + + + 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. + + If true, AO2 will stop the music for you when you or someone else does 'Objection!'. - + 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. Будучи производителем дела (ПД), вы можете войти в зону и заниматься её оркестровкой. @@ -522,40 +509,36 @@ Reason: Courtroom - + Password Пароль - + Spectator Наблюдатель - - + + Search Поиск - + Passworded Ограничен паролем - + Taken Занят - - Could not find %1 - - - + Generating chars: %1/%2 - Генерация персонажей: + Генерация персонажей: %1/%2 @@ -565,212 +548,440 @@ Reason: - + Showname Имя - + Message Сообщение - + Name Никнейм - + Pre Пред. - + Flip Разв. + Guard - Охрана + Охрана - - + + Additive + + + + + 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 Сервер + + + None + + + + + Hold It! + + + + + + + When this is turned on, your next in-character message will be a shout! + + + + + Objection! + + + + + Take That! + + + + + Toggle between server chat and global AO2 chat. + + + + + + + + This will display the animation in the viewport as soon as it is pressed. + + + + + Guilty! + + + + + Bring up the Character Select Screen and change your character. + + + + + Refresh the theme and update all of the ui elements to match. + + + + + Request the attention of the current server's moderator. + + + + + Allows you to change various aspects of the client. + + + An interface to help you announce a case (you have to be a CM first to be able to announce cases) + + + + + Switch between Areas and Music lists + + + + + Play a single-shot animation as defined by the emote when checked. + + + + + If preanim is checked, display the input text immediately as the animation plays concurrently. + + + + + Mirror your character's emotes when checked. + + + + + Add text to your last spoken message when checked. + + + + + Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window. + + + + + Lets you receive case alerts when enabled. +(You can set your preferences in the Settings!) + + + + + Display customized shownames for all users when checked. + + + + + Custom Shout! + + + + + This will display the custom character-defined animation in the viewport as soon as it is pressed. +To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect + + + + + Play realization sound and animation in the viewport on the next spoken message when checked. + + + + + Shake the screen on next spoken message when checked. + + + + + Display the list of character folders you wish to mute. + + + + + + Increase the health bar. + + + + + + Decrease the health bar. + + + + + Change the text color of the spoken message. +You can also select a part of your currently typed message and use the dropdown to change its color! + + + + Back to Lobby Назад в лобби - - Rainbow - Радужный + + + + has played a song + - - OOC Message + + You will now pair up with %1 if they also choose your character in return. - - Disable Modcalls - + Rainbow + Радужный - Pink - Розовый + Розовый - Cyan - Голубой + Голубой - + % offset % сдвига - + + To front + + + + + To behind + + + + + Select a character you wish to pair with. + + + + + Change the percentage offset of your character's position from the center of the screen. + + + + + Change the order of appearance for your character. + + + + + Display the list of characters to pair with. + + + + + Oops, you're muted! + + + + + Set your character's emote to play on your next message. + + + + + Set your character's supplementary background. + + + + + Set an 'iniswap', or an alternative character folder to refer to from your current character. +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/iniswaps.ini + + + + + + Remove the currently selected iniswap from the list and return to the original character folder. + + + + + Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any). +Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/soundlist.ini + + + + + Choose an effect to play on your next spoken message. +The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by +char.ini [Options] category, effects = 'miscname' where it referes to misc/<miscname>/effects.ini to read the effects. + + + + Music Музыка - + Sfx Звук. эффекты - + Blips Сигналы - - Log limit - - - - + Change character - + Reload theme - + Call mod - + Settings Настройки - + A/M - + Preanim - - + + Return back to the server list. + + + + + Become a spectator. You won't be able to interact with the in-character screen. + + + + You were granted the Disable Modcalls button. - - You have been banned. + + + CLIENT - - Too many arguments to save a case! You only need a filename without extension and the courtroom status. + + You have been banned. @@ -778,150 +989,320 @@ Cases you can load: %1 Теперь у вас есть кнопка "Охрана". - + 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. Введите имя файла без расширения. - + + + + + UNKNOWN + + + + 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 Мастер - + + Expand All Categories + + + + + Collapse All Categories + + + + + Fade Out Previous + + + + + Fade In + + + + + Synchronize + + + + + Default + + + + Reason: Причина: - + Call Moderator Позвать модератора - - + + Error Ошибка - + You must provide a reason. Укажите причину. - + The message is too long. Слишком длинный текст. - Choose... - Выбрать... + Выбрать... + + + + Present this piece of evidence to everyone on your next spoken message + + + + + Save evidence to an .ini file. + + + + + Load evidence from an .ini file. + + + + + Destroy this piece of evidence + + + + + Choose.. + + + + + Close the evidence display/editing overlay. +You will be prompted if there's any unsaved changes. + + + + + Save any changes made to this piece of evidence and send them to server. + + + + + Double-click to edit. Press [X] to update your changes. + + + + + Bring up the Evidence screen. + - + + Switch evidence to private inventory. + + + + + Switch evidence to global inventory. + + + + + + Transfer evidence to private inventory. + + + + + + Transfer evidence to global inventory. + + + + + The piece of evidence you've been editing has changed. + + + + + Do you wish to keep your changes? + + + + + Name: %1 +Image: %2 +Description: +%3 + + + + Images (*.png) Изображения (*.png) - + + + + Double-click to edit... + + + + Add new evidence... Добавить новую улику... + + + Evidence has been modified. + + + + + Do you want to save your changes? + + + + + Current evidence is global. Click to switch to private. + + + + + Current evidence is private. Click to switch to global. + + + + + "%1" has been transferred. + + + + + Save Inventory + + + + + + Ini Files (*.ini) + + + + + Open Inventory + + Lobby @@ -931,35 +1312,55 @@ Cases you can load: %1 Attorney Online 2 - + + Search + Поиск + + + 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? Не похоже, что ваш клиент установлен правильно. Скачали ли вы все ресурсы (tiny.cc/getao), включая огромную папку `base`? - + Version: %1 Версия: %1 - + + Settings + Настройки + + + + Allows you to change various aspects of the client. + + + + 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, 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>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! + + + + + About @@ -967,17 +1368,32 @@ Did you download all resources correctly from tiny.cc/getao, including the large <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 Вне сети + + chatlogpiece + + + + + UNKNOWN + + + + + has played a song: + + + debug_functions @@ -991,7 +1407,7 @@ Did you download all resources correctly from tiny.cc/getao, including the large Ошибка - + Notice На заметку -- cgit From 9f526c6ecfdc46b6fc424cbb4dcf8b1c96639153 Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 20:57:06 +0200 Subject: update german translation --- resource/translations/ao_de.ts | 98 +++++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/resource/translations/ao_de.ts b/resource/translations/ao_de.ts index b4090bfe..8b1aa844 100644 --- a/resource/translations/ao_de.ts +++ b/resource/translations/ao_de.ts @@ -315,77 +315,77 @@ Grund: - Keep current setting - + - aktuelle Einstellung behalten Allow Screenshake: - + Schütteln erlauben: Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. - + Erlaubt schütteln des Bildschirms. Deaktiviere dies falls du Bedenken wegen Photosensitivität hast. Allow Effects: - + Effekte erlauben: Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. - + Erlaubt Bildeffekte. Deaktiviere dies falls du Bedenken wegen Photosensitivität hast. Network Frame Effects: - + Netzwerk Frame-Effekte: Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. - + Sendet schüttel, Blitze und Geräusche aus der char.ini Datei über das Netzwerk. Funkioniert nur wenn der Server dies unterstützt. Colors in IC Log: - + Farben im IC Log: Use the markup colors in the server IC chatlog. - + Verwendet Farbe im IC Log so wie im Bild. Sticky Sounds: - + Klebende Geräuschauswahl: Turn this on to prevent the sound dropdown from clearing the sound after playing it. - + Aktiviere dies damit die Geräuschauswahl nicht zurückspringt nachdem es abgespielt wurde. Sticky Effects: - + Klebende Effekt: Turn this on to prevent the effects dropdown from clearing the effect after playing it. - + Aktiviere dies damit die Effektauswahl nicht zurückspringt nachdem er abgespielt wurde. Sticky Preanims: - + Klebende Voranimation: Turn this on to prevent preanimation checkbox from clearing after playing the emote. - + Aktiviere dies damit das Kontrollkästchen für die Voranimation nicht zurückspringt nachdem sie abgespielt wurde. @@ -455,7 +455,7 @@ Grund: Play a blip sound "once per every X symbols", where X is the blip rate. - + Spiele ein blip einmal für all X Buchstaben. @@ -485,7 +485,7 @@ Grund: If true, AO2 will stop the music for you when you or someone else does 'Objection!'. - + Hält die Musik an wenn jemand "Einspruch" ruft, wie im echten Spiel. If true, the game will stop music when someone objects, like in the actual games. @@ -846,57 +846,57 @@ Grund: None - + Keine Additive - + Hinzufügend To front - + Vorne To behind - + Hinten Select a character you wish to pair with. - + Wähle einen Charakter mit dem du gepaart sein möchtest. Change the percentage offset of your character's position from the center of the screen. - + Ändere den Abstand des Charakters zur Mitte. Change the order of appearance for your character. - + Ändere die Reihenfolge in der die Charaktere erscheinen. Display the list of characters to pair with. - + Zeigt die Liste der paarbaren Charaktere. Oops, you're muted! - + Ohje, du bist stumm! Set your character's emote to play on your next message. - + Setzt den Ausdruck für die nächste Nachricht. Set your character's supplementary background. - + Setzt die Position des Charakters. @@ -926,29 +926,29 @@ char.ini [Options] category, effects = 'miscname' where it referes to Hold It! - + Moment mal! When this is turned on, your next in-character message will be a shout! - + Wenn dies an ist, wird die Nächste Nachricht ein Zuruf! Objection! - Einspruch! + Einspruch! Take That! - + Nimm das! Toggle between server chat and global AO2 chat. - + Wechselt zwischen Serverchat und AO2 Chat. @@ -961,7 +961,7 @@ char.ini [Options] category, effects = 'miscname' where it referes to Guilty! - + Schuldig! @@ -1087,14 +1087,14 @@ You can also select a part of your currently typed message and use the dropdown CLIENT - + CLIENT has played a song - + spielte ein Lied @@ -1184,7 +1184,7 @@ Verfügbare Fälle: %1 UNKNOWN - + UNBEKANNT @@ -1250,12 +1250,12 @@ Verfügbare Fälle: Expand All Categories - + Alle Kategorien erweitern Collapse All Categories - + Alle Kategorien verstecken @@ -1275,7 +1275,7 @@ Verfügbare Fälle: Default - + Standard @@ -1444,12 +1444,12 @@ Description: Ini Files (*.ini) - + Ini Dateien (*.ini) Open Inventory - + Inventar öffnen @@ -1489,7 +1489,7 @@ Description: Search - Suche + Suche @@ -1511,12 +1511,12 @@ Hast du ALLES von tiny.cc/getao heruntergeladen und entpackt, auch den großen & Settings - Einstellungen + Einstellungen Allows you to change various aspects of the client. - + Erlaubt es verschiedene Aspekte des Clients zu ändern. @@ -1531,12 +1531,12 @@ 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<p><b>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! - + <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>Version 2.8 Entwicklung:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Qualitätskontrolle:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Danksagungen:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, die AO2 Community, Serverbetreiber, Gamemaster, Fallersteller, Inhaltersteller und Spieler! About - + Über <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 @@ -1605,12 +1605,12 @@ Cronnicossy UNKNOWN - + UNBEKANNT has played a song: - + hat ein Lied gespielt: -- cgit From 4c45e45257c6681562de3a3157d7c29975456e2d Mon Sep 17 00:00:00 2001 From: sD Date: Sat, 23 May 2020 21:01:43 +0200 Subject: include the translations with the client or they can't get loaded --- resources.qrc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources.qrc b/resources.qrc index 974f797c..cca23ef6 100644 --- a/resources.qrc +++ b/resources.qrc @@ -2,5 +2,12 @@ resource/fonts/Ace-Attorney.ttf resource/logo_ao2.png + resource/translations/ao_de.qm + resource/translations/ao_en.qm + resource/translations/ao_es.qm + resource/translations/ao_jp.qm + resource/translations/ao_pl.qm + resource/translations/ao_pt.qm + resource/translations/ao_ru.qm -- cgit From a8035542bd379c8f27087895d126361de22c19b2 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sun, 31 May 2020 17:05:55 -0500 Subject: Bring back AO themes submodule --- .gitmodules | 3 + base/themes | 1 + base/themes/default/about.png | Bin 3298 -> 0 bytes base/themes/default/addevidence.png | Bin 403 -> 0 bytes base/themes/default/addtofav.png | Bin 972 -> 0 bytes base/themes/default/addtofav_pressed.png | Bin 938 -> 0 bytes base/themes/default/arrow_left.png | Bin 396 -> 0 bytes base/themes/default/arrow_right.png | Bin 391 -> 0 bytes base/themes/default/char_passworded.png | Bin 1904 -> 0 bytes base/themes/default/char_selector.png | Bin 285 -> 0 bytes base/themes/default/char_taken.png | Bin 215 -> 0 bytes base/themes/default/charselect_background.png | Bin 5342 -> 0 bytes base/themes/default/chat.png | Bin 590 -> 0 bytes base/themes/default/chatbig.png | Bin 584 -> 0 bytes base/themes/default/chatmed.png | Bin 579 -> 0 bytes base/themes/default/connect.png | Bin 914 -> 0 bytes base/themes/default/connect_pressed.png | Bin 925 -> 0 bytes base/themes/default/courtroom_design.ini | 302 ------------------------- base/themes/default/courtroom_fonts.ini | 56 ----- base/themes/default/courtroom_sounds.ini | 8 - base/themes/default/courtroombackground.png | Bin 50139 -> 0 bytes base/themes/default/crossexamination.gif | Bin 88834 -> 0 bytes base/themes/default/crossexamination.png | Bin 4187 -> 0 bytes base/themes/default/custom.png | Bin 2505 -> 0 bytes base/themes/default/custom_selected.png | Bin 2212 -> 0 bytes base/themes/default/defense_speedlines.gif | Bin 31308 -> 0 bytes base/themes/default/defensebar0.png | Bin 171 -> 0 bytes base/themes/default/defensebar1.png | Bin 188 -> 0 bytes base/themes/default/defensebar10.png | Bin 184 -> 0 bytes base/themes/default/defensebar2.png | Bin 187 -> 0 bytes base/themes/default/defensebar3.png | Bin 187 -> 0 bytes base/themes/default/defensebar4.png | Bin 188 -> 0 bytes base/themes/default/defensebar5.png | Bin 188 -> 0 bytes base/themes/default/defensebar6.png | Bin 188 -> 0 bytes base/themes/default/defensebar7.png | Bin 187 -> 0 bytes base/themes/default/defensebar8.png | Bin 188 -> 0 bytes base/themes/default/defensebar9.png | Bin 188 -> 0 bytes base/themes/default/defminus.png | Bin 492 -> 0 bytes base/themes/default/defplus.png | Bin 498 -> 0 bytes base/themes/default/deleteevidence.png | Bin 3280 -> 0 bytes base/themes/default/emote_selected.png | Bin 249 -> 0 bytes base/themes/default/evidence_appear_left.gif | Bin 2008 -> 0 bytes base/themes/default/evidence_appear_right.gif | Bin 2225 -> 0 bytes base/themes/default/evidence_selected.png | Bin 291 -> 0 bytes base/themes/default/evidence_selector.png | Bin 931 -> 0 bytes base/themes/default/evidencebackground.png | Bin 19927 -> 0 bytes base/themes/default/evidencebutton.png | Bin 577 -> 0 bytes base/themes/default/evidenceoverlay.png | Bin 2187 -> 0 bytes base/themes/default/evidencex.png | Bin 637 -> 0 bytes base/themes/default/favorites.png | Bin 3882 -> 0 bytes base/themes/default/favorites_selected.png | Bin 4306 -> 0 bytes base/themes/default/guilty.gif | Bin 43263 -> 0 bytes base/themes/default/guilty.png | Bin 2851 -> 0 bytes base/themes/default/holdit.png | Bin 1983 -> 0 bytes base/themes/default/holdit_selected.png | Bin 1835 -> 0 bytes base/themes/default/loadingbackground.png | Bin 2194 -> 0 bytes base/themes/default/lobby_design.ini | 17 -- base/themes/default/lobbybackground.png | Bin 29532 -> 0 bytes base/themes/default/mute.png | Bin 5037 -> 0 bytes base/themes/default/mute_pressed.png | Bin 4978 -> 0 bytes base/themes/default/muted.png | Bin 1013 -> 0 bytes base/themes/default/notguilty.gif | Bin 34911 -> 0 bytes base/themes/default/notguilty.png | Bin 3269 -> 0 bytes base/themes/default/objection.png | Bin 2147 -> 0 bytes base/themes/default/objection_selected.png | Bin 1988 -> 0 bytes base/themes/default/pair_button.png | Bin 4677 -> 0 bytes base/themes/default/pair_button_pressed.png | Bin 4619 -> 0 bytes base/themes/default/placeholder.gif | Bin 9168 -> 0 bytes base/themes/default/present.png | Bin 3035 -> 0 bytes base/themes/default/present_disabled.png | Bin 2905 -> 0 bytes base/themes/default/prominus.png | Bin 493 -> 0 bytes base/themes/default/proplus.png | Bin 498 -> 0 bytes base/themes/default/prosecution_speedlines.gif | Bin 31252 -> 0 bytes base/themes/default/prosecutionbar0.png | Bin 200 -> 0 bytes base/themes/default/prosecutionbar1.png | Bin 237 -> 0 bytes base/themes/default/prosecutionbar10.png | Bin 173 -> 0 bytes base/themes/default/prosecutionbar2.png | Bin 241 -> 0 bytes base/themes/default/prosecutionbar3.png | Bin 230 -> 0 bytes base/themes/default/prosecutionbar4.png | Bin 243 -> 0 bytes base/themes/default/prosecutionbar5.png | Bin 241 -> 0 bytes base/themes/default/prosecutionbar6.png | Bin 241 -> 0 bytes base/themes/default/prosecutionbar7.png | Bin 242 -> 0 bytes base/themes/default/prosecutionbar8.png | Bin 240 -> 0 bytes base/themes/default/prosecutionbar9.png | Bin 237 -> 0 bytes base/themes/default/publicservers.png | Bin 3999 -> 0 bytes base/themes/default/publicservers_selected.png | Bin 4427 -> 0 bytes base/themes/default/realization.png | Bin 4259 -> 0 bytes base/themes/default/realization_pressed.png | Bin 4225 -> 0 bytes base/themes/default/realizationflash.png | Bin 646 -> 0 bytes base/themes/default/refresh.png | Bin 914 -> 0 bytes base/themes/default/refresh_pressed.png | Bin 919 -> 0 bytes base/themes/default/takethat.png | Bin 2057 -> 0 bytes base/themes/default/takethat_selected.png | Bin 1932 -> 0 bytes base/themes/default/testimony.gif | Bin 1033 -> 0 bytes base/themes/default/testimony.png | Bin 579 -> 0 bytes base/themes/default/witnesstestimony.gif | Bin 105223 -> 0 bytes base/themes/default/witnesstestimony.png | Bin 5186 -> 0 bytes 97 files changed, 4 insertions(+), 383 deletions(-) create mode 100644 .gitmodules create mode 160000 base/themes delete mode 100644 base/themes/default/about.png delete mode 100644 base/themes/default/addevidence.png delete mode 100644 base/themes/default/addtofav.png delete mode 100644 base/themes/default/addtofav_pressed.png delete mode 100644 base/themes/default/arrow_left.png delete mode 100644 base/themes/default/arrow_right.png delete mode 100644 base/themes/default/char_passworded.png delete mode 100644 base/themes/default/char_selector.png delete mode 100644 base/themes/default/char_taken.png delete mode 100644 base/themes/default/charselect_background.png delete mode 100644 base/themes/default/chat.png delete mode 100644 base/themes/default/chatbig.png delete mode 100644 base/themes/default/chatmed.png delete mode 100644 base/themes/default/connect.png delete mode 100644 base/themes/default/connect_pressed.png delete mode 100644 base/themes/default/courtroom_design.ini delete mode 100644 base/themes/default/courtroom_fonts.ini delete mode 100644 base/themes/default/courtroom_sounds.ini delete mode 100644 base/themes/default/courtroombackground.png delete mode 100644 base/themes/default/crossexamination.gif delete mode 100644 base/themes/default/crossexamination.png delete mode 100644 base/themes/default/custom.png delete mode 100644 base/themes/default/custom_selected.png delete mode 100644 base/themes/default/defense_speedlines.gif delete mode 100644 base/themes/default/defensebar0.png delete mode 100644 base/themes/default/defensebar1.png delete mode 100644 base/themes/default/defensebar10.png delete mode 100644 base/themes/default/defensebar2.png delete mode 100644 base/themes/default/defensebar3.png delete mode 100644 base/themes/default/defensebar4.png delete mode 100644 base/themes/default/defensebar5.png delete mode 100644 base/themes/default/defensebar6.png delete mode 100644 base/themes/default/defensebar7.png delete mode 100644 base/themes/default/defensebar8.png delete mode 100644 base/themes/default/defensebar9.png delete mode 100644 base/themes/default/defminus.png delete mode 100644 base/themes/default/defplus.png delete mode 100644 base/themes/default/deleteevidence.png delete mode 100644 base/themes/default/emote_selected.png delete mode 100644 base/themes/default/evidence_appear_left.gif delete mode 100644 base/themes/default/evidence_appear_right.gif delete mode 100644 base/themes/default/evidence_selected.png delete mode 100644 base/themes/default/evidence_selector.png delete mode 100644 base/themes/default/evidencebackground.png delete mode 100644 base/themes/default/evidencebutton.png delete mode 100644 base/themes/default/evidenceoverlay.png delete mode 100644 base/themes/default/evidencex.png delete mode 100644 base/themes/default/favorites.png delete mode 100644 base/themes/default/favorites_selected.png delete mode 100644 base/themes/default/guilty.gif delete mode 100644 base/themes/default/guilty.png delete mode 100644 base/themes/default/holdit.png delete mode 100644 base/themes/default/holdit_selected.png delete mode 100644 base/themes/default/loadingbackground.png delete mode 100644 base/themes/default/lobby_design.ini delete mode 100644 base/themes/default/lobbybackground.png delete mode 100644 base/themes/default/mute.png delete mode 100644 base/themes/default/mute_pressed.png delete mode 100644 base/themes/default/muted.png delete mode 100644 base/themes/default/notguilty.gif delete mode 100644 base/themes/default/notguilty.png delete mode 100644 base/themes/default/objection.png delete mode 100644 base/themes/default/objection_selected.png delete mode 100644 base/themes/default/pair_button.png delete mode 100644 base/themes/default/pair_button_pressed.png delete mode 100644 base/themes/default/placeholder.gif delete mode 100644 base/themes/default/present.png delete mode 100644 base/themes/default/present_disabled.png delete mode 100644 base/themes/default/prominus.png delete mode 100644 base/themes/default/proplus.png delete mode 100644 base/themes/default/prosecution_speedlines.gif delete mode 100644 base/themes/default/prosecutionbar0.png delete mode 100644 base/themes/default/prosecutionbar1.png delete mode 100644 base/themes/default/prosecutionbar10.png delete mode 100644 base/themes/default/prosecutionbar2.png delete mode 100644 base/themes/default/prosecutionbar3.png delete mode 100644 base/themes/default/prosecutionbar4.png delete mode 100644 base/themes/default/prosecutionbar5.png delete mode 100644 base/themes/default/prosecutionbar6.png delete mode 100644 base/themes/default/prosecutionbar7.png delete mode 100644 base/themes/default/prosecutionbar8.png delete mode 100644 base/themes/default/prosecutionbar9.png delete mode 100644 base/themes/default/publicservers.png delete mode 100644 base/themes/default/publicservers_selected.png delete mode 100644 base/themes/default/realization.png delete mode 100644 base/themes/default/realization_pressed.png delete mode 100644 base/themes/default/realizationflash.png delete mode 100644 base/themes/default/refresh.png delete mode 100644 base/themes/default/refresh_pressed.png delete mode 100644 base/themes/default/takethat.png delete mode 100644 base/themes/default/takethat_selected.png delete mode 100644 base/themes/default/testimony.gif delete mode 100644 base/themes/default/testimony.png delete mode 100644 base/themes/default/witnesstestimony.gif delete mode 100644 base/themes/default/witnesstestimony.png diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..1376cc16 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "base/themes"] + path = base/themes + url = https://github.com/AttorneyOnline/AO2-Themes diff --git a/base/themes b/base/themes new file mode 160000 index 00000000..620915d8 --- /dev/null +++ b/base/themes @@ -0,0 +1 @@ +Subproject commit 620915d85afdeb51bb3bd7766d5807bbdc6fa876 diff --git a/base/themes/default/about.png b/base/themes/default/about.png deleted file mode 100644 index 50fc8213..00000000 Binary files a/base/themes/default/about.png and /dev/null differ diff --git a/base/themes/default/addevidence.png b/base/themes/default/addevidence.png deleted file mode 100644 index 7a432af2..00000000 Binary files a/base/themes/default/addevidence.png and /dev/null differ diff --git a/base/themes/default/addtofav.png b/base/themes/default/addtofav.png deleted file mode 100644 index 7d989034..00000000 Binary files a/base/themes/default/addtofav.png and /dev/null differ diff --git a/base/themes/default/addtofav_pressed.png b/base/themes/default/addtofav_pressed.png deleted file mode 100644 index 7b62d52d..00000000 Binary files a/base/themes/default/addtofav_pressed.png and /dev/null differ diff --git a/base/themes/default/arrow_left.png b/base/themes/default/arrow_left.png deleted file mode 100644 index 7ed9c05d..00000000 Binary files a/base/themes/default/arrow_left.png and /dev/null differ diff --git a/base/themes/default/arrow_right.png b/base/themes/default/arrow_right.png deleted file mode 100644 index 5acc3285..00000000 Binary files a/base/themes/default/arrow_right.png and /dev/null differ diff --git a/base/themes/default/char_passworded.png b/base/themes/default/char_passworded.png deleted file mode 100644 index e79d0710..00000000 Binary files a/base/themes/default/char_passworded.png and /dev/null differ diff --git a/base/themes/default/char_selector.png b/base/themes/default/char_selector.png deleted file mode 100644 index e868cdb9..00000000 Binary files a/base/themes/default/char_selector.png and /dev/null differ diff --git a/base/themes/default/char_taken.png b/base/themes/default/char_taken.png deleted file mode 100644 index efad48dc..00000000 Binary files a/base/themes/default/char_taken.png and /dev/null differ diff --git a/base/themes/default/charselect_background.png b/base/themes/default/charselect_background.png deleted file mode 100644 index 4480e6f4..00000000 Binary files a/base/themes/default/charselect_background.png and /dev/null differ diff --git a/base/themes/default/chat.png b/base/themes/default/chat.png deleted file mode 100644 index 47281a96..00000000 Binary files a/base/themes/default/chat.png and /dev/null differ diff --git a/base/themes/default/chatbig.png b/base/themes/default/chatbig.png deleted file mode 100644 index ee8d9ce2..00000000 Binary files a/base/themes/default/chatbig.png and /dev/null differ diff --git a/base/themes/default/chatmed.png b/base/themes/default/chatmed.png deleted file mode 100644 index 9c6f87fc..00000000 Binary files a/base/themes/default/chatmed.png and /dev/null differ diff --git a/base/themes/default/connect.png b/base/themes/default/connect.png deleted file mode 100644 index 6a41e86f..00000000 Binary files a/base/themes/default/connect.png and /dev/null differ diff --git a/base/themes/default/connect_pressed.png b/base/themes/default/connect_pressed.png deleted file mode 100644 index a99d9ec1..00000000 Binary files a/base/themes/default/connect_pressed.png and /dev/null differ diff --git a/base/themes/default/courtroom_design.ini b/base/themes/default/courtroom_design.ini deleted file mode 100644 index 3779475f..00000000 --- a/base/themes/default/courtroom_design.ini +++ /dev/null @@ -1,302 +0,0 @@ -; Client size. Changing it to something other than 714, 668 will stretch or -; compress courtroombackground.png accordingly. -courtroom = 0, 0, 714, 668 - -; **COORDINATE SYSTEM RELATIVE TO "courtroom"** -; x/y coordinates 0,0 will start at top-left of the "courtroom" for everything below until specified otherwise. -; **** - -; IC Area. Changing 256, 192 will stretch or compress character gifs and the -; /bgs being used accordingly -viewport = 0, 0, 256, 192 - -; IC chatlog -ic_chatlog = 260, 0, 231, 319 - -; Master server chatlog -ms_chatlog = 490, 1, 224, 277 - -; OOC Chatlog -server_chatlog = 490, 1, 224, 277 - -; Where you type to make an OOC chat message -; NOTE: THIS DOES NOT HAVE ANY VISUAL APPEARANCE -ooc_chat_message = 492, 281, 222, 19 - -; Where you enter your OOC name, and also where it shows up -ooc_chat_name = 492, 300, 85, 19 - -; Toggle between Server and Master OOC chats -ooc_toggle = 580, 300, 133, 19 - -; The scrolling music name display -music_display = 490, 0, 224, 26 -; WARNING: music_name x/y coordinates relative to music_display! -music_name = 0, 0, 224, 26 - -; Where the jukebox is -music_list = 490, 342, 224, 326 - -; Jukebox search bar -music_search = 490, 319, 100, 23 - -; Music list state colors -found_song_color = 144, 238, 144 -missing_song_color = 255, 125, 125 - -; Labels and sliders for music/sfx/blips -music_label = 282, 607, 41, 16 -sfx_label = 282, 627, 41, 16 -blip_label = 282, 647, 41, 16 -music_slider = 326, 608, 140, 16 -sfx_slider = 326, 628, 140, 16 -blip_slider = 326, 648, 140, 16 - -; Emote buttons - [490, 98] determines how many columns and rows of buttons are -; displayed per page. 49, 49 is the ABSOLUTE MINIMUM, and displays 1 button per -; page. Having either number lower than 49 crashes the client when you try to -; pick a character. If you want X columns and Y rows, you would change it to -; 49X, 49Y (ie. 490, 147 if you want 10 columns and 3 rows) -emotes = 5, 342, 490, 98 -emote_button_spacing = 9, 9 -emote_button_size = 40, 40 - -; Page togglers for emotes -emote_left = 5, 434, 60, 32 -emote_right = 428, 434, 60, 32 - -; Emote dropdown/emote names - Change '125' to make it longer/shorter and -; display the full emote name or truncate it based on length -emote_dropdown = 5, 470, 105, 20 - -; Display the accessible iniswaps on this character (grabbed from iniswaps.ini) -iniswap_dropdown = 100, 442, 89, 20 -; The button to remove the current iniswap -iniswap_remove = 78, 442, 20, 20 - -; Display the accessible sfx on this character (grabbed from soundlist.ini). If none found, courtroom_soundlist.ini will be used. -sfx_dropdown = 220, 442, 89, 20 -; The button to remove the current iniswap -sfx_remove = 198, 442, 20, 20 - -; Display the list of overlay effects accessible -effects_dropdown = 330, 441, 89, 22 - -; The size of the icons for dropdown entries -effects_icon_size = 16, 16 - -; Hold it/Take That/Objection and the "BLING!" buttons -hold_it = 10, 310, 76, 28 -objection = 90, 310, 76, 28 -take_that = 170, 310, 76, 28 -realization = 5, 515, 42, 42 - -; If the server supports it (AOV does not currently) - if a character has a -; custom.gif and custom.wav in their folder, this button acts as another -; Objection/Take That/Hold It for that character that uses the custom animation -; and sfx. (Think Satorah! Such Insolence!, Gotcha!) -custom_objection = 250, 310, 76, 28 - -; Text color dropdown menu -text_color = 115, 470, 80, 20 - -pos_dropdown = 200, 470, 80, 20 - -; Preanimation toggle -pre = 5, 490, 80, 21 - -; Flip button -flip = 64, 490, 51, 21 - -; Additive button -Additive = 114, 490, 80, 21 - -; Guard button -guard = 200, 560, 61, 21 - -pre_no_interrupt = 200, 490, 80, 21 - -; Penalty bars and judge's buttons for penalizing. Other than the bars, these -; ONLY show up on a character with /pos jud -defense_bar = 5, 566, 187, 9 -prosecution_bar = 5, 582, 187, 9 -defense_plus = 183, 566, 9, 9 -defense_minus = 5, 566, 9, 9 -prosecution_plus = 183, 582, 9, 9 -prosecution_minus = 5, 582, 9, 9 - -; Judge's buttons for WT and CE. /pos jud -witness_testimony = 290, 470, 85, 42 -cross_examination = 290, 515, 85, 42 - -; Buttons to change character/Reload theme/Call Mod -change_character = 5, 610, 120, 23 -reload_theme = 5, 637, 94, 23 -call_mod = 104, 637, 64, 23 - -; Mute button -mute_button = 150, 515, 42, 42 - -; Screenshake -screenshake = 51, 515, 42, 42 - -; Where the Mute list pops up when you click Mute -mute_list = 280, 469, 210, 198 - -; Character select widgets -char_select = 0, 0, 714, 668 -back_to_lobby = 5, 5, 91, 23 -char_password = 297, 7, 120, 22 -char_buttons = 25, 36, 663, 596 -char_button_spacing = 7, 7 -char_select_left = 100, 5, 43, 24 -char_select_right = 146, 5, 43, 24 -spectator = 317, 640, 80, 23 - -; ------------------------- -; New in 2.6.0 -; ------------------------- - -; This is an input field that allows you to change your in-character showname. -ic_chat_name = 200, 534, 78, 23 - -; I am sure there are some differences between the 'ao2_' versions and the -; 'ao2_'-less versions of the IC text display and input, but I do not know -; what. Still, here you go! -ao2_ic_chat_name = 200, 534, 78, 23 - -; An in-game tickbox that allows you to set whether your client should show -; custom shownames where possible, or always keep to character names. -; This is useful if you suspect someone is impersonating others, for example, -; and they are using this in combination with ini-swapping to 'duplicate' a -; character. -showname_enable = 200, 510, 80, 21 - -; A simple button that opens up the settings menu. -; Equivalent to typing /settings in the OOC chat. -settings = 130, 610, 60, 23 - -; The character search text input in the character selecton screen. -; The moment you enter some text, it immediately starts filtering. -char_search = 420, 7, 120, 22 - -; A tickbox that filters based on if a character requires password to access or not. -; Note that this is actually only partially implemented in AO. -; The interface exists for it, but no way to actually password the characters. -char_passworded = 545, 7, 100, 22 - -; A tickbox that filters characters based on if they are taken. -char_taken = 635, 7, 80, 22 - -; These buttons are similar to the CE / WT buttons, except they show a -; Not Guilty or Guilty animation instead. -not_guilty = 380, 470, 85, 42 -guilty = 380, 515, 85, 42 - -; These are responsible for the pairing stuff. -; These work much like muting, actually. -pair_button = 104, 515, 42, 42 -pair_list = 280, 490, 210, 177 -pair_offset_spinbox = 280, 470, 210, 20 - -; This button allows switching between music and areas. -switch_area_music = 590, 319, 35, 23 - -; These are colours for the various statuses an area can be in. -area_free_color = 144, 238, 144 -area_lfp_color = 127, 255, 0 -area_casing_color = 255, 215, 0 -area_recess_color = 255, 246, 143 -area_rp_color = 135, 206, 255 -area_gaming_color = 171, 130, 255 -area_locked_color = 165, 43, 43 - -; These two are casing-related inputs. -; "casing" is a tickbox that toggles whether you should receive case alerts or -; not (you can set your preferences, and its default value, in the Settings!) -; "casing_button" is an interface to help you announce a case (you have to be -; a CM first to be able to announce cases). -casing = 200, 560, 80, 21 -casing_button = 173, 637, 60, 23 - -; -; Chat system -; - -; IC chatbox -chatbox = 0, 178, 256, 104 - -; IC chatbox if the current background's folder contains stand.png, -; defensedesk.png and prosecutiondesk.png -ao2_chatbox = 0, 178, 256, 104 - -; **COORDINATE SYSTEM RELATIVE TO "chatbox"/"ao2_chatbox"** -; x/y coordinates 0,0 will start at top-left of the "chatbox"/"ao2_chatbox" for everything below until specified otherwise. -; **** - -; Textbox for custom IC name (the "showname"), width is the smallest size -showname = 1, 0, 46, 15 - -; The chatbox image used for smallest possible size is "chat". "chatblank" is used if the showname is whitespace-only. -; "chatmed" will be used if the showname size exceeds the width, at which point the showname will receive showname_extra_width. -; "chatbig" will be used if the showname size exceeds the "chatmed" width, at which point the showname will receive showname_extra_width again. -; Text any bigger than that will be cut off. If "chatmed" or "chatbig" are missing, showname will not be resized. -showname_extra_width = 24 - -; IC message, positioned within the chatbox. Changing 250 affects how -; long text goes on before going onto the next line. Changing 89 affects -; how many lines you can see before the message starts scrolling, based on -; Every line height is 25 if the font size is 10 and the Sans font is used. -; There's 4 pixels from X position until the symbol is displayed. -; the formula of n = 25+(n-1)*16, where n is the number of lines to be -; displayed. (ie, set it to 25 for 1 line, 41 for 2, 57 for 3, 73 for 4, -; 89 for 5, 105 for 6... Less than 25 displays nothing) -message = 10, 12, 242, 89 - -; A chat indicator alerting us the chat ticker isn't active (text is no longer being processed). -chat_arrow = 245, 84, 11, 9 - -; Where you type to make an IC chat message -ic_chat_message = 2, 283, 250, 23 - -; IC chat message if the current background's folder contains stand.png, -; defensedesk.png and prosecutiondesk.png -ao2_ic_chat_message = 2, 283, 250, 23 - -; -; Evidence system -; - -; **COORDINATE SYSTEM RELATIVE TO "viewport"** -; x/y coordinates 0,0 will start at top-left of the "viewport" for everything below until specified otherwise. -; **** -left_evidence_icon = 13, 13, 70, 70 -right_evidence_icon = 173, 13, 70, 70 - -; **COORDINATE SYSTEM RELATIVE TO "courtroom"** -; x/y coordinates 0,0 will start at top-left of the "courtroom" for everything below until specified otherwise. -; **** - -evidence_background = 0, 385, 490, 284 -; **COORDINATE SYSTEM RELATIVE TO "evidence_background"** -; x/y coordinates 0,0 will start at top-left of the "evidence_background" for everything below until specified otherwise. -; **** -evidence_buttons = 28, 27, 430, 216 -evidence_button_spacing = 2, 3 -evidence_button_size = 70, 70 -evidence_left = 28, 0, 60, 24 -evidence_right = 400, 0, 60, 24 -evidence_present = 165, 247, 158, 41 - -evidence_overlay = 24, 24, 439, 222 -; **COORDINATE SYSTEM RELATIVE TO "evidence_overlay"** -; x/y coordinates 0,0 will start at top-left of the "evidence_overlay" (which is parented to "evidence_background") for everything below until specified otherwise. -; **** -evidence_delete = 78, 8, 70, 20 -evidence_image_name = 150, 8, 109, 20 -evidence_image_button = 259, 8, 60, 20 -evidence_x = 341, 8, 20, 20 -evidence_ok = 320, 8, 20, 20 -evidence_button = 627, 322, 85, 18 -evidence_name = 112, 4, 264, 19 -evidence_description = 78, 28, 281, 166 \ No newline at end of file diff --git a/base/themes/default/courtroom_fonts.ini b/base/themes/default/courtroom_fonts.ini deleted file mode 100644 index 1fcba764..00000000 --- a/base/themes/default/courtroom_fonts.ini +++ /dev/null @@ -1,56 +0,0 @@ -showname = 8 -showname_font = Sans -showname_color = 255, 255, 255 -showname_bold = 0 - -message = 10 -message_font = Sans -message_color = 0, 0, 0 -message_bold = 0 - -ic_chatlog = 10 -ic_chatlog_font = Sans -ic_chatlog_color = 255, 255, 255 -ic_chatlog_bold = 0 - -ms_chatlog = 8 -ms_chatlog_font = Sans -ms_chatlog_color = 0, 0, 0 -ms_chatlog_sender_color = 0, 0, 95 -ms_chatlog_bold = 0 - -server_chatlog = 8 -server_chatlog_font = Sans -server_chatlog_color = 0, 0, 0 -server_chatlog_sender_color = 95, 95, 0 -server_chatlog_bold = 0 - -music_list = 8 -music_list_font = Sans -music_list_color = 0, 0, 0 -music_list_bold = 0 - -music_name = 8 -music_name_font = Sans -music_name_color = 255, 255, 255 -music_name_bold = 0 - -area_list = 8 -area_list_font = Sans -area_list_color = 0, 0, 0 -area_list_bold = 0 - -evidence_name = 14 -evidence_name_font = Arial -evidence_name_color = 255, 128, 0 -evidence_name_bold = 1 - -evidence_image_name = 8 -evidence_image_name_font = Arial -evidence_image_name_color = 0, 0, 0 -evidence_image_name_bold = 0 - -evidence_description = 10 -evidence_description_font = Times New Roman -evidence_description_color = 255, 255, 255 -evidence_description_bold = 0 \ No newline at end of file diff --git a/base/themes/default/courtroom_sounds.ini b/base/themes/default/courtroom_sounds.ini deleted file mode 100644 index b24e2ce9..00000000 --- a/base/themes/default/courtroom_sounds.ini +++ /dev/null @@ -1,8 +0,0 @@ -realization = sfx-realization.wav -witness_testimony = sfx-testimony2.wav -cross_examination = sfx-testimony.wav -evidence_present = sfx-evidenceshoop.wav -word_call = sfx-gaspen-yeah!.wav -mod_call = sfx-gallery.wav -not_guilty = sfx-notguilty.wav -guilty = sfx-guilty.wav \ No newline at end of file diff --git a/base/themes/default/courtroombackground.png b/base/themes/default/courtroombackground.png deleted file mode 100644 index f42797ca..00000000 Binary files a/base/themes/default/courtroombackground.png and /dev/null differ diff --git a/base/themes/default/crossexamination.gif b/base/themes/default/crossexamination.gif deleted file mode 100644 index a7754b60..00000000 Binary files a/base/themes/default/crossexamination.gif and /dev/null differ diff --git a/base/themes/default/crossexamination.png b/base/themes/default/crossexamination.png deleted file mode 100644 index 044a76b9..00000000 Binary files a/base/themes/default/crossexamination.png and /dev/null differ diff --git a/base/themes/default/custom.png b/base/themes/default/custom.png deleted file mode 100644 index b58d1620..00000000 Binary files a/base/themes/default/custom.png and /dev/null differ diff --git a/base/themes/default/custom_selected.png b/base/themes/default/custom_selected.png deleted file mode 100644 index d8dc5253..00000000 Binary files a/base/themes/default/custom_selected.png and /dev/null differ diff --git a/base/themes/default/defense_speedlines.gif b/base/themes/default/defense_speedlines.gif deleted file mode 100644 index 5b454e52..00000000 Binary files a/base/themes/default/defense_speedlines.gif and /dev/null differ diff --git a/base/themes/default/defensebar0.png b/base/themes/default/defensebar0.png deleted file mode 100644 index e15b7276..00000000 Binary files a/base/themes/default/defensebar0.png and /dev/null differ diff --git a/base/themes/default/defensebar1.png b/base/themes/default/defensebar1.png deleted file mode 100644 index ddc7c052..00000000 Binary files a/base/themes/default/defensebar1.png and /dev/null differ diff --git a/base/themes/default/defensebar10.png b/base/themes/default/defensebar10.png deleted file mode 100644 index 5c955b43..00000000 Binary files a/base/themes/default/defensebar10.png and /dev/null differ diff --git a/base/themes/default/defensebar2.png b/base/themes/default/defensebar2.png deleted file mode 100644 index 78835aab..00000000 Binary files a/base/themes/default/defensebar2.png and /dev/null differ diff --git a/base/themes/default/defensebar3.png b/base/themes/default/defensebar3.png deleted file mode 100644 index 8d8427af..00000000 Binary files a/base/themes/default/defensebar3.png and /dev/null differ diff --git a/base/themes/default/defensebar4.png b/base/themes/default/defensebar4.png deleted file mode 100644 index 04416833..00000000 Binary files a/base/themes/default/defensebar4.png and /dev/null differ diff --git a/base/themes/default/defensebar5.png b/base/themes/default/defensebar5.png deleted file mode 100644 index d9236c26..00000000 Binary files a/base/themes/default/defensebar5.png and /dev/null differ diff --git a/base/themes/default/defensebar6.png b/base/themes/default/defensebar6.png deleted file mode 100644 index 373bc1b0..00000000 Binary files a/base/themes/default/defensebar6.png and /dev/null differ diff --git a/base/themes/default/defensebar7.png b/base/themes/default/defensebar7.png deleted file mode 100644 index 09c8d1af..00000000 Binary files a/base/themes/default/defensebar7.png and /dev/null differ diff --git a/base/themes/default/defensebar8.png b/base/themes/default/defensebar8.png deleted file mode 100644 index 13a45480..00000000 Binary files a/base/themes/default/defensebar8.png and /dev/null differ diff --git a/base/themes/default/defensebar9.png b/base/themes/default/defensebar9.png deleted file mode 100644 index d98ab4d2..00000000 Binary files a/base/themes/default/defensebar9.png and /dev/null differ diff --git a/base/themes/default/defminus.png b/base/themes/default/defminus.png deleted file mode 100644 index 97093810..00000000 Binary files a/base/themes/default/defminus.png and /dev/null differ diff --git a/base/themes/default/defplus.png b/base/themes/default/defplus.png deleted file mode 100644 index a3adf510..00000000 Binary files a/base/themes/default/defplus.png and /dev/null differ diff --git a/base/themes/default/deleteevidence.png b/base/themes/default/deleteevidence.png deleted file mode 100644 index 396d9902..00000000 Binary files a/base/themes/default/deleteevidence.png and /dev/null differ diff --git a/base/themes/default/emote_selected.png b/base/themes/default/emote_selected.png deleted file mode 100644 index 377dd077..00000000 Binary files a/base/themes/default/emote_selected.png and /dev/null differ diff --git a/base/themes/default/evidence_appear_left.gif b/base/themes/default/evidence_appear_left.gif deleted file mode 100644 index 352a7f19..00000000 Binary files a/base/themes/default/evidence_appear_left.gif and /dev/null differ diff --git a/base/themes/default/evidence_appear_right.gif b/base/themes/default/evidence_appear_right.gif deleted file mode 100644 index bc45e528..00000000 Binary files a/base/themes/default/evidence_appear_right.gif and /dev/null differ diff --git a/base/themes/default/evidence_selected.png b/base/themes/default/evidence_selected.png deleted file mode 100644 index 6230c836..00000000 Binary files a/base/themes/default/evidence_selected.png and /dev/null differ diff --git a/base/themes/default/evidence_selector.png b/base/themes/default/evidence_selector.png deleted file mode 100644 index 266493dd..00000000 Binary files a/base/themes/default/evidence_selector.png and /dev/null differ diff --git a/base/themes/default/evidencebackground.png b/base/themes/default/evidencebackground.png deleted file mode 100644 index ca285326..00000000 Binary files a/base/themes/default/evidencebackground.png and /dev/null differ diff --git a/base/themes/default/evidencebutton.png b/base/themes/default/evidencebutton.png deleted file mode 100644 index 2c395ec0..00000000 Binary files a/base/themes/default/evidencebutton.png and /dev/null differ diff --git a/base/themes/default/evidenceoverlay.png b/base/themes/default/evidenceoverlay.png deleted file mode 100644 index d409cc58..00000000 Binary files a/base/themes/default/evidenceoverlay.png and /dev/null differ diff --git a/base/themes/default/evidencex.png b/base/themes/default/evidencex.png deleted file mode 100644 index 6a6be36f..00000000 Binary files a/base/themes/default/evidencex.png and /dev/null differ diff --git a/base/themes/default/favorites.png b/base/themes/default/favorites.png deleted file mode 100644 index 6fa31016..00000000 Binary files a/base/themes/default/favorites.png and /dev/null differ diff --git a/base/themes/default/favorites_selected.png b/base/themes/default/favorites_selected.png deleted file mode 100644 index 4c33d432..00000000 Binary files a/base/themes/default/favorites_selected.png and /dev/null differ diff --git a/base/themes/default/guilty.gif b/base/themes/default/guilty.gif deleted file mode 100644 index 3dd95d55..00000000 Binary files a/base/themes/default/guilty.gif and /dev/null differ diff --git a/base/themes/default/guilty.png b/base/themes/default/guilty.png deleted file mode 100644 index efe68f70..00000000 Binary files a/base/themes/default/guilty.png and /dev/null differ diff --git a/base/themes/default/holdit.png b/base/themes/default/holdit.png deleted file mode 100644 index 09d1d370..00000000 Binary files a/base/themes/default/holdit.png and /dev/null differ diff --git a/base/themes/default/holdit_selected.png b/base/themes/default/holdit_selected.png deleted file mode 100644 index 51586e74..00000000 Binary files a/base/themes/default/holdit_selected.png and /dev/null differ diff --git a/base/themes/default/loadingbackground.png b/base/themes/default/loadingbackground.png deleted file mode 100644 index 202a8813..00000000 Binary files a/base/themes/default/loadingbackground.png and /dev/null differ diff --git a/base/themes/default/lobby_design.ini b/base/themes/default/lobby_design.ini deleted file mode 100644 index ef64114f..00000000 --- a/base/themes/default/lobby_design.ini +++ /dev/null @@ -1,17 +0,0 @@ -lobby = 0, 0, 517, 666 -public_servers = 46, 88, 114, 30 -favorites = 164, 88, 114, 30 -refresh = 56, 381, 132, 28 -add_to_fav = 194, 381, 132, 28 -connect = 332, 381, 132, 28 -version = 170, 1, 300, 21 -about = 428, 1, 88, 21 -server_list = 20, 125, 286, 240 -player_count = 336, 91, 173, 16 -description = 337, 109, 173, 245 -chatbox = 2, 445, 515, 198 -chatname = 3, 646, 85, 19 -chatmessage = 93, 646, 424, 19 -loading_label = 135, 92, 254, 95 -progress_bar = 135, 188, 254, 21 -cancel = 220, 220, 80, 20 diff --git a/base/themes/default/lobbybackground.png b/base/themes/default/lobbybackground.png deleted file mode 100644 index 094f19c3..00000000 Binary files a/base/themes/default/lobbybackground.png and /dev/null differ diff --git a/base/themes/default/mute.png b/base/themes/default/mute.png deleted file mode 100644 index a184cbf8..00000000 Binary files a/base/themes/default/mute.png and /dev/null differ diff --git a/base/themes/default/mute_pressed.png b/base/themes/default/mute_pressed.png deleted file mode 100644 index e9793cec..00000000 Binary files a/base/themes/default/mute_pressed.png and /dev/null differ diff --git a/base/themes/default/muted.png b/base/themes/default/muted.png deleted file mode 100644 index 969da04e..00000000 Binary files a/base/themes/default/muted.png and /dev/null differ diff --git a/base/themes/default/notguilty.gif b/base/themes/default/notguilty.gif deleted file mode 100644 index d057715d..00000000 Binary files a/base/themes/default/notguilty.gif and /dev/null differ diff --git a/base/themes/default/notguilty.png b/base/themes/default/notguilty.png deleted file mode 100644 index b9cfe318..00000000 Binary files a/base/themes/default/notguilty.png and /dev/null differ diff --git a/base/themes/default/objection.png b/base/themes/default/objection.png deleted file mode 100644 index 6fbcbc2f..00000000 Binary files a/base/themes/default/objection.png and /dev/null differ diff --git a/base/themes/default/objection_selected.png b/base/themes/default/objection_selected.png deleted file mode 100644 index 384e4e9b..00000000 Binary files a/base/themes/default/objection_selected.png and /dev/null differ diff --git a/base/themes/default/pair_button.png b/base/themes/default/pair_button.png deleted file mode 100644 index 19f6f22a..00000000 Binary files a/base/themes/default/pair_button.png and /dev/null differ diff --git a/base/themes/default/pair_button_pressed.png b/base/themes/default/pair_button_pressed.png deleted file mode 100644 index aaf53fb6..00000000 Binary files a/base/themes/default/pair_button_pressed.png and /dev/null differ diff --git a/base/themes/default/placeholder.gif b/base/themes/default/placeholder.gif deleted file mode 100644 index e35aaf4b..00000000 Binary files a/base/themes/default/placeholder.gif and /dev/null differ diff --git a/base/themes/default/present.png b/base/themes/default/present.png deleted file mode 100644 index 134d7428..00000000 Binary files a/base/themes/default/present.png and /dev/null differ diff --git a/base/themes/default/present_disabled.png b/base/themes/default/present_disabled.png deleted file mode 100644 index 9c6a702d..00000000 Binary files a/base/themes/default/present_disabled.png and /dev/null differ diff --git a/base/themes/default/prominus.png b/base/themes/default/prominus.png deleted file mode 100644 index 1191e1ee..00000000 Binary files a/base/themes/default/prominus.png and /dev/null differ diff --git a/base/themes/default/proplus.png b/base/themes/default/proplus.png deleted file mode 100644 index 5e9d563d..00000000 Binary files a/base/themes/default/proplus.png and /dev/null differ diff --git a/base/themes/default/prosecution_speedlines.gif b/base/themes/default/prosecution_speedlines.gif deleted file mode 100644 index b48802aa..00000000 Binary files a/base/themes/default/prosecution_speedlines.gif and /dev/null differ diff --git a/base/themes/default/prosecutionbar0.png b/base/themes/default/prosecutionbar0.png deleted file mode 100644 index 56b8d61c..00000000 Binary files a/base/themes/default/prosecutionbar0.png and /dev/null differ diff --git a/base/themes/default/prosecutionbar1.png b/base/themes/default/prosecutionbar1.png deleted file mode 100644 index b44323c9..00000000 Binary files a/base/themes/default/prosecutionbar1.png and /dev/null differ diff --git a/base/themes/default/prosecutionbar10.png b/base/themes/default/prosecutionbar10.png deleted file mode 100644 index f0a79c3e..00000000 Binary files a/base/themes/default/prosecutionbar10.png and /dev/null differ diff --git a/base/themes/default/prosecutionbar2.png b/base/themes/default/prosecutionbar2.png deleted file mode 100644 index 8bb51da5..00000000 Binary files a/base/themes/default/prosecutionbar2.png and /dev/null differ diff --git a/base/themes/default/prosecutionbar3.png b/base/themes/default/prosecutionbar3.png deleted file mode 100644 index d0b9c4c2..00000000 Binary files a/base/themes/default/prosecutionbar3.png and /dev/null differ diff --git a/base/themes/default/prosecutionbar4.png b/base/themes/default/prosecutionbar4.png deleted file mode 100644 index b4ac6bb0..00000000 Binary files a/base/themes/default/prosecutionbar4.png and /dev/null differ diff --git a/base/themes/default/prosecutionbar5.png b/base/themes/default/prosecutionbar5.png deleted file mode 100644 index 6bb5eb56..00000000 Binary files a/base/themes/default/prosecutionbar5.png and /dev/null differ diff --git a/base/themes/default/prosecutionbar6.png b/base/themes/default/prosecutionbar6.png deleted file mode 100644 index 9ee9638f..00000000 Binary files a/base/themes/default/prosecutionbar6.png and /dev/null differ diff --git a/base/themes/default/prosecutionbar7.png b/base/themes/default/prosecutionbar7.png deleted file mode 100644 index 34e00da9..00000000 Binary files a/base/themes/default/prosecutionbar7.png and /dev/null differ diff --git a/base/themes/default/prosecutionbar8.png b/base/themes/default/prosecutionbar8.png deleted file mode 100644 index 5035b51e..00000000 Binary files a/base/themes/default/prosecutionbar8.png and /dev/null differ diff --git a/base/themes/default/prosecutionbar9.png b/base/themes/default/prosecutionbar9.png deleted file mode 100644 index b185a1a4..00000000 Binary files a/base/themes/default/prosecutionbar9.png and /dev/null differ diff --git a/base/themes/default/publicservers.png b/base/themes/default/publicservers.png deleted file mode 100644 index 98cf2ad8..00000000 Binary files a/base/themes/default/publicservers.png and /dev/null differ diff --git a/base/themes/default/publicservers_selected.png b/base/themes/default/publicservers_selected.png deleted file mode 100644 index bcfa4c47..00000000 Binary files a/base/themes/default/publicservers_selected.png and /dev/null differ diff --git a/base/themes/default/realization.png b/base/themes/default/realization.png deleted file mode 100644 index f791d29b..00000000 Binary files a/base/themes/default/realization.png and /dev/null differ diff --git a/base/themes/default/realization_pressed.png b/base/themes/default/realization_pressed.png deleted file mode 100644 index 9a72ed3a..00000000 Binary files a/base/themes/default/realization_pressed.png and /dev/null differ diff --git a/base/themes/default/realizationflash.png b/base/themes/default/realizationflash.png deleted file mode 100644 index 776c70d2..00000000 Binary files a/base/themes/default/realizationflash.png and /dev/null differ diff --git a/base/themes/default/refresh.png b/base/themes/default/refresh.png deleted file mode 100644 index 0b49cd09..00000000 Binary files a/base/themes/default/refresh.png and /dev/null differ diff --git a/base/themes/default/refresh_pressed.png b/base/themes/default/refresh_pressed.png deleted file mode 100644 index 80366838..00000000 Binary files a/base/themes/default/refresh_pressed.png and /dev/null differ diff --git a/base/themes/default/takethat.png b/base/themes/default/takethat.png deleted file mode 100644 index 8ff2befe..00000000 Binary files a/base/themes/default/takethat.png and /dev/null differ diff --git a/base/themes/default/takethat_selected.png b/base/themes/default/takethat_selected.png deleted file mode 100644 index 3fe0a8cd..00000000 Binary files a/base/themes/default/takethat_selected.png and /dev/null differ diff --git a/base/themes/default/testimony.gif b/base/themes/default/testimony.gif deleted file mode 100644 index 6d5898d7..00000000 Binary files a/base/themes/default/testimony.gif and /dev/null differ diff --git a/base/themes/default/testimony.png b/base/themes/default/testimony.png deleted file mode 100644 index 7b81fc8e..00000000 Binary files a/base/themes/default/testimony.png and /dev/null differ diff --git a/base/themes/default/witnesstestimony.gif b/base/themes/default/witnesstestimony.gif deleted file mode 100644 index 03b4900c..00000000 Binary files a/base/themes/default/witnesstestimony.gif and /dev/null differ diff --git a/base/themes/default/witnesstestimony.png b/base/themes/default/witnesstestimony.png deleted file mode 100644 index 47c23010..00000000 Binary files a/base/themes/default/witnesstestimony.png and /dev/null differ -- cgit From 6dde524a160f445e47edb5c6befb78bfc1092a61 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sun, 31 May 2020 17:07:35 -0500 Subject: Lobby: Change "font_*" config entry to "*_font" --- src/lobby.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/lobby.cpp b/src/lobby.cpp index 98048556..33fe7a8b 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -239,20 +239,18 @@ void Lobby::set_font(QWidget *widget, QString p_identifier) int f_weight = ao_app->get_font_size(p_identifier, design_file); QString class_name = widget->metaObject()->className(); QString font_name = - ao_app->get_font_name("font_" + p_identifier, design_file); + ao_app->get_font_name(p_identifier + "_font", design_file); QFont font(font_name, f_weight); bool use = ao_app->get_font_size("use_custom_fonts", design_file) == 1; if (use) { - widget->setFont(font); - QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == 1; // is the font bold or not? + font.setBold(bold); + widget->setFont(font); + QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); bool center = ao_app->get_font_size(p_identifier + "_center", design_file) == 1; // should it be centered? - QString is_bold = ""; - if (bold) - is_bold = "bold"; QString is_center = ""; if (center) is_center = "qproperty-alignment: AlignCenter;"; @@ -260,8 +258,7 @@ void Lobby::set_font(QWidget *widget, QString p_identifier) 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);\n" + is_center + "\n" + - "font: " + is_bold + "; }"; + QString::number(f_color.blue()) + ", 255);\n" + is_center + "}"; widget->setStyleSheet(style_sheet_string); } return; -- cgit From 8e106c5d21c57cfeb717408321eb579683e5095a Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sun, 31 May 2020 17:08:01 -0500 Subject: Fix server list showing in reverse order --- src/lobby.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lobby.cpp b/src/lobby.cpp index 33fe7a8b..d6900c63 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -483,6 +483,7 @@ void Lobby::list_servers() i++; } ui_server_list->setSortingEnabled(true); + ui_server_list->sortItems(0, Qt::SortOrder::AscendingOrder); } void Lobby::list_favorites() -- cgit From ab00005bf7d4ffde047f30bad622de35e7485c51 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sun, 31 May 2020 21:20:59 -0500 Subject: Update themes submodule --- .gitignore | 1 - base/themes | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 212daeca..eb0b9792 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ base_override.h .DS_Store base-full/ -base/ logs/ bass.lib diff --git a/base/themes b/base/themes index 620915d8..49cc1265 160000 --- a/base/themes +++ b/base/themes @@ -1 +1 @@ -Subproject commit 620915d85afdeb51bb3bd7766d5807bbdc6fa876 +Subproject commit 49cc1265f55e2939248bc1eeb6be93a8a03b9853 -- cgit From 012a03e961f91d560ceb5146b2fcfea0c73ca569 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sun, 31 May 2020 21:22:54 -0500 Subject: Warn/error on incorrect compile settings for audio --- Attorney_Online.pro | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index 2a47afd2..d49676ec 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -39,6 +39,15 @@ contains(DEFINES, QTAUDIO) { QT += multimedia } +AUDIO_DEFINES = $$find(DEFINES, BASSAUDIO) $$find(DEFINES, QTAUDIO) +count(AUDIO_DEFINES, 0) { + warning("No audio system selected. Your build will not have audio.") +} + +count(AUDIO_DEFINES, 2) { + error("More than one audio system selected.") +} + macx:LIBS += -framework CoreFoundation -framework Foundation -framework CoreServices -- cgit From 032e53d1570f9accee6dc8b7877efc0d4108f55a Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sun, 31 May 2020 21:54:35 -0500 Subject: Fix SFX playing at 1/100th of its intended volume --- src/aosfxplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index 0fdba1b2..127bda63 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -66,7 +66,7 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); - set_volume(m_volume); + set_volume_internal(m_volume); if (ao_app->get_audio_output_device() != "default") BASS_ChannelSetDevice(m_stream_list[m_channel], BASS_GetDevice()); -- cgit From e0fb90984ce9b1c0430b1add185cc1d91f06792a Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sat, 6 Jun 2020 23:20:32 -0500 Subject: Update about dialog - Credited FanatSors - Added Qt version, audio engine, and build date --- src/lobby.cpp | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/src/lobby.cpp b/src/lobby.cpp index d6900c63..cc9c44d8 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -353,6 +353,14 @@ void Lobby::on_connect_released() void Lobby::on_about_clicked() { +#ifdef BASSAUDIO + const QString audio = "BASS"; +#elif defined(QTAUDIO) + const QString audio = "Qt Multimedia"; +#else + const QString audio = "null"; +#endif + QString msg = tr("

Attorney Online %1

" "The courtroom drama simulator" @@ -360,20 +368,28 @@ void Lobby::on_about_clicked() "" "https://github.com/AttorneyOnline/AO2-Client" "

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

2.8 Major Release development:
" + "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, " "Crystalwarrior, Iamgoofball" - "

2.8 Quality Assurance:
" - "WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry," - "CedricDewitt, Chewable Tablets, Fantos, Futugaze," - "Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy," + "

QA testing:
" + "WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry, " + "CedricDewitt, Chewable Tablets, Fantos, Futugaze, " + "Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy, " "GreenBowers, Robotic Overlord, Veritas, Gin-Gi" "

Special thanks:
" - "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), " + "Remy, Hibiki, Qubrick (webAO), Ruekasu (UI design), " "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " - "Noevain, Cronnicossy, the AO2 community, server hosts, game masters," - "case makers, content creators and players!") - .arg(ao_app->get_version_string()); + "Noevain, Cronnicossy, FanatSors (AO1), server hosts, game masters, " + "case makers, content creators, and the whole AO2 community!" + "

The Attorney Online networked visual novel project " + "is copyright (c) 2016-2020 Attorney Online developers. Open-source " + "licenses apply. All other assets are the property of their " + "respective owners." + "

Running on Qt version %2 with the %3 audio engine." + "

Built on %4") + .arg(ao_app->get_version_string()) + .arg(QLatin1String(QT_VERSION_STR)) + .arg(audio) + .arg(QLatin1String(__DATE__)); QMessageBox::about(this, tr("About"), msg); } -- cgit From 3e27548d3914fc01a72651e8398756843b98ff6d Mon Sep 17 00:00:00 2001 From: Pyraq Date: Tue, 9 Jun 2020 12:44:25 +0200 Subject: Yet another update to the Polish translation. --- resource/translations/ao_pl.qm | Bin 27653 -> 46479 bytes resource/translations/ao_pl.ts | 224 ++++++++++++++++++++++------------------- 2 files changed, 118 insertions(+), 106 deletions(-) diff --git a/resource/translations/ao_pl.qm b/resource/translations/ao_pl.qm index 995a5bc9..99f3c75d 100644 Binary files a/resource/translations/ao_pl.qm and b/resource/translations/ao_pl.qm differ diff --git a/resource/translations/ao_pl.ts b/resource/translations/ao_pl.ts index 009a1f7b..9bcb496f 100644 --- a/resource/translations/ao_pl.ts +++ b/resource/translations/ao_pl.ts @@ -236,77 +236,77 @@ Powód: %1 - Keep current setting - + - Zostaw obecne ustawienia Allow Screenshake: - + Zezwalaj Wstrząśnięcia: Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. - + Zezwala na wstrząśnięcia ekranu. Wyłącz to, jeśli przejmujesz się lub masz problemy z światłoczułością oraz/lub napady padaczkowe. Allow Effects: - + Zezwalaj Efekty: Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. - + Zezwala na efekty ekranu. Wyłącz to, jeśli przejmujesz się lub masz problemy z światłoczułością oraz/lub napady padaczkowe. Network Frame Effects: - + Efekty Network Frame: Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. - + Wysyła wstrząśnięcia ekranu, błyśnięcia i dźwięki, jak zdefiniowano w pliku char.ini, przez sieć. Działa tylko w przypadku serwerów, które obsługują tę funkcję. Colors in IC Log: - + Kolory w dzienniku IC: Use the markup colors in the server IC chatlog. - + Użyj znaczników kolorów w serwerowym dzienniku IC. Sticky Sounds: - + Lepkie Dźwięki: Turn this on to prevent the sound dropdown from clearing the sound after playing it. - + Włącz to, aby zapobiec listy dźwięków przed odznaczeniem zaznaczonego dźwięku po odtworzeniu. Sticky Effects: - + Lepkie Efekty: Turn this on to prevent the effects dropdown from clearing the effect after playing it. - + Włącz to, aby zapobiec listy efektów przed odznaczeniem zaznaczonego efektu po odtworzeniu. Sticky Preanims: - + Lepkie Przed-animacje: Turn this on to prevent preanimation checkbox from clearing after playing the emote. - + Włącz to, aby zapobiec przycisku wyboru przed-animacji od odznaczenia się po odegraniu emotki. @@ -376,7 +376,7 @@ Powód: %1 Play a blip sound "once per every X symbols", where X is the blip rate. - + Zagraj dźwięk blipa "raz na X symboli", gdzie X to tempo blipów. @@ -407,7 +407,7 @@ Powód: %1 If true, AO2 will stop the music for you when you or someone else does 'Objection!'. - + Jeśli zaznaczone, gra przerwie muzykę, kiedy ktoś sprzeciwi się (Objection!). If true, the game will stop music when someone objects, like in the actual games. @@ -594,7 +594,8 @@ Powód: %1 Additive - + I'm not sure about this one. + Dodatek @@ -671,34 +672,34 @@ Rozprawy które możesz załadować: %1 None - + Nic Hold It! - + (Hold It)! Zaczekaj! When this is turned on, your next in-character message will be a shout! - + Kiedy to jest włączone, twoja następna wiadomość IC będzie krzykiem! Objection! - + (Objection!) Sprzeciw! Take That! - + (Take That!) Weź To! Toggle between server chat and global AO2 chat. - + Przełączaj pomiędzy czatem serwerowym i globalnym czatem AO2. @@ -706,122 +707,125 @@ Rozprawy które możesz załadować: %1 This will display the animation in the viewport as soon as it is pressed. - + To będzie wyświetlać animację w oknie tak szybko jak jest to wciśnięte. Guilty! - + Winny! Bring up the Character Select Screen and change your character. - + Wyświetl ekran zmiany postaci i zmień swoją postać. Refresh the theme and update all of the ui elements to match. - + Odśwież motyw i uaktualnij wszystkie elementy UI, aby dopasować. Request the attention of the current server's moderator. - + Poproś uwagę moderatora obecnego serwera. Allows you to change various aspects of the client. - + Umożliwia zmianę różnych aspektów klienta. An interface to help you announce a case (you have to be a CM first to be able to announce cases) - + Interfejs, który pomoże ci ogłosić rozprawę (musisz być zarządcą rozpraw (CM), aby móc ogłaszać rozprawy) Switch between Areas and Music lists - + Przełącz pomiędzy listami Obszarów i Muzyki Play a single-shot animation as defined by the emote when checked. - + Odegraj pojedyńczą animację, jak zdefiniowano przez emotkę, gdy zaznaczone. If preanim is checked, display the input text immediately as the animation plays concurrently. - + Jeśli przed-animacja jest zaznaczona, wyświetl wpisany tekst natychmiastowo, jednocześnie podczas odgrywania animacji. Mirror your character's emotes when checked. - + Odzwierciedlij emotki twojej postaci, gdy zaznaczone. Add text to your last spoken message when checked. - + Dodaj tekst do twojej ostatniej wiadomości, gdy zaznaczone. Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window. - + Nie słuchaj wezwań moda, gdy zaznaczone, zapobiegając grania dźwięków oraz skupiania uwagi na okienko. Lets you receive case alerts when enabled. (You can set your preferences in the Settings!) - + Pozwala ci otrzymywać komunikaty rozpraw, gdy włączone. +(Możesz ustawić swoje preferencje w Ustawieniach!) Display customized shownames for all users when checked. - + Wyświetl niestandardowe ksywki dla wszystkich użytkowników, gdy zaznaczone. Custom Shout! - + Niestandardowy Krzyk (sprzeciw)! This will display the custom character-defined animation in the viewport as soon as it is pressed. To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect - + To będzie wyświetlać zdefiniowanej animacji niestandardowej postaci w oknie tak szybko, jak jest to wciśnięte. +Aby zrobić coś takiego, folder twojej postaci musi zawierać niestandardowe [webp/apng/gif/png] i niestandardowe [wav/ogg/opus] efekty dźwiękowe Play realization sound and animation in the viewport on the next spoken message when checked. - + Zagraj dźwięk realizacji i animację w oknie podczas następnej wiadomości, gdy zaznaczone. Shake the screen on next spoken message when checked. - + Wstrząśnij ekranem podczas następnej wiadomości, gdy zaznaczone. Display the list of character folders you wish to mute. - + Wyświetl listę folderów postaci, których chcesz zmutować. Increase the health bar. - + Zwiększ pasek życia. Decrease the health bar. - + Obniż pasek życia. Change the text color of the spoken message. You can also select a part of your currently typed message and use the dropdown to change its color! - + Zmień kolor tekstu dla twojej wiadomości. +Możesz również zaznaczyć część twojej obecnie pisanej wiadomości i użyć list aby zmienić jej kolor! @@ -833,12 +837,12 @@ You can also select a part of your currently typed message and use the dropdown has played a song - + włączył piosenkę You will now pair up with %1 if they also choose your character in return. - + Będzie teraz w parze z %1, jeśli oni również wybiorą twoją postać. Rainbow @@ -864,72 +868,76 @@ You can also select a part of your currently typed message and use the dropdown To front - + Do przodu To behind - + Do tyłu Select a character you wish to pair with. - + Zaznacz postać, z którą chcesz się sparować. Change the percentage offset of your character's position from the center of the screen. - + Zmień procentową odległość dla pozycji twojej postaci licząc od środka ekranu. Change the order of appearance for your character. - + Zmień kolejność występowania dla twojej postaci. Display the list of characters to pair with. - + Wyświetl listę postaci to sparowania się. Oops, you're muted! - + Ups, jesteś zmutowany! Set your character's emote to play on your next message. - + Ustaw emotki twojej postaci do odegrania podczas następnej wiadomości. Set your character's supplementary background. - + Ustaw uzupełniające tło twojej postaci. Set an 'iniswap', or an alternative character folder to refer to from your current character. Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/iniswaps.ini - + Ustaw 'iniswap' albo alternatywny folder postaci, aby odnosił się do twojej obecnej postaci. +Edytuj poprzez pisanie i naciśnięcie enter, [X] aby usunąć. To się zapisuje do base/characters/<charname>/iniswaps.ini Remove the currently selected iniswap from the list and return to the original character folder. - + Usuń obecne zaznaczony iniswap z listy i powróć do pierwotnego foldera postaci. Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any). Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/soundlist.ini - + Ustaw efekt dźwiękowy do zagrania dla twojej następnej 'przed-animacji' Zostawienie to jako domyślne, użyje dźwięku zdefiniowanego przez emotkę (jeśli istnieje). +Edytuj poprzez pisanie i naciśnięcie enter, [X] aby usunąć. To się zapisuje do base/characters/<charname>/soundlist.ini Choose an effect to play on your next spoken message. The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by char.ini [Options] category, effects = 'miscname' where it referes to misc/<miscname>/effects.ini to read the effects. - + Wybierz efekt dla twojej następnej wiadomości. +Efekty są zdefiniowane w twoim pliku theme/effect/effects.ini. Twoja postać może zdefiniować niestandardowe efekty przez +kategorię char.ini [Options], effects = 'miscname' gdzie się odnosi do misc/<miscname>/effects.ini, aby przejrzeć efekty. @@ -985,23 +993,23 @@ char.ini [Options] category, effects = 'miscname' where it referes to Return back to the server list. - + Wróć spowrotem do listy serwerów. Become a spectator. You won't be able to interact with the in-character screen. - + Zostań spektatorem. Nie będziesz mógł wchodzić w interakcję z ekranem IC. You were granted the Disable Modcalls button. - + Zostałeś obdarzonym przyciskiem Wyłącz Wezwania Moda. CLIENT - + KLIENT @@ -1096,7 +1104,7 @@ char.ini [Options] category, effects = 'miscname' where it referes to UNKNOWN - + NIEZNANE @@ -1126,32 +1134,32 @@ char.ini [Options] category, effects = 'miscname' where it referes to Expand All Categories - + Rozwiń Wszystkie Kategorie Collapse All Categories - + Zwiń Wszystkie Kategorie Fade Out Previous - + Zanikaj poprzednie Fade In - + Rozjaśnij Synchronize - + Zsynchronizuj Default - + Domyślne @@ -1186,80 +1194,81 @@ char.ini [Options] category, effects = 'miscname' where it referes to Present this piece of evidence to everyone on your next spoken message - + Zaprezentuj ten dowód dla każdego podczas twojej następnej wiadomości Save evidence to an .ini file. - + Zapisz dowody do pliku .ini. Load evidence from an .ini file. - + Załaduj dowody z pliku .ini. Destroy this piece of evidence - + Zniszcz ten dowód Choose.. - + Wybierz.. Close the evidence display/editing overlay. You will be prompted if there's any unsaved changes. - + Zamknij wyświetlanie/edytowanie okienka dowodów. +Zostaniesz poproszony, jeśli są jakieś niezapisane zmiany. Save any changes made to this piece of evidence and send them to server. - + Zapisz zmiany do tego dowodu i wyślij je do serwera. Double-click to edit. Press [X] to update your changes. - + Kliknij dwa razy, aby edytować. Naciśnij [X], by uaktualnić zmiany. Bring up the Evidence screen. - + Wyświetl ekran dowodów. Switch evidence to private inventory. - + Przełącz dowody do prywatnego ekwipunku. Switch evidence to global inventory. - + Przełącz dowody do globalnego ekwipunku. Transfer evidence to private inventory. - + Przenieś dowody do prywatnego ekwipunku. Transfer evidence to global inventory. - + Przenieś dowody do globalnego ekwipunku. The piece of evidence you've been editing has changed. - + Ten dowód, który edytujesz, zmienił się. Do you wish to keep your changes? - + Czy chcesz zatrzymać zmiany? @@ -1267,19 +1276,22 @@ You will be prompted if there's any unsaved changes. Image: %2 Description: %3 - + Nazwa: %1 +Obraz: %2 +Opis: +%3 Images (*.png) - Plik obrazu (*.png) + Pliki obrazu (*.png) Double-click to edit... - + Kliknij dwa razy, aby edytować... @@ -1289,43 +1301,43 @@ Description: Evidence has been modified. - + Dowody zostały zmodyfikowane. Do you want to save your changes? - + Czy chcesz zapisać zmiany? Current evidence is global. Click to switch to private. - + Obecne dowody są globalne. Kliknij, aby przełączyć na prywatne. Current evidence is private. Click to switch to global. - + Obecne dowody są prywatne. Kliknij, aby przełączyć na globalne. "%1" has been transferred. - + "%1" został przeniesiony. Save Inventory - + Zapisz ekwipunek Ini Files (*.ini) - + Pliki ini (*.ini) Open Inventory - + Otwórz ekwipunek @@ -1338,7 +1350,7 @@ Description: Search - Wyszukaj + Szukaj @@ -1360,12 +1372,12 @@ Czy pobrałeś wszystkie zasoby poprawnie z tiny.cc/getao, włączając duży fo Settings - Ustawienia + Ustawienia Allows you to change various aspects of the client. - + Umożliwia zmianę różnych aspektów klienta. @@ -1380,12 +1392,12 @@ Czy pobrałeś wszystkie zasoby poprawnie z tiny.cc/getao, włączając duży fo <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>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! - + <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>Główny rozwój nad wydaniem 2.8:</b><br>Crystalwarrior, Iamgoofball<p><b>Zapewnienie jakości 2.8:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<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, społeczności AO2, hostów serwerów, mistrzów gier, twórców rozpraw, twórców kontentu i dla graczy! About - + Opis <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 @@ -1410,12 +1422,12 @@ Czy pobrałeś wszystkie zasoby poprawnie z tiny.cc/getao, włączając duży fo UNKNOWN - + NIEZNANE has played a song: - + włączył piosenkę: -- cgit From f13635b5cdc238af5464b4aa916999b4e1f017b8 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Tue, 9 Jun 2020 13:44:50 -0500 Subject: Update credits again - Alphabetized QA section - Added MaximumVolty - Added court-records.net - Renamed Unishred to Lewdton --- src/lobby.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/lobby.cpp b/src/lobby.cpp index cc9c44d8..2aeb47da 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -371,15 +371,18 @@ void Lobby::on_about_clicked() "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, " "Crystalwarrior, Iamgoofball" "

QA testing:
" - "WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry, " - "CedricDewitt, Chewable Tablets, Fantos, Futugaze, " - "Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy, " - "GreenBowers, Robotic Overlord, Veritas, Gin-Gi" + "CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, " + "Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, " + "Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, " + "Veritas, Wiso" "

Special thanks:
" - "Remy, Hibiki, Qubrick (webAO), Ruekasu (UI design), " - "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " - "Noevain, Cronnicossy, FanatSors (AO1), server hosts, game masters, " - "case makers, content creators, and the whole AO2 community!" + "CrazyJC and MaximumVolty (2.8 release); " + "Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); " + "Rue (website); Draxirch (UI design); " + "Lewdton and Argoneus (tsuserver); " + "Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); " + "server hosts, game masters, case makers, content creators, " + "and the whole AO2 community!" "

The Attorney Online networked visual novel project " "is copyright (c) 2016-2020 Attorney Online developers. Open-source " "licenses apply. All other assets are the property of their " -- cgit From 35b9c834e2cbc49b1f479797fed8a9775e5c3e0f Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Tue, 9 Jun 2020 16:42:52 -0500 Subject: Lobby: Fix incorrect sorted server list --- src/lobby.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lobby.cpp b/src/lobby.cpp index 2aeb47da..613bee57 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -497,7 +497,7 @@ void Lobby::list_servers() int i = 0; for (server_type i_server : ao_app->get_server_list()) { QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); - treeItem->setText(0, QString::number(i)); + treeItem->setData(0, Qt::DisplayRole, i); treeItem->setText(1, i_server.name); i++; } @@ -513,7 +513,7 @@ void Lobby::list_favorites() int i = 0; for (server_type i_server : ao_app->get_favorite_list()) { QTreeWidgetItem *treeItem = new QTreeWidgetItem(ui_server_list); - treeItem->setText(0, QString::number(i)); + treeItem->setData(0, Qt::DisplayRole, i); treeItem->setText(1, i_server.name); // treeItem->setText(2, "-"); i++; -- cgit From 4bc23c889f22d8babe073a1e13693623f74261e3 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 10 Jun 2020 16:00:29 -0500 Subject: Bump .pro version to 2.8.4 I won't roll the minor version back to 2.8.0 - that'll just cause headaches. --- Attorney_Online.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index d49676ec..28a1e7ca 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -3,7 +3,7 @@ QT += core gui widgets network TARGET = Attorney_Online TEMPLATE = app -VERSION = 2.8.3.1 +VERSION = 2.8.4.0 INCLUDEPATH += $$PWD/include DESTDIR = $$PWD/bin -- cgit From 0bdcf03793d6f1304d02e008f4cfdaecd5e9119f Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 10 Jun 2020 21:42:42 -0500 Subject: Remove extraneous files; update themes submodule - A preconfigured config.ini is probably not useful these days. There's an options menu now. - Removed gs4 background - already in vanilla pack. - Themes submodule should probably be configured to track master. Meh. Submodules can be so finicky. It probably doesn't belong in this repo anyway - it should be in the vanilla repo (currently invisible). --- .gitlab-ci.yml | 1 - base/background/gs4/defensedesk.png | Bin 6880 -> 0 bytes base/background/gs4/prosecutiondesk.png | Bin 6551 -> 0 bytes base/background/gs4/stand.png | Bin 2657 -> 0 bytes base/config.ini | 10 ---------- base/themes | 2 +- 6 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 base/background/gs4/defensedesk.png delete mode 100644 base/background/gs4/prosecutiondesk.png delete mode 100644 base/background/gs4/stand.png delete mode 100644 base/config.ini diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e9685de0..4c7f0799 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -123,7 +123,6 @@ build windows i686: mkdir base mkdir base/themes cp -a ../base/themes/default base/themes/ - cp -a ../base/config.ini base/config.sample.ini cp -a ../base/serverlist.txt base/serverlist.sample.txt # Miscellaneous files diff --git a/base/background/gs4/defensedesk.png b/base/background/gs4/defensedesk.png deleted file mode 100644 index 00a3ffb6..00000000 Binary files a/base/background/gs4/defensedesk.png and /dev/null differ diff --git a/base/background/gs4/prosecutiondesk.png b/base/background/gs4/prosecutiondesk.png deleted file mode 100644 index 9f626733..00000000 Binary files a/base/background/gs4/prosecutiondesk.png and /dev/null differ diff --git a/base/background/gs4/stand.png b/base/background/gs4/stand.png deleted file mode 100644 index 3719e36a..00000000 Binary files a/base/background/gs4/stand.png and /dev/null differ diff --git a/base/config.ini b/base/config.ini deleted file mode 100644 index 1e8705fa..00000000 --- a/base/config.ini +++ /dev/null @@ -1,10 +0,0 @@ -theme = default -blip_rate = 1 -blank_blip = false -default_music = 50 -default_sfx = 50 -default_blip = 50 -discord = true -ic_scroll_down = false -; master = master.aceattorneyonline.com -; ooc_name = Phoenix \ No newline at end of file diff --git a/base/themes b/base/themes index 49cc1265..4b8496e7 160000 --- a/base/themes +++ b/base/themes @@ -1 +1 @@ -Subproject commit 49cc1265f55e2939248bc1eeb6be93a8a03b9853 +Subproject commit 4b8496e7b6b0926fb9f4f6f13d86cd1da31b047a -- cgit From 3d3de26140041d9e502f71f58af4a1f64615b5f2 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Fri, 12 Jun 2020 16:45:50 -0500 Subject: Fix connect button not enabling Apparently this had never been staged, and while everyone was having problems with the connect button, everything was working just fine for me. This enables the connect button a bit earlier in the handshake process than in 2.6, since there are some older servers out there that don't send FL (and so the connect button would never get enabled). This might lead to race conditions, and sometimes the progress bar does hang, but you can just cancel and reconnect - I haven't encountered a crash so far. --- src/packet_distribution.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 44e28165..670dab44 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -157,6 +157,9 @@ void AOApplication::server_packet_received(AOPacket *p_packet) s_pv = f_contents.at(0).toInt(); server_software = f_contents.at(1); + if (lobby_constructed) + w_lobby->enable_connect_button(); + send_server_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%")); } else if (header == "CT") { -- cgit From 45baa626bc23000de15bec6aa2b3c1192efc5dbe Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Sat, 20 Jun 2020 10:22:10 -0500 Subject: set tooltips of char buttons to char names --- src/charselect.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/charselect.cpp b/src/charselect.cpp index de9748b0..d003b34d 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -209,6 +209,7 @@ void Courtroom::character_loading_finished() char_button->reset(); char_button->hide(); char_button->set_image(char_list.at(n).name); + char_button->setToolTip(char_list.at(n).name); ui_char_button_list.append(char_button); connect(char_button, &AOCharButton::clicked, -- cgit From 12023c4d5c5c57ae4e06a75d1a94f7b03a88fc28 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sun, 28 Jun 2020 19:53:42 -0500 Subject: Update readme (#172) * Readme: link to docs repository * Move compile and release instructions to new file * Remove compile and release instructions from readme --- CONTRIBUTING.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 47 +---------------------------------------------- 2 files changed, 45 insertions(+), 46 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..72cfa8fd --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,44 @@ +## Compiling + +The traditional route is by undergoing the [AO2 Rite of Passage](https://gist.github.com/oldmud0/6c645bd1667370c3e92686f7d0642c38). + +However, these days it is easy to get away with using the default Qt toolchain on any platform, which creates a dynamic executable. (Don't forget to invoke windeployqt when creating a release.) + +### Dependencies + +- [BASS](http://un4seen.com) (optional; may use Qt Multimedia instead) +- [Discord Rich Presence](https://github.com/discordapp/discord-rpc) (optional) + +## Release instructions + +Follow these steps to make a new full release: + +- Set a new AO version in the `.pro` file and in `aoapplication.h`. +- Compile the project. +- Commit the version bump and and create a tag for the commit. +- Rename the executable to `Attorney_Online`. +- Create a temp directory. +- Copy a fresh `base` folder to the temp dir. Ensure that the timestamps are consistent. + - Ignore this step if creating a client-only release. +- Copy the repository's `base` folder to the temp dir. +- Append `.sample` to the names of all `.ini` files, including `serverlist.txt`. +- Copy the game executable to the temp dir. +- Copy `bass.dll`, `discord-rpc.dll`, and `qapng.dll` if applicable. +- Copy `README.md` as `README.md.txt` with CRLF line endings. +- Copy `LICENSE` as `LICENSE.txt` with CRLF line endings. +- Compress the contents of the temp dir to an archive with maximum compression, but + be sure that the contents are placed inside the root directory of the archive and not + within a subdirectory. +- Compute the SHA-1 hash of the archive. +- Upload the archive to the Wasabi bucket and an additional mirror (e.g. MEGA or OneDrive) + (if this is a full release). +- Publish a GitHub release and upload the archive there (if this is a client-only release). +- Add the new version to the `program.json` manifest for the respective platform + (if this is a client-only release). +- Update the following on the website for the respective platform: + - Full download links (Wasabi and mirror) + - Client download link + - Full download hash + - Client download hash + +Repeat for each platform (currently 32-bit Windows and 64-bit Linux). Once you're done, don't forget to announce your release! diff --git a/README.md b/README.md index 4dc6956a..2f5341d3 100644 --- a/README.md +++ b/README.md @@ -2,52 +2,7 @@ [Attorney Online](https://aceattorneyonline.com) is an online version of the world-renowned courtroom drama simulator that allows you to create and play out cases in an off-the-cuff format. -## [Refer to the Wiki](https://github.com/Crystalwarrior/KFO-Client/wiki) for more information. - ---- - -## Compiling - -The traditional route is by undergoing the [AO2 Rite of Passage](https://gist.github.com/oldmud0/6c645bd1667370c3e92686f7d0642c38). Recently, however, it has become more feasible to get away with a dynamic compilation, which is much easier for beginners and requires less setup. - -### Dependencies - -- [BASS](http://un4seen.com) (proprietary, but will become optional in the future; see #35) -- [Discord Rich Presence](https://github.com/discordapp/discord-rpc) - -## Release instructions - -Follow these steps to make a new full release: - -- Set a new AO version in the `.pro` file and in `aoapplication.h`. -- Compile the project. -- Commit the version bump and and create a tag for the commit. -- Rename the executable to `Attorney_Online`. -- Create a temp directory. -- Copy a fresh `base` folder to the temp dir. Ensure that the timestamps are consistent. - - Ignore this step if creating a client-only release. -- Copy the repository's `base` folder to the temp dir. -- Append `.sample` to the names of all `.ini` files, including `serverlist.txt`. -- Copy the game executable to the temp dir. -- Copy `bass.dll`, `discord-rpc.dll`, and `qapng.dll` if applicable. -- Copy `README.md` as `README.md.txt` with CRLF line endings. -- Copy `LICENSE` as `LICENSE.txt` with CRLF line endings. -- Compress the contents of the temp dir to an archive with maximum compression, but - be sure that the contents are placed inside the root directory of the archive and not - within a subdirectory. -- Compute the SHA-1 hash of the archive. -- Upload the archive to the Wasabi bucket and an additional mirror (e.g. MEGA or OneDrive) - (if this is a full release). -- Publish a GitHub release and upload the archive there (if this is a client-only release). -- Add the new version to the `program.json` manifest for the respective platform - (if this is a client-only release). -- Update the following on the website for the respective platform: - - Full download links (Wasabi and mirror) - - Client download link - - Full download hash - - Client download hash - -Repeat for each platform (currently 32-bit Windows and 64-bit Linux). Once you're done, don't forget to announce your release! +**[Refer to the docs](https://github.com/AttorneyOnline/docs/blob/master/docs/index.md) for more information.** ## Credits -- cgit From 19d0c29b35cafc3d12209aa29fa4db5c8dbe930b Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 29 Jun 2020 18:39:27 +0300 Subject: Fix issues when undefined colors result in everyone's chat not using talk anims (#174) base/misc/default/config.ini with properly defined "baseline" colors will have to be supplied with vanilla content later. Remove hardcoded colors - user has no access to these unless config.ini is valid, yet when others speak using these ID's their text shows up just fine. Either reimplement full on hardcoding madness (NOOOOOOOOOOOOOOOOOOOOOOOO NO NO NO NOOOOOOOOOOOOOOOO NOOOOO!!!!) or yeet. I chose the sensible option :^) --- src/courtroom.cpp | 2 +- src/text_file_functions.cpp | 32 -------------------------------- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index e3eeb599..5080b1d6 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -4245,7 +4245,7 @@ void Courtroom::set_text_color_dropdown() current_char) == "1"); color_markdown_talking_list.append( ao_app->get_chat_markdown("c" + QString::number(c) + "_talking", - current_char) == "1"); + current_char) != "0"); QString color_name = ao_app->get_chat_markdown( "c" + QString::number(c) + "_name", current_char); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 1689cd3f..4ea58d6b 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -449,38 +449,6 @@ QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) { QColor return_color(255, 255, 255); - switch (p_identifier.toInt()) { - case 0: // White - return_color = QColor(255, 255, 255); - break; - case 1: // Green - return_color = QColor(0, 255, 0); - break; - case 2: // Red - return_color = QColor(255, 0, 0); - break; - case 3: // Orange - return_color = QColor(255, 165, 0); - break; - case 4: // Blue - return_color = QColor(45, 150, 255); - break; - case 5: // Yellow - return_color = QColor(255, 255, 0); - break; - case 6: // Pink - return_color = QColor(255, 192, 203); - break; - case 7: // Cyan - return_color = QColor(0, 255, 255); - break; - case 8: // Grey - return_color = QColor(187, 187, 187); - break; - default: - return_color = QColor(255, 255, 255); - break; - } 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("c" + p_identifier, design_ini_path); -- cgit From 6d4eb8774912ce81593e0503df3923d1bc6df699 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 30 Jun 2020 23:29:51 +0300 Subject: Add explanation comments to the music looping vars Make music not loop by default for backwards compatibility with old style on servers not supporting clientside music looping Make the music loop when the packet containing loop data gives us "1", treating it as "looping=true". --- src/courtroom.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 5080b1d6..7a38b942 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3000,13 +3000,17 @@ void Courtroom::handle_song(QStringList *p_contents) (f_song_clear.lastIndexOf("/") + 1)); int n_char = f_contents.at(1).toInt(); - bool looping = true; + //Assume the song doesn't loop unless told otherwise (due to most outdated servers handling looping through serverside) + bool looping = false; + //Channel 0 is the 'master music', other channels would commonly be used for ambience int channel = 0; + //No effects assumed by default - vanilla functionality int effect_flags = 0; + if (n_char < 0 || n_char >= char_list.size()) { int channel = 0; - if (p_contents->length() > 3 && p_contents->at(3) != "-1") - looping = false; + if (p_contents->length() > 3 && p_contents->at(3) == "1") + looping = true; if (p_contents->length() > 4) // eyyy we want to change this song's CHANNEL huh @@ -3032,10 +3036,8 @@ void Courtroom::handle_song(QStringList *p_contents) str_show = p_contents->at(2); } } - if (p_contents->length() > 3 && p_contents->at(3) != "-1") { - // I am really confused why "-1" is "loop this song" and why anything else - // passes as "don't loop" (if we even have this length) but alright - looping = false; + if (p_contents->length() > 3 && p_contents->at(3) == "1") { + looping = true; } if (p_contents->length() > 4) // eyyy we want to change this song's CHANNEL huh -- cgit From 19c3aa93fedcf9f1a6e64d4c97270c89b840d769 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 2 Jul 2020 21:52:35 +0300 Subject: Some commit managed to regress the colors and it actually totally wasn't my fault!!! Fix colors being broken --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 5080b1d6..ba16f8cf 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -4234,7 +4234,7 @@ void Courtroom::set_text_color_dropdown() // Update markdown colors. TODO: make a loading function that only loads the // config file once instead of several times for (int c = 0; c < max_colors; ++c) { - QColor color = ao_app->get_chat_color(QString::number(c), current_char); + QColor color = ao_app->get_chat_color("c" + QString::number(c), current_char); color_rgb_list.append(color); color_markdown_start_list.append(ao_app->get_chat_markdown( "c" + QString::number(c) + "_start", current_char)); -- cgit From 5cd9da37063bccab1d00931091df3f8b71225540 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Fri, 3 Jul 2020 09:57:39 -0500 Subject: Credit some more people Not sure how to split this up, frankly. Some people have been more involved in client/server/protocol development than others. I'll figure this out eventually. --- src/lobby.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lobby.cpp b/src/lobby.cpp index 613bee57..3d47416b 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -370,6 +370,8 @@ void Lobby::on_about_clicked() "

Major development:
" "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, " "Crystalwarrior, Iamgoofball" + "

Client development:
" + "Cents02, in1tiate, raidensnake, windrammer" "

QA testing:
" "CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, " "Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, " -- cgit From 0a31a20266adcbd9afd6ef54abe4123f5f1708a3 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 4 Jul 2020 00:34:09 +0300 Subject: Add a setting to turn on/off custom character-defined chatboxes (#166) * Add a new "Custom Chatboxes" settings option to enable/disable char.ini setting custom chat box designs per-character * Fix chat_arrow being incorrectly updated between character messages if the custom chatbox modified the chat arrow positioning/size in any way * brackets matter --- include/aoapplication.h | 5 +++++ include/aooptionsdialog.h | 3 +++ src/aooptionsdialog.cpp | 15 +++++++++++++++ src/courtroom.cpp | 42 ++++++++++++++++++++++++++---------------- src/text_file_functions.cpp | 6 ++++++ 5 files changed, 55 insertions(+), 16 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index 18f6ef24..af357d0c 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -200,6 +200,11 @@ public: // from the config.ini. bool is_stickypres_enabled(); + // Returns the value of whether custom chatboxes should be a thing. + // from the config.ini. + // I am increasingly maddened by the lack of dynamic auto-generation system for settings. + bool is_customchat_enabled(); + // Returns the value of the maximum amount of lines the IC chatlog // may contain, from config.ini. int get_max_log_size(); diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 7e983a3f..06684ef4 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -78,6 +78,9 @@ private: QLabel *ui_stickypres_lbl; QCheckBox *ui_stickypres_cb; + QLabel *ui_customchat_lbl; + QCheckBox *ui_customchat_cb; + QWidget *ui_callwords_tab; QWidget *ui_callwords_widget; QVBoxLayout *ui_callwords_layout; diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 80746f79..e6ff8ff7 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -313,6 +313,20 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_stickypres_cb); + row += 1; + ui_customchat_lbl = new QLabel(ui_form_layout_widget); + ui_customchat_lbl->setText(tr("Custom Chatboxes:")); + ui_customchat_lbl->setToolTip( + tr("Turn this on to allow characters to define their own " + "custom chat box designs.")); + + ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_customchat_lbl); + + ui_customchat_cb = new QCheckBox(ui_form_layout_widget); + ui_customchat_cb->setChecked(ao_app->is_customchat_enabled()); + + ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_customchat_cb); + QScrollArea *scroll = new QScrollArea; scroll->setWidget(ui_form_layout_widget); ui_gameplay_tab->setLayout(new QVBoxLayout); @@ -708,6 +722,7 @@ void AOOptionsDialog::save_pressed() configini->setValue("stickysounds", ui_stickysounds_cb->isChecked()); configini->setValue("stickyeffects", ui_stickyeffects_cb->isChecked()); configini->setValue("stickypres", ui_stickypres_cb->isChecked()); + configini->setValue("customchat", ui_customchat_cb->isChecked()); QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ba16f8cf..7326948f 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1883,30 +1883,35 @@ void Courtroom::handle_chatmessage_2() QString chatbox_path = ao_app->get_theme_path("chat"); QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); - if (chatbox != "") { + QString customchar; + if (ao_app->is_customchat_enabled()) + customchar = m_chatmessage[CHAR_NAME]; + + if (chatbox != "" && ao_app->is_customchat_enabled()) { chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat"; if (!ui_vp_chatbox->set_chatbox(chatbox_path)) ui_vp_chatbox->set_chatbox(chatbox_path + "box"); + } - pos_size_type design_ini_result = ao_app->get_element_dimensions( - "chat_arrow", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); - if (design_ini_result.width < 0 || design_ini_result.height < 0) { - qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; - ui_vp_chat_arrow->hide(); - } - else { - ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); - ui_vp_chat_arrow->combo_resize(design_ini_result.width, - design_ini_result.height); - } + //This should probably be called only if any change from the last chat arrow was actually detected. + pos_size_type design_ini_result = ao_app->get_element_dimensions( + "chat_arrow", "courtroom_design.ini", customchar); + if (design_ini_result.width < 0 || design_ini_result.height < 0) { + qDebug() << "W: could not find \"chat_arrow\" in courtroom_design.ini"; + ui_vp_chat_arrow->hide(); + } + else { + ui_vp_chat_arrow->move(design_ini_result.x, design_ini_result.y); + ui_vp_chat_arrow->combo_resize(design_ini_result.width, + design_ini_result.height); } pos_size_type default_width = ao_app->get_element_dimensions( - "showname", "courtroom_design.ini", m_chatmessage[CHAR_NAME]); + "showname", "courtroom_design.ini", customchar); int extra_width = ao_app ->get_design_element("showname_extra_width", "courtroom_design.ini", - m_chatmessage[CHAR_NAME]) + customchar) .toInt(); if (extra_width > 0) { @@ -2692,8 +2697,13 @@ void Courtroom::chat_tick() ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); } - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_custom_theme = ao_app->get_chat(f_char); + QString f_char; + QString f_custom_theme; + if (ao_app->is_customchat_enabled()) + { + f_char = m_chatmessage[CHAR_NAME]; + f_custom_theme = ao_app->get_chat(f_char); + } ui_vp_chat_arrow->play( "chat_arrow", f_char, f_custom_theme); // Chat stopped being processed, indicate that. diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 4ea58d6b..8f868401 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -988,6 +988,12 @@ bool AOApplication::is_stickypres_enabled() return result.startsWith("true"); } +bool AOApplication::is_customchat_enabled() +{ + QString result = configini->value("customchat", "true").value(); + return result.startsWith("true"); +} + bool AOApplication::get_casing_enabled() { QString result = configini->value("casing_enabled", "false").value(); -- cgit From c533370fd8a939721af41e566fc28c854d616b09 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 4 Jul 2020 20:15:19 +0300 Subject: Fix the blips folder not seeking the blips/ folder for the male.wav sound effect first instead of trying to find sfx-blipmale in base/general folder, makes using the blips folder more viable. (#173) --- src/text_file_functions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 8f868401..122bc412 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -601,7 +601,7 @@ QString AOApplication::get_gender(QString p_char) QString f_result = read_char_ini(p_char, "gender", "Options"); if (f_result == "") - return "sfx-blipmale"; + f_result = "male"; if (!file_exists(get_sfx_suffix(get_sounds_path(f_result)))) { if (file_exists(get_sfx_suffix(get_sounds_path("../blips/" + f_result)))) -- cgit From 44a4a2d23ede7986212558e9cc53387d6f3a1dc9 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 4 Jul 2020 20:15:52 +0300 Subject: Fix an issue where the Ambience layer would break looping points for all other channels due to loop_start and loop_end only being a single variable. (#164) This occurs due to BASS not having any private variables of its own, so it was simply using the public variables loop_start and loop_end as reference - since those changed for any new song playing on another channel, the old looping points got replaced, and the seamless looping stops working. The solution was easy - just make a loop_start/loop_end variable for every supported channel - so 4 variables in our case. --- include/aomusicplayer.h | 4 ++-- src/aomusicplayer.cpp | 25 +++++++++++++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index de673e5e..82751b68 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -25,8 +25,8 @@ public: const int m_channelmax = 4; // These have to be public for the stupid sync thing - int loop_start = 0; - int loop_end = 0; + int loop_start[4] = {0, 0, 0, 0}; + int loop_end[4] = {0, 0, 0, 0}; public slots: void play(QString p_song, int channel = 0, bool loop = false, diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 8ba16418..249e01e5 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -40,8 +40,8 @@ void AOMusicPlayer::play(QString p_song, int channel, bool loop, QString d_path = f_path + ".txt"; - loop_start = 0; - loop_end = BASS_ChannelGetLength(newstream, BASS_POS_BYTE); + loop_start[channel] = 0; + loop_end[channel] = BASS_ChannelGetLength(newstream, BASS_POS_BYTE); if (loop && file_exists(d_path)) // Contains loop/etc. information file { QStringList lines = ao_app->read_file(d_path).split("\n"); @@ -64,11 +64,11 @@ void AOMusicPlayer::play(QString p_song, int channel, bool loop, QWORD bytes = static_cast(args[1].trimmed().toFloat() * sample_size * num_channels); if (arg == "loop_start") - loop_start = bytes; + loop_start[channel] = bytes; else if (arg == "loop_length") - loop_end = loop_start + bytes; + loop_end[channel] = loop_start[channel] + bytes; else if (arg == "loop_end") - loop_end = bytes; + loop_end[channel] = bytes; } qDebug() << "Found data file for song" << p_song << "length" << BASS_ChannelGetLength(newstream, BASS_POS_BYTE) << "loop start" @@ -111,7 +111,7 @@ void AOMusicPlayer::play(QString p_song, int channel, bool loop, else this->set_volume(m_volume[channel], channel); - this->set_looping(loop); // Have to do this here due to any + this->set_looping(loop, channel); // Have to do this here due to any // crossfading-related changes, etc. } @@ -145,6 +145,7 @@ void CALLBACK loopProc(HSYNC handle, DWORD channel, DWORD data, void *user) void AOMusicPlayer::set_looping(bool toggle, int channel) { + qDebug() << "Setting looping for channel" << channel << "to" << toggle; m_looping = toggle; if (!m_looping) { if (BASS_ChannelFlags(m_stream_list[channel], 0, 0) & BASS_SAMPLE_LOOP) @@ -161,13 +162,13 @@ void AOMusicPlayer::set_looping(bool toggle, int channel) loop_sync[channel]); // remove the sync loop_sync[channel] = 0; } - if (loop_start > 0) { - if (loop_end == 0) - loop_end = BASS_ChannelGetLength(m_stream_list[channel], BASS_POS_BYTE); - if (loop_end > 0) // Don't loop zero length songs even if we're asked to + if (loop_start[channel] > 0) { + if (loop_end[channel] == 0) + loop_end[channel] = BASS_ChannelGetLength(m_stream_list[channel], BASS_POS_BYTE); + if (loop_end[channel] > 0) // Don't loop zero length songs even if we're asked to loop_sync[channel] = BASS_ChannelSetSync( - m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end, - loopProc, &loop_start); + m_stream_list[channel], BASS_SYNC_POS | BASS_SYNC_MIXTIME, loop_end[channel], + loopProc, &loop_start[channel]); } } } -- cgit From b12f82dc8cd1137586781e8142556a6c495a0c11 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 5 Jul 2020 03:07:09 +0300 Subject: Fix html not being parsed in ic logs when ic logs go downwards (#178) I found this bug like 3 weeks ago but I forgot to actually make a PR for it oops --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 55b851e3..9920b3bf 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2538,7 +2538,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action) } else { ui_ic_chatlog->textCursor().insertText(": ", normal); - ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); + ui_ic_chatlog->textCursor().insertHtml(p_text + '\n'); } // If we got too many blocks in the current log, delete some from the -- cgit From ec9244809cd09521fd582e5812ac5f0440860677 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sun, 5 Jul 2020 15:29:41 -0500 Subject: Fix Mac build missing audio (#180) --- .travis.yml | 2 +- scripts/macos_build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index dbd19cdc..48bc2b56 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ deploy: provider: releases api_key: secure: mZCNwnqKeqJP5CqgYOanYnr/KHydxueGPRhvGLpY0Pop7MiH3CIHMN5dhHbtgJvE5GGMR4xUIEhPpmkCEJw7YiPREMqT4mkV4DR531ZLB3t/FizyvIwXuP6jFwzTofZ51qHfBpcurVc9sMFeD9Pw+rLTTgIiXL2sZxUUXc8U+ZZug1lYndgcO6P00fUJd6V9lyFQUGmbSca97YbG6KuCym0fEpyRnMqzKLjYsUUo8UKRBADtmD822O6z2FSldNZDn45Mkx0MYfHWyT5hzTb7WGa+DrTB/0un1HqqsNPlb/ahjrFQQNR2qd7HNGZa+Mvwi6egTDug+k15x8lbkacUoi34U1eFq9LSTYm8dSO5g23I1OvGvjTCkDj1jOLPqB99XlbAJ0E/9Jzw7wtlLaAzvFzTj/B63TQnO3IsgHBWR14CZlf05WMOFf2irwl+kL6ktspIHnlGgaiWYYrKeAt7QJAXiQOdYDz6SaWVC6TyOE/SszXRU6xFotmCjkP2irM5yGE8SUw2uIzKjD9uG0ZXtbLcdQEFD316+qglqFTCjnKsRfbtQs2u5spZPsZSdsOZCbLfNIn0GSTFRymFsK6gsvji8AD8AZo0zcOZ/7NMVC6A8RnF3Ve+vU/xljhsIOxoLZDvZPia7WozdV99xmnepWBwkuoQs/K0xmWcnLZDcb0= - file: "../bin/Attorney_Online_mac_x86_64.zip" + file: "../bin/Attorney_Online_macOS.zip" draft: true on: tags: true diff --git a/scripts/macos_build.sh b/scripts/macos_build.sh index efb7653f..fb631e9f 100755 --- a/scripts/macos_build.sh +++ b/scripts/macos_build.sh @@ -30,4 +30,4 @@ tar -xvf apng.tar.xz cp clang_64/plugins/imageformats/libqapng.dylib ../lib cd .. -/usr/local/opt/qt/bin/qmake && make -j2 +/usr/local/opt/qt/bin/qmake "DEFINES += DISCORD QTAUDIO" && make -j2 -- cgit From e827f560f3c7ea3279a81b2737802734e80c431d Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Sun, 5 Jul 2020 15:48:24 -0500 Subject: Mac CI: Fix wrong zip name --- scripts/macos_post_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/macos_post_build.sh b/scripts/macos_post_build.sh index df1475c4..cdf7514b 100755 --- a/scripts/macos_post_build.sh +++ b/scripts/macos_post_build.sh @@ -21,4 +21,4 @@ cp ../lib/* ../bin/Attorney_Online.app/Contents/Frameworks # libbass has a funny path for some reason, just use rpath install_name_tool -change @loader_path/libbass.dylib @rpath/libbass.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online -zip -r -9 ../bin/Attorney_Online_mac_x86_64.zip ../bin/ \ No newline at end of file +zip -r -9 ../bin/Attorney_Online_macOS.zip ../bin/ \ No newline at end of file -- cgit From c29fe7c7ba234e1819f5b5fb566173b4a1831fa4 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Tue, 7 Jul 2020 01:46:22 +0300 Subject: Regenerate the background when reload_theme is pressed to prevent scaling issues (#181) --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 9920b3bf..8f7e1b79 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -4396,7 +4396,7 @@ void Courtroom::on_reload_theme_clicked() text_state = 3; // to update status on the background - set_background(current_background); + set_background(current_background, true); } void Courtroom::on_back_to_lobby_clicked() -- cgit From 4c5fdab9e97287cd2cb76f0c9893c0420caed837 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 8 Jul 2020 00:02:17 +0300 Subject: Fix the color fix pr when logs go downwards where it didn't add an \n because html doesn't like \n very much so it has to be
because that's what HTML does yea --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 8f7e1b79..5b043c43 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2538,7 +2538,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action) } else { ui_ic_chatlog->textCursor().insertText(": ", normal); - ui_ic_chatlog->textCursor().insertHtml(p_text + '\n'); + ui_ic_chatlog->textCursor().insertHtml(p_text + "
"); } // If we got too many blocks in the current log, delete some from the -- cgit From b38e221fb169400a2f1afda0df18821b3c12381b Mon Sep 17 00:00:00 2001 From: raidensnake Date: Sun, 12 Jul 2020 05:06:38 +0100 Subject: Fix APNG backgrounds not appearing on list; fix BASSOPUS path for macOS (#185) * Added apng support for animated background positioning. * Adjusted the apng background position search. * Fixed libbassopus.dylib path on MacOS preventing opus files from playing. --- src/courtroom.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 5b043c43..effef543 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1107,7 +1107,7 @@ void Courtroom::set_background(QString p_background, bool display) // Populate the dropdown list with all pos that exist on this bg QStringList pos_list = {}; for (QString key : default_pos.keys()) { - if (file_exists(ao_app->get_static_image_suffix( + if (file_exists(ao_app->get_image_suffix( ao_app->get_background_path(key)))) { pos_list.append(default_pos[key]); } @@ -4599,11 +4599,8 @@ void Courtroom::load_bass_opus_plugin() #elif defined __APPLE__ void Courtroom::load_bass_opus_plugin() { - QString libpath = - ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib"; - QByteArray ba = libpath.toLocal8Bit(); #ifdef BASSAUDIO - BASS_PluginLoad(ba.data(), 0); + BASS_PluginLoad("libbassopus.dylib", 0); #endif } #else -- cgit From 44659fd2a6693d82443ba666a4f1a086b39e7f77 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Tue, 14 Jul 2020 03:55:18 -0600 Subject: Update some strings for 2.8 in the Spanish translation. (WIP) --- resource/translations/ao_es.ts | 390 +++++++++++++++++++++-------------------- 1 file changed, 201 insertions(+), 189 deletions(-) diff --git a/resource/translations/ao_es.ts b/resource/translations/ao_es.ts index 3d456a54..d25c145a 100644 --- a/resource/translations/ao_es.ts +++ b/resource/translations/ao_es.ts @@ -31,58 +31,58 @@ Ingrese a aceattorneyonline.com para actualizar. You have been exiled from AO. Have a nice day. - Has sido exiliado de AO. + Has sido exiliado de AO. Que tengas un buen día. - + 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. @@ -140,7 +140,7 @@ Razón: Witness needed - Se necesita testigo + Se necesita testigo @@ -203,7 +203,7 @@ Razón: 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. @@ -227,11 +227,11 @@ Razón: Allow Shake/Flash: - Permitir 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. + Permite el movimiento de la pantalla y el parpadeo. Desactive esto si tiene inquietudes o problemas con la fotosensibilidad y/o convulsiones. @@ -245,326 +245,336 @@ Razón: 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. + 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: - + 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. + 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: + 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. + La velocidad del texto será la misma que en los juegos de AA. Blip delay on punctuations: - Retraso en puntuación: + Retraso en puntuación: Sets the default volume for music. - Establece el volumen predeterminado de la música. + 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. + 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. + Si está habilitado, el juego detendrá la música cuando alguien haga una objeción, como en los juegos. - Keep current setting - + - Mantener la configuración actual Allow Screenshake: - + Permitir Screenshake: Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. - + Permite el movimiento de la pantalla (Advertencia esto podría inducir convulsiones debido a imágenes parpadeantes). Allow Effects: - + Permitir efectos: Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. - + Permite efectos de pantalla (Advertencia esto podría inducir convulsiones debido a imágenes parpadeantes). Network Frame Effects: - + Efectos de marco de red: Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. - + Envíe temblores de pantalla, destellos y sonidos como se define en char.ini a través de la red. Solo funciona para servidores que admiten esta funcionalidad. Colors in IC Log: - + Colores en el registro IC: Use the markup colors in the server IC chatlog. - + Permite colores en el chat IC del servidor. Sticky Sounds: - + Sonidos pegajosos: Turn this on to prevent the sound dropdown from clearing the sound after playing it. - + Actívelo para evitar que el menú desplegable de sonido borre el sonido después de reproducirlo. Sticky Effects: - + Efectos pegajosos: Turn this on to prevent the effects dropdown from clearing the effect after playing it. - + Actívelo para evitar que el menú desplegable de efectos elimine el efecto después de reproducirlo. Sticky Preanims: - + Preanims pegajosos: Turn this on to prevent preanimation checkbox from clearing after playing the emote. - + Actívelo para evitar que la casilla preanimation se desactive después de reproducir el emote. - + + Custom Chatboxes: + Chatboxes personalizados: + + + + Turn this on to allow characters to define their own custom chat box designs. + Actívelo para permitir que los personajes definan sus propios diseños de cuadros de chat personalizados. + + + Play a blip sound "once per every X symbols", where X is the blip rate. - + Reproduzca un sonido de blip "una vez por cada X símbolos", donde X es la tasa de blip. - + If true, AO2 will stop the music for you when you or someone else does 'Objection!'. - + Si es activado, AO2 detendrá la música por ti cuando tú u otra persona hagan '¡Objeción!'. - + 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: + Testigo: If checked, you will appear amongst the potential witnesses on the server. - Si está marcado, aparecerá entre los posibles testigos en el servidor. + 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. Only inline coloring will be shown such as <>,|| etc. - Solo se mostrará el color en línea, como <>, ||, 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. + 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 @@ -572,15 +582,15 @@ Razón: Colorful IC log: - Log IC colorido: + Log IC colorido: Enables colored text in the log. - Habilita texto con color en el log. + Habilita texto con color en el log. Only inline coloring: - Solo coloración en línea: + Solo coloración en línea: Only inline coloring will be shown such as <>,|| etc @@ -588,7 +598,7 @@ Razón: Mirror IC log: - IC log refleja interrupciones: + 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 @@ -626,13 +636,13 @@ Razón: Could not find %1 - No se pudo encontrar %1 + No se pudo encontrar %1 - + Generating chars: %1/%2 - Generando personajes: + Generando personajes: %1/%2 @@ -672,7 +682,7 @@ Razón: Guard - Guardia + Guardia @@ -695,39 +705,39 @@ Razón: White - Blanco + Blanco Green - Verde + Verde Red - Rojo + Rojo Orange - Naranja + Naranja Blue - Azul + Azul Yellow - Amarillo + Amarillo Rainbow - Arcoíris + Arcoíris Pink - Rosado + Rosado Cyan - Cian + Cian @@ -791,7 +801,7 @@ Razón: Se le concedió el botón para deshabilitar llamadas a moderadores. - + You have been banned. Has sido vetado. @@ -801,20 +811,20 @@ Razón: This does nothing, but there you go. - Esto no hace nada, pero ahí lo tienes. + 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 + Ahora te emparejarás con if they also choose your character in return. - si ellos también eligen a tu personaje a cambio. + si ellos también eligen a tu personaje a cambio. @@ -824,7 +834,7 @@ Razón: Additive - + Aditivo @@ -844,12 +854,12 @@ Razón: Change the percentage offset of your character's position from the center of the screen. - + Cambia el desplazamiento porcentual de la posición de tu personaje desde el centro de la pantalla. Change the order of appearance for your character. - + Cambia el orden de aparición de tu personaje. @@ -939,7 +949,7 @@ char.ini [Options] category, effects = 'miscname' where it referes to Bring up the Character Select Screen and change your character. - + Abre la pantalla de selección de personaje y cambia tu personaje. @@ -954,12 +964,12 @@ char.ini [Options] category, effects = 'miscname' where it referes to Allows you to change various aspects of the client. - + Le permite cambiar varios aspectos del cliente. An interface to help you announce a case (you have to be a CM first to be able to announce cases) - + Una interfaz para ayudarlo a anunciar un caso (debe ser un CM para poder anunciar casos) @@ -984,7 +994,7 @@ char.ini [Options] category, effects = 'miscname' where it referes to Add text to your last spoken message when checked. - + Agregue texto a su último mensaje hablado cuando esté marcado. @@ -1000,12 +1010,12 @@ char.ini [Options] category, effects = 'miscname' where it referes to Display customized shownames for all users when checked. - + Mostrar nombres personalizados para todos los usuarios cuando esté marcado. Custom Shout! - + ¡Grito personalizado! @@ -1026,7 +1036,7 @@ To make one, your character's folder must contain custom.[webp/apng/gif/png Display the list of character folders you wish to mute. - + Muestra la lista de carpetas de caracteres que desea silenciar. @@ -1038,13 +1048,14 @@ To make one, your character's folder must contain custom.[webp/apng/gif/png Decrease the health bar. - + Disminuye la barra de salud. Change the text color of the spoken message. You can also select a part of your currently typed message and use the dropdown to change its color! - + Cambia el color del texto en el chat IC. +¡También puede seleccionar una parte de su mensaje escrito actualmente y usar el menú desplegable para cambiar su color! @@ -1054,145 +1065,145 @@ You can also select a part of your currently typed message and use the dropdown Become a spectator. You won't be able to interact with the in-character screen. - + Conviértete en espectador. No podrás interactuar con la pantalla del personaje. - + CLIENT - - - + + + has played a song - + You will now pair up with %1 if they also choose your character in return. - + 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. - - + + UNKNOWN - + Your case "%1" was loaded! Su caso "%1" fue cargado! - + Expand All Categories - + Collapse All Categories - + Contraer todas las categorías - + Fade Out Previous - + Fade In - + Synchronize - + Default - + Predeterminado 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. @@ -1201,7 +1212,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. @@ -1226,74 +1237,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 + Mensaje OOC 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. + ¡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. Choose... - Elegir... + Elegir... @@ -1313,18 +1324,19 @@ Casos que puede cargar: Destroy this piece of evidence - + Destruye esta evidencia Choose.. - + Elegir.. Close the evidence display/editing overlay. You will be prompted if there's any unsaved changes. - + Cierra la superposición para visualizar/editar evidencia. +Se le preguntará si hay cambios no guardados. @@ -1339,7 +1351,7 @@ You will be prompted if there's any unsaved changes. Bring up the Evidence screen. - + Abre la ventana para evidencia. @@ -1411,17 +1423,17 @@ Description: Current evidence is global. Click to switch to private. - + La evidencia actual es global. Haga clic para cambiar a privado. Current evidence is private. Click to switch to global. - + La evidencia actual es privada. Haga clic para cambiar a global. "%1" has been transferred. - + "%1" ha sido transferido. @@ -1450,7 +1462,7 @@ Description: Search - Buscar + Buscar @@ -1472,12 +1484,12 @@ Did you download all resources correctly from tiny.cc/getao, including the large Settings - Ajustes + Ajustes Allows you to change various aspects of the client. - + Le permite cambiar varios aspectos del cliente. @@ -1490,31 +1502,31 @@ Did you download all resources correctly from tiny.cc/getao, including the large 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>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! - + + <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, Crystalwarrior, Iamgoofball<p><b>Client development:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>QA testing:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Special thanks:</b><br>CrazyJC and MaximumVolty (2.8 release); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); server hosts, game masters, case makers, content creators, and the whole AO2 community!<p>The Attorney Online networked visual novel project is copyright (c) 2016-2020 Attorney Online developers. Open-source licenses apply. All other assets are the property of their respective owners.<p>Running on Qt version %2 with the %3 audio engine.<p>Built on %4 + <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, Crystalwarrior, Iamgoofball<p><b>Desarrollo del cliente:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>Prueba de control de calidad:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Agradecimiento especial:</b><br>CrazyJC y MaximumVolty (versión 2.8); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, y FanatSors (AO1); server hosts, game masters, case makers, creadores de contenido y toda la comunidad AO2.<p>El proyecto Attorney Online novela visual en red tiene copyright (c) 2016-2020 Attorney Online developers. Se aplican licencias de código abierto. Todos los demás activos son propiedad de sus respectivos dueños.<p>Usando Qt versión %2 con el motor de audio %3.<p>Compilado el %4 - + About - + Acerca de <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, 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 @@ -1531,7 +1543,7 @@ Did you download all resources correctly from tiny.cc/getao, including the large has played a song: - + ha comenzado a reproducir la canción: @@ -1549,7 +1561,7 @@ Did you download all resources correctly from tiny.cc/getao, including the large 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. + In spanish it would be "Aviso", but I believe it's going to be more useful for bug reports to not translate any debug strings. -- cgit From 8639dc2f6116915b51d6a2adfe5111f81bd3612f Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Tue, 14 Jul 2020 20:46:57 -0600 Subject: Finished updating the Spanish translation. --- resource/translations/ao_es.qm | Bin 28457 -> 47340 bytes resource/translations/ao_es.ts | 218 +++++++++++++++++++++-------------------- 2 files changed, 114 insertions(+), 104 deletions(-) diff --git a/resource/translations/ao_es.qm b/resource/translations/ao_es.qm index 42ca3a00..0aefb491 100644 Binary files a/resource/translations/ao_es.qm and b/resource/translations/ao_es.qm differ diff --git a/resource/translations/ao_es.ts b/resource/translations/ao_es.ts index d25c145a..7966a17e 100644 --- a/resource/translations/ao_es.ts +++ b/resource/translations/ao_es.ts @@ -368,97 +368,97 @@ Razón: - Keep current setting - - Mantener la configuración actual + - Mantener la configuración actual Allow Screenshake: - Permitir Screenshake: + Permitir screenshake: Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. - Permite el movimiento de la pantalla (Advertencia esto podría inducir convulsiones debido a imágenes parpadeantes). + Permite el movimiento de la pantalla (Advertencia esto podría inducir convulsiones debido a imágenes parpadeantes). Allow Effects: - Permitir efectos: + Permitir efectos: Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. - Permite efectos de pantalla (Advertencia esto podría inducir convulsiones debido a imágenes parpadeantes). + Permite efectos de pantalla (Advertencia esto podría inducir convulsiones debido a imágenes parpadeantes). Network Frame Effects: - Efectos de marco de red: + Enviar efectos al servidor: Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. - Envíe temblores de pantalla, destellos y sonidos como se define en char.ini a través de la red. Solo funciona para servidores que admiten esta funcionalidad. + Envíe temblores de pantalla, destellos y sonidos como se define en char.ini a través de la red. Solo funciona para servidores que admiten esta funcionalidad. Colors in IC Log: - Colores en el registro IC: + Colores en el registro IC: Use the markup colors in the server IC chatlog. - Permite colores en el chat IC del servidor. + Permite colores en el chat IC del servidor. Sticky Sounds: - Sonidos pegajosos: + Mantener sonidos: Turn this on to prevent the sound dropdown from clearing the sound after playing it. - Actívelo para evitar que el menú desplegable de sonido borre el sonido después de reproducirlo. + Actívelo para evitar que el menú desplegable de sonido borre el sonido después de reproducirlo. Sticky Effects: - Efectos pegajosos: + Mantener efectos: Turn this on to prevent the effects dropdown from clearing the effect after playing it. - Actívelo para evitar que el menú desplegable de efectos elimine el efecto después de reproducirlo. + Actívelo para evitar que el menú desplegable de efectos elimine el efecto después de reproducirlo. Sticky Preanims: - Preanims pegajosos: + Mantener preanims: Turn this on to prevent preanimation checkbox from clearing after playing the emote. - Actívelo para evitar que la casilla preanimation se desactive después de reproducir el emote. + Actívelo para evitar que la casilla preanimation se desactive después de reproducir el emote. Custom Chatboxes: - Chatboxes personalizados: + Chatboxes personalizados: Turn this on to allow characters to define their own custom chat box designs. - Actívelo para permitir que los personajes definan sus propios diseños de cuadros de chat personalizados. + Actívelo para permitir que los personajes definan sus propios diseños de cuadros de chat personalizados. Play a blip sound "once per every X symbols", where X is the blip rate. - Reproduzca un sonido de blip "una vez por cada X símbolos", donde X es la tasa de blip. + Reproduce un sonido de blip "una vez por cada X símbolos", donde X es la tasa de blip. If true, AO2 will stop the music for you when you or someone else does 'Objection!'. - Si es activado, AO2 detendrá la música por ti cuando tú u otra persona hagan '¡Objeción!'. + Si es activado, AO2 detendrá la música por ti cuando tú u otra persona hagan '¡Objeción!'. @@ -829,109 +829,114 @@ Razón: None - + Nada Additive - Aditivo + Aditivo To front - + Al frente To behind - + Al fondo Select a character you wish to pair with. - + Seleccione un personaje con el que desee emparejarse. Change the percentage offset of your character's position from the center of the screen. - Cambia el desplazamiento porcentual de la posición de tu personaje desde el centro de la pantalla. + Cambia el desplazamiento porcentual de la posición de tu personaje desde el centro de la pantalla. Change the order of appearance for your character. - Cambia el orden de aparición de tu personaje. + Cambia el orden de aparición de tu personaje. Display the list of characters to pair with. - + Muestra la lista de personajes para emparejar. Oops, you're muted! - + ¡Ups, estas silenciado! Set your character's emote to play on your next message. - + Configura el emote de tu personaje para usar en tu próximo mensaje. Set your character's supplementary background. - + Establece el fondo suplementario de tu personaje. Set an 'iniswap', or an alternative character folder to refer to from your current character. Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/iniswaps.ini - + Establece un 'iniswap', o una carpeta de caracteres alternativa para consultar desde su personaje actual. +Edite escribiendo y presionando Enter, [X] para eliminar. Esto es guardado en base/characters/<charname>/iniswaps.ini Remove the currently selected iniswap from the list and return to the original character folder. - + Elimina el iniswap seleccionado actualmente de la lista y regresa a la carpeta de caracteres original. Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any). Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/soundlist.ini - + Establece un efecto de sonido para jugar en su próximo 'Preanim'. Dejarlo en Predeterminado usará el sonido definido por emoticones (si hay). +Edite escribiendo y presionando Enter, [X] para eliminar. Esto es guardado en base/characters/<charname>/iniswaps.ini Choose an effect to play on your next spoken message. The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by char.ini [Options] category, effects = 'miscname' where it referes to misc/<miscname>/effects.ini to read the effects. - + Elije un efecto para reproducir en su próximo mensaje hablado. +Los efectos se definen en theme/effects/effects.ini. Tu personaje puede definir efectos personalizados por +char.ini [Opciones] categoría, effects = 'miscname' donde se refiere a misc/<miscname>/effects.ini para leer los efectos. Hold It! - + ¡Un Momento! When this is turned on, your next in-character message will be a shout! - + Why the exclamation? + Cuando esto es activado, tu próximo mensaje del personaje será un grito. Objection! - + ¡Objeción! Take That! - + ¡Toma Eso! Toggle between server chat and global AO2 chat. - + Alternar entre el chat del servidor y el chat global. @@ -939,151 +944,153 @@ char.ini [Options] category, effects = 'miscname' where it referes to This will display the animation in the viewport as soon as it is pressed. - + Esto mostrará la animación en el viewport tan pronto como se presione. Guilty! - + ¡Culpable! Bring up the Character Select Screen and change your character. - Abre la pantalla de selección de personaje y cambia tu personaje. + Abre la pantalla de selección de personaje y cambia tu personaje. Refresh the theme and update all of the ui elements to match. - + Actualiza el tema y todos los elementos de la interfaz de usuario para que coincidan. Request the attention of the current server's moderator. - + Solicite la atención del moderador actual del servidor. Allows you to change various aspects of the client. - Le permite cambiar varios aspectos del cliente. + Le permite cambiar varios aspectos del cliente. An interface to help you announce a case (you have to be a CM first to be able to announce cases) - Una interfaz para ayudarlo a anunciar un caso (debe ser un CM para poder anunciar casos) + Una interfaz para ayudarlo a anunciar un caso (debe ser un CM para poder anunciar casos) Switch between Areas and Music lists - + Cambiar entre áreas y listas de música Play a single-shot animation as defined by the emote when checked. - + Reproduzca una animación de un solo disparo según lo definido por el emote cuando esté marcado. If preanim is checked, display the input text immediately as the animation plays concurrently. - + Si se marca preanim, muestre el texto de entrada inmediatamente mientras la animación se reproduce simultáneamente. Mirror your character's emotes when checked. - + Refleja los gestos de tu personaje cuando esté marcado. Add text to your last spoken message when checked. - Agregue texto a su último mensaje hablado cuando esté marcado. + Agregue texto a su último mensaje hablado cuando esté marcado. Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window. - + No escucha llamadas de moderación cuando esté marcado, evitando que reproduzcan sonidos o centrando la atención en la ventana. Lets you receive case alerts when enabled. (You can set your preferences in the Settings!) - + Le permite recibir alertas de casos cuando está habilitado. +(¡Puedes configurar tus preferencias en la Configuración!) Display customized shownames for all users when checked. - Mostrar nombres personalizados para todos los usuarios cuando esté marcado. + Mostrar nombres personalizados para todos los usuarios cuando esté marcado. Custom Shout! - ¡Grito personalizado! + ¡Grito personalizado! This will display the custom character-defined animation in the viewport as soon as it is pressed. To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect - + Esto mostrará la animación de personaje personalizada definida en el viewport tan pronto como se presione. +Para hacer una, la carpeta de tu personaje debe contener efectos personalizados [webp/apng/gif/png]. y efectos [wav/ogg/opus] personalizados de sonido Play realization sound and animation in the viewport on the next spoken message when checked. - + Reproduzca sonido y animación de realización en la ventana gráfica en el siguiente mensaje hablado cuando esté marcado. Shake the screen on next spoken message when checked. - + Agite la pantalla en el siguiente mensaje hablado cuando esté marcado. Display the list of character folders you wish to mute. - Muestra la lista de carpetas de caracteres que desea silenciar. + Muestra la lista de carpetas de caracteres que desea silenciar. Increase the health bar. - + Aumenta la barra de salud. Decrease the health bar. - Disminuye la barra de salud. + Disminuye la barra de salud. Change the text color of the spoken message. You can also select a part of your currently typed message and use the dropdown to change its color! - Cambia el color del texto en el chat IC. + Cambia el color del texto en el chat IC. ¡También puede seleccionar una parte de su mensaje escrito actualmente y usar el menú desplegable para cambiar su color! Return back to the server list. - + Regresa a la lista de servidores. Become a spectator. You won't be able to interact with the in-character screen. - Conviértete en espectador. No podrás interactuar con la pantalla del personaje. + Conviértete en espectador. No podrás interactuar con la pantalla del personaje. CLIENT - + has played a song - + ha reproducido la canción You will now pair up with %1 if they also choose your character in return. - + Ahora se emparejará con %1 si también eligen a su personaje. @@ -1168,7 +1175,7 @@ Casos que puede cargar: %1 UNKNOWN - + @@ -1178,32 +1185,32 @@ Casos que puede cargar: %1 Expand All Categories - + Expandir todas las categorías Collapse All Categories - Contraer todas las categorías + Contraer todas las categorías Fade Out Previous - + Desvanecerse Anterior Fade In - + Fundirse Synchronize - + Sincronizar Default - Predeterminado + Predeterminado 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. @@ -1309,81 +1316,81 @@ Casos que puede cargar: Present this piece of evidence to everyone on your next spoken message - + Presente esta evidencia a todos en su próximo mensaje hablado Save evidence to an .ini file. - + Guardar evidencia en un archivo .ini. Load evidence from an .ini file. - + Cargar evidencia de un archivo .ini. Destroy this piece of evidence - Destruye esta evidencia + Destruye esta evidencia Choose.. - Elegir.. + Elegir.. Close the evidence display/editing overlay. You will be prompted if there's any unsaved changes. - Cierra la superposición para visualizar/editar evidencia. + Cierra la superposición para visualizar/editar evidencia. Se le preguntará si hay cambios no guardados. Save any changes made to this piece of evidence and send them to server. - + Guardar los cambios realizados en esta evidencia y enviarlos al servidor. Double-click to edit. Press [X] to update your changes. - + Doble click para editar. Presione [X] para actualizar sus cambios. Bring up the Evidence screen. - Abre la ventana para evidencia. + Abre la ventana para evidencia. Switch evidence to private inventory. - + Cambiar la evidencia al inventario privado. Switch evidence to global inventory. - + Cambiar la evidencia al inventario global. Transfer evidence to private inventory. - + Transferir evidencia al inventario privado. Transfer evidence to global inventory. - + Transferir evidencia al inventario global. The piece of evidence you've been editing has changed. - + La evidencia que has estado editando ha cambiado. Do you wish to keep your changes? - + ¿Desea conservar sus cambios? @@ -1391,7 +1398,10 @@ Se le preguntará si hay cambios no guardados. Image: %2 Description: %3 - + Nombre: %1 +Imagen: %2 +Descripción: +%3 @@ -1403,7 +1413,7 @@ Description: Double-click to edit... - + Doble click para editar... @@ -1413,43 +1423,43 @@ Description: Evidence has been modified. - + La evidencia ha sido modificada. Do you want to save your changes? - + ¿Quieres guardar tus cambios? Current evidence is global. Click to switch to private. - La evidencia actual es global. Haga clic para cambiar a privado. + La evidencia actual es global. Haga clic para cambiar a privado. Current evidence is private. Click to switch to global. - La evidencia actual es privada. Haga clic para cambiar a global. + La evidencia actual es privada. Haga clic para cambiar a global. "%1" has been transferred. - "%1" ha sido transferido. + "%1" ha sido transferido. Save Inventory - + Guardar inventario Ini Files (*.ini) - + Archivos Ini (*.ini) Open Inventory - + Abrir el inventario @@ -1489,7 +1499,7 @@ Did you download all resources correctly from tiny.cc/getao, including the large Allows you to change various aspects of the client. - Le permite cambiar varios aspectos del cliente. + Le permite cambiar varios aspectos del cliente. @@ -1504,12 +1514,12 @@ Did you download all resources correctly from tiny.cc/getao, including the large <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, Crystalwarrior, Iamgoofball<p><b>Client development:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>QA testing:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Special thanks:</b><br>CrazyJC and MaximumVolty (2.8 release); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); server hosts, game masters, case makers, content creators, and the whole AO2 community!<p>The Attorney Online networked visual novel project is copyright (c) 2016-2020 Attorney Online developers. Open-source licenses apply. All other assets are the property of their respective owners.<p>Running on Qt version %2 with the %3 audio engine.<p>Built on %4 - <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, Crystalwarrior, Iamgoofball<p><b>Desarrollo del cliente:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>Prueba de control de calidad:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Agradecimiento especial:</b><br>CrazyJC y MaximumVolty (versión 2.8); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, y FanatSors (AO1); server hosts, game masters, case makers, creadores de contenido y toda la comunidad AO2.<p>El proyecto Attorney Online novela visual en red tiene copyright (c) 2016-2020 Attorney Online developers. Se aplican licencias de código abierto. Todos los demás activos son propiedad de sus respectivos dueños.<p>Usando Qt versión %2 con el motor de audio %3.<p>Compilado el %4 + <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, Crystalwarrior, Iamgoofball<p><b>Desarrollo del cliente:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>Prueba de control de calidad:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Agradecimiento especial:</b><br>CrazyJC y MaximumVolty (versión 2.8); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, y FanatSors (AO1); server hosts, game masters, case makers, creadores de contenido y toda la comunidad AO2.<p>El proyecto Attorney Online novela visual en red tiene copyright (c) 2016-2020 Attorney Online developers. Se aplican licencias de código abierto. Todos los demás activos son propiedad de sus respectivos dueños.<p>Usando Qt versión %2 con el motor de audio %3.<p>Compilado el %4 About - Acerca de + Acerca de <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 @@ -1538,12 +1548,12 @@ Did you download all resources correctly from tiny.cc/getao, including the large UNKNOWN - + has played a song: - ha comenzado a reproducir la canción: + ha comenzado a reproducir la canción: -- cgit From 4be472f36006443b8f66491c44d8ced3f457706c Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Wed, 15 Jul 2020 18:16:21 -0600 Subject: Update Portuguese translation. (Needs review) --- resource/translations/ao_pt.qm | Bin 28605 -> 47036 bytes resource/translations/ao_pt.ts | 516 +++++++++++++++++++++-------------------- 2 files changed, 269 insertions(+), 247 deletions(-) diff --git a/resource/translations/ao_pt.qm b/resource/translations/ao_pt.qm index 242917ff..6e443792 100644 Binary files a/resource/translations/ao_pt.qm and b/resource/translations/ao_pt.qm differ diff --git a/resource/translations/ao_pt.ts b/resource/translations/ao_pt.ts index 7a69475c..2b2a0044 100644 --- a/resource/translations/ao_pt.ts +++ b/resource/translations/ao_pt.ts @@ -30,58 +30,58 @@ Acesse aceattorneyonline.com para atualizar. You have been exiled from AO. Have a nice day. - Você foi exilado do Attorney Online. + 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. @@ -127,7 +127,7 @@ Motivo: %1 Witness needed - Precisa-se de Testemunha + Precisa-se de Testemunha @@ -192,7 +192,7 @@ Motivo: %1 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 personagens. @@ -216,11 +216,11 @@ Motivo: %1 Allow Shake/Flash: - Permitir 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. + Permite agitar e piscar. Desative isso se você tiver preocupações ou problemas com fotosensibilidade e/ou convulsões. @@ -234,342 +234,352 @@ Motivo: %1 Punctuation delay modifier. Enable it for the blips to slow down on punctuations. - Habilite para adicionar uma pequena pausa nos sinais de pontuação. + 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: - + 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. + 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: + 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. + A velocidade do texto será a mesma dos jogos AA. Blip delay on punctuations: - Atraso na pontuação: + Atraso na pontuação: Sets the default volume for music. - Define o volume padrão da música. + 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. + 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. + Se ativado, o jogo interrompe a música quando alguém protestar , como nos jogos reais. - Keep current setting - + - Mantenha as configurações atuais Allow Screenshake: - + Permitir screenshake: Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. - + Permite o tremor de tela (AVISO: Pode causar convulsões devido à imagens tremidas). Allow Effects: - + Permitir efeitos: Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. - + Permite efeitos de tela (AVISO: Pode causar convulsões devido à imagens tremidas).. Network Frame Effects: - + Envie efeitos para o servidor: Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. - + Envie vibrações, flashes e sons na tela, conforme definido no char.ini pela rede. Funciona apenas para servidores que suportam essa funcionalidade. Colors in IC Log: - + Cores no Log IC: Use the markup colors in the server IC chatlog. - + Permitir cores no chat do IC no servidor. Sticky Sounds: - + Manter sons: Turn this on to prevent the sound dropdown from clearing the sound after playing it. - + Marque para evitar que o som do menu suspenso apague o som após a reprodução. Sticky Effects: - + Manter efeitos: Turn this on to prevent the effects dropdown from clearing the effect after playing it. - + Ative-o para impedir que o menu suspenso de efeito exclua o efeito após reproduzi-lo. Sticky Preanims: - + Manter preanims: Turn this on to prevent preanimation checkbox from clearing after playing the emote. - + Ative-o para impedir que a caixa de seleção de pré-animação seja desmarcada após a execução do emote. + + + + Custom Chatboxes: + Caixas de bate-papo personalizadas: - + + Turn this on to allow characters to define their own custom chat box designs. + Ative isso para permitir que os personagens tenham as suas próprias caixas de bate-papo personalizadas. + + + Play a blip sound "once per every X symbols", where X is the blip rate. - + Reproduz um som de blip "uma vez para cada símbolo X", em que X é a taxa de blip. - + If true, AO2 will stop the music for you when you or someone else does 'Objection!'. - + Se ativado, o AO2 interromperá a música quando você ou outra pessoa fizer uma 'Protesto!'. - + 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: + Testemunha: If checked, you will appear amongst the potential witnesses on the server. - Se marcado, você aparecerá entre as testemunhas em potencial no servidor. + 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. Colorful IC log: - Log IC colorido: + Log IC colorido: Enables colored text in the log. - Ativa o texto colorido no log. + Ativa o texto colorido no log. Only inline coloring: - Somente coloração em linha: + Somente coloração em linha: Only inline coloring will be shown such as <>,|| etc. - Somente a coloração em linha será mostrada como <>, ||, etc. + Somente a coloração em linha será mostrada como <>, ||, etc. Mirror IC log: - O log IC reflete interrupções: + 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. + 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. @@ -602,14 +612,15 @@ Motivo: %1 Em uso - + Generating chars: %1/%2 - + Gerando personagens: +%1/%2 Could not find %1 - Não foi possível encontrar %1 + Não foi possível encontrar %1 @@ -624,7 +635,7 @@ Motivo: %1 OOC Message - Mensagem OOC + Mensagem OOC @@ -664,39 +675,39 @@ Motivo: %1 White - Branco + Branco Green - Verde + Verde Red - Vermelho + Vermelho Orange - Laranja + Laranja Blue - Azul + Azul Yellow - Amarelo + Amarelo Rainbow - Arco Iris + Arco Iris Pink - Rosa + Rosa Cyan - Ciano + Ciano @@ -720,7 +731,7 @@ Motivo: %1 - + Server @@ -766,138 +777,142 @@ Motivo: %1 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ê. + 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 + Agora você vai fazer par com if they also choose your character in return. - se eles também escolherem seu personagem em troca. + se eles também escolherem seu personagem em troca. None - + Nada Guard - + Guarda Additive - + Aditivo To front - + Para frente To behind - + Ao fundo Select a character you wish to pair with. - + Selecione um personagem com o qual deseja parear. Change the percentage offset of your character's position from the center of the screen. - + Altere o deslocamento percentual da posição do seu personagem no centro da tela. Change the order of appearance for your character. - + Mude a ordem de aparência do seu personagem. Display the list of characters to pair with. - + Exibe a lista de caracteres para corresponder. Oops, you're muted! - + Opa, você está mudo! Set your character's emote to play on your next message. - + Defina o emote do seu personagem para usar na próxima mensagem. Set your character's supplementary background. - + Defina o plano de fundo suplementar para o seu personagem. Set an 'iniswap', or an alternative character folder to refer to from your current character. Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/iniswaps.ini - + Defina um 'iniswap' ou uma pasta de caracteres alternativa para consultar seu personagem atual. +Edite digitando e pressionando Enter, [X] para excluir. Isso é salvo em base/characters/<charname>/iniswaps.ini Remove the currently selected iniswap from the list and return to the original character folder. - + Remova o iniswap atualmente selecionado da lista e retorne à pasta de caracteres original. Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any). Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/soundlist.ini - + Configure um efeito sonoro para tocar no seu próximo 'Preanim'. Deixá-lo no padrão usará o som definido pelos emoticons (caso existam). +Edite digitando e pressionando Enter, [X] para excluir. Isso é salvo em base/characters/<charname>/soundlist.ini Choose an effect to play on your next spoken message. The effects are defined in your theme/effects/effects.ini. Your character can define custom effects by char.ini [Options] category, effects = 'miscname' where it referes to misc/<miscname>/effects.ini to read the effects. - + Escolha um efeito para reproduzir na sua próxima mensagem falada. +Os efeitos são definidos em theme / effects / effects.ini. Seu personagem pode definir efeitos personalizados ao +categoria char.ini [Opções], effects = 'miscname', onde se refere a misc/<miscname>/effects.ini to read the effects. Hold It! - + Um momento! When this is turned on, your next in-character message will be a shout! - + Quando isso estiver ativado, sua próxima mensagem do personagem será um grito. Objection! - + Protesto! Take That! - + Tome isso! Toggle between server chat and global AO2 chat. - + Alterne entre o bate-papo do servidor e o global. @@ -905,412 +920,416 @@ char.ini [Options] category, effects = 'miscname' where it referes to This will display the animation in the viewport as soon as it is pressed. - + Isso exibirá a animação na janela de visualização assim que for pressionada. Guilty! - + Culpado! Bring up the Character Select Screen and change your character. - + Abra a tela de seleção de personagem e mude seu personagem. Refresh the theme and update all of the ui elements to match. - + Atualize o tema e todos os elementos da interface do usuário para corresponder. Request the attention of the current server's moderator. - + Solicite a atenção do moderador do servidor atual. Allows you to change various aspects of the client. - + Permite alterar vários aspectos do cliente. An interface to help you announce a case (you have to be a CM first to be able to announce cases) - + Uma interface para ajudá-lo a anunciar um caso (deve ser um CM para poder anunciar casos) Switch between Areas and Music lists - + Alterne entre áreas e listas de músicas Play a single-shot animation as defined by the emote when checked. - + Reproduza uma animação de tiro único, conforme definido pelo emote, quando marcada. If preanim is checked, display the input text immediately as the animation plays concurrently. - + Se pré-impressão estiver marcada, exiba o texto de entrada imediatamente enquanto a animação estiver sendo reproduzida simultaneamente. Mirror your character's emotes when checked. - + Reflita os gestos do seu personagem quando marcado. Add text to your last spoken message when checked. - + Adicione texto à sua última mensagem falada quando marcado. Do not listen to mod calls when checked, preventing them from playing sounds or focusing attention on the window. - + Você não ouve chamadas de moderação quando marcado, impedindo-os de tocar sons ou concentrando a atenção na janela. Lets you receive case alerts when enabled. (You can set your preferences in the Settings!) - + Permite que você receba alertas de caso quando ativado. +(Você pode configurar suas preferências em Configurações!) Display customized shownames for all users when checked. - + Mostrar nomes personalizados para todos os usuários quando marcado. Custom Shout! - + Grito personalizado! This will display the custom character-defined animation in the viewport as soon as it is pressed. To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect - + Isso exibirá a animação de caracteres personalizados definida na viewport assim que for pressionada. +Para criar uma, a pasta do seu personagem deve conter efeitos personalizados [webp/apng/gif/png]. E efeitos sonoros personalizados [wav/ogg/opus] Play realization sound and animation in the viewport on the next spoken message when checked. - + Tocar animação de som e performance na janela de desenho na seguinte mensagem falada quando marcada. Shake the screen on next spoken message when checked. - + Agite a tela na próxima mensagem falada quando marcada. Display the list of character folders you wish to mute. - + Exibe a lista de pastas de caracteres que você deseja silenciar. Increase the health bar. - + Aumente a barra de saúde. Decrease the health bar. - + Abaixe a barra de saúde. Change the text color of the spoken message. You can also select a part of your currently typed message and use the dropdown to change its color! - + Mude a cor do texto no chat IC. +Você também pode selecionar uma parte da sua mensagem escrita no momento e usar o menu suspenso para alterar sua cor! Return back to the server list. - + Retorne à lista de servidores. Become a spectator. You won't be able to interact with the in-character screen. - + Torne-se um espectador. Você não poderá interagir com a tela do personagem. - + CLIENT - + - - - + + + has played a song - + tocou a música - + You will now pair up with %1 if they also choose your character in return. - + Agora você será emparelhado com %1 se também escolher seu personagem. - + 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. - - + + UNKNOWN - + - + 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. + 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. + 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 - + Expand All Categories - + Expandir todas as categorias - + Collapse All Categories - + Recolher todas as categorias - + Fade Out Previous - + Fade Anterior - + Fade In - + Aparecimento gradual - + Synchronize - + Sincronizar - + Default - + Predeterminado - + 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. Choose... - Escolha... + Escolha... Present this piece of evidence to everyone on your next spoken message - + Apresente essa evidência a todos na sua próxima mensagem falada Save evidence to an .ini file. - + Salve evidências em um arquivo .ini. Load evidence from an .ini file. - + Carregar evidências de um arquivo .ini. Destroy this piece of evidence - + Destrua esta evidência Choose.. - + Escolher.. Close the evidence display/editing overlay. You will be prompted if there's any unsaved changes. - + Feche a sobreposição para visualizar/editar evidências. +Você será perguntado se existem alterações não salvas. Save any changes made to this piece of evidence and send them to server. - + Salve as alterações feitas nesta evidência e envie-as para o servidor. Double-click to edit. Press [X] to update your changes. - + Clique duas vezes para editar. Pressione [X] para atualizar suas alterações. Bring up the Evidence screen. - + Abra a tela para obter evidências. Switch evidence to private inventory. - + Alterar evidência para inventário privado. Switch evidence to global inventory. - + Mude a evidência para o inventário global. Transfer evidence to private inventory. - + Transfira evidências para o inventário privado. Transfer evidence to global inventory. - + Transfira evidências para o inventário global. The piece of evidence you've been editing has changed. - + A evidência que você está editando mudou. Do you wish to keep your changes? - + Deseja manter suas alterações? @@ -1318,7 +1337,10 @@ You will be prompted if there's any unsaved changes. Image: %2 Description: %3 - + Nome: %1 +Imagem: %2 +Descrição: +%3 @@ -1330,7 +1352,7 @@ Description: Double-click to edit... - + Clique duas vezes para editar... @@ -1340,43 +1362,43 @@ Description: Evidence has been modified. - + A evidência foi modificada. Do you want to save your changes? - + ¿Quieres guardar tus cambios? Current evidence is global. Click to switch to private. - + A evidência atual é global. Clique para mudar para privado. Current evidence is private. Click to switch to global. - + A evidência atual é privada. Clique para mudar para global. "%1" has been transferred. - + "%1" foi transferido. Save Inventory - + Salvar inventário Ini Files (*.ini) - + Arquivos INI (* .ini) Open Inventory - + Abrir inventário @@ -1389,7 +1411,7 @@ Description: Search - Pesquisar + Pesquisar @@ -1411,16 +1433,16 @@ Você baixou todos os recursos corretamente do tiny.cc/getao, incluindo a grande Settings - Configurações + Configurações Allows you to change various aspects of the client. - + Permite alterar vários aspectos do cliente. - + Offline Offline @@ -1435,25 +1457,25 @@ Você baixou todos os recursos corretamente do tiny.cc/getao, incluindo a grande 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>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! - + + <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, Crystalwarrior, Iamgoofball<p><b>Client development:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>QA testing:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Special thanks:</b><br>CrazyJC and MaximumVolty (2.8 release); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); server hosts, game masters, case makers, content creators, and the whole AO2 community!<p>The Attorney Online networked visual novel project is copyright (c) 2016-2020 Attorney Online developers. Open-source licenses apply. All other assets are the property of their respective owners.<p>Running on Qt version %2 with the %3 audio engine.<p>Built on %4 + <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, Crystalwarrior, Iamgoofball<p><b>Desenvolvimento de cliente:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>Teste de controle de qualidade:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Agradecimentos especiais:</b><br>CrazyJC y MaximumVolty (versão 2.8); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, y FanatSors (AO1); server hosts, game masters, case makers, criadores de conteúdo e toda a comunidade AO2.<p>O projeto Attorney Online possui direitos autorais (c) 2016-2020 Attorney Online developers. Aplicam-se licenças de código aberto. Todos os outros ativos são de propriedade de seus respectivos proprietários.<p>Usando a versão Qt %2 com o mecanismo de áudio %3.<p>Compilado em %4 - + About - + Sobre <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, 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 @@ -1465,12 +1487,12 @@ Você baixou todos os recursos corretamente do tiny.cc/getao, incluindo a grande UNKNOWN - + has played a song: - + tocou a música: -- cgit From e6b0b2e318996ad1a90bd122ca903261097e7f49 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Wed, 15 Jul 2020 18:17:04 -0600 Subject: Small changes to the Spanish translation. --- resource/translations/ao_es.qm | Bin 47340 -> 47352 bytes resource/translations/ao_es.ts | 14 +++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/resource/translations/ao_es.qm b/resource/translations/ao_es.qm index 0aefb491..63520815 100644 Binary files a/resource/translations/ao_es.qm and b/resource/translations/ao_es.qm differ diff --git a/resource/translations/ao_es.ts b/resource/translations/ao_es.ts index 7966a17e..f8ba7148 100644 --- a/resource/translations/ao_es.ts +++ b/resource/translations/ao_es.ts @@ -378,7 +378,7 @@ Razón: Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. - Permite el movimiento de la pantalla (Advertencia esto podría inducir convulsiones debido a imágenes parpadeantes). + Permite el movimiento de la pantalla (ADVERTENCIA: esto podría inducir convulsiones debido a imágenes parpadeantes). @@ -388,7 +388,7 @@ Razón: Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. - Permite efectos de pantalla (Advertencia esto podría inducir convulsiones debido a imágenes parpadeantes). + Permite efectos de pantalla (ADVERTENCIA: esto podría inducir convulsiones debido a imágenes parpadeantes). @@ -458,7 +458,7 @@ Razón: If true, AO2 will stop the music for you when you or someone else does 'Objection!'. - Si es activado, AO2 detendrá la música por ti cuando tú u otra persona hagan '¡Objeción!'. + Si es activado, AO2 detendrá la música por ti cuando tú u otra persona hagan un '¡Protesto!'. @@ -926,7 +926,7 @@ char.ini [Opciones] categoría, effects = 'miscname' donde se refiere Objection! - ¡Objeción! + ¡Protesto! @@ -999,7 +999,7 @@ char.ini [Opciones] categoría, effects = 'miscname' donde se refiere Add text to your last spoken message when checked. - Agregue texto a su último mensaje hablado cuando esté marcado. + Agregar texto a su último mensaje hablado cuando esté marcado. @@ -1028,7 +1028,7 @@ char.ini [Opciones] categoría, effects = 'miscname' donde se refiere This will display the custom character-defined animation in the viewport as soon as it is pressed. To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect Esto mostrará la animación de personaje personalizada definida en el viewport tan pronto como se presione. -Para hacer una, la carpeta de tu personaje debe contener efectos personalizados [webp/apng/gif/png]. y efectos [wav/ogg/opus] personalizados de sonido +Para hacer una, la carpeta de tu personaje debe contener efectos personalizados [webp/apng/gif/png]. Y efectos personalizados de sonido [wav/ogg/opus] @@ -1067,7 +1067,7 @@ You can also select a part of your currently typed message and use the dropdown Return back to the server list. - Regresa a la lista de servidores. + Regresar a la lista de servidores. -- cgit From bcbc48f9b055e7bd6960fdc7b028e8bf6b14863c Mon Sep 17 00:00:00 2001 From: sD Date: Wed, 22 Jul 2020 20:55:08 +0200 Subject: fix mac builds, opus lib path was wrong --- scripts/macos_post_build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/macos_post_build.sh b/scripts/macos_post_build.sh index cdf7514b..2ed73649 100755 --- a/scripts/macos_post_build.sh +++ b/scripts/macos_post_build.sh @@ -20,5 +20,6 @@ cp ../lib/* ../bin/Attorney_Online.app/Contents/Frameworks # libbass has a funny path for some reason, just use rpath install_name_tool -change @loader_path/libbass.dylib @rpath/libbass.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online +install_name_tool -change @loader_path/libbassopus.dylib @rpath/libbassopus.dylib ../bin/Attorney_Online.app/Contents/MacOS/Attorney_Online zip -r -9 ../bin/Attorney_Online_macOS.zip ../bin/ \ No newline at end of file -- cgit From b2a5f517d979361c5f04182e602155ed4e6439e1 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 23 Jul 2020 20:28:53 +0300 Subject: Add showname alignment option for theme makers (#189) * Add alignment options for shownames * Make shownames align to the left by default like before * Use this branch as an opportunity to fix showname not being resized according to misc/ folder courtroom_design.ini --- src/courtroom.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index effef543..943a8f8d 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -84,7 +84,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_vp_chatbox = new AOImage(this, ao_app); ui_vp_showname = new QLabel(ui_vp_chatbox); - ui_vp_showname->setAlignment(Qt::AlignHCenter); + ui_vp_showname->setAlignment(Qt::AlignLeft); ui_vp_chat_arrow = new AOMovie(ui_vp_chatbox, ao_app); ui_vp_chat_arrow->set_play_once(false); @@ -1873,7 +1873,7 @@ void Courtroom::handle_chatmessage_2() { ui_vp_chatbox->set_image("chatblank"); } - else // Aw yeah dude do some showname resizing magic + else // Aw yeah dude do some showname magic { if (!ui_vp_chatbox->set_image("chat")) ui_vp_chatbox->set_image("chatbox"); @@ -1913,6 +1913,19 @@ void Courtroom::handle_chatmessage_2() ->get_design_element("showname_extra_width", "courtroom_design.ini", customchar) .toInt(); + QString align = + ao_app + ->get_design_element("showname_align", "courtroom_design.ini", + customchar) + .toLower(); + if (align == "right") + ui_vp_showname->setAlignment(Qt::AlignRight); + else if (align == "center") + ui_vp_showname->setAlignment(Qt::AlignHCenter); + else if (align == "justify") + ui_vp_showname->setAlignment(Qt::AlignHCenter); + else + ui_vp_showname->setAlignment(Qt::AlignLeft); if (extra_width > 0) { if (fm_width > default_width.width && @@ -1934,6 +1947,10 @@ void Courtroom::handle_chatmessage_2() else ui_vp_showname->resize(default_width.width, ui_vp_showname->height()); } + else + { + ui_vp_showname->resize(default_width.width, ui_vp_showname->height()); + } } ui_vp_message->hide(); -- cgit From 29f0e06bc80428a753f6c67012637e914fbe295a Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 23 Jul 2020 20:32:34 +0300 Subject: Make 'FL' packet reset settings to default and take the new settings in (#186) * Fix colors in ic logs not parsing HTML properly when log_goes_downwards=false and colorlog=true * Restore KFO branding * Reset the settings values when receiving the 'FL' packet. This allows enabling/disabling features at runtime, such as ARUP system. * Revert "Restore KFO branding" This reverts commit 7f19b6257a0d75ec1d392b9b8c02a384c8dba43d. --- src/packet_distribution.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 670dab44..669b9541 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -176,6 +176,21 @@ void AOApplication::server_packet_received(AOPacket *p_packet) } } else if (header == "FL") { +// 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; + additive_enabled = false; + effects_enabled = false; if (f_packet.contains("yellowtext", Qt::CaseInsensitive)) yellow_text_enabled = true; if (f_packet.contains("prezoom", Qt::CaseInsensitive)) -- cgit From e84426ae8df870d7f7f9a86fbe9ff6beddf346b3 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 24 Jul 2020 18:39:22 +0300 Subject: Credits corrected for CrazyJC and MaximumVolty involvement in 2.8 --- src/lobby.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lobby.cpp b/src/lobby.cpp index 3d47416b..92878114 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -378,7 +378,7 @@ void Lobby::on_about_clicked() "Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, " "Veritas, Wiso" "

Special thanks:
" - "CrazyJC and MaximumVolty (2.8 release); " + "CrazyJC (2.8 release director) and MaximumVolty (2.8 release promotion); " "Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); " "Rue (website); Draxirch (UI design); " "Lewdton and Argoneus (tsuserver); " -- cgit From 154ba64f4acfdbec4d9f32f2f35d18b0a27e0cb2 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sat, 25 Jul 2020 19:31:36 +0300 Subject: Fix max_colors allowing +1 more than the actual max --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index effef543..b5a4fb58 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1591,7 +1591,7 @@ void Courtroom::on_chat_return_pressed() if (text_color < 0) f_text_color = "0"; - else if (text_color > max_colors) + else if (text_color >= max_colors) f_text_color = "0"; else f_text_color = QString::number(text_color); -- cgit From c423a5ee5621a4cc386cb6c7147ec7e010db32de Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 26 Jul 2020 19:21:58 +0300 Subject: Make music 'fade out previous' an effect enabled by default (#196) Simply make the "FADE_OUT" music effect flag by default so more users experience the SMOOTH FADE OUT magic by accident and praise the based client. --- include/courtroom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/courtroom.h b/include/courtroom.h index 259a7ed5..af4b69e0 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -415,7 +415,7 @@ private: QString effect = ""; // Music effect flags we want to send to server when we play music - int music_flags = 0; + int music_flags = FADE_OUT; int defense_bar_state = 0; int prosecution_bar_state = 0; -- cgit From d9d9232ea8125f59d1e5fb3cf48fbcec6f530529 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 27 Jul 2020 20:06:33 +0300 Subject: Fix private evidence arrows not updating (#213) --- src/evidence.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/evidence.cpp b/src/evidence.cpp index 99d365da..a8f59135 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -708,6 +708,7 @@ void Courtroom::evidence_switch(bool global) ui_evidence_save->show(); ui_evidence_load->show(); } + current_evidence_page = 0; set_evidence_page(); } -- cgit From 37520f9318c12fe07c11f6dd04c30377a3427ea7 Mon Sep 17 00:00:00 2001 From: windrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Mon, 27 Jul 2020 11:08:14 -0600 Subject: Fix connect button issue when using favorites list (#206) Co-authored-by: Cents02 --- src/lobby.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lobby.cpp b/src/lobby.cpp index 92878114..3aa488ad 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -404,7 +404,7 @@ void Lobby::on_settings_clicked() { ao_app->call_settings_menu(); } void Lobby::on_server_list_clicked(QTreeWidgetItem *p_item, int column) { column = 0; - if (p_item->text(column).toInt() != last_index) { + if (p_item->text(column).toInt() != last_index || !public_servers_selected) { server_type f_server; int n_server = p_item->text(column).toInt(); last_index = n_server; -- cgit From 4a0df25c39b429291c77d571dc9e667831b43a89 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Mon, 27 Jul 2020 20:09:09 +0300 Subject: Fix chatlog instances where char_id 0 is ignored (#210) --- src/courtroom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 2d22b5a7..109c3479 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1719,7 +1719,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) return; QString f_showname; - if (f_char_id > 0 && + if (f_char_id > -1 && (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())) { f_showname = ao_app->get_showname(char_list.at(f_char_id).name); } @@ -2161,7 +2161,7 @@ void Courtroom::handle_chatmessage_3() QString f_showname; int f_char_id = m_chatmessage[CHAR_ID].toInt(); - if (f_char_id > 0 && + if (f_char_id > -1 && (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())) { f_showname = ao_app->get_showname(char_list.at(f_char_id).name); } -- cgit From 2935d24a07a5ae9b15e47a8d390e1353af986424 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Wed, 29 Jul 2020 09:06:41 -0600 Subject: Update reference for themes submodule --- base/themes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/themes b/base/themes index 4b8496e7..118c1bfb 160000 --- a/base/themes +++ b/base/themes @@ -1 +1 @@ -Subproject commit 4b8496e7b6b0926fb9f4f6f13d86cd1da31b047a +Subproject commit 118c1bfbfac918f04c2f0bcf6c3f306151eac370 -- cgit From a640def15718fd4eae5a4dd4364eaa559358e973 Mon Sep 17 00:00:00 2001 From: windrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Wed, 29 Jul 2020 11:15:30 -0600 Subject: Fix screenshake button shunting character to origin (#215) * Fix #193 By making sure handle_chatmessage_3 calls start_chat_ticking and thus do_screenshake only after either play_idle or play_talking is called * Move call to start_chat_ticking to the end of handle_chatmessage_3 --- src/courtroom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 109c3479..5d38f8bc 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2154,8 +2154,6 @@ void Courtroom::play_char_sfx(QString sfx_name) void Courtroom::handle_chatmessage_3() { - start_chat_ticking(); - int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt(); QString f_side = m_chatmessage[SIDE]; @@ -2235,6 +2233,8 @@ void Courtroom::handle_chatmessage_3() break; } } + + start_chat_ticking(); } QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, -- cgit From 0b7b70c76a76f68b43a4e8e3a1eaccda173d6955 Mon Sep 17 00:00:00 2001 From: windrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Wed, 29 Jul 2020 11:19:27 -0600 Subject: Fix character-specific theme not falling back to current theme (#207) It is only logical to say that the user, when not specifying any specific speedline or similar in the theme, then the current theme should be checked first rather than the default theme. Co-authored-by: Cents02 --- src/text_file_functions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 122bc412..2340bd87 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -641,7 +641,7 @@ QString AOApplication::get_char_shouts(QString p_char) { QString f_result = read_char_ini(p_char, "shouts", "Options"); if (f_result == "") - return "default"; + return current_theme; // The default option is the current theme. return f_result; } -- cgit From b15c78af0d886fe6572d43e084080d065e21b50a Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Wed, 29 Jul 2020 11:23:17 -0600 Subject: Add Portuguese and Polish language options --- src/aooptionsdialog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index e6ff8ff7..79f1d11f 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -210,6 +210,8 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) 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("pl - Polskie"); ui_language_combobox->addItem("jp - 日本語"); ui_language_combobox->addItem("ru - Русский"); ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, -- cgit From b3bb06a89c9b7bb7fe46f25ec9339db7e9d8852a Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Wed, 29 Jul 2020 11:35:16 -0600 Subject: Please update Polish translation --- resource/translations/ao_pl.ts | 306 +++++++++++++++++++++-------------------- 1 file changed, 160 insertions(+), 146 deletions(-) diff --git a/resource/translations/ao_pl.ts b/resource/translations/ao_pl.ts index 9bcb496f..55f9d054 100644 --- a/resource/translations/ao_pl.ts +++ b/resource/translations/ao_pl.ts @@ -1,6 +1,6 @@ - + AOApplication @@ -32,59 +32,59 @@ Udaj się do aceattorneyonline.com, aby zaktualizować. You have been exiled from AO. Have a nice day. - Zostałeś wygnany z AO. + 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. @@ -130,7 +130,7 @@ Powód: %1 Witness needed - Potrzebny świadek + Potrzebny świadek @@ -217,11 +217,11 @@ Powód: %1 Allow Shake/Flash: - Zezwalaj Wstrząśnięcia/Błyśnięcia: + 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. + 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. @@ -239,285 +239,295 @@ Powód: %1 - Zostaw obecne ustawienia - + Allow Screenshake: Zezwalaj Wstrząśnięcia: - + Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. Zezwala na wstrząśnięcia ekranu. Wyłącz to, jeśli przejmujesz się lub masz problemy z światłoczułością oraz/lub napady padaczkowe. - + Allow Effects: Zezwalaj Efekty: - + Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. Zezwala na efekty ekranu. Wyłącz to, jeśli przejmujesz się lub masz problemy z światłoczułością oraz/lub napady padaczkowe. - + Network Frame Effects: Efekty Network Frame: - + Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. Wysyła wstrząśnięcia ekranu, błyśnięcia i dźwięki, jak zdefiniowano w pliku char.ini, przez sieć. Działa tylko w przypadku serwerów, które obsługują tę funkcję. - + Colors in IC Log: Kolory w dzienniku IC: - + Use the markup colors in the server IC chatlog. Użyj znaczników kolorów w serwerowym dzienniku IC. - + Sticky Sounds: Lepkie Dźwięki: - + Turn this on to prevent the sound dropdown from clearing the sound after playing it. Włącz to, aby zapobiec listy dźwięków przed odznaczeniem zaznaczonego dźwięku po odtworzeniu. - + Sticky Effects: Lepkie Efekty: - + Turn this on to prevent the effects dropdown from clearing the effect after playing it. Włącz to, aby zapobiec listy efektów przed odznaczeniem zaznaczonego efektu po odtworzeniu. - + Sticky Preanims: Lepkie Przed-animacje: - + Turn this on to prevent preanimation checkbox from clearing after playing the emote. Włącz to, aby zapobiec przycisku wyboru przed-animacji od odznaczenia się po odegraniu emotki. - + + Custom Chatboxes: + + + + + Turn this on to allow characters to define their own custom chat box designs. + + + + 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. - + 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'. - + 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. - + Play a blip sound "once per every X symbols", where X is the blip rate. Zagraj dźwięk blipa "raz na X symboli", gdzie X to tempo 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, AO2 will stop the music for you when you or someone else does 'Objection!'. Jeśli zaznaczone, gra przerwie muzykę, kiedy ktoś sprzeciwi się (Objection!). 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. + 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: + Ś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. + 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. @@ -552,10 +562,10 @@ Powód: %1 Could not find %1 - Nie znaleziono %1 + Nie znaleziono %1 - + Generating chars: %1/%2 Generowanie postaci: @@ -615,57 +625,57 @@ Powód: %1 White - Biały + Biały Green - Zielony + Zielony Red - Czerwony + Czerwony Orange - Pomarańczowy + Pomarańczowy Blue - Niebieski + Niebieski Yellow - Żółty + Żółty This does nothing, but there you go. - To nic nie robi, ale proszę bardzo. + 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 @@ -833,32 +843,32 @@ Możesz również zaznaczyć część twojej obecnie pisanej wiadomości i uży Powrót do poczekalni - - - + + + has played a song włączył piosenkę - + You will now pair up with %1 if they also choose your character in return. Będzie teraz w parze z %1, jeśli oni również wybiorą twoją postać. Rainbow - Tęczowy + Tęczowy Disable Modcalls - Wyłącz wezwania moda + Wyłącz wezwania moda Pink - Różowy + Różowy Cyan - Turkusowy + Turkusowy @@ -956,7 +966,7 @@ kategorię char.ini [Options], effects = 'miscname' gdzie się odnosi Log limit - Limit dziennika + Limit dziennika @@ -1007,189 +1017,189 @@ kategorię char.ini [Options], effects = 'miscname' gdzie się odnosi - + CLIENT KLIENT - + You have been banned. Zostałeś zbanowany. You were granted the Guard button. - Zostałeś obdarzonym przyciskiem Na Służbie. + 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 + Będzie teraz w parze z if they also choose your character in return. - jeżeli oni również wybiorą ciebie spowrotem. + 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. - - - - + + + + UNKNOWN NIEZNANE - + 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! - + Succesfully saved, edit doc and cmdoc link on the ini! Zapisano pomyślnie, edytuj dokument i link cmdoc w .ini! - + Master Główny - + Expand All Categories Rozwiń Wszystkie Kategorie - + Collapse All Categories Zwiń Wszystkie Kategorie - + Fade Out Previous Zanikaj poprzednie - + Fade In Rozjaśnij - + Synchronize Zsynchronizuj - + Default Domyślne - + 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. Choose... - Wybierz... + Wybierz... @@ -1324,18 +1334,18 @@ Opis: "%1" został przeniesiony. - + Save Inventory Zapisz ekwipunek - - + + Ini Files (*.ini) Pliki ini (*.ini) - + Open Inventory Otwórz ekwipunek @@ -1390,27 +1400,31 @@ Czy pobrałeś wszystkie zasoby poprawnie z tiny.cc/getao, włączając duży fo 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, Crystalwarrior, Iamgoofball<p><b>Client development:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>QA testing:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Special thanks:</b><br>CrazyJC (2.8 release director) and MaximumVolty (2.8 release promotion); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); server hosts, game masters, case makers, content creators, and the whole AO2 community!<p>The Attorney Online networked visual novel project is copyright (c) 2016-2020 Attorney Online developers. Open-source licenses apply. All other assets are the property of their respective owners.<p>Running on Qt version %2 with the %3 audio engine.<p>Built on %4 + + + <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>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! - <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>Główny rozwój nad wydaniem 2.8:</b><br>Crystalwarrior, Iamgoofball<p><b>Zapewnienie jakości 2.8:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<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, społeczności AO2, hostów serwerów, mistrzów gier, twórców rozpraw, twórców kontentu i dla graczy! + <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>Główny rozwój nad wydaniem 2.8:</b><br>Crystalwarrior, Iamgoofball<p><b>Zapewnienie jakości 2.8:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<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, społeczności AO2, hostów serwerów, mistrzów gier, twórców rozpraw, twórców kontentu i dla graczy! - + About Opis <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>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 -- cgit From 620d0c0c932478b0c31563611aeafc7228a8a72e Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Wed, 29 Jul 2020 11:52:34 -0600 Subject: Update one string in Spanish and Portuguese translations --- resource/translations/ao_es.qm | Bin 47352 -> 47385 bytes resource/translations/ao_es.ts | 240 +++++++++++++++++++++-------------------- resource/translations/ao_pt.qm | Bin 47036 -> 47069 bytes resource/translations/ao_pt.ts | 240 +++++++++++++++++++++-------------------- 4 files changed, 244 insertions(+), 236 deletions(-) diff --git a/resource/translations/ao_es.qm b/resource/translations/ao_es.qm index 63520815..7b238e79 100644 Binary files a/resource/translations/ao_es.qm and b/resource/translations/ao_es.qm differ diff --git a/resource/translations/ao_es.ts b/resource/translations/ao_es.ts index f8ba7148..8e43d8ec 100644 --- a/resource/translations/ao_es.ts +++ b/resource/translations/ao_es.ts @@ -1,6 +1,6 @@ - + AOApplication @@ -35,54 +35,54 @@ Have a nice day. Que tengas un buen día. - + 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. @@ -248,47 +248,47 @@ Razón: 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: - + Sets the music's default volume. 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'. @@ -317,47 +317,47 @@ Razón: 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: @@ -371,182 +371,182 @@ Razón: - Mantener la configuración actual - + Allow Screenshake: Permitir screenshake: - + Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. Permite el movimiento de la pantalla (ADVERTENCIA: esto podría inducir convulsiones debido a imágenes parpadeantes). - + Allow Effects: Permitir efectos: - + Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. Permite efectos de pantalla (ADVERTENCIA: esto podría inducir convulsiones debido a imágenes parpadeantes). - + Network Frame Effects: Enviar efectos al servidor: - + Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. Envíe temblores de pantalla, destellos y sonidos como se define en char.ini a través de la red. Solo funciona para servidores que admiten esta funcionalidad. - + Colors in IC Log: Colores en el registro IC: - + Use the markup colors in the server IC chatlog. Permite colores en el chat IC del servidor. - + Sticky Sounds: Mantener sonidos: - + Turn this on to prevent the sound dropdown from clearing the sound after playing it. Actívelo para evitar que el menú desplegable de sonido borre el sonido después de reproducirlo. - + Sticky Effects: Mantener efectos: - + Turn this on to prevent the effects dropdown from clearing the effect after playing it. Actívelo para evitar que el menú desplegable de efectos elimine el efecto después de reproducirlo. - + Sticky Preanims: Mantener preanims: - + Turn this on to prevent preanimation checkbox from clearing after playing the emote. Actívelo para evitar que la casilla preanimation se desactive después de reproducir el emote. - + Custom Chatboxes: Chatboxes personalizados: - + Turn this on to allow characters to define their own custom chat box designs. Actívelo para permitir que los personajes definan sus propios diseños de cuadros de chat personalizados. - + Play a blip sound "once per every X symbols", where X is the blip rate. Reproduce un sonido de blip "una vez por cada X símbolos", donde X es la tasa de blip. - + If true, AO2 will stop the music for you when you or someone else does 'Objection!'. Si es activado, AO2 detendrá la música por ti cuando tú u otra persona hagan un '¡Protesto!'. - + 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. @@ -559,12 +559,12 @@ Razón: 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. @@ -801,7 +801,7 @@ Razón: Se le concedió el botón para deshabilitar llamadas a moderadores. - + You have been banned. Has sido vetado. @@ -814,7 +814,7 @@ Razón: Esto no hace nada, pero ahí lo tienes. - + You opened the settings menu. Abriste el menú de configuración. @@ -1076,139 +1076,139 @@ You can also select a part of your currently typed message and use the dropdown - + CLIENT - - - + + + has played a song ha reproducido la canción - + You will now pair up with %1 if they also choose your character in return. Ahora se emparejará con %1 si también eligen a su personaje. - + 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. - - - - + + + + UNKNOWN - + Your case "%1" was loaded! Su caso "%1" fue cargado! - + Expand All Categories Expandir todas las categorías - + Collapse All Categories Contraer todas las categorías - + Fade Out Previous Desvanecerse Anterior - + Fade In Fundirse - + Synchronize Sincronizar - + Default Predeterminado @@ -1219,7 +1219,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. @@ -1244,34 +1244,34 @@ 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. - + 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 @@ -1284,28 +1284,28 @@ 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. - + 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. @@ -1446,18 +1446,18 @@ Descripción: "%1" ha sido transferido. - + Save Inventory Guardar inventario - - + + Ini Files (*.ini) Archivos Ini (*.ini) - + Open Inventory Abrir el inventario @@ -1513,9 +1513,13 @@ Did you download all resources correctly from tiny.cc/getao, including the large - <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, Crystalwarrior, Iamgoofball<p><b>Client development:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>QA testing:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Special thanks:</b><br>CrazyJC and MaximumVolty (2.8 release); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); server hosts, game masters, case makers, content creators, and the whole AO2 community!<p>The Attorney Online networked visual novel project is copyright (c) 2016-2020 Attorney Online developers. Open-source licenses apply. All other assets are the property of their respective owners.<p>Running on Qt version %2 with the %3 audio engine.<p>Built on %4 + <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, Crystalwarrior, Iamgoofball<p><b>Client development:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>QA testing:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Special thanks:</b><br>CrazyJC (2.8 release director) and MaximumVolty (2.8 release promotion); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); server hosts, game masters, case makers, content creators, and the whole AO2 community!<p>The Attorney Online networked visual novel project is copyright (c) 2016-2020 Attorney Online developers. Open-source licenses apply. All other assets are the property of their respective owners.<p>Running on Qt version %2 with the %3 audio engine.<p>Built on %4 <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, Crystalwarrior, Iamgoofball<p><b>Desarrollo del cliente:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>Prueba de control de calidad:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Agradecimiento especial:</b><br>CrazyJC y MaximumVolty (versión 2.8); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, y FanatSors (AO1); server hosts, game masters, case makers, creadores de contenido y toda la comunidad AO2.<p>El proyecto Attorney Online novela visual en red tiene copyright (c) 2016-2020 Attorney Online developers. Se aplican licencias de código abierto. Todos los demás activos son propiedad de sus respectivos dueños.<p>Usando Qt versión %2 con el motor de audio %3.<p>Compilado el %4 + + <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, Crystalwarrior, Iamgoofball<p><b>Client development:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>QA testing:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Special thanks:</b><br>CrazyJC and MaximumVolty (2.8 release); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); server hosts, game masters, case makers, content creators, and the whole AO2 community!<p>The Attorney Online networked visual novel project is copyright (c) 2016-2020 Attorney Online developers. Open-source licenses apply. All other assets are the property of their respective owners.<p>Running on Qt version %2 with the %3 audio engine.<p>Built on %4 + <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, Crystalwarrior, Iamgoofball<p><b>Desarrollo del cliente:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>Prueba de control de calidad:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Agradecimiento especial:</b><br>CrazyJC y MaximumVolty (versión 2.8); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, y FanatSors (AO1); server hosts, game masters, case makers, creadores de contenido y toda la comunidad AO2.<p>El proyecto Attorney Online novela visual en red tiene copyright (c) 2016-2020 Attorney Online developers. Se aplican licencias de código abierto. Todos los demás activos son propiedad de sus respectivos dueños.<p>Usando Qt versión %2 con el motor de audio %3.<p>Compilado el %4 + About diff --git a/resource/translations/ao_pt.qm b/resource/translations/ao_pt.qm index 6e443792..dc8bc70d 100644 Binary files a/resource/translations/ao_pt.qm and b/resource/translations/ao_pt.qm differ diff --git a/resource/translations/ao_pt.ts b/resource/translations/ao_pt.ts index 2b2a0044..a3991f8b 100644 --- a/resource/translations/ao_pt.ts +++ b/resource/translations/ao_pt.ts @@ -1,6 +1,6 @@ - + AOApplication @@ -34,54 +34,54 @@ Have a nice day. 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. @@ -237,47 +237,47 @@ Motivo: %1 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: - + Sets the music's default volume. 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'. @@ -306,47 +306,47 @@ Motivo: %1 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: @@ -360,182 +360,182 @@ Motivo: %1 - Mantenha as configurações atuais - + Allow Screenshake: Permitir screenshake: - + Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. Permite o tremor de tela (AVISO: Pode causar convulsões devido à imagens tremidas). - + Allow Effects: Permitir efeitos: - + Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. Permite efeitos de tela (AVISO: Pode causar convulsões devido à imagens tremidas).. - + Network Frame Effects: Envie efeitos para o servidor: - + Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. Envie vibrações, flashes e sons na tela, conforme definido no char.ini pela rede. Funciona apenas para servidores que suportam essa funcionalidade. - + Colors in IC Log: Cores no Log IC: - + Use the markup colors in the server IC chatlog. Permitir cores no chat do IC no servidor. - + Sticky Sounds: Manter sons: - + Turn this on to prevent the sound dropdown from clearing the sound after playing it. Marque para evitar que o som do menu suspenso apague o som após a reprodução. - + Sticky Effects: Manter efeitos: - + Turn this on to prevent the effects dropdown from clearing the effect after playing it. Ative-o para impedir que o menu suspenso de efeito exclua o efeito após reproduzi-lo. - + Sticky Preanims: Manter preanims: - + Turn this on to prevent preanimation checkbox from clearing after playing the emote. Ative-o para impedir que a caixa de seleção de pré-animação seja desmarcada após a execução do emote. - + Custom Chatboxes: Caixas de bate-papo personalizadas: - + Turn this on to allow characters to define their own custom chat box designs. Ative isso para permitir que os personagens tenham as suas próprias caixas de bate-papo personalizadas. - + Play a blip sound "once per every X symbols", where X is the blip rate. Reproduz um som de blip "uma vez para cada símbolo X", em que X é a taxa de blip. - + If true, AO2 will stop the music for you when you or someone else does 'Objection!'. Se ativado, o AO2 interromperá a música quando você ou outra pessoa fizer uma 'Protesto!'. - + 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. @@ -548,12 +548,12 @@ Motivo: %1 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. @@ -731,7 +731,7 @@ Motivo: %1 - + Server @@ -777,7 +777,7 @@ Motivo: %1 Você recebeu o botão Desativar Modcalls. - + You have been banned. Você foi banido. @@ -786,7 +786,7 @@ Motivo: %1 Isso não faz nada, mas lá vai você. - + You opened the settings menu. Você abriu o menu de configurações. @@ -1052,124 +1052,124 @@ Você também pode selecionar uma parte da sua mensagem escrita no momento e usa - + CLIENT - - - + + + has played a song tocou a música - + You will now pair up with %1 if they also choose your character in return. Agora você será emparelhado com %1 se também escolher seu personagem. - + 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. - - - - + + + + UNKNOWN - + 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! @@ -1178,73 +1178,73 @@ 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. - + 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 - + Expand All Categories Expandir todas as categorias - + Collapse All Categories Recolher todas as categorias - + Fade Out Previous Fade Anterior - + Fade In Aparecimento gradual - + Synchronize Sincronizar - + Default Predeterminado - + 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. @@ -1385,18 +1385,18 @@ Descrição: "%1" foi transferido. - + Save Inventory Salvar inventário - - + + Ini Files (*.ini) Arquivos INI (* .ini) - + Open Inventory Abrir inventário @@ -1458,9 +1458,13 @@ Você baixou todos os recursos corretamente do tiny.cc/getao, incluindo a grande - <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, Crystalwarrior, Iamgoofball<p><b>Client development:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>QA testing:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Special thanks:</b><br>CrazyJC and MaximumVolty (2.8 release); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); server hosts, game masters, case makers, content creators, and the whole AO2 community!<p>The Attorney Online networked visual novel project is copyright (c) 2016-2020 Attorney Online developers. Open-source licenses apply. All other assets are the property of their respective owners.<p>Running on Qt version %2 with the %3 audio engine.<p>Built on %4 + <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, Crystalwarrior, Iamgoofball<p><b>Client development:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>QA testing:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Special thanks:</b><br>CrazyJC (2.8 release director) and MaximumVolty (2.8 release promotion); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); server hosts, game masters, case makers, content creators, and the whole AO2 community!<p>The Attorney Online networked visual novel project is copyright (c) 2016-2020 Attorney Online developers. Open-source licenses apply. All other assets are the property of their respective owners.<p>Running on Qt version %2 with the %3 audio engine.<p>Built on %4 <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, Crystalwarrior, Iamgoofball<p><b>Desenvolvimento de cliente:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>Teste de controle de qualidade:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Agradecimentos especiais:</b><br>CrazyJC y MaximumVolty (versão 2.8); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, y FanatSors (AO1); server hosts, game masters, case makers, criadores de conteúdo e toda a comunidade AO2.<p>O projeto Attorney Online possui direitos autorais (c) 2016-2020 Attorney Online developers. Aplicam-se licenças de código aberto. Todos os outros ativos são de propriedade de seus respectivos proprietários.<p>Usando a versão Qt %2 com o mecanismo de áudio %3.<p>Compilado em %4 + + <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, Crystalwarrior, Iamgoofball<p><b>Client development:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>QA testing:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Special thanks:</b><br>CrazyJC and MaximumVolty (2.8 release); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); server hosts, game masters, case makers, content creators, and the whole AO2 community!<p>The Attorney Online networked visual novel project is copyright (c) 2016-2020 Attorney Online developers. Open-source licenses apply. All other assets are the property of their respective owners.<p>Running on Qt version %2 with the %3 audio engine.<p>Built on %4 + <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, Crystalwarrior, Iamgoofball<p><b>Desenvolvimento de cliente:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>Teste de controle de qualidade:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Agradecimentos especiais:</b><br>CrazyJC y MaximumVolty (versão 2.8); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, y FanatSors (AO1); server hosts, game masters, case makers, criadores de conteúdo e toda a comunidade AO2.<p>O projeto Attorney Online possui direitos autorais (c) 2016-2020 Attorney Online developers. Aplicam-se licenças de código aberto. Todos os outros ativos são de propriedade de seus respectivos proprietários.<p>Usando a versão Qt %2 com o mecanismo de áudio %3.<p>Compilado em %4 + About -- cgit From 6c2e999561660259a85777c3db3e9e33327cd8aa Mon Sep 17 00:00:00 2001 From: Pyraq Date: Wed, 29 Jul 2020 21:22:16 +0200 Subject: Please include this updated Polish translation. --- resource/translations/ao_pl.qm | Bin 46479 -> 48099 bytes resource/translations/ao_pl.ts | 76 ++++++++++++++++++++--------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/resource/translations/ao_pl.qm b/resource/translations/ao_pl.qm index 99f3c75d..04ec8348 100644 Binary files a/resource/translations/ao_pl.qm and b/resource/translations/ao_pl.qm differ diff --git a/resource/translations/ao_pl.ts b/resource/translations/ao_pl.ts index 55f9d054..24cccf8a 100644 --- a/resource/translations/ao_pl.ts +++ b/resource/translations/ao_pl.ts @@ -1,6 +1,6 @@ - + AOApplication @@ -19,7 +19,7 @@ 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. Odkryto błąd podczas łączenia się z głównym serwerem. -Używamy wielu głównych serwerów, aby zminimalizować każdą możliwą przerwę, ale klient wyczerpał jakąkolwiek możliwość znalezienia i połączenia się z jednym. +Używamy wielu master serwerów, aby zminimalizować każdą możliwą przerwę, ale klient wyczerpał jakąkolwiek możliwość znalezienia i połączenia się z jednym. Sprawdź swoje połączenie internetowe oraz zaporę ogniową i spróbuj ponownie. @@ -153,7 +153,7 @@ Powód: %1 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. + Ustawia motyw używany w grze. Jeżeli nowy motyw zmienia wygląd poczekalni, będziesz musiał ją również odświeżyć, aby zmiany zaczęły działać, np. poprzez dołączenie do serwera i wyjście z niego. @@ -173,7 +173,7 @@ Powód: %1 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'. + Ilość wiadomości, jakie dziennik IC będzie pokazywał zanim usunie starsze wiadomości. Wartość 0 albo niżej, liczy się jako 'nieskończone'. @@ -198,12 +198,12 @@ Powód: %1 Backup MS: - Kopia zapasowa głównego serwera: + Kopia zapasowa master 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. + Jeśli wbudowane szukanie serwerów zawiedzie, gra spróbuje użyć adresu podanego tutaj i użyje go jako adresu zapasowego master serwera. @@ -246,7 +246,7 @@ Powód: %1 Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. - Zezwala na wstrząśnięcia ekranu. Wyłącz to, jeśli przejmujesz się lub masz problemy z światłoczułością oraz/lub napady padaczkowe. + Zezwala na wstrząśnięcia ekranu. Wyłącz to, jeśli przejmujesz się lub masz problemy z światłoczułością oraz/lub z napadami padaczkowymi. @@ -256,7 +256,7 @@ Powód: %1 Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. - Zezwala na efekty ekranu. Wyłącz to, jeśli przejmujesz się lub masz problemy z światłoczułością oraz/lub napady padaczkowe. + Zezwala na efekty ekranowe. Wyłącz to, jeśli przejmujesz się lub masz problemy z światłoczułością oraz/lub z napadami padaczkowymi. @@ -286,7 +286,7 @@ Powód: %1 Turn this on to prevent the sound dropdown from clearing the sound after playing it. - Włącz to, aby zapobiec listy dźwięków przed odznaczeniem zaznaczonego dźwięku po odtworzeniu. + Włącz to, aby zapobiec listę dźwięków przed odznaczeniem zaznaczonego dźwięku po jego odtworzeniu. @@ -296,7 +296,7 @@ Powód: %1 Turn this on to prevent the effects dropdown from clearing the effect after playing it. - Włącz to, aby zapobiec listy efektów przed odznaczeniem zaznaczonego efektu po odtworzeniu. + Włącz to, aby zapobiec listę efektów przed odznaczeniem zaznaczonego efektu po jego odtworzeniu. @@ -311,12 +311,12 @@ Powód: %1 Custom Chatboxes: - + Niestandardowe Okna Czatu: Turn this on to allow characters to define their own custom chat box designs. - + Włącz to, aby pozwolić postaciom definiować swoje własne designy okienek czatu. @@ -407,17 +407,17 @@ Powód: %1 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). + Jeśli zaznaczone, gra zezwoli na pętlące się efekty dźwiękowe (SFX) na odtwarzanie podczas animacji. Kill Music On Objection: - Przerwij muzykę w czasie sprzeciwu: + Przerwij muzykę na czas sprzeciwu: If true, AO2 will stop the music for you when you or someone else does 'Objection!'. - Jeśli zaznaczone, gra przerwie muzykę, kiedy ktoś sprzeciwi się (Objection!). + Jeśli zaznaczone, gra przerwie muzykę, kiedy ktoś się sprzeciwi (Objection!). If true, the game will stop music when someone objects, like in the actual games. @@ -542,7 +542,7 @@ Powód: %1 Spectator - Widz + Spektator @@ -717,7 +717,7 @@ Rozprawy które możesz załadować: %1 This will display the animation in the viewport as soon as it is pressed. - To będzie wyświetlać animację w oknie tak szybko jak jest to wciśnięte. + To będzie wyświetlać animację w oknie, jak tylko zostanie to wciśnięte. @@ -737,7 +737,7 @@ Rozprawy które możesz załadować: %1 Request the attention of the current server's moderator. - Poproś uwagę moderatora obecnego serwera. + Poproś o uwagę moderatora obecnego serwera. @@ -800,7 +800,7 @@ Rozprawy które możesz załadować: %1 This will display the custom character-defined animation in the viewport as soon as it is pressed. To make one, your character's folder must contain custom.[webp/apng/gif/png] and custom.[wav/ogg/opus] sound effect - To będzie wyświetlać zdefiniowanej animacji niestandardowej postaci w oknie tak szybko, jak jest to wciśnięte. + To będzie wyświetlać zdefiniowanej animacji niestandardowej postaci w oknie, jak tylko zostanie to wciśnięte. Aby zrobić coś takiego, folder twojej postaci musi zawierać niestandardowe [webp/apng/gif/png] i niestandardowe [wav/ogg/opus] efekty dźwiękowe @@ -835,7 +835,7 @@ Aby zrobić coś takiego, folder twojej postaci musi zawierać niestandardowe [w Change the text color of the spoken message. You can also select a part of your currently typed message and use the dropdown to change its color! Zmień kolor tekstu dla twojej wiadomości. -Możesz również zaznaczyć część twojej obecnie pisanej wiadomości i użyć list aby zmienić jej kolor! +Możesz również zaznaczyć część twojej obecnie pisanej wiadomości i użyć listy aby zmienić jej kolor! @@ -852,7 +852,7 @@ Możesz również zaznaczyć część twojej obecnie pisanej wiadomości i uży You will now pair up with %1 if they also choose your character in return. - Będzie teraz w parze z %1, jeśli oni również wybiorą twoją postać. + Będziesz teraz w parze z %1, jeśli oni również wybiorą twoją postać. Rainbow @@ -903,7 +903,7 @@ Możesz również zaznaczyć część twojej obecnie pisanej wiadomości i uży Display the list of characters to pair with. - Wyświetl listę postaci to sparowania się. + Wyświetl listę postaci do sparowania się z. @@ -913,7 +913,7 @@ Możesz również zaznaczyć część twojej obecnie pisanej wiadomości i uży Set your character's emote to play on your next message. - Ustaw emotki twojej postaci do odegrania podczas następnej wiadomości. + Ustaw emotkę twojej postaci do odegrania podczas następnej wiadomości. @@ -937,7 +937,7 @@ Edytuj poprzez pisanie i naciśnięcie enter, [X] aby usunąć. To się zapisuje Set a sound effect to play on your next 'Preanim'. Leaving it on Default will use the emote-defined sound (if any). Edit by typing and pressing Enter, [X] to remove. This saves to your base/characters/<charname>/soundlist.ini - Ustaw efekt dźwiękowy do zagrania dla twojej następnej 'przed-animacji' Zostawienie to jako domyślne, użyje dźwięku zdefiniowanego przez emotkę (jeśli istnieje). + Ustaw efekt dźwiękowy do zagrania dla twojej następnej 'Animacji' Zostawienie to jako domyślne, użyje dźwięku zdefiniowanego przez emotkę (jeśli istnieje). Edytuj poprzez pisanie i naciśnięcie enter, [X] aby usunąć. To się zapisuje do base/characters/<charname>/soundlist.ini @@ -997,18 +997,18 @@ kategorię char.ini [Options], effects = 'miscname' gdzie się odnosi Preanim - Sounds weird but I don't know how to translate it other than this. - przed-animacja + Whatever, I'll just call it an animation. + Animacja Return back to the server list. - Wróć spowrotem do listy serwerów. + Wróć z powrotem do listy serwerów. Become a spectator. You won't be able to interact with the in-character screen. - Zostań spektatorem. Nie będziesz mógł wchodzić w interakcję z ekranem IC. + Zostań spektatorem. Nie będziesz mógł wchodzić w interakcję z oknem IC. @@ -1033,7 +1033,7 @@ kategorię char.ini [Options], effects = 'miscname' gdzie się odnosi You opened the settings menu. - Otworzyłeś opcje. + Otworzyłeś ustawienia. You will now pair up with @@ -1046,7 +1046,7 @@ kategorię char.ini [Options], effects = 'miscname' gdzie się odnosi You are no longer paired with anyone. - Nie jesteś już w parze z kimkolwiek. + Nie jesteś już w parze z nikim. @@ -1066,7 +1066,7 @@ kategorię char.ini [Options], effects = 'miscname' gdzie się odnosi That offset does not look like one. - To wyrównanie nie wygląda na takie. + To wyrównanie nie wygląda na poprawne. @@ -1076,17 +1076,17 @@ kategorię char.ini [Options], effects = 'miscname' gdzie się odnosi 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. + 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 tego powodu. Your pre-animations interrupt again. - Twoje przed-animacje przerywają tekst spowrotem. + Twoje animacje przerywają tekst spowrotem. Your pre-animations will not interrupt text. - Twoje przed-animacje nie będą przerywać tekstu. + Twoje animacje nie będą przerywać tekstu. @@ -1139,7 +1139,7 @@ kategorię char.ini [Options], effects = 'miscname' gdzie się odnosi Master - Główny + @@ -1195,7 +1195,7 @@ kategorię char.ini [Options], effects = 'miscname' gdzie się odnosi The message is too long. - Ta wiadomość jest za długa. + Ta wiadomość jest zbyt długa. Choose... @@ -1294,7 +1294,7 @@ Opis: Images (*.png) - Pliki obrazu (*.png) + Obrazy (*.png) @@ -1402,7 +1402,7 @@ Czy pobrałeś wszystkie zasoby poprawnie z tiny.cc/getao, włączając duży fo <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, Crystalwarrior, Iamgoofball<p><b>Client development:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>QA testing:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Special thanks:</b><br>CrazyJC (2.8 release director) and MaximumVolty (2.8 release promotion); Remy, Hibiki, court-records.net (sprites); Qubrick (webAO); Rue (website); Draxirch (UI design); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); server hosts, game masters, case makers, content creators, and the whole AO2 community!<p>The Attorney Online networked visual novel project is copyright (c) 2016-2020 Attorney Online developers. Open-source licenses apply. All other assets are the property of their respective owners.<p>Running on Qt version %2 with the %3 audio engine.<p>Built on %4 - + <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, Crystalwarrior, Iamgoofball<p><b>Rozwój Klienta:</b><br>Cents02, in1tiate, raidensnake, windrammer<p><b>Testowanie QA:</b><br>CaseyCazy, CedricDewitt, Chewable Tablets, CrazyJC, Fantos, Fury McFlurry, Geck, Gin-Gi, Jamania, Minx, Pandae, Robotic Overlord, Shadowlions (aka Shali), Sierra, SomeGuy, Veritas, Wiso<p><b>Szczególne podziękowania:</b><br>CrazyJC (dyrektor wydania 2.8) and MaximumVolty (promocja wydania 2.8); Remy, Hibiki, court-records.net (sprite'y); Qubrick (webAO); Rue (strona internetowa); Draxirch (design UI); Lewdton and Argoneus (tsuserver); Fiercy, Noevain, Cronnicossy, and FanatSors (AO1); hostom serwerów, mistrzom gier, twórcom rozpraw, twórcom kontentu, i dla całej społeczności AO2!<p>Attorney Online sieciowy projekt wizualnej powieści ma prawa autorskie (c) 2016-2020 Attorney Online developerzy. Dotyczy licencji open-source. Wszystkie inne własności należą do ich odpiowiednich właścicieli.<p>Działa na wersji QT %2 z %3 silnikiem audio.<p>Zbudowany na %4 <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>2.8 Major Release development:</b><br>Crystalwarrior, Iamgoofball<p><b>2.8 Quality Assurance:</b><br>WillDean, Captain N, Mr M, Riel, Seimmet, Fury McFlurry,CedricDewitt, Chewable Tablets, Fantos, Futugaze,Geck, Minx, Pandae, Sierra, CrazyJC, CaseyMayCazy,GreenBowers, Robotic Overlord, Veritas, Gin-Gi<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, the AO2 community, server hosts, game masters,case makers, content creators and players! -- cgit From 58180371efb781c247304452cd282b853dc97dad Mon Sep 17 00:00:00 2001 From: windrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Wed, 29 Jul 2020 16:07:55 -0600 Subject: Hitting return on blank search box should collapse music list (#205) * If enter is hit with no query it collapses the music list Co-authored-by: Cents02 --- include/courtroom.h | 1 + src/courtroom.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/courtroom.h b/include/courtroom.h index af4b69e0..ee682ba8 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -664,6 +664,7 @@ private slots: void on_ooc_return_pressed(); + void on_music_search_return_pressed(); void on_music_search_edited(QString p_text); void on_music_list_double_clicked(QTreeWidgetItem *p_item, int column); void on_music_list_context_menu_requested(const QPoint &pos); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 5d38f8bc..0991a52a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -322,6 +322,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(ui_effects_dropdown, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(on_effects_context_menu_requested(QPoint))); + connect(ui_music_search, SIGNAL(returnPressed()), this, + SLOT(on_music_search_return_pressed())); connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); @@ -3552,6 +3554,13 @@ void Courtroom::on_music_search_edited(QString p_text) } } +void Courtroom::on_music_search_return_pressed() +{ + if (ui_music_search->text() == "") { + ui_music_list->collapseAll(); + } +} + void Courtroom::on_pos_dropdown_changed(int p_index) { if (p_index < 0 || p_index > 7) -- cgit From fc9fe6b34b98dfc3a3b3aa3e342a638019071f45 Mon Sep 17 00:00:00 2001 From: windrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Wed, 29 Jul 2020 16:08:39 -0600 Subject: Fix colors not persisting when refreshing IC log (#204) Co-authored-by: Cents02 --- include/chatlogpiece.h | 7 ++++--- include/courtroom.h | 2 +- src/chatlogpiece.cpp | 10 ++++++++-- src/courtroom.cpp | 14 +++++++------- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/include/chatlogpiece.h b/include/chatlogpiece.h index f3a9dc8b..14d4b349 100644 --- a/include/chatlogpiece.h +++ b/include/chatlogpiece.h @@ -10,9 +10,9 @@ class chatlogpiece { public: chatlogpiece(); chatlogpiece(QString p_name, QString p_showname, QString p_message, - bool p_song); + bool p_song,int color); chatlogpiece(QString p_name, QString p_showname, QString p_message, - bool p_song, QDateTime p_datetime); + bool p_song, int color, QDateTime p_datetime); QString get_name(); QString get_showname(); @@ -20,7 +20,7 @@ public: bool is_song(); QDateTime get_datetime(); QString get_datetime_as_string(); - + int get_chat_color(); QString get_full(); private: @@ -28,6 +28,7 @@ private: QString showname; QString message; QDateTime datetime; + int color; bool p_is_song; }; diff --git a/include/courtroom.h b/include/courtroom.h index ee682ba8..1862c772 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -221,7 +221,7 @@ public: // 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 = "", QString action = ""); + void append_ic_text(QString p_text, QString p_name = "", QString action = "", int 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 diff --git a/src/chatlogpiece.cpp b/src/chatlogpiece.cpp index ec964b91..2a041f13 100644 --- a/src/chatlogpiece.cpp +++ b/src/chatlogpiece.cpp @@ -5,27 +5,31 @@ chatlogpiece::chatlogpiece() name = tr("UNKNOWN"); showname = tr("UNKNOWN"); message = tr("UNKNOWN"); + color = 0; p_is_song = false; datetime = QDateTime::currentDateTime().toUTC(); } chatlogpiece::chatlogpiece(QString p_name, QString p_showname, - QString p_message, bool p_song) + QString p_message, bool p_song, int p_color) { name = p_name; showname = p_showname; message = p_message; p_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) + QString p_message, bool p_song, int p_color, + QDateTime p_datetime) { name = p_name; showname = p_showname; message = p_message; p_is_song = p_song; + color = p_color; datetime = p_datetime.toUTC(); } @@ -41,6 +45,8 @@ bool chatlogpiece::is_song() { return p_is_song; } QString chatlogpiece::get_datetime_as_string() { return datetime.toString(); } +int chatlogpiece::get_chat_color() { return color; } + QString chatlogpiece::get_full() { QString full = "["; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 0991a52a..2e2f2a5a 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1787,7 +1787,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) f_charname = ao_app->get_showname(char_list.at(f_char_id).name); chatlogpiece *temp = - new chatlogpiece(f_charname, f_showname, m_chatmessage[MESSAGE], false); + new chatlogpiece(f_charname, f_showname, m_chatmessage[MESSAGE], false, m_chatmessage[TEXT_COLOR].toInt()); ic_chatlog_history.append(*temp); ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); @@ -1796,7 +1796,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ic_chatlog_history.removeFirst(); } - append_ic_text(m_chatmessage[MESSAGE], f_showname); + append_ic_text(m_chatmessage[MESSAGE], f_showname, "", m_chatmessage[TEXT_COLOR].toInt()); int objection_mod = m_chatmessage[OBJECTION_MOD].toInt(); QString f_char = m_chatmessage[CHAR_NAME]; @@ -2482,7 +2482,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, return p_text_escaped; } -void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action) +void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action, int color) { QTextCharFormat bold; QTextCharFormat normal; @@ -2495,7 +2495,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action) if (p_action == "") p_text = filter_ic_text(p_text, ao_app->is_colorlog_enabled(), -1, - m_chatmessage[TEXT_COLOR].toInt()); + color); if (log_goes_downwards) { const bool is_scrolled_down = @@ -3080,7 +3080,7 @@ void Courtroom::handle_song(QStringList *p_contents) } if (!mute_map.value(n_char)) { - chatlogpiece *temp = new chatlogpiece(str_char, str_show, f_song, true); + chatlogpiece *temp = new chatlogpiece(str_char, str_show, f_song, true, m_chatmessage[TEXT_COLOR].toInt()); ic_chatlog_history.append(*temp); ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); @@ -4516,14 +4516,14 @@ void Courtroom::on_showname_enable_clicked() append_ic_text(item.get_message(), item.get_showname(), tr("has played a song")); else - append_ic_text(item.get_message(), item.get_showname()); + append_ic_text(item.get_message(), item.get_showname(), "", item.get_chat_color()); } else { if (item.is_song()) append_ic_text(item.get_message(), item.get_name(), tr("has played a song")); else - append_ic_text(item.get_message(), item.get_name()); + append_ic_text(item.get_message(), item.get_name(), "", item.get_chat_color()); } } -- cgit From 949a32390338bd4fe4e6e55b5608382b33bbfb12 Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Wed, 29 Jul 2020 17:38:34 -0500 Subject: Fix showname placeholder text and shout button after changing characters (#147) --- src/charselect.cpp | 2 -- src/courtroom.cpp | 32 ++++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/charselect.cpp b/src/charselect.cpp index d003b34d..77e2c95a 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -144,8 +144,6 @@ void Courtroom::char_clicked(int n_char) update_character(n_char); enter_courtroom(); - - ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); } void Courtroom::put_button_in_place(int starting, int chars_on_this_page) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 2e2f2a5a..9c46e15b 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1,4 +1,4 @@ -#include "courtroom.h" +#include "courtroom.h" Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() { @@ -1264,6 +1264,9 @@ void Courtroom::update_character(int p_cid) else ui_custom_objection->hide(); + if (m_cid != -1) // there is no name at char_list -1, and we crash if we try + // to find one + ui_ic_chat_name->setPlaceholderText(char_list.at(m_cid).name); ui_char_select_background->hide(); ui_ic_chat_message->setEnabled(m_cid != -1); ui_ic_chat_message->setFocus(); @@ -1296,6 +1299,25 @@ void Courtroom::enter_courtroom() list_music(); list_areas(); + switch ( + objection_state) // no need to reset these as it was done in set_widgets() + { + case 1: + ui_hold_it->set_image("holdit_selected"); + break; + case 2: + ui_objection->set_image("objection_selected"); + break; + case 3: + ui_take_that->set_image("takethat_selected"); + break; + case 4: + ui_custom_objection->set_image("custom_selected"); + break; + default: + break; + } + music_player->set_volume(ui_music_slider->value(), 0); // set music // Set the ambience and other misc. music layers for (int i = 1; i < music_player->m_channelmax; ++i) { @@ -3223,7 +3245,9 @@ void Courtroom::on_ooc_return_pressed() if (ok) { if (whom > -1) { other_charid = whom; - QString msg = tr("You will now pair up with %1 if they also choose your character in return.").arg(char_list.at(whom).name); + QString msg = tr("You will now pair up with %1 if they also choose " + "your character in return.") + .arg(char_list.at(whom).name); append_server_chatmessage("CLIENT", msg, "1"); } else { @@ -3371,8 +3395,8 @@ void Courtroom::on_ooc_return_pressed() QString casestatus = casefile.value("status", "").value(); if (!caseauth.isEmpty()) - append_server_chatmessage(tr("CLIENT"), tr("Case made by %1.").arg(caseauth), - "1"); + append_server_chatmessage(tr("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 + "#%")); -- cgit From abe80513d8bc9185b811ebdfa0f845f55d57198b Mon Sep 17 00:00:00 2001 From: windrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Wed, 29 Jul 2020 16:43:33 -0600 Subject: Add Qt 5.9 compatibility (#202) * Added Ubuntu 18 backwards compatibility Co-authored-by: Cents02 --- src/aolineedit.cpp | 7 +++++-- src/courtroom.cpp | 22 +++++++++++++++++----- src/hardware_functions.cpp | 2 +- src/scrolltext.cpp | 12 +++++++++++- 4 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/aolineedit.cpp b/src/aolineedit.cpp index f98d95fe..d80fa014 100644 --- a/src/aolineedit.cpp +++ b/src/aolineedit.cpp @@ -11,8 +11,11 @@ void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e) void AOLineEdit::focusOutEvent(QFocusEvent *ev) { int start = selectionStart(); - int len = selectionEnd() - start; // We're not using selectionLength because - // Linux build doesn't run qt5.10 +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + int len = selectionLength(); +#else + int len = selectedText().length(); +#endif QLineEdit::focusOutEvent(ev); if (p_selection && start != -1 && len != -1) this->setSelection(start, len); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 9c46e15b..1a1f2319 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1903,8 +1903,12 @@ void Courtroom::handle_chatmessage_2() ui_vp_chatbox->set_image("chatbox"); QFontMetrics fm(ui_vp_showname->font()); +// Gotta support the slow paced ubuntu 18 STUCK IN 5.9.5!! +#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0) int fm_width = fm.horizontalAdvance(ui_vp_showname->text()); - +#else + int fm_width = fm.boundingRect((ui_vp_showname->text())).width(); +#endif QString chatbox_path = ao_app->get_theme_path("chat"); QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); QString customchar; @@ -1917,7 +1921,8 @@ void Courtroom::handle_chatmessage_2() ui_vp_chatbox->set_chatbox(chatbox_path + "box"); } - //This should probably be called only if any change from the last chat arrow was actually detected. + // This should probably be called only if any change from the last chat + // arrow was actually detected. pos_size_type design_ini_result = ao_app->get_element_dimensions( "chat_arrow", "courtroom_design.ini", customchar); if (design_ini_result.width < 0 || design_ini_result.height < 0) { @@ -3051,11 +3056,13 @@ void Courtroom::handle_song(QStringList *p_contents) (f_song_clear.lastIndexOf("/") + 1)); int n_char = f_contents.at(1).toInt(); - //Assume the song doesn't loop unless told otherwise (due to most outdated servers handling looping through serverside) + // Assume the song doesn't loop unless told otherwise (due to most outdated + // servers handling looping through serverside) bool looping = false; - //Channel 0 is the 'master music', other channels would commonly be used for ambience + // Channel 0 is the 'master music', other channels would commonly be used for + // ambience int channel = 0; - //No effects assumed by default - vanilla functionality + // No effects assumed by default - vanilla functionality int effect_flags = 0; if (n_char < 0 || n_char >= char_list.size()) { @@ -4340,7 +4347,12 @@ void Courtroom::on_text_color_changed(int p_color) if (markdown_end.isEmpty()) markdown_end = markdown_start; int start = ui_ic_chat_message->selectionStart(); +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) int end = ui_ic_chat_message->selectionEnd() + 1; +#else + int end = ui_ic_chat_message->selectedText().length() + 1; +#endif + ui_ic_chat_message->setCursorPosition(start); ui_ic_chat_message->insert(markdown_start); ui_ic_chat_message->setCursorPosition(end); diff --git a/src/hardware_functions.cpp b/src/hardware_functions.cpp index 6da642a5..2f3c44d3 100644 --- a/src/hardware_functions.cpp +++ b/src/hardware_functions.cpp @@ -3,7 +3,7 @@ #include #include -#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) +#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) #if (defined(_WIN32) || defined(_WIN64)) #include diff --git a/src/scrolltext.cpp b/src/scrolltext.cpp index afd0aaba..d5da6ce5 100644 --- a/src/scrolltext.cpp +++ b/src/scrolltext.cpp @@ -34,8 +34,12 @@ void ScrollText::setSeparator(QString separator) void ScrollText::updateText() { timer.stop(); - +#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0) singleTextWidth = fontMetrics().horizontalAdvance(_text); +#else + singleTextWidth = fontMetrics().boundingRect(_text).width(); +#endif + scrollEnabled = (singleTextWidth > width() - leftMargin * 2); if (scrollEnabled) { @@ -47,8 +51,14 @@ void ScrollText::updateText() staticText.setText(_text); staticText.prepare(QTransform(), font()); +#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0) wholeTextSize = QSize(fontMetrics().horizontalAdvance(staticText.text()), fontMetrics().height()); +#else + wholeTextSize = QSize(fontMetrics().boundingRect(staticText.text()).width(), + fontMetrics().height()); +#endif + } void ScrollText::paintEvent(QPaintEvent *) -- cgit From 3afdad90c8eceef4194657713033c6c48d6e97cd Mon Sep 17 00:00:00 2001 From: in1tiate <32779090+in1tiate@users.noreply.github.com> Date: Wed, 29 Jul 2020 17:45:46 -0500 Subject: Add support for multiple custom interjections via context menu (#162) * YOU DO NOT BELONG IN THIS PR GET OUT Co-authored-by: oldmud0 Co-authored-by: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Co-authored-by: Crystalwarrior --- include/courtroom.h | 7 +++-- src/courtroom.cpp | 91 +++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 87 insertions(+), 11 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index 1862c772..af3059ac 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -224,8 +224,8 @@ public: void append_ic_text(QString p_text, QString p_name = "", QString action = "", int 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 + // 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); @@ -380,6 +380,7 @@ private: QString current_char = ""; int objection_state = 0; + QString objection_custom = ""; int realization_state = 0; int screenshake_state = 0; int text_color = 0; @@ -561,6 +562,7 @@ private: QCheckBox *ui_showname_enable; AOButton *ui_custom_objection; + QMenu *custom_obj_menu; AOButton *ui_realization; AOButton *ui_screenshake; AOButton *ui_mute; @@ -723,6 +725,7 @@ private slots: void on_objection_clicked(); void on_take_that_clicked(); void on_custom_objection_clicked(); + void show_custom_objection_menu(const QPoint &pos); void on_realization_clicked(); void on_screenshake_clicked(); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 1a1f2319..d8a18ce2 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -242,6 +242,8 @@ 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(this); ui_realization = new AOButton(this, ao_app); ui_screenshake = new AOButton(this, ao_app); ui_mute = new AOButton(this, ao_app); @@ -346,6 +348,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() 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(show_custom_objection_menu(const QPoint &))); connect(ui_realization, SIGNAL(clicked()), this, SLOT(on_realization_clicked())); @@ -1257,12 +1262,38 @@ void Courtroom::update_character(int p_cid) ui_prosecution_plus->hide(); } - if (ao_app->custom_objection_enabled && - file_exists(ao_app->get_image_suffix( - ao_app->get_character_path(current_char, "custom")))) - ui_custom_objection->show(); - else - ui_custom_objection->hide(); + ui_custom_objection->hide(); + if (ao_app->custom_objection_enabled) // if setting is enabled + { + custom_obj_menu->clear(); + if (file_exists(ao_app->get_image_suffix( + ao_app->get_character_path(current_char, "custom")))) + { + ui_custom_objection->show(); + QAction *action = custom_obj_menu->addAction("Default"); + custom_obj_menu->setDefaultAction(action); + objection_custom = ""; + } + if (dir_exists( + ao_app->get_character_path(current_char, "custom_objections"))) { + ui_custom_objection->show(); + QDir directory( + ao_app->get_character_path(current_char, "custom_objections")); + QStringList custom_obj = directory.entryList(QStringList() << "*.png" + << "*.gif" + << "*.apng" + << "*.webp", + QDir::Files); + for (const QString &filename : custom_obj) { + QAction *action = custom_obj_menu->addAction(filename); + if (custom_obj_menu->defaultAction() == nullptr) + { + custom_obj_menu->setDefaultAction(action); + objection_custom = action->text(); + } + } + } + } if (m_cid != -1) // there is no name at char_list -1, and we crash if we try // to find one @@ -1584,6 +1615,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); @@ -1770,7 +1806,15 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ""; // System messages don't care about repeating themselves else previous_ic_message = f_message; - + 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. + } // Stop the chat arrow from animating ui_vp_chat_arrow->stop(); @@ -1843,8 +1887,18 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) break; // case 4 is AO2 only case 4: - ui_vp_objection->play("custom", f_char, f_custom_theme, 724); - objection_player->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], + f_char, f_custom_theme); + } + else { + ui_vp_objection->play("custom", f_char, f_custom_theme, + shout_stay_time); + objection_player->play("custom", f_char, f_custom_theme); + } break; default: qDebug() << "W: Logic error in objection switch statement!"; @@ -4179,6 +4233,24 @@ void Courtroom::on_custom_objection_clicked() ui_ic_chat_message->setFocus(); } +void Courtroom::show_custom_objection_menu(const QPoint &pos) +{ + QPoint globalPos = ui_custom_objection->mapToGlobal(pos); + QAction *selecteditem = custom_obj_menu->exec(globalPos); + if (selecteditem) { + ui_objection->set_image("objection"); + ui_take_that->set_image("takethat"); + ui_hold_it->set_image("holdit"); + ui_custom_objection->set_image("custom_selected"); + if (selecteditem->text() == "Default") + objection_custom = ""; + else + objection_custom = selecteditem->text(); + objection_state = 4; + custom_obj_menu->setDefaultAction(selecteditem); + } +} + void Courtroom::on_realization_clicked() { if (realization_state == 0) { @@ -4456,6 +4528,7 @@ void Courtroom::on_reload_theme_clicked() anim_state = 4; text_state = 3; + objection_custom = ""; // to update status on the background set_background(current_background, true); -- cgit From 6844f72ab5184bcfee763bfe80baf1ee387a5811 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Wed, 29 Jul 2020 18:31:15 -0500 Subject: Fix build error from bad merge redefinition of objection_mod --- src/courtroom.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index d8a18ce2..f16d9a92 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1864,7 +1864,6 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) append_ic_text(m_chatmessage[MESSAGE], f_showname, "", m_chatmessage[TEXT_COLOR].toInt()); - int objection_mod = m_chatmessage[OBJECTION_MOD].toInt(); QString f_char = m_chatmessage[CHAR_NAME]; QString f_custom_theme = ao_app->get_char_shouts(f_char); -- cgit From 55fa6d7da0e455401850eb04e72a0854a7c169d8 Mon Sep 17 00:00:00 2001 From: windrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Thu, 30 Jul 2020 11:10:58 -0600 Subject: Add darker button generator (#201) When an `_off` emote button exists without an `_on` counterpart, the client will automatically generate the `_on` button and save it to disk. Co-authored-by: Cents02 Co-authored-by: oldmud0 --- include/aoemotebutton.h | 3 ++- src/aoemotebutton.cpp | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/include/aoemotebutton.h b/include/aoemotebutton.h index cb46167f..58e7e747 100644 --- a/include/aoemotebutton.h +++ b/include/aoemotebutton.h @@ -2,7 +2,7 @@ #define AOEMOTEBUTTON_H #include "aoapplication.h" - +#include #include #include @@ -25,6 +25,7 @@ private: int m_id = 0; + signals: void emote_clicked(int p_id); diff --git a/src/aoemotebutton.cpp b/src/aoemotebutton.cpp index abec526b..90535607 100644 --- a/src/aoemotebutton.cpp +++ b/src/aoemotebutton.cpp @@ -1,5 +1,4 @@ #include "aoemotebutton.h" - #include "file_functions.h" AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, @@ -17,6 +16,8 @@ AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, void AOEmoteButton::set_image(QString p_image, QString p_emote_comment) { + QString tmp_p_image = p_image; + if (file_exists(p_image)) { this->setText(""); this->setStyleSheet( @@ -24,6 +25,26 @@ void AOEmoteButton::set_image(QString p_image, QString p_emote_comment) "\") 0 0 0 0 stretch stretch; }" "QToolTip { color: #000000; background-color: #ffffff; border: 0px; }"); } + else if (p_image.contains("_on") && file_exists(tmp_p_image.replace("_on", "_off"))) { + QImage tmpImage(tmp_p_image); + QPoint p1, p2; + p2.setY(tmpImage.height()); + + QLinearGradient gradient(p1, p2); + gradient.setColorAt(0, Qt::transparent); + gradient.setColorAt(1, QColor(0, 0, 0, 159)); + + QPainter p(&tmpImage); + p.fillRect(0, 0, tmpImage.width(), tmpImage.height(), gradient); + + gradient.setColorAt(0, QColor(0, 0, 0, 159)); + gradient.setColorAt(1, Qt::transparent); + p.fillRect(0, 0, tmpImage.width(), tmpImage.height(), gradient); + + p.end(); + tmpImage.save(p_image, "png"); + set_image(p_image, p_emote_comment); + } else { this->setText(p_emote_comment); this->setStyleSheet("QPushButton { border-image: url(); }" -- cgit From 3a84a3f187e8287c06851f7b780831503beb1ab4 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Thu, 30 Jul 2020 13:13:10 -0600 Subject: Add missing misc folder --- base/misc/default/chatbox.png | Bin 0 -> 505 bytes base/misc/default/config.ini | 59 +++++++++++++++++++++++++++++++++ base/misc/default/holdit.opus | Bin 0 -> 15238 bytes base/misc/default/holdit_bubble.gif | Bin 0 -> 39003 bytes base/misc/default/objection.opus | Bin 0 -> 15238 bytes base/misc/default/objection_bubble.gif | Bin 0 -> 43029 bytes base/misc/default/takethat.opus | Bin 0 -> 15238 bytes base/misc/default/takethat_bubble.gif | Bin 0 -> 40634 bytes 8 files changed, 59 insertions(+) create mode 100644 base/misc/default/chatbox.png create mode 100644 base/misc/default/config.ini create mode 100644 base/misc/default/holdit.opus create mode 100644 base/misc/default/holdit_bubble.gif create mode 100644 base/misc/default/objection.opus create mode 100644 base/misc/default/objection_bubble.gif create mode 100644 base/misc/default/takethat.opus create mode 100644 base/misc/default/takethat_bubble.gif diff --git a/base/misc/default/chatbox.png b/base/misc/default/chatbox.png new file mode 100644 index 00000000..0c3bae1e Binary files /dev/null and b/base/misc/default/chatbox.png differ diff --git a/base/misc/default/config.ini b/base/misc/default/config.ini new file mode 100644 index 00000000..b3bf9a81 --- /dev/null +++ b/base/misc/default/config.ini @@ -0,0 +1,59 @@ +c0 = 255, 255, 255 +c0_name = White +c0_talking = 1 + +c1 = 0, 255, 0 +c1_name = Green +c1_start = ` +c1_end = ` +c1_remove = 1 +c1_talking = 1 + +c2 = 255, 0, 0 +c2_name = Red +c2_start = ~ +c2_end = ~ +c2_remove = 1 +c2_talking = 1 + +c3 = 255, 165, 0 +c3_name = Orange +c3_start = | +c3_end = | +c3_remove = 1 +c3_talking = 0 + +c4 = 45, 150, 255 +c4_name = Blue +c4_start = ( +c4_end = ) +c4_remove = 0 +c4_talking = 0 + +c5 = 255, 255, 0 +c5_name = Yellow +c5_start = º +c5_end = º +c5_remove = 1 +c5_talking = 1 + +c6 = 255, 192, 203 +c6_name = Pink +c6_start = № +c6_end = № +c6_remove = 1 +c6_talking = 1 + +c7 = 0, 255, 255 +c7_name = Cyan +c7_start = √ +c7_end = √ +c7_remove = 1 +c7_talking = 1 + +c8 = 187, 187, 187 +c8_name = Gray +c8_start = [ +c8_end = ] +c8_remove = 0 +c8_talking = 1 \ No newline at end of file diff --git a/base/misc/default/holdit.opus b/base/misc/default/holdit.opus new file mode 100644 index 00000000..a454be83 Binary files /dev/null and b/base/misc/default/holdit.opus differ diff --git a/base/misc/default/holdit_bubble.gif b/base/misc/default/holdit_bubble.gif new file mode 100644 index 00000000..536f8cd7 Binary files /dev/null and b/base/misc/default/holdit_bubble.gif differ diff --git a/base/misc/default/objection.opus b/base/misc/default/objection.opus new file mode 100644 index 00000000..7e15d05e Binary files /dev/null and b/base/misc/default/objection.opus differ diff --git a/base/misc/default/objection_bubble.gif b/base/misc/default/objection_bubble.gif new file mode 100644 index 00000000..22c2169b Binary files /dev/null and b/base/misc/default/objection_bubble.gif differ diff --git a/base/misc/default/takethat.opus b/base/misc/default/takethat.opus new file mode 100644 index 00000000..2f143e12 Binary files /dev/null and b/base/misc/default/takethat.opus differ diff --git a/base/misc/default/takethat_bubble.gif b/base/misc/default/takethat_bubble.gif new file mode 100644 index 00000000..795552a8 Binary files /dev/null and b/base/misc/default/takethat_bubble.gif differ -- cgit From a82c2d4fc1dc77416e3cd787ca5341885a5ab6c9 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Thu, 30 Jul 2020 14:48:54 -0500 Subject: CI: Deploy entire base folder Yes, all of it. --- .gitlab-ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4c7f0799..e0b0886f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -121,9 +121,7 @@ build windows i686: # Base folder .deploy_base: &deploy_base | mkdir base - mkdir base/themes - cp -a ../base/themes/default base/themes/ - cp -a ../base/serverlist.txt base/serverlist.sample.txt + cp -a ../base/ base/ # Miscellaneous files .deploy_misc: &deploy_misc | -- cgit From 906a600a6433531010e6e6493ebaf786823edb8c Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Thu, 30 Jul 2020 16:17:06 -0500 Subject: Fix emoji displaying extraneous characters (#219) Fixes #192. --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index f16d9a92..bb2177ee 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2541,7 +2541,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, p_text_escaped.insert(check_pos_escaped, f_character); check_pos_escaped += f_char_length; } - check_pos += 1; + check_pos += f_char_length; } if (!ic_color_stack.empty() && html) { -- cgit From 1802f6309f5804c221a41fc3a487d759369df0e3 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 31 Jul 2020 00:25:19 +0300 Subject: Make spectator function as a character with ID -1 (#211) - Don't hide spectator button anymore. - Make the spectator button properly send the char switch packet. - Fix the spectator button not properly loading the courtroom and music list etc. --- src/charselect.cpp | 18 ++++++++++++------ src/courtroom.cpp | 6 ++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/charselect.cpp b/src/charselect.cpp index 77e2c95a..8e0aab5e 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -123,14 +123,17 @@ 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"); + if (n_char != -1) + { + QString char_ini_path = + ao_app->get_character_path(char_list.at(n_char).name, "char.ini"); - qDebug() << "char_ini_path" << char_ini_path; + qDebug() << "char_ini_path" << char_ini_path; - if (!file_exists(char_ini_path)) { - call_notice("Could not find " + char_ini_path); - return; + if (!file_exists(char_ini_path)) { + call_notice("Could not find " + char_ini_path); + return; + } } if (n_char != m_cid) { @@ -144,6 +147,9 @@ void Courtroom::char_clicked(int n_char) update_character(n_char); enter_courtroom(); + + if (n_char != -1) + ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name); } void Courtroom::put_button_in_place(int starting, int chars_on_this_page) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index bb2177ee..ec869020 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -4515,7 +4515,6 @@ void Courtroom::on_change_character_clicked() set_char_select(); ui_char_select_background->show(); - ui_spectator->hide(); } void Courtroom::on_reload_theme_clicked() @@ -4551,7 +4550,10 @@ void Courtroom::on_char_select_right_clicked() set_char_select_page(); } -void Courtroom::on_spectator_clicked() { update_character(-1); } +void Courtroom::on_spectator_clicked() +{ + char_clicked(-1); +} void Courtroom::on_call_mod_clicked() { -- cgit From be4b6e78ab74a1f5fded5e855c8847c844bfe850 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Thu, 30 Jul 2020 21:55:15 -0500 Subject: Fix regression parsing HTML escapes Introduced trying to fix emoji. This parsing function is cancerous. --- src/courtroom.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ec869020..5368159e 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2326,7 +2326,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, int check_pos = 0; int check_pos_escaped = 0; - bool ic_next_is_not_special = false; + bool parse_escape_seq = false; std::stack ic_color_stack; // Text alignment shenanigans. Could make a dropdown for this later, too! @@ -2375,6 +2375,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_rest); QString f_character; int f_char_length; + int f_char_bytes; tbf.toNextBoundary(); @@ -2396,18 +2397,20 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, // } // } - if (html) - f_character = f_character.toHtmlEscaped(); + f_char_bytes = f_char_length = f_character.length(); - f_char_length = f_character.length(); + if (html) { + f_character = f_character.toHtmlEscaped(); + f_char_length = f_character.length(); + } bool color_update = false; bool is_end = false; bool skip = false; - if (!ic_next_is_not_special) { + if (!parse_escape_seq) { if (f_character == "\\") { - ic_next_is_not_special = true; + parse_escape_seq = true; skip = true; } // Nothing related to colors here @@ -2469,7 +2472,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, } // Parse the newest color stack if (color_update && (target_pos <= -1 || check_pos < target_pos)) { - if (!ic_next_is_not_special) { + if (!parse_escape_seq) { QString appendage = ""; if (!ic_color_stack.empty()) @@ -2509,7 +2512,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, if (f_character == "s" || f_character == "f") // screenshake/flash skip = true; - ic_next_is_not_special = false; + parse_escape_seq = false; } // Make all chars we're not supposed to see invisible @@ -2541,7 +2544,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, p_text_escaped.insert(check_pos_escaped, f_character); check_pos_escaped += f_char_length; } - check_pos += f_char_length; + check_pos += f_char_bytes; } if (!ic_color_stack.empty() && html) { -- cgit From 6cc7d7dd6d22dd684e2f4fe1cc4c76c5e0fc4950 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Thu, 30 Jul 2020 21:13:49 -0600 Subject: Adds background, characters and sounds to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index eb0b9792..37f16122 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,9 @@ bins/ build/ release/ debug/ +base/background +base/characters +base/sounds .qmake.stash -- cgit From f00efbb1ca65771d1548d5d1f7a73332c9fc4baa Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Thu, 30 Jul 2020 21:21:52 -0600 Subject: Update reference for themes submodule --- base/themes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/themes b/base/themes index 118c1bfb..8de30fc0 160000 --- a/base/themes +++ b/base/themes @@ -1 +1 @@ -Subproject commit 118c1bfbfac918f04c2f0bcf6c3f306151eac370 +Subproject commit 8de30fc0fa0e1492a29dad0e839764ca44168cb3 -- cgit From 204d6c4b79e46eae42eb424a884841efcfbe3a94 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Thu, 30 Jul 2020 22:06:04 -0600 Subject: Add callwords.ini and config.ini to gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 37f16122..fedae9d9 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,8 @@ debug/ base/background base/characters base/sounds +base/callwords.ini +base/config.ini .qmake.stash -- cgit From 740d825fd2ac34e052b8cd69f7fd86cea75e324d Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 31 Jul 2020 23:06:55 +0300 Subject: Add a p_char optional argument to set_fonts() (#209) Add overrides to set_font for font name and size (this is to preserve the chat_size and chat_font char.ini arguments that were implemented way earlier) Cease the baddening with set_font that was there before and condense it into a proper set_font function call Implement set_font for custom showname shenanigans from the misc folder --- include/courtroom.h | 4 +-- src/courtroom.cpp | 76 +++++++++++++++++++++++++++++------------------------ 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/include/courtroom.h b/include/courtroom.h index af3059ac..33117586 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -118,7 +118,7 @@ public: void set_widgets(); // sets font size based on theme ini files - void set_font(QWidget *widget, QString class_name, QString p_identifier); + void set_font(QWidget *widget, QString class_name, QString p_identifier, QString p_char="", QString font_name="", int f_pointsize=0); // Get the properly constructed font QFont get_qfont(QString font_name, int f_pointsize, bool antialias = true); @@ -128,7 +128,7 @@ public: QColor f_color = Qt::black, bool bold = false); // helper function that calls above function on the relevant widgets - void set_fonts(); + void set_fonts(QString p_char=""); // sets dropdown menu stylesheet void set_dropdown(QWidget *widget); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 5368159e..bc182a87 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -937,33 +937,48 @@ void Courtroom::set_widgets() refresh_evidence(); } -void Courtroom::set_fonts() +void Courtroom::set_fonts(QString p_char) { - 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_font(ui_music_name, "", "music_name"); + set_font(ui_vp_showname, "", "showname", p_char); + set_font(ui_vp_message, "", "message", p_char); + set_font(ui_ic_chatlog, "", "ic_chatlog", p_char); + set_font(ui_ms_chatlog, "", "ms_chatlog", p_char); + set_font(ui_server_chatlog, "", "server_chatlog", p_char); + set_font(ui_music_list, "", "music_list", p_char); + set_font(ui_area_list, "", "area_list", p_char); + set_font(ui_music_name, "", "music_name", p_char); set_dropdowns(); } void Courtroom::set_font(QWidget *widget, QString class_name, - QString p_identifier) + QString p_identifier, QString p_char, + QString font_name, int f_pointsize) { QString design_file = "courtroom_fonts.ini"; - int f_pointsize = ao_app->get_font_size(p_identifier, design_file); - QString font_name = - ao_app->get_font_name(p_identifier + "_font", design_file); - QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - bool bold = ao_app->get_font_size(p_identifier + "_bold", design_file) == + if (f_pointsize <= 0) + f_pointsize = ao_app->get_design_element(p_identifier, design_file, p_char).toInt(); + if (font_name == "") + font_name = + ao_app->get_design_element(p_identifier + "_font", design_file, p_char); + QString f_color_result = ao_app->get_design_element(p_identifier + "_color", design_file, p_char); + QColor f_color(0, 0, 0); + if (f_color_result != "") + { + QStringList color_list = f_color_result.split(","); + + if (color_list.size() >= 3) + { + f_color.setRed(color_list.at(0).toInt()); + f_color.setGreen(color_list.at(1).toInt()); + f_color.setBlue(color_list.at(2).toInt()); + } + } + bool bold = ao_app->get_design_element(p_identifier + "_bold", design_file, p_char) == 1; // is the font bold or not? bool antialias = - ao_app->get_font_size(p_identifier + "_sharp", design_file) != - 1; // is the font anti-aliased or not? + ao_app->get_design_element(p_identifier + "_sharp", design_file, p_char) != + "1"; // is the font anti-aliased or not? this->set_qfont(widget, class_name, get_qfont(font_name, f_pointsize, antialias), f_color, bold); @@ -1946,6 +1961,9 @@ void Courtroom::handle_chatmessage_2() ui_vp_showname->setText(m_chatmessage[SHOWNAME]); } + QString customchar; + if (ao_app->is_customchat_enabled()) + customchar = m_chatmessage[CHAR_NAME]; if (ui_vp_showname->text().trimmed().isEmpty()) // Whitespace showname { ui_vp_chatbox->set_image("chatblank"); @@ -1963,10 +1981,7 @@ void Courtroom::handle_chatmessage_2() int fm_width = fm.boundingRect((ui_vp_showname->text())).width(); #endif QString chatbox_path = ao_app->get_theme_path("chat"); - QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); - QString customchar; - if (ao_app->is_customchat_enabled()) - customchar = m_chatmessage[CHAR_NAME]; + QString chatbox = ao_app->get_chat(customchar); if (chatbox != "" && ao_app->is_customchat_enabled()) { chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chat"; @@ -2028,6 +2043,8 @@ void Courtroom::handle_chatmessage_2() } else ui_vp_showname->resize(default_width.width, ui_vp_showname->height()); + + set_font(ui_vp_showname, "", "showname", customchar); } else { @@ -2038,25 +2055,16 @@ void Courtroom::handle_chatmessage_2() ui_vp_message->hide(); ui_vp_chatbox->hide(); - // todo: put this in its own function or update - QString design_file = "courtroom_fonts.ini"; - int f_pointsize = ao_app->get_font_size("message", design_file); - QString font_name = ao_app->get_font_name("message_font", design_file); - QColor f_color = ao_app->get_color("message_color", design_file); - bool bold = ao_app->get_font_size("message_bold", design_file) == - 1; // is the font bold or not? - bool antialias = ao_app->get_font_size("message_sharp", design_file) != - 1; // is the font anti-aliased or not? - + QString font_name; QString chatfont = ao_app->get_chat_font(m_chatmessage[CHAR_NAME]); if (chatfont != "") font_name = chatfont; + int f_pointsize = 0; int chatsize = ao_app->get_chat_size(m_chatmessage[CHAR_NAME]); - if (chatsize != -1) + if (chatsize > 0) f_pointsize = chatsize; - this->set_qfont(ui_vp_message, "", - get_qfont(font_name, f_pointsize, antialias), f_color, bold); + set_font(ui_vp_message, "", "message", customchar, font_name, f_pointsize); set_scene(m_chatmessage[DESK_MOD], m_chatmessage[SIDE]); -- cgit From 56d7fff50044ef72626ac40ccf13da1e34b5f0a1 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 31 Jul 2020 23:07:14 +0300 Subject: Fix reload theme breaking BG sizing (#212) May need additional testing with animated BGs. --- src/aoscene.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 094d7a54..594013a1 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -24,14 +24,14 @@ void AOScene::set_image(QString p_image) return; } - if (file_exists(background_path) && background_path == last_image) - return; - - this->clear(); - this->setMovie(nullptr); + if (!file_exists(background_path) || background_path != last_image) + { + this->clear(); + this->setMovie(nullptr); - m_movie->stop(); - m_movie->setFileName(background_path); + m_movie->stop(); + m_movie->setFileName(background_path); + } if (m_movie->isValid() && m_movie->frameCount() > 1) { m_movie->jumpToNextFrame(); @@ -43,9 +43,12 @@ void AOScene::set_image(QString p_image) m_movie->setScaledSize(QSize(n_w, n_h)); this->resize(m_movie->scaledSize()); - this->setMovie(m_movie); + if (!file_exists(background_path) || background_path != last_image) + { + this->setMovie(m_movie); + m_movie->start(); + } QLabel::move(x + (f_w - n_w) / 2, y + (f_h - n_h) / 2); // Center - m_movie->start(); } else { QPixmap background(background_path); -- cgit From bab10ea14ddaf7af7aeeff925b373be1c347d0d7 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 31 Jul 2020 23:11:38 +0300 Subject: Add "Play Random Song" option (#200) It also respects the search string, so only visible tracks are chosen from the pool. Categories (i.e. entries with children) are also ignored. --- include/courtroom.h | 1 + src/courtroom.cpp | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/courtroom.h b/include/courtroom.h index 33117586..182c2a68 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -673,6 +673,7 @@ private slots: void music_fade_out(bool toggle); void music_fade_in(bool toggle); void music_synchronize(bool toggle); + void music_random(); void music_list_expand_all(); void music_list_collapse_all(); void on_area_list_double_clicked(QTreeWidgetItem *p_item, int column); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index bc182a87..b203cf08 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -4098,6 +4098,9 @@ void Courtroom::on_music_list_context_menu_requested(const QPoint &pos) { QMenu *menu = new QMenu(); + menu->addAction(QString(tr("Play Random Song")), this, + SLOT(music_random())); + menu->addSeparator(); menu->addAction(QString(tr("Expand All Categories")), this, SLOT(music_list_expand_all())); menu->addAction(QString(tr("Collapse All Categories")), this, @@ -4149,6 +4152,18 @@ void Courtroom::music_synchronize(bool toggle) music_flags &= ~SYNC_POS; } +void Courtroom::music_random() +{ + QList clist; + QTreeWidgetItemIterator it(ui_music_list, QTreeWidgetItemIterator::NotHidden | QTreeWidgetItemIterator::NoChildren); + while (*it) { + clist += (*it); + ++it; + } + int i = qrand() % clist.length(); + on_music_list_double_clicked(clist.at(i), 1); +} + void Courtroom::music_list_expand_all() { ui_music_list->expandAll(); } void Courtroom::music_list_collapse_all() { -- cgit From 36b5af3cb9ce8e5530c5bd9353a4e2f10da506b6 Mon Sep 17 00:00:00 2001 From: windrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Fri, 31 Jul 2020 14:14:39 -0600 Subject: Add option for automatic logging (#203) Just so we're on the same page, this is enabled by default. Co-authored-by: Cents02 --- include/aoapplication.h | 3 +++ include/aooptionsdialog.h | 2 ++ src/aooptionsdialog.cpp | 16 +++++++++++++++- src/courtroom.cpp | 6 ++++-- src/packet_distribution.cpp | 17 ++++++++++------- src/text_file_functions.cpp | 6 ++++++ 6 files changed, 40 insertions(+), 10 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index af357d0c..f4685eca 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -427,6 +427,9 @@ public: // Get the message for the CM for casing alerts. QString get_casing_can_host_cases(); + // Get if automatic logging is enabled + bool get_auto_logging_enabled(); + // The file name of the log file in base/logs. QString log_filename; diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 06684ef4..2b8c879b 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -131,6 +131,8 @@ private: QCheckBox *ui_casing_cm_cb; QLabel *ui_casing_cm_cases_lbl; QLineEdit *ui_casing_cm_cases_textbox; + QLabel *ui_log_lbl; + QCheckBox *ui_log_cb; bool needs_default_audiodev(); diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 79f1d11f..6cedee8d 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -699,6 +699,20 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_casing_cm_cases_textbox); + //Check whether mass logging is enabled + row += 1; + ui_log_lbl = new QLabel(ui_casing_widget); + ui_log_lbl->setText(tr("Automatic Logging:")); + ui_log_lbl->setToolTip( + tr("If checked, all logs will be automatically written in the " + "/logs folder.")); + + ui_casing_layout->setWidget(row, QFormLayout::LabelRole, ui_log_lbl); + + ui_log_cb = new QCheckBox(ui_casing_widget); + ui_log_cb->setChecked(ao_app->get_auto_logging_enabled()); + + ui_casing_layout->setWidget(row, QFormLayout::FieldRole, ui_log_cb); // When we're done, we should continue the updates! setUpdatesEnabled(true); @@ -725,7 +739,7 @@ void AOOptionsDialog::save_pressed() configini->setValue("stickyeffects", ui_stickyeffects_cb->isChecked()); configini->setValue("stickypres", ui_stickypres_cb->isChecked()); configini->setValue("customchat", ui_customchat_cb->isChecked()); - + configini->setValue("automatic_logging_enabled", ui_log_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 b203cf08..98b6a9c3 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1870,7 +1870,8 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) chatlogpiece *temp = new chatlogpiece(f_charname, f_showname, m_chatmessage[MESSAGE], false, m_chatmessage[TEXT_COLOR].toInt()); ic_chatlog_history.append(*temp); - ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); + if (ao_app->get_auto_logging_enabled()) + ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); while (ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) { @@ -3175,7 +3176,8 @@ void Courtroom::handle_song(QStringList *p_contents) 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); - ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); + if (ao_app->get_auto_logging_enabled()) + ao_app->append_to_file(temp->get_full(), ao_app->log_filename, true); while (ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) { diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index 669b9541..b543cfb5 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -292,13 +292,16 @@ void AOApplication::server_packet_received(AOPacket *p_packet) // Remove any characters not accepted in folder names for the server_name // here - this->log_filename = QDateTime::currentDateTime().toUTC().toString( - "'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|\']")) + - "/'ddd MMMM yyyy hh.mm.ss t'.log'"); - this->write_to_file("Joined server " + server_name + " on address " + - server_address + " on " + - QDateTime::currentDateTime().toUTC().toString(), - log_filename, true); + if (AOApplication::get_auto_logging_enabled()){ + this->log_filename = QDateTime::currentDateTime().toUTC().toString( + "'logs/" + server_name.remove(QRegExp("[\\\\/:*?\"<>|\']")) + + "/'ddd MMMM yyyy hh.mm.ss t'.log'"); + this->write_to_file("Joined server " + server_name + " on address " + + server_address + " on " + + QDateTime::currentDateTime().toUTC().toString(), + log_filename, true); + } + QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256); hash.addData(server_address.toUtf8()); if (is_discord_enabled()) diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 2340bd87..39754f39 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -1049,3 +1049,9 @@ QString AOApplication::get_casing_can_host_cases() .value(); return result; } +bool AOApplication::get_auto_logging_enabled() +{ + QString result = + configini->value("automatic_logging_enabled", "true").value(); + return result.startsWith("true"); +} -- cgit