From: Heli Hyvättinen Date: Mon, 25 Jul 2011 18:57:39 +0000 (+0300) Subject: About box integrated to view/scene X-Git-Tag: v0.3.0_fremantle~14 X-Git-Url: http://vcs.maemo.org/git/?p=ghostsoverboard;a=commitdiff_plain;h=3ffba2cef65df1beeb1797099d8d8c99f98a0acb About box integrated to view/scene --- diff --git a/seascene.cpp b/seascene.cpp index d714baf..655a903 100644 --- a/seascene.cpp +++ b/seascene.cpp @@ -42,6 +42,9 @@ const QString octopusImageFilename_= ":/pix/tursas.png"; SeaScene::SeaScene(QObject *parent) : QGraphicsScene(parent) { + + setItemPointersNull(); + paused_ = false; screenLitKeeper_.keepScreenLit(true); @@ -98,8 +101,12 @@ void SeaScene::setupMap(int ghosts, int rocks, int octopuses, int octopusSpeed) clear(); + setItemPointersNull(); + createMenuItems(); + createAboutBoxItems(); + //empty the list of moving items movingItems_.clear(); @@ -386,7 +393,18 @@ void SeaScene::handleScreenTapped() return; } - //If the game is paused, chacl if menu item was selected + //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 menu item was selected QList items = selectedItems(); @@ -546,16 +564,8 @@ void SeaScene::prepareForMenu(QGraphicsItem * pItem) void SeaScene::about() { - QMessageBox::about(NULL, tr("About %1").arg(QApplication::applicationName()), - tr("Version %1" - "

Copyright 2011 Heli Hyvättinen" - "

License: General Public License v2" - "

Bug Reports: https://bugs.maemo.org/ " - "enter_bug.cgi?product=Ghosts%20Overboard" - ).arg(QApplication::applicationVersion())); - - - + pPausetextItem_->hide(); + pAboutBoxItem_->show(); } @@ -651,3 +661,34 @@ void::SeaScene::softContinue() pause(pPauseAction_->isChecked()); } + +void SeaScene::createAboutBoxItems() +{ + pAboutBoxItem_ = new QGraphicsTextItem; + addItem(pAboutBoxItem_); + pAboutBoxItem_->setPos(25,50); + pAboutBoxItem_->setZValue(1000); + pAboutBoxItem_->hide(); + + pAboutBoxItem_->setHtml(tr("" + "%1
Version %2" + "

Copyright 2011 Heli Hyvättinen" + "

License: General Public License v2" + "

Bug Reports:
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; +} diff --git a/seascene.h b/seascene.h index 4fbbd3d..256c614 100644 --- a/seascene.h +++ b/seascene.h @@ -82,6 +82,10 @@ public slots: void softContinue(); + void createAboutBoxItems(); + + void setItemPointersNull(); + protected: @@ -122,6 +126,8 @@ protected: QGraphicsTextItem * pQuitItem_; QGraphicsTextItem * pMinimizeItem_; + QGraphicsTextItem * pAboutBoxItem_; + QList levelList_; int currentLevel_;