+impuzzle (0.6.1-1maemo0) unstable; urgency=low
+
+ * Fixes: Preventing user interaction with image pieces during game setup that would lead to segfault.
+ * Taking garage bug tracker into use instead of email address
+
+ -- Timo Härkönen <timop.harkonen@gmail.com> Wed, 26 May 2010 21:46:00 +0200
+
+impuzzle (0.6-1maemo1) unstable; urgency=low
+
+ * Just building against the new SDK in autobuilder
+
+ -- Timo Härkönen <timop.harkonen@gmail.com> Tue, 25 May 2010 17:18:00 +0200
+
impuzzle (0.6-1maemo0) unstable; urgency=low
* Fixes: Move counter not resetted when starting new game
impuzzle (0.6-1maemo0) unstable; urgency=low
* Fixes: Move counter not resetted when starting new game
Maintainer: Timo Härkönen <timop.harkonen@gmail.com>
Build-Depends: debhelper (>= 5), libqt4-dev (>= 4.6.0)
Standards-Version: 3.7.2
Maintainer: Timo Härkönen <timop.harkonen@gmail.com>
Build-Depends: debhelper (>= 5), libqt4-dev (>= 4.6.0)
Standards-Version: 3.7.2
-XSBC-Bugtracker: mailto:timop.harkonen@gmail.com
+XSBC-Bugtracker: https://garage.maemo.org/tracker/?group_id=1167
Package: impuzzle
Architecture: any
Package: impuzzle
Architecture: any
Description: Image puzzle game
impuzzle is a picture puzzle game that let's you
use your own pictures as the game board.
Description: Image puzzle game
impuzzle is a picture puzzle game that let's you
use your own pictures as the game board.
+ Limitations in current version:
+ For random images only images in /home/user/MyDocs/.images is used
XB-Maemo-Icon-26:
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c
6QAAAAZiS0dEALAAMQAxnfM89gAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0
XB-Maemo-Icon-26:
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c
6QAAAAZiS0dEALAAMQAxnfM89gAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0
void GameView::setPieces(const QList<PuzzleItem *> pieces, bool shuffle)
{
void GameView::setPieces(const QList<PuzzleItem *> pieces, bool shuffle)
{
+ PuzzleItem::setManuallyMovable(false);
+
if(pieces.isEmpty()) {
qDebug() << "Empty list @ GameView::setPieces";
return;
if(pieces.isEmpty()) {
qDebug() << "Empty list @ GameView::setPieces";
return;
if(shuffle) {
QTimer::singleShot(750, this, SLOT(shufflePieces()));
}
if(shuffle) {
QTimer::singleShot(750, this, SLOT(shufflePieces()));
}
+ else {
+ PuzzleItem::setManuallyMovable(true);
+ }
case 0:
if(pieces_.at(hiddenIndex_)->currentPlace().y() > topLeft.y()) {
QPointF tmp = pieces_.at(hiddenIndex_)->currentPlace();
case 0:
if(pieces_.at(hiddenIndex_)->currentPlace().y() > topLeft.y()) {
QPointF tmp = pieces_.at(hiddenIndex_)->currentPlace();
- item = dynamic_cast<PuzzleItem *>(scene()->itemAt(tmp + QPointF(0, -verticalStep_)));
- if(item->movable()) {
- emptyPlace_ = item->currentPlace();
- pieces_.at(hiddenIndex_)->setCurrentPlace(item->currentPlace());
- pieces_.at(hiddenIndex_)->setPos(item->currentPlace());
- item->setCurrentPlace(tmp);
- item->setPos(tmp);
- invalidateScene();
- scene()->update();
- setMovingPieces();
- movesMade++;
- }
- else {
- qDebug() << "Item right of hidden piece not movable";
+ QGraphicsItem *graphicsItem = scene()->itemAt(tmp + QPointF(0, -verticalStep_));
+ if(graphicsItem) {
+ item = dynamic_cast<PuzzleItem *>(graphicsItem);
+ if(item->movable()) {
+ emptyPlace_ = item->currentPlace();
+ pieces_.at(hiddenIndex_)->setCurrentPlace(item->currentPlace());
+ pieces_.at(hiddenIndex_)->setPos(item->currentPlace());
+ item->setCurrentPlace(tmp);
+ item->setPos(tmp);
+ invalidateScene();
+ scene()->update();
+ setMovingPieces();
+ movesMade++;
+ }
+ else {
+ qDebug() << "Item right of hidden piece not movable";
+ }
case 1:
if(pieces_.at(hiddenIndex_)->currentPlace().y() < bottomRight.y()) {
QPointF tmp = pieces_.at(hiddenIndex_)->currentPlace();
case 1:
if(pieces_.at(hiddenIndex_)->currentPlace().y() < bottomRight.y()) {
QPointF tmp = pieces_.at(hiddenIndex_)->currentPlace();
- item = dynamic_cast<PuzzleItem *>(scene()->itemAt(tmp + QPointF(0, verticalStep_)));
- if(item->movable()) {
- emptyPlace_ = item->currentPlace();
- pieces_.at(hiddenIndex_)->setCurrentPlace(item->currentPlace());
- pieces_.at(hiddenIndex_)->setPos(item->currentPlace());
- item->setCurrentPlace(tmp);
- item->setPos(tmp);
- setMovingPieces();
- movesMade++;
- }
- else {
- qDebug() << "Item down of hidden piece not movable";
+ QGraphicsItem *graphicsItem = scene()->itemAt(tmp + QPointF(0, verticalStep_));
+ if(graphicsItem) {
+ item = dynamic_cast<PuzzleItem *>(graphicsItem);
+ if(item->movable()) {
+ emptyPlace_ = item->currentPlace();
+ pieces_.at(hiddenIndex_)->setCurrentPlace(item->currentPlace());
+ pieces_.at(hiddenIndex_)->setPos(item->currentPlace());
+ item->setCurrentPlace(tmp);
+ item->setPos(tmp);
+ setMovingPieces();
+ movesMade++;
+ }
+ else {
+ qDebug() << "Item down of hidden piece not movable";
+ }
case 2:
if(pieces_.at(hiddenIndex_)->currentPlace().x() > topLeft.x()) {
QPointF tmp = pieces_.at(hiddenIndex_)->currentPlace();
case 2:
if(pieces_.at(hiddenIndex_)->currentPlace().x() > topLeft.x()) {
QPointF tmp = pieces_.at(hiddenIndex_)->currentPlace();
- item = dynamic_cast<PuzzleItem *>(scene()->itemAt(tmp + QPointF(-horizontalStep_, 0)));
- if(item->movable()) {
- emptyPlace_ = item->currentPlace();
- pieces_.at(hiddenIndex_)->setCurrentPlace(item->currentPlace());
- pieces_.at(hiddenIndex_)->setPos(item->currentPlace());
- item->setCurrentPlace(tmp);
- item->setPos(tmp);
- setMovingPieces();
- movesMade++;
- }
- else {
- qDebug() << "Item left of hidden piece not movable";
+ QGraphicsItem *graphicsItem = scene()->itemAt(tmp + QPointF(-horizontalStep_, 0));
+ if(graphicsItem) {
+ item = dynamic_cast<PuzzleItem *>(graphicsItem);
+ if(item->movable()) {
+ emptyPlace_ = item->currentPlace();
+ pieces_.at(hiddenIndex_)->setCurrentPlace(item->currentPlace());
+ pieces_.at(hiddenIndex_)->setPos(item->currentPlace());
+ item->setCurrentPlace(tmp);
+ item->setPos(tmp);
+ setMovingPieces();
+ movesMade++;
+ }
+ else {
+ qDebug() << "Item left of hidden piece not movable";
+ }
case 3:
if(pieces_.at(hiddenIndex_)->currentPlace().x() < bottomRight.x()) {
QPointF tmp = pieces_.at(hiddenIndex_)->currentPlace();
case 3:
if(pieces_.at(hiddenIndex_)->currentPlace().x() < bottomRight.x()) {
QPointF tmp = pieces_.at(hiddenIndex_)->currentPlace();
- item = dynamic_cast<PuzzleItem *>(scene()->itemAt(tmp + QPointF(horizontalStep_, 0)));
- if(item->movable()) {
- emptyPlace_ = item->currentPlace();
- pieces_.at(hiddenIndex_)->setCurrentPlace(item->currentPlace());
- pieces_.at(hiddenIndex_)->setPos(item->currentPlace());
- item->setCurrentPlace(tmp);
- item->setPos(tmp);
- setMovingPieces();
- movesMade++;
- }
- else {
- qDebug() << "Item up of hidden piece not movable";
+ QGraphicsItem *graphicsItem = scene()->itemAt(tmp + QPointF(horizontalStep_, 0));
+ if(graphicsItem) {
+ item = dynamic_cast<PuzzleItem *>(graphicsItem);
+ if(item->movable()) {
+ emptyPlace_ = item->currentPlace();
+ pieces_.at(hiddenIndex_)->setCurrentPlace(item->currentPlace());
+ pieces_.at(hiddenIndex_)->setPos(item->currentPlace());
+ item->setCurrentPlace(tmp);
+ item->setPos(tmp);
+ setMovingPieces();
+ movesMade++;
+ }
+ else {
+ qDebug() << "Item up of hidden piece not movable";
+ }
qDebug() << QString("Shuffle moves: %1/%2").arg(movesMade).arg(moveCount);
QParallelAnimationGroup *animationGroup = new QParallelAnimationGroup(this);
qDebug() << QString("Shuffle moves: %1/%2").arg(movesMade).arg(moveCount);
QParallelAnimationGroup *animationGroup = new QParallelAnimationGroup(this);
+ connect(animationGroup, SIGNAL(finished()), this, SLOT(shuffleAnimationFinished()));
for(int i = 0; i < pieces_.count(); ++i) {
QPropertyAnimation *animation = new QPropertyAnimation(pieces_.at(i), "pos");
animation->setStartValue(pieces_.at(i)->correctPlace());
for(int i = 0; i < pieces_.count(); ++i) {
QPropertyAnimation *animation = new QPropertyAnimation(pieces_.at(i), "pos");
animation->setStartValue(pieces_.at(i)->correctPlace());
animationGroup->addAnimation(animation);
}
animationGroup->start();
animationGroup->addAnimation(animation);
}
animationGroup->start();
pieces_.at(hiddenIndex_)->hide();
pieces_.at(hiddenIndex_)->hide();
+void GameView::shuffleAnimationFinished()
+{
+ PuzzleItem::setManuallyMovable(true);
}
QPointF GameView::emptyPlace()
}
QPointF GameView::emptyPlace()
bool restoreGame();
void saveGame();
bool restoreGame();
void saveGame();
+private slots:
+ void shuffleAnimationFinished();
+
signals:
void gameWon();
void gameRestored();
signals:
void gameWon();
void gameRestored();
[Desktop Entry]
Encoding=UTF-8
[Desktop Entry]
Encoding=UTF-8
Icon=impuzzle
Exec=/opt/impuzzle/impuzzle
X-Osso-Type=application/x-executable
Icon=impuzzle
Exec=/opt/impuzzle/impuzzle
X-Osso-Type=application/x-executable
+Maemo-Display-Name=impuzzle
#include <QFontMetrics>
int PuzzleItem::moveCount_ = 0;
#include <QFontMetrics>
int PuzzleItem::moveCount_ = 0;
+bool PuzzleItem::manuallyMovable_ = false;
PuzzleItem::PuzzleItem(QGraphicsItem *parent) :
QGraphicsPixmapItem(parent)
PuzzleItem::PuzzleItem(QGraphicsItem *parent) :
QGraphicsPixmapItem(parent)
void PuzzleItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
void PuzzleItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
+ if(movable_ && manuallyMovable_) {
moveMeTo(GameView::instance()->emptyPlace());
QPointF tmp = currentPlace();
setCurrentPlace(GameView::instance()->emptyPlace());
moveMeTo(GameView::instance()->emptyPlace());
QPointF tmp = currentPlace();
setCurrentPlace(GameView::instance()->emptyPlace());
+void PuzzleItem::setManuallyMovable(const bool manuallyMovable)
+{
+ manuallyMovable_ = manuallyMovable;
+}
+
void PuzzleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QGraphicsPixmapItem::paint(painter, option, widget);
void PuzzleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
QGraphicsPixmapItem::paint(painter, option, widget);
static int moveCount();
static void setMoveCount(const int count);
static void resetMoveCount();
static int moveCount();
static void setMoveCount(const int count);
static void resetMoveCount();
+ static void setManuallyMovable(const bool manuallyMovable);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setPieceNumber(const int pieceNumber);
int pieceNumber() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
void setPieceNumber(const int pieceNumber);
int pieceNumber() const;
bool movable_;
QPropertyAnimation *moveAnimation_;
static int moveCount_;
bool movable_;
QPropertyAnimation *moveAnimation_;
static int moveCount_;
+ static bool manuallyMovable_;
int pieceNumber_;
bool drawNumber_;
};
int pieceNumber_;
bool drawNumber_;
};
qDebug() << "Random image selected";
// Get random image from ~/MyDocs/.images/
qDebug() << "Random image selected";
// Get random image from ~/MyDocs/.images/
+ //TODO: images from other directories
QStringList filters;
filters << "*.jpg" << "*.png" << "*.xpm";
QStringList filters;
filters << "*.jpg" << "*.png" << "*.xpm";
- qDebug() << "Default image selected";
+ //qDebug() << "Default image selected";
Settings::instance()->setImage(0);
Settings::instance()->setImagePath("default");
Settings::instance()->setImage(0);
Settings::instance()->setImagePath("default");