2013-09-26 18:38:44 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-09-26 18:38:44 +02:00
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2013-09-26 18:38:44 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2013-09-26 18:38:44 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "createandroidmanifestwizard.h"
|
2015-01-16 13:22:47 +01:00
|
|
|
#include "qmakeandroidrunconfiguration.h"
|
2013-09-26 18:38:44 +02:00
|
|
|
|
2014-09-22 16:20:51 +03:00
|
|
|
#include <android/androidconfigurations.h>
|
2014-06-25 15:42:11 +02:00
|
|
|
#include <android/androidmanager.h>
|
|
|
|
|
#include <android/androidqtsupport.h>
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
|
|
|
|
|
2013-09-26 18:38:44 +02:00
|
|
|
#include <projectexplorer/target.h>
|
2014-06-25 15:42:11 +02:00
|
|
|
|
2013-10-29 16:19:24 +01:00
|
|
|
#include <qmakeprojectmanager/qmakeproject.h>
|
2014-06-25 15:42:11 +02:00
|
|
|
|
2013-09-26 18:38:44 +02:00
|
|
|
#include <proparser/prowriter.h>
|
2014-06-25 15:42:11 +02:00
|
|
|
|
|
|
|
|
#include <qtsupport/qtkitinformation.h>
|
|
|
|
|
|
2016-08-03 17:55:54 +02:00
|
|
|
#include <utils/utilsicons.h>
|
|
|
|
|
|
2014-09-22 16:20:51 +03:00
|
|
|
#include <QCheckBox>
|
2013-09-26 18:38:44 +02:00
|
|
|
#include <QComboBox>
|
|
|
|
|
#include <QFormLayout>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
|
|
|
|
using namespace Android;
|
2014-07-23 12:47:51 +02:00
|
|
|
using namespace QmakeAndroidSupport::Internal;
|
2014-09-22 16:20:51 +03:00
|
|
|
using namespace Utils;
|
2014-06-25 15:42:11 +02:00
|
|
|
|
2013-10-29 14:22:31 +01:00
|
|
|
using QmakeProjectManager::QmakeProject;
|
2017-02-10 11:16:18 +01:00
|
|
|
using QmakeProjectManager::QmakeProFile;
|
2013-09-26 18:38:44 +02:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// NoApplicationProFilePage
|
|
|
|
|
//
|
|
|
|
|
NoApplicationProFilePage::NoApplicationProFilePage(CreateAndroidManifestWizard *wizard)
|
|
|
|
|
: m_wizard(wizard)
|
|
|
|
|
{
|
|
|
|
|
QVBoxLayout *layout = new QVBoxLayout(this);
|
|
|
|
|
QLabel *label = new QLabel(this);
|
|
|
|
|
label->setWordWrap(true);
|
|
|
|
|
label->setText(tr("No application .pro file found in this project."));
|
|
|
|
|
layout->addWidget(label);
|
|
|
|
|
setTitle(tr("No Application .pro File"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// ChooseProFilePage
|
|
|
|
|
//
|
2017-02-10 11:16:18 +01:00
|
|
|
ChooseProFilePage::ChooseProFilePage(CreateAndroidManifestWizard *wizard,
|
|
|
|
|
const QList<QmakeProFile *> &files,
|
|
|
|
|
const QmakeProFile *select) :
|
|
|
|
|
m_wizard(wizard)
|
2013-09-26 18:38:44 +02:00
|
|
|
{
|
|
|
|
|
QFormLayout *fl = new QFormLayout(this);
|
|
|
|
|
QLabel *label = new QLabel(this);
|
|
|
|
|
label->setWordWrap(true);
|
2014-09-22 16:20:51 +03:00
|
|
|
label->setText(tr("Select the .pro file for which you want to create the Android template files."));
|
2013-09-26 18:38:44 +02:00
|
|
|
fl->addRow(label);
|
|
|
|
|
|
|
|
|
|
m_comboBox = new QComboBox(this);
|
2017-02-10 11:16:18 +01:00
|
|
|
for (QmakeProFile *file : files) {
|
|
|
|
|
m_comboBox->addItem(file->displayName(), QVariant::fromValue(static_cast<void *>(file))); // TODO something more?
|
|
|
|
|
if (file == select)
|
2015-01-16 13:22:47 +01:00
|
|
|
m_comboBox->setCurrentIndex(m_comboBox->count() - 1);
|
|
|
|
|
}
|
2013-09-26 18:38:44 +02:00
|
|
|
|
2015-01-16 13:22:47 +01:00
|
|
|
nodeSelected(m_comboBox->currentIndex());
|
2016-06-26 22:52:59 +03:00
|
|
|
connect(m_comboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
|
|
|
|
this, &ChooseProFilePage::nodeSelected);
|
2013-09-26 18:38:44 +02:00
|
|
|
|
|
|
|
|
fl->addRow(tr(".pro file:"), m_comboBox);
|
|
|
|
|
setTitle(tr("Select a .pro File"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ChooseProFilePage::nodeSelected(int index)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(index)
|
2017-02-10 11:16:18 +01:00
|
|
|
m_wizard->setProFile(static_cast<QmakeProFile *>(m_comboBox->itemData(m_comboBox->currentIndex()).value<void *>()));
|
2013-09-26 18:38:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// ChooseDirectoryPage
|
|
|
|
|
//
|
|
|
|
|
ChooseDirectoryPage::ChooseDirectoryPage(CreateAndroidManifestWizard *wizard)
|
2014-03-12 15:20:39 +01:00
|
|
|
: m_wizard(wizard), m_androidPackageSourceDir(0), m_complete(true)
|
2013-09-26 18:38:44 +02:00
|
|
|
{
|
2015-01-16 13:22:47 +01:00
|
|
|
m_layout = new QFormLayout(this);
|
|
|
|
|
m_label = new QLabel(this);
|
|
|
|
|
m_label->setWordWrap(true);
|
|
|
|
|
m_layout->addRow(m_label);
|
2013-09-26 18:38:44 +02:00
|
|
|
|
2015-01-16 13:22:47 +01:00
|
|
|
m_androidPackageSourceDir = new PathChooser(this);
|
|
|
|
|
m_androidPackageSourceDir->setExpectedKind(PathChooser::Directory);
|
|
|
|
|
m_layout->addRow(tr("Android package source directory:"), m_androidPackageSourceDir);
|
2013-09-26 18:38:44 +02:00
|
|
|
|
2014-03-12 15:20:39 +01:00
|
|
|
m_sourceDirectoryWarning = new QLabel(this);
|
|
|
|
|
m_sourceDirectoryWarning->setVisible(false);
|
2014-03-31 13:38:15 +02:00
|
|
|
m_sourceDirectoryWarning->setText(tr("The Android package source directory cannot be the same as the project directory."));
|
2014-03-12 15:20:39 +01:00
|
|
|
m_sourceDirectoryWarning->setWordWrap(true);
|
|
|
|
|
m_warningIcon = new QLabel(this);
|
|
|
|
|
m_warningIcon->setVisible(false);
|
2017-01-02 12:37:49 +01:00
|
|
|
m_warningIcon->setPixmap(Utils::Icons::CRITICAL.pixmap());
|
2014-03-12 15:20:39 +01:00
|
|
|
m_warningIcon->setWordWrap(true);
|
|
|
|
|
m_warningIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
|
|
|
|
|
|
|
|
QHBoxLayout *hbox = new QHBoxLayout;
|
|
|
|
|
hbox->addWidget(m_warningIcon);
|
|
|
|
|
hbox->addWidget(m_sourceDirectoryWarning);
|
|
|
|
|
hbox->setAlignment(m_warningIcon, Qt::AlignTop);
|
|
|
|
|
|
2015-01-16 13:22:47 +01:00
|
|
|
m_layout->addRow(hbox);
|
2013-09-26 18:38:44 +02:00
|
|
|
|
2016-06-26 22:52:59 +03:00
|
|
|
connect(m_androidPackageSourceDir, &PathChooser::pathChanged,
|
|
|
|
|
m_wizard, &CreateAndroidManifestWizard::setDirectory);
|
2014-09-22 16:20:51 +03:00
|
|
|
|
|
|
|
|
if (wizard->copyGradle()) {
|
|
|
|
|
QCheckBox *checkBox = new QCheckBox(this);
|
|
|
|
|
checkBox->setChecked(true);
|
|
|
|
|
connect(checkBox, &QCheckBox::toggled, wizard, &CreateAndroidManifestWizard::setCopyGradle);
|
|
|
|
|
checkBox->setText(tr("Copy the Gradle files to Android directory"));
|
2015-01-05 14:21:59 +01:00
|
|
|
checkBox->setToolTip(tr("It is highly recommended if you are planning to extend the Java part of your Qt application."));
|
2015-01-16 13:22:47 +01:00
|
|
|
m_layout->addRow(checkBox);
|
2014-09-22 16:20:51 +03:00
|
|
|
}
|
2013-09-26 18:38:44 +02:00
|
|
|
}
|
|
|
|
|
|
2014-03-12 15:20:39 +01:00
|
|
|
void ChooseDirectoryPage::checkPackageSourceDir()
|
|
|
|
|
{
|
2017-02-10 11:16:18 +01:00
|
|
|
QString projectDir = m_wizard->proFile()->filePath().toFileInfo().absolutePath();
|
2014-03-12 15:20:39 +01:00
|
|
|
QString newDir = m_androidPackageSourceDir->path();
|
|
|
|
|
bool isComplete = QFileInfo(projectDir) != QFileInfo(newDir);
|
|
|
|
|
|
|
|
|
|
m_sourceDirectoryWarning->setVisible(!isComplete);
|
|
|
|
|
m_warningIcon->setVisible(!isComplete);
|
|
|
|
|
|
|
|
|
|
if (isComplete != m_complete) {
|
|
|
|
|
m_complete = isComplete;
|
|
|
|
|
emit completeChanged();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ChooseDirectoryPage::isComplete() const
|
|
|
|
|
{
|
|
|
|
|
return m_complete;
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-16 13:22:47 +01:00
|
|
|
void ChooseDirectoryPage::initializePage()
|
|
|
|
|
{
|
2017-02-10 11:16:18 +01:00
|
|
|
QString androidPackageDir = m_wizard->proFile()->singleVariableValue(QmakeProjectManager::Variable::AndroidPackageSourceDir);
|
2015-01-16 13:22:47 +01:00
|
|
|
if (androidPackageDir.isEmpty()) {
|
|
|
|
|
m_label->setText(tr("Select the Android package source directory.\n\n"
|
|
|
|
|
"The files in the Android package source directory are copied to the build directory's "
|
|
|
|
|
"Android directory and the default files are overwritten."));
|
|
|
|
|
|
2017-02-10 11:16:18 +01:00
|
|
|
m_androidPackageSourceDir->setPath(m_wizard->proFile()->filePath().toFileInfo().absolutePath().append(QLatin1String("/android")));
|
2016-06-26 22:52:59 +03:00
|
|
|
connect(m_androidPackageSourceDir, &PathChooser::rawPathChanged,
|
|
|
|
|
this, &ChooseDirectoryPage::checkPackageSourceDir);
|
2015-01-16 13:22:47 +01:00
|
|
|
} else {
|
|
|
|
|
m_label->setText(tr("The Android template files will be created in the ANDROID_PACKAGE_SOURCE_DIR set in the .pro file."));
|
|
|
|
|
m_androidPackageSourceDir->setPath(androidPackageDir);
|
|
|
|
|
m_androidPackageSourceDir->setReadOnly(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_wizard->setDirectory(m_androidPackageSourceDir->path());
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-26 18:38:44 +02:00
|
|
|
//
|
|
|
|
|
// CreateAndroidManifestWizard
|
|
|
|
|
//
|
|
|
|
|
CreateAndroidManifestWizard::CreateAndroidManifestWizard(ProjectExplorer::Target *target)
|
2017-02-10 11:16:18 +01:00
|
|
|
: m_target(target), m_proFile(0), m_copyState(Ask)
|
2013-09-26 18:38:44 +02:00
|
|
|
{
|
2014-09-22 16:20:51 +03:00
|
|
|
setWindowTitle(tr("Create Android Template Files Wizard"));
|
2013-09-26 18:38:44 +02:00
|
|
|
|
2013-10-29 14:22:31 +01:00
|
|
|
QmakeProject *project = static_cast<QmakeProject *>(target->project());
|
2017-02-10 11:16:18 +01:00
|
|
|
QList<QmakeProFile *> files = project->applicationProFiles();
|
2014-09-22 16:20:51 +03:00
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target->kit());
|
|
|
|
|
m_copyGradle = version && version->qtVersion() >= QtSupport::QtVersionNumber(5, 4, 0);
|
|
|
|
|
|
2017-02-10 11:16:18 +01:00
|
|
|
const QmakeProFile *currentRunNode = nullptr;
|
2015-01-16 13:22:47 +01:00
|
|
|
ProjectExplorer::RunConfiguration *rc = target->activeRunConfiguration();
|
|
|
|
|
if (auto qrc = qobject_cast<QmakeAndroidRunConfiguration *>(rc))
|
2017-02-10 11:16:18 +01:00
|
|
|
currentRunNode = project->rootProFile()->findProFile(qrc->proFilePath());
|
2015-01-16 13:22:47 +01:00
|
|
|
|
2017-02-10 11:16:18 +01:00
|
|
|
if (files.isEmpty()) {
|
2013-09-26 18:38:44 +02:00
|
|
|
// oh uhm can't create anything
|
|
|
|
|
addPage(new NoApplicationProFilePage(this));
|
2017-02-10 11:16:18 +01:00
|
|
|
} else if (files.size() == 1) {
|
|
|
|
|
setProFile(files.first());
|
2013-09-26 18:38:44 +02:00
|
|
|
addPage(new ChooseDirectoryPage(this));
|
|
|
|
|
} else {
|
2017-02-10 11:16:18 +01:00
|
|
|
addPage(new ChooseProFilePage(this, files, currentRunNode));
|
2013-09-26 18:38:44 +02:00
|
|
|
addPage(new ChooseDirectoryPage(this));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-10 11:16:18 +01:00
|
|
|
QmakeProjectManager::QmakeProFile *CreateAndroidManifestWizard::proFile() const
|
2013-09-26 18:38:44 +02:00
|
|
|
{
|
2017-02-10 11:16:18 +01:00
|
|
|
return m_proFile;
|
2013-09-26 18:38:44 +02:00
|
|
|
}
|
|
|
|
|
|
2017-02-10 11:16:18 +01:00
|
|
|
void CreateAndroidManifestWizard::setProFile(QmakeProjectManager::QmakeProFile *node)
|
2013-09-26 18:38:44 +02:00
|
|
|
{
|
2017-02-10 11:16:18 +01:00
|
|
|
m_proFile = node;
|
2013-09-26 18:38:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CreateAndroidManifestWizard::setDirectory(const QString &directory)
|
|
|
|
|
{
|
|
|
|
|
m_directory = directory;
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-22 16:20:51 +03:00
|
|
|
bool CreateAndroidManifestWizard::copyGradle()
|
2013-09-26 18:38:44 +02:00
|
|
|
{
|
2014-09-22 16:20:51 +03:00
|
|
|
return m_copyGradle;
|
2014-07-21 21:55:01 +02:00
|
|
|
}
|
|
|
|
|
|
2014-09-22 16:20:51 +03:00
|
|
|
void CreateAndroidManifestWizard::setCopyGradle(bool copy)
|
2014-07-21 21:55:01 +02:00
|
|
|
{
|
2014-09-22 16:20:51 +03:00
|
|
|
m_copyGradle = copy;
|
2013-09-26 18:38:44 +02:00
|
|
|
}
|
|
|
|
|
|
2014-09-22 16:20:51 +03:00
|
|
|
bool CreateAndroidManifestWizard::copy(const QFileInfo &src, const QFileInfo &dst, QStringList * addedFiles)
|
2013-09-26 18:38:44 +02:00
|
|
|
{
|
2014-09-22 16:20:51 +03:00
|
|
|
bool copyFile = true;
|
|
|
|
|
if (dst.exists()) {
|
|
|
|
|
switch (m_copyState) {
|
|
|
|
|
case Ask:
|
|
|
|
|
{
|
|
|
|
|
int res = QMessageBox::question(this,
|
|
|
|
|
tr("Overwrite %1 file").arg(dst.fileName()),
|
|
|
|
|
tr("Overwrite existing \"%1\"?")
|
|
|
|
|
.arg(QDir(m_directory).relativeFilePath(dst.absoluteFilePath())),
|
|
|
|
|
QMessageBox::Yes | QMessageBox::YesToAll |
|
|
|
|
|
QMessageBox::No | QMessageBox::NoToAll |
|
|
|
|
|
QMessageBox::Cancel);
|
|
|
|
|
switch (res) {
|
|
|
|
|
case QMessageBox::YesToAll:
|
|
|
|
|
m_copyState = OverwriteAll;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case QMessageBox::Yes:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case QMessageBox::NoToAll:
|
|
|
|
|
m_copyState = SkipAll;
|
|
|
|
|
copyFile = false;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case QMessageBox::No:
|
|
|
|
|
copyFile = false;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2013-09-26 18:38:44 +02:00
|
|
|
}
|
2014-09-22 16:20:51 +03:00
|
|
|
break;
|
|
|
|
|
case SkipAll:
|
|
|
|
|
copyFile = false;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2013-09-26 18:38:44 +02:00
|
|
|
}
|
2014-09-22 16:20:51 +03:00
|
|
|
if (copyFile)
|
|
|
|
|
QFile::remove(dst.filePath());
|
2013-09-26 18:38:44 +02:00
|
|
|
}
|
|
|
|
|
|
2014-09-22 16:20:51 +03:00
|
|
|
if (!dst.absoluteDir().exists())
|
|
|
|
|
dst.absoluteDir().mkpath(dst.absolutePath());
|
2014-07-21 21:55:01 +02:00
|
|
|
|
2014-09-22 16:20:51 +03:00
|
|
|
if (copyFile && !QFile::copy(src.filePath(), dst.filePath())) {
|
2014-07-21 21:55:01 +02:00
|
|
|
QMessageBox::warning(this, tr("File Creation Error"),
|
2014-09-22 16:20:51 +03:00
|
|
|
tr("Could not copy file \"%1\" to \"%2\".")
|
|
|
|
|
.arg(src.filePath()).arg(dst.filePath()));
|
|
|
|
|
return false;
|
2014-07-21 21:55:01 +02:00
|
|
|
}
|
2014-09-22 16:20:51 +03:00
|
|
|
addedFiles->append(dst.absoluteFilePath());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2014-07-21 21:55:01 +02:00
|
|
|
|
2014-09-22 16:20:51 +03:00
|
|
|
void CreateAndroidManifestWizard::createAndroidTemplateFiles()
|
|
|
|
|
{
|
|
|
|
|
if (m_directory.isEmpty())
|
2013-09-26 18:38:44 +02:00
|
|
|
return;
|
2014-09-22 16:20:51 +03:00
|
|
|
|
|
|
|
|
QStringList addedFiles;
|
|
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(m_target->kit());
|
2014-11-18 18:26:08 +02:00
|
|
|
if (!version)
|
|
|
|
|
return;
|
|
|
|
|
if (version->qtVersion() < QtSupport::QtVersionNumber(5, 4, 0)) {
|
2014-09-22 16:20:51 +03:00
|
|
|
const QString src(version->qmakeProperty("QT_INSTALL_PREFIX")
|
|
|
|
|
.append(QLatin1String("/src/android/java/AndroidManifest.xml")));
|
|
|
|
|
FileUtils::copyRecursively(FileName::fromString(src),
|
|
|
|
|
FileName::fromString(m_directory + QLatin1String("/AndroidManifest.xml")),
|
|
|
|
|
0, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
|
|
|
|
|
} else {
|
|
|
|
|
const QString src(version->qmakeProperty("QT_INSTALL_PREFIX")
|
|
|
|
|
.append(QLatin1String("/src/android/templates")));
|
|
|
|
|
|
|
|
|
|
FileUtils::copyRecursively(FileName::fromString(src),
|
|
|
|
|
FileName::fromString(m_directory),
|
|
|
|
|
0, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
|
|
|
|
|
|
|
|
|
|
if (m_copyGradle)
|
|
|
|
|
FileUtils::copyRecursively(AndroidConfigurations::currentConfig().sdkLocation().appendPath(QLatin1String("/tools/templates/gradle/wrapper")),
|
|
|
|
|
FileName::fromString(m_directory),
|
|
|
|
|
0, [this, &addedFiles](QFileInfo src, QFileInfo dst, QString *){return copy(src, dst, &addedFiles);});
|
|
|
|
|
|
|
|
|
|
AndroidManager::updateGradleProperties(m_target);
|
2013-09-26 18:38:44 +02:00
|
|
|
}
|
2017-02-10 11:16:18 +01:00
|
|
|
m_proFile->addFiles(addedFiles);
|
2013-09-26 18:38:44 +02:00
|
|
|
|
2017-02-10 11:16:18 +01:00
|
|
|
if (m_proFile->singleVariableValue(QmakeProjectManager::Variable::AndroidPackageSourceDir).isEmpty()) {
|
2013-09-26 18:38:44 +02:00
|
|
|
// and now time for some magic
|
|
|
|
|
QString value = QLatin1String("$$PWD/")
|
2017-02-10 11:16:18 +01:00
|
|
|
+ m_proFile->filePath().toFileInfo().absoluteDir().relativeFilePath(m_directory);
|
2013-09-26 18:38:44 +02:00
|
|
|
bool result =
|
2017-02-10 11:16:18 +01:00
|
|
|
m_proFile->setProVariable(QLatin1String("ANDROID_PACKAGE_SOURCE_DIR"), QStringList(value));
|
2013-09-26 18:38:44 +02:00
|
|
|
|
2014-09-22 16:20:51 +03:00
|
|
|
if (!result) {
|
2013-09-26 18:38:44 +02:00
|
|
|
QMessageBox::warning(this, tr("Project File not Updated"),
|
2015-02-02 00:37:38 +02:00
|
|
|
tr("Could not update the .pro file %1.")
|
2017-02-10 11:16:18 +01:00
|
|
|
.arg(m_proFile->filePath().toUserOutput()));
|
2013-09-26 18:38:44 +02:00
|
|
|
}
|
|
|
|
|
}
|
2014-09-22 16:20:51 +03:00
|
|
|
Core::EditorManager::openEditor(m_directory + QLatin1String("/AndroidManifest.xml"));
|
2013-09-26 18:38:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CreateAndroidManifestWizard::accept()
|
|
|
|
|
{
|
2014-09-22 16:20:51 +03:00
|
|
|
createAndroidTemplateFiles();
|
2015-02-03 23:50:37 +02:00
|
|
|
Wizard::accept();
|
2013-09-26 18:38:44 +02:00
|
|
|
}
|