libkdegames
kcarddialog.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __KCARDDIALOG_H_
00019 #define __KCARDDIALOG_H_
00020
00021 #include <kdialog.h>
00022 #include <kconfig.h>
00023
00024 #include <libkdegames_export.h>
00025
00026 class QListWidgetItem;
00027 class KCardDialogPrivate;
00028
00092 class KDEGAMES_EXPORT KCardDialog : public KDialog
00093 {
00094 Q_OBJECT
00095
00096 public:
00097
00108 explicit KCardDialog (QWidget* parent = NULL,
00109 bool pAllowSVG = true,
00110 bool pAllowPNG = true,
00111 bool pLock = true,
00112 QString defFront = QString(),
00113 QString defBack = QString()
00114 );
00115
00122 explicit KCardDialog (KConfigGroup& group, QWidget* parent = NULL);
00123
00127 ~KCardDialog();
00128
00147 static int getCardDeck(QString &pFrontName,
00148 QString &pBackName,
00149 QWidget *pParent = NULL,
00150 bool pAllowSVG = true,
00151 bool pAllowPNG = true,
00152 bool pLock = true,
00153 bool pRandom = false);
00154
00159 void saveSettings(KConfigGroup& group);
00160
00165 static QString deckSVGFilePath(const QString& name);
00166
00174 static QString cardSVGFilePath(const QString& name);
00175
00180 static bool isSVGCard(const QString& name);
00181
00186 static bool isSVGDeck(const QString& name);
00187
00193 static QString defaultCardName(bool pAllowSVG = true, bool pAllowPNG = true);
00194
00200 static QString defaultDeckName(bool pAllowSVG = true, bool pAllowPNG = true);
00201
00207 static QString randomCardName(bool pAllowSVG = true, bool pAllowPNG = true);
00208
00214 static QString randomDeckName(bool pAllowSVG = true, bool pAllowPNG = true);
00215
00222 static QString cardDir(const QString& name);
00223
00230 static QString deckFilename(const QString& name);
00231
00236 QString deckName() const;
00237
00242 QString cardName() const;
00243
00249 static void reset();
00250
00255 static QString getDefaultCardDir(bool pAllowSVG = true, bool pAllowPNG = true);
00256
00261 static QString getDefaultDeck(bool pAllowSVG = true, bool pAllowPNG = true);
00262
00263
00264 protected:
00268 static void readFronts();
00269
00273 static void readBacks();
00274
00278 void insertCardIcons();
00279
00283 void insertDeckIcons();
00284
00289 void updateBack(QString item);
00290
00295 void updateFront(QString item);
00296
00300 void setupGUI();
00301
00308 static QString findi18nBack(QString& name);
00309
00315 static QString getDeckFileNameFromIndex(const QString& desktop);
00316
00320 static QString group();
00321
00322 protected Q_SLOTS:
00326 void updateFront();
00327
00333 void updateBack();
00334
00339 void updateLocking(int state);
00340
00345 void updateSVG(int state);
00346 void updatePNG(int state);
00351
00352 private:
00356 static void init();
00357
00361 KCardDialogPrivate* const d;
00362 };
00363
00364 #endif