on xenial help sign in
Small clazy fixes

Approved by: Lukáš Tinkl

commit6d3ed344235845f3e3b0253e780ac236108192aa authorAlbert Astals Cid <albert.astals@canonical.com> dateThu 11 Aug 2016, 06:24 (10 years ago) parenta5288594b0f843
9 files changed+16−16
plugins/AccountsService/AccountsService.cpp+2−2 plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp−2 plugins/Unity/Indicators/actionrootstate.cpp+1−1 plugins/Utils/deviceconfigparser.cpp+1−1 plugins/Utils/timezoneFormatter.cpp+1−1 plugins/Utils/windowstatestorage.cpp+3−1 plugins/Wizard/timezonemodel.cpp+5−5 src/SecondaryWindow.cpp+1−1 tools/registry-tracker.cpp+2−2
plugins/AccountsService/AccountsService.cpp+2−2
@@ -68,9 +68,9 @@ Q_DECLARE_METATYPE(StringMapList)
6868QVariant primaryButtonConverter(const QVariant &value)
6969{
7070 QString stringValue = value.toString();
71− if (stringValue == "left") {
71+ if (stringValue == QLatin1String("left")) {
7272 return QVariant::fromValue(0);
73− } else if (stringValue == "right") {
73+ } else if (stringValue == QLatin1String("right")) {
7474 return QVariant::fromValue(1); // Mir is less clear on this -- any non-zero value is the same
7575 } else {
7676 return QVariant::fromValue(0); // default to left
plugins/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp−2
@@ -40,8 +40,6 @@ UsersModel::UsersModel(QObject *parent) :
4040 QAbstractListModel(parent),
4141 d_ptr(new UsersModelPrivate(this))
4242{
43− Q_D(UsersModel);
44−
4543 // Extend roleNames (we want to keep the "display" role)
4644 QHash<int, QByteArray> roles = roleNames();
4745 roles[NameRole] = "name";
plugins/Unity/Indicators/actionrootstate.cpp+1−1
@@ -44,7 +44,7 @@ void ActionRootState::setActionGroup(QDBusActionGroup *actionGroup)
4444 connect(m_actionGroup, &QDBusActionGroup::statusChanged, this, [&](bool) { updateActionState(); });
4545 connect(m_actionGroup, &QDBusActionGroup::actionAppear, this, [&](const QString&) { updateActionState(); });
4646 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(); });
4848
4949 connect(m_actionGroup, &QObject::destroyed, this, [&](QObject*) { updateActionState(); });
5050 }
plugins/Utils/deviceconfigparser.cpp+1−1
@@ -26,7 +26,7 @@ DeviceConfigParser::DeviceConfigParser(QObject *parent): QObject(parent)
2626 // Local files have highest priority
2727 QString path;
2828 Q_FOREACH (const QString &standardPath, QStandardPaths::standardLocations(QStandardPaths::GenericConfigLocation)) {
29− if (QFileInfo(standardPath + "/devices.conf").exists()) {
29+ if (QFileInfo::exists(standardPath + "/devices.conf")) {
3030 path = standardPath + "/devices.conf";
3131 break;
3232 }
plugins/Utils/timezoneFormatter.cpp+1−1
@@ -39,7 +39,7 @@ QString TimezoneFormatter::currentTimeInTimezoneWithAbbrev(const QVariant &tzId)
3939 QTimeZone tz(tzId.toByteArray());
4040 if (tz.isValid()) {
4141 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));
4343 }
4444 return QString();
4545}
plugins/Utils/windowstatestorage.cpp+3−1
@@ -28,7 +28,9 @@
2828QMutex WindowStateStorage::s_mutex;
2929
3030inline QString sanitiseString(QString string) {
31− return string.remove("\"").remove("'").remove("\\");
31+ return string.remove(QLatin1Char('\"'))
32+ .remove(QLatin1Char('\''))
33+ .remove(QLatin1Char('\\'));
3234}
3335
3436WindowStateStorage::WindowStateStorage(QObject *parent):
plugins/Wizard/timezonemodel.cpp+5−5
@@ -60,12 +60,12 @@ QVariant TimeZoneLocationModel::data(const QModelIndex &index, int role) const
6060
6161 switch (role) {
6262 case Qt::DisplayRole:
63− return QStringLiteral("%1, %2, %3").arg(geonames_city_get_name(city))
64− .arg(geonames_city_get_state(city))
65− .arg(geonames_city_get_country(city));
63+ return QStringLiteral("%1, %2, %3").arg(geonames_city_get_name(city),
64+ geonames_city_get_state(city),
65+ geonames_city_get_country(city));
6666 case SimpleRole:
67− return QStringLiteral("%1, %2").arg(geonames_city_get_name(city))
68− .arg(geonames_city_get_country(city));
67+ return QStringLiteral("%1, %2").arg(geonames_city_get_name(city),
68+ geonames_city_get_country(city));
6969 case TimeZoneRole:
7070 return geonames_city_get_timezone(city);
7171 case CountryRole:
src/SecondaryWindow.cpp+1−1
@@ -30,7 +30,7 @@ SecondaryWindow::SecondaryWindow(QQmlEngine *engine)
3030 if (!ok) {
3131 pxpgu = 8;
3232 }
33− engine->rootContext()->setContextProperty("internalGu", pxpgu);
33+ engine->rootContext()->setContextProperty(QStringLiteral("internalGu"), pxpgu);
3434 setResizeMode(QQuickView::SizeRootObjectToView);
3535 setColor("black");
3636 setTitle(QStringLiteral("Unity8 Shell - Secondary Screen"));
tools/registry-tracker.cpp+2−2
@@ -110,7 +110,7 @@ void RegistryTracker::runRegistry()
110110 }
111111
112112 // 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" : "");
114114 if (!m_systemScopes) {
115115 m_scopeInstallDir.reset(new QTemporaryDir(tmp.filePath("scopes.XXXXXX")));
116116 if (!m_scopeInstallDir->isValid()) {
@@ -118,7 +118,7 @@ void RegistryTracker::runRegistry()
118118 }
119119 scopeInstallDir = m_scopeInstallDir->path();
120120 }
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);
122122 QString mw_ini = QString(MW_CONFIG).arg(m_endpoints_dir.path());
123123
124124 if (!m_systemScopes) {