on xenial help sign in
clazy improvements

Pass small (<=16 bytes) and trivially-copyable type by value Don't call QList::operator[]() on temporary Fix QString(const char*) being called Use qEnvironmentVariableIsEmpty() instead of qgetenv().isEmpty() Use the multiarg arg() use Q_FOREACH for non const qt containers delete copy constructor and assignment operator for non copyable class remove assignment operator that does the same as the default one

commit38640ebd53724e4a2f42f77820c6db5ed5f50e20 authorAlbert Astals Cid <albert.astals@canonical.com> dateFri 20 Nov 2015, 16:01 (11 years ago) parentb03c9e3
26 files changed+64−68
libs/UbuntuGestures/Pool.h−8 plugins/Cursor/CursorImageProvider.cpp+7−7 plugins/Cursor/MousePointer.cpp+2−2 plugins/Cursor/plugin.cpp+1−1 plugins/Dash/horizontaljournal.cpp+1−1 plugins/Dash/listviewwithpageheader.cpp+3−3 plugins/Dash/organicgrid.cpp+3−3 plugins/Dash/organicgrid.h+2−2 plugins/Dash/verticaljournal.cpp+6−6 plugins/Dash/verticaljournal.h+1−1 plugins/GlobalShortcut/globalshortcutregistry.cpp+1−1 plugins/IntegratedLightDM/liblightdm/Greeter.cpp+1−1 plugins/Ubuntu/DownloadDaemonListener/DownloadTracker.h+1−1 plugins/Ubuntu/Gestures/Damper.h+2−2 plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+3−3 plugins/Ubuntu/Gestures/DirectionalDragArea_p.h+3−3 plugins/Unity/Launcher/asadapter.h+3 plugins/Unity/Launcher/dbusinterface.cpp+8−7 plugins/Unity/Platform/platform.cpp+2−2 plugins/Utils/constants.cpp+1−1 plugins/Utils/easingcurve.cpp+1−1 plugins/Utils/easingcurve.h+1−1 plugins/Utils/timezoneFormatter.cpp+1−1 plugins/Utils/windowstatestorage.cpp+5−5 plugins/Utils/windowstatestorage.h+2−2 src/ShellApplication.cpp+3−3
libs/UbuntuGestures/Pool.h−8
@@ -60,14 +60,6 @@ public:
6060 ItemType &operator*() const { return *item; }
6161 ItemType &value() const { return *item; }
6262
63− Iterator &operator= (const Iterator& other) {
64− index = other.index;
65− item = other.item;
66−
67− // by convention, always return *this
68− return *this;
69− }
70−
7163 operator bool() const { return item != nullptr; }
7264
7365 int index;
plugins/Cursor/CursorImageProvider.cpp+7−7
@@ -134,7 +134,7 @@ CursorImage *CursorImageProvider::fetchCursor(const QString &cursorThemeAndName)
134134 QString themeName;
135135 QString cursorName;
136136 {
137− QStringList themeAndNameList = cursorThemeAndName.split("/");
137+ QStringList themeAndNameList = cursorThemeAndName.split('/');
138138 if (themeAndNameList.size() != 2) {
139139 return nullptr;
140140 }
@@ -151,20 +151,20 @@ CursorImage *CursorImageProvider::fetchCursor(const QString &themeName, const QS
151151
152152 // Try some fallbacks
153153 if (cursorImage->qimage.isNull()) {
154− if (cursorName == "ibeam") {
154+ if (cursorName == QLatin1String("ibeam")) {
155155 qDebug() << "CursorImageProvider: \"ibeam\" not found, falling back to \"xterm\"";
156− cursorImage = fetchCursorHelper(themeName, "xterm");
157− } else if (cursorName == "xterm") {
156+ cursorImage = fetchCursorHelper(themeName, QStringLiteral("xterm"));
157+ } else if (cursorName == QLatin1String("xterm")) {
158158 qDebug() << "CursorImageProvider: \"xterm\" not found, falling back to \"ibeam\"";
159− cursorImage = fetchCursorHelper(themeName, "ibeam");
159+ cursorImage = fetchCursorHelper(themeName, QStringLiteral("ibeam"));
160160 }
161161 }
162162
163163 // if it all fails, there must be at least a left_ptr
164− if (cursorImage->qimage.isNull() && cursorName != "left_ptr") {
164+ if (cursorImage->qimage.isNull() && cursorName != QLatin1String("left_ptr")) {
165165 qDebug() << "CursorImageProvider:" << cursorName
166166 << "not found (nor its fallbacks, if any). Going for \"left_ptr\" as a last resort.";
167− cursorImage = fetchCursorHelper(themeName, "left_ptr");
167+ cursorImage = fetchCursorHelper(themeName, QStringLiteral("left_ptr"));
168168 }
169169
170170 if (cursorImage->qimage.isNull()) {
plugins/Cursor/MousePointer.cpp+2−2
@@ -27,8 +27,8 @@
2727
2828MousePointer::MousePointer(QQuickItem *parent)
2929 : MirMousePointerInterface(parent)
30− , m_cursorName("left_ptr")
31− , m_themeName("default")
30+ , m_cursorName(QStringLiteral("left_ptr"))
31+ , m_themeName(QStringLiteral("default"))
3232 , m_hotspotX(0)
3333 , m_hotspotY(0)
3434{
plugins/Cursor/plugin.cpp+1−1
@@ -35,5 +35,5 @@ void CursorPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
3535{
3636 QQmlExtensionPlugin::initializeEngine(engine, uri);
3737
38− engine->addImageProvider(QLatin1String("cursor"), new CursorImageProvider());
38+ engine->addImageProvider(QStringLiteral("cursor"), new CursorImageProvider());
3939}
plugins/Dash/horizontaljournal.cpp+1−1
@@ -184,7 +184,7 @@ void HorizontalJournal::calculateImplicitHeight()
184184
185185void HorizontalJournal::processModelRemoves(const QVector<QQmlChangeSet::Change> &removes)
186186{
187− Q_FOREACH(const QQmlChangeSet::Change &remove, removes) {
187+ Q_FOREACH(const QQmlChangeSet::Change remove, removes) {
188188 for (int i = remove.count - 1; i >= 0; --i) {
189189 const int indexToRemove = remove.index + i;
190190 // We only support removing from the end so
plugins/Dash/listviewwithpageheader.cpp+3−3
@@ -941,7 +941,7 @@ void ListViewWithPageHeader::onModelUpdated(const QQmlChangeSet &changeSet, bool
941941// qDebug() << "ListViewWithPageHeader::onModelUpdated" << changeSet << reset;
942942 const auto oldFirstVisibleIndex = m_firstVisibleIndex;
943943
944− Q_FOREACH(const QQmlChangeSet::Change &remove, changeSet.removes()) {
944+ Q_FOREACH(const QQmlChangeSet::Change remove, changeSet.removes()) {
945945// qDebug() << "ListViewWithPageHeader::onModelUpdated Remove" << remove.index << remove.count;
946946 if (remove.index + remove.count > m_firstVisibleIndex && remove.index < m_firstVisibleIndex + m_visibleItems.count()) {
947947 const qreal oldFirstValidIndexPos = m_visibleItems.first()->y();
@@ -994,7 +994,7 @@ void ListViewWithPageHeader::onModelUpdated(const QQmlChangeSet &changeSet, bool
994994 }
995995 }
996996
997− Q_FOREACH(const QQmlChangeSet::Change &insert, changeSet.inserts()) {
997+ Q_FOREACH(const QQmlChangeSet::Change insert, changeSet.inserts()) {
998998// qDebug() << "ListViewWithPageHeader::onModelUpdated Insert" << insert.index << insert.count;
999999 const bool insertingInValidIndexes = insert.index > m_firstVisibleIndex && insert.index < m_firstVisibleIndex + m_visibleItems.count();
10001000 const bool firstItemWithViewOnTop = insert.index == 0 && m_firstVisibleIndex == 0 && m_visibleItems.first()->y() + m_clipItem->y() > contentY();
@@ -1052,7 +1052,7 @@ void ListViewWithPageHeader::onModelUpdated(const QQmlChangeSet &changeSet, bool
10521052 }
10531053 }
10541054
1055− Q_FOREACH(const QQmlChangeSet::Change &change, changeSet.changes()) {
1055+ Q_FOREACH(const QQmlChangeSet::Change change, changeSet.changes()) {
10561056// qDebug() << "ListViewWithPageHeader::onModelUpdated Change" << change.index << change.count;
10571057 for (int i = change.index; i < change.count; ++i) {
10581058 ListItem *item = itemAtIndex(i);
plugins/Dash/organicgrid.cpp+3−3
@@ -32,7 +32,7 @@ QSizeF OrganicGrid::smallDelegateSize() const
3232 return m_smallDelegateSize;
3333}
3434
35−void OrganicGrid::setSmallDelegateSize(const QSizeF &size)
35+void OrganicGrid::setSmallDelegateSize(const QSizeF size)
3636{
3737 if (m_smallDelegateSize != size) {
3838 m_smallDelegateSize = size;
@@ -49,7 +49,7 @@ QSizeF OrganicGrid::bigDelegateSize() const
4949 return m_bigDelegateSize;
5050}
5151
52−void OrganicGrid::setBigDelegateSize(const QSizeF &size)
52+void OrganicGrid::setBigDelegateSize(const QSizeF size)
5353{
5454 if (m_bigDelegateSize != size) {
5555 m_bigDelegateSize = size;
@@ -237,7 +237,7 @@ void OrganicGrid::calculateImplicitHeight()
237237
238238void OrganicGrid::processModelRemoves(const QVector<QQmlChangeSet::Change> &removes)
239239{
240− Q_FOREACH(const QQmlChangeSet::Change &remove, removes) {
240+ Q_FOREACH(const QQmlChangeSet::Change remove, removes) {
241241 for (int i = remove.count - 1; i >= 0; --i) {
242242 const int indexToRemove = remove.index + i;
243243 // We only support removing from the end
plugins/Dash/organicgrid.h+2−2
@@ -59,10 +59,10 @@ public:
5959 OrganicGrid();
6060
6161 QSizeF smallDelegateSize() const;
62− void setSmallDelegateSize(const QSizeF &size);
62+ void setSmallDelegateSize(const QSizeF size);
6363
6464 QSizeF bigDelegateSize() const;
65− void setBigDelegateSize(const QSizeF &size);
65+ void setBigDelegateSize(const QSizeF size);
6666
6767Q_SIGNALS:
6868 void smallDelegateSizeChanged();
plugins/Dash/verticaljournal.cpp+6−6
@@ -50,7 +50,7 @@ void VerticalJournal::setColumnWidth(qreal columnWidth)
5050
5151 if (isComponentComplete()) {
5252 Q_FOREACH(const auto &column, m_columnVisibleItems) {
53− Q_FOREACH(const ViewItem &item, column) {
53+ Q_FOREACH(const ViewItem item, column) {
5454 item.m_item->setWidth(columnWidth);
5555 }
5656 }
@@ -172,7 +172,7 @@ void VerticalJournal::cleanupExistingItems()
172172 // Cleanup the existing items
173173 for (int i = 0; i < m_columnVisibleItems.count(); ++i) {
174174 QList<ViewItem> &column = m_columnVisibleItems[i];
175− Q_FOREACH(const ViewItem &item, column)
175+ Q_FOREACH(const ViewItem item, column)
176176 releaseItem(item.m_item);
177177 column.clear();
178178 }
@@ -218,10 +218,10 @@ void VerticalJournal::doRelayout()
218218
219219 if (!allItems.isEmpty()) {
220220 if (allItems.first().m_modelIndex == 0) {
221− Q_FOREACH(const ViewItem &item, allItems)
221+ Q_FOREACH(const ViewItem item, allItems)
222222 addItemToView(item.m_modelIndex, item.m_item);
223223 } else {
224− Q_FOREACH(const ViewItem &item, allItems)
224+ Q_FOREACH(const ViewItem item, allItems)
225225 releaseItem(item.m_item);
226226 }
227227 }
@@ -230,7 +230,7 @@ void VerticalJournal::doRelayout()
230230void VerticalJournal::updateItemCulling(qreal visibleFromY, qreal visibleToY)
231231{
232232 Q_FOREACH(const auto &column, m_columnVisibleItems) {
233− Q_FOREACH(const ViewItem &item, column) {
233+ Q_FOREACH(const ViewItem item, column) {
234234 const bool cull = item.y() + item.height() <= visibleFromY || item.y() >= visibleToY;
235235 QQuickItemPrivate::get(item.m_item)->setCulled(cull);
236236 }
@@ -239,7 +239,7 @@ void VerticalJournal::updateItemCulling(qreal visibleFromY, qreal visibleToY)
239239
240240void VerticalJournal::processModelRemoves(const QVector<QQmlChangeSet::Change> &removes)
241241{
242− Q_FOREACH(const QQmlChangeSet::Change &remove, removes) {
242+ Q_FOREACH(const QQmlChangeSet::Change remove, removes) {
243243 for (int i = remove.count - 1; i >= 0; --i) {
244244 const int indexToRemove = remove.index + i;
245245 // Since we only support removing from the end, indexToRemove
plugins/Dash/verticaljournal.h+1−1
@@ -76,7 +76,7 @@ private:
7676 qreal x() const { return m_item->x(); }
7777 qreal y() const { return m_item->y(); }
7878 qreal height() const { return m_item->height(); }
79− bool operator<(const ViewItem &v) const { return m_modelIndex < v.m_modelIndex; }
79+ bool operator<(const ViewItem v) const { return m_modelIndex < v.m_modelIndex; }
8080
8181 QQuickItem *m_item;
8282 int m_modelIndex;
plugins/GlobalShortcut/globalshortcutregistry.cpp+1−1
@@ -104,7 +104,7 @@ void GlobalShortcutRegistry::setupFilterOnWindow(qulonglong wid)
104104 s_windowId = 0;
105105 }
106106
107− for(QWindow *window: qApp->allWindows()) {
107+ Q_FOREACH(QWindow *window, qApp->allWindows()) {
108108 if (window && window->winId() == wid) {
109109 m_filteredWindow = window;
110110 window->installEventFilter(this);
plugins/IntegratedLightDM/liblightdm/Greeter.cpp+1−1
@@ -173,7 +173,7 @@ void Greeter::respond(const QString &response)
173173
174174void Greeter::sendAuthenticationComplete()
175175{
176− if (qgetenv("UNITY_TESTING").isEmpty()) {
176+ if (qEnvironmentVariableIsEmpty("UNITY_TESTING")) {
177177 // simulate PAM's delay
178178 QTimer::singleShot(1000, this, &Greeter::authenticationComplete);
179179 } else {
plugins/Ubuntu/DownloadDaemonListener/DownloadTracker.h+1−1
@@ -48,7 +48,7 @@ public:
4848Q_SIGNALS:
4949 void serviceChanged(const QString &service);
5050 void dbusPathChanged(const QString &dbusPath);
51− void serviceReadyChanged(const bool &serviceReady);
51+ void serviceReadyChanged(const bool serviceReady);
5252
5353 void canceled(bool success);
5454 void error(const QString &error);
plugins/Ubuntu/Gestures/Damper.h+2−2
@@ -67,12 +67,12 @@ public:
6767
6868 qreal maxDelta() const { return m_x.maxDelta(); }
6969
70− void reset(const QPointF &point) {
70+ void reset(const QPointF point) {
7171 m_x.reset(point.x());
7272 m_y.reset(point.y());
7373 }
7474
75− void update(const QPointF &point) {
75+ void update(const QPointF point) {
7676 m_x.update(point.x());
7777 m_y.update(point.y());
7878 }
plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+3−3
@@ -614,7 +614,7 @@ void DirectionalDragAreaPrivate::setStatus(Status newStatus)
614614 }
615615}
616616
617−void DirectionalDragAreaPrivate::setPublicPos(const QPointF &point)
617+void DirectionalDragAreaPrivate::setPublicPos(const QPointF point)
618618{
619619 bool xChanged = publicPos.x() != point.x();
620620 bool yChanged = publicPos.y() != point.y();
@@ -653,7 +653,7 @@ void DirectionalDragAreaPrivate::setPublicPos(const QPointF &point)
653653 }
654654}
655655
656−void DirectionalDragAreaPrivate::setPublicScenePos(const QPointF &point)
656+void DirectionalDragAreaPrivate::setPublicScenePos(const QPointF point)
657657{
658658 bool xChanged = publicScenePos.x() != point.x();
659659 bool yChanged = publicScenePos.y() != point.y();
@@ -863,7 +863,7 @@ void DirectionalDragAreaPrivate::updateSceneDirectionVector()
863863 sceneDirectionVector = sceneDirection - sceneOrigin;
864864}
865865
866−qreal DirectionalDragAreaPrivate::projectOntoDirectionVector(const QPointF &sceneVector) const
866+qreal DirectionalDragAreaPrivate::projectOntoDirectionVector(const QPointF sceneVector) const
867867{
868868 // same as dot product as sceneDirectionVector is a unit vector
869869 return sceneVector.x() * sceneDirectionVector.x() +
plugins/Ubuntu/Gestures/DirectionalDragArea_p.h+3−3
@@ -84,13 +84,13 @@ public:
8484 bool isPastMaxDistance() const;
8585 const QTouchEvent::TouchPoint *fetchTargetTouchPoint(QTouchEvent *event);
8686 void setStatus(Status newStatus);
87− void setPublicPos(const QPointF &point);
88− void setPublicScenePos(const QPointF &point);
87+ void setPublicPos(const QPointF point);
88+ void setPublicScenePos(const QPointF point);
8989 bool isWithinTouchCompositionWindow();
9090 void updateSceneDirectionVector();
9191 // returns the scalar projection between the given vector (in scene coordinates)
9292 // and m_sceneDirectionVector
93− qreal projectOntoDirectionVector(const QPointF &sceneVector) const;
93+ qreal projectOntoDirectionVector(const QPointF sceneVector) const;
9494 void touchOwnershipEvent(TouchOwnershipEvent *event);
9595 void unownedTouchEvent(UnownedTouchEvent *event);
9696 void unownedTouchEvent_undecided(UnownedTouchEvent *unownedTouchEvent);
plugins/Unity/Launcher/asadapter.h+3
@@ -28,6 +28,9 @@ public:
2828 ASAdapter();
2929 ~ASAdapter();
3030
31+ ASAdapter(const ASAdapter&) = delete;
32+ ASAdapter& operator=(const ASAdapter&) = delete;
33+
3134 void syncItems(const QList<LauncherItem*> &list);
3235
3336private:
plugins/Unity/Launcher/dbusinterface.cpp+8−7
@@ -159,11 +159,12 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
159159 return false;
160160 }
161161
162− if (message.member() == QLatin1String("Get") && (message.arguments().count() != 2 || message.arguments()[0].toString() != QLatin1String("com.canonical.Unity.Launcher.Item"))) {
162+ const QList<QVariant> messageArguments = message.arguments();
163+ if (message.member() == QLatin1String("Get") && (messageArguments.count() != 2 || messageArguments[0].toString() != QLatin1String("com.canonical.Unity.Launcher.Item"))) {
163164 return false;
164165 }
165166
166− if (message.member() == QLatin1String("Set") && (message.arguments().count() != 3 || message.arguments()[0].toString() != QLatin1String("com.canonical.Unity.Launcher.Item"))) {
167+ if (message.member() == QLatin1String("Set") && (messageArguments.count() != 3 || messageArguments[0].toString() != QLatin1String("com.canonical.Unity.Launcher.Item"))) {
167168 return false;
168169 }
169170
@@ -176,7 +177,7 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
176177
177178 QVariantList retval;
178179 if (message.member() == QLatin1String("Get")) {
179− QString cachedString = message.arguments()[1].toString();
180+ QString cachedString = messageArguments[1].toString();
180181 if (!item) {
181182 return false;
182183 }
@@ -188,21 +189,21 @@ bool DBusInterface::handleMessage(const QDBusMessage& message, const QDBusConnec
188189 retval.append(QVariant::fromValue(QDBusVariant(item->progress())));
189190 }
190191 } else if (message.member() == QLatin1String("Set")) {
191− QString cachedString = message.arguments()[1].toString();
192+ QString cachedString = messageArguments[1].toString();
192193 if (cachedString == QLatin1String("count")) {
193− int newCount = message.arguments()[2].value<QDBusVariant>().variant().toInt();
194+ int newCount = messageArguments[2].value<QDBusVariant>().variant().toInt();
194195 if (!item || newCount != item->count()) {
195196 Q_EMIT countChanged(appid, newCount);
196197 notifyPropertyChanged(QStringLiteral("com.canonical.Unity.Launcher.Item"), encodeAppId(appid), QStringLiteral("count"), QVariant(newCount));
197198 }
198199 } else if (cachedString == QLatin1String("countVisible")) {
199− bool newVisible = message.arguments()[2].value<QDBusVariant>().variant().toBool();
200+ bool newVisible = messageArguments[2].value<QDBusVariant>().variant().toBool();
200201 if (!item || newVisible != item->countVisible()) {
201202 Q_EMIT countVisibleChanged(appid, newVisible);
202203 notifyPropertyChanged(QStringLiteral("com.canonical.Unity.Launcher.Item"), encodeAppId(appid), QStringLiteral("countVisible"), newVisible);
203204 }
204205 } else if (cachedString == QLatin1String("progress")) {
205− int newProgress = message.arguments()[2].value<QDBusVariant>().variant().toInt();
206+ int newProgress = messageArguments[2].value<QDBusVariant>().variant().toInt();
206207 if (!item || newProgress != item->progress()) {
207208 Q_EMIT progressChanged(appid, newProgress);
208209 notifyPropertyChanged(QStringLiteral("com.canonical.Unity.Launcher.Item"), encodeAppId(appid), QStringLiteral("progress"), QVariant(newProgress));
plugins/Unity/Platform/platform.cpp+2−2
@@ -20,7 +20,7 @@
2020
2121Platform::Platform(QObject *parent)
2222 : QObject(parent)
23− , m_iface("org.freedesktop.hostname1", "/org/freedesktop/hostname1", "org.freedesktop.hostname1",
23+ , m_iface(QStringLiteral("org.freedesktop.hostname1"), QStringLiteral("/org/freedesktop/hostname1"), QStringLiteral("org.freedesktop.hostname1"),
2424 QDBusConnection::systemBus(), this)
2525{
2626 QMetaObject::invokeMethod(this, "init");
@@ -29,7 +29,7 @@ Platform::Platform(QObject *parent)
2929void Platform::init()
3030{
3131 m_chassis = m_iface.property("Chassis").toString();
32− m_isPC = (m_chassis == "desktop" || m_chassis == "laptop" || m_chassis == "server");
32+ m_isPC = (m_chassis == QLatin1String("desktop") || m_chassis == QLatin1String("laptop") || m_chassis == QLatin1String("server"));
3333}
3434
3535QString Platform::chassis() const
plugins/Utils/constants.cpp+1−1
@@ -19,7 +19,7 @@
1919Constants::Constants(QObject *parent)
2020 : QObject(parent)
2121{
22− if (qgetenv("QT_LOAD_TESTABILITY").isEmpty()) {
22+ if (qEnvironmentVariableIsEmpty("QT_LOAD_TESTABILITY")) {
2323 m_indicatorValueTimeout = 30000;
2424 } else {
2525 m_indicatorValueTimeout = 5000;
plugins/Utils/easingcurve.cpp+1−1
@@ -32,7 +32,7 @@ QEasingCurve::Type EasingCurve::type() const
3232 return m_easingCurve.type();
3333}
3434
35−void EasingCurve::setType(const QEasingCurve::Type &type)
35+void EasingCurve::setType(const QEasingCurve::Type type)
3636{
3737 // FIXME: Working around bug https://bugreports.qt-project.org/browse/QTBUG-38686 here
3838 QEasingCurve newCurve;
plugins/Utils/easingcurve.h+1−1
@@ -46,7 +46,7 @@ public:
4646 EasingCurve(QObject *parent = 0);
4747
4848 QEasingCurve::Type type() const;
49− void setType(const QEasingCurve::Type &type);
49+ void setType(const QEasingCurve::Type type);
5050
5151 qreal period() const;
5252 void setPeriod(qreal period);
plugins/Utils/timezoneFormatter.cpp+1−1
@@ -29,7 +29,7 @@ QString TimezoneFormatter::currentTimeInTimezone(const QVariant &tzId) const
2929 if (tz.isValid()) {
3030 const QDateTime now = QDateTime::currentDateTime().toTimeZone(tz);
3131 // return locale-aware string in the form "day, hh:mm", e.g. "Mon 14:30" or "Mon 1:30 pm"
32− return QStringLiteral("%1 %2").arg(now.toString(QStringLiteral("ddd"))).arg(now.time().toString(Qt::DefaultLocaleShortDate));
32+ return QStringLiteral("%1 %2").arg(now.toString(QStringLiteral("ddd")), now.time().toString(Qt::DefaultLocaleShortDate));
3333 }
3434 return QString();
3535}
plugins/Utils/windowstatestorage.cpp+5−5
@@ -66,10 +66,10 @@ WindowStateStorage::WindowState WindowStateStorage::getState(const QString &wind
6666 if (!query.first()) {
6767 return defaultValue;
6868 }
69− return (WindowState)query.value("state").toInt();
69+ return (WindowState)query.value(QStringLiteral("state")).toInt();
7070}
7171
72−void WindowStateStorage::saveGeometry(const QString &windowId, const QRect &rect)
72+void WindowStateStorage::saveGeometry(const QString &windowId, const QRect rect)
7373{
7474 const QString queryString = QStringLiteral("INSERT OR REPLACE INTO geometry (windowId, x, y, width, height) values ('%1', '%2', '%3', '%4', '%5');")
7575 .arg(windowId)
@@ -94,7 +94,7 @@ void WindowStateStorage::executeAsyncQuery(const QString &queryString)
9494 }
9595}
9696
97−QRect WindowStateStorage::getGeometry(const QString &windowId, const QRect &defaultValue) const
97+QRect WindowStateStorage::getGeometry(const QString &windowId, const QRect defaultValue) const
9898{
9999 QString queryString = QStringLiteral("SELECT * FROM geometry WHERE windowId = '%1';")
100100 .arg(windowId);
@@ -120,9 +120,9 @@ void WindowStateStorage::initdb()
120120 query.exec(QStringLiteral("CREATE TABLE geometry(windowId TEXT UNIQUE, x INTEGER, y INTEGER, width INTEGER, height INTEGER);"));
121121 }
122122
123− if (!m_db.tables().contains("state")) {
123+ if (!m_db.tables().contains(QStringLiteral("state"))) {
124124 QSqlQuery query;
125− query.exec("CREATE TABLE state(windowId TEXT UNIQUE, state INTEGER);");
125+ query.exec(QStringLiteral("CREATE TABLE state(windowId TEXT UNIQUE, state INTEGER);"));
126126 }
127127}
128128
plugins/Utils/windowstatestorage.h+2−2
@@ -35,8 +35,8 @@ public:
3535 Q_INVOKABLE void saveState(const QString &windowId, WindowState state);
3636 Q_INVOKABLE WindowState getState(const QString &windowId, WindowState defaultValue) const;
3737
38− Q_INVOKABLE void saveGeometry(const QString &windowId, const QRect &rect);
39− Q_INVOKABLE QRect getGeometry(const QString &windowId, const QRect &defaultValue) const;
38+ Q_INVOKABLE void saveGeometry(const QString &windowId, const QRect rect);
39+ Q_INVOKABLE QRect getGeometry(const QString &windowId, const QRect defaultValue) const;
4040
4141private:
4242 void initdb();
src/ShellApplication.cpp+3−3
@@ -103,7 +103,7 @@ ShellApplication::ShellApplication(int & argc, char ** argv, bool isMirServer)
103103 // (eg cloned desktop, several desktops, etc)
104104 if (isMirServer && screens().count() == 2) {
105105 m_shellView->setScreen(screens().at(1));
106− m_qmlArgs.setDeviceName("desktop");
106+ m_qmlArgs.setDeviceName(QStringLiteral("desktop"));
107107
108108 m_secondaryWindow = new SecondaryWindow(m_qmlEngine);
109109 m_secondaryWindow->setScreen(screens().at(0));
@@ -164,7 +164,7 @@ void ShellApplication::onScreenAdded(QScreen * /*screen*/)
164164 // (eg cloned desktop, several desktops, etc)
165165 if (screens().count() == 2) {
166166 m_shellView->setScreen(screens().at(1));
167− m_qmlArgs.setDeviceName("desktop");
167+ m_qmlArgs.setDeviceName(QStringLiteral("desktop"));
168168 // Changing the QScreen where a QWindow is drawn makes it also lose focus (besides having
169169 // its backing QPlatformWindow recreated). So lets refocus it.
170170 m_shellView->requestActivate();
@@ -188,7 +188,7 @@ void ShellApplication::onScreenAboutToBeRemoved(QScreen *screen)
188188 Q_ASSERT(m_secondaryWindow);
189189 delete m_secondaryWindow;
190190 m_secondaryWindow = nullptr;
191− m_shellView->setScreen(screens().first());
191+ m_shellView->setScreen(screens().at(0));
192192 m_qmlArgs.setDeviceName(m_deviceName);
193193 // Changing the QScreen where a QWindow is drawn makes it also lose focus (besides having
194194 // its backing QPlatformWindow recreated). So lets refocus it.