Make sure the Taskbar state is set properly in the Splash screen.

This commit is contained in:
LoRd_MuldeR 2013-03-29 03:07:15 +01:00
parent 6ba1f0e5d1
commit d139d11d71

View File

@ -38,6 +38,18 @@
/* If, after 50 ms, the wait() function returns with FALSE, then the thread probably is still running and we return TRUE. Otherwise we can return FALSE. */ /* If, after 50 ms, the wait() function returns with FALSE, then the thread probably is still running and we return TRUE. Otherwise we can return FALSE. */
#define THREAD_RUNNING(THRD) (((THRD)->isRunning()) ? (!((THRD)->wait(50))) : false) #define THREAD_RUNNING(THRD) (((THRD)->isRunning()) ? (!((THRD)->wait(50))) : false)
#define SET_TASKBAR_STATE(FLAG) do \
{ \
if(FLAG) \
{ \
if(!bTaskBar) bTaskBar = WinSevenTaskbar::setTaskbarState(splashScreen, WinSevenTaskbar::WinSevenTaskbarIndeterminateState); \
} \
else \
{ \
if(bTaskBar) bTaskBar = (!WinSevenTaskbar::setTaskbarState(splashScreen, WinSevenTaskbar::WinSevenTaskbarNoState)); \
} \
} \
while(0)
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Constructor // Constructor
@ -85,6 +97,7 @@ void SplashScreen::showSplash(QThread *thread)
double opacity = OPACITY_DELTA; double opacity = OPACITY_DELTA;
const int opacitySteps = qRound(1.0 / OPACITY_DELTA); const int opacitySteps = qRound(1.0 / OPACITY_DELTA);
SplashScreen *splashScreen = new SplashScreen(); SplashScreen *splashScreen = new SplashScreen();
bool bTaskBar = false;
//Show splash //Show splash
splashScreen->m_canClose = false; splashScreen->m_canClose = false;
@ -112,14 +125,15 @@ void SplashScreen::showSplash(QThread *thread)
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
//Init taskbar //Init taskbar
WinSevenTaskbar::setTaskbarState(splashScreen, WinSevenTaskbar::WinSevenTaskbarIndeterminateState); SET_TASKBAR_STATE(true);
//Fade in //Fade in
for(int i = 1; i <= opacitySteps; i++) for(int i = 1; i <= opacitySteps; i++)
{ {
opacity = OPACITY_DELTA * static_cast<double>(i); opacity = (i < opacitySteps) ? (OPACITY_DELTA * static_cast<double>(i)) : 1.0;
splashScreen->setWindowOpacity(opacity); splashScreen->setWindowOpacity(opacity);
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents, FADE_DELAY); QApplication::processEvents(QEventLoop::ExcludeUserInputEvents, FADE_DELAY);
SET_TASKBAR_STATE(true);
Sleep(FADE_DELAY); Sleep(FADE_DELAY);
} }
@ -152,7 +166,7 @@ void SplashScreen::showSplash(QThread *thread)
} }
//Restore taskbar //Restore taskbar
WinSevenTaskbar::setTaskbarState(splashScreen, WinSevenTaskbar::WinSevenTaskbarNoState); SET_TASKBAR_STATE(false);
//Hide splash //Hide splash
splashScreen->m_canClose = true; splashScreen->m_canClose = true;