[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [pairs/frameworks] game: refactoring of cardItem
From: Marco Calignano <marco.calignano () gmail ! com>
Date: 2014-09-15 20:16:50
Message-ID: E1XTche-00040W-Io () scm ! kde ! org
[Download RAW message or body]
Git commit 35477441b46011ab3e4962f547899f23e09fcf5d by Marco Calignano.
Committed on 10/07/2014 at 09:46.
Pushed by calignano into branch 'frameworks'.
refactoring of cardItem
M +28 -208 game/carditem.cpp
M +27 -48 game/carditem.h
M +58 -117 game/pairsview.cpp
M +12 -23 game/pairsview.h
http://commits.kde.org/pairs/35477441b46011ab3e4962f547899f23e09fcf5d
diff --git a/game/carditem.cpp b/game/carditem.cpp
index 5ba26b3..68419f6 100644
--- a/game/carditem.cpp
+++ b/game/carditem.cpp
@@ -21,233 +21,53 @@
*/
#include "carditem.h"
-#include <QGraphicsRotation>
-#include <QPropertyAnimation>
#include <QFile>
-#include <QPainter>
-#include <QGraphicsOpacityEffect>
-#include <QGraphicsColorizeEffect>
#include <KDE/KLocale>
#include <KStandardDirs>
-#include <Phonon/MediaObject>
-#include <Phonon/AudioOutput>
-#include <Phonon/VideoPlayer>
-#include "pairstheme.h"
-#include <kfontutils.h>
-
-CardItem::CardItem(const QSharedPointer<QSvgRenderer>& back, QGraphicsItem* parent, \
QGraphicsScene* scene, Phonon::MediaObject *media)
- : QGraphicsPixmapItem(parent)
- , m_type(CARD_NONE)
- , m_activated(false)
- , m_backRenderer(back)
- , m_media(media)
+CardItem::CardItem(QObject* parent, QImage front, QImage back, QString text, QString \
postMessage, QByteArray foundSound, QByteArray missedSound, CardType type, int index) \
+ : QObject(parent) + , QStandardItem()
+ , m_type(type)
+ , m_front(front)
+ , m_back(back)
+ , m_text(text)
+ , m_postMessage(postMessage)
+ , m_found(foundSound)
+ , m_missed(missedSound)
{
-
- m_rotation = new QGraphicsRotation(this);
- m_rotation->setAxis(Qt::YAxis);
-
- m_animation = new QPropertyAnimation(m_rotation, "angle", m_rotation);
- m_animation->setStartValue(0);
- m_animation->setEndValue(90);
- m_animation->setDuration(200);
- m_animation->setEasingCurve(QEasingCurve::InOutQuad);
- connect(m_animation, SIGNAL(finished()), SLOT(changeValue()));
-
- m_animationBack = new QPropertyAnimation(m_rotation, "angle", m_rotation);
- m_animationBack->setStartValue(90);
- m_animationBack->setEndValue(0);
- m_animationBack->setDuration(200);
- m_animationBack->setEasingCurve(QEasingCurve::InOutQuad);
-
- setTransformations(QList<QGraphicsTransform*>() << m_rotation);
- m_opacityAnimation=new QPropertyAnimation(this, "opacity", this);
- m_opacityAnimation->setStartValue(1.0);
- m_opacityAnimation->setEndValue(0.2);
- QGraphicsColorizeEffect *colorize = new QGraphicsColorizeEffect(this);
- colorize->setColor(Qt::white);
- colorize->setStrength(0);
- m_colorAnimation = new QPropertyAnimation(colorize, "strength", colorize);
- m_colorAnimation->setStartValue(1);
- m_colorAnimation->setEndValue(0.6);
- m_colorAnimation->setDuration(200);
- m_backColorAnimation = new QPropertyAnimation(colorize, "strength", colorize);
- m_backColorAnimation->setStartValue(0.6);
- m_backColorAnimation->setEndValue(0);
- m_backColorAnimation->setDuration(0);
- setGraphicsEffect(colorize);
-
- setDuration(200);
- setShapeMode(BoundingRectShape);
+ m_parent = parent;
+ m_index = index;
}
CardItem::~CardItem()
{}
-void CardItem::setSize(const QSizeF& newSize)
-{
- if(newSize==m_back.size())
- return;
-
- m_back=QPixmap(newSize.toSize());
- m_back.fill(Qt::transparent);
- QPainter p(&m_back);
- m_backRenderer->render(&p);
- m_rotation->setOrigin(QVector3D(m_back.rect().center()));
-
- m_color=QPixmap(newSize.toSize());
- m_color.fill(Qt::transparent);
- if(m_type==CARD_WORD) {
- QPainter paint(&m_color);
- paint.setPen(Qt::white);
- KFontUtils::adaptFontSize(paint, m_text, m_color.size());
- paint.drawText( m_color.rect(), Qt::AlignCenter, m_text);
- } else {
- QPainter pixPainter(&m_color);
- m_frontRenderer->render(&pixPainter);
- }
-
- if(m_type == CARD_LOGIC || m_type == CARD_SOUNDLOGIC)
- {
- setPixmap(m_color);
- }
- else
- {
- setPixmap(m_back);
- }
-}
-
-void CardItem::setDuration(int dur)
-{
- m_animation->setDuration(dur);
- m_animationBack->setDuration(dur);
-}
-
-void CardItem::setType(CardType type, const QString& file, const PairsTheme* theme){
- m_type = type;
- switch(type){
- case CARD_SOUNDLOGIC:
- case CARD_SOUND:
- {
- QString dir = QStandardPaths::locate(QStandardPaths::DataLocation, \
QLatin1String( "gameicons/pairs.svg"));
- setCardPixmap(QSharedPointer<QSvgRenderer>(new \
QSvgRenderer(dir+"gameicons/sound.svg")));
-// m_color.fill(Qt::blue);
- QBuffer *mediafile = new QBuffer(this);
- mediafile->setData(theme->themeData(file));
- m_source = Phonon::MediaSource(mediafile);
- /// void copy(QIODevice *source , QIODevice *target){ \
target->write(source->readAll()); }
- } break;
- case CARD_IMAGE2:
- case CARD_IMAGE:
- case CARD_LOGIC:
- setCardPixmap(QSharedPointer<QSvgRenderer>(new \
QSvgRenderer(theme->themeData(file))));
- break;
- case CARD_WORD:
- m_text = file;
- break;
- default:
- break;
- }
-
-}
-
-
-void CardItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* )
-{
- if((!m_activated) && (m_media->state()!= Phonon::PlayingState)) {
- turn();
- }
-}
-
-void CardItem::turn()
-{
- disconnect(m_media, SIGNAL(finished()), this, SLOT(turn()));
- m_activated=!m_activated;
-
- m_animation->start();
-}
-
-void CardItem::setCardPixmap(const QSharedPointer<QSvgRenderer>& renderer)
-{
- m_frontRenderer=renderer;
-}
-
-void CardItem::changeValue()
-{
- if(m_activated){
- setPixmap(m_color);
- if(m_type == CARD_LOGIC || m_type == CARD_SOUNDLOGIC){
- m_colorAnimation->start();
- }
- }
- else{
- if(m_type == CARD_LOGIC || m_type == CARD_SOUNDLOGIC){
- setPixmap(m_color);
- m_backColorAnimation->start();
- }
- else{
- setPixmap(m_back);
- }
- }
-
- if((m_type==CARD_SOUND || m_type==CARD_SOUNDLOGIC) && m_activated) {
- Phonon::MediaObject* object = new Phonon::MediaObject(this);
- Phonon::AudioOutput *audioOutput = new \
Phonon::AudioOutput(Phonon::GameCategory, object);
- createPath(object, audioOutput);
- object->setCurrentSource(m_source);
- object->play();
-
- //We delay the emit selected until it has played, that way sounds don't \
overlap
- connect(object, SIGNAL(finished()), this, SLOT(emitSelected()));
- connect(object, SIGNAL(finished()), object, SLOT(deleteLater()));
- } else if(m_activated)
- emitSelected();
-
- m_animationBack->start();
-}
-
-void CardItem::emitSelected()
-{
- emit selected(this);
-}
-
-void CardItem::markDone()
-{
- m_opacityAnimation->start();
-}
-
-bool CardItem::isDone() const
-{
- return m_opacityAnimation->currentTime()!=0;
-}
-
-void CardItem::setFoundSound(const QByteArray& found)
-{
- m_found = found;
-}
-
-QByteArray readFile(const QString& path)
-{
- QFile f(path);
- bool r = f.open(QFile::ReadOnly);
- Q_ASSERT(r);
- return f.readAll();
-}
-
-QByteArray CardItem::foundSound() const
+QByteArray CardItem::readFoundSound() const
{
if(m_found.isEmpty()) {
static QByteArray defaultCorrectSound;
if(defaultCorrectSound.isEmpty()) {
- defaultCorrectSound = \
readFile(QStandardPaths::locate(QStandardPaths::DataLocation, \
QLatin1String("themes/right.ogg"))); + QFile \
file(QStandardPaths::locate(QStandardPaths::DataLocation, \
QLatin1String("themes/right.ogg"))); + if \
(!file.open(QIODevice::ReadOnly)) return defaultCorrectSound; + \
defaultCorrectSound = file.readAll(); }
return defaultCorrectSound;
} else
return m_found;
}
-QByteArray CardItem::missedSound() const
+QByteArray CardItem::readMissedSound() const
{
- static QByteArray defaultMissedSound = \
readFile(QStandardPaths::locate(QStandardPaths::DataLocation, \
QLatin1String("themes/wrong.ogg")));
- return defaultMissedSound;
+ if(m_missed.isEmpty()) {
+ static QByteArray defaultMissedSound;
+ if(defaultMissedSound.isEmpty()) {
+ QFile file(QStandardPaths::locate(QStandardPaths::DataLocation, \
QLatin1String("themes/wrong.ogg"))); + if \
(!file.open(QIODevice::ReadOnly)) return defaultMissedSound; + \
defaultMissedSound = file.readAll(); + }
+ return defaultMissedSound;
+ } else
+ return m_missed;
}
+
diff --git a/game/carditem.h b/game/carditem.h
index 83469a8..9c7af1a 100644
--- a/game/carditem.h
+++ b/game/carditem.h
@@ -23,68 +23,47 @@
#ifndef CARDITEM_H
#define CARDITEM_H
-#include <QGraphicsRectItem>
-#include <QSvgRenderer>
+#include <QStandardItem>
#include <QBuffer>
-
+#include <QImage>
+#include <QString>
#include "cardtype.h"
-#include <phonon/mediasource.h>
class PairsTheme;
-namespace Phonon { class MediaObject; class MediaSource;}
-class QPropertyAnimation;
-class QGraphicsRotation;
class CardItem
- : public QObject, public QGraphicsPixmapItem
+ : public QObject
+ , public QStandardItem
{
- Q_OBJECT
- Q_PROPERTY(QPointF position READ pos WRITE setPos);
- Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity);
+ Q_OBJECT;
+ Q_PROPERTY(QImage frontImage READ readFront);
+ Q_PROPERTY(QImage backImage READ readBack);
+ Q_PROPERTY(QString postMessage READ readPostMsg);
+ Q_PROPERTY(QString text READ readText);
+ Q_PROPERTY(QByteArray foundSound READ readFoundSound WRITE setFoundSound);
+ Q_PROPERTY(QByteArray missedSound READ readMissedSound WRITE setMissedSound);
public:
- CardItem(const QSharedPointer<QSvgRenderer>& back, QGraphicsItem* parent, \
QGraphicsScene* scene = 0, Phonon::MediaObject *media = 0); + \
CardItem(QObject* parent, QImage front, QImage back, QString text, QString \
postMessage, QByteArray foundSound, QByteArray missedSound, CardType type, int \
index); virtual ~CardItem();
-
- virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
- virtual void mousePressEvent(QGraphicsSceneMouseEvent*) {}
- void setCardPixmap(const QSharedPointer<QSvgRenderer>& renderer);
- void markDone();
- void setType(CardType type, const QString& file, const PairsTheme* theme);
- bool isDone() const;
- void setDuration(int dur);
- void setSize(const QSizeF& newSize);
- void setFoundSound(const QByteArray & found);
- QByteArray foundSound() const;
- QByteArray missedSound() const;
-
- public slots:
- void changeValue();
- void turn();
- void emitSelected();
-
+ // void setType(CardType type, const QString& file, const PairsTheme* theme);
+ QByteArray readFoundSound() const;
+ void setFoundSound(const QByteArray &found){m_found = found;};
+ QByteArray readMissedSound() const;
+ void setMissedSound(const QByteArray &missed){m_missed = missed;};
+ QImage readBack(){return m_back;};
+ QImage readFront(){return m_front;};
+ QString readText(){return m_text;};
+ QString readPostMsg(){return m_postMessage;};
-
- signals:
- void selected(CardItem* data);
-
private:
- QPropertyAnimation* m_animation;
- QPropertyAnimation* m_animationBack;
-
+ QObject *m_parent;
CardType m_type;
- bool m_activated;
- QPixmap m_color;
- QPixmap m_back;
- QPropertyAnimation* m_opacityAnimation;
- QPropertyAnimation* m_colorAnimation;
- QPropertyAnimation* m_backColorAnimation;
- Phonon::MediaSource m_source;
- QSharedPointer<QSvgRenderer> m_frontRenderer;
- QSharedPointer<QSvgRenderer> m_backRenderer;
+ QImage m_front;
+ QImage m_back;
QString m_text;
+ QString m_postMessage;
QByteArray m_found;
- QGraphicsRotation* m_rotation;
- Phonon::MediaObject *m_media;
+ QByteArray m_missed;
};
#endif // CARDITEM_H
diff --git a/game/pairsview.cpp b/game/pairsview.cpp
index ecf36d1..0330014 100644
--- a/game/pairsview.cpp
+++ b/game/pairsview.cpp
@@ -22,18 +22,16 @@
*/
#include "pairsview.h"
-#include "carditem.h"
+#include "cardmodel.h"
#include "pairstheme.h"
#include "themesmodel.h"
#include "themeiconsprovider.h"
#include "pairsplayer.h"
#include <QDebug>
#include <QPropertyAnimation>
-#include <QGraphicsRotation>
#include <QDate>
#include <QTimer>
#include <QFile>
-#include <QSvgRenderer>
#include <QQmlEngine>
#include <QQmlComponent>
#include <QQuickItem>
@@ -47,36 +45,29 @@
#include <Phonon/AudioOutput>
#include <QStandardPaths>
-#include <knewstuff3/downloaddialog.h>
-#include <knewstuff3/entry.h>
+#include <KNewStuff3/kns3/downloaddialog.h>
+#include <KNewStuff3/kns3/entry.h>
#include <QResizeEvent>
#include <cmath>
#include <KRandom>
-#include <KStandardDirs>
-#include <kdeclarative.h>
+//#include <KStandardDirs>
+//#include <kdeclarative.h>
PairsView::PairsView(QWindow *parent, QQmlEngine *pengine, const QString &file)
: QQuickView(pengine, parent)
- , m_last(0)
, m_knsDialog(0)
- , m_itemsPerRow(1)
{
m_model = new ThemesModel(this, file);
+ m_cards = new CardModel(this);
m_players = new PlayersModel(this);
m_themeImagesProvider = new ThemeIconsProvider(QQuickImageProvider::Pixmap, \
m_model);
- m_timer = new QTimer(this);
- connect(m_timer, SIGNAL(timeout()), this, SLOT(update()));
-
- connect(m_players, SIGNAL(rowsRemoved(QModelIndex,int,int)), m_timer, \
SLOT(stop()));
-
-// qmlRegisterType<ThemesModel>("org.kde.edu.pairs", 1, 0, "ThemesModel");
-
- setResizeMode(SizeRootObjectToView);
-
+ m_themeImagesProvider = new ThemeIconsProvider(QQuickImageProvider::Pixmap, \
m_model); +
rootContext()->setContextProperty("fgame", this);
rootContext()->setContextProperty("themesModel", m_model);
rootContext()->setContextProperty("playersModel", m_players);
+ rootContext()->setContextProperty("cardModel", m_cards);
engine()->addImageProvider("theme", m_themeImagesProvider);
/* TODO
@@ -90,9 +81,6 @@ PairsView::PairsView(QWindow *parent, QQmlEngine *pengine, const \
QString &file) setSource(QUrl("qrc:/qml/Main.qml"));
Q_ASSERT(errors().isEmpty());
- m_resizeTimer = new QTimer(this);
- m_resizeTimer->setSingleShot(true);
- connect(m_resizeTimer, SIGNAL(timeout()), SLOT(reorganizeCards()));
connect(engine(), SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit()));
m_media = new Phonon::MediaObject(this);
@@ -103,55 +91,6 @@ PairsView::PairsView(QWindow *parent, QQmlEngine *pengine, const \
QString &file) PairsView::~PairsView()
{}
-int PairsView::cardsNum()
-{
- return m_cards.count();
-}
-
-bool PairsView::isGameOver() const
-{
- foreach(CardItem* card, m_cards) {
- if(!card->isDone())
- return false;
- }
- return true;
-}
-
-void PairsView::update()
-{
- m_players->player(m_currentPlayer)->incSeconds();
-}
-
-void PairsView::cardSelected(CardItem* card)
-{
- Q_ASSERT(card);
-
- if(m_last) {
- if(m_last->data(0)==card->data(0)) {
- m_last->markDone();
- card->markDone();
- playSound(card->foundSound());
- m_players->player(m_currentPlayer)->incFound();
- QTimer::singleShot(500, this, SLOT(checkGameOver()));
- } else {
- connect(m_media, SIGNAL(finished()), card, SLOT(turn()));
- connect(m_media, SIGNAL(finished()), m_last, SLOT(turn()));
- playSound(card->missedSound());
- m_players->player(m_currentPlayer)->incMissed();
-
- //next player
- do {
- ++m_currentPlayer %= m_players->rowCount();
- } while(!m_players->player(m_currentPlayer)->isSelected());
- emit currentPlayerChanged();
- }
- m_last=0;
- }
- else {
- m_last=card;
- }
-}
-
void PairsView::newGame(int row, const QString& cardType)
{
PairsTheme* theme=static_cast<PairsTheme*>(m_model->item(row));
@@ -160,12 +99,17 @@ void PairsView::newGame(int row, const QString& cardType)
void PairsView::newGame(const PairsTheme* theme, const QString& language, const \
QString& cardType) {
+<<<<<<< Updated upstream
qDeleteAll(m_cards);
m_last = 0;
m_cards.clear();
QList<CardItem*> cards;
QQuickItem* cardsParent=findChild<QQuickItem*>("board");
+=======
+ m_cards->clear();
+ QQuickItem* cardsParent=findChild<QQuickItem*>("board");
+>>>>>>> Stashed changes
playersModel()->resetPlayers();
Q_ASSERT(cardsParent);
@@ -184,64 +128,53 @@ void PairsView::newGame(const PairsTheme* theme, const QString& \
language, const else{
file_buf = (theme->themeData(theme->backImage()));
}
- QSharedPointer<QSvgRenderer> backRenderer(new QSvgRenderer(file_buf));
+ QImage backImage;
+ backImage.loadFromData(file_buf);
for(int i=0; i<num; i++) {
ThemeElement titem = items.at(i);
+<<<<<<< Updated upstream
- CardItem* item = new CardItem(backRenderer, cardsParent, scene(), m_media);
+ CardItem* item = new CardItem(backRenderer, cardsParent, m_media);
item->setData(0, i);
if(type == CARD_LOGIC || type == CARD_SOUNDLOGIC) {
item->setType(CARD_LOGIC, titem.value(theme->mainType(), language), \
theme); } else {
item->setType(theme->mainType(), titem.value(theme->mainType(), \
language), theme); +=======
+ QString file = titem.value(theme->mainType(), language);
+ QImage frontImage;
+ QString text;
+ QByteArray fsound;
+ QByteArray msound;
+ CardType mtype = type;
+ switch(type){
+ case CARD_SOUNDLOGIC:
+ mtype = CARD_LOGIC;
+ case CARD_SOUND:
+ {
+ QString dir = QStandardPaths::locate(QStandardPaths::DataLocation, \
QLatin1String( "gameicons/pairs.svg"), QStandardPaths::LocateDirectory); + \
frontImage.load(dir+"gameicons/sound.svg"); + fsound = \
theme->themeData(file); + } break;
+ case CARD_IMAGE2:
+ case CARD_IMAGE:
+ case CARD_LOGIC:
+ frontImage.loadFromData(theme->themeData(file));
+ break;
+ case CARD_WORD:
+ text = file;
+ break;
+ default:
+ break;
+>>>>>>> Stashed changes
}
-
- CardItem* item1 = new CardItem(backRenderer, cardsParent, scene(), m_media);
- item1->setData(0, i);
-
-// qDebug() << cardType << titem.name[type][language];
-
- item1->setType(type, titem.value(type, language), theme);
- if(type == CARD_LOGIC || type == CARD_SOUNDLOGIC) {
- item->setDuration(0);
- item1->setDuration(0);
- }
-
- item->setFoundSound(theme->themeData(titem.foundSound(language)));
- item1->setFoundSound(theme->themeData(titem.foundSound(language)));
- connect(item, SIGNAL(selected(CardItem*)), SLOT(cardSelected(CardItem*)));
- connect(item1, SIGNAL(selected(CardItem*)), SLOT(cardSelected(CardItem*)));
- cards += item;
- cards += item1;
-
+ if(type == CARD_LOGIC || type == CARD_SOUNDLOGIC) {}
+ m_cards->addCard(new CardItem(cardsParent, frontImage, backImage, text, "", \
fsound, msound, mtype, i)); + m_cards->addCard(new CardItem(cardsParent, \
frontImage, backImage, text, "", fsound, msound, mtype, i)); }
-
- while(!cards.isEmpty())
- m_cards += cards.takeAt(KRandom::random()%cards.size());
-
- if(num % 2 == 0)
- setRowSize(qMax(4, num/2));
- else
- setRowSize((2*num)/3);
-
-
- QObject* cardsContext=rootObject()->findChild<QObject*>("board");
- Q_ASSERT(cardsContext);
- cardsContext->setProperty("isGameOver", QVariant(false));
-
- m_currentPlayer=-1;
- for(int i=0; i<m_players->rowCount(); i++) {
- if(m_players->player(i)->isSelected()) {
- m_currentPlayer = i;
- break;
- }
- }
- emit currentPlayerChanged();
-
- Q_ASSERT(m_currentPlayer>=0 && "some player must be selected first");
- m_timer->start(1000);
}
+<<<<<<< Updated upstream
void PairsView::checkGameOver()
{
if(isGameOver()) {
@@ -256,15 +189,18 @@ void PairsView::stopGame()
{
m_timer->stop();
}
+=======
+>>>>>>> Stashed changes
void PairsView::download()
{
if(!m_knsDialog)
- m_knsDialog=new KNS3::DownloadDialog("pairs.knsrc", this);
+ m_knsDialog=new KNS3::DownloadDialog("pairs.knsrc", 0);
m_knsDialog->show();
}
+<<<<<<< Updated upstream
void PairsView::resizeEvent(QResizeEvent* ev)
{
QQuickView::resizeEvent(ev);
@@ -307,7 +243,11 @@ void PairsView::reorganizeCards(bool starting)
i++;
}
}
+=======
+>>>>>>> Stashed changes
+
+/*
void PairsView::playSound(const QByteArray& sound) const
{
QBuffer* b = new QBuffer;
@@ -321,3 +261,4 @@ void PairsView::playSound(const QByteArray& sound) const
}
connect(m_media, SIGNAL(finished()), b, SLOT(deleteLater()));
}
+*/
diff --git a/game/pairsview.h b/game/pairsview.h
index 3295da0..2221e5c 100644
--- a/game/pairsview.h
+++ b/game/pairsview.h
@@ -27,69 +27,58 @@
#include <QQuickView>
+
namespace KNS3 { class DownloadDialog; }
namespace Phonon { class MediaObject;}
class PlayersModel;
class ThemesModel;
class PairsTheme;
-class CardItem;
+class CardModel;
class QQmlEngine;
class ThemeIconsProvider;
class PairsView : public QQuickView
{
Q_OBJECT
- Q_PROPERTY(int currentPlayer READ currentPlayer NOTIFY currentPlayerChanged)
public:
/**
* Default constructor
*/
- PairsView(QWindow *parent, QQmlEngine *pengine, const QString &file = "");
+ PairsView(QWidget *parent, const QString &file = "");
/**
* Destructor
*/
virtual ~PairsView();
- bool isGameOver() const;
- void setRowSize(int itemsPerRow);
- int cardsNum();
- void newGame(const PairsTheme* theme, const QString& language, const QString& \
cardType); PlayersModel* playersModel() const { return m_players; }
void setLanguage(const QString &l) { m_language = l; }
int currentPlayer() const { return m_currentPlayer; }
Q_SCRIPTABLE void newGame(int row, const QString& cardType);
Q_SCRIPTABLE QString language(){return m_language;};
+<<<<<<< Updated upstream
-// virtual void resizeEvent(QResizeEvent* ev);
+ virtual void resizeEvent(QResizeEvent* ev);
signals:
void gameOver();
void currentPlayerChanged();
+=======
+
+>>>>>>> Stashed changes
public slots:
- void checkGameOver();
void download();
- void cardSelected(CardItem* cardData);
- void stopGame();
-
-private slots:
- void update();
- void reorganizeCards(bool starting=false);
-
+
private:
- void playSound(const QByteArray& sound) const;
-
+ void newGame(const PairsTheme* theme, const QString& language, const QString& \
cardType); +// void playSound(const QByteArray& sound) const;
ThemesModel* m_model;
- CardItem* m_last;
- QList<CardItem*> m_cards;
+ CardModel* m_cards;
ThemeIconsProvider *m_themeImagesProvider;
KNS3::DownloadDialog *m_knsDialog;
PlayersModel* m_players;
int m_currentPlayer;
- QTimer *m_timer;
- int m_itemsPerRow;
- QTimer* m_resizeTimer;
QString m_language;
Phonon::MediaObject *m_media;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic