forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.1'
Conflicts: src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp Change-Id: Icce6e8dd9b3afd9a0fe836e9babfb7a17cee9c4d
This commit is contained in:
@@ -102,6 +102,13 @@ void AndroidAnalyzeSupport::handleRemoteProcessStarted(int qmlPort)
|
||||
m_qmlPort = qmlPort;
|
||||
}
|
||||
|
||||
void AndroidAnalyzeSupport::handleRemoteProcessFinished(const QString &errorMsg)
|
||||
{
|
||||
if (m_runControl)
|
||||
m_runControl->notifyRemoteFinished();
|
||||
AndroidRunSupport::handleRemoteProcessFinished(errorMsg);
|
||||
}
|
||||
|
||||
void AndroidAnalyzeSupport::handleRemoteOutput(const QByteArray &output)
|
||||
{
|
||||
const QString msg = QString::fromUtf8(output);
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
private slots:
|
||||
void handleRemoteProcessStarted(int qmlPort);
|
||||
|
||||
void handleRemoteProcessFinished(const QString &errorMsg);
|
||||
void handleRemoteOutput(const QByteArray &output);
|
||||
void handleRemoteErrorOutput(const QByteArray &output);
|
||||
|
||||
|
||||
@@ -467,7 +467,7 @@ QString AndroidConfig::createAVD(QWidget *parent, int minApiLevel, QString targe
|
||||
avdDialog.abiComboBox->addItems(QStringList(targetArch));
|
||||
|
||||
if (!avdDialog.targetComboBox->count()) {
|
||||
QMessageBox::critical(0, QApplication::translate("AndroidConfig", "Error Creating AVD"),
|
||||
QMessageBox::critical(parent, QApplication::translate("AndroidConfig", "Error Creating AVD"),
|
||||
QApplication::translate("AndroidConfig", "Cannot create a new AVD. No sufficiently recent Android SDK available.\n"
|
||||
"Please install an SDK of at least API version %1.").
|
||||
arg(minApiLevel));
|
||||
@@ -479,11 +479,19 @@ QString AndroidConfig::createAVD(QWidget *parent, int minApiLevel, QString targe
|
||||
avdDialog.nameLineEdit->setValidator(&v);
|
||||
if (d.exec() != QDialog::Accepted)
|
||||
return QString();
|
||||
return createAVD(avdDialog.targetComboBox->currentText(), avdDialog.nameLineEdit->text(),
|
||||
avdDialog.abiComboBox->currentText(), avdDialog.sizeSpinBox->value());
|
||||
QString error;
|
||||
QString avd = createAVD(avdDialog.targetComboBox->currentText(), avdDialog.nameLineEdit->text(),
|
||||
avdDialog.abiComboBox->currentText(), avdDialog.sizeSpinBox->value(),
|
||||
&error);
|
||||
if (!error.isEmpty()) {
|
||||
QMessageBox::critical(parent, QApplication::translate("AndroidConfig", "Error Creating AVD"),
|
||||
error);
|
||||
}
|
||||
|
||||
return avd;
|
||||
}
|
||||
|
||||
QString AndroidConfig::createAVD(const QString &target, const QString &name, const QString &abi, int sdcardSize) const
|
||||
QString AndroidConfig::createAVD(const QString &target, const QString &name, const QString &abi, int sdcardSize, QString *error) const
|
||||
{
|
||||
QProcess proc;
|
||||
proc.setProcessEnvironment(androidToolEnvironment().toProcessEnvironment());
|
||||
@@ -518,12 +526,16 @@ QString AndroidConfig::createAVD(const QString &target, const QString &name, con
|
||||
break;
|
||||
}
|
||||
|
||||
Core::MessageManager::write(QString::fromLocal8Bit(question), Core::MessageManager::Flash);
|
||||
|
||||
proc.waitForFinished();
|
||||
|
||||
if (proc.exitCode()) // error!
|
||||
QString errorOutput = QString::fromLocal8Bit(proc.readAllStandardError());
|
||||
// The exit code is always 0, so we need to check stderr
|
||||
// For now assume that any output at all indicates a error
|
||||
if (!errorOutput.isEmpty()) {
|
||||
*error = errorOutput;
|
||||
return QString();
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -991,7 +1003,7 @@ void AndroidConfigurations::updateAutomaticKitList()
|
||||
QList<Kit *> existingKits;
|
||||
|
||||
foreach (Kit *k, KitManager::kits()) {
|
||||
if (DeviceKitInformation::deviceId(k) != Core::Id(Constants::ANDROID_DEVICE_ID))
|
||||
if (DeviceTypeKitInformation::deviceTypeId(k) != Core::Id(Constants::ANDROID_DEVICE_TYPE))
|
||||
continue;
|
||||
if (!k->isAutoDetected())
|
||||
continue;
|
||||
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
|
||||
|
||||
QString createAVD(QWidget *parent, int minApiLevel = 0, QString targetArch = QString()) const;
|
||||
QString createAVD(const QString &target, const QString &name, const QString &abi, int sdcardSize) const;
|
||||
QString createAVD(const QString &target, const QString &name, const QString &abi, int sdcardSize, QString *error) const;
|
||||
bool removeAVD(const QString &name) const;
|
||||
|
||||
QVector<AndroidDeviceInfo> connectedDevices(QString *error = 0) const;
|
||||
|
||||
@@ -527,9 +527,7 @@ QAbstractItemModel *AndroidDeployQtStep::keystoreCertificates()
|
||||
if (!m_keystorePasswd.length())
|
||||
return 0;
|
||||
params << m_keystorePasswd;
|
||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
||||
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
|
||||
keytoolProc.setProcessEnvironment(env.toProcessEnvironment());
|
||||
params << QLatin1String("-J\"-Duser.language=en\"");
|
||||
keytoolProc.start(AndroidConfigurations::currentConfig().keytoolPath().toString(), params);
|
||||
if (!keytoolProc.waitForStarted() || !keytoolProc.waitForFinished()) {
|
||||
QMessageBox::critical(0, tr("Error"),
|
||||
|
||||
@@ -154,8 +154,10 @@ AndroidDeployQtWidget::AndroidDeployQtWidget(AndroidDeployQtStep *step)
|
||||
connect(m_ui->addAndroidExtraLibButton, SIGNAL(clicked()), this, SLOT(addAndroidExtraLib()));
|
||||
connect(m_ui->removeAndroidExtraLibButton, SIGNAL(clicked()), this, SLOT(removeAndroidExtraLib()));
|
||||
|
||||
connect(m_step->project(), SIGNAL(proFilesEvaluated()), this, SLOT(checkProjectTemplate()));
|
||||
checkProjectTemplate();
|
||||
connect(m_extraLibraryListModel, SIGNAL(enabledChanged(bool)),
|
||||
m_ui->additionalLibrariesGroupBox, SLOT(setEnabled(bool)));
|
||||
|
||||
m_ui->additionalLibrariesGroupBox->setEnabled(m_extraLibraryListModel->isEnabled());
|
||||
}
|
||||
|
||||
AndroidDeployQtWidget::~AndroidDeployQtWidget()
|
||||
@@ -163,15 +165,6 @@ AndroidDeployQtWidget::~AndroidDeployQtWidget()
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void AndroidDeployQtWidget::checkProjectTemplate()
|
||||
{
|
||||
QmakeProjectManager::QmakeProject *project = static_cast<QmakeProjectManager::QmakeProject *>(m_step->project());
|
||||
if (project->rootQmakeProjectNode()->projectType() == QmakeProjectManager::ApplicationTemplate)
|
||||
m_ui->additionalLibrariesGroupBox->setEnabled(true);
|
||||
else
|
||||
m_ui->additionalLibrariesGroupBox->setEnabled(false);
|
||||
}
|
||||
|
||||
void AndroidDeployQtWidget::createManifestButton()
|
||||
{
|
||||
CreateAndroidManifestWizard wizard(m_step->target());
|
||||
@@ -296,6 +289,8 @@ void AndroidDeployQtWidget::updateKeyStorePath(const QString &path)
|
||||
Utils::FileName file = Utils::FileName::fromString(path);
|
||||
m_step->setKeystorePath(file);
|
||||
m_ui->signPackageCheckBox->setChecked(!file.isEmpty());
|
||||
if (!file.isEmpty())
|
||||
setCertificates();
|
||||
}
|
||||
|
||||
void AndroidDeployQtWidget::certificatesAliasComboBoxActivated(const QString &alias)
|
||||
@@ -351,7 +346,7 @@ void AndroidDeployQtWidget::addAndroidExtraLib()
|
||||
{
|
||||
QStringList fileNames = QFileDialog::getOpenFileNames(this,
|
||||
tr("Select additional libraries"),
|
||||
QDir::homePath(),
|
||||
m_currentBuildConfiguration->target()->project()->projectDirectory(),
|
||||
tr("Libraries (*.so)"));
|
||||
|
||||
if (!fileNames.isEmpty())
|
||||
|
||||
@@ -75,7 +75,6 @@ private slots:
|
||||
void addAndroidExtraLib();
|
||||
void removeAndroidExtraLib();
|
||||
void checkEnableRemoveButton();
|
||||
void checkProjectTemplate();
|
||||
|
||||
private:
|
||||
virtual QString summaryText() const;
|
||||
|
||||
@@ -370,6 +370,19 @@ QModelIndex AndroidDeviceModel::indexFor(const QString &serial)
|
||||
/////////////////
|
||||
// AndroidDeviceDialog
|
||||
/////////////////
|
||||
|
||||
static inline QString msgConnect()
|
||||
{
|
||||
return AndroidDeviceDialog::tr("<p>Connect an Android device via USB and activate developer mode on it. "
|
||||
"Some devices require the installation of a USB driver.</p>");
|
||||
|
||||
}
|
||||
|
||||
static inline QString msgAdbListDevices()
|
||||
{
|
||||
return AndroidDeviceDialog::tr("<p>The adb tool in the Android SDK lists all connected devices if run via "adb devices".</p>");
|
||||
}
|
||||
|
||||
AndroidDeviceDialog::AndroidDeviceDialog(int apiLevel, const QString &abi, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_model(new AndroidDeviceModel(apiLevel, abi)),
|
||||
@@ -387,14 +400,10 @@ AndroidDeviceDialog::AndroidDeviceDialog(int apiLevel, const QString &abi, QWidg
|
||||
|
||||
m_ui->defaultDeviceCheckBox->setText(tr("Always use this device for architecture %1").arg(abi));
|
||||
|
||||
m_ui->noDeviceFoundLabel->setText(tr("<p align=\"center\"><span style=\" font-size:16pt;\">"
|
||||
"No Device Found</span></p>"
|
||||
"<br/>"
|
||||
"<p>Connect an Android device via USB and activate developer mode on it. "
|
||||
"Some devices require the installation of a USB driver.</p>"
|
||||
"<br/>"
|
||||
"<p>The adb tool in the Android SDK lists all connected devices if run via "adb devices".</p>"
|
||||
));
|
||||
m_ui->noDeviceFoundLabel->setText(QLatin1String("<p align=\"center\"><span style=\" font-size:16pt;\">")
|
||||
+ tr("No Device Found") + QLatin1String("</span></p><br/>")
|
||||
+ msgConnect() + QLatin1String("<br/>")
|
||||
+ msgAdbListDevices());
|
||||
connect(m_ui->missingLabel, SIGNAL(linkActivated(QString)),
|
||||
this, SLOT(showHelp()));
|
||||
|
||||
@@ -489,8 +498,5 @@ void AndroidDeviceDialog::showHelp()
|
||||
{
|
||||
QPoint pos = m_ui->missingLabel->pos();
|
||||
pos = m_ui->missingLabel->parentWidget()->mapToGlobal(pos);
|
||||
QToolTip::showText(pos, tr("<p>Connect an Android device via USB and activate developer mode on it. "
|
||||
"Some devices require the installation of a USB driver.</p>"
|
||||
"<p>The adb tool in the Android SDK lists all connected devices if run via "adb devices".</p>"),
|
||||
this);
|
||||
QToolTip::showText(pos, msgConnect() + msgAdbListDevices(), this);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="noDeviceFoundLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><br/></p></body></html></string>
|
||||
<string notr="true"><html><head/><body><p><br/></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
|
||||
@@ -40,9 +40,11 @@ AndroidExtraLibraryListModel::AndroidExtraLibraryListModel(QmakeProjectManager::
|
||||
: QAbstractItemModel(parent)
|
||||
, m_project(project)
|
||||
{
|
||||
reset();
|
||||
QmakeProjectManager::QmakeProFileNode *node = m_project->rootQmakeProjectNode();
|
||||
proFileUpdated(node, node->validParse(), node->parseInProgress());
|
||||
|
||||
connect(m_project, SIGNAL(proFilesEvaluated()), this, SLOT(reset()));
|
||||
connect(m_project, SIGNAL(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)),
|
||||
this, SLOT(proFileUpdated(QmakeProjectManager::QmakeProFileNode*,bool,bool)));
|
||||
}
|
||||
|
||||
QModelIndex AndroidExtraLibraryListModel::index(int row, int column, const QModelIndex &) const
|
||||
@@ -75,15 +77,40 @@ QVariant AndroidExtraLibraryListModel::data(const QModelIndex &index, int role)
|
||||
};
|
||||
}
|
||||
|
||||
void AndroidExtraLibraryListModel::reset()
|
||||
void AndroidExtraLibraryListModel::proFileUpdated(QmakeProjectManager::QmakeProFileNode *node, bool success, bool parseInProgress)
|
||||
{
|
||||
if (m_project->rootQmakeProjectNode()->projectType() != QmakeProjectManager::ApplicationTemplate)
|
||||
QmakeProjectManager::QmakeProFileNode *root = m_project->rootQmakeProjectNode();
|
||||
if (node != root)
|
||||
return;
|
||||
|
||||
if (parseInProgress) {
|
||||
emit enabledChanged(false);
|
||||
return;
|
||||
}
|
||||
|
||||
bool enabled;
|
||||
beginResetModel();
|
||||
QmakeProjectManager::QmakeProFileNode *node = m_project->rootQmakeProjectNode();
|
||||
m_entries = node->variableValue(QmakeProjectManager::AndroidExtraLibs);
|
||||
if (success && root->projectType() == QmakeProjectManager::ApplicationTemplate) {
|
||||
m_entries = node->variableValue(QmakeProjectManager::AndroidExtraLibs);
|
||||
enabled = true;
|
||||
} else {
|
||||
// parsing error or not a application template
|
||||
m_entries.clear();
|
||||
enabled = false;
|
||||
}
|
||||
endResetModel();
|
||||
|
||||
emit enabledChanged(enabled);
|
||||
}
|
||||
|
||||
bool AndroidExtraLibraryListModel::isEnabled() const
|
||||
{
|
||||
QmakeProjectManager::QmakeProFileNode *root = m_project->rootQmakeProjectNode();
|
||||
if (root->parseInProgress())
|
||||
return false;
|
||||
if (root->projectType() != QmakeProjectManager::ApplicationTemplate)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void AndroidExtraLibraryListModel::addEntries(const QStringList &list)
|
||||
|
||||
@@ -34,7 +34,10 @@
|
||||
#include <QAbstractItemModel>
|
||||
#include <QStringList>
|
||||
|
||||
namespace QmakeProjectManager { class QmakeProject; }
|
||||
namespace QmakeProjectManager {
|
||||
class QmakeProject;
|
||||
class QmakeProFileNode;
|
||||
}
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
@@ -54,8 +57,13 @@ public:
|
||||
void removeEntries(QModelIndexList list);
|
||||
void addEntries(const QStringList &list);
|
||||
|
||||
bool isEnabled() const;
|
||||
|
||||
signals:
|
||||
void enabledChanged(bool);
|
||||
|
||||
private slots:
|
||||
void reset();
|
||||
void proFileUpdated(QmakeProjectManager::QmakeProFileNode *node, bool success, bool parseInProgress);
|
||||
|
||||
private:
|
||||
QmakeProjectManager::QmakeProject *m_project;
|
||||
|
||||
@@ -364,9 +364,7 @@ QAbstractItemModel *AndroidPackageCreationStep::keystoreCertificates()
|
||||
if (!m_keystorePasswd.length())
|
||||
return 0;
|
||||
params << m_keystorePasswd;
|
||||
Utils::Environment env = Utils::Environment::systemEnvironment();
|
||||
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
|
||||
keytoolProc.setProcessEnvironment(env.toProcessEnvironment());
|
||||
params << QLatin1String("-J\"-Duser.language=en\"");
|
||||
keytoolProc.start(AndroidConfigurations::currentConfig().keytoolPath().toString(), params);
|
||||
if (!keytoolProc.waitForStarted() || !keytoolProc.waitForFinished()) {
|
||||
QMessageBox::critical(0, tr("Error"),
|
||||
|
||||
@@ -172,6 +172,11 @@ void AndroidSettingsWidget::check(AndroidSettingsWidget::Mode mode)
|
||||
|| !toolChainPath.appendPath(QLatin1String("toolchains")).toFileInfo().exists()
|
||||
|| !sourcesPath.appendPath(QLatin1String("sources/cxx-stl")).toFileInfo().exists()) {
|
||||
m_ndkState = Error;
|
||||
m_ndkErrorMessage = tr("\"%1\" does not seem to be an Android NDK top folder.")
|
||||
.arg(m_androidConfig.ndkLocation().toUserOutput());
|
||||
} else if (platformPath.toString().contains(QLatin1String(" "))) {
|
||||
m_ndkState = Error;
|
||||
m_ndkErrorMessage = tr("The Android NDK cannot be installed into a path with spaces.");
|
||||
} else {
|
||||
QList<AndroidToolChainFactory::AndroidToolChainInformation> compilerPaths
|
||||
= AndroidToolChainFactory::toolchainPathsForNdk(m_androidConfig.ndkLocation());
|
||||
@@ -242,16 +247,17 @@ void AndroidSettingsWidget::applyToUi(AndroidSettingsWidget::Mode mode)
|
||||
}
|
||||
|
||||
if (mode & Ndk) {
|
||||
Utils::FileName location = Utils::FileName::fromUserInput(m_ui->NDKLocationLineEdit->text());
|
||||
if (m_ndkState == NotSet) {
|
||||
m_ui->ndkWarningIconLabel->setVisible(false);
|
||||
m_ui->toolchainFoundLabel->setVisible(false);
|
||||
m_ui->kitWarningIconLabel->setVisible(false);
|
||||
m_ui->kitWarningLabel->setVisible(false);
|
||||
} else if (m_ndkState == Error) {
|
||||
m_ui->toolchainFoundLabel->setText(tr("\"%1\" does not seem to be an Android NDK top folder.").arg(location.toUserOutput()));
|
||||
m_ui->toolchainFoundLabel->setText(m_ndkErrorMessage);
|
||||
m_ui->toolchainFoundLabel->setVisible(true);
|
||||
m_ui->ndkWarningIconLabel->setVisible(true);
|
||||
m_ui->kitWarningIconLabel->setVisible(false);
|
||||
m_ui->kitWarningLabel->setVisible(false);
|
||||
} else {
|
||||
if (m_ndkCompilerCount > 0) {
|
||||
m_ui->ndkWarningIconLabel->setVisible(false);
|
||||
|
||||
@@ -103,6 +103,7 @@ private:
|
||||
|
||||
State m_sdkState;
|
||||
State m_ndkState;
|
||||
QString m_ndkErrorMessage;
|
||||
int m_ndkCompilerCount;
|
||||
QString m_ndkMissingQtArchs;
|
||||
State m_javaState;
|
||||
|
||||
Reference in New Issue
Block a user