diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | c90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch) | |
tree | 6d8391395bce9eaea4ad78958617edb20c6a7573 /ksirtet/ksirtet/field.cpp | |
download | tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksirtet/ksirtet/field.cpp')
-rw-r--r-- | ksirtet/ksirtet/field.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/ksirtet/ksirtet/field.cpp b/ksirtet/ksirtet/field.cpp new file mode 100644 index 00000000..e3384a9e --- /dev/null +++ b/ksirtet/ksirtet/field.cpp @@ -0,0 +1,61 @@ +#include "field.h" +#include "field.moc" + +#include <qwhatsthis.h> + +#include <klocale.h> +#include <kgamelcd.h> + +#include "board.h" +#include "prefs.h" +#include "piece.h" + +//----------------------------------------------------------------------------- +KSField::KSField(QWidget *parent) + : Field(parent) +{ + const Board *b = static_cast<Board *>(board); + QWhatsThis::add(b->giftPool(), i18n("Indicate the number of garbage lines you received from your opponent.")); +} + +void KSField::removedUpdated() +{ + KGameLCD *lcd = static_cast<KGameLCD *>(removedList->lcd(0)); + lcd->displayInt(board->nbRemoved()); + if ( board->nbRemoved() ) lcd->highlight(); + if ( Prefs::showDetailedRemoved() ) { + const KSBoard *ksb = static_cast<const KSBoard *>(board); + for (uint i=0; i<4; i++) { + if ( !(ksb->lastRemoved() & (2<<i)) ) continue; + lcd = static_cast<KGameLCD *>(removedList->lcd(i+1)); + lcd->displayInt(ksb->nbRemovedLines(i)); + if ( ksb->nbRemovedLines(i) ) lcd->highlight(); + } + } +} + +void KSField::settingsChanged() +{ + Field::settingsChanged(); + bool b = Prefs::oldRotationStyle(); + static_cast<KSPieceInfo &>(Piece::info()).setOldRotationStyle(b); + + removedList->clear(); + QWhatsThis::remove(removedList); + KGameLCD *lcd = new KGameLCD(5, removedList); + QString s = (Prefs::showDetailedRemoved() ? i18n("Total:") : QString::null); + removedList->append(s, lcd); + lcd->displayInt( board->nbRemoved() ); + lcd->show(); + + if ( Prefs::showDetailedRemoved() ) { + for (uint i=0; i<4; i++) { + KGameLCD *lcd = new KGameLCD(5, removedList); + QString s = i18n("1 Line:", "%n Lines:", i+1); + removedList->append(s, lcd); + uint nb = static_cast<const KSBoard *>(board)->nbRemovedLines(i); + lcd->displayInt(nb); + lcd->show(); + } + } +} |