diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2020-08-13 10:47:50 -0500 |
|---|---|---|
| committer | oldmud0 <oldmud0@users.noreply.github.com> | 2020-08-13 10:48:53 -0500 |
| commit | e88f885a9f69909bd759b8cc81e089f85ee58930 (patch) | |
| tree | f8358f05bef0bb93b2ef132774fc7b31250dcb46 /src/aoimage.cpp | |
| parent | 593e9d7353f601f81bbe26925ace4966434e7370 (diff) | |
| parent | ec1c95bdb33dd063880c4cb6c3c9c3cf5d0ed454 (diff) | |
Merge master with some older CI changes
Diffstat (limited to 'src/aoimage.cpp')
| -rw-r--r-- | src/aoimage.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/aoimage.cpp b/src/aoimage.cpp index ffdf25aa..2663ba05 100644 --- a/src/aoimage.cpp +++ b/src/aoimage.cpp @@ -10,37 +10,42 @@ AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) AOImage::~AOImage() {} -void AOImage::set_image(QString p_image) +bool 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 theme_image_path = + ao_app->get_static_image_suffix(ao_app->get_theme_path(p_image)); + QString default_image_path = + ao_app->get_static_image_suffix(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 + else if (file_exists(default_image_path)) final_image_path = default_image_path; + else { + qDebug() << "Warning: Image" << p_image << "not found! Can't set!"; + return false; + } QPixmap f_pixmap(final_image_path); this->setPixmap( f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + return true; } -void AOImage::set_image_from_path(QString p_path) +bool AOImage::set_chatbox(QString p_path) { - QString default_path = ao_app->get_default_theme_path("chatmed.png"); + p_path = ao_app->get_static_image_suffix(p_path); + if (!file_exists(p_path)) { + qDebug() << "Warning: Chatbox" << p_path << "not found! Can't set!"; + return false; + } - QString final_path; - - if (file_exists(p_path)) - final_path = p_path; - else - final_path = default_path; - - QPixmap f_pixmap(final_path); + QPixmap f_pixmap(p_path); this->setPixmap( f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + return true; } |
