1 |
torben |
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 |
|
|
|
27 |
|
|
#include "guiupdate.h" |
28 |
|
|
|
29 |
|
|
class QPushButton; |
30 |
|
|
class QSpinBox; |
31 |
|
|
class QListBox; |
32 |
|
|
class QLabel; |
33 |
|
|
class QString; |
34 |
|
|
|
35 |
|
|
class SolutionContainer; |
36 |
|
|
class Queens; |
37 |
|
|
class Board; |
38 |
|
|
|
39 |
|
|
enum SortingAlgorithm{SortVector, SortList, SortHash, SortMNVector}; |
40 |
|
|
|
41 |
|
|
/** |
42 |
|
|
@author Torben Nielsen |
43 |
|
|
*/ |
44 |
|
|
class QueensMain : public QDialog, public GUIUpdate |
45 |
|
|
{ |
46 |
|
|
Q_OBJECT |
47 |
|
|
private: |
48 |
|
|
Board *m_board; |
49 |
|
|
QPushButton *m_quit; |
50 |
|
|
QPushButton *m_start; |
51 |
|
|
QPushButton *m_stop; |
52 |
|
|
QListBox *m_list; |
53 |
|
|
QSpinBox *m_sizeSelector; |
54 |
|
|
QLabel *m_status; |
55 |
|
|
QTime m_time; |
56 |
|
|
|
57 |
|
|
SolutionContainer *m_solutions; |
58 |
|
|
Queens *m_queens; |
59 |
|
|
SortingAlgorithm m_sortalgo; |
60 |
|
|
|
61 |
|
|
QTime m_elapsed; |
62 |
|
|
int m_totalcount; |
63 |
|
|
|
64 |
|
|
|
65 |
|
|
void contextMenuEvent(QContextMenuEvent *); |
66 |
|
|
|
67 |
|
|
public: |
68 |
|
|
QueensMain(QWidget *parent = 0, const char *name = 0); |
69 |
|
|
|
70 |
|
|
~QueensMain(); |
71 |
|
|
QString elapsed(); |
72 |
|
|
void uniqueSolutions(); |
73 |
|
|
|
74 |
|
|
public slots: |
75 |
|
|
void start(); |
76 |
|
|
void stop(); |
77 |
|
|
void foundSolution(); |
78 |
|
|
void finishedSearch(); |
79 |
|
|
void showSolution(); |
80 |
|
|
void resize(int size); |
81 |
|
|
void duplicateRemoved(); |
82 |
|
|
|
83 |
|
|
void sortList(); |
84 |
|
|
void sortVector(); |
85 |
|
|
void sortHash(); |
86 |
|
|
void sortMNVector(); |
87 |
|
|
}; |
88 |
|
|
|
89 |
|
|
#endif |