forked from sandsmark/recrossable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crossword.h
49 lines (35 loc) · 977 Bytes
/
crossword.h
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
#ifndef CROSSWORD_H
#define CROSSWORD_H
#include <QObject>
#include <QVector>
#include <QHash>
#include "cwc/grid.hh"
class Crossword : public QObject
{
Q_OBJECT
Q_PROPERTY(int rows READ rows NOTIFY rowsChanged)
Q_PROPERTY(int columns READ columns NOTIFY columnsChanged)
public:
explicit Crossword(QObject *parent = nullptr);
int rows() const { return m_rows; }
int columns() const { return m_columns; }
signals:
void columnsChanged();
void rowsChanged();
public slots:
QString hintAt(const int index);
QString correctAt(const int index);
bool isOpen(const int index);
QStringList hintsAcross();
QStringList hintsDown();
QString hintTextAt(int index);
private:
void parseWordlist(const QString &filePath);
void generateCrossword();
QHash<QString, QString> m_hints;
int m_rows = 0;
int m_columns = 0;
Grid *m_grid = nullptr;
Answers *m_answers = nullptr;
};
#endif // CROSSWORD_H