Skip to content

Commit

Permalink
uhhhhh this is hell
Browse files Browse the repository at this point in the history
  • Loading branch information
Satoru-1816 committed Aug 14, 2024
1 parent a9f1478 commit ae92ff1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
13 changes: 12 additions & 1 deletion include/courtroom.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,18 @@ class Courtroom : public QMainWindow {
// TEST ONLY
void remote_select_emote(int p_id) {
select_emote(p_id);
};
}

// i'm sorry
void remote_char_update(QString char_name) {
if (char_name != current_char) {
current_char = char_name;
}
}

void remote_emote_update(int id) {
current_emote = id;
}

QString server_overlay = "";

Expand Down
2 changes: 2 additions & 0 deletions include/widgets/emote_menu_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ private slots:

QVector<AOEmoteButton*> spriteButtons;
QList<AOEmoteButton*> selectedButtons;
bool inSubfolder = false;
// QString original_charName;
};

class TagDialog : public QDialog {
Expand Down
37 changes: 22 additions & 15 deletions src/widgets/emote_menu_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,18 @@ void EmoteMenuFilter::showEvent(QShowEvent *event) {
}

void EmoteMenuFilter::loadButtons(const QStringList &emoteIds, bool isIniswap, const QString &subfolderPath) {
QString charName = ao_app->w_courtroom->get_current_char();
QString charName = ao_app->w_courtroom->get_current_char();

if (isIniswap && !subfolderPath.isEmpty()) {
charName = subfolderPath;
ao_app->w_courtroom->remote_char_update(subfolderPath);
inSubfolder = true;
} else {
if (charName.contains("/")) {
charName = charName.split('/').first();
}
inSubfolder = false;
}
int total_emotes = ao_app->get_emote_number(charName);
QString selected_image = ao_app->get_image_suffix(ao_app->get_theme_path("emote_selected", ""), true);
QString emotePath;
Expand All @@ -164,13 +175,7 @@ void EmoteMenuFilter::loadButtons(const QStringList &emoteIds, bool isIniswap, c
continue;
}

if (isIniswap && !subfolderPath.isEmpty()) {
// Load from the iniswap subfolder
emotePath = ao_app->get_image_suffix(ao_app->get_character_path(subfolderPath, "emotions/button" + QString::number(n + 1) + "_off"));
} else {
// Load from the default path
emotePath = ao_app->get_image_suffix(ao_app->get_character_path(charName, "emotions/button" + QString::number(n + 1) + "_off"));
}
emotePath = ao_app->get_image_suffix(ao_app->get_character_path(charName, "emotions/button" + QString::number(n + 1) + "_off"));

AOEmoteButton *spriteButton = new AOEmoteButton(this, ao_app, 0, 0, buttonSize, buttonSize);
spriteButton->set_image(emotePath, "");
Expand Down Expand Up @@ -278,7 +283,7 @@ void EmoteMenuFilter::onCategorySelected(QListWidgetItem *item) {
qDebug() << subfolderName;

loadButtons(QStringList(), true, subfolderName);
} else if (selectedCategory != "Default Emotes") {
} else if (selectedCategory != "Default Emotes") {
QMap<QString, QStringList> categories = ao_app->read_emote_categories(ao_app->w_courtroom->get_current_char());
QStringList emoteIds = categories.value(selectedCategory);
loadButtons(emoteIds);
Expand Down Expand Up @@ -539,26 +544,28 @@ void EmoteMenuFilter::onButtonClicked(AOEmoteButton *button) {
updateButtonSelection(button, true);
selectedButtons.append(button);

// courtroom->ui_ic_chat_message->setFocus();
// courtroom->ui_emote_dropdown->setCurrentIndex(button->get_id());
ao_app->w_courtroom->remote_select_emote(button->get_id()-1);
messageBox->setFocus();
}
}

void EmoteMenuFilter::updateButtonSelection(AOEmoteButton *button, bool isSelected) {
QString state;
QString charName;
if (isSelected) {
state = "_on";
} else {
state = "_off";
}

QString baseImagePath = ao_app->get_image_suffix(ao_app->get_character_path(ao_app->w_courtroom->get_current_char(),
if (!categoryList->currentItem()->text().contains("[>]")) {
charName = ao_app->w_courtroom->get_current_char(); // If this isn't a sub-folder
} else {
charName = categoryList->currentItem()->text().mid(4); // Change this once it works
}
QString baseImagePath = ao_app->get_image_suffix(ao_app->get_character_path(charName,
"emotions/button" + QString::number(button->get_id()) + state));

// button->set_image(baseImagePath, "");
button->set_char_image(ao_app->w_courtroom->get_current_char(), button->get_id() - 1, isSelected);
button->set_char_image(charName, button->get_id() - 1, isSelected);
}

QString EmoteMenuFilter::getEmoteMenuChat(bool clear) {
Expand Down

0 comments on commit ae92ff1

Please sign in to comment.