mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
OP-786 Implemented progress label drawing. Added timer to close splash window 5 seconds after main window opens if not clicked.
This commit is contained in:
parent
365e087128
commit
1246fb1b85
@ -33,6 +33,7 @@ const QChar CopyrightSymbol(0x00a9);
|
||||
GCSSplashScreen::GCSSplashScreen() :
|
||||
QSplashScreen(), m_pixmap(0), m_painter(0)
|
||||
{
|
||||
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
||||
m_pixmap = new QPixmap(":/app/splash.png");
|
||||
|
||||
m_painter = new QPainter(m_pixmap);
|
||||
@ -57,10 +58,19 @@ GCSSplashScreen::~GCSSplashScreen()
|
||||
{
|
||||
}
|
||||
|
||||
void GCSSplashScreen::drawMessageText(const QString &message)
|
||||
{
|
||||
QPixmap pix(*m_pixmap);
|
||||
QPainter progressPainter(&pix);
|
||||
progressPainter.setPen(Qt::lightGray);
|
||||
QFont font("Tahoma", 13);
|
||||
progressPainter.setFont(font);
|
||||
progressPainter.drawText(170, 385, message);
|
||||
setPixmap(pix);
|
||||
}
|
||||
|
||||
void GCSSplashScreen::showPluginLoadingProgress(ExtensionSystem::PluginSpec *pluginSpec)
|
||||
{
|
||||
QFont font("Tahoma", 13);
|
||||
m_painter->setFont(font);
|
||||
m_painter->drawText(170, 385, pluginSpec->name());
|
||||
setPixmap(*m_pixmap);
|
||||
QString message(tr("Loading ") + pluginSpec->name() + " plugin...");
|
||||
drawMessageText(message);
|
||||
}
|
||||
|
@ -42,10 +42,12 @@ public:
|
||||
|
||||
public slots:
|
||||
void showPluginLoadingProgress(ExtensionSystem::PluginSpec *pluginSpec);
|
||||
void showProgressMessage(const QString &message) { drawMessageText(message); }
|
||||
|
||||
private:
|
||||
QPixmap *m_pixmap;
|
||||
QPainter *m_painter;
|
||||
void drawMessageText(const QString &message);
|
||||
|
||||
};
|
||||
|
||||
|
@ -287,6 +287,8 @@ int main(int argc, char **argv)
|
||||
}
|
||||
app.setProperty("qtc_locale", locale); // Do we need this?
|
||||
|
||||
splash.showProgressMessage(QObject::tr("Application starting..."));
|
||||
|
||||
// Load
|
||||
ExtensionSystem::PluginManager pluginManager;
|
||||
pluginManager.setFileExtension(QLatin1String("pluginspec"));
|
||||
@ -356,11 +358,14 @@ int main(int argc, char **argv)
|
||||
|
||||
QObject::connect(&pluginManager, SIGNAL(pluginAboutToBeLoaded(ExtensionSystem::PluginSpec*)),
|
||||
&splash, SLOT(showPluginLoadingProgress(ExtensionSystem::PluginSpec*)));
|
||||
|
||||
pluginManager.loadPlugins();
|
||||
|
||||
if (coreplugin->hasError()) {
|
||||
displayError(msgCoreLoadFailure(coreplugin->errorString()));
|
||||
return 1;
|
||||
}
|
||||
|
||||
{
|
||||
QStringList errors;
|
||||
foreach (ExtensionSystem::PluginSpec *p, pluginManager.plugins())
|
||||
@ -384,7 +389,9 @@ int main(int argc, char **argv)
|
||||
// Do this after the event loop has started
|
||||
QTimer::singleShot(100, &pluginManager, SLOT(startTests()));
|
||||
|
||||
//Close splashscreen
|
||||
splash.close();
|
||||
//Close splashscreen after 5 seconds
|
||||
QTimer::singleShot(5 * 1000, &splash, SLOT(close()));
|
||||
splash.showProgressMessage(QObject::tr("Application started."));
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user