-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel_choose.cpp
More file actions
101 lines (79 loc) · 2.12 KB
/
Copy pathmodel_choose.cpp
File metadata and controls
101 lines (79 loc) · 2.12 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include "model_choose.h"
#include "ui_model_choose.h"
#include"mainwindow.h"
#include"formalquiz.h"
#include"exercise.h"
#include"rank.h"
#include"user_info.h"
#include<QMessageBox>
#include<QString>
extern user succeed1;
extern int exerflag;
int mode;
Model_Choose::Model_Choose(QWidget *parent) :
QDialog(parent),
ui(new Ui::Model_Choose)
{
ui->setupUi(this);
if(succeed1.times==3)ui->remain->setStyleSheet("color:rgb(255, 78, 25)");
ui->remain->setText("您的正式竞赛剩余次数还有"+QString::number(3-succeed1.times)+"次");
this->setWindowTitle("欢迎你,"+succeed1.name+",请进行模式选择");
}
Model_Choose::~Model_Choose()
{
delete ui;
}
void Model_Choose::on_return_2_clicked()
{
this->close();
MainWindow*pic=new MainWindow();
pic->show();
}
void Model_Choose::on_formal_clicked()
{
mode=1;
if(succeed1.times!=3){
QMessageBox msgBox;
msgBox.setWindowTitle("提示");
msgBox.setText("您的次数还剩余"+QString::number(3-succeed1.times)+"次");
msgBox.setText("您进行正式测试将少一次机会,是否消耗一次?\n");
msgBox.setStandardButtons(QMessageBox::Ok| QMessageBox::No );
msgBox.setDefaultButton(QMessageBox::Ok);
int ret = msgBox.exec();
switch(ret){
case QMessageBox::Ok:{
this->close();
FormalQuiz *pic=new FormalQuiz();
pic->show();
break;
}
case QMessageBox::No:{
break;
}
}
}
else if(succeed1.times==3){
QMessageBox::critical(this,tr("警告"),tr("您已用完次数,不可再参加正式竞赛"));
return;
}
}
void Model_Choose::on_simulate_clicked()
{
mode=2;
this->close();
FormalQuiz *pic=new FormalQuiz();
pic->show();
}
void Model_Choose::on_exercise_clicked()
{
this->close();
exerflag=1;
Exercise *pic=new Exercise();
pic->show();
}
void Model_Choose::on_rankView_clicked()
{
this->close();
Rank*pic=new Rank();
pic->show();
}