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/aoimage.cpp | |
| parent | 6f1bce5882676ea7affe717a2f5a00b8c3b7fe12 (diff) | |
| parent | ec1057b5d7e1d39963275bc2cbd79a53cf6f3f5c (diff) | |
Merge pull request #54 from OmniTroid/master
Restructuring + better cross-platform support
Diffstat (limited to 'src/aoimage.cpp')
| -rw-r--r-- | src/aoimage.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/aoimage.cpp b/src/aoimage.cpp new file mode 100644 index 00000000..7bb56bb6 --- /dev/null +++ b/src/aoimage.cpp @@ -0,0 +1,47 @@ +#include "file_functions.h" + +#include "aoimage.h" + +AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) +{ + m_parent = parent; + ao_app = p_ao_app; +} + +AOImage::~AOImage() +{ + +} + +void AOImage::set_image(QString p_image) +{ + QString theme_image_path = ao_app->get_theme_path(p_image); + QString default_image_path = ao_app->get_default_theme_path(p_image); + + QString final_image_path; + + if (file_exists(theme_image_path)) + final_image_path = theme_image_path; + else + final_image_path = default_image_path; + + QPixmap f_pixmap(final_image_path); + + this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); +} + +void AOImage::set_image_from_path(QString p_path) +{ + QString default_path = ao_app->get_default_theme_path("chatmed.png"); + + QString final_path; + + if (file_exists(p_path)) + final_path = p_path; + else + final_path = default_path; + + QPixmap f_pixmap(final_path); + + this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); +} |
