[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kmines/viranch/qtquick] src: Use the settings option for whether or not to use question marks
From:       Viranch Mehta <viranch.mehta () gmail ! com>
Date:       2013-03-28 11:59:43
Message-ID: 20130328115943.29214A60EE () git ! kde ! org
[Download RAW message or body]

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 <QGraphicsObject>
 #include <KGameRenderer>
@@ -31,6 +32,8 @@ CanvasWidget::CanvasWidget(KGameRenderer *renderer, QWidget \
                *parent) :
     connect(rootObject(), SIGNAL(minesCountChanged(int,int)), this, \
                SIGNAL(minesCountChanged(int,int)));
     connect(rootObject(), SIGNAL(firstClickDone()), this, SIGNAL(firstClickDone()));
     connect(rootObject(), SIGNAL(gameOver(bool)), this, SIGNAL(gameOver(bool)));
+
+    updateUseQuestionMarks();
 }
 
 void CanvasWidget::setGamePaused(bool paused)
@@ -45,3 +48,8 @@ void CanvasWidget::startNewGame(int rows, int cols, int numMines)
                               Q_ARG(QVariant, cols),
                               Q_ARG(QVariant, numMines));
 }
+
+void CanvasWidget::updateUseQuestionMarks()
+{
+    rootObject()->setProperty("useQuestionMarks", Settings::useQuestionMarks());
+}
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"), \
                QLatin1String( "games-config-options" ));
     dialog->addPage( new KgThemeSelector( m_renderer.themeProvider() ), i18n( \
                "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(updateUseQuestionMarks()) );  \
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 = (cellState+1)%3;
+                if (flagged && !canvas.useQuestionMarks)
+                    cellState = (cellState+2)%3;
+                else
+                    cellState = (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 = rows;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic