forked from qt-creator/qt-creator
Android: Simplify return statements
Change-Id: I100b16a1fd74c4528f61f681bbeb5cdb4adddee5 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -450,8 +450,7 @@ QString AndroidBuildApkWidget::openSslIncludeFileContent(const FilePath &project
|
||||
return "android: include(" + openSslPath + "/openssl.pri)";
|
||||
if (projectPath.endsWith("CMakeLists.txt"))
|
||||
return "if (ANDROID)\n include(" + openSslPath + "/CMakeLists.txt)\nendif()";
|
||||
|
||||
return QString();
|
||||
return {};
|
||||
}
|
||||
|
||||
void AndroidBuildApkWidget::setCertificates()
|
||||
|
||||
@@ -675,7 +675,7 @@ QString AndroidConfig::getDeviceProperty(const QString &device, const QString &p
|
||||
adbProc.setCommand(cmd);
|
||||
adbProc.runBlocking();
|
||||
if (adbProc.result() != ProcessResult::FinishedWithSuccess)
|
||||
return QString();
|
||||
return {};
|
||||
|
||||
return adbProc.allOutput();
|
||||
}
|
||||
@@ -692,18 +692,18 @@ QString AndroidConfig::getAvdName(const QString &serialnumber)
|
||||
{
|
||||
int index = serialnumber.indexOf(QLatin1String("-"));
|
||||
if (index == -1)
|
||||
return QString();
|
||||
return {};
|
||||
bool ok;
|
||||
int port = serialnumber.mid(index + 1).toInt(&ok);
|
||||
if (!ok)
|
||||
return QString();
|
||||
return {};
|
||||
|
||||
const QByteArray avdName = "avd name\n";
|
||||
|
||||
QTcpSocket tcpSocket;
|
||||
tcpSocket.connectToHost(QHostAddress(QHostAddress::LocalHost), port);
|
||||
if (!tcpSocket.waitForConnected(100)) // Don't wait more than 100ms for a local connection
|
||||
return QString{};
|
||||
return {};
|
||||
|
||||
tcpSocket.write(avdName + "exit\n");
|
||||
tcpSocket.waitForDisconnected(500);
|
||||
|
||||
@@ -43,7 +43,7 @@ QModelIndex AndroidExtraLibraryListModel::index(int row, int column, const QMode
|
||||
|
||||
QModelIndex AndroidExtraLibraryListModel::parent(const QModelIndex &) const
|
||||
{
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
|
||||
int AndroidExtraLibraryListModel::rowCount(const QModelIndex &) const
|
||||
|
||||
@@ -91,7 +91,7 @@ QString AndroidManager::packageName(const Target *target)
|
||||
{
|
||||
QDomDocument doc;
|
||||
if (!openManifest(target, doc))
|
||||
return QString();
|
||||
return {};
|
||||
QDomElement manifestElem = doc.documentElement();
|
||||
return manifestElem.attribute(QLatin1String("package"));
|
||||
}
|
||||
@@ -100,7 +100,7 @@ QString AndroidManager::packageName(const FilePath &manifestFile)
|
||||
{
|
||||
QDomDocument doc;
|
||||
if (!openXmlFile(doc, manifestFile))
|
||||
return QString();
|
||||
return {};
|
||||
QDomElement manifestElem = doc.documentElement();
|
||||
return manifestElem.attribute(QLatin1String("package"));
|
||||
}
|
||||
@@ -109,7 +109,7 @@ QString AndroidManager::activityName(const Target *target)
|
||||
{
|
||||
QDomDocument doc;
|
||||
if (!openManifest(target, doc))
|
||||
return QString();
|
||||
return {};
|
||||
QDomElement activityElem = doc.documentElement().firstChildElement(
|
||||
QLatin1String("application")).firstChildElement(QLatin1String("activity"));
|
||||
return activityElem.attribute(QLatin1String("android:name"));
|
||||
|
||||
@@ -1387,7 +1387,7 @@ void PermissionsModel::removePermission(int index)
|
||||
QVariant PermissionsModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role != Qt::DisplayRole || !index.isValid())
|
||||
return QVariant();
|
||||
return {};
|
||||
return m_permissions[index.row()];
|
||||
}
|
||||
|
||||
|
||||
@@ -84,14 +84,14 @@ QModelIndex AndroidSdkModel::index(int row, int column, const QModelIndex &paren
|
||||
return createIndex(row, column); // Top level items (Tools & platform)
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
|
||||
QModelIndex AndroidSdkModel::parent(const QModelIndex &index) const
|
||||
{
|
||||
void *ip = index.internalPointer();
|
||||
if (!ip)
|
||||
return QModelIndex();
|
||||
return {};
|
||||
|
||||
auto package = static_cast<const AndroidSdkPackage *>(ip);
|
||||
if (package->type() == AndroidSdkPackage::SystemImagePackage) {
|
||||
@@ -107,7 +107,7 @@ QModelIndex AndroidSdkModel::parent(const QModelIndex &index) const
|
||||
return createIndex(0, 0); // Tools
|
||||
}
|
||||
|
||||
return QModelIndex();
|
||||
return {};
|
||||
}
|
||||
|
||||
int AndroidSdkModel::rowCount(const QModelIndex &parent) const
|
||||
@@ -137,7 +137,7 @@ int AndroidSdkModel::columnCount(const QModelIndex &parent) const
|
||||
QVariant AndroidSdkModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
return {};
|
||||
|
||||
if (!index.parent().isValid()) {
|
||||
// Top level tools
|
||||
@@ -160,7 +160,7 @@ QVariant AndroidSdkModel::data(const QModelIndex &index, int role) const
|
||||
return platform->apiLevel();
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
return {};
|
||||
}
|
||||
|
||||
auto p = static_cast<const AndroidSdkPackage *>(index.internalPointer());
|
||||
@@ -213,7 +213,7 @@ QVariant AndroidSdkModel::data(const QModelIndex &index, int role) const
|
||||
if (role == PackageStateRole)
|
||||
return p->state();
|
||||
|
||||
return QVariant();
|
||||
return {};
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> AndroidSdkModel::roleNames() const
|
||||
|
||||
@@ -40,7 +40,7 @@ int CertificatesModel::rowCount(const QModelIndex &parent) const
|
||||
QVariant CertificatesModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid() || (role != Qt::DisplayRole && role != Qt::ToolTipRole))
|
||||
return QVariant();
|
||||
return {};
|
||||
if (role == Qt::DisplayRole)
|
||||
return m_certs[index.row()].first;
|
||||
return m_certs[index.row()].second;
|
||||
|
||||
Reference in New Issue
Block a user