31 |
#include "queensmain.h" |
#include "queensmain.h" |
32 |
#include "board.h" |
#include "board.h" |
33 |
#include "queens.h" |
#include "queens.h" |
34 |
|
|
35 |
#include "solution.h" |
#include "solution.h" |
36 |
#include "solutionvector.h" |
#include "solutionmatrix.h" |
37 |
#include "solutionlist.h" |
#include "solutionint.h" |
38 |
#include "solutionhash.h" |
|
39 |
#include "solutionmnvector.h" |
#include "containervector.h" |
40 |
|
#include "containerlist.h" |
41 |
|
#include "containerhash.h" |
42 |
|
#include "containermnvector.h" |
43 |
|
|
44 |
#include "config.h" |
#include "config.h" |
45 |
|
|
46 |
#define MatrixSolution Solution |
|
47 |
|
|
48 |
QueensMain::QueensMain(QWidget *parent, const char *name) |
QueensMain::QueensMain(QWidget *parent, const char *name) |
49 |
: QDialog(parent, name) |
: QDialog(parent, name) |
86 |
m_sortalgo = SortList; |
m_sortalgo = SortList; |
87 |
m_solutions = NULL; |
m_solutions = NULL; |
88 |
m_queens = NULL; |
m_queens = NULL; |
89 |
|
m_sol = NULL; |
90 |
|
|
91 |
connect(m_quit, |
connect(m_quit, |
92 |
SIGNAL( clicked() ), |
SIGNAL( clicked() ), |
148 |
delete m_solutions; |
delete m_solutions; |
149 |
switch (m_sortalgo) { |
switch (m_sortalgo) { |
150 |
case SortList: |
case SortList: |
151 |
m_solutions = new SolutionList(this); |
m_solutions = new ContainerList(this); |
152 |
break; |
break; |
153 |
case SortVector: |
case SortVector: |
154 |
m_solutions = new SolutionVector(this); |
m_solutions = new ContainerVector(this); |
155 |
break; |
break; |
156 |
case SortHash: |
case SortHash: |
157 |
m_solutions = new SolutionHash(this); |
m_solutions = new ContainerHash(this); |
158 |
break; |
break; |
159 |
case SortMNVector: |
case SortMNVector: |
160 |
m_solutions = new SolutionMNVector(this); |
m_solutions = new ContainerMNVector(this); |
161 |
break; |
break; |
162 |
} |
} |
163 |
|
|
166 |
|
|
167 |
switch(this->m_storage) { |
switch(this->m_storage) { |
168 |
case StorageInt: |
case StorageInt: |
169 |
#warning MatrixSolution<=>IntSolution |
m_sol = new SolutionInt(m_sizeSelector->value()); |
|
m_sol = new MatrixSolution(m_sizeSelector->value()); |
|
170 |
break; |
break; |
171 |
case StorageMatrix: |
case StorageMatrix: |
172 |
m_sol = new MatrixSolution(m_sizeSelector->value()); |
m_sol = new SolutionMatrix(m_sizeSelector->value()); |
173 |
break; |
break; |
174 |
} |
} |
175 |
|
|
176 |
|
|
177 |
m_elapsed.start(); |
m_elapsed.start(); |
178 |
m_time.start(); |
m_time.start(); |
179 |
m_queens = new Queens(this, m_solutions, m_sizeSelector->value() ,false); |
m_queens = new Queens(this, m_sol, m_solutions, m_sizeSelector->value() ,false); |
180 |
m_queens->start(); |
m_queens->start(); |
181 |
} |
} |
182 |
|
|
224 |
{ |
{ |
225 |
int index = m_list->currentItem(); |
int index = m_list->currentItem(); |
226 |
Solution* sol = m_solutions->solution( index ); |
Solution* sol = m_solutions->solution( index ); |
227 |
m_board->setMatrix( *sol ); |
m_board->setMatrix( sol ); |
228 |
} |
} |
229 |
|
|
230 |
void QueensMain::resize(int size) |
void QueensMain::resize(int size) |