[bt-devel] The splash screen

Eeli Kaikkonen eekaikko at mail.student.oulu.fi
Sat Dec 27 02:39:27 MST 2008


I didn't get the splash screen working, it's broken with many Qt styles. 
I played with QSplashScreen and got nice results. Maybe we could replace 
our kstartuplogo with QSplashScreen? You can test it by disabling the 
creation of kstartuplogo from main.cpp and changing the bibletime.cpp 
constructor:

#include <QSplashScreen>
BibleTime::BibleTime() :
    .....
{
    QPixmap pm;
    if ( !pm.load( 
util::filesystem::DirectoryUtil::getPicsDir().canonicalPath().append("/startuplogo.png")) 
) {
        qWarning("Can't load startuplogo! Check your installation.");
    }
    QSplashScreen splash(pm);
    QString splashHtml("<div 
style='background-color:black;color:white;font-weight:bold'>%1</div>");
    if (CBTConfig::get(CBTConfig::logo)) {
        splash.show();
    }
    splash.showMessage(splashHtml.arg(tr("Initializing the Sword 
engine...")), Qt::AlignCenter);
    initBackends();
    splash.showMessage(splashHtml.arg(tr("Creating BibleTime's user 
interface...")), Qt::AlignCenter);
    initView();
    splash.showMessage(splashHtml.arg(tr("Initializing menu- and 
toolbars...")), Qt::AlignCenter);
    initActions();
    initConnections();
    readSettings();
    setPlainCaption(QString());
}


The current implementation is nice but it's quite much needless, 
regarding the nature of a splash screen in general. We would save couple 
of files and some code lines by using the Qt equivalent. This would also 
have the advantage of playing nicely with different text sizes and 
lengths. The current one has only one text line, hiding the text which 
doesn't fit, and when the display resolutions go higher the 
pixmap/splash window width will get smaller compared to text width.

Using the Qt class would also be safe with all platforms. We don't know 
how the current one behaves e.g. on Windows.


--Eeli Kaikkonen



More information about the bt-devel mailing list