[welcomeq] Compile the QML into the module
- Default implementation is in the QRC - Register Branding for QML modules (just once)
This commit is contained in:
parent
b5e17b7ea5
commit
152c3352c2
@ -35,6 +35,7 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
static const NamedEnumTable< Calamares::QmlViewStep::QmlSearch >&
|
||||
searchNames()
|
||||
{
|
||||
@ -82,6 +83,20 @@ changeQMLState( QMLAction action, QQuickItem* item )
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
registerCalamaresModels()
|
||||
{
|
||||
static bool done = false;
|
||||
if ( !done )
|
||||
{
|
||||
done = true;
|
||||
qmlRegisterSingletonType< Calamares::Branding >(
|
||||
"calamares.ui", 1, 0, "Branding", []( QQmlEngine*, QJSEngine* ) -> QObject* {
|
||||
return Calamares::Branding::instance();
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
@ -92,6 +107,8 @@ QmlViewStep::QmlViewStep( const QString& name, QObject* parent )
|
||||
, m_spinner( new WaitingWidget( tr( "Loading ..." ) ) )
|
||||
, m_qmlWidget( new QQuickWidget )
|
||||
{
|
||||
registerCalamaresModels();
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( m_widget );
|
||||
layout->addWidget( m_spinner );
|
||||
|
||||
|
@ -1,35 +1,15 @@
|
||||
import io.calamares.modules 1.0 as Modules
|
||||
import io.calamares.ui 1.0
|
||||
import calamares.ui 1.0
|
||||
|
||||
import QtQuick 2.10
|
||||
import QtQuick.Controls 2.10
|
||||
import QtQuick.Layouts 1.3
|
||||
import org.kde.kirigami 2.7 as Kirigami
|
||||
import org.kde.mauikit 1.0 as Maui
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Window 2.3
|
||||
|
||||
ResponsiveBase
|
||||
Page
|
||||
{
|
||||
id: control
|
||||
|
||||
Modules.Welcome
|
||||
{
|
||||
id: _welcome
|
||||
}
|
||||
|
||||
nextButton.enabled: _welcome.Config.isNextEnabled
|
||||
onNextClicked:
|
||||
{
|
||||
if (stackView.depth === 2)
|
||||
return
|
||||
|
||||
stackView.push(_langComponent)
|
||||
}
|
||||
|
||||
title: stackView.currentItem.title
|
||||
subtitle: stackView.currentItem.subtitle
|
||||
message: stackView.currentItem.message
|
||||
id: welcome
|
||||
|
||||
header: Item
|
||||
{
|
||||
@ -46,181 +26,4 @@ ResponsiveBase
|
||||
sourceSize.height: height
|
||||
}
|
||||
}
|
||||
|
||||
stackView.initialItem: Item
|
||||
{
|
||||
property string title: "Welcome to " + Branding.string(Branding.ProductName) + " " + Branding.string(Branding.Version)
|
||||
property string subtitle: _welcome.Config.genericWelcomeMessage
|
||||
property string message: _welcome.Config.warningMessage
|
||||
|
||||
ListView
|
||||
{
|
||||
id: _requirementsList
|
||||
anchors.centerIn: parent
|
||||
implicitWidth: Math.min(parent.width, 500)
|
||||
implicitHeight: Math.min(contentHeight, 500)
|
||||
|
||||
Rectangle
|
||||
{
|
||||
z: parent.z - 1
|
||||
anchors.fill: parent
|
||||
color: Kirigami.Theme.backgroundColor
|
||||
radius: 5
|
||||
opacity: 0.5
|
||||
}
|
||||
|
||||
model: _welcome.Config.requirementsModel
|
||||
|
||||
delegate: ItemDelegate
|
||||
{
|
||||
id: _delegate
|
||||
|
||||
background: Rectangle
|
||||
{
|
||||
color: model.satisfied ? Kirigami.Theme.positiveTextColor : Kirigami.Theme.negativeTextColor
|
||||
opacity: 0.2
|
||||
}
|
||||
|
||||
width: parent.width
|
||||
height: 48
|
||||
|
||||
contentItem: RowLayout
|
||||
{
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
Item
|
||||
{
|
||||
Layout.fillHeight: true
|
||||
Layout.preferredWidth: height
|
||||
|
||||
Kirigami.Icon
|
||||
{
|
||||
source: model.satisfied ? "checkmark" : (model.mandatory ? "error" : "dialog-warning-symbolic")
|
||||
height: 32
|
||||
width: height
|
||||
anchors.centerIn: parent
|
||||
color: background.color
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
spacing: 0
|
||||
|
||||
Label
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
horizontalAlignment: Qt.AlignLeft
|
||||
text: model.name
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
horizontalAlignment: Qt.AlignLeft
|
||||
text: !model.satisfied ? model.negatedText : model.details
|
||||
opacity: isCurrentItem ? 1 : 0.7
|
||||
font.weight: Font.Light
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
footer: RowLayout
|
||||
{
|
||||
|
||||
width: parent.width
|
||||
height: 64
|
||||
|
||||
spacing: Kirigami.Units.largeSpacing* 2
|
||||
|
||||
Button
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
text: "About"
|
||||
icon.name: "documentinfo"
|
||||
Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4)
|
||||
Kirigami.Theme.textColor: "#fff"
|
||||
|
||||
visible: Branding.string(Branding.ProductUrl).length
|
||||
onClicked: Qt.openUrlExternally(Branding.string(Branding.ProductUrl))
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Support")
|
||||
icon.name: "help-contents"
|
||||
Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4)
|
||||
Kirigami.Theme.textColor: "#fff"
|
||||
visible: Branding.string(Branding.SupportUrl).length
|
||||
onClicked: Qt.openUrlExternally(Branding.string(Branding.SupportUrl))
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Known issues")
|
||||
icon.name: "tools-report-bug"
|
||||
Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4)
|
||||
Kirigami.Theme.textColor: "#fff"
|
||||
visible: Branding.string(Branding.KnownIssuesUrl).length
|
||||
onClicked: Qt.openUrlExternally(Branding.string(Branding.KnownIssuesUrl))
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Release notes")
|
||||
icon.name: "answer"
|
||||
Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4)
|
||||
Kirigami.Theme.textColor: "#fff"
|
||||
visible: Branding.string(Branding.ReleaseNotesUrl).length
|
||||
onClicked: Qt.openUrlExternally(Branding.string(Branding.ReleaseNotesUrl))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Component
|
||||
{
|
||||
id: _langComponent
|
||||
|
||||
Item
|
||||
{
|
||||
property string title : qsTr("Language")
|
||||
property string subtitle: qsTr("Select your preferred language to continue with the installation")
|
||||
|
||||
ListViewTemplate
|
||||
{
|
||||
id: _langList
|
||||
anchors.centerIn: parent
|
||||
implicitWidth: Math.min(parent.width, 500)
|
||||
implicitHeight: Math.min(contentHeight, 500)
|
||||
|
||||
currentIndex: _welcome.Config.localeIndex
|
||||
|
||||
model: _welcome.Config.languagesModel
|
||||
|
||||
delegate: ListItemDelegate
|
||||
{
|
||||
id: _delegate
|
||||
label1.text: model.label
|
||||
label2.text: model.englishLabel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
5
src/modules/welcomeq/welcomeq.qrc
Normal file
5
src/modules/welcomeq/welcomeq.qrc
Normal file
@ -0,0 +1,5 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file alias="welcomeq.qml">welcomeq.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
Loading…
Reference in New Issue
Block a user