diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro index b0ccdee..e132277 100644 --- a/Attorney_Online_remake.pro +++ b/Attorney_Online_remake.pro @@ -13,7 +13,7 @@ RC_ICONS = logo.ico TARGET = Attorney_Online_remake TEMPLATE = app -VERSION = 2.3.5.0 +VERSION = 2.4.0.0 SOURCES += main.cpp\ lobby.cpp \ diff --git a/aoapplication.h b/aoapplication.h index f333e33..8585728 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -137,8 +137,8 @@ public: private: const int RELEASE = 2; - const int MAJOR_VERSION = 3; - const int MINOR_VERSION = 5; + const int MAJOR_VERSION = 4; + const int MINOR_VERSION = 0; QString user_theme = "default"; diff --git a/aoevidencebutton.cpp b/aoevidencebutton.cpp index 6fff5bc..36f4adf 100644 --- a/aoevidencebutton.cpp +++ b/aoevidencebutton.cpp @@ -7,6 +7,7 @@ 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; ui_selected = new AOImage(p_parent, ao_app); ui_selected->resize(70, 70); @@ -28,6 +29,13 @@ AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, i 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; @@ -44,14 +52,28 @@ void AOEvidenceButton::set_image(QString p_image) } } +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 final_image_path; + + if (file_exists(theme_image_path)) + final_image_path = theme_image_path; + else + final_image_path = default_image_path; + + this->setText(""); + this->setStyleSheet("border-image:url(\"" + final_image_path + "\")"); +} + void AOEvidenceButton::set_selected(bool p_selected) { - m_selected = p_selected; - - if (!m_selected) - ui_selected->hide(); - else + if (p_selected) ui_selected->show(); + else + ui_selected->hide(); } void AOEvidenceButton::on_clicked() diff --git a/aoevidencebutton.h b/aoevidencebutton.h index 2a630b8..9657f07 100644 --- a/aoevidencebutton.h +++ b/aoevidencebutton.h @@ -14,19 +14,20 @@ 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;} void set_selected(bool p_selected); private: AOApplication *ao_app; + QWidget *m_parent; AOImage *ui_selected; AOImage *ui_selector; - bool m_selected = false; - int m_id = 0; protected: diff --git a/aoscene.cpp b/aoscene.cpp index f5e3a69..2e26610 100644 --- a/aoscene.cpp +++ b/aoscene.cpp @@ -48,11 +48,11 @@ void AOScene::set_legacy_desk(QString p_image) int vp_height = m_parent->height(); //double y_modifier = 147 / 192; - double w_modifier = vp_width / 256; + //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_w = w_modifier * f_desk.width(); int final_h = h_modifier * f_desk.height(); //this->resize(final_w, final_h); diff --git a/courtroom.cpp b/courtroom.cpp index b047705..70d6df5 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -878,7 +878,7 @@ void Courtroom::on_chat_return_pressed() void Courtroom::handle_chatmessage(QStringList *p_contents) { - if (p_contents->size() < 15) + if (p_contents->size() < chatmessage_size) return; for (int n_string = 0 ; n_string < chatmessage_size ; ++n_string) @@ -886,10 +886,15 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) m_chatmessage[n_string] = p_contents->at(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_NAME])) return; - QString f_showname = ao_app->get_showname(char_list.at(m_chatmessage[CHAR_ID].toInt()).name); + QString f_showname = ao_app->get_showname(char_list.at(f_char_id).name); QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n'; @@ -1349,7 +1354,6 @@ void Courtroom::set_scene() } else { - qDebug() << "last"; if (f_side == "wit") { ui_vp_desk->show(); @@ -1502,7 +1506,10 @@ void Courtroom::mod_called(QString p_ip) { ui_server_chatlog->append(p_ip); if (ui_guard->isChecked()) + { modcall_player->play("sfx-gallery.wav"); + ao_app->alert(this); + } } void Courtroom::on_ooc_return_pressed() diff --git a/courtroom.h b/courtroom.h index 266938b..8838dcd 100644 --- a/courtroom.h +++ b/courtroom.h @@ -370,6 +370,7 @@ private slots: void on_emote_dropdown_changed(int p_index); + void on_evidence_name_edited(); void on_evidence_clicked(int p_id); void on_evidence_double_clicked(int p_id); diff --git a/evidence.cpp b/evidence.cpp index 7e915b0..0e65194 100644 --- a/evidence.cpp +++ b/evidence.cpp @@ -68,6 +68,7 @@ void Courtroom::construct_evidence() } } + 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_x, SIGNAL(clicked()), this, SLOT(on_evidence_x_clicked())); @@ -79,6 +80,8 @@ void Courtroom::set_evidence_list(QVector &p_evi_list) { local_evidence_list.clear(); local_evidence_list = p_evi_list; + + set_evidence_page(); } void Courtroom::set_evidence_page() @@ -110,12 +113,15 @@ void Courtroom::set_evidence_page() for (AOEvidenceButton *i_button : ui_evidence_list) { - i_button->hide(); + i_button->reset(); } if (total_evidence == 0) return; + //to account for the "add evidence" button + ++total_evidence; + int total_pages = total_evidence / max_evidence_on_page; int evidence_on_page = 0; @@ -132,6 +138,8 @@ void Courtroom::set_evidence_page() else evidence_on_page = max_evidence_on_page; + qDebug() << "total pages: " << total_pages; + if (total_pages > current_evidence_page + 1) ui_evidence_right->show(); @@ -142,34 +150,73 @@ void Courtroom::set_evidence_page() for (int n_evidence_button = 0 ; n_evidence_button < evidence_on_page ; ++n_evidence_button) { - qDebug() << "n_evidence_button " << 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); - if (n_real_evidence < total_evidence) + //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); + + 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(); } +} +void Courtroom::on_evidence_name_edited() +{ + 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_clicked(int p_id) { - ui_evidence_name->setText(local_evidence_list.at(p_id + max_evidence_on_page * current_evidence_page).name); + 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()) + { + ao_app->send_server_packet(new AOPacket("PE###empty.png#%")); + return; + } + else if (f_real_id > local_evidence_list.size()) + return; + + ui_evidence_name->setText(local_evidence_list.at(f_real_id).name); + + for (AOEvidenceButton *i_button : ui_evidence_list) + i_button->set_selected(false); + + ui_evidence_list.at(p_id)->set_selected(true); + + /* for (AOEvidenceButton *i_button : ui_evidence_list) { i_button->set_selected(false); } ui_evidence_list.at(p_id)->set_selected(true); + */ - current_evidence = p_id + max_evidence_on_page * current_evidence_page; + current_evidence = f_real_id; } void Courtroom::on_evidence_double_clicked(int p_id) @@ -184,12 +231,15 @@ void Courtroom::on_evidence_hover(int p_id, bool p_state) { int final_id = p_id + max_evidence_on_page * current_evidence_page; - if (p_state && final_id < local_evidence_list.size()) + if (p_state) { - ui_evidence_name->setText(local_evidence_list.at(final_id).name); + if (final_id == local_evidence_list.size()) + 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); + else + ui_evidence_name->setText(local_evidence_list.at(current_evidence).name); } - else - ui_evidence_name->setText(local_evidence_list.at(current_evidence).name); } void Courtroom::on_evidence_left_clicked()