kradio4
r778
|
00001 /*************************************************************************** 00002 aboutwidget.h - description 00003 ------------------- 00004 begin : Sa Sep 13 2003 00005 copyright : (C) 2003 by Martin Witte 00006 email : emw-kradio@nocabal.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef KRADIO_ABOUT_WIDGET_H 00019 #define KRADIO_ABOUT_WIDGET_H 00020 00021 #ifdef HAVE_CONFIG_H 00022 #include <config.h> 00023 #endif 00024 00025 00026 //#include <QtGui/QWidget> 00027 #include <QtGui/QLabel> 00028 00029 /* Unfortunately KDE doesn't provide the class KAboutContainerBase 00030 to public programming, so we have to copy most of that code into 00031 an own class :( 00032 */ 00033 00034 class QFrame; 00035 class KAboutContainer; 00036 class QTabWidget; 00037 class QVBoxLayout; 00038 class KAboutData; 00039 00040 #include <QtGui/QLabel> 00041 00042 // copied (and renamed) from kaboutdialog_private.h 00043 // original: KImageTrackLabel 00044 00045 class KRadioImageTrackLabel : public QLabel 00046 { 00047 Q_OBJECT 00048 00049 public: 00050 enum MouseMode 00051 { 00052 MousePress = 1, 00053 MouseRelease, 00054 MouseDoubleClick, 00055 MouseMove 00056 }; 00057 00058 public: 00059 KRadioImageTrackLabel( QWidget * parent, const char * name=0); 00060 00061 signals: 00062 void mouseTrack( int mode, const QMouseEvent *e ); 00063 00064 protected: 00065 virtual void mousePressEvent( QMouseEvent *e ); 00066 virtual void mouseReleaseEvent( QMouseEvent *e ); 00067 virtual void mouseDoubleClickEvent( QMouseEvent *e ); 00068 virtual void mouseMoveEvent ( QMouseEvent *e ); 00069 }; 00070 00071 // copied (and renamed) from kaboutdialog_private.h 00072 // original: KAboutContainerBase 00073 00074 class KRadioAboutWidget : public QWidget 00075 { 00076 Q_OBJECT 00077 00078 public: 00079 enum LayoutType 00080 { 00081 AbtPlain = 0x0001, 00082 AbtTabbed = 0x0002, 00083 AbtTitle = 0x0004, 00084 AbtImageLeft = 0x0008, 00085 AbtImageRight = 0x0010, 00086 AbtImageOnly = 0x0020, 00087 AbtProduct = 0x0040, 00088 AbtKDEStandard = AbtTabbed|AbtTitle|AbtImageLeft, 00089 AbtAppStandard = AbtTabbed|AbtTitle|AbtProduct, 00090 AbtImageAndTitle = AbtPlain|AbtTitle|AbtImageOnly 00091 }; 00092 00093 public: 00094 KRadioAboutWidget(const KAboutData &abtData, int layoutType, QWidget *parent = 0, char *name = 0); 00095 virtual void show( void ); 00096 virtual QSize sizeHint( void ) const; 00097 00098 void setAboutData(const KAboutData &abtData); 00099 00100 void setTitle( const QString &title ); 00101 void setImage( const QString &fileName ); 00102 void setImageBackgroundColor( const QColor &color ); 00103 void setImageFrame( bool state ); 00104 void setProduct( const QString &appName, const QString &version, 00105 const QString &author, const QString &year ); 00106 00107 QFrame *addTextPage( const QString &title, const QString &text, 00108 bool richText=false, int numLines=10 ); 00109 QFrame *addLicensePage( const QString &title, const QString &text, 00110 int numLines=10 ); 00111 KAboutContainer *addContainerPage( const QString &title, 00112 int childAlignment = AlignCenter, int innerAlignment = AlignCenter ); 00113 KAboutContainer *addScrolledContainerPage( const QString &title, 00114 int childAlignment = AlignCenter, int innerAlignment = AlignCenter ); 00115 00116 QFrame *addEmptyPage( const QString &title ); 00117 00118 KAboutContainer *addContainer( int childAlignment, int innerAlignment ); 00119 00120 public slots: 00121 virtual void slotMouseTrack( int mode, const QMouseEvent *e ); 00122 virtual void slotUrlClick( const QString &url ); 00123 virtual void slotMailClick( const QString &name, const QString &address ); 00124 00125 protected: 00126 virtual void fontChange( const QFont &oldFont ); 00127 00128 signals: 00129 void mouseTrack( int mode, const QMouseEvent *e ); 00130 void urlClick( const QString &url ); 00131 void mailClick( const QString &name, const QString &address ); 00132 00133 private: 00134 QMemArray<QWidget*> mContainerList; 00135 00136 QVBoxLayout *mTopLayout; 00137 KRadioImageTrackLabel *mImageLabel; 00138 QLabel *mTitleLabel; 00139 QLabel *mIconLabel; 00140 QLabel *mVersionLabel; 00141 QLabel *mAuthorLabel; 00142 QFrame *mImageFrame; 00143 QTabWidget *mPageTab; 00144 QFrame *mPlainSpace; 00145 }; 00146 00147 00148 #endif