[welcome] Add QML model for translations
This commit is contained in:
parent
d41d8df2a5
commit
03ed308bd9
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include <KAboutData>
|
#include <KAboutData>
|
||||||
|
|
||||||
|
#include "locale/LabelModel.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
@ -61,8 +62,11 @@ int main(int argc, char **argv)
|
|||||||
cnf.setHelpUrl( QUrl( argv[1] ) );
|
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< 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") );
|
qqw.setSource( QUrl::fromLocalFile("../src/modules/welcome/welcome.qml") );
|
||||||
|
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import QtQuick 2.0;
|
import QtQuick 2.0;
|
||||||
import QtQuick.Controls 2.3;
|
import QtQuick.Controls 2.3;
|
||||||
import io.calamares.modules.welcome 1.0;
|
import io.calamares.modules.welcome 1.0;
|
||||||
|
import io.calamares.locale 1.0;
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 200;
|
width: 200;
|
||||||
@ -14,8 +15,15 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
|
id: thebutton;
|
||||||
anchors.top: label.bottom;
|
anchors.top: label.bottom;
|
||||||
text: PotatoConfig.helpUrl;
|
text: PotatoConfig.helpUrl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
anchors.fill: parent;
|
||||||
|
model: LocaleModel;
|
||||||
|
delegate: Label { text: display }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user