1 |
/*************************************************************************** |
2 |
* Copyright (C) 2005 by Torben Nielsen * |
3 |
* torben@t-hoerup.dk * |
4 |
* * |
5 |
* This program is free software; you can redistribute it and/or modify * |
6 |
* it under the terms of the GNU General Public License as published by * |
7 |
* the Free Software Foundation; either version 2 of the License, or * |
8 |
* (at your option) any later version. * |
9 |
* * |
10 |
* This program is distributed in the hope that it will be useful, * |
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
13 |
* GNU General Public License for more details. * |
14 |
* * |
15 |
* You should have received a copy of the GNU General Public License * |
16 |
* along with this program; if not, write to the * |
17 |
* Free Software Foundation, Inc., * |
18 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
19 |
***************************************************************************/ |
20 |
#ifndef QUEENSMAIN_H |
21 |
#define QUEENSMAIN_H |
22 |
|
23 |
#include <qdialog.h> |
24 |
#include <qdatetime.h> |
25 |
#include <qtimer.h> |
26 |
//Added by qt3to4: |
27 |
#include <QLabel> |
28 |
#include <QContextMenuEvent> |
29 |
|
30 |
#include "guiupdate.h" |
31 |
|
32 |
class QPushButton; |
33 |
class QSpinBox; |
34 |
class Q3ListBox; |
35 |
class QLabel; |
36 |
class QString; |
37 |
class Solution; |
38 |
|
39 |
class SolutionContainer; |
40 |
class Queens; |
41 |
class Board; |
42 |
|
43 |
enum SortingAlgorithm{SortVector, SortList, SortHash, SortMNVector, SortMinimalVector}; |
44 |
enum StorageClass{ StorageInt, StorageMatrix }; |
45 |
|
46 |
|
47 |
/** |
48 |
@author Torben Nielsen |
49 |
*/ |
50 |
class QueensMain : public QDialog, public GUIUpdate |
51 |
{ |
52 |
Q_OBJECT |
53 |
private: |
54 |
Board *m_board; |
55 |
QPushButton *m_quit; |
56 |
QPushButton *m_start; |
57 |
QPushButton *m_stop; |
58 |
Q3ListBox *m_list; |
59 |
QSpinBox *m_sizeSelector; |
60 |
QLabel *m_status; |
61 |
QTime m_time; |
62 |
|
63 |
Solution* m_sol; |
64 |
SolutionContainer *m_solutions; |
65 |
Queens *m_queens; |
66 |
SortingAlgorithm m_sortalgo; |
67 |
StorageClass m_storage; |
68 |
|
69 |
QTime m_elapsed; |
70 |
int m_totalcount; |
71 |
|
72 |
|
73 |
void contextMenuEvent(QContextMenuEvent *); |
74 |
|
75 |
public: |
76 |
QueensMain(QWidget *parent = 0, const char *name = 0); |
77 |
|
78 |
~QueensMain(); |
79 |
QString elapsed(); |
80 |
void uniqueSolutions(); |
81 |
|
82 |
public slots: |
83 |
void start(); |
84 |
void stop(); |
85 |
void foundSolution(); |
86 |
void finishedSearch(); |
87 |
void showSolution(); |
88 |
void resize(int size); |
89 |
void duplicateRemoved(); |
90 |
|
91 |
void sortList(); |
92 |
void sortVector(); |
93 |
void sortHash(); |
94 |
void sortMNVector(); |
95 |
void sortMinimalVector(); |
96 |
|
97 |
void storageInt(); |
98 |
void storageMatrix(); |
99 |
|
100 |
}; |
101 |
|
102 |
#endif |