on xenial help sign in
clazy fixes

* Missing Q_OBJECT macro * QStringLiteral/QLatin1String fixes * QFileInfo::exists is faster than QFileInfo().exists * QMap::contains already works on the keys, calling keys() is slower

commit8437a8fbd21939bb2e71740b0f8be752ef7405f1 authorAlbert Astals Cid <albert.astals@canonical.com> dateFri 19 Feb 2016, 09:44 (11 years ago) parent7cdf423
6 files changed+15−13
plugins/Dash/plugin.cpp+6−6 plugins/GlobalShortcut/globalshortcutregistry.cpp+3−3 plugins/Unity/Indicators/indicatorsmanager.cpp+2−2 plugins/Unity/Indicators/rootstateparser.h+1 plugins/Unity/Launcher/desktopfilehandler.cpp+2−2 src/CachingNetworkManagerFactory.h+1
plugins/Dash/plugin.cpp+6−6
@@ -28,12 +28,12 @@
2828static QUrl oauthCleanedUrl(QUrl u)
2929{
3030 QUrlQuery q(u);
31− q.removeQueryItem("oauth_nonce");
32− q.removeQueryItem("oauth_timestamp");
33− q.removeQueryItem("oauth_consumer_key");
34− q.removeQueryItem("oauth_signature_method");
35− q.removeQueryItem("oauth_version");
36− q.removeQueryItem("oauth_signature");
31+ q.removeQueryItem(QStringLiteral("oauth_nonce"));
32+ q.removeQueryItem(QStringLiteral("oauth_timestamp"));
33+ q.removeQueryItem(QStringLiteral("oauth_consumer_key"));
34+ q.removeQueryItem(QStringLiteral("oauth_signature_method"));
35+ q.removeQueryItem(QStringLiteral("oauth_version"));
36+ q.removeQueryItem(QStringLiteral("oauth_signature"));
3737 u.setQuery(q);
3838 return u;
3939}
plugins/GlobalShortcut/globalshortcutregistry.cpp+3−3
@@ -35,13 +35,13 @@ GlobalShortcutList GlobalShortcutRegistry::shortcuts() const
3535
3636bool GlobalShortcutRegistry::hasShortcut(const QVariant &seq) const
3737{
38− return m_shortcuts.keys().contains(seq);
38+ return m_shortcuts.contains(seq);
3939}
4040
4141void GlobalShortcutRegistry::addShortcut(const QVariant &seq, GlobalShortcut *sc)
4242{
4343 if (sc) {
44− if (!m_shortcuts.keys().contains(seq)) { // create a new entry
44+ if (!m_shortcuts.contains(seq)) { // create a new entry
4545 m_shortcuts.insert(seq, {sc});
4646 } else { // append to an existing one
4747 auto shortcuts = m_shortcuts[seq];
@@ -76,7 +76,7 @@ bool GlobalShortcutRegistry::eventFilter(QObject *obj, QEvent *event)
7676 if (event->type() == QEvent::KeyPress) {
7777 QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
7878 QKeySequence seq = QKeySequence(keyEvent->key() + keyEvent->modifiers());
79− if (m_shortcuts.keys().contains(seq)) {
79+ if (m_shortcuts.contains(seq)) {
8080 const auto shortcuts = m_shortcuts.value(seq);
8181 Q_FOREACH(const auto &shortcut, shortcuts) {
8282 if (shortcut) {
plugins/Unity/Indicators/indicatorsmanager.cpp+2−2
@@ -116,7 +116,7 @@ void IndicatorsManager::loadFile(const QFileInfo& file_info)
116116 QSettings indicator_settings(file_info.absoluteFilePath(), QSettings::IniFormat, this);
117117 const QString name = indicator_settings.value(QStringLiteral("Indicator Service/Name")).toString();
118118
119− if (m_platform.isPC() && name == "indicator-keyboard") {
119+ if (m_platform.isPC() && name == QLatin1String("indicator-keyboard")) {
120120 return; // convergence: skip this indicator until it works in Mir
121121 }
122122
@@ -293,7 +293,7 @@ Indicator::Ptr IndicatorsManager::indicator(const QString& indicator_name)
293293 // The rest of the indicators respect their default profile (which is "phone", even on desktop PCs)
294294 if ((new_indicator->identifier() == QStringLiteral("indicator-session") && m_platform.isMultiSession())
295295 || (new_indicator->identifier() == QStringLiteral("indicator-power") && m_platform.isPC())) {
296− new_indicator->setProfile("desktop");
296+ new_indicator->setProfile(QStringLiteral("desktop"));
297297 } else {
298298 new_indicator->setProfile(m_profile);
299299 }
plugins/Unity/Indicators/rootstateparser.h+1
@@ -23,6 +23,7 @@
2323
2424class UNITYINDICATORS_EXPORT RootStateParser : public ActionStateParser
2525{
26+Q_OBJECT
2627public:
2728 RootStateParser(QObject* parent = nullptr);
2829 virtual QVariant toQVariant(GVariant* state) const override;
plugins/Unity/Launcher/desktopfilehandler.cpp+2−2
@@ -146,9 +146,9 @@ QString DesktopFileHandler::icon() const
146146 QString iconString = settings.value(QStringLiteral("Icon")).toString();
147147 QString pathString = settings.value(QStringLiteral("Path")).toString();
148148
149− if (QFileInfo(iconString).exists()) {
149+ if (QFileInfo::exists(iconString)) {
150150 return QFileInfo(iconString).absoluteFilePath();
151− } else if (QFileInfo(pathString + '/' + iconString).exists()) {
151+ } else if (QFileInfo::exists(pathString + '/' + iconString)) {
152152 return pathString + '/' + iconString;
153153 }
154154 return "image://theme/" + iconString;
src/CachingNetworkManagerFactory.h+1
@@ -25,6 +25,7 @@
2525
2626class CachingNetworkAccessManager : public QNetworkAccessManager
2727{
28+Q_OBJECT
2829public:
2930 CachingNetworkAccessManager(QObject *parent = 0);
3031