on xenial help sign in
Small clazy fixes
6d3ed34Albert Astals Cid
plugins/AccountsService/AccountsService.cpp+2−2
@@ -68,9 +68,9 @@ Q_DECLARE_METATYPE(StringMapList)
68QVariant primaryButtonConverter(const QVariant &value)
68QVariant primaryButtonConverter(const QVariant &value)
69{
69{
70 QString stringValue = value.toString();
70 QString stringValue = value.toString();
71− if (stringValue == "left") {
71+ if (stringValue == QLatin1String("left")) {
72 return QVariant::fromValue(0);
72 return QVariant::fromValue(0);
73− } else if (stringValue == "right") {
73+ } else if (stringValue == QLatin1String("right")) {
74 return QVariant::fromValue(1); // Mir is less clear on this -- any non-zero value is the same
74 return QVariant::fromValue(1); // Mir is less clear on this -- any non-zero value is the same
75 } else {
75 } else {
76 return QVariant::fromValue(0); // default to left
76 return QVariant::fromValue(0); // default to left
plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp−2
@@ -40,8 +40,6 @@ UsersModel::UsersModel(QObject *parent) :
40 QAbstractListModel(parent),
40 QAbstractListModel(parent),
41 d_ptr(new UsersModelPrivate(this))
41 d_ptr(new UsersModelPrivate(this))
42{
42{
43− Q_D(UsersModel);
44−
45 // Extend roleNames (we want to keep the "display" role)
43 // Extend roleNames (we want to keep the "display" role)
46 QHash<int, QByteArray> roles = roleNames();
44 QHash<int, QByteArray> roles = roleNames();
47 roles[NameRole] = "name";
45 roles[NameRole] = "name";
plugins/Unity/Indicators/actionrootstate.cpp+1−1
@@ -44,7 +44,7 @@ void ActionRootState::setActionGroup(QDBusActionGroup *actionGroup)
44 connect(m_actionGroup, &QDBusActionGroup::statusChanged, this, [&](bool) { updateActionState(); });
44 connect(m_actionGroup, &QDBusActionGroup::statusChanged, this, [&](bool) { updateActionState(); });
45 connect(m_actionGroup, &QDBusActionGroup::actionAppear, this, [&](const QString&) { updateActionState(); });
45 connect(m_actionGroup, &QDBusActionGroup::actionAppear, this, [&](const QString&) { updateActionState(); });
46 connect(m_actionGroup, &QDBusActionGroup::actionVanish, this, [&](const QString&) { updateActionState(); });
46 connect(m_actionGroup, &QDBusActionGroup::actionVanish, this, [&](const QString&) { updateActionState(); });
47− connect(m_actionGroup, &QDBusActionGroup::actionStateChanged, this, [&](QVariant) { updateActionState(); });
47+ connect(m_actionGroup, &QDBusActionGroup::actionStateChanged, this, [&](const QVariant&) { updateActionState(); });
48
48
49 connect(m_actionGroup, &QObject::destroyed, this, [&](QObject*) { updateActionState(); });
49 connect(m_actionGroup, &QObject::destroyed, this, [&](QObject*) { updateActionState(); });
50 }
50 }
plugins/Utils/deviceconfigparser.cpp+1−1
@@ -26,7 +26,7 @@ DeviceConfigParser::DeviceConfigParser(QObject *parent): QObject(parent)
26 // Local files have highest priority
26 // Local files have highest priority
27 QString path;
27 QString path;
28 Q_FOREACH (const QString &standardPath, QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation)) {
28 Q_FOREACH (const QString &standardPath, QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation)) {
29− if (QFileInfo(standardPath + "/devices.conf").exists()) {
29+ if (QFileInfo::exists(standardPath + "/devices.conf")) {
30 path = standardPath + "/devices.conf";
30 path = standardPath + "/devices.conf";
31 break;
31 break;
32 }
32 }
plugins/Utils/timezoneFormatter.cpp+1−1
@@ -39,7 +39,7 @@ QString TimezoneFormatter::currentTimeInTimezoneWithAbbrev(const QVariant &tzId)
39 QTimeZone tz(tzId.toByteArray());
39 QTimeZone tz(tzId.toByteArray());
40 if (tz.isValid()) {
40 if (tz.isValid()) {
41 const QDateTime now = QDateTime::currentDateTime().toTimeZone(tz);
41 const QDateTime now = QDateTime::currentDateTime().toTimeZone(tz);
42− return QStringLiteral("%1 %2").arg(now.time().toString(QStringLiteral("h:mm"))).arg(tz.abbreviation(now));
42+ return QStringLiteral("%1 %2").arg(now.time().toString(QStringLiteral("h:mm")), tz.abbreviation(now));
43 }
43 }
44 return QString();
44 return QString();
45}
45}
plugins/Utils/windowstatestorage.cpp+3−1
@@ -28,7 +28,9 @@
28QMutex WindowStateStorage::s_mutex;
28QMutex WindowStateStorage::s_mutex;
29
29
30inline QString sanitiseString(QString string) {
30inline QString sanitiseString(QString string) {
31− return string.remove("\"").remove("'").remove("\\");
31+ return string.remove(QLatin1Char('\"'))
32+ .remove(QLatin1Char('\''))
33+ .remove(QLatin1Char('\\'));
32}
34}
33
35
34WindowStateStorage::WindowStateStorage(QObject *parent):
36WindowStateStorage::WindowStateStorage(QObject *parent):
plugins/Wizard/timezonemodel.cpp+5−5
@@ -60,12 +60,12 @@ QVariant TimeZoneLocationModel::data(const QModelIndex &index, int role) const
60
60
61 switch (role) {
61 switch (role) {
62 case Qt::DisplayRole:
62 case Qt::DisplayRole:
63− return QStringLiteral("%1, %2, %3").arg(geonames_city_get_name(city))
63+ return QStringLiteral("%1, %2, %3").arg(geonames_city_get_name(city),
64− .arg(geonames_city_get_state(city))
64+ geonames_city_get_state(city),
65− .arg(geonames_city_get_country(city));
65+ geonames_city_get_country(city));
66 case SimpleRole:
66 case SimpleRole:
67− return QStringLiteral("%1, %2").arg(geonames_city_get_name(city))
67+ return QStringLiteral("%1, %2").arg(geonames_city_get_name(city),
68− .arg(geonames_city_get_country(city));
68+ geonames_city_get_country(city));
69 case TimeZoneRole:
69 case TimeZoneRole:
70 return geonames_city_get_timezone(city);
70 return geonames_city_get_timezone(city);
71 case CountryRole:
71 case CountryRole:
src/SecondaryWindow.cpp+1−1
@@ -30,7 +30,7 @@ SecondaryWindow::SecondaryWindow(QQmlEngine *engine)
30 if (!ok) {
30 if (!ok) {
31 pxpgu = 8;
31 pxpgu = 8;
32 }
32 }
33− engine->rootContext()->setContextProperty("internalGu", pxpgu);
33+ engine->rootContext()->setContextProperty(QStringLiteral("internalGu"), pxpgu);
34 setResizeMode(QQuickView::SizeRootObjectToView);
34 setResizeMode(QQuickView::SizeRootObjectToView);
35 setColor("black");
35 setColor("black");
36 setTitle(QStringLiteral("Unity8 Shell - Secondary Screen"));
36 setTitle(QStringLiteral("Unity8 Shell - Secondary Screen"));
tools/registry-tracker.cpp+2−2
@@ -110,7 +110,7 @@ void RegistryTracker::runRegistry()
110 }
110 }
111
111
112 // FIXME: keep in sync with the SSRegistry config
112 // FIXME: keep in sync with the SSRegistry config
113− QString runtime_ini = QString(RUNTIME_CONFIG).arg(m_registry_config.fileName()).arg(m_mw_config.fileName()).arg(m_serverScopes ? "SSRegistry" : "");
113+ QString runtime_ini = QString(RUNTIME_CONFIG).arg(m_registry_config.fileName(), m_mw_config.fileName(), m_serverScopes ? "SSRegistry" : "");
114 if (!m_systemScopes) {
114 if (!m_systemScopes) {
115 m_scopeInstallDir.reset(new QTemporaryDir(tmp.filePath("scopes.XXXXXX")));
115 m_scopeInstallDir.reset(new QTemporaryDir(tmp.filePath("scopes.XXXXXX")));
116 if (!m_scopeInstallDir->isValid()) {
116 if (!m_scopeInstallDir->isValid()) {
@@ -118,7 +118,7 @@ void RegistryTracker::runRegistry()
118 }
118 }
119 scopeInstallDir = m_scopeInstallDir->path();
119 scopeInstallDir = m_scopeInstallDir->path();
120 }
120 }
121− QString registry_ini = QString(REGISTRY_CONFIG).arg(m_mw_config.fileName()).arg(scopeInstallDir).arg(scopeRunnerBin);
121+ QString registry_ini = QString(REGISTRY_CONFIG).arg(m_mw_config.fileName(), scopeInstallDir, scopeRunnerBin);
122 QString mw_ini = QString(MW_CONFIG).arg(m_endpoints_dir.path());
122 QString mw_ini = QString(MW_CONFIG).arg(m_endpoints_dir.path());
123
123
124 if (!m_systemScopes) {
124 if (!m_systemScopes) {