atrooney-online-2/src/aoimage.cpp
oldmud0 13942345c6 Run clang-format on entire project
Indentation fixed to 2 spaces per tab. Braces set to Stroustrup style.
Lines reflow at 80 characters. One-line method bodies are on the same
line as the signature. Space always after `//`. No indentation
on preprocessor macros. Includes are sorted lexicographically.

If you don't want to see this commit on blames, use the hidden
whitespace option on GitHub, or use `-w` in git-blame.
2020-04-17 21:57:16 -05:00

47 lines
1.0 KiB
C++

#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));
}