aboutsummaryrefslogtreecommitdiff
path: root/src/aobutton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/aobutton.cpp')
-rw-r--r--src/aobutton.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/aobutton.cpp b/src/aobutton.cpp
index 5ef2a066..4fc50d65 100644
--- a/src/aobutton.cpp
+++ b/src/aobutton.cpp
@@ -4,40 +4,44 @@
#include "file_functions.h"
#include "options.h"
-AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app)
+AOButton::AOButton(AOApplication *p_ao_app, QWidget *parent)
: QPushButton(parent)
+ , ao_app(p_ao_app)
{
- ao_app = p_ao_app;
- movie = new QMovie(this);
- connect(movie, &QMovie::frameChanged, [this]{
- this->setIcon(movie->currentPixmap().scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
+ m_movie = new QMovie(this);
+
+ connect(m_movie, &QMovie::frameChanged, this, [this] {
+ this->setIcon(m_movie->currentPixmap().scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
this->setIconSize(QSize(this->width(), this->height()));
});
}
-AOButton::~AOButton() {}
+AOButton::~AOButton()
+{}
void AOButton::set_image(QString p_path, QString p_misc)
{
- movie->stop();
+ m_movie->stop();
QString p_image;
- p_image = ao_app->get_image(p_path, Options::getInstance().theme(), Options::getInstance().subTheme(),
- ao_app->default_theme, p_misc, "", "", !Options::getInstance().animatedThemeEnabled());
- if (p_image.isEmpty()) {
- this->setIcon(QIcon());
- this->setIconSize(this->size());
- this->setStyleSheet("");
- return;
+ p_image = ao_app->get_image(p_path, Options::getInstance().theme(), Options::getInstance().subTheme(), ao_app->default_theme, p_misc, "", "", !Options::getInstance().animatedThemeEnabled());
+ if (p_image.isEmpty())
+ {
+ this->setIcon(QIcon());
+ this->setIconSize(this->size());
+ this->setStyleSheet("");
+ return;
}
this->setText("");
this->setStyleSheet("QPushButton { background-color: transparent; border: 0px }");
- movie->setFileName(p_image);
+ m_movie->setFileName(p_image);
// We double-check if the user wants animated themes, so even if an animated image slipped through,
// we still set it static
- if (Options::getInstance().animatedThemeEnabled() && movie->frameCount() > 1) {
- movie->start();
+ if (Options::getInstance().animatedThemeEnabled() && m_movie->frameCount() > 1)
+ {
+ m_movie->start();
}
- else {
+ else
+ {
this->setIcon(QPixmap(p_image).scaled(this->size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
this->setIconSize(this->size());
}