[libcalamaresui] Add properties to ViewManager to expose Settings

This commit is contained in:
Adriaan de Groot 2021-03-03 16:06:53 +01:00
parent 849da3f322
commit 6a1e46d7f6
2 changed files with 33 additions and 0 deletions

View File

@ -608,4 +608,25 @@ ViewManager::rowCount( const QModelIndex& parent ) const
return m_steps.length();
}
bool
ViewManager::isChrootMode() const
{
const auto* s = Settings::instance();
return s ? s->doChroot() : true;
}
bool
ViewManager::isDebugMode() const
{
const auto* s = Settings::instance();
return s ? s->debugMode() : false;
}
bool
ViewManager::isSetupMode() const
{
const auto* s = Settings::instance();
return s ? s->isSetupMode() : false;
}
} // namespace Calamares

View File

@ -50,6 +50,11 @@ class UIDLLEXPORT ViewManager : public QAbstractListModel
///@brief Sides on which the ViewManager has side-panels
Q_PROPERTY( Qt::Orientations panelSides READ panelSides WRITE setPanelSides MEMBER m_panelSides )
// Global properties, where ViewManager proxies to Settings
Q_PROPERTY( bool isDebugMode READ isDebugMode CONSTANT FINAL )
Q_PROPERTY( bool isChrootMode READ isChrootMode CONSTANT FINAL )
Q_PROPERTY( bool isSetupMode READ isSetupMode CONSTANT FINAL )
public:
/**
* @brief instance access to the ViewManager singleton.
@ -197,6 +202,13 @@ public Q_SLOTS:
/// @brief Connected to ViewStep::nextStatusChanged for all steps
void updateNextStatus( bool enabled );
/// @brief Proxy to Settings::debugMode() default @c false
bool isDebugMode() const;
/// @brief Proxy to Settings::doChroot() default @c true
bool isChrootMode() const;
/// @brief Proxy to Settings::isSetupMode() default @c false
bool isSetupMode() const;
signals:
void currentStepChanged();
void ensureSize( QSize size ) const; // See ViewStep::ensureSize()