mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-25 03:15:44 -05:00
[calamares] Allow test-loading of View modules
The view modules need a QApplication, not just a core application, and a ViewManager instance, so create those before really loading the module.
This commit is contained in:
parent
a0f7ef64d4
commit
58de7cea94
1 changed files with 19 additions and 20 deletions
|
@ -30,7 +30,9 @@
|
||||||
#include "Job.h"
|
#include "Job.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
#include "ViewManager.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
#include <QCommandLineOption>
|
#include <QCommandLineOption>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
@ -40,26 +42,10 @@
|
||||||
|
|
||||||
struct ModuleConfig
|
struct ModuleConfig
|
||||||
{
|
{
|
||||||
QString
|
QString moduleName() const { return m_module; }
|
||||||
moduleName() const
|
QString configFile() const { return m_jobConfig; }
|
||||||
{
|
QString language() const { return m_language; }
|
||||||
return m_module;
|
QString globalConfigFile() const { return m_globalConfig; }
|
||||||
}
|
|
||||||
QString
|
|
||||||
configFile() const
|
|
||||||
{
|
|
||||||
return m_jobConfig;
|
|
||||||
}
|
|
||||||
QString
|
|
||||||
language() const
|
|
||||||
{
|
|
||||||
return m_language;
|
|
||||||
}
|
|
||||||
QString
|
|
||||||
globalConfigFile() const
|
|
||||||
{
|
|
||||||
return m_globalConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString m_module;
|
QString m_module;
|
||||||
QString m_jobConfig;
|
QString m_jobConfig;
|
||||||
|
@ -202,6 +188,7 @@ int
|
||||||
main( int argc, char* argv[] )
|
main( int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
QCoreApplication a( argc, argv );
|
QCoreApplication a( argc, argv );
|
||||||
|
QApplication* aw = nullptr;
|
||||||
|
|
||||||
ModuleConfig module = handle_args( a );
|
ModuleConfig module = handle_args( a );
|
||||||
if ( module.moduleName().isEmpty() )
|
if ( module.moduleName().isEmpty() )
|
||||||
|
@ -233,6 +220,13 @@ main( int argc, char* argv[] )
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cDebug() << " .. got" << m->name() << m->typeString() << m->interfaceString();
|
||||||
|
if ( m->type() == Calamares::Module::Type::View )
|
||||||
|
{
|
||||||
|
aw = new QApplication( argc, argv );
|
||||||
|
(void)Calamares::ViewManager::instance( nullptr );
|
||||||
|
}
|
||||||
|
|
||||||
if ( !m->isLoaded() )
|
if ( !m->isLoaded() )
|
||||||
{
|
{
|
||||||
m->loadSelf();
|
m->loadSelf();
|
||||||
|
@ -268,5 +262,10 @@ main( int argc, char* argv[] )
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( aw )
|
||||||
|
{
|
||||||
|
delete aw;
|
||||||
|
}
|
||||||
|
|
||||||
return failure_count ? 1 : 0;
|
return failure_count ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue