#include "WinSevenTaskbar.h"
#define EPS (1.0E-5)
+#define FADE_DELAY 4
////////////////////////////////////////////////////////////
// Constructor
void SplashScreen::showSplash(QThread *thread)
{
+ double opacity = 0.0;
SplashScreen *splashScreen = new SplashScreen();
//Show splash
splashScreen->m_canClose = false;
- splashScreen->setWindowOpacity(0.0);
+ splashScreen->setWindowOpacity(opacity);
splashScreen->show();
+
+ //Wait for window to show
+ QApplication::processEvents();
+ Sleep(100);
QApplication::processEvents();
- //Setup event loop
+ //Setup the event loop
QEventLoop *loop = new QEventLoop(splashScreen);
connect(thread, SIGNAL(terminated()), loop, SLOT(quit()), Qt::QueuedConnection);
connect(thread, SIGNAL(finished()), loop, SLOT(quit()), Qt::QueuedConnection);
- //Start the thread
+ //Start thread
+ QApplication::processEvents();
thread->start();
- bool flag = false;
+ QApplication::processEvents();
+
+ //Init taskbar
+ WinSevenTaskbar::setTaskbarState(splashScreen, WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
//Fade in
- for(double d = 0.0; d <= 1.0 + EPS; d = d + 0.01)
+ for(int i = 0; i <= 100; i++)
{
- splashScreen->setWindowOpacity(d);
+ opacity = 0.01 * static_cast<double>(i);
+ splashScreen->setWindowOpacity(opacity);
QApplication::processEvents();
- if(!flag) flag = WinSevenTaskbar::setTaskbarState(splashScreen, WinSevenTaskbar::WinSevenTaskbarIndeterminateState);
- Sleep(6);
+ Sleep(FADE_DELAY);
}
//Loop while thread is running
loop->exec();
//Fade out
- for(double d = 1.0; d >= 0.0; d = d - 0.01)
+ for(int i = 100; i >= 0; i--)
{
- splashScreen->setWindowOpacity(d);
+ opacity = 0.01 * static_cast<double>(i);
+ splashScreen->setWindowOpacity(opacity);
QApplication::processEvents();
- Sleep(6);
+ Sleep(FADE_DELAY);
}
//Restore taskbar
splashScreen->m_canClose = true;
splashScreen->close();
+ //Free
LAMEXP_DELETE(loop);
LAMEXP_DELETE(splashScreen);
}
labelVersionInstalled->setText(QString("%1 %2 (%3)").arg(tr("Build"), QString::number(lamexp_version_build()), lamexp_version_date().toString(Qt::ISODate)));
labelVersionLatest->setText(QString("(%1)").arg(tr("Unknown")));
- QTimer::singleShot(0, this, SLOT(updateInit()));
installButton->setEnabled(false);
closeButton->setEnabled(false);
retryButton->setEnabled(false);
progressBar->setMaximum(counter);
progressBar->setValue(0);
+
+ QTimer::singleShot(0, this, SLOT(updateInit()));
}
void UpdateDialog::closeEvent(QCloseEvent *event)
{
setMinimumSize(size());
setMaximumHeight(height());
-
+ QApplication::processEvents();
checkForUpdates();
}