diff --git a/ground/openpilotgcs/src/app/app.pro b/ground/openpilotgcs/src/app/app.pro index d3fdc8d6d..8dc7d9533 100644 --- a/ground/openpilotgcs/src/app/app.pro +++ b/ground/openpilotgcs/src/app/app.pro @@ -5,7 +5,8 @@ TEMPLATE = app TARGET = $$GCS_APP_TARGET DESTDIR = $$GCS_APP_PATH QT += xml -SOURCES += main.cpp +SOURCES += main.cpp \ + gcssplashscreen.cpp include(../rpath.pri) include(../libs/utils/utils.pri) @@ -31,3 +32,6 @@ OTHER_FILES += openpilotgcs.rc RESOURCES += \ appresources.qrc + +HEADERS += \ + gcssplashscreen.h diff --git a/ground/openpilotgcs/src/app/appresources.qrc b/ground/openpilotgcs/src/app/appresources.qrc index 4b10fa76d..2108b63fd 100644 --- a/ground/openpilotgcs/src/app/appresources.qrc +++ b/ground/openpilotgcs/src/app/appresources.qrc @@ -1,5 +1,5 @@ - loadingblue13.gif + splash.png diff --git a/ground/openpilotgcs/src/app/gcssplashscreen.cpp b/ground/openpilotgcs/src/app/gcssplashscreen.cpp new file mode 100644 index 000000000..fb577625f --- /dev/null +++ b/ground/openpilotgcs/src/app/gcssplashscreen.cpp @@ -0,0 +1,66 @@ +/** + ****************************************************************************** + * + * @file gcssplashscreen.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. + * @addtogroup [Group] + * @{ + * @addtogroup GCSSplashScreen + * @{ + * @brief [Brief] + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "gcssplashscreen.h" +#include + +const QChar CopyrightSymbol(0x00a9); + +GCSSplashScreen::GCSSplashScreen() : + QSplashScreen(), m_pixmap(0), m_painter(0) +{ + m_pixmap = new QPixmap(":/app/splash.png"); + + m_painter = new QPainter(m_pixmap); + m_painter->setPen(Qt::lightGray); + QFont font("Tahoma", 8); + m_painter->setFont(font); + m_painter->drawText(405, 170, QString(CopyrightSymbol) + + QString(tr("2010-2013 The OpenPilot Project - All Rights Reserved"))); + QString revision; + +#ifdef GCS_REVISION + revision = GCS_REVISION; +#else + revision = tr("N/A"); +#endif + + m_painter->drawText(405, 190, QString(tr("GCS Revision - ")) + revision); + setPixmap(*m_pixmap); +} + +GCSSplashScreen::~GCSSplashScreen() +{ +} + +void GCSSplashScreen::showPluginLoadingProgress(ExtensionSystem::PluginSpec *pluginSpec) +{ + QFont font("Tahoma", 13); + m_painter->setFont(font); + m_painter->drawText(170, 385, pluginSpec->name()); + setPixmap(*m_pixmap); +} diff --git a/ground/openpilotgcs/src/app/gcssplashscreen.h b/ground/openpilotgcs/src/app/gcssplashscreen.h new file mode 100644 index 000000000..579edcceb --- /dev/null +++ b/ground/openpilotgcs/src/app/gcssplashscreen.h @@ -0,0 +1,52 @@ +/** + ****************************************************************************** + * + * @file gcssplashscreen.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. + * @addtogroup [Group] + * @{ + * @addtogroup GCSSplashScreen + * @{ + * @brief [Brief] + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef GCSSPLASHSCREEN_H +#define GCSSPLASHSCREEN_H + +#include +#include +#include +#include + +class GCSSplashScreen : public QSplashScreen +{ + Q_OBJECT +public: + explicit GCSSplashScreen(); + ~GCSSplashScreen(); + +public slots: + void showPluginLoadingProgress(ExtensionSystem::PluginSpec *pluginSpec); + +private: + QPixmap *m_pixmap; + QPainter *m_painter; + +}; + +#endif // GCSSPLASHSCREEN_H diff --git a/ground/openpilotgcs/src/app/loadingblue13.gif b/ground/openpilotgcs/src/app/loadingblue13.gif deleted file mode 100644 index c49bab4b3..000000000 Binary files a/ground/openpilotgcs/src/app/loadingblue13.gif and /dev/null differ diff --git a/ground/openpilotgcs/src/app/main.cpp b/ground/openpilotgcs/src/app/main.cpp index fb6ccd774..3d0161d0f 100644 --- a/ground/openpilotgcs/src/app/main.cpp +++ b/ground/openpilotgcs/src/app/main.cpp @@ -28,6 +28,7 @@ #include "qtsingleapplication.h" #include "utils/xmlconfig.h" +#include "gcssplashscreen.h" #include #include @@ -47,6 +48,7 @@ #include #include #include +#include enum { OptionIndent = 4, DescriptionIndent = 24 }; @@ -252,8 +254,7 @@ int main(int argc, char **argv) SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv); //Open Splashscreen - QPixmap logoPixmap(":/app/loadingblue13.gif"); - QSplashScreen splash(logoPixmap); + GCSSplashScreen splash; splash.show(); QString locale = QLocale::system().name(); @@ -325,7 +326,7 @@ int main(int argc, char **argv) break; } } - if (!coreplugin) { + if(!coreplugin){ QString nativePaths = QDir::toNativeSeparators(pluginPaths.join(QLatin1String(","))); const QString reason = QCoreApplication::translate("Application", "Could not find 'Core.pluginspec' in %1").arg(nativePaths); displayError(msgCoreLoadFailure(reason)); @@ -353,6 +354,8 @@ int main(int argc, char **argv) if (!isFirstInstance && foundAppOptions.contains(QLatin1String(CLIENT_OPTION))) return sendArguments(app, pluginManager.arguments()) ? 0 : -1; + QObject::connect(&pluginManager, SIGNAL(pluginAboutToBeLoaded(ExtensionSystem::PluginSpec*)), + &splash, SLOT(showPluginLoadingProgress(ExtensionSystem::PluginSpec*))); pluginManager.loadPlugins(); if (coreplugin->hasError()) { displayError(msgCoreLoadFailure(coreplugin->errorString())); diff --git a/ground/openpilotgcs/src/app/splash.png b/ground/openpilotgcs/src/app/splash.png new file mode 100644 index 000000000..bd644a5c1 Binary files /dev/null and b/ground/openpilotgcs/src/app/splash.png differ diff --git a/ground/openpilotgcs/src/libs/extensionsystem/pluginmanager.cpp b/ground/openpilotgcs/src/libs/extensionsystem/pluginmanager.cpp index d8e637802..e29c1644e 100644 --- a/ground/openpilotgcs/src/libs/extensionsystem/pluginmanager.cpp +++ b/ground/openpilotgcs/src/libs/extensionsystem/pluginmanager.cpp @@ -583,7 +583,9 @@ void PluginManagerPrivate::loadPlugins() QListIterator it(queue); it.toBack(); while (it.hasPrevious()) { - loadPlugin(it.previous(), PluginSpec::Running); + PluginSpec* plugin = it.previous(); + emit q->pluginAboutToBeLoaded(plugin); + loadPlugin(plugin, PluginSpec::Running); } emit q->pluginsChanged(); q->m_allPluginsLoaded=true; diff --git a/ground/openpilotgcs/src/libs/extensionsystem/pluginmanager.h b/ground/openpilotgcs/src/libs/extensionsystem/pluginmanager.h index 49bcd5c55..c194c20fd 100644 --- a/ground/openpilotgcs/src/libs/extensionsystem/pluginmanager.h +++ b/ground/openpilotgcs/src/libs/extensionsystem/pluginmanager.h @@ -114,6 +114,7 @@ signals: void objectAdded(QObject *obj); void aboutToRemoveObject(QObject *obj); + void pluginAboutToBeLoaded(ExtensionSystem::PluginSpec* pluginSpec); void pluginsChanged(); void pluginsLoadEnded(); private slots: