You have to solve current level before advance
authorpaul romanchenko <paulaner@gmail.com>
Fri, 17 Sep 2010 05:23:57 +0000 (09:23 +0400)
committerpaul romanchenko <paulaner@gmail.com>
Fri, 17 Sep 2010 05:23:57 +0000 (09:23 +0400)
fieldview.h
mainwindow.cpp
needadvance.cpp [new file with mode: 0644]
needadvance.h [new file with mode: 0644]
needadvance.ui [new file with mode: 0644]

index c9111a8..197e830 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <QtCore>
 #include <QtGui>
-#include <QtSvg>
 
 #include "playfield.h"
 #include "iconset.h"
@@ -69,9 +68,6 @@ private:
         PlayField *playField;
         int selX, selY;
         int moveX, moveY;
-        QStateMachine *machine;
-        QState *rotL, *rotR;
-        QTimer timer;
         bool moving;
         QList<Animation*> *moves;
 
index e80d336..f90ed54 100644 (file)
@@ -2,6 +2,7 @@
 #include "ui_mainwindow.h"
 #include "preferences.h"
 #include "howtoplay.h"
+#include "needadvance.h"
 
 MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent),
@@ -118,6 +119,7 @@ void MainWindow::solved(int moves)
 {
     PlayField *pf=pack->levelAt(levelNo);
     Settings().saveHiscore(pack->getTitle(),pf->title, moves);
+    levelHiscore=moves;
     loadNextLevel();
 }
 
@@ -145,6 +147,11 @@ void MainWindow::saveState()
 
 void MainWindow::loadNextLevel()
 {
+    if(levelHiscore == HS::NO_SCORE)
+    {
+        needadvance().exec();
+        return;
+    }
     if(levelNo<(pack->size()-1))
     {
         levelNo++;
diff --git a/needadvance.cpp b/needadvance.cpp
new file mode 100644 (file)
index 0000000..bf311c8
--- /dev/null
@@ -0,0 +1,14 @@
+#include "needadvance.h"
+#include "ui_needadvance.h"
+
+needadvance::needadvance(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::needadvance)
+{
+    ui->setupUi(this);
+}
+
+needadvance::~needadvance()
+{
+    delete ui;
+}
diff --git a/needadvance.h b/needadvance.h
new file mode 100644 (file)
index 0000000..7ca5606
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef NEEDADVANCE_H
+#define NEEDADVANCE_H
+
+#include <QDialog>
+
+namespace Ui {
+    class needadvance;
+}
+
+class needadvance : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit needadvance(QWidget *parent = 0);
+    ~needadvance();
+
+private:
+    Ui::needadvance *ui;
+};
+
+#endif // NEEDADVANCE_H
diff --git a/needadvance.ui b/needadvance.ui
new file mode 100644 (file)
index 0000000..150401d
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>needadvance</class>
+ <widget class="QDialog" name="needadvance">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>778</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout">
+   <item>
+    <widget class="QLabel" name="label">
+     <property name="font">
+      <font>
+       <pointsize>16</pointsize>
+      </font>
+     </property>
+     <property name="text">
+      <string>Solve this level first!</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer name="horizontalSpacer">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>40</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <widget class="QPushButton" name="pushButton">
+     <property name="text">
+      <string>I will!</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>pushButton</sender>
+   <signal>clicked()</signal>
+   <receiver>needadvance</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>612</x>
+     <y>146</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>575</x>
+     <y>189</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>