new transparent splash-screen without obsolete text-messages

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1018 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-05-25 09:58:23 +00:00
parent 4788517843
commit 08b1cd55cd
5 changed files with 32 additions and 39 deletions

View File

@@ -31,6 +31,8 @@
#include <QtCore/QTimer>
#include <QtCore/QTranslator>
#include <QtGui/QApplication>
#include <QtGui/QBitmap>
#include <QtGui/QPainter>
#include <QtGui/QSplashScreen>
#ifdef HAVE_SCHED_H
@@ -55,8 +57,6 @@ static inline QString baseName( const QString & _file )
}
int splash_alignment_flags = Qt::AlignTop | Qt::AlignLeft;
inline void loadTranslation( const QString & _tname,
const QString & _dir = configManager::inst()->localeDir() )
{
@@ -334,18 +334,29 @@ int main( int argc, char * * argv )
qApp->setPalette( pal );
// init splash screen
QPixmap splash = embed::getIconPixmap( "splash" );
mainWindow::s_splashScreen = new QSplashScreen( splash );
mainWindow::s_splashScreen->show();
// init splash screen - this is a bit difficult as we have a
// semi-transparent splash-image therefore we first need to grab
// the screen, paint the splash onto it and then set a mask
// which covers all pixels which are not fully transparent in
// splash-image - otherwise we get nasty edges etc.
const QPixmap splash = embed::getIconPixmap( "splash" );
const QPoint pt = QApplication::desktop()->
availableGeometry().center() - splash.rect().center();
QPixmap pm = QPixmap::grabWindow(
QApplication::desktop()->winId(),
pt.x(), pt.y(),
splash.width(), splash.height() );
QPainter p( &pm );
p.drawPixmap( 0, 0, splash );
p.end();
mainWindow::s_splashScreen->showMessage( mainWindow::tr(
"Setting up main-"
"window and "
"workspace..." ),
splash_alignment_flags,
Qt::white );
QSplashScreen * ss = new QSplashScreen( pm );
ss->setWindowOpacity( 0.85 );
ss->setMask( splash.alphaChannel().createMaskFromColor( QColor( 0, 0, 0 ) ) );
ss->show();
qApp->processEvents();
// init central engine which handles all components of LMMS
engine::init();
// we try to load given file
@@ -372,9 +383,7 @@ int main( int argc, char * * argv )
engine::getMainWindow()->resize( 200, 500 );
}
delete mainWindow::s_splashScreen;
mainWindow::s_splashScreen = NULL;
delete ss;
}
else
{

View File

@@ -37,7 +37,6 @@
#include <QtGui/QMdiSubWindow>
#include <QtGui/QMenuBar>
#include <QtGui/QMessageBox>
#include <QtGui/QSplashScreen>
#include <QtGui/QSplitter>
@@ -70,9 +69,6 @@
#include "templates.h"
QSplashScreen * mainWindow::s_splashScreen = NULL;
extern int splash_alignment_flags;
mainWindow::mainWindow( void ) :
@@ -190,23 +186,6 @@ mainWindow::~mainWindow()
void mainWindow::finalize( void )
{
if( qApp->argc() > 1 )
{
s_splashScreen->showMessage( tr( "Loading song..." ),
splash_alignment_flags,
Qt::white );
}
else
{
s_splashScreen->showMessage( tr( "Creating new song..." ),
splash_alignment_flags,
Qt::white );
}
s_splashScreen->showMessage( tr( "Creating GUI..." ),
splash_alignment_flags,
Qt::white );
resetWindowTitle();
setWindowIcon( embed::getIconPixmap( "icon" ) );