-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialog.cpp
76 lines (67 loc) · 1.66 KB
/
dialog.cpp
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
72
73
74
75
76
#include "dialog.h"
#include "ui_dialog.h"
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
this->setWindowTitle("Snake");
this->hide();
music_bool=0;
connect(ui->pushButton,&QPushButton::clicked,this,&Dialog::deal_back_music);
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::deal_back_music()
{
if(music_bool==0)
{
ui->pushButton->setStyleSheet("QPushButton{"
"background-color: rgba(255, 255, 255, 0);"
"background-image: url(:/new/prefix1/image/music_close.png);"
"}");
music_bool=1;
emit back_music();
}
else if(music_bool==1)
{
ui->pushButton->setStyleSheet("QPushButton{"
"background-color: rgba(255, 255, 255, 0);"
"background-image: url(:/new/prefix1/image/music_open.png);"
"}");
music_bool=0;
emit back_music();
}
}
void Dialog::on_comboBox_currentIndexChanged(const QString &arg1)
{
if(arg1=="easy")
{
m_speed=500;
emit level_signal(m_speed);
}
else if(arg1=="ordinary")
{
m_speed=300;
emit level_signal(m_speed);
}
else if(arg1=="difficult")
{
m_speed=100;
emit level_signal(m_speed);
}
}
void Dialog::on_comboBox_2_currentIndexChanged(const QString &arg1)
{
emit snake_color(arg1);
}
void Dialog::on_comboBox_3_currentIndexChanged(const QString &arg1)
{
emit food_color(arg1);
}
void Dialog::on_pushButton_2_clicked()
{
emit non_human();
}