kcarddialog.h

00001 /*
00002     This file is part of the KDE games library
00003     Copyright (C) 2000 Martin Heni (martin@heni-online.de)
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License version 2 as published by the Free Software Foundation.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 #ifndef __KCARDDIALOG_H_
00020 #define __KCARDDIALOG_H_
00021 
00022 #include <qstring.h>
00023 #include <kdialogbase.h>
00024 #include <qmap.h> // TODO: remove - it is in kcarddialog.cpp now; left here for source compatibility
00025 
00026 #include <kdemacros.h>
00027 class QIconViewItem;
00028 
00029 class KConfig;
00030 
00031 class KCardDialogPrivate;
00032 
00090 class KDE_EXPORT KCardDialog : public KDialogBase
00091 {
00092   Q_OBJECT
00093 
00094 public:
00095 
00101    enum CardFlags { Both=0, NoDeck=0x01, NoCards=0x02 };
00102 
00110    KCardDialog (QWidget* parent = NULL,const char* name = NULL,
00111                 CardFlags flags = Both);
00115    ~KCardDialog();
00116 
00156    static int getCardDeck(QString &deck,QString &carddir, QWidget *parent=0,
00157                           CardFlags flags=Both, bool* randomDeck=0,
00158                           bool* randomCardDir=0, double* scale=0, KConfig* conf=0);
00159 
00175    static void getConfigCardDeck(KConfig* conf, QString& deck, QString& cardDir, double& scale);
00176 
00188    static QString getDefaultDeck();
00189 
00201    static QString getDefaultCardDir();
00202 
00210     static QString getCardPath(const QString &carddir, int index);
00211 
00216     static QString getRandomDeck();
00217 
00222     static QString getRandomCardDir();
00223 
00228    void showRandomDeckBox(bool s);
00229 
00234    void showRandomCardDirBox(bool s);
00235 
00241    const QString& deck() const;
00242 
00247    void setDeck(const QString& file);
00248 
00252    const QString& cardDir() const;
00253 
00258    void setCardDir(const QString& dir);
00259 
00263    CardFlags flags() const;
00264 
00270    void setupDialog(bool showResizeBox = false);
00271 
00276    bool isRandomDeck() const;
00277 
00282    bool isRandomCardDir() const;
00283 
00287    bool isGlobalDeck() const;
00288 
00292    bool isGlobalCardDir() const;
00293 
00297    double cardScale() const;
00298 
00303    void loadConfig(KConfig* conf);
00304 
00311    void saveConfig(KConfig* conf);
00312 
00313 
00314 protected:
00315     void insertCardIcons();
00316     void insertDeckIcons();
00317 
00318     static void getGlobalDeck(QString& cardDir, bool& random);
00319     static void getGlobalCardDir(QString& deck, bool& random);
00320 
00321     static QString getDeckName(const QString& desktop);
00322 
00327     static QString group();
00328 
00329 protected slots:
00330    void slotDeckClicked(QIconViewItem *);
00331    void slotCardClicked(QIconViewItem *);
00332    void slotRandomCardDirToggled(bool on);
00333    void slotRandomDeckToggled(bool on);
00334    void slotCardResized(int);
00335    void slotDefaultSize();
00336    void slotSetGlobalDeck();
00337    void slotSetGlobalCardDir();
00338 
00339 private:
00340    static void init();
00341 
00342    KCardDialogPrivate* d;
00343 };
00344 
00345 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys