aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/aoapplication.cpp2
-rw-r--r--src/charselect.cpp7
-rw-r--r--src/courtroom.cpp117
-rw-r--r--src/lobby.cpp6
-rw-r--r--src/main.cpp7
-rw-r--r--src/packet_distribution.cpp5
-rw-r--r--src/path_functions.cpp71
7 files changed, 116 insertions, 99 deletions
diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp
index 1e78ef5e..13c995f2 100644
--- a/src/aoapplication.cpp
+++ b/src/aoapplication.cpp
@@ -32,7 +32,7 @@ AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv)
original_message_handler = qInstallMessageHandler(message_handler);
setApplicationVersion(get_version_string());
- setApplicationDisplayName(tr("Attorney Online 2"));
+ setApplicationDisplayName(tr("Attorney Online %1").arg(applicationVersion()));
}
AOApplication::~AOApplication()
diff --git a/src/charselect.cpp b/src/charselect.cpp
index 7b9308a4..d57d7518 100644
--- a/src/charselect.cpp
+++ b/src/charselect.cpp
@@ -188,13 +188,6 @@ void Courtroom::char_clicked(int n_char)
enter_courtroom();
set_courtroom_size();
}
-
- if (n_char != -1) {
- ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name);
- }
- else {
- ui_ic_chat_name->setPlaceholderText("Spectator");
- }
}
void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 2db30e45..db6b81b4 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -180,7 +180,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_ic_chat_message = new QLineEdit(this);
ui_ic_chat_message->setFrame(false);
- ui_ic_chat_message->setPlaceholderText(tr("Message"));
+ ui_ic_chat_message->setPlaceholderText(tr("Message in-character"));
ui_ic_chat_message_filter = new AOLineEditFilter();
ui_ic_chat_message_filter->preserve_selection = true;
ui_ic_chat_message->installEventFilter(ui_ic_chat_message_filter);
@@ -193,6 +193,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->setObjectName("ui_ooc_chat_message");
+ ui_ooc_chat_message->setPlaceholderText(tr("Message out-of-character"));
ui_ooc_chat_name = new QLineEdit(this);
ui_ooc_chat_name->setFrame(false);
@@ -1445,7 +1446,15 @@ void Courtroom::set_pos_dropdown(QStringList pos_dropdowns)
ui_pos_dropdown->blockSignals(true);
pos_dropdown_list = pos_dropdowns;
ui_pos_dropdown->clear();
- ui_pos_dropdown->addItems(pos_dropdown_list);
+ for (int n = 0; n < pos_dropdown_list.size(); ++n) {
+ QString pos = pos_dropdown_list.at(n);
+ ui_pos_dropdown->addItem(pos);
+ QPixmap image = QPixmap(ao_app->get_image_suffix(ao_app->get_background_path(ao_app->get_pos_path(pos))));
+ if (!image.isNull()) {
+ image = image.scaledToHeight(ui_pos_dropdown->iconSize().height());
+ }
+ ui_pos_dropdown->setItemIcon(n, image);
+ }
if (current_side != "" && !pos_dropdown_list.contains(current_side))
ui_pos_dropdown->setEditText(current_side);
@@ -1528,15 +1537,15 @@ void Courtroom::update_character(int p_cid)
for (const QString &filename : custom_obj) {
CustomObjection custom_objection;
custom_objection.filename = filename;
- QString custom_name = ao_app->read_char_ini(f_char, filename.split(".")[0] + "_name", "Shouts");
+ QString custom_name = ao_app->read_char_ini(f_char, filename.left(filename.lastIndexOf(".")) + "_name", "Shouts");
QAction *action;
if (custom_name != "") {
custom_objection.name = custom_name;
action = custom_obj_menu->addAction(custom_name);
}
else {
- custom_objection.name = filename.split(".")[0];
- action = custom_obj_menu->addAction(filename.split(".")[0]);
+ custom_objection.name = filename.left(filename.lastIndexOf("."));
+ action = custom_obj_menu->addAction(custom_objection.name);
}
if (custom_obj_menu->defaultAction() == nullptr) {
custom_obj_menu->setDefaultAction(action);
@@ -1547,9 +1556,12 @@ void Courtroom::update_character(int p_cid)
}
}
- if (m_cid != -1) // there is no name at char_list -1, and we crash if we try
- // to find one
+ if (m_cid != -1) {
ui_ic_chat_name->setPlaceholderText(char_list.at(m_cid).name);
+ }
+ else {
+ ui_ic_chat_name->setPlaceholderText("Spectator");
+ }
ui_char_select_background->hide();
ui_ic_chat_message->setEnabled(m_cid != -1);
ui_ic_chat_message->setFocus();
@@ -2376,9 +2388,8 @@ bool Courtroom::handle_objection()
// case 4 is AO2 only
case 4:
if (custom_objection != "") {
- filename = "custom_objections/" + custom_objection;
- objection_player->play(
- "custom_objections/" + custom_objection.split('.')[0],
+ filename = "custom_objections/" + custom_objection.left(custom_objection.lastIndexOf("."));
+ objection_player->play(filename,
m_chatmessage[CHAR_NAME],
ao_app->get_chat(m_chatmessage[CHAR_NAME]));
}
@@ -3757,73 +3768,10 @@ void Courtroom::play_sfx()
ao_app->get_sfx_looping(current_char, current_emote) == "1");
}
-void Courtroom::set_scene(QString f_desk_mod, QString f_side)
+void Courtroom::set_scene(const QString f_desk_mod, const QString f_side)
{
- // witness is default if pos is invalid
- QString f_background;
- QString f_desk_image;
- if (file_exists(ao_app->get_image_suffix(ao_app->get_background_path("witnessempty")))) {
- f_background = "witnessempty";
- f_desk_image = "stand";
- }
- else {
- f_background = "wit";
- f_desk_image = "wit_overlay";
- }
-
- 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";
- }
-
- QString desk_override = ao_app->read_design_ini("overlays/" + f_background, ao_app->get_background_path("design.ini"));
- if (desk_override != "")
- f_desk_image = desk_override;
-
- ui_vp_background->load_image(f_background);
- ui_vp_desk->load_image(f_desk_image);
+ ui_vp_background->load_image(ao_app->get_pos_path(f_side));
+ ui_vp_desk->load_image(ao_app->get_pos_path(f_side, true));
if (f_desk_mod == "0" ||
(f_desk_mod != "1" &&
@@ -3844,7 +3792,7 @@ void Courtroom::set_self_offset(QString p_list, QString p_effect) {
self_offset_v = 0;
else
self_offset_v = self_offsets[1].toInt();
- ui_vp_player_char->move(ui_viewport->width() * self_offset / 100, ui_viewport->height() * self_offset_v / 100);
+ ui_vp_player_char->move_and_center(ui_viewport->width() * self_offset / 100, ui_viewport->height() * self_offset_v / 100);
//If an effect is ignoring the users offset, we force it to the default position of the viewport.
if (ao_app->get_effect_property(play_effect[0], current_char, "ignore_offset") == "true") {
@@ -3996,12 +3944,18 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
return;
}
sfx_name = ao_app->get_court_sfx("witness_testimony", bg_misc);
+ if (sfx_name == "") {
+ sfx_name = ao_app->get_court_sfx("witnesstestimony", bg_misc);
+ }
filename = "witnesstestimony_bubble";
ui_vp_testimony->load_image("testimony", "", bg_misc);
}
// cross examination
else if (p_wtce == "testimony2") {
- sfx_name = ao_app->get_court_sfx("cross_examination", bg_misc);
+ sfx_name = ao_app->get_court_sfx("cross_examination", bg_misc);
+ if (sfx_name == "") {
+ sfx_name = ao_app->get_court_sfx("crossexamination", bg_misc);
+ }
filename = "crossexamination_bubble";
ui_vp_testimony->kill();
}
@@ -4012,6 +3966,9 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
if (p_wtce == "judgeruling") {
if (variant == 0) {
sfx_name = ao_app->get_court_sfx("not_guilty", bg_misc);
+ if (sfx_name == "") {
+ sfx_name = ao_app->get_court_sfx("notguilty", bg_misc);
+ }
filename = "notguilty_bubble";
ui_vp_testimony->kill();
}
@@ -5188,7 +5145,7 @@ void Courtroom::set_text_color_dropdown()
ui_text_color->addItem(color_name);
QPixmap pixmap(16, 16);
pixmap.fill(color);
- ui_text_color->setItemIcon(ui_text_color->count() - 1, QIcon(pixmap));
+ ui_text_color->setItemIcon(ui_text_color->count() - 1, pixmap);
color_row_to_number.append(c);
}
for (int c = 0; c < max_colors; ++c) {
@@ -5334,8 +5291,6 @@ void Courtroom::on_reload_theme_clicked()
enter_courtroom();
gen_char_rgb_list(ao_app->get_chat(current_char));
- objection_custom = "";
-
// to update status on the background
set_background(current_background, true);
}
diff --git a/src/lobby.cpp b/src/lobby.cpp
index 52e228f3..c0d0e4de 100644
--- a/src/lobby.cpp
+++ b/src/lobby.cpp
@@ -112,6 +112,12 @@ void Lobby::set_widgets()
if (f_lobby.width < 0 || f_lobby.height < 0) {
qWarning() << "did not find lobby width or height in " << filename;
+ #ifdef ANDROID
+ if(QtAndroid::checkPermission("android.permission.READ_EXTERNAL_STORAGE")==QtAndroid::PermissionResult::Denied) {
+ QtAndroid::requestPermissionsSync({"android.permission.READ_EXTERNAL_STORAGE","android.permission.WRITE_EXTERNAL_STORAGE"});
+ }
+ #endif
+
// 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"
diff --git a/src/main.cpp b/src/main.cpp
index 6edefa49..e8ffe67e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -14,13 +14,6 @@ int main(int argc, char *argv[])
{
qSetMessagePattern("%{type}: %{if-category}%{category}: %{endif}%{message}");
-#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);
-#endif
-
AOApplication main_app(argc, argv);
AOApplication::addLibraryPath(AOApplication::applicationDirPath() + "/lib");
diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp
index 8ac1b280..e0326139 100644
--- a/src/packet_distribution.cpp
+++ b/src/packet_distribution.cpp
@@ -173,7 +173,6 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
courtroom_loaded = false;
- window_title = tr("Attorney Online %1").arg(applicationVersion());
int selected_server = w_lobby->get_selected_server();
QString server_address = "", server_name = "";
@@ -183,7 +182,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
server_name = info.name;
server_address =
QString("%1:%2").arg(info.ip, QString::number(info.port));
- window_title += ": " + server_name;
+ window_title = server_name;
}
}
else {
@@ -192,7 +191,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
server_name = info.name;
server_address =
QString("%1:%2").arg(info.ip, QString::number(info.port));
- window_title += ": " + server_name;
+ window_title = server_name;
}
}
diff --git a/src/path_functions.cpp b/src/path_functions.cpp
index ded1b675..575461f0 100644
--- a/src/path_functions.cpp
+++ b/src/path_functions.cpp
@@ -92,6 +92,77 @@ VPath AOApplication::get_default_background_path(QString p_file)
return VPath("background/default/" + p_file);
}
+QString AOApplication::get_pos_path(const QString& pos, const bool desk)
+{
+ // witness is default if pos is invalid
+ QString f_background;
+ QString f_desk_image;
+ if (file_exists(get_image_suffix(get_background_path("witnessempty")))) {
+ f_background = "witnessempty";
+ f_desk_image = "stand";
+ }
+ else {
+ f_background = "wit";
+ f_desk_image = "wit_overlay";
+ }
+
+ if (pos == "def" && file_exists(get_image_suffix(
+ get_background_path("defenseempty")))) {
+ f_background = "defenseempty";
+ f_desk_image = "defensedesk";
+ }
+ else if (pos == "pro" &&
+ file_exists(get_image_suffix(
+ get_background_path("prosecutorempty")))) {
+ f_background = "prosecutorempty";
+ f_desk_image = "prosecutiondesk";
+ }
+ else if (pos == "jud" && file_exists(get_image_suffix(
+ get_background_path("judgestand")))) {
+ f_background = "judgestand";
+ f_desk_image = "judgedesk";
+ }
+ else if (pos == "hld" &&
+ file_exists(get_image_suffix(
+ get_background_path("helperstand")))) {
+ f_background = "helperstand";
+ f_desk_image = "helperdesk";
+ }
+ else if (pos == "hlp" &&
+ file_exists(get_image_suffix(
+ get_background_path("prohelperstand")))) {
+ f_background = "prohelperstand";
+ f_desk_image = "prohelperdesk";
+ }
+ else if (pos == "jur" && file_exists(get_image_suffix(
+ get_background_path("jurystand")))) {
+ f_background = "jurystand";
+ f_desk_image = "jurydesk";
+ }
+ else if (pos == "sea" &&
+ file_exists(get_image_suffix(
+ get_background_path("seancestand")))) {
+ f_background = "seancestand";
+ f_desk_image = "seancedesk";
+ }
+
+ if (file_exists(get_image_suffix(
+ get_background_path(pos)))) // Unique pos path
+ {
+ f_background = pos;
+ f_desk_image = pos + "_overlay";
+ }
+
+ QString desk_override = read_design_ini("overlays/" + f_background, get_background_path("design.ini"));
+ if (desk_override != "") {
+ f_desk_image = desk_override;
+}
+ if (desk) {
+ return f_desk_image;
+ }
+ return f_background;
+}
+
VPath AOApplication::get_evidence_path(QString p_file)
{
return VPath("evidence/" + p_file);