CONFIG += mobility
MOBILITY = sensors
MOBILITY += systeminfo
+MOBILITY += feedback
symbian {
TARGET.UID3 = 0xe3f4bbc2
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();
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);
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_);
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));
#include <QEvent>
#include <QTimer>
+#include <QDebug>
SeaView::SeaView(QWidget *parent) :
QGraphicsView(parent)
//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();
}
#include <QDebug>
#include <QDBusMessage>
#include <QDBusConnection>
+#include <QFeedbackHapticsEffect>
+
+
+
+QTM_USE_NAMESPACE
Ship::Ship(QList<QPixmap> pixmapList, QGraphicsItem *parent) :
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();
+
}
}