-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdialog.cpp
More file actions
72 lines (60 loc) · 1.53 KB
/
dialog.cpp
File metadata and controls
72 lines (60 loc) · 1.53 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "dialog.h"
#include "ui_dialog.h"
#include <QtGui>
#include <QGraphicsPixmapItem>
#include <QGraphicsView>
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
game = false;
mThread = new MyThread(this);
connect(mThread, SIGNAL(ImageChanged(int, QImage)), this,SLOT(onImageChanged(int, QImage)));
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::onImageChanged(int Number, QImage img)
{
if(!game)
{
if(Number == 1) ui->label->setText("Kamień");
else if (Number == 2) ui->label->setText("Papier");
else if (Number == 3) ui->label->setText("Nożyczki");
else ui->label->setText("Nie wykryto");
updateGraphicsView(img);
} else {
game_window.updatePlayer(img);
game_window.updateList(Number);
}
}
void Dialog::on_pushButton_clicked()
{
//Started
mThread->Stop = false;
mThread->start();
}
void Dialog::on_pushButton_2_clicked()
{
//Stoped
mThread->Stop = true;
}
void Dialog::on_pushButton_3_clicked()
{
on_pushButton_clicked();
game = true;
mThread->game_window = true;
game_window.show();
}
void Dialog::updateGraphicsView(QImage img)
{
//QImage img2 = this->getQImageFromIplImage(img1);
//QImage img2("/home/ania/projekty/RockPaperScissor/image.png");
QGraphicsScene* scene = new QGraphicsScene;
ui->graphicsView->setScene(scene);
scene->setBackgroundBrush(Qt::black);
scene->addPixmap(QPixmap::fromImage(img));
ui->graphicsView->show();
}