forked from qt-creator/qt-creator
Android: fix copy gradle templates checkbox
The Gradle templates were always being copied over regardless of the checkbox value. Task-number: QTCREATORBUG-26476 Change-Id: I460bf78150239023c2e5eefc152d7e416954d34f Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -154,9 +154,10 @@ ChooseDirectoryPage::ChooseDirectoryPage(CreateAndroidManifestWizard *wizard)
|
|||||||
m_wizard->setDirectory(m_androidPackageSourceDir->unexpandedFilePath());
|
m_wizard->setDirectory(m_androidPackageSourceDir->unexpandedFilePath());
|
||||||
});
|
});
|
||||||
|
|
||||||
if (wizard->copyGradle()) {
|
if (wizard->allowGradleTemplates()) {
|
||||||
auto checkBox = new QCheckBox(this);
|
auto checkBox = new QCheckBox(this);
|
||||||
connect(checkBox, &QCheckBox::toggled, wizard, &CreateAndroidManifestWizard::setCopyGradle);
|
connect(checkBox, &QCheckBox::toggled,
|
||||||
|
wizard, &CreateAndroidManifestWizard::setCopyGradleTemplates);
|
||||||
checkBox->setChecked(false);
|
checkBox->setChecked(false);
|
||||||
checkBox->setText(Tr::tr("Copy the Gradle files to Android directory"));
|
checkBox->setText(Tr::tr("Copy the Gradle files to Android directory"));
|
||||||
checkBox->setToolTip(Tr::tr("It is highly recommended if you are planning to extend the Java part of your Qt application."));
|
checkBox->setToolTip(Tr::tr("It is highly recommended if you are planning to extend the Java part of your Qt application."));
|
||||||
@@ -230,7 +231,8 @@ CreateAndroidManifestWizard::CreateAndroidManifestWizard(BuildSystem *buildSyste
|
|||||||
|
|
||||||
const QList<BuildTargetInfo> buildTargets = buildSystem->applicationTargets();
|
const QList<BuildTargetInfo> buildTargets = buildSystem->applicationTargets();
|
||||||
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(buildSystem->kit());
|
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(buildSystem->kit());
|
||||||
m_copyGradle = version && version->qtVersion() >= AndroidManager::firstQtWithAndroidDeployQt;
|
m_allowGradleTemplates = version &&
|
||||||
|
version->qtVersion() >= AndroidManager::firstQtWithAndroidDeployQt;
|
||||||
|
|
||||||
if (buildTargets.isEmpty()) {
|
if (buildTargets.isEmpty()) {
|
||||||
// oh uhm can't create anything
|
// oh uhm can't create anything
|
||||||
@@ -259,14 +261,19 @@ void CreateAndroidManifestWizard::setDirectory(const FilePath &directory)
|
|||||||
m_directory = directory;
|
m_directory = directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreateAndroidManifestWizard::copyGradle()
|
bool CreateAndroidManifestWizard::copyGradleTemplates() const
|
||||||
{
|
{
|
||||||
return m_copyGradle;
|
return m_copyGradleTemplates;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateAndroidManifestWizard::setCopyGradle(bool copy)
|
bool CreateAndroidManifestWizard::allowGradleTemplates() const
|
||||||
{
|
{
|
||||||
m_copyGradle = copy;
|
return m_allowGradleTemplates;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateAndroidManifestWizard::setCopyGradleTemplates(bool copy)
|
||||||
|
{
|
||||||
|
m_copyGradleTemplates = copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateAndroidManifestWizard::createAndroidTemplateFiles()
|
void CreateAndroidManifestWizard::createAndroidTemplateFiles()
|
||||||
@@ -290,7 +297,7 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
|
|||||||
nullptr,
|
nullptr,
|
||||||
copy());
|
copy());
|
||||||
|
|
||||||
if (m_copyGradle) {
|
if (copyGradleTemplates()) {
|
||||||
FilePath gradlePath = version->prefix() / "src/3rdparty/gradle";
|
FilePath gradlePath = version->prefix() / "src/3rdparty/gradle";
|
||||||
QTC_ASSERT(gradlePath.exists(), return);
|
QTC_ASSERT(gradlePath.exists(), return);
|
||||||
FileUtils::copyRecursively(gradlePath, m_directory, nullptr, copy());
|
FileUtils::copyRecursively(gradlePath, m_directory, nullptr, copy());
|
||||||
|
@@ -19,10 +19,11 @@ public:
|
|||||||
void setBuildKey(const QString &buildKey);
|
void setBuildKey(const QString &buildKey);
|
||||||
|
|
||||||
void accept() override;
|
void accept() override;
|
||||||
bool copyGradle();
|
bool copyGradleTemplates() const;
|
||||||
|
bool allowGradleTemplates() const;
|
||||||
|
|
||||||
void setDirectory(const Utils::FilePath &directory);
|
void setDirectory(const Utils::FilePath &directory);
|
||||||
void setCopyGradle(bool copy);
|
void setCopyGradleTemplates(bool copy);
|
||||||
|
|
||||||
ProjectExplorer::BuildSystem *buildSystem() const;
|
ProjectExplorer::BuildSystem *buildSystem() const;
|
||||||
|
|
||||||
@@ -32,7 +33,8 @@ private:
|
|||||||
ProjectExplorer::BuildSystem *m_buildSystem;
|
ProjectExplorer::BuildSystem *m_buildSystem;
|
||||||
QString m_buildKey;
|
QString m_buildKey;
|
||||||
Utils::FilePath m_directory;
|
Utils::FilePath m_directory;
|
||||||
bool m_copyGradle;
|
bool m_allowGradleTemplates;
|
||||||
|
bool m_copyGradleTemplates;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Android::Internal
|
} // Android::Internal
|
||||||
|
Reference in New Issue
Block a user