Commit f49c93db authored by Lorenz Meier's avatar Lorenz Meier

Remove splash screen

parent 9fcdda7b
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include <QFile> #include <QFile>
#include <QFlags> #include <QFlags>
#include <QSplashScreen>
#include <QPixmap> #include <QPixmap>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QPainter> #include <QPainter>
...@@ -433,21 +432,12 @@ bool QGCApplication::_initForNormalAppBoot(void) ...@@ -433,21 +432,12 @@ bool QGCApplication::_initForNormalAppBoot(void)
_styleIsDark = settings.value(_styleKey, _styleIsDark).toBool(); _styleIsDark = settings.value(_styleKey, _styleIsDark).toBool();
_loadCurrentStyle(); _loadCurrentStyle();
// Show splash screen
QPixmap splashImage(":/res/SplashScreen");
QSplashScreen* splashScreen = new QSplashScreen(splashImage);
// Delete splash screen after mainWindow was displayed
splashScreen->setAttribute(Qt::WA_DeleteOnClose);
splashScreen->show();
processEvents();
splashScreen->showMessage(tr("Loading application fonts"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
// Exit main application when last window is closed // Exit main application when last window is closed
connect(this, SIGNAL(lastWindowClosed()), this, SLOT(quit())); connect(this, SIGNAL(lastWindowClosed()), this, SLOT(quit()));
// Start the user interface // Start the user interface
splashScreen->showMessage(tr("Starting user interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); MainWindow* mainWindow = MainWindow::_create();
MainWindow* mainWindow = MainWindow::_create(splashScreen);
Q_CHECK_PTR(mainWindow); Q_CHECK_PTR(mainWindow);
// If we made it this far and we still don't have a location. Either the specfied location was invalid // If we made it this far and we still don't have a location. Either the specfied location was invalid
...@@ -461,10 +451,6 @@ bool QGCApplication::_initForNormalAppBoot(void) ...@@ -461,10 +451,6 @@ bool QGCApplication::_initForNormalAppBoot(void)
mainWindow->showSettings(); mainWindow->showSettings();
} }
// Remove splash screen
splashScreen->finish(mainWindow);
mainWindow->splashScreenFinished();
#ifndef __mobile__ #ifndef __mobile__
// Now that main window is up check for lost log files // Now that main window is up check for lost log files
connect(this, &QGCApplication::checkForLostLogFiles, MAVLinkProtocol::instance(), &MAVLinkProtocol::checkForLostLogFiles); connect(this, &QGCApplication::checkForLostLogFiles, MAVLinkProtocol::instance(), &MAVLinkProtocol::checkForLostLogFiles);
......
...@@ -228,6 +228,5 @@ void QGCFileDialog::_validate(Options& options) ...@@ -228,6 +228,5 @@ void QGCFileDialog::_validate(Options& options)
options |= DontUseNativeDialog; options |= DontUseNativeDialog;
#endif #endif
if (MainWindow::instance()) { if (MainWindow::instance()) {
MainWindow::instance()->hideSplashScreen();
} }
} }
...@@ -101,7 +101,6 @@ private: ...@@ -101,7 +101,6 @@ private:
parent = _validateParameters(buttons, &defaultButton, parent); parent = _validateParameters(buttons, &defaultButton, parent);
if (MainWindow::instance()) { if (MainWindow::instance()) {
MainWindow::instance()->hideSplashScreen();
if (parent == NULL) { if (parent == NULL) {
parent = MainWindow::instance(); parent = MainWindow::instance();
} }
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <QFile> #include <QFile>
#include <QFlags> #include <QFlags>
#include <QThread> #include <QThread>
#include <QSplashScreen>
#include <QPixmap> #include <QPixmap>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QPainter> #include <QPainter>
......
...@@ -32,7 +32,6 @@ This file is part of the QGROUNDCONTROL project ...@@ -32,7 +32,6 @@ This file is part of the QGROUNDCONTROL project
#include <QDebug> #include <QDebug>
#include <QTimer> #include <QTimer>
#include <QHostInfo> #include <QHostInfo>
#include <QSplashScreen>
#include <QQuickView> #include <QQuickView>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QScreen> #include <QScreen>
...@@ -100,10 +99,10 @@ const char* MainWindow::_visibleWidgetsKey = "VisibleWidgets"; ...@@ -100,10 +99,10 @@ const char* MainWindow::_visibleWidgetsKey = "VisibleWidgets";
static MainWindow* _instance = NULL; ///< @brief MainWindow singleton static MainWindow* _instance = NULL; ///< @brief MainWindow singleton
MainWindow* MainWindow::_create(QSplashScreen* splashScreen) MainWindow* MainWindow::_create()
{ {
Q_ASSERT(_instance == NULL); Q_ASSERT(_instance == NULL);
new MainWindow(splashScreen); new MainWindow();
// _instance is set in constructor // _instance is set in constructor
Q_ASSERT(_instance); Q_ASSERT(_instance);
return _instance; return _instance;
...@@ -122,20 +121,15 @@ void MainWindow::deleteInstance(void) ...@@ -122,20 +121,15 @@ void MainWindow::deleteInstance(void)
/// @brief Private constructor for MainWindow. MainWindow singleton is only ever created /// @brief Private constructor for MainWindow. MainWindow singleton is only ever created
/// by MainWindow::_create method. Hence no other code should have access to /// by MainWindow::_create method. Hence no other code should have access to
/// constructor. /// constructor.
MainWindow::MainWindow(QSplashScreen* splashScreen) MainWindow::MainWindow()
: _autoReconnect(false) : _autoReconnect(false)
, _lowPowerMode(false) , _lowPowerMode(false)
, _showStatusBar(false) , _showStatusBar(false)
, _splashScreen(splashScreen)
, _mainQmlWidgetHolder(NULL) , _mainQmlWidgetHolder(NULL)
{ {
Q_ASSERT(_instance == NULL); Q_ASSERT(_instance == NULL);
_instance = this; _instance = this;
if (splashScreen) {
connect(this, &MainWindow::initStatusChanged, splashScreen, &QSplashScreen::showMessage);
}
// Qt 4/5 on Ubuntu does place the native menubar correctly so on Linux we revert back to in-window menu bar. // Qt 4/5 on Ubuntu does place the native menubar correctly so on Linux we revert back to in-window menu bar.
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
menuBar()->setNativeMenuBar(false); menuBar()->setNativeMenuBar(false);
...@@ -595,15 +589,6 @@ void MainWindow::_storeCurrentViewState(void) ...@@ -595,15 +589,6 @@ void MainWindow::_storeCurrentViewState(void)
settings.setValue(_getWindowGeometryKey(), saveGeometry()); settings.setValue(_getWindowGeometryKey(), saveGeometry());
} }
/// @brief Hides the spash screen if it is currently being shown
void MainWindow::hideSplashScreen(void)
{
if (_splashScreen) {
_splashScreen->hide();
_splashScreen = NULL;
}
}
void MainWindow::manageLinks() void MainWindow::manageLinks()
{ {
SettingsDialog settings(this, SettingsDialog::ShowCommLinks); SettingsDialog settings(this, SettingsDialog::ShowCommLinks);
......
...@@ -55,7 +55,6 @@ This file is part of the QGROUNDCONTROL project ...@@ -55,7 +55,6 @@ This file is part of the QGROUNDCONTROL project
#include "Mouse6dofInput.h" #include "Mouse6dofInput.h"
#endif // QGC_MOUSE_ENABLED_WIN #endif // QGC_MOUSE_ENABLED_WIN
class QSplashScreen;
class QGCStatusBar; class QGCStatusBar;
class Linecharts; class Linecharts;
class QGCDataPlot2D; class QGCDataPlot2D;
...@@ -77,10 +76,7 @@ public: ...@@ -77,10 +76,7 @@ public:
void deleteInstance(void); void deleteInstance(void);
/// @brief Creates the MainWindow singleton. Should only be called once by QGCApplication. /// @brief Creates the MainWindow singleton. Should only be called once by QGCApplication.
static MainWindow* _create(QSplashScreen* splashScreen); static MainWindow* _create();
/// @brief Called to indicate that splash screen is no longer being displayed.
void splashScreenFinished(void) { _splashScreen = NULL; }
~MainWindow(); ~MainWindow();
...@@ -97,8 +93,6 @@ public: ...@@ -97,8 +93,6 @@ public:
return _lowPowerMode; return _lowPowerMode;
} }
void hideSplashScreen(void);
/// @brief Saves the last used connection /// @brief Saves the last used connection
void saveLastUsedConnection(const QString connection); void saveLastUsedConnection(const QString connection);
...@@ -222,7 +216,7 @@ private slots: ...@@ -222,7 +216,7 @@ private slots:
private: private:
/// Constructor is private since all creation should be through MainWindow::_create /// Constructor is private since all creation should be through MainWindow::_create
MainWindow(QSplashScreen* splashScreen); MainWindow();
void _openUrl(const QString& url, const QString& errorMessage); void _openUrl(const QString& url, const QString& errorMessage);
...@@ -265,7 +259,6 @@ private: ...@@ -265,7 +259,6 @@ private:
bool _lowPowerMode; ///< If enabled, QGC reduces the update rates of all widgets bool _lowPowerMode; ///< If enabled, QGC reduces the update rates of all widgets
bool _showStatusBar; bool _showStatusBar;
QVBoxLayout* _centralLayout; QVBoxLayout* _centralLayout;
QSplashScreen* _splashScreen; ///< Splash screen, NULL is splash screen not currently being shown
Ui::MainWindow _ui; Ui::MainWindow _ui;
QGCQmlWidgetHolder* _mainQmlWidgetHolder; QGCQmlWidgetHolder* _mainQmlWidgetHolder;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment