forked from qt-creator/qt-creator
Android: drop const from AndroidConfigurations::currentConfig()
Since the config can be expected to modify configuration values (e.g. setEmulatorArgs()) it shouldn't be const, but can be set to const whenever creating a reference that is not meant for modifying the config. Change-Id: I8c816a5422d4d57afa158c723d908e3a9a9a0db8 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -1408,7 +1408,7 @@ Environment AndroidConfigurations::toolsEnvironment(const AndroidConfig &config)
|
||||
return env;
|
||||
}
|
||||
|
||||
const AndroidConfig &AndroidConfigurations::currentConfig()
|
||||
AndroidConfig &AndroidConfigurations::currentConfig()
|
||||
{
|
||||
return m_instance->m_config; // ensure that m_instance is initialized
|
||||
}
|
||||
|
@@ -211,7 +211,7 @@ class ANDROID_EXPORT AndroidConfigurations : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const AndroidConfig ¤tConfig();
|
||||
static AndroidConfig ¤tConfig();
|
||||
static Internal::AndroidSdkManager *sdkManager();
|
||||
static void setConfig(const AndroidConfig &config);
|
||||
static AndroidConfigurations *instance();
|
||||
|
@@ -627,8 +627,8 @@ AndroidDeviceManager *AndroidDeviceManager::instance()
|
||||
|
||||
AndroidDeviceManager::AndroidDeviceManager(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_avdManager(m_androidConfig),
|
||||
m_androidConfig(AndroidConfigurations::currentConfig())
|
||||
m_androidConfig(AndroidConfigurations::currentConfig()),
|
||||
m_avdManager(m_androidConfig)
|
||||
{
|
||||
connect(qApp, &QCoreApplication::aboutToQuit, this, [this]() {
|
||||
m_devicesUpdaterTimer.stop();
|
||||
|
@@ -90,7 +90,7 @@ public:
|
||||
ProjectExplorer::IDevice::Ptr create() const override;
|
||||
|
||||
private:
|
||||
AndroidConfig m_androidConfig;
|
||||
const AndroidConfig &m_androidConfig;
|
||||
};
|
||||
|
||||
class AndroidDeviceManager : public QObject
|
||||
@@ -116,8 +116,8 @@ private:
|
||||
QFutureWatcher<QVector<AndroidDeviceInfo>> m_devicesFutureWatcher;
|
||||
QFutureWatcher<QPair<ProjectExplorer::IDevice::ConstPtr, bool>> m_removeAvdFutureWatcher;
|
||||
QTimer m_devicesUpdaterTimer;
|
||||
AndroidConfig &m_androidConfig;
|
||||
AndroidAvdManager m_avdManager;
|
||||
AndroidConfig m_androidConfig;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -78,7 +78,7 @@ private:
|
||||
Utils::FilePath createQmlrcFile(const Utils::FilePath &workFolder, const QString &basename);
|
||||
|
||||
ProjectExplorer::RunControl *m_rc = nullptr;
|
||||
AndroidConfig m_androidConfig;
|
||||
const AndroidConfig &m_androidConfig;
|
||||
QString m_serialNumber;
|
||||
QStringList m_avdAbis;
|
||||
int m_viewerPid = -1;
|
||||
|
@@ -48,8 +48,8 @@ namespace Internal {
|
||||
* @brief Download Android SDK tools package from within Qt Creator.
|
||||
*/
|
||||
AndroidSdkDownloader::AndroidSdkDownloader()
|
||||
: m_androidConfig(AndroidConfigurations::currentConfig())
|
||||
{
|
||||
m_androidConfig = AndroidConfigurations::currentConfig();
|
||||
connect(&m_manager, &QNetworkAccessManager::finished, this, &AndroidSdkDownloader::downloadFinished);
|
||||
}
|
||||
|
||||
|
@@ -72,7 +72,7 @@ private:
|
||||
QNetworkReply *m_reply = nullptr;
|
||||
Utils::FilePath m_sdkFilename;
|
||||
QProgressDialog *m_progressDialog = nullptr;
|
||||
AndroidConfig m_androidConfig;
|
||||
const AndroidConfig &m_androidConfig;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
|
@@ -108,7 +108,7 @@ private:
|
||||
|
||||
Ui_AndroidSettingsWidget m_ui;
|
||||
AndroidSdkManagerWidget *m_sdkManagerWidget = nullptr;
|
||||
AndroidConfig m_androidConfig{AndroidConfigurations::currentConfig()};
|
||||
AndroidConfig &m_androidConfig{AndroidConfigurations::currentConfig()};
|
||||
|
||||
AndroidSdkManager m_sdkManager{m_androidConfig};
|
||||
AndroidSdkDownloader m_sdkDownloader;
|
||||
|
@@ -116,7 +116,7 @@ bool AndroidToolChain::isValid() const
|
||||
|
||||
void AndroidToolChain::addToEnvironment(Environment &env) const
|
||||
{
|
||||
AndroidConfig config = AndroidConfigurations::currentConfig();
|
||||
const AndroidConfig &config = AndroidConfigurations::currentConfig();
|
||||
env.set(QLatin1String("ANDROID_NDK_HOST"), config.toolchainHostFromNdk(m_ndkLocation));
|
||||
const Utils::FilePath javaHome = config.openJDKLocation();
|
||||
if (javaHome.exists()) {
|
||||
@@ -178,7 +178,7 @@ static FilePath clangPlusPlusPath(const FilePath &clangPath)
|
||||
|
||||
static QList<FilePath> uniqueNdksForCurrentQtVersions()
|
||||
{
|
||||
AndroidConfig config = AndroidConfigurations::currentConfig();
|
||||
const AndroidConfig &config = AndroidConfigurations::currentConfig();
|
||||
|
||||
auto androidQtVersions = QtSupport::QtVersionManager::versions(
|
||||
[](const QtSupport::BaseQtVersion *v) {
|
||||
|
@@ -51,9 +51,9 @@ static Q_LOGGING_CATEGORY(avdDialogLog, "qtc.android.avdDialog", QtWarningMsg)
|
||||
|
||||
AvdDialog::AvdDialog(const AndroidConfig &config, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
m_androidConfig(config),
|
||||
m_sdkManager(m_androidConfig),
|
||||
m_allowedNameChars(QLatin1String("[a-z|A-Z|0-9|._-]*")),
|
||||
m_androidConfig(config)
|
||||
m_allowedNameChars(QLatin1String("[a-z|A-Z|0-9|._-]*"))
|
||||
{
|
||||
m_avdDialog.setupUi(this);
|
||||
m_hideTipTimer.setInterval(2000);
|
||||
|
@@ -71,12 +71,12 @@ private:
|
||||
};
|
||||
|
||||
Ui::AddNewAVDDialog m_avdDialog;
|
||||
AndroidSdkManager m_sdkManager;
|
||||
CreateAvdInfo m_createdAvdInfo;
|
||||
QTimer m_hideTipTimer;
|
||||
QRegularExpression m_allowedNameChars;
|
||||
QList<DeviceDefinitionStruct> m_deviceDefinitionsList;
|
||||
AndroidConfig m_androidConfig;
|
||||
const AndroidConfig &m_androidConfig;
|
||||
AndroidSdkManager m_sdkManager;
|
||||
QMap<AvdDialog::DeviceType, QString> deviceTypeToStringMap;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user