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
eccdf5fa91
commit
90b72798c4
@ -33,6 +33,7 @@ const QChar CopyrightSymbol(0x00a9);
|
|||||||
GCSSplashScreen::GCSSplashScreen() :
|
GCSSplashScreen::GCSSplashScreen() :
|
||||||
QSplashScreen(), m_pixmap(0), m_painter(0)
|
QSplashScreen(), m_pixmap(0), m_painter(0)
|
||||||
{
|
{
|
||||||
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
||||||
m_pixmap = new QPixmap(":/app/splash.png");
|
m_pixmap = new QPixmap(":/app/splash.png");
|
||||||
|
|
||||||
m_painter = new QPainter(m_pixmap);
|
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)
|
void GCSSplashScreen::showPluginLoadingProgress(ExtensionSystem::PluginSpec *pluginSpec)
|
||||||
{
|
{
|
||||||
QFont font("Tahoma", 13);
|
QString message(tr("Loading ") + pluginSpec->name() + " plugin...");
|
||||||
m_painter->setFont(font);
|
drawMessageText(message);
|
||||||
m_painter->drawText(170, 385, pluginSpec->name());
|
|
||||||
setPixmap(*m_pixmap);
|
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,12 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showPluginLoadingProgress(ExtensionSystem::PluginSpec *pluginSpec);
|
void showPluginLoadingProgress(ExtensionSystem::PluginSpec *pluginSpec);
|
||||||
|
void showProgressMessage(const QString &message) { drawMessageText(message); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPixmap *m_pixmap;
|
QPixmap *m_pixmap;
|
||||||
QPainter *m_painter;
|
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?
|
app.setProperty("qtc_locale", locale); // Do we need this?
|
||||||
|
|
||||||
|
splash.showProgressMessage(QObject::tr("Application starting..."));
|
||||||
|
|
||||||
// Load
|
// Load
|
||||||
ExtensionSystem::PluginManager pluginManager;
|
ExtensionSystem::PluginManager pluginManager;
|
||||||
pluginManager.setFileExtension(QLatin1String("pluginspec"));
|
pluginManager.setFileExtension(QLatin1String("pluginspec"));
|
||||||
@ -356,11 +358,14 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
QObject::connect(&pluginManager, SIGNAL(pluginAboutToBeLoaded(ExtensionSystem::PluginSpec*)),
|
QObject::connect(&pluginManager, SIGNAL(pluginAboutToBeLoaded(ExtensionSystem::PluginSpec*)),
|
||||||
&splash, SLOT(showPluginLoadingProgress(ExtensionSystem::PluginSpec*)));
|
&splash, SLOT(showPluginLoadingProgress(ExtensionSystem::PluginSpec*)));
|
||||||
|
|
||||||
pluginManager.loadPlugins();
|
pluginManager.loadPlugins();
|
||||||
|
|
||||||
if (coreplugin->hasError()) {
|
if (coreplugin->hasError()) {
|
||||||
displayError(msgCoreLoadFailure(coreplugin->errorString()));
|
displayError(msgCoreLoadFailure(coreplugin->errorString()));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QStringList errors;
|
QStringList errors;
|
||||||
foreach (ExtensionSystem::PluginSpec *p, pluginManager.plugins())
|
foreach (ExtensionSystem::PluginSpec *p, pluginManager.plugins())
|
||||||
@ -384,7 +389,9 @@ int main(int argc, char **argv)
|
|||||||
// Do this after the event loop has started
|
// Do this after the event loop has started
|
||||||
QTimer::singleShot(100, &pluginManager, SLOT(startTests()));
|
QTimer::singleShot(100, &pluginManager, SLOT(startTests()));
|
||||||
|
|
||||||
//Close splashscreen
|
//Close splashscreen after 5 seconds
|
||||||
splash.close();
|
QTimer::singleShot(5 * 1000, &splash, SLOT(close()));
|
||||||
|
splash.showProgressMessage(QObject::tr("Application started."));
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user