diff options
author | Stijn Buys <ingar@osirion.org> | 2012-08-05 14:44:09 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-08-05 14:44:09 +0000 |
commit | 3ddd4b5ffa4ca2c002394af6a9f3615f6ea96f13 (patch) | |
tree | cd78ffe52161aa31b0f08846a66210b45ac84063 /src | |
parent | c22536813e9b7b8c6cabaa97660f1876b0df1832 (diff) |
Added revert button.
Diffstat (limited to 'src')
-rw-r--r-- | src/solverwindow.cc | 11 | ||||
-rw-r--r-- | src/solverwindow.h | 4 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/solverwindow.cc b/src/solverwindow.cc index d799c56..1ace44f 100644 --- a/src/solverwindow.cc +++ b/src/solverwindow.cc @@ -29,6 +29,11 @@ SolverWindow::SolverWindow() sidebarlayout->addWidget(savebutton); connect(savebutton, SIGNAL(clicked()), this, SLOT(save())); + // add revert button + QPushButton *revertbutton = new QPushButton(tr("Revert")); + sidebarlayout->addWidget(revertbutton); + connect(revertbutton, SIGNAL(clicked()), this, SLOT(revert())); + // add step constraints button QPushButton *stepconstraintsbutton = new QPushButton(tr("Constraints")); sidebarlayout->addWidget(stepconstraintsbutton); @@ -94,12 +99,18 @@ void SolverWindow::load() } } solverwindow_sudokuwidget->set_values(sudoku); + solverwindow_revertstate.assign(sudoku); file.close(); QApplication::restoreOverrideCursor(); } +void SolverWindow::revert() +{ + solverwindow_sudokuwidget->set_values(solverwindow_revertstate); +} + void SolverWindow::save() { QString filename = QFileDialog::getSaveFileName(this, tr("Save as..."), HOMEDIR, "Sudoku (*.sudoku)"); diff --git a/src/solverwindow.h b/src/solverwindow.h index 51908c9..2422e97 100644 --- a/src/solverwindow.h +++ b/src/solverwindow.h @@ -4,6 +4,8 @@ #include <QWidget> +#include "sudoku.h" + class SudokuWidget; class SolverWindow : public QWidget @@ -17,12 +19,14 @@ public slots: void load(); void save(); + void revert(); void step_constraints(); void step_coverage(); void clear(); private: SudokuWidget *solverwindow_sudokuwidget; + Sudoku solverwindow_revertstate; }; #endif // __INCLUDED_SUDOKUSOLVER_SOLVERWINDOW__
\ No newline at end of file |