Merge branch 'victoryscreen'
[ghostsoverboard] / seascene.cpp
index b7f9211..a00b2c0 100644 (file)
@@ -43,6 +43,9 @@ const QString octopusImageFilename_= ":/pix/tursas.png";
 SeaScene::SeaScene(QObject *parent) :
     QGraphicsScene(parent)
 {
+
+    setItemPointersNull();
+
     paused_ = false;
     screenLitKeeper_.keepScreenLit(true);
 
@@ -100,8 +103,12 @@ void SeaScene::setupMap(int ghosts, int rocks, int octopuses, int octopusSpeed)
 
     clear();
 
+    setItemPointersNull();
+
     createMenuItems();
 
+    createAboutBoxItems();
+
     createVictoryItems();
 
 
@@ -391,6 +398,18 @@ void SeaScene::handleScreenTapped()
         return;
     }
 
+    //If the game is paused and about box is shown, close it and show the pause text and menu again
+
+    if(pAboutBoxItem_)
+    {
+        if(pAboutBoxItem_->isVisible())
+        {
+            pAboutBoxItem_->hide();
+            pPausetextItem_->show();
+        }
+    }
+
+  
     //If the game is paused, check if the victory item is being shown
     if(pVictoryCongratulationsItem_)
     {
@@ -563,16 +582,8 @@ void SeaScene::prepareForMenu(QGraphicsItem * pItem)
 
 void SeaScene::about()
 {
-    QMessageBox::about(NULL, tr("About %1").arg(QApplication::applicationName()),
-                       tr("Version %1"
-                          "<p>Copyright 2011 Heli Hyv&auml;ttinen"
-                          "<p>License: General Public License v2"
-                          "<p>Bug Reports: https://bugs.maemo.org/ "
-                          "enter_bug.cgi?product=Ghosts%20Overboard"
-                          ).arg(QApplication::applicationVersion()));
-
-
-
+    pPausetextItem_->hide();
+    pAboutBoxItem_->show();
 }
 
 
@@ -634,6 +645,7 @@ void SeaScene::softContinue()
     pause(pPauseAction_->isChecked());
 }
 
+
 void SeaScene::createVictoryItems()
 {
     pVictoryCongratulationsItem_ = new QGraphicsTextItem;
@@ -654,5 +666,35 @@ void SeaScene::createVictoryItems()
                        "<br><br> Tap to play again ");
     pTextItem->setPos(-50,100);
     pTextItem->setZValue(1000);
+}
 
+void SeaScene::createAboutBoxItems()
+{
+    pAboutBoxItem_ = new QGraphicsTextItem;
+    addItem(pAboutBoxItem_);
+    pAboutBoxItem_->setPos(25,50);
+    pAboutBoxItem_->setZValue(1000);
+    pAboutBoxItem_->hide();
+
+    pAboutBoxItem_->setHtml(tr("<font color = darkorange size = \"7\">"
+                          "%1 <br> <font size = \"5\"> Version %2"
+                          "<p><font size = \"4\"> Copyright 2011 Heli Hyv&auml;ttinen"
+                          "<p><font size = \"4\"> License: General Public License v2"
+                          "<p><font size = \"3\"> Bug Reports: <br> https://bugs.maemo.org/ "
+                          "enter_bug.cgi?product=Ghosts%20Overboard"
+                          ).arg(QApplication::applicationName(),QApplication::applicationVersion()));
+
+}
+
+void SeaScene::setItemPointersNull()
+{
+    pPausetextItem_ = NULL;
+    pRestartLevelItem_ = NULL;
+    pRestartGameItem_ = NULL;
+    pSettingsItem_ = NULL;
+    pAboutItem_ = NULL;
+    pQuitItem_ = NULL ;
+    pMinimizeItem_ = NULL;
+
+    pAboutBoxItem_ = NULL;
 }