tdeaboutdialog.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., 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 _TDEABOUTDIALOG_H_ 00031 #define _TDEABOUTDIALOG_H_ 00032 00033 #include <kdialogbase.h> 00034 #include <tqstring.h> 00035 00036 class TQFrame; 00037 class TQLabel; 00038 class TQVBoxLayout; 00039 class TQTabWidget; 00040 class KURLLabel; 00041 class TDEAboutContainer; 00042 class TDEAboutContainerBase; 00043 00044 class TDEAboutWidgetPrivate; 00045 00046 class TDEAboutContainerPrivate; 00050 class TDEUI_EXPORT TDEAboutContainer : public TQFrame 00051 { 00052 Q_OBJECT 00053 00054 public: 00055 TDEAboutContainer( TQWidget *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( TQWidget *widget ); 00061 void addPerson( const TQString &name, const TQString &email, 00062 const TQString &url, const TQString &task, 00063 bool showHeader = false, bool showframe = false, 00064 bool showBold = false ); 00065 void addTitle( const TQString &title, int alignment=AlignLeft, 00066 bool showframe = false, bool showBold = false ); 00067 void addImage( const TQString &fileName, int alignment=AlignLeft ); 00068 00069 virtual TQSize sizeHint( void ) const; 00070 virtual TQSize minimumSizeHint( void ) const; 00071 00072 protected: 00073 virtual void childEvent( TQChildEvent *e ); 00074 00075 signals: 00076 void urlClick( const TQString &url ); 00077 void mailClick( const TQString &name, const TQString &address ); 00078 00079 00080 private: 00081 TQVBoxLayout *mVbox; 00082 int mAlignment; 00083 TDEAboutContainerPrivate* const d; 00084 }; 00085 00086 class TDEAboutContributorPrivate; 00087 00092 class TDEUI_EXPORT TDEAboutContributor : public TQFrame 00093 { 00094 Q_OBJECT 00095 00096 public: 00097 TDEAboutContributor( TQWidget *parent=0, const char *name=0, 00098 const TQString &username=TQString::null, 00099 const TQString &email=TQString::null, 00100 const TQString &url=TQString::null, 00101 const TQString &work=TQString::null, 00102 bool showHeader=false, bool showFrame=true, 00103 bool showBold=false ); 00104 00105 void setName( const TQString &text, const TQString &header=TQString::null, 00106 bool update = true ); 00107 void setEmail( const TQString &text, const TQString &header=TQString::null, 00108 bool update = true ); 00109 void setURL( const TQString &text, const TQString &header=TQString::null, 00110 bool update = true ); 00111 void setWork( const TQString &text, const TQString &header=TQString::null, 00112 bool update = true ); 00113 TQString getName( void ) const; 00114 TQString getEmail( void ) const; 00115 TQString getURL( void ) const; 00116 TQString getWork( void ) const; 00117 00118 virtual TQSize sizeHint( void ) const; 00119 00120 protected: 00121 virtual void fontChange( const TQFont &oldFont ); 00122 00123 protected slots: 00124 void urlClickedSlot( const TQString& ); 00125 void emailClickedSlot( const TQString& emailaddress ); 00126 00127 private: 00128 void updateLayout( void ); 00129 00130 signals: 00131 void sendEmail(const TQString& name, const TQString& email); 00132 void openURL(const TQString& url); 00133 00134 private: 00135 TQLabel *mLabel[4]; 00136 TQLabel *mText[4]; 00137 bool mShowHeader; 00138 bool mShowBold; 00139 00140 TDEAboutContributorPrivate* const d; 00141 00142 virtual void setName(const char *_name) { TQFrame::setName(_name); } 00143 }; 00144 00150 class TDEUI_EXPORT TDEAboutWidget : public TQWidget 00151 { 00152 Q_OBJECT 00153 00154 public: 00155 00159 TDEAboutWidget(TQWidget* parent=0, const char* name=0 ); 00160 00165 void adjust(); 00166 00170 void setLogo(const TQPixmap&); 00174 void setAuthor(const TQString& name, const TQString& email, 00175 const TQString& url, const TQString& work); 00179 void setMaintainer(const TQString& name, const TQString& email, 00180 const TQString& url, const TQString& work); 00184 void addContributor(const TQString& name, const TQString& email, 00185 const TQString& url, const TQString& work); 00189 void setVersion(const TQString& name); 00190 // ------------------------------------------------------------------------- 00191 protected slots: 00195 void sendEmailSlot(const TQString& name, const TQString& email); 00199 void openURLSlot(const TQString& url); 00200 // ------------------------------------------------------------------------- 00201 signals: 00205 void sendEmail(const TQString& name, const TQString& email); 00209 void openURL(const TQString& url); 00210 // ------------------------------------------------------------------------- 00211 protected: 00212 // events: 00216 void resizeEvent(TQResizeEvent*); 00220 TQLabel *version; 00224 TQLabel *cont; 00228 TQLabel *logo; 00232 TDEAboutContributor *author; 00236 TDEAboutContributor *maintainer; 00240 bool showMaintainer; 00244 TQPtrList<TDEAboutContributor> contributors; 00245 // ######################################################################### 00246 // 00247 private: 00248 TDEAboutWidgetPrivate* const d; 00249 }; 00250 00251 class TDEAboutDialogPrivate; 00283 class TDEUI_EXPORT TDEAboutDialog : 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 TDEAboutDialog( TQWidget *parent=0, const char *name=0, bool modal=true ); 00315 00341 TDEAboutDialog( int dialogLayout, const TQString &caption, int buttonMask, 00342 ButtonCode defaultButton, TQWidget *parent=0, 00343 const char *name=0, bool modal=false, bool separator = false, 00344 const TQString &user1 = TQString::null, 00345 const TQString &user2 = TQString::null, 00346 const TQString &user3 = TQString::null ); 00347 00355 void adjust(); 00356 00364 virtual void show( void ); 00365 00374 virtual void show( TQWidget *centerParent ); 00375 00382 void setTitle( const TQString &title ); 00383 00391 void setImage( const TQString &fileName ); 00392 00405 void setIcon( const TQString &fileName ) KDE_DEPRECATED; // KDE4: remove 00406 00412 void setProgramLogo( const TQString &fileName ); 00413 00425 void setProgramLogo( const TQPixmap &pixmap ); 00426 00435 void setImageBackgroundColor( const TQColor &color ); 00436 00444 void setImageFrame( bool state ); 00445 00457 void setProduct( const TQString &appName, const TQString &version, 00458 const TQString &author, const TQString &year ); 00459 00472 TQFrame *addTextPage( const TQString &title, const TQString &text, 00473 bool richText=false, int numLines=10 ); 00474 00485 TQFrame *addLicensePage( const TQString &title, const TQString &text, 00486 int numLines=10 ); 00487 00500 TDEAboutContainer *addContainerPage( const TQString &title, 00501 int childAlignment = AlignCenter, int innerAlignment = AlignCenter ); 00502 00515 TDEAboutContainer *addScrolledContainerPage( const TQString &title, 00516 int childAlignment = AlignCenter, int innerAlignment = AlignCenter ); 00517 00528 TDEAboutContainer *addContainer( int childAlignment, int innerAlignment ); 00529 00537 TQFrame *addPage( const TQString &title ); 00538 00539 00544 void setLogo(const TQPixmap&); 00545 00550 void setAuthor(const TQString& name, const TQString& email, 00551 const TQString& url, const TQString& work); 00552 00557 void setMaintainer(const TQString& name, const TQString& email, 00558 const TQString& url, const TQString& work); 00559 00564 void addContributor(const TQString& name, const TQString& email, 00565 const TQString& url, const TQString& work); 00566 00571 void setVersion(const TQString& name); 00572 00577 static void imageURL( TQWidget *parent, const TQString &caption, 00578 const TQString &path, const TQColor &imageColor, 00579 const TQString &url ); 00580 00581 signals: 00588 void sendEmail(const TQString& name, const TQString& email); 00589 00593 void openURL(const TQString& url); 00594 // ---------------------------------------------------------------------------- 00595 protected: 00599 TDEAboutWidget * about; 00600 00604 TDEAboutContainerBase *mContainerBase; 00605 00606 // ------------------------------------------------------------------------- 00607 protected slots: 00608 00612 void sendEmailSlot(const TQString& name, const TQString& email); 00613 00617 void openURLSlot(const TQString& url); 00618 00624 virtual void mouseTrackSlot( int mode, const TQMouseEvent *e ); 00625 00626 // ######################################################################### 00627 protected: 00628 virtual void virtual_hook( int id, void* data ); 00629 private: 00630 TDEAboutDialogPrivate* const d; 00631 }; 00632 00633 #endif // defined TDEABOUTDIALOG_H