[libcalamaresui] Name QML-wrangling functions consistently

- Use "Qml" in camel-cased names
This commit is contained in:
Adriaan de Groot 2020-05-19 17:17:14 +02:00
parent 0947da3d41
commit 4491fb8c27
5 changed files with 10 additions and 10 deletions

View File

@ -208,7 +208,7 @@ CalamaresWindow::getWidgetNavigation( QWidget* parent )
QWidget* QWidget*
CalamaresWindow::getQmlSidebar( QWidget* parent, int ) CalamaresWindow::getQmlSidebar( QWidget* parent, int )
{ {
CalamaresUtils::registerCalamaresModels(); CalamaresUtils::registerQmlModels();
QQuickWidget* w = new QQuickWidget( parent ); QQuickWidget* w = new QQuickWidget( parent );
w->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); w->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
w->setResizeMode( QQuickWidget::SizeRootObjectToView ); w->setResizeMode( QQuickWidget::SizeRootObjectToView );
@ -220,7 +220,7 @@ CalamaresWindow::getQmlSidebar( QWidget* parent, int )
QWidget* QWidget*
CalamaresWindow::getQmlNavigation( QWidget* parent ) CalamaresWindow::getQmlNavigation( QWidget* parent )
{ {
CalamaresUtils::registerCalamaresModels(); CalamaresUtils::registerQmlModels();
QQuickWidget* w = new QQuickWidget( parent ); QQuickWidget* w = new QQuickWidget( parent );
w->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); w->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
w->setResizeMode( QQuickWidget::SizeRootObjectToView ); w->setResizeMode( QQuickWidget::SizeRootObjectToView );

View File

@ -34,7 +34,7 @@ namespace CalamaresUtils
{ {
void void
callQMLFunction( QQuickItem* qmlObject, const char* method ) callQmlFunction( QQuickItem* qmlObject, const char* method )
{ {
QByteArray methodSignature( method ); QByteArray methodSignature( method );
methodSignature.append( "()" ); methodSignature.append( "()" );
@ -149,7 +149,7 @@ qmlSearchNames()
} }
void void
registerCalamaresModels() registerQmlModels()
{ {
static bool done = false; static bool done = false;
if ( !done ) if ( !done )

View File

@ -40,7 +40,7 @@ namespace CalamaresUtils
* Additionally, modules based on QmlViewStep have a context * Additionally, modules based on QmlViewStep have a context
* property `config` referring to that module's configuration (if any). * property `config` referring to that module's configuration (if any).
*/ */
UIDLLEXPORT void registerCalamaresModels(); UIDLLEXPORT void registerQmlModels();
/** @brief Calls the QML method @p method on @p qmlObject /** @brief Calls the QML method @p method on @p qmlObject
* *
@ -50,7 +50,7 @@ UIDLLEXPORT void registerCalamaresModels();
* *
* If there is a return value from the QML method, it is logged (but not otherwise used). * If there is a return value from the QML method, it is logged (but not otherwise used).
*/ */
UIDLLEXPORT void callQMLFunction( QQuickItem* qmlObject, const char* method ); UIDLLEXPORT void callQmlFunction( QQuickItem* qmlObject, const char* method );
/** @brief Search modes for loading Qml files. /** @brief Search modes for loading Qml files.
* *

View File

@ -58,7 +58,7 @@ changeQMLState( QMLAction action, QQuickItem* item )
static const char propertyName[] = "activatedInCalamares"; static const char propertyName[] = "activatedInCalamares";
bool activate = action == QMLAction::Start; bool activate = action == QMLAction::Start;
CalamaresUtils::callQMLFunction( item, activate ? "onActivate" : "onLeave" ); CalamaresUtils::callQmlFunction( item, activate ? "onActivate" : "onLeave" );
auto property = item->property( propertyName ); auto property = item->property( propertyName );
if ( property.isValid() && ( property.type() == QVariant::Bool ) && ( property.toBool() != activate ) ) if ( property.isValid() && ( property.type() == QVariant::Bool ) && ( property.toBool() != activate ) )
@ -76,7 +76,7 @@ QmlViewStep::QmlViewStep( QObject* parent )
, m_spinner( new WaitingWidget( tr( "Loading ..." ) ) ) , m_spinner( new WaitingWidget( tr( "Loading ..." ) ) )
, m_qmlWidget( new QQuickWidget ) , m_qmlWidget( new QQuickWidget )
{ {
CalamaresUtils::registerCalamaresModels(); CalamaresUtils::registerQmlModels();
QVBoxLayout* layout = new QVBoxLayout( m_widget ); QVBoxLayout* layout = new QVBoxLayout( m_widget );
layout->addWidget( m_spinner ); layout->addWidget( m_spinner );

View File

@ -52,7 +52,7 @@ SlideshowQML::SlideshowQML( QWidget* parent )
, m_qmlComponent( nullptr ) , m_qmlComponent( nullptr )
, m_qmlObject( nullptr ) , m_qmlObject( nullptr )
{ {
CalamaresUtils::registerCalamaresModels(); CalamaresUtils::registerQmlModels();
m_qmlShow->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); m_qmlShow->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
m_qmlShow->setResizeMode( QQuickWidget::SizeRootObjectToView ); m_qmlShow->setResizeMode( QQuickWidget::SizeRootObjectToView );
@ -163,7 +163,7 @@ SlideshowQML::changeSlideShowState( Action state )
if ( Branding::instance()->slideshowAPI() == 2 ) if ( Branding::instance()->slideshowAPI() == 2 )
{ {
// The QML was already loaded in the constructor, need to start it // The QML was already loaded in the constructor, need to start it
CalamaresUtils::callQMLFunction( m_qmlObject, activate ? "onActivate" : "onLeave" ); CalamaresUtils::callQmlFunction( m_qmlObject, activate ? "onActivate" : "onLeave" );
} }
else if ( !Calamares::Branding::instance()->slideshowPath().isEmpty() ) else if ( !Calamares::Branding::instance()->slideshowPath().isEmpty() )
{ {