KDE3Support
k3aboutdialog.h
Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor, 00019 * Boston, MA 02110-1301, 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 K3ABOUTDIALOG_H 00031 #define K3ABOUTDIALOG_H 00032 00033 #include <kde3support_export.h> 00034 00035 #include <QtGui/QFrame> 00036 #include <kdialog.h> 00037 00038 class QLabel; 00039 class QLabel; 00040 class K3AboutContainer; 00041 class K3AboutContainerBase; 00042 00046 class KDE3SUPPORT_EXPORT K3AboutContainer : public QFrame 00047 { 00048 Q_OBJECT 00049 00050 public: 00051 K3AboutContainer( QWidget *parent = 0, 00052 int margin = 0, int spacing = 0, 00053 Qt::Alignment childAlignment = Qt::AlignCenter, 00054 Qt::Alignment innerAlignment = Qt::AlignCenter ); 00055 00056 ~K3AboutContainer(); 00057 00058 void addWidget( QWidget *widget ); 00059 00060 void addPerson( const QString &name, const QString &email, 00061 const QString &url, const QString &task, 00062 bool showHeader = false, bool showframe = false, 00063 bool showBold = false ); 00064 00065 void addTitle( const QString &title, Qt::Alignment alignment = Qt::AlignLeft, 00066 bool showframe = false, bool showBold = false ); 00067 00068 void addImage( const QString &fileName, Qt::Alignment alignment = Qt::AlignLeft ); 00069 00070 virtual QSize sizeHint() const; 00071 virtual QSize minimumSizeHint() const; 00072 00073 private: 00074 class Private; 00075 Private* const d; 00076 }; 00077 00082 class KDE3SUPPORT_EXPORT K3AboutContributor : public QFrame 00083 { 00084 Q_OBJECT 00085 00086 public: 00087 K3AboutContributor( QWidget *parent = 0, 00088 const QString &username = QString(), 00089 const QString &email = QString(), 00090 const QString &url = QString(), 00091 const QString &work = QString(), 00092 bool showHeader = false, bool showFrame = true, 00093 bool showBold = false ); 00094 00095 ~K3AboutContributor(); 00096 00097 void setName( const QString &text, const QString &header = QString(), 00098 bool update = true ); 00099 00100 void setEmail( const QString &text, const QString &header = QString(), 00101 bool update = true ); 00102 00103 void setUrl( const QString &text, const QString &header = QString(), 00104 bool update = true ); 00105 00106 void setWork( const QString &text, const QString &header = QString(), 00107 bool update = true ); 00108 00109 QString name() const; 00110 QString email() const; 00111 QString url() const; 00112 QString work() const; 00113 00114 virtual QSize sizeHint() const; 00115 00116 protected: 00117 virtual void fontChange( const QFont &oldFont ); 00118 00119 private: 00120 class Private; 00121 Private* const d; 00122 00123 virtual void setName(const char *_name) { QObject::setObjectName(QLatin1String(_name)); } 00124 }; 00125 00131 class KDE3SUPPORT_EXPORT K3AboutWidget : public QWidget 00132 { 00133 Q_OBJECT 00134 00135 public: 00136 00140 K3AboutWidget( QWidget* parent=0 ); 00141 00146 void adjust(); 00147 00153 void setLogo( const QPixmap &logo ); 00154 00158 void setAuthor( const QString& name, const QString& email, 00159 const QString& url, const QString& work ); 00160 00164 void setMaintainer( const QString& name, const QString& email, 00165 const QString& url, const QString& work ); 00166 00170 void addContributor( const QString& name, const QString& email, 00171 const QString& url, const QString& work ); 00172 00176 void setVersion( const QString& name ); 00177 00178 protected: 00182 void resizeEvent(QResizeEvent*); 00183 00187 QLabel *version; 00188 00192 QLabel *cont; 00193 00197 QLabel *logo; 00198 00202 K3AboutContributor *author; 00203 00207 K3AboutContributor *maintainer; 00208 00212 bool showMaintainer; 00213 00217 QList<K3AboutContributor *> contributors; 00218 00219 private: 00220 class Private; 00221 Private* const d; 00222 }; 00223 00255 class KDE3SUPPORT_EXPORT K3AboutDialog : public KDialog 00256 { 00257 Q_OBJECT 00258 00259 public: 00260 00264 enum LayoutType 00265 { 00266 Plain = 0x0001, 00267 Tabbed = 0x0002, 00268 Title = 0x0004, 00269 ImageLeft = 0x0008, 00270 ImageRight = 0x0010, 00271 ImageOnly = 0x0020, 00272 Product = 0x0040, 00273 KDEStandard = Tabbed | Title | ImageLeft, 00274 AppStandard = Tabbed | Title | Product, 00275 ImageAndTitle = Plain | Title | ImageOnly 00276 }; 00277 00278 public: 00287 K3AboutDialog( QWidget *parent=0 ); 00288 00302 K3AboutDialog( int dialogLayout, const QString &caption, QWidget *parent=0 ); 00303 00311 void adjust(); 00312 00320 virtual void show(); 00321 00330 virtual void show( QWidget *centerParent ); 00331 00338 void setTitle( const QString &title ); 00339 00347 void setImage( const QString &fileName ); 00348 00352 void setProgramLogo( const QString &fileName ); 00353 00363 void setProgramLogo( const QPixmap &pixmap ); 00364 00373 void setImageBackgroundColor( const QColor &color ); 00374 00382 void setImageFrame( bool state ); 00383 00395 void setProduct( const QString &appName, const QString &version, 00396 const QString &author, const QString &year ); 00397 00410 QFrame *addTextPage( const QString &title, const QString &text, 00411 bool richText=false, int numLines=10 ); 00412 00423 QFrame *addLicensePage( const QString &title, const QString &text, 00424 int numLines=10 ); 00425 00438 K3AboutContainer *addContainerPage( const QString &title, 00439 Qt::Alignment childAlignment = Qt::AlignCenter, 00440 Qt::Alignment innerAlignment = Qt::AlignCenter ); 00441 00454 K3AboutContainer *addScrolledContainerPage( const QString &title, 00455 Qt::Alignment childAlignment = Qt::AlignCenter, 00456 Qt::Alignment innerAlignment = Qt::AlignCenter ); 00457 00468 K3AboutContainer *addContainer( Qt::Alignment childAlignment, Qt::Alignment innerAlignment ); 00469 00477 QFrame *addPage( const QString &title ); 00478 00483 void setLogo( const QPixmap &logo ); 00484 00489 void setAuthor( const QString& name, const QString& email, 00490 const QString& url, const QString& work ); 00491 00496 void setMaintainer( const QString& name, const QString& email, 00497 const QString& url, const QString& work ); 00498 00503 void addContributor( const QString& name, const QString& email, 00504 const QString& url, const QString& work ); 00505 00510 void setVersion( const QString& name ); 00511 00516 static void imageUrl( QWidget *parent, const QString &caption, 00517 const QString &path, const QColor &imageColor, 00518 const QString &url ); 00519 00520 protected: 00524 K3AboutWidget *mAbout; 00525 00529 K3AboutContainerBase *mContainerBase; 00530 00531 private: 00532 class Private; 00533 Private* const d; 00534 }; 00535 00536 #endif // defined K3ABOUTDIALOG_H
KDE 4.6 API Reference