Added "restart level" to the menu
authorHeli Hyvättinen <heli.hyvattinen@kymp.net>
Wed, 8 Jun 2011 10:40:05 +0000 (13:40 +0300)
committerHeli Hyvättinen <heli.hyvattinen@kymp.net>
Wed, 8 Jun 2011 10:40:05 +0000 (13:40 +0300)
mainwindow.cpp
mainwindow.h

index e4ab78a..1bbd123 100644 (file)
@@ -22,12 +22,29 @@ MainWindow::MainWindow(QWidget *parent)
     pView_->setScene(pScene_);
     setCentralWidget(pView_);
 
+    QAction * pPauseAction = new QAction(tr("Pause"),this);
+    pPauseAction->setCheckable(true);
+    addAction(pPauseAction);
+    connect(pPauseAction,SIGNAL(triggered(bool)),this,SLOT(pause(bool)));
+    menuBar()->addAction(pPauseAction);
+
+    QAction * pRestartLevelAction = new QAction(tr("Restart level"),this);
+    pRestartLevelAction->setCheckable(true);
+    addAction(pRestartLevelAction);
+    connect(pRestartLevelAction,SIGNAL(triggered()),this,SLOT(restartLevel()));
+    menuBar()->addAction(pRestartLevelAction);
+
+
 
     //the boundaries of the scene are set to match the size of the view window, which is not
     //available in the constructor --> timer needed
     QTimer::singleShot(100,this,SLOT(initializeBoundaries()));
 
 
+
+
+
+
 }
 
 MainWindow::~MainWindow()
@@ -72,4 +89,10 @@ void MainWindow::pause(bool paused)
         qDebug("about to stop movement");
         pTursas_->stopMoving();
     }
+
+}
+
+void MainWindow::restartLevel()
+{
+    pScene_->setupMap(5,5,5);
 }
index 6a708e7..778ea5d 100644 (file)
@@ -17,6 +17,7 @@ public:
 public slots:
     void initializeBoundaries();
     void pause(bool paused);
+    void restartLevel();
 
 private: