[Kde-games-devel] KDE/kdegames
Andreas Pakulat
apaku at gmx.de
Sun Dec 23 13:06:15 CET 2007
SVN commit 752043 by apaku:
I totally forgot about this change. Use the KCardDialog config entries so
config-reading/writing is not duplicated in each card game with different key
names.
CCMAIL:kde-games-devel at kde.org
M +1 -1 kpat/cardmaps.cpp
M +19 -4 kpat/pwidget.cpp
M +12 -9 lskat/src/mainwindow.cpp
--- trunk/KDE/kdegames/kpat/cardmaps.cpp #752042:752043
@@ -239,7 +239,7 @@
d->m_thread->finish();
d->m_thread->reset();
- QString theme = cs.readEntry( "Theme", "Oxygen-white (SVG)" );
+ QString theme = cs.readEntry( "Cardname", "Oxygen-white (SVG)" );
d->m_cardDeck = KCardDialog::cardDir(theme);
if( d->m_cardDeck.isEmpty() )
--- trunk/KDE/kdegames/kpat/pwidget.cpp #752042:752043
@@ -240,15 +240,30 @@
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup cs(config, settings_group);
QString deckName, oldDeckName, dummy;
- deckName = oldDeckName = cs.readEntry("Theme");
+ deckName = oldDeckName = cs.readEntry("Cardname");
- int result = KCardDialog::getCardDeck(deckName, dummy, this, true, false);
+ // This makes sure that the dialog doesn't allow to change to non-svg themes
+ // or change the back. The latter is unsupported in kpat in KDE 4.0 and the
+ // former seems to be not wanted by the author.
+ // This should be removed for KDE4.1, when kpat starts to support changing
+ // the backside and the dialog gets a bit more API
+ // apaku at gmx.de
+ cs.writeEntry("AllowFixed", false);
+ cs.writeEntry("AllowScaled", true);
+ cs.writeEntry("ShowFixedOnly", false);
+ cs.writeEntry("ShowScaledOnly", true);
+ cs.writeEntry("Locking", true);
+
+ KCardDialog dlg(cs);
+ int result = dlg.exec();
if (result == QDialog::Accepted)
{
+ // Always store the settings, as other things than only the deck may
+ // have changed
+ dlg.saveSettings(cs);
+ cs.sync();
if (deckName != oldDeckName) {
- cs.writeEntry("Theme", deckName);
-
cardMap::self()->updateTheme(cs);
cardMap::self()->triggerRescale();
}
--- trunk/KDE/kdegames/lskat/src/mainwindow.cpp #752042:752043
@@ -251,8 +251,6 @@
// Program data
KConfigGroup cfg = config->group("ProgramData");
- cfg.writeEntry("cards", mCardDir);
- cfg.writeEntry("deck", mDeckGrafix);
cfg.writeEntry("startplayer", mStartPlayer);
cfg.writeEntry("ThemeIndexNo", mThemeIndexNo);
@@ -279,8 +277,8 @@
QString dd = KCardDialog::defaultDeckName();
// Read card path
- mCardDir = cfg.readEntry("cards", dcd);
- mDeckGrafix = cfg.readEntry("deck", dd);
+ mCardDir = cfg.readEntry("Cardname", dcd);
+ mDeckGrafix = cfg.readEntry("Deckname", dd);
// Check for path existence
QFile file(KCardDialog::deckFilename(mDeckGrafix));
@@ -545,19 +543,24 @@
QString back = mDeckGrafix;
int result;
- result=KCardDialog::getCardDeck(front, back, this, true, true, false, false);
+ KConfigGroup grp = KGlobal::config()->group("ProgramData");
+ KCardDialog dlg(grp);
+ result=dlg.exec();
if (result==QDialog::Accepted)
{
+ // Always store the settings, other things than the deck may have changed
+ dlg.saveSettings(grp);
+ grp.sync();
if (global_debug > 0) kDebug() << "NEW CARDDECK:" << front << "and" << back;
bool change = false; // Avoid unnecessary changes
- if (!back.isEmpty() && back != mDeckGrafix)
+ if (!dlg.deckName().isEmpty() && dlg.deckName() != mDeckGrafix)
{
- mDeckGrafix = back;
+ mDeckGrafix = dlg.deckName();
change = true;
}
- if (!front.isEmpty() && front != mCardDir)
+ if (!dlg.cardName().isEmpty() && dlg.cardName() != mCardDir)
{
- mCardDir = front;
+ mCardDir = dlg.cardName();
change = true;
}
if (change)
More information about the kde-games-devel
mailing list