Commit b5a167d0 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'fix-splashscreen-check' into 'master'

Core: consistently check for splashscreen availability.

Core::finishSplash had an unguarded callsite that would cause a crash if
the splash screen is disbled. This change makes everything a bit simpler.

See merge request !168
parents 32829e5b 99ee26a8
...@@ -114,7 +114,8 @@ Core() : ...@@ -114,7 +114,8 @@ Core() :
nextBackupId_(0), nextBackupId_(0),
nextBackupGroupId_(0), nextBackupGroupId_(0),
objectRoot_(0), objectRoot_(0),
coreWidget_(0) coreWidget_(0),
splash_(0)
{ {
//init logFile //init logFile
...@@ -608,7 +609,7 @@ Core::init() { ...@@ -608,7 +609,7 @@ Core::init() {
QStringList optionFiles = OpenFlipper::Options::optionFiles(); QStringList optionFiles = OpenFlipper::Options::optionFiles();
for ( int i = 0 ; i < (int)optionFiles.size(); ++i) { for ( int i = 0 ; i < (int)optionFiles.size(); ++i) {
if ( OpenFlipper::Options::gui() && OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) { if (splash_) {
splash_->showMessage(tr("Loading Configuration File %1/%2").arg(i+1).arg(optionFiles.size()), splash_->showMessage(tr("Loading Configuration File %1/%2").arg(i+1).arg(optionFiles.size()),
Qt::AlignBottom | Qt::AlignLeft , Qt::white); Qt::AlignBottom | Qt::AlignLeft , Qt::white);
} }
...@@ -621,7 +622,7 @@ Core::init() { ...@@ -621,7 +622,7 @@ Core::init() {
openIniFile( optionFiles[i] ,false,true,false); openIniFile( optionFiles[i] ,false,true,false);
} }
if ( OpenFlipper::Options::gui() && OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) if (splash_)
splash_->clearMessage(); splash_->clearMessage();
// =============================================================================================== // ===============================================================================================
...@@ -674,7 +675,7 @@ Core::init() { ...@@ -674,7 +675,7 @@ Core::init() {
} }
if ( OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) { if ( splash_ ) {
splash_->raise(); splash_->raise();
splash_->showMessage(tr("Ready."), Qt::AlignBottom | Qt::AlignLeft , Qt::white); splash_->showMessage(tr("Ready."), Qt::AlignBottom | Qt::AlignLeft , Qt::white);
finishSplash(); finishSplash();
...@@ -2041,7 +2042,7 @@ void Core::showReducedMenuBar(bool reduced) { ...@@ -2041,7 +2042,7 @@ void Core::showReducedMenuBar(bool reduced) {
} }
void Core::finishSplash() { void Core::finishSplash() {
splash_->finish(coreWidget_); if (splash_) splash_->finish(coreWidget_);
} }
......
...@@ -389,7 +389,7 @@ void Core::loadPlugins() ...@@ -389,7 +389,7 @@ void Core::loadPlugins()
loadedPlugins.push_back(loader); loadedPlugins.push_back(loader);
if ( OpenFlipper::Options::gui() && OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) { if (splash_) {
splashMessage_ = tr("Loading Plugin %1/%2").arg(loadedPlugins.size()).arg(pluginlist.size()) ; splashMessage_ = tr("Loading Plugin %1/%2").arg(loadedPlugins.size()).arg(pluginlist.size()) ;
splash_->showMessage( splashMessage_ , Qt::AlignBottom | Qt::AlignLeft , Qt::white); splash_->showMessage( splashMessage_ , Qt::AlignBottom | Qt::AlignLeft , Qt::white);
} }
...@@ -411,7 +411,7 @@ void Core::loadPlugins() ...@@ -411,7 +411,7 @@ void Core::loadPlugins()
for (std::vector<QPluginLoader*>::iterator it = loadedPlugins.begin(); for (std::vector<QPluginLoader*>::iterator it = loadedPlugins.begin();
it != loadedPlugins.end(); ++it) { it != loadedPlugins.end(); ++it) {
if ( OpenFlipper::Options::gui() && OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) { if (splash_) {
splashMessage_ = tr("Initializing Plugin %1/%2") splashMessage_ = tr("Initializing Plugin %1/%2")
.arg(std::distance(loadedPlugins.begin(), it) + 1) .arg(std::distance(loadedPlugins.begin(), it) + 1)
.arg(loadedPlugins.size()); .arg(loadedPlugins.size());
...@@ -770,7 +770,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic ...@@ -770,7 +770,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
emit log(LOGOUT,tr("Found Plugin : \t %1").arg(basePlugin->name()) ); emit log(LOGOUT,tr("Found Plugin : \t %1").arg(basePlugin->name()) );
if ( OpenFlipper::Options::gui() && OpenFlipperSettings().value("Core/Gui/splash",true).toBool() ) { if (splash_) {
splashMessage_ = splashMessage_ + " " + basePlugin->name() ; splashMessage_ = splashMessage_ + " " + basePlugin->name() ;
splash_->showMessage( splashMessage_ , Qt::AlignBottom | Qt::AlignLeft , Qt::white); splash_->showMessage( splashMessage_ , Qt::AlignBottom | Qt::AlignLeft , Qt::white);
} }
......
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