[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [pairs/stack3457] game: removed trailing spaces from Qt code
From: Heena Mahour <heena393 () gmail ! com>
Date: 2014-07-01 11:44:54
Message-ID: E1X1wUY-0004ug-63 () scm ! kde ! org
[Download RAW message or body]
Git commit 07c40a71f259adde003421e5ef3759b26df3383e by Heena Mahour.
Committed on 01/07/2014 at 11:17.
Pushed by heenamahour into branch 'stack3457'.
removed trailing spaces from Qt code
M +8 -8 game/carditem.cpp
M +1 -6 game/carditem.h
M +0 -2 game/cardtype.h
M +1 -1 game/main.cpp
M +1 -1 game/pairs.cpp
M +2 -2 game/pairs.h
M +2 -2 game/pairstheme.cpp
M +4 -4 game/pairsthemebase.cpp
M +4 -4 game/pairsthemebase.h
M +15 -16 game/pairsview.cpp
M +6 -6 game/pairsview.h
M +3 -3 game/playersmodel.cpp
M +4 -4 game/playersmodel.h
M +1 -2 game/themesmodel.cpp
M +2 -2 game/themesmodel.h
http://commits.kde.org/pairs/07c40a71f259adde003421e5ef3759b26df3383e
diff --git a/game/carditem.cpp b/game/carditem.cpp
index 6237fe4..76e95e3 100644
--- a/game/carditem.cpp
+++ b/game/carditem.cpp
@@ -46,20 +46,20 @@ CardItem::CardItem(const QSharedPointer<QSvgRenderer>& back, \
QGraphicsItem* pare
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);
@@ -88,13 +88,13 @@ 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) {
@@ -106,7 +106,7 @@ void CardItem::setSize(const QSizeF& newSize)
QPainter pixPainter(&m_color);
m_frontRenderer->render(&pixPainter);
}
-
+
if(m_type == CARD_LOGIC || m_type == CARD_SOUNDLOGIC)
{
setPixmap(m_color);
@@ -163,7 +163,7 @@ void CardItem::turn()
{
disconnect(m_media, SIGNAL(finished()), this, SLOT(turn()));
m_activated=!m_activated;
-
+
m_animation->start();
}
@@ -196,7 +196,7 @@ void CardItem::changeValue()
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()));
diff --git a/game/carditem.h b/game/carditem.h
index 83469a8..d58cf13 100644
--- a/game/carditem.h
+++ b/game/carditem.h
@@ -44,7 +44,6 @@ class CardItem
public:
CardItem(const QSharedPointer<QSvgRenderer>& back, QGraphicsItem* parent, \
QGraphicsScene* scene = 0, Phonon::MediaObject *media = 0); virtual ~CardItem();
-
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent*) {}
void setCardPixmap(const QSharedPointer<QSvgRenderer>& renderer);
@@ -56,21 +55,17 @@ class CardItem
void setFoundSound(const QByteArray & found);
QByteArray foundSound() const;
QByteArray missedSound() const;
-
+
public slots:
void changeValue();
void turn();
void emitSelected();
-
-
signals:
void selected(CardItem* data);
-
private:
QPropertyAnimation* m_animation;
QPropertyAnimation* m_animationBack;
-
CardType m_type;
bool m_activated;
QPixmap m_color;
diff --git a/game/cardtype.h b/game/cardtype.h
index b5263a2..d3c4762 100644
--- a/game/cardtype.h
+++ b/game/cardtype.h
@@ -25,14 +25,12 @@
enum CardType {
CARD_NONE = 0,
-
CARD_IMAGE,
CARD_IMAGE2,
CARD_SOUND,
CARD_WORD,
CARD_LOGIC,
CARD_SOUNDLOGIC,
-
CARD_MAX_TYPE,
CARD_FOUND
diff --git a/game/main.cpp b/game/main.cpp
index 03b562f..fde1335 100644
--- a/game/main.cpp
+++ b/game/main.cpp
@@ -54,7 +54,7 @@ int main(int argc, char **argv)
KCmdLineArgs::addCmdLineOptions(options); //new
KApplication app;
-
+
// see if we are starting with session management
if (app.isSessionRestored())
{
diff --git a/game/pairs.cpp b/game/pairs.cpp
index 64f7ef1..52672b6 100644
--- a/game/pairs.cpp
+++ b/game/pairs.cpp
@@ -49,7 +49,7 @@ Pairs::Pairs(const QString &file)
setWindowIcon(KIcon("pairs"));
setWindowTitle(qAppName());
setCentralWidget(m_view);
-
+
setAutoSaveSettings();
}
diff --git a/game/pairs.h b/game/pairs.h
index e394a73..3468ee8 100644
--- a/game/pairs.h
+++ b/game/pairs.h
@@ -48,9 +48,9 @@ public:
*/
virtual ~Pairs();
PairsView* view() const { return m_view; }
-
+
virtual QSize sizeHint() const { return QSize(800,500); }
-
+
private:
PairsView *m_view;
QString m_right;
diff --git a/game/pairstheme.cpp b/game/pairstheme.cpp
index 883a9c4..65377ff 100644
--- a/game/pairstheme.cpp
+++ b/game/pairstheme.cpp
@@ -38,7 +38,7 @@ PairsTheme::PairsTheme(const QString& path)
files = files.filter(QRegExp("*.game", Qt::CaseSensitive, QRegExp::Wildcard));
Q_ASSERT(files.count()>=1 && "no games in the theme!");
-
+
QString themename(files.first()); //TODO: Support many games inside a theme
Q_ASSERT(m_archive.directory()->entry(themename)->isFile());
const KArchiveFile* file = static_cast<const \
KArchiveFile*>(m_archive.directory()->entry(themename)); @@ -81,7 +81,7 @@ QByteArray \
PairsTheme::themeData(const QString& path) const const KArchiveEntry* entry = \
m_archive.directory()->entry(path); if(!entry || !entry->isFile())
return QByteArray();
-
+
return static_cast<const KArchiveFile*>(entry)->data();
}
diff --git a/game/pairsthemebase.cpp b/game/pairsthemebase.cpp
index 9f5f66b..c56d967 100644
--- a/game/pairsthemebase.cpp
+++ b/game/pairsthemebase.cpp
@@ -132,7 +132,7 @@ void PairsThemeBase::parseElement(QXmlStreamReader &reader)
common[i].clear();
// qDebug() << "ITEM" << item.name[i] << "/ITEM";
}
-
+
// qDebug() << "CTYPES" << m_cardtypes << "/CTYPES";
// qDebug() << item.foundSound("en");
m_items += item;
@@ -143,10 +143,10 @@ void PairsThemeBase::parseElement(QXmlStreamReader &reader)
QString lang = reader.attributes().hasAttribute("lang") ? \
reader.attributes().value("lang").toString() : "any"; QString src = "";
m_languages.insert(lang);
-
+
if(name != "element") {
m_cardtypes[lang].insert(name);
-
+
current_type = cardNameToType(name);
if(current_type != CARD_WORD)
src = reader.attributes().value("src").toString();
@@ -190,7 +190,7 @@ void PairsThemeBase::parseElement(QXmlStreamReader &reader)
item.name[current_type][lang] = src;
break;
}
-
+
if(current_type == m_main_type) {
common[current_type] = src;
//common[CARD_LOGIC] = src;
diff --git a/game/pairsthemebase.h b/game/pairsthemebase.h
index aafc5c7..9745c6c 100644
--- a/game/pairsthemebase.h
+++ b/game/pairsthemebase.h
@@ -37,12 +37,12 @@ public:
QMap<QString, QString> name[CARD_MAX_TYPE];
QMap<QString, QString> found;
ThemeElement(){ reset(); };
-
+
void reset() {
for(int i = 0; i < CARD_MAX_TYPE; i++) name[i].clear();
found.clear();
};
-
+
QString value(CardType type, const QString& language) const;
QStringList langlist(CardType type) const;
QStringList foundLanglist() const;
@@ -78,7 +78,7 @@ class PairsThemeBase : public QObject, public QStandardItem
virtual QStringList images() const = 0;
virtual bool hasFile(const QString& path) const = 0;
virtual QString path() const = 0;
-
+
protected:
void parse(QXmlStreamReader &reader);
void parseElement(QXmlStreamReader &reader);
@@ -100,7 +100,7 @@ class PairsThemeBase : public QObject, public QStandardItem
CardType m_main_type;
QList<ThemeElement> m_items;
-
+
QString m_error;
QSet<QString> m_languages;
QMap<QString, QSet<QString> > m_cardtypes;
diff --git a/game/pairsview.cpp b/game/pairsview.cpp
index f6ce583..815a9dc 100644
--- a/game/pairsview.cpp
+++ b/game/pairsview.cpp
@@ -63,20 +63,20 @@ PairsView::PairsView(QWidget *parent, const QString &file)
// #ifndef QT_NO_OPENGL
// setViewport(new QGLWidget);
// #endif
-
+
m_model = new ThemesModel(this, file);
m_players = new PlayersModel(this);
m_themeImagesProvider = new \
ThemeIconsProvider(QDeclarativeImageProvider::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);
-
+
rootContext()->setContextProperty("fgame", this);
rootContext()->setContextProperty("themesModel", m_model);
rootContext()->setContextProperty("playersModel", m_players);
@@ -92,12 +92,12 @@ PairsView::PairsView(QWidget *parent, 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);
Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::GameCategory, \
this); createPath(m_media, audioOutput);
@@ -128,7 +128,7 @@ void PairsView::update()
void PairsView::cardSelected(CardItem* card)
{
Q_ASSERT(card);
-
+
if(m_last) {
if(m_last->data(0)==card->data(0)) {
m_last->markDone();
@@ -141,7 +141,7 @@ void PairsView::cardSelected(CardItem* card)
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();
@@ -167,11 +167,11 @@ void PairsView::newGame(const PairsTheme* theme, const QString& \
language, const m_last = 0;
m_cards.clear();
QList<CardItem*> cards;
-
+
QDeclarativeItem* \
cardsParent=rootObject()->findChild<QDeclarativeItem*>("board"); \
playersModel()->resetPlayers(); Q_ASSERT(cardsParent);
-
+
QList<ThemeElement> items = theme->items();
//int num=qMin(((rows*columns)/2)*2, items.size()); //we make it %2
int num = items.size();
@@ -218,16 +218,15 @@ void PairsView::newGame(const PairsTheme* theme, const QString& \
language, const cards += item1;
}
-
+
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));
diff --git a/game/pairsview.h b/game/pairsview.h
index 69fa294..ae48716 100644
--- a/game/pairsview.h
+++ b/game/pairsview.h
@@ -49,7 +49,7 @@ public:
* Destructor
*/
virtual ~PairsView();
-
+
bool isGameOver() const;
void setRowSize(int itemsPerRow);
int cardsNum();
@@ -57,7 +57,7 @@ public:
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;};
@@ -65,20 +65,20 @@ public:
signals:
void gameOver();
void currentPlayerChanged();
-
+
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;
-
+
ThemesModel* m_model;
CardItem* m_last;
QList<CardItem*> m_cards;
diff --git a/game/playersmodel.cpp b/game/playersmodel.cpp
index f48d88e..743cbd9 100644
--- a/game/playersmodel.cpp
+++ b/game/playersmodel.cpp
@@ -52,13 +52,13 @@ PlayersModel::PlayersModel(QObject* parent)
PlayersModel::~PlayersModel()
{
QStringList players, icons;
-
+
for (int i = 0; i < rowCount(); ++i) {
PairsPlayer* p=player(i);
players += p->text();
icons += p->data(Qt::DecorationRole).toString();
}
-
+
KConfig config;
KConfigGroup group(&config, "NewGame");
group.writeEntry("Players", players);
@@ -87,7 +87,7 @@ void PlayersModel::refresh()
QString icon = icons[i];
if(!m_playerIcons.contains(icon))
icon = randomIcon();
-
+
addPlayer(name, icon);
i++;
}
diff --git a/game/playersmodel.h b/game/playersmodel.h
index 27abb7b..23c4cd1 100644
--- a/game/playersmodel.h
+++ b/game/playersmodel.h
@@ -38,15 +38,15 @@ class PlayersModel : public QStandardItemModel
Time,
Selected
};
-
+
explicit PlayersModel(QObject* parent);
virtual ~PlayersModel();
-
+
PairsPlayer* player(int row);
Q_SCRIPTABLE void addPlayer(const QString& player, const QString& \
decoration); Q_SCRIPTABLE void removePlayer(int index);
void resetPlayers();
-
+
public slots:
QVariant info(int row, const QByteArray& role);
void toggleSelection(int row);
@@ -56,7 +56,7 @@ class PlayersModel : public QStandardItemModel
private slots:
void refresh();
-
+
private:
QStringList m_playerIcons;
};
diff --git a/game/themesmodel.cpp b/game/themesmodel.cpp
index 614c12e..416ac12 100644
--- a/game/themesmodel.cpp
+++ b/game/themesmodel.cpp
@@ -147,11 +147,10 @@ bool ThemesModel::exists(const QString& id)
QByteArray ThemesModel::themeData(const QString& id) const
{
int firstSlash = id.indexOf('/');
-
+
const PairsTheme *theme = 0;
if(firstSlash>=0)
theme = themeForName(id.left(firstSlash));
-
if(!theme)
return QByteArray();
diff --git a/game/themesmodel.h b/game/themesmodel.h
index 66e9d72..ec7ae07 100644
--- a/game/themesmodel.h
+++ b/game/themesmodel.h
@@ -41,10 +41,10 @@ class ThemesModel : public QStandardItemModel
public slots:
QVariant info(int row, const QByteArray& role);
bool isPertinent(int row, const QString &type,const QString &lang);
-
+
/** @returns a random image from any theme */
QString randomThemesImage() const;
-
+
private slots:
void reload();
private:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic