#include <kcarddialog.h>

Public Member Functions | |
| KCardDialog (QWidget *parent=NULL, bool pAllowSVG=true, bool pAllowPNG=true, bool pLock=true, QString defFront=QString(), QString defBack=QString()) | |
| Constructs a card deck selection dialog. | |
| KCardDialog (KConfigGroup &group, QWidget *parent=NULL) | |
| Constructs a card deck selection dialog. | |
| ~KCardDialog () | |
| Destructs a card deck selection dialog. | |
| void | saveSettings (KConfigGroup &group) |
| Saves the KCardDialog config into a config file. | |
| QString | backName () const |
| Retrieve the name of the card deck (back side) from the dialog. | |
| QString | frontName () const |
| Retrieve the name of the card set (front side) from the dialog. | |
Static Public Member Functions | |
| static int | getCardDeck (QString &pFrontName, QString &pBackName, QWidget *pParent=NULL, bool pAllowSVG=true, bool pAllowPNG=true, bool pLock=true, bool pRandom=false) |
| Creates a modal carddeck dialog, lets the user choose a deck, and returns when the dialog is closed. | |
| static int | getCardDeck (const KConfigGroup &group) |
| Convenience function, works like the above function. | |
| static QString | getDefaultCardDir (bool pAllowSVG=true, bool pAllowPNG=true) |
| Retreive the default card directory. | |
| static QString | getDefaultDeck (bool pAllowSVG=true, bool pAllowPNG=true) |
| Retrieve the default deck filename. | |
Protected Slots | |
| void | updateFront () |
| Called by the card set list view when a new item was selected. | |
| void | updateBack () |
| Called by the card deck list view when a new item was selected. | |
| void | updateLocking (int state) |
| Called by the checkboxes when the state of the locking changed. | |
| void | updateSVG (int state) |
| Called by the checkboxes when the state of the SVG filter changed. | |
| void | updatePNG (int state) |
| Called by the checkboxes when the state of the PNG filter changed. | |
Protected Member Functions | |
| void | insertCardIcons () |
| void | insertDeckIcons () |
| Insert the back sides into the list view. | |
| void | updateBack (QString item) |
| Update the back side preview image. | |
| void | updateFront (QString item) |
| Update the front side preview image. | |
| void | setupGUI () |
| Configure the dialog GUI. | |
Static Protected Member Functions | |
| static QString | getDeckFileNameFromIndex (const QString &desktop) |
| Retrieve the filename of the PNG file for the backside of a deck. | |
The KCardDialog provides a dialog for interactive carddeck selection. It gives cardgames an easy to use interface to select front and back of the card sets. As card sets the KDE default cardsets are offered as well as used specified ones.
In most cases, the simplest use of this class is the static method KCardDialog::getCardDeck, which pops up the dialog, allows the user to select a carddeck, and returns when the dialog is closed. Only if you really need some specific behaviour or if you overwrite the dialog you need all the other access functions.
Card sets (front and back) are identified by their (translated) names. Access to further properties of the sets like their filenames or directories is achieved by querying the dialog using static functions where as argument the card deck or set name is given as argument.
Example:
QString front,back;
int result = KCardDialog::getCardDeck(front, back);
if ( result == KCardDialog::Accepted )
...
Retrieve the filename and information for the card back (deck):
QString front,back;
int result = KCardDialog::getCardDeck(front, back);
...
QString deckFile = KCardDialog::deckSVGFilePath(back);
bool isSVG = KCardDialog::isSVGDeck(back);
...
Retrieve the SVG information for the card set (front):
QString front,back;
int result = KCardDialog::getCardDeck(front, back);
...
QString cardFile = KCardDialog::cardSVGFilePath(front);
bool isSVG = KCardDialog::isSVGCards(front);
...
Here you can see a card dialog in action
KCarddialog
KCardDialog::getCardDeck takes additionalparameters for custumization. You can e.g. retrieve a random card deck, limit the choice to scalable or fixed size decks, or lock the front and backside together.
You can also provide a KConfigGroup reference to the dialog. This is used to store information about the dialog.
Definition at line 92 of file kcarddialog.h.
| KCardDialog::KCardDialog | ( | QWidget * | parent = NULL, |
|
| bool | pAllowSVG = true, |
|||
| bool | pAllowPNG = true, |
|||
| bool | pLock = true, |
|||
| QString | defFront = QString(), |
|||
| QString | defBack = QString() | |||
| ) | [explicit] |
Constructs a card deck selection dialog.
| parent | The parent widget of the dialog, if any. | |
| pAllowSVG | Allow selection of scalable cards sets. | |
| pAllowPNG | Allow selection of fixed size cards sets. | |
| pLock | Back side is set to match the front side of cards. | |
| defFront | Default front side name. | |
| defBack | Default back side name. |
Definition at line 108 of file kcarddialog.cpp.
References KCardDialogPrivate::allowPNG, KCardDialogPrivate::allowSVG, KCardDialogPrivate::currentBack, KCardDialogPrivate::currentFront, setupGUI(), and KCardDialogPrivate::useLocking.

| KCardDialog::KCardDialog | ( | KConfigGroup & | group, | |
| QWidget * | parent = NULL | |||
| ) | [explicit] |
Constructs a card deck selection dialog.
| group | The configuration group for dialog | |
| parent | The parent widget of the dialog, if any. |
Definition at line 123 of file kcarddialog.cpp.
References KCardDialogPrivate::allowPNG, KCardDialogPrivate::allowSVG, CONF_ALLOW_FIXED_CARDS, CONF_ALLOW_SCALED_CARDS, CONF_CARD, CONF_DECK, CONF_LOCKING, CONF_SHOWONLY_FIXED_CARDS, CONF_SHOWONLY_SCALED_CARDS, KCardDialogPrivate::currentBack, KCardDialogPrivate::currentFront, setupGUI(), KCardDialogPrivate::useLocking, KCardDialogPrivate::usePNGOnly, and KCardDialogPrivate::useSVGOnly.

| KCardDialog::~KCardDialog | ( | ) |
| int KCardDialog::getCardDeck | ( | QString & | pFrontName, | |
| QString & | pBackName, | |||
| QWidget * | pParent = NULL, |
|||
| bool | pAllowSVG = true, |
|||
| bool | pAllowPNG = true, |
|||
| bool | pLock = true, |
|||
| bool | pRandom = false | |||
| ) | [static] |
Creates a modal carddeck dialog, lets the user choose a deck, and returns when the dialog is closed.
| pFrontName | A reference to the card front side name. Holds the result of the user choice. | |
| pBackName | A reference to the card back side name. Holds the result of the user choice. | |
| pParent | Pointer to the parent window of the dialog | |
| pAllowSVG | Allow selection of scalable cards sets. | |
| pAllowPNG | Allow selection of fixed size cards sets. | |
| pLock | Back side is set to match the front side of cards. | |
| pRandom | Return a random selection for front and back side. |
Definition at line 132 of file 1.cpp.
References Ui_KGameCardSelectorBase::backList, Ui_KGameCardSelectorBase::checkBoxLock, Ui_KGameCardSelectorBase::checkBoxPNG, Ui_KGameCardSelectorBase::checkBoxSVG, KCardDialogPrivate::currentCard, KCardDialogPrivate::currentDeck, d, Ui_KGameCardSelectorBase::frontList, insertCardIcons(), insertDeckIcons(), Ui_KGameCardSelectorBase::setupUi(), KCardDialogPrivate::ui, updateBack(), updateFront(), updateLocking(), updatePNG(), updateSVG(), KCardDialogPrivate::useLocking, KCardDialogPrivate::usePNGOnly, and KCardDialogPrivate::useSVGOnly.

| static int KCardDialog::getCardDeck | ( | const KConfigGroup & | group | ) | [static] |
Convenience function, works like the above function.
Creates a modal carddeck dialog, reading the settings from the config group.
| group | the KConfigGroup to read the settings from. |
| void KCardDialog::saveSettings | ( | KConfigGroup & | group | ) |
Saves the KCardDialog config into a config file.
These settings are used by KCardDialog.
Definition at line 140 of file kcarddialog.cpp.
References KCardDialogPrivate::allowPNG, KCardDialogPrivate::allowSVG, CONF_ALLOW_FIXED_CARDS, CONF_ALLOW_SCALED_CARDS, CONF_CARD, CONF_DECK, CONF_LOCKING, CONF_SHOWONLY_FIXED_CARDS, CONF_SHOWONLY_SCALED_CARDS, KCardDialogPrivate::currentBack, KCardDialogPrivate::currentFront, KCardDialogPrivate::useLocking, KCardDialogPrivate::usePNGOnly, and KCardDialogPrivate::useSVGOnly.
| QString KCardDialog::backName | ( | ) | const |
Retrieve the name of the card deck (back side) from the dialog.
Definition at line 261 of file kcarddialog.cpp.
References KCardDialogPrivate::currentBack.
| QString KCardDialog::frontName | ( | ) | const |
Retrieve the name of the card set (front side) from the dialog.
Definition at line 268 of file kcarddialog.cpp.
References KCardDialogPrivate::currentFront.
| QString KCardDialog::getDefaultCardDir | ( | bool | pAllowSVG = true, |
|
| bool | pAllowPNG = true | |||
| ) | [static] |
| QString KCardDialog::getDefaultDeck | ( | bool | pAllowSVG = true, |
|
| bool | pAllowPNG = true | |||
| ) | [static] |
| void KCardDialog::insertCardIcons | ( | ) | [protected] |
Definition at line 314 of file 1.cpp.
References KCardDialogStatic::cardInfo, KCardDialogPrivate::currentCard, KCardDialogPrivate::filterOutCard(), Ui_KGameCardSelectorBase::frontList, KCardInfo::name, KCardInfo::preview, KCardDialogPrivate::ui, updateFront(), KCardDialogPrivate::usePNGOnly, and KCardDialogPrivate::useSVGOnly.
Referenced by getCardDeck(), setupGUI(), updatePNG(), and updateSVG().

| void KCardDialog::insertDeckIcons | ( | ) | [protected] |
Insert the back sides into the list view.
Definition at line 581 of file 1.cpp.
References KCardDialogStatic::deckInfo, KCardInfo::name, KCardInfo::preview, and updateBack().
Referenced by getCardDeck(), setupGUI(), updatePNG(), and updateSVG().
| void KCardDialog::updateBack | ( | QString | item | ) | [protected] |
Update the back side preview image.
| item | The name of the deck. |
Definition at line 561 of file 1.cpp.
References KCardDialogStatic::deckInfo, and KCardInfo::preview.
Referenced by getCardDeck().
| void KCardDialog::updateFront | ( | QString | item | ) | [protected] |
Update the front side preview image.
| item | The name of the card set. |
Definition at line 350 of file 1.cpp.
References KCardInfo::back, Ui_KGameCardSelectorBase::cardDescription, KCardDialogStatic::cardInfo, Ui_KGameCardSelectorBase::cardName, KCardInfo::comment, KCardDialogPrivate::currentCard, Ui_KGameCardSelectorBase::frontPreview, KCardInfo::name, KCardInfo::preview, KCardDialogPrivate::ui, updateBack(), KCardDialogPrivate::useLocking, KCardDialogPrivate::usePNGOnly, and KCardDialogPrivate::useSVGOnly.
Referenced by getCardDeck().
| void KCardDialog::setupGUI | ( | ) | [protected] |
Configure the dialog GUI.
Definition at line 153 of file kcarddialog.cpp.
References KCardDialogPrivate::allowPNG, KCardDialogPrivate::allowSVG, Ui_KGameCardSelectorBase::backList, Ui_KGameCardSelectorBase::checkBoxLock, Ui_KGameCardSelectorBase::checkBoxPNG, Ui_KGameCardSelectorBase::checkBoxSVG, KCardDialogPrivate::currentBack, KCardDialogPrivate::currentFront, CardDeckInfo::defaultBackName(), CardDeckInfo::defaultFrontName(), Ui_KGameCardSelectorBase::frontList, insertCardIcons(), insertDeckIcons(), Ui_KGameCardSelectorBase::setupUi(), KCardDialogPrivate::ui, updateBack(), updateFront(), updateLocking(), updatePNG(), updateSVG(), KCardDialogPrivate::useLocking, KCardDialogPrivate::usePNGOnly, and KCardDialogPrivate::useSVGOnly.
Referenced by KCardDialog().

| QString KCardDialog::getDeckFileNameFromIndex | ( | const QString & | desktop | ) | [static, protected] |
| void KCardDialog::updateFront | ( | ) | [protected, slot] |
Called by the card set list view when a new item was selected.
Definition at line 309 of file kcarddialog.cpp.
References Ui_KGameCardSelectorBase::frontList, and KCardDialogPrivate::ui.
Referenced by getCardDeck(), insertCardIcons(), setupGUI(), and updateLocking().
| void KCardDialog::updateBack | ( | ) | [protected, slot] |
Called by the card deck list view when a new item was selected.
| current | The newly selected item. | |
| last | The previously selected item. |
Definition at line 444 of file kcarddialog.cpp.
References Ui_KGameCardSelectorBase::backList, and KCardDialogPrivate::ui.
Referenced by getCardDeck(), insertDeckIcons(), setupGUI(), and updateFront().
| void KCardDialog::updateLocking | ( | int | state | ) | [protected, slot] |
Called by the checkboxes when the state of the locking changed.
| state | The new locking state. |
Definition at line 496 of file 1.cpp.
References updateFront().
Referenced by getCardDeck(), and setupGUI().
| void KCardDialog::updateSVG | ( | int | state | ) | [protected, slot] |
Called by the checkboxes when the state of the SVG filter changed.
| state | The new SVG filter state. |
Definition at line 512 of file 1.cpp.
References insertCardIcons(), and insertDeckIcons().
Referenced by getCardDeck(), and setupGUI().
| void KCardDialog::updatePNG | ( | int | state | ) | [protected, slot] |
Called by the checkboxes when the state of the PNG filter changed.
| state | The new PNG filter state. |
Definition at line 533 of file 1.cpp.
References insertCardIcons(), and insertDeckIcons().
Referenced by getCardDeck(), and setupGUI().
1.5.3