Defaults to off.
Untested for now.
menuBar()->addAction(pAboutAction);
+ QAction * pVibrateAction = new QAction(tr("Vibration effects"),this);
+ pVibrateAction->setCheckable(true);
+ addAction(pVibrateAction);
+ connect(pVibrateAction,SIGNAL(triggered(bool)),this,SLOT(setVibrationEffects(bool)));
+ menuBar()->addAction(pVibrateAction);
+
+
//the boundaries of the scene are set to match the size of the view window, which is not
//available in the constructor --> timer needed
QTimer::singleShot(100,this,SLOT(initializeBoundaries()));
return QMainWindow::event(event);
}
+
void nextLevel();
+
private:
SeaScene * pScene_;
QAction* pPauseAction_;
+
};
#endif // MAINWINDOW_H
addItem(pShip);
connect(pShip,SIGNAL(pickingGhost(QGraphicsItem*)),this, SLOT(removeGhost(QGraphicsItem*)) );
connect(pShip,SIGNAL(droppingGhosts(int)),this,SLOT(ghostsDropped(int)));
+ connect(this,SIGNAL(vibrationActivated(bool)),pShip,SLOT(setVibrationActivate(bool)));
pShip->startMoving();
movingItems_.append(pShip);
connect(this,SIGNAL(pauseOn()),pShip,SLOT(stopMoving()));
screenLitKeeper_.keepScreenLit(false);
}
}
+
+void SeaScene::vibrationActivate(bool on)
+{
+ emit vibrationActivated(on);
+}
void allGhostsPicked();
void pauseOn();
void pauseOff();
+ void vibrationActivated(bool on);
public slots:
void pause (bool paused);
+ void vibrationActivate(bool);
+
protected:
/*! Gives a pointer to a random position if a free one is found. Otherwise returns NULL.
{
shipImages_ = pixmapList;
ghostsAboard_ = 0;
-
+ vibrationActive_ = false;
}
bool Ship::handleCollisions()
//vibrate
+ if (vibrationActive_)
+ {
+ QDBusMessage message = QDBusMessage::createMethodCall("com.nokia.mce","/com/nokia/mce/request","com.nokia.mce.request","req_vibrator_pattern_activate");
- 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");
+ QList<QVariant> arguments;
- message.setArguments(arguments);
+ arguments.append("PatternChatAndEmail");
- message = QDBusConnection::systemBus().call(message);
+ message.setArguments(arguments);
- qDebug() << message;
+ message = QDBusConnection::systemBus().call(message);
+ //qDebug() << message;
+ }
}
+void Ship::setVibrationActivate(bool on)
+{
+ vibrationActive_ = on;
+}
void dropAllGhosts();
+ void setVibrationActivate(bool on);
+
protected:
protected:
QList<QPixmap> shipImages_;
+ bool vibrationActive_;
+
};