void Grandf::deal( const QList<KCard*> & cardsToDeal ) { setKeyboardModeActive( false ); QList<KCard*> cards = cardsToDeal; QPointF initPos( 1.4 * 3 * deck()->cardWidth(), 1.2 * deck()->cardHeight() ); int start = 0; int stop = 7-1; int dir = 1; for (int round=0; round < 7; round++) { int i = start; do { if (!cards.isEmpty()) addCardForDeal( store[i], cards.takeLast(), (i == start), initPos ); i += dir; } while ( i != stop + dir); int t = start; start = stop; stop = t+dir; dir = -dir; } int i = 0; while (!cards.isEmpty()) { addCardForDeal( store[i+1], cards.takeLast(), true, initPos ); i = (i+1)%6; } for (int round=0; round < 7; round++) { KCard *c = store[round]->topCard(); if (c) c->setFaceUp(true); } startDealAnimation(); }
void Spider::setSuits(int suits) { if ( suits != m_suits ) { m_suits = suits; stopDemo(); clearHighlightedItems(); setKeyboardModeActive( false ); int cardWidth = deck()->cardWidth(); createDeck(); deck()->setCardWidth( cardWidth ); Settings::setSpiderSuitCount( m_suits ); if ( m_suits == 1 ) options->setCurrentItem( 0 ); else if ( m_suits == 2 ) options->setCurrentItem( 1 ); else options->setCurrentItem( 2 ); } }