summaryrefslogtreecommitdiff
path: root/src/solverwindow.h
blob: 3a7daf1970d221bb3bf030c57c29f9fb5dd50c11 (plain)
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

#ifndef __INCLUDED_SUDOKUSOLVER_SOLVERWINDOW__
#define __INCLUDED_SUDOKUSOLVER_SOLVERWINDOW__

#include <QWidget>

#include "sudoku.h"

class SudokuWidget;

class SolverWindow : public QWidget
{
	Q_OBJECT
	
public:
	SolverWindow();
	
	inline const QString & filename()
	{
		return solverwindow_filename;
	}

public slots:
	
	void doNew();
	void doOpen();
	void doSave();
	void doSaveAs();
	void doRevert();
	
	/**
	 * @brief try to solve a single cell by using the rules only
	 * */
	void doStep();	
	/**
	 * @brief try to solve a single cell by guessing where required
	 * */
	void doGuess();
	/**
	 * @brief try to find a solution by using the rules only
	 * */
	void doSolve();
	/**
	 * @brief try to find a solution by guessing where required
	 * */
	void doSearch();
	
	void doValidate();
	
signals:
	void statusChanged(const QString &text);
	
private:
	void step_constraints();
	void step_coverage();	

	void saveToFile(const QString & filename);
	void openFromFile(const QString & filename);
	
	bool confirmOverwrite(const QString & filename);
	
	SudokuWidget	*solverwindow_sudokuwidget;
	QString		solverwindow_filename;
};

#endif // __INCLUDED_SUDOKUSOLVER_SOLVERWINDOW__