Merge branch 'savingsettings' into harmattan
authorHeli Hyvättinen <heli.hyvattinen@kymp.net>
Sat, 23 Jul 2011 09:04:18 +0000 (12:04 +0300)
committerHeli Hyvättinen <heli.hyvattinen@kymp.net>
Sat, 23 Jul 2011 09:04:18 +0000 (12:04 +0300)
ghostsoverboard.pro
orientationcontrolledgraphicspixmapobject.cpp
seascene.cpp
seaview.cpp
ship.cpp

index e3fb626..31cee3c 100644 (file)
@@ -34,6 +34,7 @@ HEADERS  += \
 CONFIG += mobility
 MOBILITY = sensors
 MOBILITY += systeminfo
+MOBILITY += feedback
 
 symbian {
     TARGET.UID3 = 0xe3f4bbc2
index d86ea23..272c7cf 100644 (file)
@@ -65,17 +65,25 @@ void OrientationControlledGraphicsPixmapObject::readRotationSensor()
 
     QRotationReading* pSensorData = rotationSensor_.reading();
 
-    int deltay = pSensorData->x(); //yes, you need the "x" value from the sensor for "y" direction in the scene...
-    int deltax = pSensorData->y(); //...and vice versa
+    //    int deltay = pSensorData->x(); //yes, in Maemo 5 you need the "x" value from the sensor for "y" direction in the scene...
+    //    int deltax = pSensorData->y(); //...and vice versa
 
+        int deltay = -pSensorData->y(); //But in Harmattan, you need the "y" value from the sensor for "y" direction in the scene...
+        int deltax = pSensorData->x(); //...and x for x (when in landscape)
+                                      //and you need to reverse the y value
 
  //   qDebug() << deltax << " " << deltay;
 
     int oldx = x();
     int oldy = y();
 
-    int newx = x() + deltax/15;
-    int newy = y() + deltay/15;
+    //this is how it works on maemo
+//    int newx = x() + deltax/15;
+//    int newy = y() + deltay/15;
+
+    //this is for Harmattan
+    int newx = x() + deltax/5;
+    int newy = y() + deltay/5;
 
 
 //    qDebug() << sceneRectangle.left() << sceneRectangle.right();
index 084afd9..3062678 100644 (file)
@@ -70,7 +70,9 @@ SeaScene::SeaScene(QObject *parent) :
 
     currentLevel_ = 0;
 
-    connect(this,SIGNAL(allGhostsPicked()),this,SLOT(nextLevel()));
+    //This ensures that nextlevel will not be called until its safe to delete the Ship object.
+    //Leaving out Qt::QueuedConnection or calling nextlevel directly instead of emitting the signal will CRASH
+    connect(this,SIGNAL(allGhostsPicked()),this,SLOT(nextLevel()),Qt::QueuedConnection);
 
 
     pVibrateAction_ = new QAction(tr("Vibration effects"),this);
@@ -460,7 +462,14 @@ void SeaScene::createMenuItems()
 
 
     pPausetextItem_ = new QGraphicsTextItem;
-    pPausetextItem_->setHtml("<font size = \"5\" color = darkorange> Game paused. Tap to continue.");
+
+ // This is for fremantle
+//    pPausetextItem_->setHtml("<font size = \"5\" color = darkorange> Game paused. Tap to continue.");
+
+//Harmattan needs bigger font
+    pPausetextItem_->setHtml("<font size = \"7\" color = darkorange> Game paused. Tap to continue.");
+
+
     pPausetextItem_->setZValue(1000);
     pPausetextItem_->setPos(200,50);
     addItem(pPausetextItem_);
@@ -468,7 +477,13 @@ void SeaScene::createMenuItems()
 
     menuItemCount_ = 0;
 
-    QString menufonthtml = "<font size = \"4\" color = darkorange>";
+  // This is for fremantle
+ //   QString menufonthtml = "<font size = \"4\" color = darkorange>";
+
+
+ //Harmattan needs bigger font
+        QString menufonthtml = "<font size = \"6\" color = darkorange>";
+
 
     pRestartGameItem_ = new QGraphicsTextItem;
     pRestartGameItem_->setHtml(tr("Restart <br> game").prepend(menufonthtml));
index 62c12a4..64dc8d7 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <QEvent>
 #include <QTimer>
+#include <QDebug>
 
 SeaView::SeaView(QWidget *parent) :
     QGraphicsView(parent)
@@ -99,18 +100,25 @@ void SeaView::initializeBoundaries()
         //the boundaries of the scene are set to match the size of the view window, and
         //the view is set to show exactly the whole scene area
 
-    //this occasionally gives a tiny scene, so using a fixed size fit for N900/Maemo5 until a fix is found
+    //this occasionally gives a tiny scene, so using a fixed size fit until a fix is found
 
 //    QPoint topleft (0,0);
-//    QSize windowsize = pView_->size();
+//    QSize windowsize = size();
 //    QRectF rectangle (topleft,windowsize);
 
-    QRectF rectangle(0,0,800,480);
+  //    This is for fremantle
+//    QRectF rectangle(0,0,800,480);
+
+    //This is for Harmattan
+    //The automatic code above gives 854 width and 480 height, but that gives both scrollbars
+    //Found by forking: 843 width and 476 height are the largest that don't bring up the scrollbars
+
+    QRectF rectangle(0,0,843,476);
 
     pScene_->setSceneRect(rectangle);
     setSceneRect(rectangle);
 
-//     qDebug() << "Initialized boundaries" << rectangle.right() << rectangle.bottom() << pView_->width() << pView_->height();
+    qDebug() << "Initialized boundaries" << rectangle.right() << rectangle.bottom() << width() << height();
 
     pScene_->restartLevel();
 }
index adcc202..85f0c8b 100644 (file)
--- a/ship.cpp
+++ b/ship.cpp
 #include <QDebug>
 #include <QDBusMessage>
 #include <QDBusConnection>
+#include <QFeedbackHapticsEffect>
+
+
+
+QTM_USE_NAMESPACE
 
 
 Ship::Ship(QList<QPixmap> pixmapList, QGraphicsItem *parent) :
@@ -95,17 +100,28 @@ void Ship::dropAllGhosts()
 
     if (vibrationActive_)
     {
-        QDBusMessage message = QDBusMessage::createMethodCall("com.nokia.mce","/com/nokia/mce/request","com.nokia.mce.request","req_vibrator_pattern_activate");
 
-        QList<QVariant> arguments;
+ //       This is for fremantle
+//        QDBusMessage message = QDBusMessage::createMethodCall("com.nokia.mce","/com/nokia/mce/request","com.nokia.mce.request","req_vibrator_pattern_activate");
+
+//        QList<QVariant> arguments;
 
-        arguments.append("PatternChatAndEmail");
+//        arguments.append("PatternChatAndEmail");
 
-        message.setArguments(arguments);
+//        message.setArguments(arguments);
 
-        message = QDBusConnection::systemBus().call(message);
+//        message = QDBusConnection::systemBus().call(message);
 
     //qDebug() << message;
+
+
+        //This is for Harmattan
+
+        QFeedbackHapticsEffect vibrationEffect;
+        vibrationEffect.setDuration(1000);
+        vibrationEffect.setIntensity(1.0);
+        vibrationEffect.start();
+
     }
 }