Commit e57ed31c authored by Daniel Teske's avatar Daniel Teske

Android: Replace setting for input .json file and use active rc instead

That's a more natural approach to select the application .pro file

Task-number: QTCREATORBUG-13732
Change-Id: I8c6745bea4b408e1d4f7ed2cd4e1d50798c60881
Reviewed-by: default avatarBogDan Vatra <bogdan@kde.org>
parent 2477df97
......@@ -31,6 +31,7 @@
#include "qmakeandroidbuildapkstep.h"
#include "qmakeandroidbuildapkwidget.h"
#include "qmakeandroidrunconfiguration.h"
#include <android/androidconfigurations.h>
#include <android/androidconstants.h>
......@@ -143,17 +144,14 @@ QmakeAndroidBuildApkStep::QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepLis
QString QmakeAndroidBuildApkStep::proFilePathForInputFile() const
{
return m_proFilePathForInputFile;
}
void QmakeAndroidBuildApkStep::setProFilePathForInputFile(const QString &path)
{
m_proFilePathForInputFile = path;
ProjectExplorer::RunConfiguration *rc = target()->activeRunConfiguration();
if (auto *arc = qobject_cast<QmakeAndroidRunConfiguration *>(rc))
return arc->proFilePath();
return QString();
}
QmakeAndroidBuildApkStep::QmakeAndroidBuildApkStep(ProjectExplorer::BuildStepList *bc, QmakeAndroidBuildApkStep *other)
: Android::AndroidBuildApkStep(bc, other),
m_proFilePathForInputFile(other->m_proFilePathForInputFile)
: Android::AndroidBuildApkStep(bc, other)
{
ctor();
}
......@@ -162,7 +160,7 @@ Utils::FileName QmakeAndroidBuildApkStep::androidPackageSourceDir() const
{
QmakeProjectManager::QmakeProject *pro = static_cast<QmakeProjectManager::QmakeProject *>(project());
const QmakeProjectManager::QmakeProFileNode *node
= pro->rootQmakeProjectNode()->findProFileFor(m_proFilePathForInputFile);
= pro->rootQmakeProjectNode()->findProFileFor(proFilePathForInputFile());
if (!node)
return Utils::FileName();
return Utils::FileName::fromString(node->singleVariableValue(QmakeProjectManager::AndroidPackageSourceDir));
......@@ -170,8 +168,6 @@ Utils::FileName QmakeAndroidBuildApkStep::androidPackageSourceDir() const
void QmakeAndroidBuildApkStep::ctor()
{
connect(project(), SIGNAL(proFilesEvaluated()),
this, SLOT(updateInputFile()));
}
bool QmakeAndroidBuildApkStep::init()
......@@ -309,32 +305,14 @@ ProjectExplorer::BuildStepConfigWidget *QmakeAndroidBuildApkStep::createConfigWi
bool QmakeAndroidBuildApkStep::fromMap(const QVariantMap &map)
{
m_proFilePathForInputFile = map.value(ProFilePathForInputFile).toString();
return Android::AndroidBuildApkStep::fromMap(map);
}
QVariantMap QmakeAndroidBuildApkStep::toMap() const
{
QVariantMap map = Android::AndroidBuildApkStep::toMap();
map.insert(ProFilePathForInputFile, m_proFilePathForInputFile);
return map;
}
void QmakeAndroidBuildApkStep::updateInputFile()
{
QmakeProject *pro = static_cast<QmakeProject *>(project());
QList<QmakeProFileNode *> nodes = pro->applicationProFiles();
const QmakeProFileNode *node = pro->rootQmakeProjectNode()->findProFileFor(m_proFilePathForInputFile);
if (!nodes.contains(const_cast<QmakeProFileNode *>(node))) {
if (!nodes.isEmpty())
m_proFilePathForInputFile = nodes.first()->path();
else
m_proFilePathForInputFile.clear();
}
emit inputFileChanged();
}
} // namespace Internal
} // namespace QmakeProjectManager
......@@ -86,18 +86,10 @@ protected:
bool fromMap(const QVariantMap &map);
QVariantMap toMap() const;
signals:
// also on purpose emitted if the possible values of this changed
void inputFileChanged();
private slots:
void updateInputFile();
private:
void setupProcessParameters(ProjectExplorer::ProcessParameters *pp,
ProjectExplorer::BuildConfiguration *bc,
const QStringList &arguments, const QString &command);
QString m_proFilePathForInputFile;
QString m_command;
QString m_argumentsPasswordConcealed;
bool m_skipBuilding;
......
......@@ -39,6 +39,7 @@
#include <qmakeprojectmanager/qmakeproject.h>
#include <QFileDialog>
#include <QLabel>
using QmakeProjectManager::QmakeProject;
using QmakeProjectManager::QmakeProFileNode;
......@@ -86,13 +87,6 @@ QmakeAndroidBuildApkWidget::QmakeAndroidBuildApkWidget(QmakeAndroidBuildApkStep
m_extraLibraryListModel = new AndroidExtraLibraryListModel(static_cast<QmakeProject *>(m_step->project()), this);
m_ui->androidExtraLibsListView->setModel(m_extraLibraryListModel);
updateInputFileUi();
connect(m_step, SIGNAL(inputFileChanged()),
SLOT(updateInputFileUi()));
connect(m_ui->inputFileComboBox, SIGNAL(currentIndexChanged(int)),
SLOT(inputFileComboBoxIndexChanged()));
connect(m_ui->createAndroidTemplatesButton, SIGNAL(clicked()),
SLOT(createAndroidTemplatesButton()));
......@@ -116,40 +110,6 @@ QmakeAndroidBuildApkWidget::~QmakeAndroidBuildApkWidget()
delete m_ui;
}
void QmakeAndroidBuildApkWidget::updateInputFileUi()
{
QmakeProject *project
= static_cast<QmakeProject *>(m_step->project());
QList<QmakeProFileNode *> nodes = project->applicationProFiles();
int size = nodes.size();
if (size == 0 || size == 1) {
// there's nothing to select, e.g. before parsing
m_ui->inputFileLabel->setVisible(false);
m_ui->inputFileComboBox->setVisible(false);
} else {
m_ignoreChange = true;
m_ui->inputFileLabel->setVisible(true);
m_ui->inputFileComboBox->setVisible(true);
m_ui->inputFileComboBox->clear();
foreach (QmakeProFileNode *node, nodes)
m_ui->inputFileComboBox->addItem(node->displayName(), node->path());
int index = m_ui->inputFileComboBox->findData(m_step->proFilePathForInputFile());
m_ui->inputFileComboBox->setCurrentIndex(index);
m_ignoreChange = false;
}
}
void QmakeAndroidBuildApkWidget::inputFileComboBoxIndexChanged()
{
if (m_ignoreChange)
return;
QString proFilePath = m_ui->inputFileComboBox->itemData(m_ui->inputFileComboBox->currentIndex()).toString();
m_step->setProFilePathForInputFile(proFilePath);
}
void QmakeAndroidBuildApkWidget::createAndroidTemplatesButton()
{
CreateAndroidManifestWizard wizard(m_step->target());
......
......@@ -61,8 +61,6 @@ public:
~QmakeAndroidBuildApkWidget();
private slots:
void updateInputFileUi();
void inputFileComboBoxIndexChanged();
void createAndroidTemplatesButton();
void addAndroidExtraLib();
void removeAndroidExtraLib();
......
......@@ -50,20 +50,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="inputFileLabel">
<property name="text">
<string>Input file for androiddeployqt:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="inputFileComboBox"/>
</item>
</layout>
</item>
</layout>
</widget>
</item>
......
......@@ -104,7 +104,7 @@ QList<Core::Id> QmakeAndroidRunConfigurationFactory::availableCreationIds(Target
RunConfiguration *QmakeAndroidRunConfigurationFactory::doCreate(Target *parent, Core::Id id)
{
if (parent->project()->rootProjectNode())
return new QmakeAndroidRunConfiguration(parent, id, parent->project()->rootProjectNode()->path());
return new QmakeAndroidRunConfiguration(parent, id, pathFromId(id));
return new QmakeAndroidRunConfiguration(parent, id);
}
......@@ -113,7 +113,7 @@ RunConfiguration *QmakeAndroidRunConfigurationFactory::doRestore(Target *parent,
{
Core::Id id = ProjectExplorer::idFromMap(map);
if (parent->project()->rootProjectNode())
return new QmakeAndroidRunConfiguration(parent, id, parent->project()->rootProjectNode()->path());
return new QmakeAndroidRunConfiguration(parent, id);
return new QmakeAndroidRunConfiguration(parent, id);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment