[libcalamaresui] Replace a superfluous lambda

- The whole method body can be a lot on its own, and since
   loadModules() does nothing but single-shot the lambda,
   call it from outside instead.
This commit is contained in:
Adriaan de Groot 2019-09-14 14:15:00 -04:00
parent ce6f6592d4
commit d6ed046495
3 changed files with 106 additions and 106 deletions

View File

@ -39,6 +39,7 @@
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QDir> #include <QDir>
#include <QFileInfo> #include <QFileInfo>
#include <QTimer>
CalamaresApplication::CalamaresApplication( int& argc, char* argv[] ) CalamaresApplication::CalamaresApplication( int& argc, char* argv[] )
@ -354,7 +355,7 @@ CalamaresApplication::initView()
connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, this, &CalamaresApplication::initViewSteps ); connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, this, &CalamaresApplication::initViewSteps );
connect( m_moduleManager, &Calamares::ModuleManager::modulesFailed, this, &CalamaresApplication::initFailed ); connect( m_moduleManager, &Calamares::ModuleManager::modulesFailed, this, &CalamaresApplication::initFailed );
m_moduleManager->loadModules(); QTimer::singleShot( 0, m_moduleManager, &Calamares::ModuleManager::loadModules );
m_mainwindow->move( this->desktop()->availableGeometry().center() - m_mainwindow->rect().center() ); m_mainwindow->move( this->desktop()->availableGeometry().center() - m_mainwindow->rect().center() );

View File

@ -182,7 +182,6 @@ findCustomInstance( const Settings::InstanceDescriptionList& customInstances, co
void void
ModuleManager::loadModules() ModuleManager::loadModules()
{ {
QTimer::singleShot( 0, this, [this]() {
QStringList failedModules = checkDependencies(); QStringList failedModules = checkDependencies();
Settings::InstanceDescriptionList customInstances = Settings::instance()->customModuleInstances(); Settings::InstanceDescriptionList customInstances = Settings::instance()->customModuleInstances();
@ -308,7 +307,6 @@ ModuleManager::loadModules()
{ {
emit modulesLoaded(); emit modulesLoaded();
} }
} );
} }
void void

View File

@ -79,8 +79,9 @@ public:
Module* moduleInstance( const QString& instanceKey ); Module* moduleInstance( const QString& instanceKey );
/** /**
* @brief loadModules initiates the asynchronous module loading operation. * @brief loadModules does all of the module loading operation.
* When this is done, the signal modulesLoaded is emitted. * When this is done, the signal modulesLoaded is emitted.
* It is recommended to call this from a single-shot QTimer.
*/ */
void loadModules(); void loadModules();