More improvements to Splash Screen.

This commit is contained in:
LoRd_MuldeR 2013-11-24 00:02:32 +01:00
parent 5fa1b19eb8
commit 1f98e90244
7 changed files with 114 additions and 69 deletions

View File

@ -294,11 +294,11 @@
</message>
<message>
<source>BerliOS Developer</source>
<translation>Розробник BerliOS</translation>
<translation type="unfinished"></translation>
</message>
<message>
<source>CodePlex</source>
<translation>CodePlex</translation>
<translation type="unfinished"></translation>
</message>
</context>
<context>
@ -2751,7 +2751,7 @@
</message>
<message>
<source>Initializing, please wait...</source>
<translation>Ініціалізація, будь ласка, зачекайте...</translation>
<translation type="unfinished">Ініціалізація, будь ласка, зачекайте...</translation>
</message>
</context>
</TS>

View File

@ -2,6 +2,9 @@
<ui version="4.0">
<class>SplashScreen</class>
<widget class="QFrame" name="SplashScreen">
<property name="windowModality">
<enum>Qt::ApplicationModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
@ -34,9 +37,9 @@
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
<red>41</red>
<green>58</green>
<blue>86</blue>
</color>
</brush>
</colorrole>
@ -63,9 +66,9 @@
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
<red>41</red>
<green>58</green>
<blue>86</blue>
</color>
</brush>
</colorrole>
@ -83,18 +86,18 @@
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
<red>41</red>
<green>58</green>
<blue>86</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>0</red>
<green>0</green>
<blue>0</blue>
<red>41</red>
<green>58</green>
<blue>86</blue>
</color>
</brush>
</colorrole>
@ -104,10 +107,6 @@
<property name="windowTitle">
<string>LameXP is launching...</string>
</property>
<property name="windowIcon">
<iconset resource="../res/Images.qrc">
<normaloff>:/images/Loading2.gif</normaloff>:/images/Loading2.gif</iconset>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>

View File

@ -1,31 +1,32 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource>
<file>images/Announcement.png</file>
<file>images/Busy.gif</file>
<file>images/Cartoon.png</file>
<file>images/CD.png</file>
<file>images/Disque.png</file>
<file>images/DropBox.png</file>
<qresource>
<file>images/Announcement.png</file>
<file>images/Background.jpg</file>
<file>images/Busy.gif</file>
<file>images/Cartoon.png</file>
<file>images/CD.png</file>
<file>images/Disque.png</file>
<file>images/DropBox.png</file>
<file>images/DropZone.png</file>
<file>images/HeaderIcon_CueImport.png</file>
<file>images/HeaderIcon_LogFile.png</file>
<file>images/HeaderIcon_MetaInfo.png</file>
<file>images/Label.png</file>
<file>images/Loading.gif</file>
<file>images/Loading2.gif</file>
<file>images/Loading3.gif</file>
<file>images/HeaderIcon_LogFile.png</file>
<file>images/HeaderIcon_MetaInfo.png</file>
<file>images/Label.png</file>
<file>images/Loading.gif</file>
<file>images/Loading2.gif</file>
<file>images/Loading3.gif</file>
<file>images/Loading4.gif</file>
<file>images/Logo.png</file>
<file>images/Logo_Contributors.png</file>
<file>images/Logo_GNU.png</file>
<file>images/Logo_Software.png</file>
<file>images/Qt.svg</file>
<file>images/Splash.png</file>
<file>images/Logo_Contributors.png</file>
<file>images/Logo_GNU.png</file>
<file>images/Logo_Software.png</file>
<file>images/Qt.svg</file>
<file>images/Splash.png</file>
<file>images/Sound.png</file>
<file>images/Starting.png</file>
<file>images/Thumb.png</file>
<file>images/Wizard.png</file>
<file>images/Working.gif</file>
</qresource>
<file>images/Wizard.png</file>
<file>images/Working.gif</file>
</qresource>
</RCC>

BIN
res/images/Background.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -35,7 +35,7 @@
#define VER_LAMEXP_MINOR_LO 9
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 8
#define VER_LAMEXP_BUILD 1462
#define VER_LAMEXP_BUILD 1464
#define VER_LAMEXP_CONFG 1348
///////////////////////////////////////////////////////////////////////////////

View File

@ -61,8 +61,8 @@ SplashScreen::SplashScreen(QWidget *parent)
setupUi(this);
//Make size fixed
setFixedSize(this->maximumSize());
setFixedSize(this->size());
//Create event loop
m_loop = new QEventLoop(this);
@ -75,7 +75,10 @@ SplashScreen::SplashScreen(QWidget *parent)
connect(m_timer, SIGNAL(timeout()), this, SLOT(updateHandler()));
//Enable "sheet of glass" effect on splash screen
lamexp_sheet_of_glass(this);
if(!lamexp_sheet_of_glass(this))
{
setStyleSheet("background-image: url(:/images/Background.jpg)");
}
//Start animation
m_working = new QMovie(":/images/Loading4.gif");
@ -83,9 +86,6 @@ SplashScreen::SplashScreen(QWidget *parent)
labelLoading->setMovie(m_working);
m_working->start();
//Set wait cursor
setCursor(Qt::WaitCursor);
//Init status
m_canClose = false;
m_status = STATUS_FADE_IN;
@ -116,11 +116,14 @@ SplashScreen::~SplashScreen(void)
void SplashScreen::showSplash(QThread *thread)
{
SplashScreen *splashScreen = new SplashScreen();
//Show splash
splashScreen->setWindowOpacity(OPACITY_DELTA);
splashScreen->show();
//Set wait cursor
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
//Wait for window to show
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
splashScreen->repaint();
@ -136,7 +139,7 @@ void SplashScreen::showSplash(QThread *thread)
//Start the thread
splashScreen->m_timer->start(FADE_DELAY);
QTimer::singleShot(8*60*1000, splashScreen->m_loop, SLOT(quit()));
QTimer::singleShot(0, thread, SLOT(start()));
QTimer::singleShot(333, thread, SLOT(start()));
//Start event handling!
const int ret = splashScreen->m_loop->exec(QEventLoop::ExcludeUserInputEvents);
@ -151,6 +154,9 @@ void SplashScreen::showSplash(QThread *thread)
//Restore taskbar
SET_TASKBAR_STATE(splashScreen, splashScreen->m_taskBarInit, false);
//Restore cursor
QApplication::restoreOverrideCursor();
//Hide splash
splashScreen->m_canClose = true;
splashScreen->close();

View File

@ -169,6 +169,17 @@ static struct
}
g_lamexp_themes_enabled;
//Win32 DWM API functions
static struct
{
bool bInitialized;
QLibrary *dwmapi_dll;
HRESULT (__stdcall *dwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS* pMarInset);
HRESULT (__stdcall *dwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind);
QReadWriteLock lock;
}
g_lamexp_dwmapi;
//Image formats
static const char *g_lamexp_imageformats[] = {"bmp", "png", "jpg", "gif", "ico", "xpm", NULL}; //"svg"
@ -1846,39 +1857,61 @@ bool lamexp_open_media_file(const QString &mediaFilePath)
return false;
}
bool lamexp_sheet_of_glass(QWidget *window)
static void lamexp_init_dwmapi(void)
{
typedef HRESULT (__stdcall *dwmExtendFrameIntoClientArea_t)(HWND hWnd, const MARGINS* pMarInset);
typedef HRESULT (__stdcall *dwmEnableBlurBehindWindow_t)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind);
QReadLocker writeLock(&g_lamexp_dwmapi.lock);
//Not initialized yet?
if(g_lamexp_dwmapi.bInitialized)
{
return;
}
//Does OS support DWM?
if(lamexp_get_os_version() < lamexp_winver_vista)
if(lamexp_get_os_version() >= lamexp_winver_vista)
{
return false;
//Load DWMAPI.DLL
g_lamexp_dwmapi.dwmapi_dll = new QLibrary("dwmapi.dll");
if(g_lamexp_dwmapi.dwmapi_dll->load())
{
//Lookup required functions
g_lamexp_dwmapi.dwmExtendFrameIntoClientArea = (HRESULT (__stdcall*)(HWND, const MARGINS*)) g_lamexp_dwmapi.dwmapi_dll->resolve("DwmExtendFrameIntoClientArea");
g_lamexp_dwmapi.dwmEnableBlurBehindWindow = (HRESULT (__stdcall*)(HWND, const DWM_BLURBEHIND*)) g_lamexp_dwmapi.dwmapi_dll->resolve("DwmEnableBlurBehindWindow");
}
else
{
LAMEXP_DELETE(g_lamexp_dwmapi.dwmapi_dll);
qWarning("Failed to load DWMAPI.DLL on a DWM-enabled system!");
}
}
//Load DWMAPI.DLL
QLibrary libDwm("dwmapi.dll");
if(!libDwm.load())
{
qWarning("Failed to load DWMAPI.DLL on a DWM-enabled system!");
return false;
}
g_lamexp_dwmapi.bInitialized = true;
}
//Lookup required functions
dwmExtendFrameIntoClientArea_t dwmExtendFrameIntoClientArea = (dwmExtendFrameIntoClientArea_t) libDwm.resolve("DwmExtendFrameIntoClientArea");
dwmEnableBlurBehindWindow_t dwmEnableBlurBehindWindow = (dwmEnableBlurBehindWindow_t) libDwm.resolve("DwmEnableBlurBehindWindow");
/*
* Enable "sheet of glass" effect on the given Window
*/
bool lamexp_sheet_of_glass(QWidget *window)
{
QReadLocker readLock(&g_lamexp_dwmapi.lock);
//Initialize the DWM API
while(!g_lamexp_dwmapi.bInitialized)
{
readLock.unlock();
lamexp_init_dwmapi();
readLock.relock();
}
//Check function pointers
if((dwmExtendFrameIntoClientArea == NULL) || (dwmEnableBlurBehindWindow == NULL))
//Required functions available?
if((g_lamexp_dwmapi.dwmExtendFrameIntoClientArea == NULL) || (g_lamexp_dwmapi.dwmEnableBlurBehindWindow == NULL))
{
qWarning("Required functions are missing from DWMAPI.DLL on a DWM-enabled system!");
return false;
}
//Enable the "sheet of glass" effect on this window
MARGINS margins = {-1, -1, -1, -1};
if(HRESULT hr = dwmExtendFrameIntoClientArea(window->winId(), &margins))
if(HRESULT hr = g_lamexp_dwmapi.dwmExtendFrameIntoClientArea(window->winId(), &margins))
{
qWarning("DwmExtendFrameIntoClientArea function has failed! (error %d)", hr);
return false;
@ -1889,7 +1922,7 @@ bool lamexp_sheet_of_glass(QWidget *window)
memset(&bb, 0, sizeof(DWM_BLURBEHIND));
bb.fEnable = TRUE;
bb.dwFlags = DWM_BB_ENABLE;
if(HRESULT hr = dwmEnableBlurBehindWindow(window->winId(), &bb))
if(HRESULT hr = g_lamexp_dwmapi.dwmEnableBlurBehindWindow(window->winId(), &bb))
{
qWarning("DwmEnableBlurBehindWindow function has failed! (error %d)", hr);
return false;
@ -1975,6 +2008,11 @@ void lamexp_finalization(void)
QApplication *application = dynamic_cast<QApplication*>(QApplication::instance());
LAMEXP_DELETE(application);
//Release DWM API
g_lamexp_dwmapi.dwmEnableBlurBehindWindow = NULL;
g_lamexp_dwmapi.dwmExtendFrameIntoClientArea = NULL;
LAMEXP_DELETE(g_lamexp_dwmapi.dwmapi_dll);
//Detach from shared memory
lamexp_ipc_exit();
@ -2062,4 +2100,5 @@ extern "C" void _lamexp_global_init_win32(void)
LAMEXP_ZERO_MEMORY(g_lamexp_os_version);
LAMEXP_ZERO_MEMORY(g_lamexp_wine);
LAMEXP_ZERO_MEMORY(g_lamexp_themes_enabled);
LAMEXP_ZERO_MEMORY(g_lamexp_dwmapi);
}