aboutsummaryrefslogtreecommitdiff
path: root/aocharbutton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'aocharbutton.cpp')
-rw-r--r--aocharbutton.cpp32
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();