Commit f49c93db authored by Lorenz Meier's avatar Lorenz Meier

Remove splash screen

parent 9fcdda7b
......@@ -31,7 +31,6 @@
#include <QFile>
#include <QFlags>
#include <QSplashScreen>
#include <QPixmap>
#include <QDesktopWidget>
#include <QPainter>
......@@ -433,21 +432,12 @@ bool QGCApplication::_initForNormalAppBoot(void)
_styleIsDark = settings.value(_styleKey, _styleIsDark).toBool();
_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
connect(this, SIGNAL(lastWindowClosed()), this, SLOT(quit()));
// Start the user interface
splashScreen->showMessage(tr("Starting user interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
MainWindow* mainWindow = MainWindow::_create(splashScreen);
MainWindow* mainWindow = MainWindow::_create();
Q_CHECK_PTR(mainWindow);
// 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)
mainWindow->showSettings();
}
// Remove splash screen
splashScreen->finish(mainWindow);
mainWindow->splashScreenFinished();
#ifndef __mobile__
// Now that main window is up check for lost log files
connect(this, &QGCApplication::checkForLostLogFiles, MAVLinkProtocol::instance(), &MAVLinkProtocol::checkForLostLogFiles);
......
......@@ -228,6 +228,5 @@ void QGCFileDialog::_validate(Options& options)
options |= DontUseNativeDialog;
#endif
if (MainWindow::instance()) {
MainWindow::instance()->hideSplashScreen();
}
}
......@@ -101,7 +101,6 @@ private:
parent = _validateParameters(buttons, &defaultButton, parent);
if (MainWindow::instance()) {
MainWindow::instance()->hideSplashScreen();
if (parent == NULL) {
parent = MainWindow::instance();
}
......
......@@ -33,7 +33,6 @@
#include <QFile>
#include <QFlags>
#include <QThread>
#include <QSplashScreen>
#include <QPixmap>
#include <QDesktopWidget>
#include <QPainter>
......
......@@ -32,7 +32,6 @@ This file is part of the QGROUNDCONTROL project
#include <QDebug>
#include <QTimer>
#include <QHostInfo>
#include <QSplashScreen>
#include <QQuickView>
#include <QDesktopWidget>
#include <QScreen>
......@@ -100,10 +99,10 @@ const char* MainWindow::_visibleWidgetsKey = "VisibleWidgets";
static MainWindow* _instance = NULL; ///< @brief MainWindow singleton
MainWindow* MainWindow::_create(QSplashScreen* splashScreen)
MainWindow* MainWindow::_create()
{
Q_ASSERT(_instance == NULL);
new MainWindow(splashScreen);
new MainWindow();
// _instance is set in constructor
Q_ASSERT(_instance);
return _instance;
......@@ -122,20 +121,15 @@ void MainWindow::deleteInstance(void)
/// @brief Private constructor for MainWindow. MainWindow singleton is only ever created
/// by MainWindow::_create method. Hence no other code should have access to
/// constructor.
MainWindow::MainWindow(QSplashScreen* splashScreen)
MainWindow::MainWindow()
: _autoReconnect(false)
, _lowPowerMode(false)
, _showStatusBar(false)
, _splashScreen(splashScreen)
, _mainQmlWidgetHolder(NULL)
{
Q_ASSERT(_instance == NULL);
_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.
#ifdef Q_OS_LINUX
menuBar()->setNativeMenuBar(false);
......@@ -595,15 +589,6 @@ void MainWindow::_storeCurrentViewState(void)
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()
{
SettingsDialog settings(this, SettingsDialog::ShowCommLinks);
......
......@@ -55,7 +55,6 @@ This file is part of the QGROUNDCONTROL project
#include "Mouse6dofInput.h"
#endif // QGC_MOUSE_ENABLED_WIN
class QSplashScreen;
class QGCStatusBar;
class Linecharts;
class QGCDataPlot2D;
......@@ -77,10 +76,7 @@ public:
void deleteInstance(void);
/// @brief Creates the MainWindow singleton. Should only be called once by QGCApplication.
static MainWindow* _create(QSplashScreen* splashScreen);
/// @brief Called to indicate that splash screen is no longer being displayed.
void splashScreenFinished(void) { _splashScreen = NULL; }
static MainWindow* _create();
~MainWindow();
......@@ -97,8 +93,6 @@ public:
return _lowPowerMode;
}
void hideSplashScreen(void);
/// @brief Saves the last used connection
void saveLastUsedConnection(const QString connection);
......@@ -222,7 +216,7 @@ private slots:
private:
/// Constructor is private since all creation should be through MainWindow::_create
MainWindow(QSplashScreen* splashScreen);
MainWindow();
void _openUrl(const QString& url, const QString& errorMessage);
......@@ -265,7 +259,6 @@ private:
bool _lowPowerMode; ///< If enabled, QGC reduces the update rates of all widgets
bool _showStatusBar;
QVBoxLayout* _centralLayout;
QSplashScreen* _splashScreen; ///< Splash screen, NULL is splash screen not currently being shown
Ui::MainWindow _ui;
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