diff --git a/src/modules/welcome/qmlmain.cpp b/src/modules/welcome/qmlmain.cpp index 0aca1ddcd..9c160fc1d 100644 --- a/src/modules/welcome/qmlmain.cpp +++ b/src/modules/welcome/qmlmain.cpp @@ -15,6 +15,7 @@ #include +#include "locale/LabelModel.h" #include "utils/Logger.h" #include "Config.h" @@ -61,8 +62,11 @@ int main(int argc, char **argv) cnf.setHelpUrl( QUrl( argv[1] ) ); } + // TODO: this should put the one config object in the context, rather than adding a factory function to share it everywhere qmlRegisterSingletonType< Config >( "io.calamares.modules.welcome", 1, 0, "PotatoConfig", [](QQmlEngine*, QJSEngine*) -> QObject* { return theConfig(); }); + qmlRegisterSingletonType< CalamaresUtils::Locale::LabelModel >( "io.calamares.locale", 1, 0, "LocaleModel", [](QQmlEngine*, QJSEngine*) -> QObject* { return CalamaresUtils::Locale::availableTranslations(); } ); + qqw.setSource( QUrl::fromLocalFile("../src/modules/welcome/welcome.qml") ); return a.exec(); diff --git a/src/modules/welcome/welcome.qml b/src/modules/welcome/welcome.qml index ba28d660b..bdb7c4416 100644 --- a/src/modules/welcome/welcome.qml +++ b/src/modules/welcome/welcome.qml @@ -1,6 +1,7 @@ import QtQuick 2.0; import QtQuick.Controls 2.3; import io.calamares.modules.welcome 1.0; +import io.calamares.locale 1.0; Rectangle { width: 200; @@ -14,8 +15,15 @@ Rectangle { } Button { + id: thebutton; anchors.top: label.bottom; text: PotatoConfig.helpUrl; } + + ListView { + anchors.fill: parent; + model: LocaleModel; + delegate: Label { text: display } + } }