diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2018-12-15 11:02:12 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-15 11:02:12 -0600 |
| commit | de6877409714417c8fb29d66d1ae1ef098b82644 (patch) | |
| tree | db79ef284b2223daa1bee48056a96a81310945bf /aocharbutton.cpp | |
| parent | 3ef743da7b8071e0dc4b1189cbe131f65f11b5de (diff) | |
| parent | 6d1ea9d81fc02fbc481d93af549003db954aa1f7 (diff) | |
Merge pull request #33 from AttorneyOnline/mega-merge
AOV/Case Cafe feature parity
Diffstat (limited to 'aocharbutton.cpp')
| -rw-r--r-- | aocharbutton.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/aocharbutton.cpp b/aocharbutton.cpp index 550e819d..76610270 100644 --- a/aocharbutton.cpp +++ b/aocharbutton.cpp @@ -2,12 +2,14 @@ #include "file_functions.h" -AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos) : QPushButton(parent) +AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, bool is_taken) : QPushButton(parent) { m_parent = parent; ao_app = p_ao_app; + taken = is_taken; + this->resize(60, 60); this->move(x_pos, y_pos); @@ -38,9 +40,22 @@ void AOCharButton::reset() ui_selector->hide(); } -void AOCharButton::set_taken() +void AOCharButton::set_taken(bool is_taken) { - ui_taken->show(); + taken = is_taken; +} + +void AOCharButton::apply_taken_image() +{ + if (taken) + { + ui_taken->move(0,0); + ui_taken->show(); + } + else + { + ui_taken->hide(); + } } void AOCharButton::set_passworded() @@ -50,20 +65,12 @@ void AOCharButton::set_passworded() void AOCharButton::set_image(QString p_character) { - QString image_path = ao_app->get_character_path(p_character) + "char_icon.png"; - QString legacy_path = ao_app->get_demothings_path() + p_character.toLower() + "_char_icon.png"; - QString alt_path = ao_app->get_demothings_path() + p_character.toLower() + "_off.png"; + QString image_path = ao_app->get_character_path(p_character, "char_icon.png"); this->setText(""); if (file_exists(image_path)) this->setStyleSheet("border-image:url(\"" + image_path + "\")"); - else if (file_exists(legacy_path)) - { - this->setStyleSheet("border-image:url(\"" + legacy_path + "\")"); - //ninja optimization - QFile::copy(legacy_path, image_path); - } else { this->setStyleSheet("border-image:url()"); @@ -73,6 +80,7 @@ void AOCharButton::set_image(QString p_character) void AOCharButton::enterEvent(QEvent * e) { + ui_selector->move(this->x() - 1, this->y() - 1); ui_selector->raise(); ui_selector->show(); |
