Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef QTXSPLASH_H
00027 #define QTXSPLASH_H
00028
00029 #include "Qtx.h"
00030
00031 #include <QWidget>
00032 #include <QPixmap>
00033 #include <QGradient>
00034 #include <QMap>
00035
00036 #ifdef WIN32
00037 #pragma warning( disable:4251 )
00038 #endif
00039
00040 class QtxResourceMgr;
00041
00042 class QTX_EXPORT QtxSplash : public QWidget
00043 {
00044 Q_OBJECT
00045
00046 private:
00047 QtxSplash( const QPixmap& );
00048
00049 public:
00051 typedef enum {
00052 LeftSide = 0x0001,
00053 RightSide = 0x0002,
00054 TopSide = 0x0004,
00055 BottomSide = 0x0008,
00056 LeftToRight = 0x0010,
00057 RightToLeft = 0x0020
00058 } ProgressBarFlags;
00059
00060 virtual ~QtxSplash();
00061
00062 static QtxSplash* splash( const QPixmap& = QPixmap() );
00063
00064 static void setStatus( const QString&, const int = -1 );
00065 static void setError( const QString&, const QString& = QString(), const int = -1 );
00066
00067 void setPixmap( const QPixmap& );
00068 QPixmap pixmap() const;
00069
00070 void setHideOnClick( const bool );
00071 bool hideOnClick() const;
00072
00073 void setProgressVisible( const bool );
00074 bool progressVisible() const;
00075
00076 void setMessageVisible( const bool );
00077 bool messageVisible() const;
00078
00079 void setPercentageVisible( const bool );
00080 bool percentageVisible() const;
00081
00082 void setTotalSteps( const int );
00083 int totalSteps() const;
00084
00085 void setProgress( const int );
00086 void setProgress( const int, const int );
00087 int progress() const;
00088
00089 void setMargin( const int );
00090 int margin() const;
00091
00092 void setProgressWidth( const int );
00093 int progressWidth() const;
00094
00095 void setProgressFlags( const int );
00096 int progressFlags() const;
00097
00098 void setProgressColors( const QColor&,
00099 const QColor& = QColor(),
00100 const Qt::Orientation = Qt::Vertical );
00101 void setProgressColors( const QGradient& );
00102 const QGradient* progressColors() const;
00103
00104 void setOpacity( const double );
00105 double opacity() const;
00106
00107 void setTextAlignment( const int );
00108 int textAlignment() const;
00109
00110 void setTextColors( const QColor&, const QColor& = QColor() );
00111 void textColors( QColor&, QColor& ) const;
00112
00113 void setConstantInfo( const QString& info );
00114 QString constantInfo() const;
00115
00116 void setOption( const QString&, const QString& );
00117 QString option( const QString& ) const;
00118
00119 QString message() const;
00120
00121 int error() const;
00122
00123 void finish( QWidget* );
00124 void repaint();
00125
00126 void readSettings( QtxResourceMgr*, const QString& = QString() );
00127
00128 public slots:
00129 void setMessage( const QString&,
00130 const int,
00131 const QColor& = QColor() );
00132 void setMessage( const QString& );
00133 void clear();
00134
00135 protected:
00136 virtual void mousePressEvent( QMouseEvent* );
00137 virtual void customEvent( QEvent* );
00138 virtual void paintEvent( QPaintEvent* );
00139
00140 virtual void drawContents( QPainter* );
00141
00142 virtual void drawProgressBar( QPainter* );
00143 virtual void drawMessage( QPainter* );
00144
00145 private:
00146 void drawContents();
00147 void setError( const int );
00148 QString fullMessage() const;
00149
00150 private:
00151 typedef QMap<QString, QString> OptMap;
00152
00153 private:
00154 static QtxSplash* mySplash;
00155
00156 QPixmap myPixmap;
00157 QString myInfo;
00158 QString myMessage;
00159 int myAlignment;
00160 QColor myColor;
00161 QColor myShadowColor;
00162 bool myHideOnClick;
00163 int myProgress;
00164 int myTotal;
00165 QGradient myGradient;
00166 int myProgressWidth;
00167 int myProgressFlags;
00168 int myMargin;
00169 double myOpacity;
00170 int myError;
00171 OptMap myOptions;
00172 bool myShowProgress;
00173 bool myShowMessage;
00174 bool myShowPercent;
00175 };
00176
00177 #endif