diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2019-01-02 09:40:38 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-02 09:40:38 -0600 |
| commit | 4d93f059c01664ad074cf467e79a63b85e86beb0 (patch) | |
| tree | 57b8a9760796937e66e393b3bc00f4bee4337bdf /src/aoemotebutton.cpp | |
| parent | 6f1bce5882676ea7affe717a2f5a00b8c3b7fe12 (diff) | |
| parent | ec1057b5d7e1d39963275bc2cbd79a53cf6f3f5c (diff) | |
Merge pull request #54 from OmniTroid/master
Restructuring + better cross-platform support
Diffstat (limited to 'src/aoemotebutton.cpp')
| -rw-r--r-- | src/aoemotebutton.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/aoemotebutton.cpp b/src/aoemotebutton.cpp new file mode 100644 index 00000000..9c1d3889 --- /dev/null +++ b/src/aoemotebutton.cpp @@ -0,0 +1,36 @@ +#include "aoemotebutton.h" + +#include "file_functions.h" + +AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent) +{ + parent = p_parent; + ao_app = p_ao_app; + + this->move(p_x, p_y); + this->resize(40, 40); + + connect(this, SIGNAL(clicked()), this, SLOT(on_clicked())); +} + +void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix) +{ + QString emotion_number = QString::number(p_emote + 1); + QString image_path = ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix); + + if (file_exists(image_path)) + { + this->setText(""); + this->setStyleSheet("border-image:url(\"" + image_path + "\")"); + } + else + { + this->setText(ao_app->get_emote_comment(p_char, p_emote)); + this->setStyleSheet("border-image:url(\"\")"); + } +} + +void AOEmoteButton::on_clicked() +{ + emote_clicked(m_id); +} |
