Changeset 2969

Show
Ignore:
Timestamp:
04/28/06 04:39:29 (3 years ago)
Author:
madcat
Message:

0.3 splash.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • hydranode/hngui/main.cpp

    r2941 r2969  
    5555QString imgDir()  { return s_imgDir;  } 
    5656 
     57class Splash : public QSplashScreen { 
     58public: 
     59        Splash(const QPixmap &img); 
     60        void showMessage( 
     61                const QString &message, int alignment = Qt::AlignLeft,  
     62                const QColor &color = Qt::black 
     63        ); 
     64protected: 
     65        void drawContents(QPainter *p); 
     66private: 
     67        QString m_message; 
     68}; 
     69 
     70Splash::Splash(const QPixmap &img) : QSplashScreen(img) { 
     71        setMask( 
     72                QRegion( 
     73                        QPixmap::fromImage( 
     74                                pixmap().toImage().createAlphaMask( 
     75                                        Qt::AutoColor | Qt::DiffuseDither  
     76                                        | Qt::DiffuseAlphaDither 
     77                                ), Qt::AutoColor | Qt::DiffuseDither  
     78                                | Qt::DiffuseAlphaDither 
     79                        ) 
     80                ) 
     81        ); 
     82} 
     83 
     84void Splash::showMessage(const QString &message, int al, const QColor &c) { 
     85        QSplashScreen::showMessage(message, al, c); 
     86        m_message = message; 
     87} 
     88 
     89void Splash::drawContents(QPainter *p) { 
     90        logDebug("Contents drawn."); 
     91//      QSplashScreen::drawContents(p); 
     92        p->setBackground(QColor(0, 0, 0, 0)); 
     93        p->setRenderHint(QPainter::Antialiasing); 
     94        p->setRenderHint(QPainter::SmoothPixmapTransform); 
     95        p->drawPixmap(0, 0, pixmap()); 
     96        p->drawText(4, height() - 46, m_message); 
     97} 
     98 
    5799MainWindow::MainWindow() : m_ecomm(), m_core(), m_ui(), m_corePort(9990), 
    58100m_showTitle(true) { 
    59         m_splash = new QSplashScreen(QPixmap(imgDir() + "splash.png")); 
     101        m_splash = new Splash(QPixmap(imgDir() + "splash.png")); 
    60102        connect( 
    61103                m_splash, SIGNAL(destroyed(QObject*)), 
     
    63105        ); 
    64106        m_splash->show(); 
     107        m_splash->showMessage("Sleeping..."); 
     108        m_splash->repaint(); 
     109        Sleep(30000); 
    65110        setWindowTitle("Hydranode - v0.3"); 
    66111#if 0 
     
    523568                ) 
    524569        ); 
    525  
    526570} 
    527571 
  • hydranode/hngui/main.h

    r2939 r2969  
    3737} 
    3838class EngineComm; 
    39 class QSplashScreen
     39class Splash
    4040class QToolButton; 
    4141 
     
    113113        QWidget          *m_currentPage; 
    114114 
    115         QSplashScreen *m_splash; 
     115        Splash *m_splash; 
    116116        int            m_corePort; 
    117117        QString m_cmdLine; // command-line used for starting core process