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

View File

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

View File

@ -2,6 +2,7 @@
<RCC version="1.0"> <RCC version="1.0">
<qresource> <qresource>
<file>images/Announcement.png</file> <file>images/Announcement.png</file>
<file>images/Background.jpg</file>
<file>images/Busy.gif</file> <file>images/Busy.gif</file>
<file>images/Cartoon.png</file> <file>images/Cartoon.png</file>
<file>images/CD.png</file> <file>images/CD.png</file>

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_MINOR_LO 9
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 8 #define VER_LAMEXP_PATCH 8
#define VER_LAMEXP_BUILD 1462 #define VER_LAMEXP_BUILD 1464
#define VER_LAMEXP_CONFG 1348 #define VER_LAMEXP_CONFG 1348
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

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

View File

@ -169,6 +169,17 @@ static struct
} }
g_lamexp_themes_enabled; 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 //Image formats
static const char *g_lamexp_imageformats[] = {"bmp", "png", "jpg", "gif", "ico", "xpm", NULL}; //"svg" 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; 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); QReadLocker writeLock(&g_lamexp_dwmapi.lock);
typedef HRESULT (__stdcall *dwmEnableBlurBehindWindow_t)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind);
//Not initialized yet?
if(g_lamexp_dwmapi.bInitialized)
{
return;
}
//Does OS support DWM? //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 //Load DWMAPI.DLL
QLibrary libDwm("dwmapi.dll"); g_lamexp_dwmapi.dwmapi_dll = new QLibrary("dwmapi.dll");
if(!libDwm.load()) 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!"); qWarning("Failed to load DWMAPI.DLL on a DWM-enabled system!");
return false; }
} }
//Lookup required functions g_lamexp_dwmapi.bInitialized = true;
dwmExtendFrameIntoClientArea_t dwmExtendFrameIntoClientArea = (dwmExtendFrameIntoClientArea_t) libDwm.resolve("DwmExtendFrameIntoClientArea"); }
dwmEnableBlurBehindWindow_t dwmEnableBlurBehindWindow = (dwmEnableBlurBehindWindow_t) libDwm.resolve("DwmEnableBlurBehindWindow");
//Check function pointers /*
if((dwmExtendFrameIntoClientArea == NULL) || (dwmEnableBlurBehindWindow == NULL)) * 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();
}
//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; return false;
} }
//Enable the "sheet of glass" effect on this window //Enable the "sheet of glass" effect on this window
MARGINS margins = {-1, -1, -1, -1}; 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); qWarning("DwmExtendFrameIntoClientArea function has failed! (error %d)", hr);
return false; return false;
@ -1889,7 +1922,7 @@ bool lamexp_sheet_of_glass(QWidget *window)
memset(&bb, 0, sizeof(DWM_BLURBEHIND)); memset(&bb, 0, sizeof(DWM_BLURBEHIND));
bb.fEnable = TRUE; bb.fEnable = TRUE;
bb.dwFlags = DWM_BB_ENABLE; 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); qWarning("DwmEnableBlurBehindWindow function has failed! (error %d)", hr);
return false; return false;
@ -1975,6 +2008,11 @@ void lamexp_finalization(void)
QApplication *application = dynamic_cast<QApplication*>(QApplication::instance()); QApplication *application = dynamic_cast<QApplication*>(QApplication::instance());
LAMEXP_DELETE(application); 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 //Detach from shared memory
lamexp_ipc_exit(); 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_os_version);
LAMEXP_ZERO_MEMORY(g_lamexp_wine); LAMEXP_ZERO_MEMORY(g_lamexp_wine);
LAMEXP_ZERO_MEMORY(g_lamexp_themes_enabled); LAMEXP_ZERO_MEMORY(g_lamexp_themes_enabled);
LAMEXP_ZERO_MEMORY(g_lamexp_dwmapi);
} }