Clang: make ViewManager instance a proper singleton.
This commit is contained in:
parent
6a3aa01564
commit
09b25ab3e9
@ -142,7 +142,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
|
|||||||
CalamaresUtils::unmarginLayout( sideLayout );
|
CalamaresUtils::unmarginLayout( sideLayout );
|
||||||
CalamaresUtils::unmarginLayout( mainLayout );
|
CalamaresUtils::unmarginLayout( mainLayout );
|
||||||
|
|
||||||
Calamares::ViewManager* vm = new Calamares::ViewManager( this );
|
Calamares::ViewManager* vm = Calamares::ViewManager::instance( this );
|
||||||
|
|
||||||
mainLayout->addWidget( vm->centralWidget() );
|
mainLayout->addWidget( vm->centralWidget() );
|
||||||
}
|
}
|
||||||
|
@ -42,13 +42,20 @@ ViewManager::instance()
|
|||||||
return s_instance;
|
return s_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ViewManager*
|
||||||
|
ViewManager::instance( QObject* parent )
|
||||||
|
{
|
||||||
|
Q_ASSERT( !s_instance );
|
||||||
|
s_instance = new ViewManager( parent );
|
||||||
|
return s_instance;
|
||||||
|
}
|
||||||
|
|
||||||
ViewManager::ViewManager( QObject* parent )
|
ViewManager::ViewManager( QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_widget( new QWidget() )
|
, m_widget( new QWidget() )
|
||||||
, m_currentStep( 0 )
|
, m_currentStep( 0 )
|
||||||
{
|
{
|
||||||
Q_ASSERT( !s_instance );
|
Q_ASSERT( !s_instance );
|
||||||
s_instance = this;
|
|
||||||
|
|
||||||
QBoxLayout* mainLayout = new QVBoxLayout;
|
QBoxLayout* mainLayout = new QVBoxLayout;
|
||||||
m_widget->setLayout( mainLayout );
|
m_widget->setLayout( mainLayout );
|
||||||
|
@ -43,12 +43,10 @@ class UIDLLEXPORT ViewManager : public QObject
|
|||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief instance access to the ViewManager singleton.
|
* @brief instance access to the ViewManager singleton.
|
||||||
* @return
|
* @return pointer to the singleton instance.
|
||||||
*/
|
*/
|
||||||
static ViewManager* instance();
|
static ViewManager* instance();
|
||||||
|
static ViewManager* instance( QObject* parent );
|
||||||
explicit ViewManager( QObject* parent = nullptr );
|
|
||||||
virtual ~ViewManager();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief centralWidget always returns the central widget in the Calamares main
|
* @brief centralWidget always returns the central widget in the Calamares main
|
||||||
@ -115,6 +113,9 @@ signals:
|
|||||||
void currentStepChanged();
|
void currentStepChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
explicit ViewManager( QObject* parent = nullptr );
|
||||||
|
virtual ~ViewManager();
|
||||||
|
|
||||||
void insertViewStep( int before, ViewStep* step );
|
void insertViewStep( int before, ViewStep* step );
|
||||||
|
|
||||||
static ViewManager* s_instance;
|
static ViewManager* s_instance;
|
||||||
|
Loading…
Reference in New Issue
Block a user