aboutsummaryrefslogtreecommitdiff
path: root/src/aoimage.cpp
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2018-12-26 16:43:08 +0100
committerDavid Skoland <davidskoland@gmail.com>2018-12-26 16:43:08 +0100
commit00cfd2750d39795e4c205aee2a33b92b1da2524d (patch)
tree839c1129418ca8fefe41e6814917f9dabb6efa4b /src/aoimage.cpp
parent6f1bce5882676ea7affe717a2f5a00b8c3b7fe12 (diff)
moved headers into include and cpp files into src + logo into resource
Diffstat (limited to 'src/aoimage.cpp')
-rw-r--r--src/aoimage.cpp47
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));
+}