-
Notifications
You must be signed in to change notification settings - Fork 0
/
traindescriber.hxx
39 lines (35 loc) · 1.28 KB
/
traindescriber.hxx
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
29
30
31
32
33
34
35
36
37
38
39
#ifndef TRAINDESCRIBER_HXX
#define TRAINDESCRIBER_HXX
#include <QSvgWidget>
#include <QMap>
#include <QScreen>
#include <QGuiApplication>
#include "dispatcher.hxx"
#include "scaling.hxx"
namespace EWRB
{
class TrainDescriber
{
private:
QWidget* _parent;
bool _illuminated = false;
Dispatcher* _dispatcher;
int _location[2] = {0,0};
int _id = -1;
QMap<bool, QSvgWidget*> _svgs;
public:
TrainDescriber(const int& id, Dispatcher* dispatcher, QWidget* parent, QString type) : _id(id), _dispatcher(dispatcher), _parent(parent)
{
const Scaler* scaler_ = new Scaler;
_svgs[false] = new QSvgWidget(":/svgs/svgs/TrainDescriberOff.svg", parent);
_svgs[false]->setFixedSize(scaler_->scale_width(37), scaler_->scale_height(35));
_svgs[true] = new QSvgWidget(":/svgs/svgs/TrainDescriber"+type+".svg", parent);
_svgs[true]->setFixedSize(scaler_->scale_width(37), scaler_->scale_height(35));
}
bool isOn() const {return _illuminated;}
void PlaceAt(const int& x, const int& y);
void update();
int id() const {return _id;}
};
};
#endif // TRAINDESCRIBER_HXX