8c2a95dbe2
* Mir starts up and is able to display system settings * x86_64 only for now, because at least ubuntu-app-test did not build on aarch64 Based on PureTryOut's work. Getting it to this stage was a huge effort (as it shows in the package count: 111(!)). See the merge request for details. [skip ci]: this won't finish in CI; ollieparanoid made sure that everything builds for x86_64.
155 lines
8.2 KiB
Diff
155 lines
8.2 KiB
Diff
From f306efd7fcceac905093a0ef58aae93412813d16 Mon Sep 17 00:00:00 2001
|
|
From: Luca Weiss <luca@z3ntu.xyz>
|
|
Date: Sun, 30 Dec 2018 22:31:37 +0100
|
|
Subject: [PATCH 4/5] Make it compile with Qt 5.12
|
|
|
|
---
|
|
src/UbuntuToolkit/ucstylehints.cpp | 35 +++++++++++++++---------------
|
|
src/UbuntuToolkit/ucstylehints_p.h | 8 +++----
|
|
2 files changed, 21 insertions(+), 22 deletions(-)
|
|
|
|
diff --git a/src/UbuntuToolkit/ucstylehints.cpp b/src/UbuntuToolkit/ucstylehints.cpp
|
|
index cf1bba798..852f55777 100644
|
|
--- a/src/UbuntuToolkit/ucstylehints.cpp
|
|
+++ b/src/UbuntuToolkit/ucstylehints.cpp
|
|
@@ -27,17 +27,17 @@
|
|
UT_NAMESPACE_BEGIN
|
|
|
|
// verifies property declaration correctness
|
|
-void UCStyleHintsParser::verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings)
|
|
+void UCStyleHintsParser::verifyBindings(const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings)
|
|
{
|
|
Q_FOREACH(const QV4::CompiledData::Binding *binding, bindings) {
|
|
- verifyProperty(qmlUnit, binding);
|
|
+ verifyProperty(compilationUnit, binding);
|
|
}
|
|
}
|
|
|
|
-void UCStyleHintsParser::verifyProperty(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding)
|
|
+void UCStyleHintsParser::verifyProperty(const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit, const QV4::CompiledData::Binding *binding)
|
|
{
|
|
if (binding->type == QV4::CompiledData::Binding::Type_Object) {
|
|
- error(qmlUnit->objectAt(binding->value.objectIndex),
|
|
+ error(compilationUnit->objectAt(binding->value.objectIndex),
|
|
QStringLiteral("StyleHints does not support creating state-specific objects."));
|
|
return;
|
|
}
|
|
@@ -45,15 +45,15 @@ void UCStyleHintsParser::verifyProperty(const QV4::CompiledData::Unit *qmlUnit,
|
|
// group properties or attached properties, we do handle those as well
|
|
if (binding->type == QV4::CompiledData::Binding::Type_GroupProperty
|
|
|| binding->type == QV4::CompiledData::Binding::Type_AttachedProperty) {
|
|
- const QV4::CompiledData::Object *subObj = qmlUnit->objectAt(binding->value.objectIndex);
|
|
+ const QV4::CompiledData::Object *subObj = compilationUnit->objectAt(binding->value.objectIndex);
|
|
const QV4::CompiledData::Binding *subBinding = subObj->bindingTable();
|
|
for (quint32 i = 0; i < subObj->nBindings; ++i, ++subBinding) {
|
|
- verifyProperty(qmlUnit, subBinding);
|
|
+ verifyProperty(compilationUnit, subBinding);
|
|
}
|
|
}
|
|
|
|
// filter out signals!
|
|
- QString propertyName = qmlUnit->stringAt(binding->propertyNameIndex);
|
|
+ QString propertyName = compilationUnit->stringAt(binding->propertyNameIndex);
|
|
if (propertyName.startsWith(QStringLiteral("on")) && propertyName.at(2).isUpper()) {
|
|
error(binding, QStringLiteral("Signal properties are not supported."));
|
|
return;
|
|
@@ -61,10 +61,9 @@ void UCStyleHintsParser::verifyProperty(const QV4::CompiledData::Unit *qmlUnit,
|
|
}
|
|
|
|
// decodes property declarations, stores the bindings and values
|
|
-void UCStyleHintsParser::applyBindings(QObject *obj, QV4::CompiledData::CompilationUnit *cdata, const QList<const QV4::CompiledData::Binding *> &bindings)
|
|
+void UCStyleHintsParser::applyBindings(QObject *obj, const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings)
|
|
{
|
|
UCStyleHints *hints = static_cast<UCStyleHints*>(obj);
|
|
- const QV4::CompiledData::Unit *qmlUnit = cdata->data;
|
|
|
|
UCStyledItemBase *styledItem = qobject_cast<UCStyledItemBase*>(hints->parent());
|
|
if (!styledItem) {
|
|
@@ -73,26 +72,26 @@ void UCStyleHintsParser::applyBindings(QObject *obj, QV4::CompiledData::Compilat
|
|
}
|
|
|
|
Q_FOREACH(const QV4::CompiledData::Binding *binding, bindings) {
|
|
- hints->decodeBinding(QString(), qmlUnit, binding);
|
|
+ hints->decodeBinding(QString(), compilationUnit, binding);
|
|
}
|
|
|
|
- hints->m_cdata = cdata;
|
|
+ hints->m_cdata = compilationUnit;
|
|
hints->m_decoded = true;
|
|
}
|
|
|
|
-void UCStyleHints::decodeBinding(const QString &propertyPrefix, const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding)
|
|
+void UCStyleHints::decodeBinding(const QString &propertyPrefix, const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit, const QV4::CompiledData::Binding *binding)
|
|
{
|
|
- QString propertyName = propertyPrefix + qmlUnit->stringAt(binding->propertyNameIndex);
|
|
+ QString propertyName = propertyPrefix + compilationUnit->stringAt(binding->propertyNameIndex);
|
|
|
|
// handle grouped properties first
|
|
if (binding->type == QV4::CompiledData::Binding::Type_GroupProperty
|
|
|| binding->type == QV4::CompiledData::Binding::Type_AttachedProperty) {
|
|
|
|
- const QV4::CompiledData::Object *subObj = qmlUnit->objectAt(binding->value.objectIndex);
|
|
+ const QV4::CompiledData::Object *subObj = compilationUnit->objectAt(binding->value.objectIndex);
|
|
const QV4::CompiledData::Binding *subBinding = subObj->bindingTable();
|
|
QString pre = propertyName + ".";
|
|
for (quint32 i = 0; i < subObj->nBindings; ++i, ++subBinding) {
|
|
- decodeBinding(pre, qmlUnit, subBinding);
|
|
+ decodeBinding(pre, compilationUnit, subBinding);
|
|
}
|
|
return;
|
|
}
|
|
@@ -100,7 +99,7 @@ void UCStyleHints::decodeBinding(const QString &propertyPrefix, const QV4::Compi
|
|
switch (binding->type) {
|
|
case QV4::CompiledData::Binding::Type_Script:
|
|
{
|
|
- QString expression = binding->valueAsScriptString(qmlUnit);
|
|
+ QString expression = binding->valueAsScriptString(compilationUnit.data());
|
|
QUrl url = QUrl();
|
|
int line = -1;
|
|
int column = -1;
|
|
@@ -125,12 +124,12 @@ void UCStyleHints::decodeBinding(const QString &propertyPrefix, const QV4::Compi
|
|
case QV4::CompiledData::Binding::Type_TranslationById:
|
|
case QV4::CompiledData::Binding::Type_String:
|
|
{
|
|
- m_values << qMakePair(propertyName, binding->valueAsString(qmlUnit));
|
|
+ m_values << qMakePair(propertyName, binding->valueAsString(compilationUnit.data()));
|
|
break;
|
|
}
|
|
case QV4::CompiledData::Binding::Type_Number:
|
|
{
|
|
- m_values << qMakePair(propertyName, binding->valueAsNumber());
|
|
+ m_values << qMakePair(propertyName, binding->valueAsNumber(compilationUnit->constants));
|
|
break;
|
|
}
|
|
case QV4::CompiledData::Binding::Type_Boolean:
|
|
diff --git a/src/UbuntuToolkit/ucstylehints_p.h b/src/UbuntuToolkit/ucstylehints_p.h
|
|
index ef5fafd6e..ddc96a7f1 100644
|
|
--- a/src/UbuntuToolkit/ucstylehints_p.h
|
|
+++ b/src/UbuntuToolkit/ucstylehints_p.h
|
|
@@ -78,7 +78,7 @@ private:
|
|
friend class UCStyleHintsParser;
|
|
|
|
void propertyNotFound(const QString &styleName, const QString &property);
|
|
- void decodeBinding(const QString &propertyPrefix, const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding);
|
|
+ void decodeBinding(const QString &propertyPrefix, const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit, const QV4::CompiledData::Binding *binding);
|
|
};
|
|
|
|
class UBUNTUTOOLKIT_EXPORT UCStyleHintsParser : public QQmlCustomParser
|
|
@@ -86,11 +86,11 @@ class UBUNTUTOOLKIT_EXPORT UCStyleHintsParser : public QQmlCustomParser
|
|
public:
|
|
UCStyleHintsParser() : QQmlCustomParser(QQmlCustomParser::AcceptsSignalHandlers) {}
|
|
|
|
- void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override;
|
|
- void applyBindings(QObject *obj, QV4::CompiledData::CompilationUnit *cdata, const QList<const QV4::CompiledData::Binding *> &bindings) override;
|
|
+ void verifyBindings(const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override;
|
|
+ void applyBindings(QObject *obj, const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override;
|
|
|
|
private:
|
|
- void verifyProperty(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding);
|
|
+ void verifyProperty(const QQmlRefPointer<QV4::CompiledData::CompilationUnit> &compilationUnit, const QV4::CompiledData::Binding *binding);
|
|
};
|
|
|
|
UT_NAMESPACE_END
|
|
--
|
|
2.20.1
|
|
|