~ubuntu-branches/ubuntu/karmic/kdegames/karmic

« back to all changes in this revision

Viewing changes to kpat/card.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-06-05 06:55:55 UTC
  • mfrom: (1.2.28 upstream)
  • Revision ID: james.westby@ubuntu.com-20090605065555-jpumbtj5mqszt8pi
Tags: 4:4.2.90-0ubuntu1~ppa1
* New upstream release
  - Bump kdelibs5-dev to 4.2.90
  - Remove debian/patches fixed by upstream, drop quilt from build-deps
* Update kblocks.install, kdiamond.install, ksirk.install, kblocks.install

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
*******************************************************/
20
20
 
21
21
#include "card.h"
22
 
#include "pile.h"
 
22
 
23
23
#include "cardmaps.h"
24
24
#include "dealer.h"
 
25
#include "pile.h"
 
26
 
 
27
#include <KDebug>
 
28
 
 
29
#include <QtCore/QTimeLine>
 
30
#include <QtGui/QGraphicsItemAnimation>
 
31
#include <QtGui/QGraphicsSceneMouseEvent>
 
32
#include <QtGui/QPainter>
 
33
#include <QtGui/QPixmap>
 
34
#include <QtGui/QStyleOptionGraphicsItem>
25
35
 
26
36
#include <cmath>
27
 
#include <cassert>
28
 
 
29
 
#include <QPainter>
30
 
//Added by qt3to4:
31
 
#include <QPixmap>
32
 
#include <QBrush>
33
 
#include <QTimeLine>
34
 
#include <QGraphicsItemAnimation>
35
 
#include <QGraphicsSceneMouseEvent>
36
 
#include <QStyleOptionGraphicsItem>
37
 
#include <QGraphicsSvgItem>
38
 
#include <QPixmapCache>
39
 
 
40
 
#include <kdebug.h>
 
37
 
41
38
 
42
39
AbstractCard::AbstractCard( Rank r, Suit s )
43
40
    : m_suit( s ), m_rank( r ), m_faceup( false )
199
196
//
200
197
void Card::moveTo(qreal x2, qreal y2, qreal z2, int duration)
201
198
{
202
 
 
203
199
    //kDebug(11111) << "Card::moveTo" << x2 << " " << y2 << " " << duration << " " << kBacktrace();
204
200
    if ( fabs( x2 - x() ) < 2 && fabs( y2 - y() ) < 1 )
205
201
    {
226
222
    timeLine->setDuration( duration );
227
223
    timeLine->start();
228
224
 
229
 
    connect( timeLine, SIGNAL( finished() ), SLOT( stopAnimation() ) );
 
225
    connect( timeLine, SIGNAL(finished()), SLOT(stopAnimation()) );
230
226
 
231
227
    m_destX = x2;
232
228
    m_destY = y2;
272
268
    timeLine->setDuration( duration );
273
269
    timeLine->start();
274
270
 
275
 
    connect( timeLine, SIGNAL( finished() ), SLOT( stopAnimation() ) );
276
 
    connect( timeLine, SIGNAL( valueChanged( qreal ) ), SLOT( flipAnimationChanged( qreal ) ) );
 
271
    connect( timeLine, SIGNAL(finished()), SLOT(stopAnimation()) );
 
272
    connect( timeLine, SIGNAL(valueChanged(qreal)), SLOT(flipAnimationChanged(qreal)) );
277
273
 
278
274
    // Set the target of the animation
279
275
    m_destX = x2;
291
287
{
292
288
    if ( r > 0.5 && !isFaceUp() ) {
293
289
        flip();
294
 
        assert( m_destFace == m_faceup );
 
290
        Q_ASSERT( m_destFace == m_faceup );
295
291
    }
296
292
}
297
293
 
353
349
        setSpread( source()->cardOffset(this) );
354
350
 
355
351
    m_isSeen = Unknown;
356
 
    emit stoped( this );
 
352
    emit stopped( this );
357
353
}
358
354
 
359
355
bool  Card::animated() const
439
435
    timeLine->setDuration( 1500 );
440
436
    timeLine->start();
441
437
 
442
 
    connect( timeLine, SIGNAL( finished() ), SLOT( stopAnimation() ) );
 
438
    connect( timeLine, SIGNAL(finished()), SLOT(stopAnimation()) );
443
439
 
444
440
    m_destZ = zValue();
445
441
    m_destX = x();
528
524
 
529
525
    QTimeLine *timeLine = new QTimeLine( t, this );
530
526
    m_originalPosition = pos();
 
527
 
531
528
    animation = new QGraphicsItemAnimation( this );
532
529
    animation->setItem( this );
533
530
    animation->setTimeLine( timeLine );
547
544
 
548
545
    m_isZoomed = true;
549
546
 
550
 
    connect( timeLine, SIGNAL( finished() ), SLOT( stopAnimation() ) );
 
547
    connect( timeLine, SIGNAL(finished()), SLOT(stopAnimation()) );
551
548
 
552
549
    m_destZ = zValue();
553
550
    m_destX = dest.x();
578
575
 
579
576
    m_isZoomed = false;
580
577
 
581
 
    connect( timeLine, SIGNAL( finished() ), SLOT( stopAnimation() ) );
 
578
    connect( timeLine, SIGNAL(finished()), SLOT(stopAnimation()) );
582
579
 
583
580
    m_destZ = zValue();
584
581
    m_destX = m_originalPosition.x();