00001 /*************************************************************************** 00002 celsplashscreen.h - description 00003 ------------------- 00004 begin : Tue Jan 03 23:27:30 CET 2006 00005 copyright : (C) 2006 by Christophe Teyssier 00006 email : chris@teyssier.org 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 #include <vector> 00019 #include <qpainter.h> 00020 #include <qwidget.h> 00021 #include <qstring.h> 00022 #include <qpixmap.h> 00023 #include <qrect.h> 00024 #include <qcolor.h> 00025 #include <qfont.h> 00026 #include <kfilemetainfo.h> 00027 #include <celestiacore.h> 00028 00029 class TextItem { 00030 public: 00031 TextItem(); 00032 QRect& getRect() { return rect; } 00033 void set(const QString& prefix, const KFileMetaInfoGroup& info); 00034 void setFlags(int f) { flags = f; }; 00035 void setColor(const QString& rgb); 00036 void setFont(const QFont& _font) { font = _font; } 00037 void setContent(const QString& value) { content = value; } 00038 00039 virtual ~TextItem() {}; 00040 virtual void draw(QPainter* painter) const; 00041 00042 protected: 00043 bool disable; 00044 QRect rect; 00045 int flags; 00046 QColor color; 00047 QFont font; 00048 QString content; 00049 QString insertBefore; 00050 bool showBox; 00051 }; 00052 00053 class CelSplashScreen:public QWidget, virtual public ProgressNotifier 00054 { 00055 Q_OBJECT 00056 00057 public: 00058 CelSplashScreen(const QString& filename, QWidget* parent); 00059 virtual ~CelSplashScreen() {}; 00060 void setPixmap( const QString &filename ); 00061 virtual void update(const string& message); 00062 void repaint(); 00063 void finish( QWidget *w ); 00064 00065 protected: 00066 virtual void drawContents(QPainter *painter); 00067 void mousePressEvent( QMouseEvent * ); 00068 00069 private: 00070 void drawContents(); 00071 QPixmap pixmap; 00072 QWidget* parent; 00073 TextItem version; 00074 TextItem status; 00075 std::vector<TextItem> extraText; 00076 }; 00077
1.4.1