summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/solverwindow.cc11
-rw-r--r--src/solverwindow.h4
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