aboutsummaryrefslogtreecommitdiff
path: root/aoscene.cpp
blob: 1d76aed127ade52e67db0c0ddaf8363e28d5a1dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "aoscene.h"

#include "courtroom.h"

#include "file_functions.h"

AOScene::AOScene(Courtroom *parent) : QLabel(parent)
{
  m_courtroom = parent;
}

void AOScene::set_image(QString p_image)
{
  QString background_path = m_courtroom->get_background_path() + p_image;
  QString default_path = m_courtroom->get_default_background_path() + p_image;

  QPixmap background(background_path);
  QPixmap default_bg(default_path);

  int w = this->width();
  int h = this->height();


  if (file_exists(background_path))
    this->setPixmap(background.scaled(w, h));
  else
    this->setPixmap(default_bg.scaled(w, h));
}