From 3ddd4b5ffa4ca2c002394af6a9f3615f6ea96f13 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 5 Aug 2012 14:44:09 +0000 Subject: Added revert button. --- src/solverwindow.cc | 11 +++++++++++ src/solverwindow.h | 4 ++++ 2 files changed, 15 insertions(+) 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 +#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 -- cgit v1.2.3