Make ModuleManager accessible from outside CalamaresApplication.
This commit is contained in:
parent
4e2e964503
commit
dda7ea211d
@ -32,11 +32,24 @@
|
|||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
ModuleManager* ModuleManager::s_instance = nullptr;
|
||||||
|
|
||||||
|
|
||||||
|
ModuleManager*
|
||||||
|
ModuleManager::instance()
|
||||||
|
{
|
||||||
|
return s_instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ModuleManager::ModuleManager( const QStringList& paths, QObject* parent )
|
ModuleManager::ModuleManager( const QStringList& paths, QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_paths( paths )
|
, m_paths( paths )
|
||||||
, m_lastPhaseLoaded( Phase_NULL )
|
, m_lastPhaseLoaded( Phase_NULL )
|
||||||
{
|
{
|
||||||
|
Q_ASSERT( !s_instance );
|
||||||
|
s_instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModuleManager::~ModuleManager()
|
ModuleManager::~ModuleManager()
|
||||||
|
@ -38,6 +38,8 @@ public:
|
|||||||
explicit ModuleManager( const QStringList& paths, QObject* parent = nullptr );
|
explicit ModuleManager( const QStringList& paths, QObject* parent = nullptr );
|
||||||
virtual ~ModuleManager();
|
virtual ~ModuleManager();
|
||||||
|
|
||||||
|
static ModuleManager* instance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief init goes through the module search directories and gets a list of
|
* @brief init goes through the module search directories and gets a list of
|
||||||
* modules available for loading, along with their metadata.
|
* modules available for loading, along with their metadata.
|
||||||
@ -64,10 +66,10 @@ private:
|
|||||||
void checkDependencies();
|
void checkDependencies();
|
||||||
|
|
||||||
QMap< QString, Module* > m_availableModules;
|
QMap< QString, Module* > m_availableModules;
|
||||||
|
|
||||||
QStringList m_paths;
|
QStringList m_paths;
|
||||||
|
|
||||||
Phase m_lastPhaseLoaded;
|
Phase m_lastPhaseLoaded;
|
||||||
|
|
||||||
|
static ModuleManager* s_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user