aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/aoapplication.h2
-rw-r--r--include/courtroom.h12
-rw-r--r--src/aoblipplayer.cpp2
-rw-r--r--src/aocharmovie.cpp1
-rw-r--r--src/aooptionsdialog.cpp2
-rw-r--r--src/courtroom.cpp134
-rw-r--r--src/networkmanager.cpp4
-rw-r--r--src/packet_distribution.cpp45
8 files changed, 162 insertions, 40 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h
index e4f2ee68..03aa01a1 100644
--- a/include/aoapplication.h
+++ b/include/aoapplication.h
@@ -58,6 +58,8 @@ public:
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);
diff --git a/include/courtroom.h b/include/courtroom.h
index 951a5a33..ec0fa5c4 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -212,6 +212,9 @@ public:
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
@@ -415,6 +418,15 @@ private:
//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;
diff --git a/src/aoblipplayer.cpp b/src/aoblipplayer.cpp
index 1c668ab4..9b548c33 100644
--- a/src/aoblipplayer.cpp
+++ b/src/aoblipplayer.cpp
@@ -70,7 +70,7 @@ void AOBlipPlayer::set_blips(QString p_sfx)
void AOBlipPlayer::blip_tick()
{
- int f_cycle = m_cycle++;
+ m_cycle++;
if (m_cycle == 5)
m_cycle = 0;
diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp
index e84c493f..dfd53559 100644
--- a/src/aocharmovie.cpp
+++ b/src/aocharmovie.cpp
@@ -208,7 +208,6 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
m_movie->stop();
m_movie->setFileName(gif_path);
m_movie->jumpToFrame(0);
- int real_duration = 0;
play_once = true;
play(p_char, p_emote, "");
}
diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp
index 37d49573..3749b653 100644
--- a/src/aooptionsdialog.cpp
+++ b/src/aooptionsdialog.cpp
@@ -244,7 +244,6 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
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())
{
@@ -253,6 +252,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDi
}
#ifdef BASSAUDIO
BASS_DEVICEINFO info;
+ int a = 0;
for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
{
ui_audio_device_combobox->addItem(info.name);
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 718470fc..8592d4fd 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -150,6 +150,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
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);
@@ -367,6 +368,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
set_widgets();
set_char_select();
+ detect_fallback_text();
}
void Courtroom::set_mute_list()
@@ -609,7 +611,15 @@ void Courtroom::set_widgets()
ui_take_that->set_image("takethat.png");
set_size_and_pos(ui_ooc_toggle, "ooc_toggle");
- ui_ooc_toggle->setText(tr("Server"));
+ 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");
@@ -622,22 +632,70 @@ void Courtroom::set_widgets()
ui_not_guilty->set_image("notguilty.png");
set_size_and_pos(ui_change_character, "change_character");
- ui_change_character->setText(tr("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");
- ui_reload_theme->setText(tr("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");
- ui_call_mod->setText(tr("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");
- ui_settings->setText(tr("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");
- ui_announce_casing->setText(tr("Casing"));
-
+ 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");
- ui_switch_area_music->setText(tr("A/M"));
+ 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"));
@@ -1131,6 +1189,32 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QSt
ui_server_chatlog->append_chatmessage(p_name, p_message, colour);
}
+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:
@@ -1655,7 +1739,21 @@ void Courtroom::handle_chatmessage_2()
ui_vp_chatbox->set_image("chatmed.png");
else
{
- QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png";
+ 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);
}
@@ -3300,16 +3398,24 @@ void Courtroom::on_ooc_toggle_clicked()
{
ui_ms_chatlog->show();
ui_server_chatlog->hide();
- ui_ooc_toggle->setText(tr("Master"));
-
+ 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("Server"));
-
+ 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;
}
}
@@ -3750,6 +3856,8 @@ void Courtroom::on_reload_theme_clicked()
//to update status on the background
set_background(current_background);
+ //to update fallback text bools
+ detect_fallback_text();
enter_courtroom(m_cid);
anim_state = 4;
diff --git a/src/networkmanager.cpp b/src/networkmanager.cpp
index a9810d49..b029eabe 100644
--- a/src/networkmanager.cpp
+++ b/src/networkmanager.cpp
@@ -134,9 +134,9 @@ void NetworkManager::on_srv_lookup()
for (const QDnsServiceRecord &record : srv_records)
{
-#ifdef DEBUG_NETWORK
+ #ifdef DEBUG_NETWORK
qDebug() << "Connecting to " << record.target() << ":" << record.port();
-#endif
+ #endif
ms_socket->connectToHost(record.target(), record.port());
QTime timer;
timer.start();
diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp
index 5538c15e..c3812788 100644
--- a/src/packet_distribution.cpp
+++ b/src/packet_distribution.cpp
@@ -151,6 +151,16 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
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();
@@ -411,7 +421,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (!courtroom_constructed)
goto end;
- bool musics_time = false;
+ bool musiclist_start = false;
int areas = 0;
for (int n_element = 0 ; n_element < f_contents.size() ; n_element += 2)
@@ -428,19 +438,15 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
w_lobby->set_loading_text(tr("Loading music:\n%1/%2").arg(QString::number(loaded_music)).arg(QString::number(music_list_size)));
- if (musics_time)
+ if (musiclist_start)
{
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"))
+ if (is_music_track(f_music))
{
- musics_time = true;
+ musiclist_start = true;
areas--;
//w_courtroom->fix_last_area();
w_courtroom->append_music(f_music);
@@ -514,22 +520,17 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (!courtroom_constructed)
goto end;
- bool musics_time = false;
+ bool musiclist_start = false;
area_count = 0;
for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
{
- 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")))
+ if (!musiclist_start && is_music_track(f_contents.at(n_element)))
{
- musics_time = true;
+ musiclist_start = true;
continue;
}
- AOPacketLoadMusicThreading *music_load = new AOPacketLoadMusicThreading(this, f_contents.at(n_element), musics_time);
+ AOPacketLoadMusicThreading *music_load = new AOPacketLoadMusicThreading(this, f_contents.at(n_element), musiclist_start);
QThreadPool::globalInstance()->start(music_load);
++loaded_music;
int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size;
@@ -606,11 +607,11 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
{
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();
+ 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")
{