Git commit ec233318c4a90ea97cbf8e48af461112a9ec15d6 by Viranch Mehta. Committed on 07/08/2012 at 16:22. Pushed by viranch into branch 'viranch/qtquick'. Use the settings option for whether or not to use question marks M +8 -0 src/canvaswidget.cpp M +3 -0 src/canvaswidget.h M +1 -0 src/mainwindow.cpp M +4 -1 src/qml/CellItem.qml M +2 -0 src/qml/main.qml http://commits.kde.org/kmines/ec233318c4a90ea97cbf8e48af461112a9ec15d6 diff --git a/src/canvaswidget.cpp b/src/canvaswidget.cpp index aca22e8..98e9ea5 100644 --- a/src/canvaswidget.cpp +++ b/src/canvaswidget.cpp @@ -16,6 +16,7 @@ */ = #include "canvaswidget.h" +#include "settings.h" = #include #include @@ -31,6 +32,8 @@ CanvasWidget::CanvasWidget(KGameRenderer *renderer, QWidg= et *parent) : connect(rootObject(), SIGNAL(minesCountChanged(int,int)), this, SIGNAL= (minesCountChanged(int,int))); connect(rootObject(), SIGNAL(firstClickDone()), this, SIGNAL(firstClic= kDone())); connect(rootObject(), SIGNAL(gameOver(bool)), this, SIGNAL(gameOver(bo= ol))); + + updateUseQuestionMarks(); } = void CanvasWidget::setGamePaused(bool paused) @@ -45,3 +48,8 @@ void CanvasWidget::startNewGame(int rows, int cols, int n= umMines) Q_ARG(QVariant, cols), Q_ARG(QVariant, numMines)); } + +void CanvasWidget::updateUseQuestionMarks() +{ + rootObject()->setProperty("useQuestionMarks", Settings::useQuestionMar= ks()); +} diff --git a/src/canvaswidget.h b/src/canvaswidget.h index aaae2c9..130fc0b 100644 --- a/src/canvaswidget.h +++ b/src/canvaswidget.h @@ -35,6 +35,9 @@ signals: void firstClickDone(); void gameOver(bool won); = +public slots: + void updateUseQuestionMarks(); + /* protected: void keyPressEvent(QKeyEvent *event); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 9083bb5..cadb390 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -236,6 +236,7 @@ void KMinesMainWindow::configureSettings() dialog->addPage( new GeneralOptsConfig( dialog ), i18n("General"), QLa= tin1String( "games-config-options" )); dialog->addPage( new KgThemeSelector( m_renderer.themeProvider() ), i1= 8n( "Theme" ), QLatin1String( "games-config-theme" )); dialog->addPage( new CustomGameConfig( dialog ), i18n("Custom Game"), = QLatin1String( "games-config-custom" )); + connect( dialog, SIGNAL(settingsChanged(QString)), m_canvas, SLOT(upda= teUseQuestionMarks()) ); dialog->setHelp(QString(),QLatin1String( "kmines" )); dialog->show(); } diff --git a/src/qml/CellItem.qml b/src/qml/CellItem.qml index a418519..d957654 100644 --- a/src/qml/CellItem.qml +++ b/src/qml/CellItem.qml @@ -54,7 +54,10 @@ KgCore.CanvasItem { cell.clicked(); } else { if (revealed) return; - cellState =3D (cellState+1)%3; + if (flagged && !canvas.useQuestionMarks) + cellState =3D (cellState+2)%3; + else + cellState =3D (cellState+1)%3; } } } diff --git a/src/qml/main.qml b/src/qml/main.qml index 82be16e..90a737a 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -26,6 +26,8 @@ Item { signal firstClickDone signal gameOver(bool won) = + property bool useQuestionMarks: true + function startNewGame(rows, cols, mines) { Logic.reset(); field.rows =3D rows;