-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.cpp
More file actions
41 lines (32 loc) · 778 Bytes
/
controller.cpp
File metadata and controls
41 lines (32 loc) · 778 Bytes
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
40
41
#include "controller.h"
#include <QMainWindow>
#include <QPainter>
#include <QApplication>
#include <QThread>
#include <iostream>
Controller::Controller(MainWindow * parent)
: QObject(0)
{
p = parent;
viz = new Vizualizer();
QThread * thread = new QThread(this);
Backend * updater = new Backend(viz);
updater->moveToThread(thread);
connect(updater, SIGNAL(redrawUI()), this, SLOT(upd()));
connect(thread, SIGNAL(destroyed()), updater, SLOT(deleteLater()));
connect(thread, SIGNAL (started()), updater, SLOT (process()));
thread->start();
}
void Controller::onKeyPressed(long long code)
{
back->onKeyPressed(code);
viz->onKeyPressed(code);
}
void Controller::upd()
{
p->upd();
}
QImage Controller::onPaint()
{
return viz->onPaint();
}