kaboutdialog.h Source File (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# kaboutdialog.h

    00001 /*
    00002  * This file is part of the KDE Libraries
    00003  * Copyright (C) 1999-2001 Mirko Boehm (mirko@kde.org) and
    00004  * Espen Sand (espen@kde.org)
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the GNU Library General Public
    00008  * License as published by the Free Software Foundation; either
    00009  * version 2 of the License, or (at your option) any later version.
    00010  *
    00011  * This library is distributed in the hope that it will be useful,
    00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014  * Library General Public License for more details.
    00015  *
    00016  * You should have received a copy of the GNU Library General Public License
    00017  * along with this library; see the file COPYING.LIB.  If not, write to
    00018  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00019  * Boston, MA 02111-1307, USA.
    00020  *
    00021  */
    00022
    00023 /*
    00024  * This file declares a class for creating "About ..." dialogs
    00025  * in a general way. It provides geometry management and some
    00026  * options to connect for, like emailing the author or maintainer.
    00027  */
    00028
    00029
    00030 #ifndef _KABOUTDIALOG_H_
    00031 #define _KABOUTDIALOG_H_
    00032
    00033 #include <kdialogbase.h>
    00034 #include <qstring.h>
    00035
    00036 class QFrame;
    00037 class QLabel;
    00038 class QVBoxLayout;
    00039 class QTabWidget;
    00040 class KURLLabel;
    00041 class KAboutContainer;
    00042 class KAboutContainerBase;
    00043
    00044 class KAboutWidgetPrivate;
    00045
    00046 class KAboutContainerPrivate;
    00050 class KAboutContainer : public QFrame
    00051 {
    00052   Q_OBJECT
    00053
    00054   public:
    00055     KAboutContainer( QWidget *parent=0, const char *name=0,
    00056                      int margin=0, int spacing=0,
    00057                      int childAlignment = AlignCenter,
    00058                      int innerAlignment = AlignCenter );
    00059
    00060     void addWidget( QWidget *widget );
    00061     void addPerson( const QString &name, const QString &email,
    00062                     const QString &url, const QString &task,
    00063                     bool showHeader = false, bool showframe = false,
    00064                     bool showBold = false );
    00065     void addTitle(  const QString &title, int alignment=AlignLeft,
    00066                     bool showframe = false, bool showBold = false );
    00067     void addImage( const QString &fileName, int alignment=AlignLeft );
    00068
    00069     virtual QSize sizeHint( void ) const;
    00070     virtual QSize minimumSizeHint( void ) const;
    00071
    00072   protected:
    00073     virtual void childEvent( QChildEvent *e );
    00074
    00075   signals:
    00076     void urlClick( const QString &url );
    00077     void mailClick( const QString &name, const QString &address );
    00078
    00079
    00080   private:
    00081     QVBoxLayout *mVbox;
    00082     int mAlignment;
    00083     KAboutContainerPrivate *d;
    00084 };
    00085
    00086 class KAboutContributorPrivate;
    00087
    00092 class KAboutContributor : public QFrame
    00093 {
    00094   Q_OBJECT
    00095
    00096   public:
    00097     KAboutContributor( QWidget *parent=0, const char *name=0,
    00098                        const QString &username=QString::null,
    00099                        const QString &email=QString::null,
    00100                        const QString &url=QString::null,
    00101                        const QString &work=QString::null,
    00102                        bool showHeader=false, bool showFrame=true,
    00103                        bool showBold=false );
    00104
    00105     void setName( const QString &text, const QString &header=QString::null,
    00106                   bool update = true );
    00107     void setEmail( const QString &text, const QString &header=QString::null,
    00108                    bool update = true );
    00109     void setURL( const QString &text, const QString &header=QString::null,
    00110                  bool update = true );
    00111     void setWork( const QString &text, const QString &header=QString::null,
    00112                   bool update = true );
    00113     QString getName( void ) const;
    00114     QString getEmail( void ) const;
    00115     QString getURL( void ) const;
    00116     QString getWork( void ) const;
    00117
    00118     virtual QSize sizeHint( void ) const;
    00119
    00120   protected:
    00121     virtual void fontChange( const QFont &oldFont );
    00122
    00123   protected slots:
    00124     void urlClickedSlot( const QString& );
    00125     void emailClickedSlot( const QString& emailaddress );
    00126
    00127   private:
    00128     void updateLayout( void );
    00129
    00130   signals:
    00131     void sendEmail(const QString& name, const QString& email);
    00132     void openURL(const QString& url);
    00133
    00134   private:
    00135     QLabel *mLabel[4];
    00136     QLabel *mText[4];
    00137     bool mShowHeader;
    00138     bool mShowBold;
    00139
    00140     KAboutContributorPrivate *d;
    00141
    00142         virtual void setName(const char *_name) { QFrame::setName(_name); }
    00143 };
    00144
    00150 class KAboutWidget : public QWidget
    00151 {
    00152   Q_OBJECT
    00153
    00154 public:
    00155
    00159   KAboutWidget(QWidget* parent=0, const char* name=0 );
    00160
    00165   void adjust();
    00166
    00170   void setLogo(const QPixmap&);
    00174   void setAuthor(const QString& name, const QString& email,
    00175                  const QString& url, const QString& work);
    00179   void setMaintainer(const QString& name, const QString& email,
    00180                      const QString& url, const QString& work);
    00184   void addContributor(const QString& name, const QString& email,
    00185                       const QString& url, const QString& work);
    00189   void setVersion(const QString& name);
    00190   // -------------------------------------------------------------------------
    00191 protected slots:
    00195   void sendEmailSlot(const QString& name, const QString& email);
    00199   void openURLSlot(const QString& url);
    00200   // -------------------------------------------------------------------------
    00201 signals:
    00205   void sendEmail(const QString& name, const QString& email);
    00209   void openURL(const QString& url);
    00210   // -------------------------------------------------------------------------
    00211 protected:
    00212   // events:
    00216   void resizeEvent(QResizeEvent*);
    00220   QLabel *version;
    00224   QLabel *cont;
    00228   QLabel *logo;
    00232   KAboutContributor *author;
    00236   KAboutContributor *maintainer;
    00240   bool showMaintainer;
    00244   QPtrList<KAboutContributor> contributors;
    00245   // #########################################################################
    00246   //
    00247 private:
    00248   KAboutWidgetPrivate *d;
    00249 };
    00250
    00251 class KAboutDialogPrivate;
    00283 class KAboutDialog : public KDialogBase
    00284 {
    00285   Q_OBJECT
    00286
    00287   public:
    00291     enum LayoutType
    00292     {
    00293       AbtPlain         = 0x0001,
    00294       AbtTabbed        = 0x0002,
    00295       AbtTitle         = 0x0004,
    00296       AbtImageLeft     = 0x0008,
    00297       AbtImageRight    = 0x0010,
    00298       AbtImageOnly     = 0x0020,
    00299       AbtProduct       = 0x0040,
    00300       AbtKDEStandard   = AbtTabbed|AbtTitle|AbtImageLeft,
    00301       AbtAppStandard   = AbtTabbed|AbtTitle|AbtProduct,
    00302       AbtImageAndTitle = AbtPlain|AbtTitle|AbtImageOnly
    00303     };
    00304
    00305   public:
    00314     KAboutDialog( QWidget *parent=0, const char *name=0, bool modal=true );
    00315
    00341     KAboutDialog( int dialogLayout, const QString &caption, int buttonMask,
    00342                   ButtonCode defaultButton, QWidget *parent=0,
    00343                   const char *name=0, bool modal=false, bool separator = false,
    00344                   const QString &user1 = QString::null,
    00345                   const QString &user2 = QString::null,
    00346                   const QString &user3 = QString::null );
    00347
    00355   void adjust();
    00356
    00364   virtual void show( void );
    00365
    00374   virtual void show( QWidget *centerParent );
    00375
    00382   void setTitle( const QString &title );
    00383
    00391   void setImage( const QString &fileName );
    00392
    00401   void setImageBackgroundColor( const QColor &color );
    00402
    00410   void setImageFrame( bool state );
    00411
    00423   void setProduct( const QString &appName, const QString &version,
    00424                    const QString &author, const QString &year );
    00425
    00438   QFrame *addTextPage( const QString &title, const QString &text,
    00439                        bool richText=false, int numLines=10 );
    00440
    00451   QFrame *addLicensePage( const QString &title, const QString &text,
    00452                           int numLines=10 );
    00453
    00466   KAboutContainer *addContainerPage( const QString &title,
    00467     int childAlignment = AlignCenter, int innerAlignment = AlignCenter );
    00468
    00481   KAboutContainer *addScrolledContainerPage( const QString &title,
    00482     int childAlignment = AlignCenter, int innerAlignment = AlignCenter );
    00483
    00494   KAboutContainer *addContainer( int childAlignment, int innerAlignment );
    00495
    00503   QFrame *addPage( const QString &title );
    00504
    00505
    00510   void setLogo(const QPixmap&);
    00511
    00516   void setAuthor(const QString& name, const QString& email,
    00517                  const QString& url, const QString& work);
    00518
    00523   void setMaintainer(const QString& name, const QString& email,
    00524                      const QString& url, const QString& work);
    00525
    00530   void addContributor(const QString& name, const QString& email,
    00531                       const QString& url, const QString& work);
    00532
    00537   void setVersion(const QString& name);
    00538
    00543   static void imageURL( QWidget *parent, const QString &caption,
    00544                           const QString &path, const QColor &imageColor,
    00545                           const QString &url );
    00546
    00547 signals:
    00554   void sendEmail(const QString& name, const QString& email);
    00555
    00559   void openURL(const QString& url);
    00560   // ----------------------------------------------------------------------------
    00561 protected:
    00565   KAboutWidget * about;
    00566
    00570   KAboutContainerBase *mContainerBase;
    00571
    00572   // -------------------------------------------------------------------------
    00573 protected slots:
    00574
    00578   void sendEmailSlot(const QString& name, const QString& email);
    00579
    00583   void openURLSlot(const QString& url);
    00584
    00590   virtual void mouseTrackSlot( int mode, const QMouseEvent *e );
    00591
    00592   // #########################################################################
    00593 protected:
    00594   virtual void virtual_hook( int id, void* data );
    00595 private:
    00596   KAboutDialogPrivate *d;
    00597 };
    00598
    00599 #endif // defined KABOUTDIALOG_H

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:55:51 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001