forked from qt-creator/qt-creator
Android: Remove QFileInfo use in AndroidAvdManager
Change-Id: Ied226a83fe2c0628430a8e339cde4354f726026c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -15,7 +15,6 @@
|
|||||||
#include <utils/runextensions.h>
|
#include <utils/runextensions.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@@ -26,17 +25,14 @@
|
|||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace {
|
namespace Android::Internal {
|
||||||
static Q_LOGGING_CATEGORY(avdManagerLog, "qtc.android.avdManager", QtWarningMsg)
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Android {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
const int avdCreateTimeoutMs = 30000;
|
const int avdCreateTimeoutMs = 30000;
|
||||||
|
|
||||||
|
static Q_LOGGING_CATEGORY(avdManagerLog, "qtc.android.avdManager", QtWarningMsg)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Runs the \c avdmanager tool specific to configuration \a config with arguments \a args. Returns
|
Runs the \c avdmanager tool specific to configuration \a config with arguments \a args. Returns
|
||||||
\c true if the command is successfully executed. Output is copied into \a output. The function
|
\c true if the command is successfully executed. Output is copied into \a output. The function
|
||||||
@@ -244,16 +240,15 @@ QString AndroidAvdManager::startAvd(const QString &name) const
|
|||||||
|
|
||||||
bool AndroidAvdManager::startAvdAsync(const QString &avdName) const
|
bool AndroidAvdManager::startAvdAsync(const QString &avdName) const
|
||||||
{
|
{
|
||||||
QFileInfo info(m_config.emulatorToolPath().toString());
|
const FilePath emulator = m_config.emulatorToolPath();
|
||||||
if (!info.exists()) {
|
if (!emulator.exists()) {
|
||||||
const QString emulatorToolPath = m_config.emulatorToolPath().toUserOutput();
|
QMetaObject::invokeMethod(Core::ICore::mainWindow(), [emulator] {
|
||||||
QMetaObject::invokeMethod(Core::ICore::mainWindow(), [emulatorToolPath] {
|
|
||||||
QMessageBox::critical(Core::ICore::dialogParent(),
|
QMessageBox::critical(Core::ICore::dialogParent(),
|
||||||
AndroidAvdManager::tr("Emulator Tool Is Missing"),
|
AndroidAvdManager::tr("Emulator Tool Is Missing"),
|
||||||
AndroidAvdManager::tr(
|
AndroidAvdManager::tr(
|
||||||
"Install the missing emulator tool (%1) to the"
|
"Install the missing emulator tool (%1) to the"
|
||||||
" installed Android SDK.")
|
" installed Android SDK.")
|
||||||
.arg(emulatorToolPath));
|
.arg(emulator.displayName()));
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -343,16 +338,13 @@ bool AndroidAvdManager::waitForBooted(const QString &serialNumber,
|
|||||||
for (int i = 0; i < 60; ++i) {
|
for (int i = 0; i < 60; ++i) {
|
||||||
if (cancelChecker && cancelChecker())
|
if (cancelChecker && cancelChecker())
|
||||||
return false;
|
return false;
|
||||||
if (isAvdBooted(serialNumber)) {
|
if (isAvdBooted(serialNumber))
|
||||||
return true;
|
return true;
|
||||||
} else {
|
QThread::sleep(2);
|
||||||
QThread::sleep(2);
|
if (!m_config.isConnected(serialNumber)) // device was disconnected
|
||||||
if (!m_config.isConnected(serialNumber)) // device was disconnected
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // Android::Internal
|
||||||
} // namespace Android
|
|
||||||
|
|||||||
@@ -7,8 +7,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace Android {
|
namespace Android::Internal {
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class AndroidAvdManager
|
class AndroidAvdManager
|
||||||
{
|
{
|
||||||
@@ -40,5 +39,4 @@ private:
|
|||||||
const AndroidConfig &m_config;
|
const AndroidConfig &m_config;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // Android::Internal
|
||||||
} // namespace Android
|
|
||||||
|
|||||||
Reference in New Issue
Block a user