Skip to content

Commit a64241a

Browse files
authored
Merge pull request #473 from AttorneyOnline/fix/everything
Fix change character lag, bg resizing and repos weirdness, inconsistent behavior, sticker setting etc.
2 parents f1eb91a + 5ac95ad commit a64241a

12 files changed

Lines changed: 190 additions & 228 deletions

include/aoapplication.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ class AOApplication : public QApplication {
228228
// for settings.
229229
bool is_customchat_enabled();
230230

231+
// Returns the value of characer sticker (avatar) setting
232+
bool is_sticker_enabled();
233+
231234
// Returns the value of whether continuous playback should be used
232235
// from the config.ini.
233236
bool is_continuous_enabled();

include/aooptionsdialog.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ class AOOptionsDialog : public QDialog {
108108
QLabel *ui_customchat_lbl;
109109
QCheckBox *ui_customchat_cb;
110110

111+
QLabel *ui_sticker_lbl;
112+
QCheckBox *ui_sticker_cb;
113+
111114
QLabel *ui_continuous_lbl;
112115
QCheckBox *ui_continuous_cb;
113116

include/courtroom.h

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ class Courtroom : public QMainWindow {
121121

122122
void character_loading_finished();
123123

124+
//
125+
void set_courtroom_size();
126+
124127
// sets position of widgets based on theme ini files
125128
void set_widgets();
126129

@@ -140,18 +143,15 @@ class Courtroom : public QMainWindow {
140143
void set_fonts(QString p_char = "");
141144

142145
// sets dropdown menu stylesheet
143-
void set_dropdown(QWidget *widget);
146+
void set_stylesheet(QWidget *widget);
144147

145148
// helper funciton that call above function on the relevant widgets
146-
void set_dropdowns();
149+
void set_stylesheets();
147150

148151
void set_window_title(QString p_title);
149152

150-
// reads theme inis and sets size and pos based on the identifier
151-
void set_size_and_pos(QWidget *p_widget, QString p_identifier);
152-
153-
// reads theme and char inis and sets size and pos based on the identifier
154-
void set_size_and_pos(QWidget *p_widget, QString p_identifier, QString p_char);
153+
// reads theme and sets size and pos based on the identifier (using p_misc if provided)
154+
void set_size_and_pos(QWidget *p_widget, QString p_identifier, QString p_misc="");
155155

156156
// reads theme inis and returns the size and pos as defined by it
157157
QPoint get_theme_pos(QString p_identifier);
@@ -165,7 +165,7 @@ class Courtroom : public QMainWindow {
165165
void set_background(QString p_background, bool display = false);
166166

167167
// sets the local character pos/side to use.
168-
void set_side(QString p_side, bool block_signals=true);
168+
void set_side(QString p_side);
169169

170170
// sets the pos dropdown
171171
void set_pos_dropdown(QStringList pos_dropdowns);
@@ -576,10 +576,6 @@ class Courtroom : public QMainWindow {
576576
int evidence_rows = 3;
577577
int max_evidence_on_page = 18;
578578

579-
// is set to true if the bg folder contains defensedesk.png,
580-
// prosecutiondesk.png and stand.png
581-
bool is_ao2_bg = false;
582-
583579
// whether the ooc chat is server or master chat, true is server
584580
bool server_ooc = true;
585581

@@ -826,7 +822,7 @@ private slots:
826822
void music_random();
827823
void music_list_expand_all();
828824
void music_list_collapse_all();
829-
void music_stop();
825+
void music_stop(bool no_effects = false);
830826
void on_area_list_double_clicked(QTreeWidgetItem *p_item, int column);
831827

832828
void select_emote(int p_id);
@@ -838,6 +834,7 @@ private slots:
838834

839835
void on_emote_dropdown_changed(int p_index);
840836
void on_pos_dropdown_changed(int p_index);
837+
void on_pos_dropdown_changed(QString p_text);
841838
void on_pos_remove_clicked();
842839

843840
void on_iniswap_dropdown_changed(int p_index);

include/lobby.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include <QDebug>
1919
#include <QScrollBar>
20+
#include <QHeaderView>
2021

2122
class AOApplication;
2223

@@ -32,7 +33,7 @@ class Lobby : public QMainWindow {
3233
void append_chatmessage(QString f_name, QString f_message);
3334
void append_error(QString f_message);
3435
void set_player_count(int players_online, int max_players);
35-
void set_stylesheet(QWidget *widget, QString target_tag);
36+
void set_stylesheet(QWidget *widget);
3637
void set_stylesheets();
3738
void set_fonts();
3839
void set_font(QWidget *widget, QString p_identifier);

src/aolayer.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,11 @@ void InterfaceLayer::load_image(QString p_filename, QString p_miscname)
240240

241241
void StickerLayer::load_image(QString p_charname)
242242
{
243-
QString p_miscname = ao_app->get_chat(p_charname);
243+
QString p_miscname;
244+
if (ao_app->is_customchat_enabled())
245+
p_miscname = ao_app->get_chat(p_charname);
244246
transform_mode = ao_app->get_misc_scaling(p_miscname);
245247
QString final_image = ao_app->get_image("sticker/" + p_charname, ao_app->current_theme, ao_app->get_subtheme(), ao_app->default_theme, p_miscname);
246-
if (!file_exists((final_image)))
247-
final_image = ao_app->get_image_suffix(
248-
ao_app->get_character_path(p_charname, "showname")), // Scuffed DRO way
249248
start_playback(final_image);
250249
}
251250

@@ -261,6 +260,7 @@ void CharLayer::start_playback(QString p_image)
261260

262261
void AOLayer::start_playback(QString p_image)
263262
{
263+
this->show();
264264

265265
if (!ao_app->is_continuous_enabled()) {
266266
continuous = false;
@@ -322,7 +322,6 @@ void AOLayer::start_playback(QString p_image)
322322
int f_delay = m_reader.nextImageDelay();
323323

324324
this->set_frame(f_pixmap);
325-
this->show();
326325
if (max_frames > 1) {
327326
movie_frames.append(f_pixmap);
328327
movie_delays.append(f_delay);
@@ -450,6 +449,10 @@ void CharLayer::load_network_effects()
450449

451450
void CharLayer::play_frame_effect(int p_frame)
452451
{
452+
if (p_frame >= movie_effects.size()) {
453+
qDebug() << "W: Attempted to play a frame effect bigger than the size of movie_effects";
454+
return;
455+
}
453456
if (p_frame < max_frames) {
454457
foreach (QString effect, movie_effects[p_frame]) {
455458
if (effect == "shake") {

src/aooptionsdialog.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,19 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
485485

486486
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_customchat_cb);
487487

488+
row += 1;
489+
ui_sticker_lbl = new QLabel(ui_form_layout_widget);
490+
ui_sticker_lbl->setText(tr("Stickers:"));
491+
ui_sticker_lbl->setToolTip(
492+
tr("Turn this on to allow characters to define their own "
493+
"stickers (unique images that show up over the chatbox - like avatars or shownames)."));
494+
495+
ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_sticker_lbl);
496+
497+
ui_sticker_cb = new QCheckBox(ui_form_layout_widget);
498+
499+
ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_sticker_cb);
500+
488501
row += 1;
489502
ui_continuous_lbl = new QLabel(ui_form_layout_widget);
490503
ui_continuous_lbl->setText(tr("Continuous Playback:"));
@@ -691,8 +704,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
691704
ui_objectmusic_lbl = new QLabel(ui_audio_widget);
692705
ui_objectmusic_lbl->setText(tr("Kill Music On Objection:"));
693706
ui_objectmusic_lbl->setToolTip(
694-
tr("If true, AO2 will stop the music for you when you or someone else "
695-
"does 'Objection!'."));
707+
tr("If true, AO2 will ask the server to stop music when you use 'Objection!' "));
696708

697709
ui_audio_layout->setWidget(row, QFormLayout::LabelRole, ui_objectmusic_lbl);
698710

@@ -909,6 +921,7 @@ void AOOptionsDialog::update_values() {
909921
ui_stickyeffects_cb->setChecked(ao_app->is_stickyeffects_enabled());
910922
ui_stickypres_cb->setChecked(ao_app->is_stickypres_enabled());
911923
ui_customchat_cb->setChecked(ao_app->is_customchat_enabled());
924+
ui_sticker_cb->setChecked(ao_app->is_sticker_enabled());
912925
ui_continuous_cb->setChecked(ao_app->is_continuous_enabled());
913926
ui_category_stop_cb->setChecked(ao_app->is_category_stop_enabled());
914927
ui_blank_blips_cb->setChecked(ao_app->get_blank_blip());

src/charselect.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ void Courtroom::char_clicked(int n_char)
177177
}
178178
else {
179179
update_character(n_char);
180-
set_widgets(); // so we don't erroneously keep the charselect's fixedSize
180+
enter_courtroom();
181+
set_courtroom_size();
181182
}
182183

183184
if (n_char != -1)

0 commit comments

Comments
 (0)