diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp index bc80a84ba75..18bb2d1b486 100644 --- a/src/plugins/android/androidmanifesteditorwidget.cpp +++ b/src/plugins/android/androidmanifesteditorwidget.cpp @@ -240,6 +240,18 @@ void AndroidManifestEditorWidget::initializePage() m_targetLineEdit->installEventFilter(this); formLayout->addRow(tr("Run:"), m_targetLineEdit); + m_styleExtractMethod = new QComboBox(applicationGroupBox); + formLayout->addRow(tr("Style extraction:"), m_styleExtractMethod); + QList styleMethodsMap = { + {"default", "In most cases this will be the same as \"full\", but it can also be something else if needed, e.g. for compatibility reasons."}, + {"full", "Useful for Qt Widgets & Qt Quick Controls 1 apps."}, + {"minimal", "Useful for Qt Quick Controls 2 apps, it is much faster than \"full\"."}, + {"none", "Useful for apps that don't use Qt Widgets, Qt Quick Controls 1 or Qt Quick Controls 2."}}; + for (int i = 0; i addItem(styleMethodsMap.at(i).at(0)); + m_styleExtractMethod->setItemData(i, styleMethodsMap.at(i).at(1), Qt::ToolTipRole); + } + auto iconLayout = new QHBoxLayout(); createDPIButton(iconLayout, @@ -297,6 +309,9 @@ void AndroidManifestEditorWidget::initializePage() this, setDirtyFunc); connect(m_targetLineEdit, &QComboBox::currentTextChanged, this, setDirtyFunc); + connect(m_styleExtractMethod, + QOverload::of(&QComboBox::currentIndexChanged), + this, setDirtyFunc); connect(m_masterIconButton, &QAbstractButton::clicked, this, &AndroidManifestEditorWidget::setMasterIcon); @@ -804,11 +819,21 @@ void AndroidManifestEditorWidget::syncToWidgets(const QDomDocument &doc) QDomElement metadataElem = activityElem.firstChildElement(QLatin1String("meta-data")); + const int parseItemsCount = 2; + int counter = 0; while (!metadataElem.isNull()) { if (metadataElem.attribute(QLatin1String("android:name")) == QLatin1String("android.app.lib_name")) { m_targetLineEdit->setEditText(metadataElem.attribute(QLatin1String("android:value"))); - break; + ++counter; + } else if (metadataElem.attribute(QLatin1String("android:name")) + == QLatin1String("android.app.extract_android_style")) { + m_styleExtractMethod->setCurrentText( + metadataElem.attribute(QLatin1String("android:value"))); + ++counter; } + + if (counter == parseItemsCount) + break; metadataElem = metadataElem.nextSiblingElement(QLatin1String("meta-data")); } @@ -1093,15 +1118,24 @@ bool AndroidManifestEditorWidget::parseMetaData(QXmlStreamReader &reader, QXmlSt { Q_ASSERT(reader.isStartElement()); - bool found = false; + const int parseItemsCount = 2; + int counter = 0; QXmlStreamAttributes attributes = reader.attributes(); QXmlStreamAttributes result; + QStringList keys; + QStringList values; if (attributes.value(QLatin1String("android:name")) == QLatin1String("android.app.lib_name")) { - QStringList keys = QStringList("android:value"); - QStringList values = QStringList(m_targetLineEdit->currentText()); + keys = QStringList("android:value"); + values = QStringList(m_targetLineEdit->currentText()); result = modifyXmlStreamAttributes(attributes, keys, values); - found = true; + ++counter; + } else if (attributes.value(QLatin1String("android:name")) + == QLatin1String("android.app.extract_android_style")) { + keys = QStringList("android:value"); + values = QStringList(m_styleExtractMethod->currentText()); + result = modifyXmlStreamAttributes(attributes, keys, values); + ++counter; } else { result = attributes; } @@ -1114,7 +1148,7 @@ bool AndroidManifestEditorWidget::parseMetaData(QXmlStreamReader &reader, QXmlSt while (!reader.atEnd()) { if (reader.isEndElement()) { writer.writeCurrentToken(reader); - return found; + return counter == parseItemsCount; } else if (reader.isStartElement()) { parseUnknownElement(reader, writer); } else { @@ -1122,7 +1156,7 @@ bool AndroidManifestEditorWidget::parseMetaData(QXmlStreamReader &reader, QXmlSt } reader.readNext(); } - return found; // should never be reached + return counter == parseItemsCount; // should never be reached } void AndroidManifestEditorWidget::parseUsesSdk(QXmlStreamReader &reader, QXmlStreamWriter & writer) diff --git a/src/plugins/android/androidmanifesteditorwidget.h b/src/plugins/android/androidmanifesteditorwidget.h index efbc2b529a4..8e38773cd69 100644 --- a/src/plugins/android/androidmanifesteditorwidget.h +++ b/src/plugins/android/androidmanifesteditorwidget.h @@ -189,6 +189,7 @@ private: QLineEdit *m_appNameLineEdit; QLineEdit *m_activityNameLineEdit; QComboBox *m_targetLineEdit; + QComboBox *m_styleExtractMethod; QToolButton *m_masterIconButton; QToolButton *m_lIconButton; QToolButton *m_lIconClearButton;