From: Heli Hyvättinen Date: Sat, 24 Sep 2011 13:45:46 +0000 (+0300) Subject: Asks for a vibra resource... X-Git-Tag: v0.4.0~13^2~5 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=6ee4fa907fa84c5117239e0f214fff56b8297eca;p=ghostsoverboard Asks for a vibra resource... ...but is denied it. --- diff --git a/ghostsoverboard.pro b/ghostsoverboard.pro index 039d296..247a8f2 100644 --- a/ghostsoverboard.pro +++ b/ghostsoverboard.pro @@ -100,5 +100,8 @@ unix:!symbian:!maemo5 { INSTALLS += icon } +#Harmattan specific: + CONFIG += link_pkgconfig + PKGCONFIG += libresourceqt1 diff --git a/seascene.cpp b/seascene.cpp index 753e916..cba81c3 100644 --- a/seascene.cpp +++ b/seascene.cpp @@ -35,6 +35,7 @@ #include #include + const QString ghostImageFilename_ = ":/pix/aave.png"; const QString rockImageFilename_ =":/pix/kari.png"; const QString octopusImageFilename_= ":/pix/tursas.png"; @@ -101,6 +102,19 @@ SeaScene::SeaScene(QObject *parent) : autopauseTimer.setInterval(15*60*1000); connect(&autopauseTimer,SIGNAL(timeout()),this,SLOT(turnPauseOn())); + pResourceSet_ = new ResourcePolicy::ResourceSet("gaming",this); + ResourcePolicy::VibraResource * pVibraResource = new ResourcePolicy::VibraResource(); + pVibraResource->setOptional(false); //The only resource of the set, so no sense for it to be optional + pResourceSet_->addResourceObject(pVibraResource); + + connect(pResourceSet_,SIGNAL(resourcesGranted(const QList< ResourcePolicy::ResourceType >)),this,SLOT(resourcesAvailable())); + connect(pResourceSet_,SIGNAL(lostResources()),this,SLOT(resourcesLost())); + + //To test whether resources were succesfully asked but not given + connect(pResourceSet_,SIGNAL(resourcesDenied()),this,SLOT(resourcesLost())); + pResourceSet_->setAlwaysReply(); + + pResourceSet_->acquire(); } @@ -800,3 +814,14 @@ void SeaScene::createLevelCompletedItems() pTapForNextLevelItem->setZValue(1000); pTapForNextLevelItem->setHtml("Tap to start the next level"); } + +void SeaScene::resourcesAvailable() +{ + qDebug() << "Resources available"; +} + +void SeaScene::resourcesLost() +{ + qDebug() << "Resources lost"; +} + diff --git a/seascene.h b/seascene.h index c3de5f7..715dfe3 100644 --- a/seascene.h +++ b/seascene.h @@ -32,6 +32,7 @@ #include #include #include +#include class SeaScene : public QGraphicsScene { @@ -86,6 +87,10 @@ public slots: void turnPauseOn(); + void resourcesAvailable(); + + void resourcesLost(); + protected: @@ -152,6 +157,9 @@ protected: QTime scoreCounter_; int totalScore_; int levelScore_; + + ResourcePolicy::ResourceSet * pResourceSet_; + }; #endif // SEASCENE_H