#include <kcarddialog.h>
Collaboration diagram for KCardDialog:

Public Types | |
| enum | CardFlags { Both = 0, NoDeck = 0x01, NoCards = 0x02 } |
Public Member Functions | |
| KCardDialog (QWidget *parent=NULL, const char *name=NULL, CardFlags flags=Both) | |
| Constructs a card deck selection dialog. | |
| ~KCardDialog () | |
| Destructs a card deck selection dialog. | |
| void | showRandomDeckBox (bool s) |
| Show or hides the "random backside" checkbox. | |
| void | showRandomCardDirBox (bool s) |
| Show or hides the "random foreside" checkbox. | |
| const QString & | deck () const |
| Returns the chosen deck, which is a valid path to a imagefile. | |
| void | setDeck (const QString &file) |
| Sets the default deck. | |
| const QString & | cardDir () const |
| void | setCardDir (const QString &dir) |
| Sets the default card directory. | |
| CardFlags | flags () const |
| void | setupDialog (bool showResizeBox=false) |
| Creates the default widgets in the dialog. | |
| bool | isRandomDeck () const |
| bool | isRandomCardDir () const |
| bool | isGlobalDeck () const |
| bool | isGlobalCardDir () const |
| double | cardScale () const |
| void | loadConfig (KConfig *conf) |
| Load the default settings into the dialog (e.g. | |
| void | saveConfig (KConfig *conf) |
| Saves the KCardDialog config into a config file. | |
Static Public Member Functions | |
| static int | getCardDeck (QString &deck, QString &carddir, QWidget *parent=0, CardFlags flags=Both, bool *randomDeck=0, bool *randomCardDir=0, double *scale=0, KConfig *conf=0) |
| Creates a modal carddeck dialog, lets the user choose a deck, and returns when the dialog is closed. | |
| static void | getConfigCardDeck (KConfig *conf, QString &deck, QString &cardDir, double &scale) |
| Read the configuration from the applications rc file and put the previously chosen deck/frontside in the parameter deck and carddir. | |
| static QString | getDefaultDeck () |
| Returns the default path to the card deck backsides. | |
| static QString | getDefaultCardDir () |
| Returns the default path to the card frontsides. | |
| static QString | getCardPath (const QString &carddir, int index) |
| Returns the path to the card frontside specified in dir carddir. | |
| static QString | getRandomDeck () |
| Returns a random deck in deckPath(). | |
| static QString | getRandomCardDir () |
| Returns a random directory of cards. | |
Protected Slots | |
| void | slotDeckClicked (QIconViewItem *) |
| void | slotCardClicked (QIconViewItem *) |
| void | slotRandomCardDirToggled (bool on) |
| void | slotRandomDeckToggled (bool on) |
| void | slotCardResized (int) |
| void | slotDefaultSize () |
| void | slotSetGlobalDeck () |
| void | slotSetGlobalCardDir () |
Protected Member Functions | |
| void | insertCardIcons () |
| void | insertDeckIcons () |
Static Protected Member Functions | |
| static void | getGlobalDeck (QString &cardDir, bool &random) |
| static void | getGlobalCardDir (QString &deck, bool &random) |
| static QString | getDeckName (const QString &desktop) |
| static QString | group () |
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.
Example:
QString deck,card; int result = KCardDialog::getCardDeck(deck,card ); if ( result == KCardDialog::Accepted ) ...
Here you can see a card dialog in action
KCarddialog
KCardDialog::getCardDeck takes a lot of different parameters which are probably very useful. You can e.g. use the parameters randomDeck and randomCardDir to give the end-user the ability to choose a random deck/carddir. You have to save the value of those parameters in your config file - that's why the parameters are needed.
You can also provide a KConfig pointer (usually kapp->config()). This pointer is used to store information about the dialog in an own group ("KCardDailog"). So you can just ignore the randomCardDir and randomDeck values and call KCardDialog::getConfigCardDeck instead. The only reson for this function is to read a previously written configuration and give you the information about it. This way you don't have to save any configuration on your own - KCardDialog does this for you.
Another Parameter for KCardDialog::getCardDeck is scale. This pointer to a double variable contains the scaling factor the user has chosen in the dialog (the scale box won't be shown if you don't provide this parameter). You might want to check out QPixmap::xFrom which gives you access to scaling. You can e.g. use
QWMatrix m; m.scale(s,s); pixmap.xForm(m);
Definition at line 90 of file kcarddialog.h.
|
|
Definition at line 101 of file kcarddialog.h. |
|
||||||||||||||||
|
Constructs a card deck selection dialog.
Definition at line 531 of file kcarddialog.cpp. References KCardDialogPrivate::cFlags. |
|
|
Destructs a card deck selection dialog.
Definition at line 524 of file kcarddialog.cpp. |
|
|
Definition at line 249 of file kcarddialog.cpp. References KCardDialogPrivate::cCardDir. Referenced by getCardDeck(), saveConfig(), setupDialog(), slotRandomCardDirToggled(), and slotSetGlobalCardDir(). |
|
|
Definition at line 252 of file kcarddialog.cpp. References KCardDialogPrivate::cScale. Referenced by getCardDeck(). |
|
|
Returns the chosen deck, which is a valid path to a imagefile.
Definition at line 247 of file kcarddialog.cpp. References KCardDialogPrivate::cDeck. Referenced by getCardDeck(), saveConfig(), setupDialog(), and slotSetGlobalDeck(). |
|
|
Definition at line 251 of file kcarddialog.cpp. References KCardDialogPrivate::cFlags. Referenced by loadConfig(), saveConfig(), and setupDialog(). |
|
||||||||||||||||||||||||||||||||||||
|
Creates a modal carddeck dialog, lets the user choose a deck, and returns when the dialog is closed.
Definition at line 112 of file kcarddialog.cpp. References cardDir(), cardScale(), deck(), getGlobalDeck(), isGlobalDeck(), isRandomCardDir(), isRandomDeck(), loadConfig(), setCardDir(), setDeck(), setupDialog(), showRandomCardDirBox(), and showRandomDeckBox(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Returns the path to the card frontside specified in dir carddir.
Definition at line 232 of file kcarddialog.cpp. |
|
||||||||||||||||||||
|
Read the configuration from the applications rc file and put the previously chosen deck/frontside in the parameter deck and carddir. You probably want to use this function on startup of your program so that the user gets exactly the card/frontside he/she chose before. Note that you don't have to care whether the user wants to get a random carddeck or not as this function takes care of this.
Definition at line 179 of file kcarddialog.cpp. References CONF_DECK, CONF_GROUP, CONF_RANDOMDECK, and getRandomDeck(). Here is the call graph for this function: ![]() |
|
|
Definition at line 562 of file kcarddialog.cpp. Referenced by getRandomDeck(), and insertDeckIcons(). |
|
|
Returns the default path to the card frontsides. You want to use this usually before the user used the card dialog the first time to get an default deck. You can assume that getCardPath(getDefaultCardPath(), *)
Definition at line 224 of file kcarddialog.cpp. References KCARD_DEFAULTCARD, and KCARD_DEFAULTCARDDIR. |
|
|
Returns the default path to the card deck backsides. You want to use this usually before the user used the card dialog the first time to get a default deck. You can assume that getDefaultDeckPath()
Definition at line 218 of file kcarddialog.cpp. References KCARD_DEFAULTDECK. Referenced by setupDialog(). |
|
||||||||||||
|
Definition at line 781 of file kcarddialog.cpp. References CONF_GLOBAL_CARDDIR, CONF_GLOBAL_GROUP, CONF_GLOBAL_RANDOMCARDDIR, and getRandomCardDir(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Definition at line 765 of file kcarddialog.cpp. References CONF_GLOBAL_DECK, CONF_GLOBAL_GROUP, CONF_GLOBAL_RANDOMDECK, and getRandomDeck(). Referenced by getCardDeck(). Here is the call graph for this function: ![]() |
|
|
Returns a random directory of cards.
Definition at line 586 of file kcarddialog.cpp. Referenced by getGlobalCardDir(), and slotRandomCardDirToggled(). |
|
|
Returns a random deck in deckPath().
Definition at line 574 of file kcarddialog.cpp. References getDeckName(). Referenced by getConfigCardDeck(), getGlobalDeck(), and slotRandomDeckToggled(). Here is the call graph for this function: ![]() |
|
|
|
|
|
Definition at line 453 of file kcarddialog.cpp. References KCardDialogPrivate::cardIconView, KCardDialogPrivate::cardMap, and KCardDialogPrivate::helpMap. Referenced by setupDialog(). |
|
|
Definition at line 489 of file kcarddialog.cpp. References KCardDialogPrivate::deckIconView, KCardDialogPrivate::deckMap, getDeckName(), and KCardDialogPrivate::helpMap. Referenced by setupDialog(). Here is the call graph for this function: ![]() |
|
|
Definition at line 259 of file kcarddialog.cpp. References KCardDialogPrivate::globalCardDir. |
|
|
Definition at line 257 of file kcarddialog.cpp. References KCardDialogPrivate::globalDeck. Referenced by getCardDeck(). |
|
|
Definition at line 255 of file kcarddialog.cpp. References KCardDialogPrivate::randomCardDir. Referenced by getCardDeck(), saveConfig(), and slotSetGlobalCardDir(). |
|
|
Definition at line 253 of file kcarddialog.cpp. References KCardDialogPrivate::randomDeck. Referenced by getCardDeck(), saveConfig(), and slotSetGlobalDeck(). |
|
|
Load the default settings into the dialog (e.g. whether the "use random deck" checkbox is checked or not). Definition at line 646 of file kcarddialog.cpp. References CONF_DECK, CONF_GROUP, CONF_RANDOMDECK, CONF_USEGLOBALDECK, flags(), KCardDialogPrivate::globalDeck, NoDeck, KCardDialogPrivate::randomDeck, setDeck(), and slotRandomDeckToggled(). Referenced by getCardDeck(). Here is the call graph for this function: ![]() |
|
|
Saves the KCardDialog config into a config file. This should be the applications config file - KCardDialog creates an own group ("KCardDialog"). These settings are used by loadConfig and getConfigCardDeck. Definition at line 720 of file kcarddialog.cpp. References cardDir(), CONF_DECK, CONF_GROUP, CONF_RANDOMCARDDIR, CONF_RANDOMDECK, CONF_SCALE, CONF_USEGLOBALCARDDIR, CONF_USEGLOBALDECK, KCardDialogPrivate::cScale, deck(), flags(), KCardDialogPrivate::globalCardDir, KCardDialogPrivate::globalDeck, isRandomCardDir(), isRandomDeck(), NoCards, and NoDeck. Here is the call graph for this function: ![]() |
|
|
Sets the default card directory.
Definition at line 250 of file kcarddialog.cpp. References KCardDialogPrivate::cCardDir. Referenced by getCardDeck(), slotCardClicked(), and slotRandomCardDirToggled(). |
|
|
Sets the default deck.
Definition at line 248 of file kcarddialog.cpp. References KCardDialogPrivate::cDeck. Referenced by getCardDeck(), loadConfig(), slotDeckClicked(), and slotRandomDeckToggled(). |
|
|
|
Show or hides the "random foreside" checkbox.
Definition at line 610 of file kcarddialog.cpp. References KCardDialogPrivate::randomCardDir. Referenced by getCardDeck(). |
|
|
Show or hides the "random backside" checkbox.
Definition at line 599 of file kcarddialog.cpp. References KCardDialogPrivate::randomDeck. Referenced by getCardDeck(). |
|
|
Definition at line 550 of file kcarddialog.cpp. References KCardDialogPrivate::cardLabel, KCardDialogPrivate::cardMap, KCardDialogPrivate::deckLabel, KCardDialogPrivate::helpMap, and setCardDir(). Referenced by setupDialog(). |
|
|
Definition at line 691 of file kcarddialog.cpp. References KCardDialogPrivate::cPreview, KCardDialogPrivate::cPreviewPix, KCardDialogPrivate::cScale, SLIDER_MAX, and SLIDER_MIN. Referenced by setupDialog(). |
|
|
Definition at line 540 of file kcarddialog.cpp. References KCardDialogPrivate::deckLabel, KCardDialogPrivate::deckMap, KCardDialogPrivate::helpMap, and setDeck(). Referenced by setupDialog(). |
|
|
Definition at line 712 of file kcarddialog.cpp. References KCardDialogPrivate::scaleSlider, SLIDER_MAX, and SLIDER_MIN. Referenced by setupDialog(). |
|
|
Definition at line 632 of file kcarddialog.cpp. References cardDir(), KCardDialogPrivate::cardLabel, getRandomCardDir(), and setCardDir(). Referenced by setupDialog(). |
|
|
Definition at line 621 of file kcarddialog.cpp. References KCardDialogPrivate::deckLabel, getRandomDeck(), and setDeck(). Referenced by loadConfig(), and setupDialog(). |
|
|
Definition at line 754 of file kcarddialog.cpp. References cardDir(), CONF_GLOBAL_CARDDIR, CONF_GLOBAL_GROUP, CONF_GLOBAL_RANDOMCARDDIR, and isRandomCardDir(). Referenced by setupDialog(). |
|
|
Definition at line 743 of file kcarddialog.cpp. References CONF_GLOBAL_DECK, CONF_GLOBAL_GROUP, CONF_GLOBAL_RANDOMDECK, deck(), and isRandomDeck(). Referenced by setupDialog(). |
1.4.6