-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandler.h
More file actions
92 lines (77 loc) · 2.02 KB
/
handler.h
File metadata and controls
92 lines (77 loc) · 2.02 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
#ifndef HANDLER_H
#define HANDLER_H
#include <QObject>
class handler;
#include <stdlib.h>
#include <QStringList>
#include <QList>
#include <string>
#include <cstdlib>
#include <ctime>
#include <QFile>
#include <QIODevice>
#include <QTextStream>
#include "myitem.h"
using namespace std;
// 这是一个单例,用于在图元与主窗口交互更新分数
// 只能创建一个对象
class handler : public QObject
{
Q_OBJECT
public:
// 获得单例
static handler* getInstance();
// 加分
void addScore(int score);
// 更新单词列表
void UpdateWordList(QStringList *);
// 获取随机数
int RandomNum(int, int);
// 在单词列表中随机一个
QString randomWord();
// 单词宽高
int x, y;
// 单词中的雷,加分等
QStringList* opened_block;
// 单词列表
QStringList* WordList;
// 静态单词列表
QStringList* staticWordList;
// 是否出现打开一半的情况
bool incomplete = false;
// '不完整的'信号发送函数
void SendIncompleted();
// 未打开的图片列表
QList<myItem*>* closePictureList;
QList<QList<int>*>* SpiltNum(int Num, int geshu);
// 打开文件
int readFile(QStringList* WordList);
// 随机一个情况
QString randomQingKuang();
private:
// 卑微的构造函数
explicit handler(QObject *parent = nullptr);
// 卑微的析构函数
~handler();
//存储用户输入的整数
int n;
//存储用户输入的要拆分的个数
int m;
//计数器,记录拆分结果的个数
int totalKind;
//存储拆分出的因数
//注意:这里只定义了20长度的数组空间,可根据需要自己扩充
int a[20];
void print();
void Split(int arrayIndex,int preDivisor,int newDivisor);
QList<QList<int>*>* resultList;
signals:
// 更新分数信号
void UpdateScore(int);
// 方块'不完整的'信号
void Incompleted();
private:
// 唯一的实例
static handler *hand;
};
#endif // HANDLER_H