[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kde4/playground/games/crossedwords/src
From: Pino Toscano <toscano.pino () tiscali ! it>
Date: 2005-09-30 21:31:31
Message-ID: 1128115891.918692.27028.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 465805 by pino:
* block the drop in the board when it's not the turn
* fix a crash in the tile widget (why does it happened? boh!)
M +5 -0 boardwidget.cpp
M +3 -0 boardwidget.h
M +1 -1 crossedwords.cpp
M +4 -7 tilewidget.cpp
M +0 -3 tilewidget.h
--- branches/work/kde4/playground/games/crossedwords/src/boardwidget.cpp \
#465804:465805 @@ -128,6 +128,11 @@
}
}
+void boardWidget::nextPlayer(const QString &, bool isItMe)
+{
+ setAcceptDrops(isItMe);
+}
+
void boardWidget::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
--- branches/work/kde4/playground/games/crossedwords/src/boardwidget.h #465804:465805
@@ -27,6 +27,9 @@
void removeDroppedTile();
+ public slots:
+ void nextPlayer(const QString &nick, bool isItMe);
+
signals:
void tileSizeChanged(double);
--- branches/work/kde4/playground/games/crossedwords/src/crossedwords.cpp \
#465804:465805 @@ -153,7 +153,7 @@
connect(m_client, SIGNAL(startGame()), this, SLOT(startGame()));
connect(m_client, SIGNAL(newTile(tile *)), m_tileWidget, SLOT(addTile(tile *)));
connect(m_client, SIGNAL(nextPlayer(const QString &, bool)), m_chatWidget, \
SLOT(nextPlayer(const QString &, bool)));
- connect(m_client, SIGNAL(nextPlayer(const QString &, bool)), m_tileWidget, \
SLOT(nextPlayer(const QString &, bool))); + connect(m_client, \
SIGNAL(nextPlayer(const QString &, bool)), m_board, SLOT(nextPlayer(const QString &, \
bool))); m_client->tryConnect();
}
}
--- branches/work/kde4/playground/games/crossedwords/src/tilewidget.cpp \
#465804:465805 @@ -29,7 +29,7 @@
#include "boardwidget.h"
#include "utils.h"
-tileWidget::tileWidget(QWidget *parent) : QWidget(parent), m_canDrag(false)
+tileWidget::tileWidget(QWidget *parent) : QWidget(parent)
{
m_tiles.reserve(7);
for (int i = 0; i < m_tiles.capacity(); i++)
@@ -88,11 +88,6 @@
update();
}
-void tileWidget::nextPlayer(const QString &, bool isItMe)
-{
- m_canDrag = isItMe;
-}
-
void tileWidget::insertAndShift(tile *t, int pos, int oldpos)
{
if (!(Utils::checkRange(pos, 0, m_tiles.size()) || Utils::checkRange(oldpos, 0, \
m_tiles.size()))) return; @@ -142,8 +137,10 @@
if ((e->pos() - m_startdrag).manhattanLength() < QApplication::startDragDistance()) \
return;
int tmp = Utils::calcMousePositionInt(m_startdrag.x(), m_tileSize);
+ if (!Utils::checkRange(tmp, 0, m_tiles.size())) return;
+
tile *t = m_tiles.at(tmp);
- if (t && m_canDrag)
+ if (t)
{
QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData;
--- branches/work/kde4/playground/games/crossedwords/src/tilewidget.h #465804:465805
@@ -36,8 +36,6 @@
void addTile(tile *t);
- void nextPlayer(const QString &nick, bool isItMe);
-
protected:
virtual void paintEvent(QPaintEvent *event);
@@ -54,7 +52,6 @@
double m_tileSize;
QPoint m_startdrag;
int m_oldDragIndex;
- bool m_canDrag;
};
#endif
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic