diff options
| -rw-r--r-- | include/courtroom.h | 4 | ||||
| -rw-r--r-- | src/aocharmovie.cpp | 4 | ||||
| -rw-r--r-- | src/aoemotebutton.cpp | 1 | ||||
| -rw-r--r-- | src/aoimage.cpp | 15 | ||||
| -rw-r--r-- | src/aomovie.cpp | 1 | ||||
| -rw-r--r-- | src/aooptionsdialog.cpp | 7 | ||||
| -rw-r--r-- | src/aoscene.cpp | 1 | ||||
| -rw-r--r-- | src/aosfxplayer.cpp | 9 | ||||
| -rw-r--r-- | src/courtroom.cpp | 96 |
9 files changed, 99 insertions, 39 deletions
diff --git a/include/courtroom.h b/include/courtroom.h index 5b5ff6c1..172b9f15 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -424,8 +424,12 @@ private: // List of all currently available pos QStringList pos_dropdown_list; + // is the message we're about to send supposed to present evidence? bool is_presenting_evidence = false; + // have we already presented evidence for this message? + bool evidence_presented = false; + QString effect = ""; // Music effect flags we want to send to server when we play music diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index 252aab5d..2fe90b64 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -35,8 +35,8 @@ void AOCharMovie::load_image(QString p_char, QString p_emote, 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_character_path( + p_char, p_emote)), // Just use the non-prefixed image, animated or not 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( diff --git a/src/aoemotebutton.cpp b/src/aoemotebutton.cpp index 90535607..652010d2 100644 --- a/src/aoemotebutton.cpp +++ b/src/aoemotebutton.cpp @@ -27,6 +27,7 @@ void AOEmoteButton::set_image(QString p_image, QString p_emote_comment) } else if (p_image.contains("_on") && file_exists(tmp_p_image.replace("_on", "_off"))) { QImage tmpImage(tmp_p_image); + tmpImage = tmpImage.convertToFormat(QImage::Format_ARGB32); QPoint p1, p2; p2.setY(tmpImage.height()); diff --git a/src/aoimage.cpp b/src/aoimage.cpp index 2663ba05..3977c979 100644 --- a/src/aoimage.cpp +++ b/src/aoimage.cpp @@ -2,6 +2,8 @@ #include "aoimage.h" +#include <QBitmap> + AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) { m_parent = parent; @@ -29,9 +31,10 @@ bool AOImage::set_image(QString p_image) } QPixmap f_pixmap(final_image_path); - - this->setPixmap( - f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + f_pixmap = + f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio); + this->setPixmap(f_pixmap); + this->setMask(f_pixmap.mask()); return true; } @@ -45,7 +48,9 @@ bool AOImage::set_chatbox(QString p_path) QPixmap f_pixmap(p_path); - this->setPixmap( - f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + f_pixmap = + f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio); + this->setPixmap(f_pixmap); + this->setMask(f_pixmap.mask()); return true; } diff --git a/src/aomovie.cpp b/src/aomovie.cpp index ac949219..196c1d3e 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -9,6 +9,7 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) ao_app = p_ao_app; m_movie = new QMovie(); + m_movie->setCacheMode(QMovie::CacheAll); this->setMovie(m_movie); diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 6fc4d03e..4d36f43f 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -756,6 +756,9 @@ void AOOptionsDialog::save_pressed() // Save everything into the config.ini. QSettings *configini = ao_app->configini; + const bool audioChanged = ui_audio_device_combobox->currentText() != + ao_app->get_audio_output_device(); + configini->setValue("theme", ui_theme_combobox->currentText()); configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked()); configini->setValue("log_maximum", ui_length_spinbox->value()); @@ -806,7 +809,9 @@ void AOOptionsDialog::save_pressed() configini->setValue("casing_can_host_cases", ui_casing_cm_cases_textbox->text()); - ao_app->initBASS(); + if (audioChanged) + ao_app->initBASS(); + callwordsini->close(); done(0); } diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 594013a1..78d69acd 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); + m_movie->setCacheMode(QMovie::CacheAll); last_image = ""; } diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index 8c4f3c86..1a0e2d2f 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -37,11 +37,16 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, QString misc_path = ""; QString char_path = ""; + QString theme_path = ""; QString sound_path = ao_app->get_sfx_suffix(ao_app->get_sounds_path(p_sfx)); - if (shout != "") + if (shout != "") { misc_path = ao_app->get_sfx_suffix(ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx); + theme_path = ao_app->get_sfx_suffix(ao_app->get_theme_path(p_sfx)); + if (!file_exists(theme_path)) + theme_path = ao_app->get_sfx_suffix(ao_app->get_default_theme_path(p_sfx)); + } if (p_char != "") char_path = ao_app->get_sfx_suffix(ao_app->get_character_path(p_char, p_sfx)); @@ -52,6 +57,8 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout, f_path = char_path; else if (file_exists(misc_path)) f_path = misc_path; + else if (shout != "" && file_exists(theme_path)) //only check here for shouts + f_path = theme_path; else f_path = sound_path; diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 2484bcb0..a12c95ae 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -552,7 +552,11 @@ void Courtroom::set_widgets() log_maximum_blocks = ao_app->get_max_log_size(); - bool regenerate = log_goes_downwards != ao_app->get_log_goes_downwards() || log_colors != ao_app->is_colorlog_enabled() || log_newline != ao_app->get_log_newline() || log_margin != ao_app->get_log_margin() || log_timestamp != ao_app->get_log_timestamp(); + bool regenerate = log_goes_downwards != ao_app->get_log_goes_downwards() || + log_colors != ao_app->is_colorlog_enabled() || + log_newline != ao_app->get_log_newline() || + log_margin != ao_app->get_log_margin() || + log_timestamp != ao_app->get_log_timestamp(); log_goes_downwards = ao_app->get_log_goes_downwards(); log_colors = ao_app->is_colorlog_enabled(); log_newline = ao_app->get_log_newline(); @@ -563,7 +567,8 @@ void Courtroom::set_widgets() set_size_and_pos(ui_ic_chatlog, "ic_chatlog"); ui_ic_chatlog->setFrameShape(QFrame::NoFrame); - ui_ic_chatlog->setPlaceholderText(log_goes_downwards ? "▼ Log goes down ▼" : "▲ Log goes up ▲"); + ui_ic_chatlog->setPlaceholderText(log_goes_downwards ? "▼ Log goes down ▼" + : "▲ Log goes up ▲"); set_size_and_pos(ui_ms_chatlog, "ms_chatlog"); ui_ms_chatlog->setFrameShape(QFrame::NoFrame); @@ -705,6 +710,8 @@ void Courtroom::set_widgets() "the original character folder.")); ui_sfx_remove->hide(); + set_iniswap_dropdown(); + set_size_and_pos(ui_effects_dropdown, "effects_dropdown"); ui_effects_dropdown->setInsertPolicy(QComboBox::InsertAtBottom); ui_effects_dropdown->setToolTip( @@ -1525,6 +1532,9 @@ void Courtroom::on_chat_return_pressed() if ((anim_state < 3 || text_state < 2) && objection_state == 0) return; + ui_ic_chat_message->blockSignals(true); + QTimer::singleShot(600, this, + [=] { ui_ic_chat_message->blockSignals(false); }); // MS# // deskmod# // pre-emote# @@ -1752,6 +1762,7 @@ void Courtroom::reset_ic() ui_vp_chat_arrow->stop(); text_state = 0; anim_state = 0; + evidence_presented = false; ui_vp_objection->stop(); chat_tick_timer->stop(); ui_vp_evidence_display->reset(); @@ -1853,10 +1864,10 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) m_chatmessage[MESSAGE] = ""; // Turn it into true blankpost } - if (!m_chatmessage[MESSAGE].isEmpty() || ic_chatlog_history.isEmpty() || ic_chatlog_history.last().get_message() != "") - { + if (!m_chatmessage[MESSAGE].isEmpty() || ic_chatlog_history.isEmpty() || + ic_chatlog_history.last().get_message() != "") { log_ic_text(f_charname, f_displayname, m_chatmessage[MESSAGE], "", - m_chatmessage[TEXT_COLOR].toInt()); + m_chatmessage[TEXT_COLOR].toInt()); append_ic_text(m_chatmessage[MESSAGE], f_displayname, "", m_chatmessage[TEXT_COLOR].toInt()); } @@ -2244,7 +2255,8 @@ void Courtroom::handle_chatmessage_3() .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()) { + if (f_evi_id > 0 && f_evi_id <= local_evidence_list.size() && + !evidence_presented) { // 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_evi_name = local_evidence_list.at(f_evi_id - 1).name; @@ -2254,9 +2266,12 @@ void Courtroom::handle_chatmessage_3() ui_vp_evidence_display->show_evidence(f_image, is_left_side, ui_sfx_slider->value()); - log_ic_text(m_chatmessage[CHAR_NAME], m_chatmessage[SHOWNAME], f_evi_name, tr("has presented evidence"), - m_chatmessage[TEXT_COLOR].toInt()); + log_ic_text(m_chatmessage[CHAR_NAME], m_chatmessage[SHOWNAME], f_evi_name, + tr("has presented evidence"), + m_chatmessage[TEXT_COLOR].toInt()); append_ic_text(f_evi_name, f_showname, tr("has presented evidence")); + evidence_presented = true; // we're done presenting evidence, and we + // don't want to do it twice } int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); @@ -2561,10 +2576,9 @@ QString Courtroom::filter_ic_text(QString p_text, bool html, int target_pos, } void Courtroom::log_ic_text(QString p_name, QString p_showname, - QString p_message, QString p_action, int p_color) + QString p_message, QString p_action, int p_color) { - chatlogpiece log_entry(p_name, p_showname, p_message, p_action, - p_color); + chatlogpiece log_entry(p_name, p_showname, p_message, p_action, p_color); ic_chatlog_history.append(log_entry); if (ao_app->get_auto_logging_enabled()) ao_app->append_to_file(log_entry.get_full(), ao_app->log_filename, true); @@ -2589,9 +2603,12 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action, const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); const bool need_newline = !ui_ic_chatlog->document()->isEmpty(); - const int scrollbar_target_value = log_goes_downwards ? ui_ic_chatlog->verticalScrollBar()->maximum() : ui_ic_chatlog->verticalScrollBar()->minimum(); + const int scrollbar_target_value = + log_goes_downwards ? ui_ic_chatlog->verticalScrollBar()->maximum() + : ui_ic_chatlog->verticalScrollBar()->minimum(); - ui_ic_chatlog->moveCursor(log_goes_downwards ? QTextCursor::End : QTextCursor::Start); + ui_ic_chatlog->moveCursor(log_goes_downwards ? QTextCursor::End + : QTextCursor::Start); // Only prepend with newline if log goes downwards if (log_goes_downwards && need_newline) { @@ -2600,7 +2617,9 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action, // Timestamp if we're doing that meme if (log_timestamp) - ui_ic_chatlog->textCursor().insertText("[" + QDateTime::currentDateTime().toString("h:mm:ss AP") + "] ", normal); + ui_ic_chatlog->textCursor().insertText( + "[" + QDateTime::currentDateTime().toString("h:mm:ss AP") + "] ", + normal); // Format the name of the actor ui_ic_chatlog->textCursor().insertText(p_name, bold); @@ -2609,8 +2628,9 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action, // Format the action in normal ui_ic_chatlog->textCursor().insertText(" " + p_action, normal); if (log_newline) - // For some reason, we're forced to use <br> instead of the more sensible \n. - // Why? Because \n is treated as a new Block instead of a soft newline within a paragraph! + // For some reason, we're forced to use <br> instead of the more sensible + // \n. Why? Because \n is treated as a new Block instead of a soft newline + // within a paragraph! ui_ic_chatlog->textCursor().insertHtml("<br>"); else ui_ic_chatlog->textCursor().insertText(": ", normal); @@ -2619,16 +2639,19 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action, } else { if (log_newline) - // For some reason, we're forced to use <br> instead of the more sensible \n. - // Why? Because \n is treated as a new Block instead of a soft newline within a paragraph! + // For some reason, we're forced to use <br> instead of the more sensible + // \n. Why? Because \n is treated as a new Block instead of a soft newline + // within a paragraph! ui_ic_chatlog->textCursor().insertHtml("<br>"); else ui_ic_chatlog->textCursor().insertText(": ", normal); // Format the result according to html if (log_colors) - ui_ic_chatlog->textCursor().insertHtml(filter_ic_text(p_text, true, -1, color)); + ui_ic_chatlog->textCursor().insertHtml( + filter_ic_text(p_text, true, -1, color)); else - ui_ic_chatlog->textCursor().insertText(filter_ic_text(p_text, false), normal); + ui_ic_chatlog->textCursor().insertText(filter_ic_text(p_text, false), + normal); } // Only append with newline if log goes upwards @@ -2639,7 +2662,8 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action, // If we got too many blocks in the current log, delete some. while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) { - ui_ic_chatlog->moveCursor(log_goes_downwards ? QTextCursor::Start : QTextCursor::End); + ui_ic_chatlog->moveCursor(log_goes_downwards ? QTextCursor::Start + : QTextCursor::End); ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); ui_ic_chatlog->textCursor().removeSelectedText(); if (log_goes_downwards) @@ -2649,7 +2673,8 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action, } // Finally, scroll the scrollbar to the correct position. - if (old_cursor.hasSelection() || old_scrollbar_value != scrollbar_target_value) { + if (old_cursor.hasSelection() || + old_scrollbar_value != scrollbar_target_value) { // The user has selected text or scrolled away from the bottom: maintain // position. ui_ic_chatlog->setTextCursor(old_cursor); @@ -2658,9 +2683,10 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, QString p_action, else { // The user hasn't selected any text and the scrollbar is at the bottom: // scroll to the bottom. - ui_ic_chatlog->moveCursor(log_goes_downwards ? QTextCursor::End : QTextCursor::Start); + ui_ic_chatlog->moveCursor(log_goes_downwards ? QTextCursor::End + : QTextCursor::Start); ui_ic_chatlog->verticalScrollBar()->setValue( - ui_ic_chatlog->verticalScrollBar()->maximum()); + log_goes_downwards ? ui_ic_chatlog->verticalScrollBar()->maximum() : 0); } } @@ -3136,8 +3162,12 @@ 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_clear); + if (channel == 0) { + if (file_exists(ao_app->get_sfx_suffix(ao_app->get_music_path(f_song)))) + ui_music_name->setText(f_song_clear); + else + ui_music_name->setText(tr("[MISSING] %1").arg(f_song_clear)); + } } else { QString str_char = char_list.at(n_char).name; @@ -3164,12 +3194,16 @@ void Courtroom::handle_song(QStringList *p_contents) if (!mute_map.value(n_char)) { log_ic_text(str_char, str_show, f_song, tr("has played a song"), - m_chatmessage[TEXT_COLOR].toInt()); + m_chatmessage[TEXT_COLOR].toInt()); 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) - ui_music_name->setText(f_song_clear); + if (channel == 0) { + if (file_exists(ao_app->get_sfx_suffix(ao_app->get_music_path(f_song)))) + ui_music_name->setText(f_song_clear); + else + ui_music_name->setText(tr("[MISSING] %1").arg(f_song_clear)); + } } } } @@ -4633,7 +4667,9 @@ void Courtroom::regenerate_ic_chatlog() { ui_ic_chatlog->clear(); foreach (chatlogpiece item, ic_chatlog_history) { - append_ic_text(item.get_message(), ui_showname_enable->isChecked() ? item.get_showname() : item.get_name(), + append_ic_text(item.get_message(), + ui_showname_enable->isChecked() ? item.get_showname() + : item.get_name(), item.get_action(), item.get_chat_color()); } } |
