aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCrystalwarrior <varsash@gmail.com>2021-03-24 23:05:09 +0300
committerCrystalwarrior <varsash@gmail.com>2021-03-24 23:05:09 +0300
commit37de947a3df3c90b27562515f5d3a1e05ad40de5 (patch)
treee3925beb6a3649dd3dfd49f852262b2334b01d62
parente9eba9b5ab1b022905d2f6dbe8e6ad2e2a516372 (diff)
Mark ui_selector, ui_passworded, ui_taken for evidence and character select as static-only due to massice performance overhead for no substantial benefit
-rw-r--r--include/aoimage.h4
-rw-r--r--src/aocharbutton.cpp6
-rw-r--r--src/aoevidencebutton.cpp4
-rw-r--r--src/aoimage.cpp5
-rw-r--r--src/charselect.cpp2
5 files changed, 12 insertions, 9 deletions
diff --git a/include/aoimage.h b/include/aoimage.h
index 70ff1fc0..b75eee19 100644
--- a/include/aoimage.h
+++ b/include/aoimage.h
@@ -11,7 +11,7 @@
class AOImage : public QLabel {
public:
- AOImage(QWidget *parent, AOApplication *p_ao_app);
+ AOImage(QWidget *parent, AOApplication *p_ao_app, bool make_static = false);
~AOImage();
QWidget *m_parent;
@@ -20,6 +20,8 @@ public:
QString path;
+ bool is_static = false;
+
bool set_image(QString p_image, QString p_misc = "");
void set_size_and_pos(QString identifier);
};
diff --git a/src/aocharbutton.cpp b/src/aocharbutton.cpp
index 3b384f35..5b48e50a 100644
--- a/src/aocharbutton.cpp
+++ b/src/aocharbutton.cpp
@@ -15,19 +15,19 @@ AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos,
this->resize(60, 60);
this->move(x_pos, y_pos);
- ui_taken = new AOImage(this, ao_app);
+ ui_taken = new AOImage(this, ao_app, true);
ui_taken->resize(60, 60);
ui_taken->set_image("char_taken");
ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents);
ui_taken->hide();
- ui_passworded = new AOImage(this, ao_app);
+ ui_passworded = new AOImage(this, ao_app, true);
ui_passworded->resize(60, 60);
ui_passworded->set_image("char_passworded");
ui_passworded->setAttribute(Qt::WA_TransparentForMouseEvents);
ui_passworded->hide();
- ui_selector = new AOImage(parent, ao_app);
+ ui_selector = new AOImage(parent, ao_app, true);
ui_selector->resize(62, 62);
ui_selector->move(x_pos - 1, y_pos - 1);
ui_selector->set_image("char_selector");
diff --git a/src/aoevidencebutton.cpp b/src/aoevidencebutton.cpp
index aea903ad..fee7327a 100644
--- a/src/aoevidencebutton.cpp
+++ b/src/aoevidencebutton.cpp
@@ -9,14 +9,14 @@ AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app,
ao_app = p_ao_app;
m_parent = p_parent;
- ui_selected = new AOImage(this, ao_app);
+ ui_selected = new AOImage(this, ao_app, true);
ui_selected->resize(p_w, p_h);
// ui_selected->move(p_x, p_y);
ui_selected->set_image("evidence_selected");
ui_selected->setAttribute(Qt::WA_TransparentForMouseEvents);
ui_selected->hide();
- ui_selector = new AOImage(this, ao_app);
+ ui_selector = new AOImage(this, ao_app, true);
ui_selector->resize(p_w, p_h);
// ui_selector->move(p_x - 1, p_y - 1);
ui_selector->set_image("evidence_selector");
diff --git a/src/aoimage.cpp b/src/aoimage.cpp
index e1bd8b8c..142189c2 100644
--- a/src/aoimage.cpp
+++ b/src/aoimage.cpp
@@ -4,11 +4,12 @@
#include <QBitmap>
-AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
+AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app, bool make_static) : QLabel(parent)
{
m_parent = parent;
ao_app = p_ao_app;
movie = new QMovie();
+ is_static = make_static;
connect(movie, &QMovie::frameChanged, [=]{
QPixmap f_pixmap = movie->currentPixmap();
f_pixmap =
@@ -23,7 +24,7 @@ AOImage::~AOImage() {}
bool AOImage::set_image(QString p_path, QString p_misc)
{
// Check if the user wants animated themes
- if (ao_app->get_animated_theme())
+ if (!is_static && ao_app->get_animated_theme())
// We want an animated image
p_path = ao_app->get_image(p_path, ao_app->current_theme, ao_app->get_subtheme(), ao_app->default_theme, p_misc);
else
diff --git a/src/charselect.cpp b/src/charselect.cpp
index 510d8c0a..d45e8759 100644
--- a/src/charselect.cpp
+++ b/src/charselect.cpp
@@ -21,7 +21,7 @@ void Courtroom::construct_char_select()
ui_char_buttons = new QWidget(ui_char_select_background);
- ui_selector = new AOImage(ui_char_select_background, ao_app);
+ ui_selector = new AOImage(ui_char_select_background, ao_app, true);
ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
ui_selector->resize(62, 62);