Merge lp:~loic.molinari/ubuntu-ui-toolkit/uitk-ascii-cast-warnings-fix into lp:ubuntu-ui-toolkit/staging
- uitk-ascii-cast-warnings-fix
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Zsombor Egri |
Approved revision: | 2104 |
Merged at revision: | 2112 |
Proposed branch: | lp:~loic.molinari/ubuntu-ui-toolkit/uitk-ascii-cast-warnings-fix |
Merge into: | lp:ubuntu-ui-toolkit/staging |
Prerequisite: | lp:~loic.molinari/ubuntu-ui-toolkit/uitk-ubuntu-qt-module-projects-clean-up |
Diff against target: |
1907 lines (+352/-292) 48 files modified
src/UbuntuMetrics/applicationmonitor.cpp (+1/-1) src/UbuntuMetrics/logger.cpp (+2/-2) src/UbuntuToolkit/UbuntuToolkit.pro (+0/-3) src/UbuntuToolkit/adapters/actionsproxy_p.cpp (+1/-1) src/UbuntuToolkit/adapters/alarmsadapter_organizer.cpp (+42/-38) src/UbuntuToolkit/adapters/dbuspropertywatcher_p.cpp (+15/-12) src/UbuntuToolkit/i18n.cpp (+56/-37) src/UbuntuToolkit/livetimer_p.cpp (+8/-8) src/UbuntuToolkit/privates/appheaderbase.cpp (+1/-1) src/UbuntuToolkit/privates/listitemdragarea.cpp (+1/-1) src/UbuntuToolkit/privates/listitemdraghandler.cpp (+1/-1) src/UbuntuToolkit/privates/splitviewhandler.cpp (+2/-2) src/UbuntuToolkit/qquickmimedata.cpp (+5/-2) src/UbuntuToolkit/quickutils.cpp (+7/-7) src/UbuntuToolkit/sortfiltermodel.cpp (+3/-2) src/UbuntuToolkit/statesaverbackend_p.cpp (+9/-7) src/UbuntuToolkit/timeutils_p.h (+2/-2) src/UbuntuToolkit/ubuntutoolkitmodule.cpp (+46/-36) src/UbuntuToolkit/ucaction.cpp (+3/-3) src/UbuntuToolkit/ucactionitem.cpp (+2/-1) src/UbuntuToolkit/ucargument.cpp (+1/-1) src/UbuntuToolkit/ucarguments.cpp (+10/-9) src/UbuntuToolkit/ucbottomedge.cpp (+4/-4) src/UbuntuToolkit/ucbottomedgehint.cpp (+4/-4) src/UbuntuToolkit/ucbottomedgeregion.cpp (+1/-1) src/UbuntuToolkit/ucdefaulttheme.cpp (+13/-14) src/UbuntuToolkit/ucdeprecatedtheme.cpp (+5/-4) src/UbuntuToolkit/uchaptics.cpp (+2/-1) src/UbuntuToolkit/ucheader.cpp (+1/-1) src/UbuntuToolkit/uclabel.cpp (+7/-5) src/UbuntuToolkit/uclistitem.cpp (+4/-4) src/UbuntuToolkit/uclistitemstyle.cpp (+4/-3) src/UbuntuToolkit/ucmainviewbase.cpp (+1/-1) src/UbuntuToolkit/ucmousefilters.cpp (+2/-2) src/UbuntuToolkit/ucpagetreenode.cpp (+12/-12) src/UbuntuToolkit/ucqquickimageextension.cpp (+12/-10) src/UbuntuToolkit/ucscalingimageprovider.cpp (+2/-2) src/UbuntuToolkit/ucserviceproperties.cpp (+4/-4) src/UbuntuToolkit/ucstatesaver.cpp (+1/-1) src/UbuntuToolkit/ucstyleditembase.cpp (+3/-3) src/UbuntuToolkit/ucstylehints.cpp (+5/-4) src/UbuntuToolkit/uctheme.cpp (+22/-19) src/UbuntuToolkit/ucthemingextension.cpp (+3/-2) src/UbuntuToolkit/ucubuntushape.cpp (+4/-3) src/UbuntuToolkit/ucubuntushape_p.h (+6/-4) src/UbuntuToolkit/ucunits.cpp (+3/-3) src/UbuntuToolkit/ucurihandler.cpp (+1/-1) src/UbuntuToolkit/unitythemeiconprovider.cpp (+8/-3) |
To merge this branch: | bzr merge lp:~loic.molinari/ubuntu-ui-toolkit/uitk-ascii-cast-warnings-fix |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
ubuntu-sdk-build-bot | continuous-integration | Approve | |
Zsombor Egri | Approve | ||
Review via email: mp+305446@code.launchpad.net |
Commit message
Optimised QString code gen for ASCII strings known at compile-time.
That allows the compiler to optimise our code better by putting all these QStrings known at compile time in the .rodata section of the binary as well as preventing a bunch of useless processing on them. That also allows us to remove "DEFINES -= QT_ASCII_
Description of the change
Optimised QString code gen for ASCII strings known at compile-time.
That allows the compiler to optimise our code better by putting all these QStrings known at compile time in the .rodata section of the binary as well as preventing a bunch of useless processing on them. That also allows us to remove "DEFINES -= QT_ASCII_
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2103
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2103
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2103
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2103
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
- 2104. By Loïc Molinari
-
Merged lp:ubuntu-ui-toolkit/staging.
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2104
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2104
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2104
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2104
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2104
https:/
Executed test runs:
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Zsombor Egri (zsombi) wrote : | # |
Quite a big change, with all the string literals. Thanks for that!
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2104
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2104
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2104
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2104
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
PASSED: Continuous integration, rev:2104
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'src/UbuntuMetrics/applicationmonitor.cpp' |
2 | --- src/UbuntuMetrics/applicationmonitor.cpp 2016-09-09 17:49:07 +0000 |
3 | +++ src/UbuntuMetrics/applicationmonitor.cpp 2016-09-15 14:53:25 +0000 |
4 | @@ -39,7 +39,7 @@ |
5 | aligned_alloc(logQueueAlignment, logQueueSize * sizeof(UMEvent))); |
6 | |
7 | #if !defined(QT_NO_DEBUG) |
8 | - setObjectName(QString::fromLatin1("UbuntuMetrics logging", 21)); // Thread name. |
9 | + setObjectName(QStringLiteral("UbuntuMetrics logging")); // Thread name. |
10 | #endif |
11 | start(); |
12 | } |
13 | |
14 | === modified file 'src/UbuntuMetrics/logger.cpp' |
15 | --- src/UbuntuMetrics/logger.cpp 2016-09-09 17:49:07 +0000 |
16 | +++ src/UbuntuMetrics/logger.cpp 2016-09-15 14:53:25 +0000 |
17 | @@ -113,8 +113,8 @@ |
18 | |
19 | QTime timeStamp = QTime(0, 0).addMSecs(event.timeStamp / 1000000); |
20 | QString timeString = !timeStamp.hour() |
21 | - ? timeStamp.toString(QString::fromLatin1("mm:ss:zzz", 9)) |
22 | - : timeStamp.toString(QString::fromLatin1("hh:mm:ss:zzz", 12)); |
23 | + ? timeStamp.toString(QStringLiteral("mm:ss:zzz")) |
24 | + : timeStamp.toString(QStringLiteral("hh:mm:ss:zzz")); |
25 | |
26 | switch (event.type) { |
27 | case UMEvent::Process: { |
28 | |
29 | === modified file 'src/UbuntuToolkit/UbuntuToolkit.pro' |
30 | --- src/UbuntuToolkit/UbuntuToolkit.pro 2016-09-12 08:18:53 +0000 |
31 | +++ src/UbuntuToolkit/UbuntuToolkit.pro 2016-09-15 14:53:25 +0000 |
32 | @@ -240,6 +240,3 @@ |
33 | $$PWD/privates/shaders/frame.frag |
34 | |
35 | load(ubuntu_qt_module) |
36 | - |
37 | -# Remove the ASCII cast warnings added by qt_module. |
38 | -DEFINES -= QT_ASCII_CAST_WARNINGS |
39 | |
40 | === modified file 'src/UbuntuToolkit/adapters/actionsproxy_p.cpp' |
41 | --- src/UbuntuToolkit/adapters/actionsproxy_p.cpp 2016-09-09 17:49:07 +0000 |
42 | +++ src/UbuntuToolkit/adapters/actionsproxy_p.cpp 2016-09-15 14:53:25 +0000 |
43 | @@ -30,7 +30,7 @@ |
44 | : globalContext(new UCActionContext) |
45 | { |
46 | // for testing purposes |
47 | - globalContext->setObjectName("GlobalActionContext"); |
48 | + globalContext->setObjectName(QStringLiteral("GlobalActionContext")); |
49 | } |
50 | ActionProxy::~ActionProxy() |
51 | { |
52 | |
53 | === modified file 'src/UbuntuToolkit/adapters/alarmsadapter_organizer.cpp' |
54 | --- src/UbuntuToolkit/adapters/alarmsadapter_organizer.cpp 2016-09-09 21:26:23 +0000 |
55 | +++ src/UbuntuToolkit/adapters/alarmsadapter_organizer.cpp 2016-09-15 14:53:25 +0000 |
56 | @@ -31,20 +31,19 @@ |
57 | #include "alarmmanager_p_p.h" |
58 | #include "ucalarm_p_p.h" |
59 | |
60 | -#define ALARM_DATABASE "%1/alarms.json" |
61 | -/* |
62 | - * The main alarm manager engine used from Saucy onwards is EDS (Evolution Data |
63 | - * Server) based. Any previous release uses the generic "memory" manager engine |
64 | - * which does not store alarm data, does not schedule organizer events and does |
65 | - * not give visual or audible reminding. |
66 | - */ |
67 | -#define ALARM_MANAGER "eds" |
68 | -#define ALARM_MANAGER_FALLBACK "memory" |
69 | -#define ALARM_COLLECTION "Alarms" |
70 | +static const QString alarmDatabase = QStringLiteral("%1/alarms.json"); |
71 | + |
72 | +// The main alarm manager engine used from Saucy onwards is EDS (Evolution Data |
73 | +// Server) based. Any previous release uses the generic "memory" manager engine |
74 | +// which does not store alarm data, does not schedule organizer events and does |
75 | +// not give visual or audible reminding. |
76 | +static const QString alarmManager = QStringLiteral("eds"); |
77 | +static const QString alarmManagerFallback = QStringLiteral("memory"); |
78 | +static const QString alarmCollection = QStringLiteral("Alarms"); |
79 | |
80 | // special tags used as workaround for bug #1361702 |
81 | -const char *tagAlarmService = "x-canonical-alarm"; |
82 | -const char *tagDisabledAlarm = "x-canonical-disabled"; |
83 | +static const QString tagAlarmService = QStringLiteral("x-canonical-alarm"); |
84 | +static const QString tagDisabledAlarm = QStringLiteral("x-canonical-disabled"); |
85 | |
86 | QTORGANIZER_USE_NAMESPACE |
87 | |
88 | @@ -94,7 +93,7 @@ |
89 | return false; |
90 | } |
91 | QDateTime dt = AlarmUtils::normalizeDate(date); |
92 | - if (AlarmsAdapter::get()->manager->managerName() == ALARM_MANAGER) { |
93 | + if (AlarmsAdapter::get()->manager->managerName() == alarmManager) { |
94 | // use invalid timezone to simulate floating time for EDS backend |
95 | dt = QDateTime(dt.date(), dt.time(), QTimeZone()); |
96 | } |
97 | @@ -393,12 +392,13 @@ |
98 | // register QOrganizerItemId comparators so QVariant == operator can compare them |
99 | QMetaType::registerComparators<QOrganizerItemId>(); |
100 | |
101 | - QString envManager(qgetenv("ALARM_BACKEND")); |
102 | + QString envManager = QString::fromLocal8Bit(qgetenv("ALARM_BACKEND")); |
103 | if (envManager.isEmpty()) |
104 | - envManager = ALARM_MANAGER; |
105 | + envManager = alarmManager; |
106 | if (!QOrganizerManager::availableManagers().contains(envManager)) { |
107 | - qWarning() << "WARNING: alarm manager" << envManager << "not installed, using" << QString(ALARM_MANAGER_FALLBACK); |
108 | - envManager = ALARM_MANAGER_FALLBACK; |
109 | + qWarning() << "WARNING: alarm manager" << envManager << "not installed, using" |
110 | + << alarmManagerFallback; |
111 | + envManager = alarmManagerFallback; |
112 | } |
113 | manager = new QOrganizerManager(envManager); |
114 | manager->setParent(q_ptr); |
115 | @@ -406,7 +406,7 @@ |
116 | QList<QOrganizerCollection> collections = manager->collections(); |
117 | if (collections.count() > 0) { |
118 | Q_FOREACH(const QOrganizerCollection &c, collections) { |
119 | - if (c.metaData(QOrganizerCollection::KeyName).toString() == ALARM_COLLECTION) { |
120 | + if (c.metaData(QOrganizerCollection::KeyName).toString() == alarmCollection) { |
121 | collection = c; |
122 | break; |
123 | } |
124 | @@ -414,9 +414,10 @@ |
125 | } |
126 | if (collection.id().isNull()) { |
127 | // create alarm collection |
128 | - collection.setMetaData(QOrganizerCollection::KeyName, ALARM_COLLECTION); |
129 | + collection.setMetaData(QOrganizerCollection::KeyName, alarmCollection); |
130 | // EDS requires extra metadata to be set |
131 | - collection. setExtendedMetaData("collection-type", "Task List"); |
132 | + collection.setExtendedMetaData( |
133 | + QStringLiteral("collection-type"), QStringLiteral("Task List")); |
134 | if (!manager->saveCollection(&collection)) { |
135 | qWarning() << "WARNING: Creating dedicated collection for alarms was not possible, alarms will be saved into the default collection!"; |
136 | collection = manager->defaultCollection(); |
137 | @@ -470,10 +471,10 @@ |
138 | // load fallback manager data |
139 | void AlarmsAdapter::loadAlarms() |
140 | { |
141 | - if (manager->managerName() != ALARM_MANAGER_FALLBACK) { |
142 | + if (manager->managerName() != alarmManagerFallback) { |
143 | return; |
144 | } |
145 | - QFile file(QString(ALARM_DATABASE).arg(QStandardPaths::writableLocation(QStandardPaths::DataLocation))); |
146 | + QFile file(alarmDatabase.arg(QStandardPaths::writableLocation(QStandardPaths::DataLocation))); |
147 | if (!file.open(QFile::ReadOnly)) { |
148 | return; |
149 | } |
150 | @@ -485,12 +486,13 @@ |
151 | |
152 | // use UCAlarm to save store JSON data |
153 | UCAlarm alarm; |
154 | - alarm.setMessage(object["message"].toString()); |
155 | - alarm.setDate(QDateTime::fromString(object["date"].toString())); |
156 | - alarm.setSound(object["sound"].toString()); |
157 | - alarm.setType(static_cast<UCAlarm::AlarmType>(object["type"].toInt())); |
158 | - alarm.setDaysOfWeek(static_cast<UCAlarm::DaysOfWeek>(object["days"].toInt())); |
159 | - alarm.setEnabled(object["enabled"].toBool()); |
160 | + alarm.setMessage(object[QStringLiteral("message")].toString()); |
161 | + alarm.setDate(QDateTime::fromString(object[QStringLiteral("date")].toString())); |
162 | + alarm.setSound(object[QStringLiteral("sound")].toString()); |
163 | + alarm.setType(static_cast<UCAlarm::AlarmType>(object[QStringLiteral("type")].toInt())); |
164 | + alarm.setDaysOfWeek( |
165 | + static_cast<UCAlarm::DaysOfWeek>(object[QStringLiteral("days")].toInt())); |
166 | + alarm.setEnabled(object[QStringLiteral("enabled")].toBool()); |
167 | |
168 | AlarmDataAdapter *pAlarm = static_cast<AlarmDataAdapter*>(UCAlarmPrivate::get(&alarm)); |
169 | // call checkAlarm to complete field checks (i.e. type vs daysOfWeek, kick date, etc) |
170 | @@ -504,14 +506,14 @@ |
171 | // save fallback manager data only |
172 | void AlarmsAdapter::saveAlarms() |
173 | { |
174 | - if (manager->managerName() != ALARM_MANAGER_FALLBACK) { |
175 | + if (manager->managerName() != alarmManagerFallback) { |
176 | return; |
177 | } |
178 | QDir dir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); |
179 | if (!dir.exists()) { |
180 | dir.mkpath(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); |
181 | } |
182 | - QFile file(QString(ALARM_DATABASE).arg(dir.path())); |
183 | + QFile file(alarmDatabase.arg(dir.path())); |
184 | if (!file.open(QFile::WriteOnly | QFile::Truncate)) { |
185 | return; |
186 | } |
187 | @@ -520,12 +522,12 @@ |
188 | // create an UCAlarm and set its event to ease conversions |
189 | const UCAlarm *alarm = alarmList[i]; |
190 | QJsonObject object; |
191 | - object["message"] = alarm->message(); |
192 | - object["date"] = alarm->date().toString(); |
193 | - object["sound"] = alarm->sound().toString(); |
194 | - object["type"] = QJsonValue(alarm->type()); |
195 | - object["days"] = QJsonValue(alarm->daysOfWeek()); |
196 | - object["enabled"] = QJsonValue(alarm->enabled()); |
197 | + object[QStringLiteral("message")] = alarm->message(); |
198 | + object[QStringLiteral("date")] = alarm->date().toString(); |
199 | + object[QStringLiteral("sound")] = alarm->sound().toString(); |
200 | + object[QStringLiteral("type")] = QJsonValue(alarm->type()); |
201 | + object[QStringLiteral("days")] = QJsonValue(alarm->daysOfWeek()); |
202 | + object[QStringLiteral("enabled")] = QJsonValue(alarm->enabled()); |
203 | data.append(object); |
204 | |
205 | } |
206 | @@ -559,9 +561,11 @@ |
207 | { |
208 | Q_ASSERT(value.type() == QVariant::Bool); |
209 | if (value.toBool()) { |
210 | - return !todo.tags().contains(tagDisabledAlarm) && todo.tags().contains(tagAlarmService); |
211 | + return !todo.tags().contains(tagDisabledAlarm) |
212 | + && todo.tags().contains(tagAlarmService); |
213 | } else { |
214 | - return todo.tags().contains(tagDisabledAlarm) && todo.tags().contains(tagAlarmService); |
215 | + return todo.tags().contains(tagDisabledAlarm) |
216 | + && todo.tags().contains(tagAlarmService); |
217 | } |
218 | } |
219 | case AlarmManager::Date: |
220 | |
221 | === modified file 'src/UbuntuToolkit/adapters/dbuspropertywatcher_p.cpp' |
222 | --- src/UbuntuToolkit/adapters/dbuspropertywatcher_p.cpp 2016-09-09 17:49:07 +0000 |
223 | +++ src/UbuntuToolkit/adapters/dbuspropertywatcher_p.cpp 2016-09-15 14:53:25 +0000 |
224 | @@ -24,7 +24,8 @@ |
225 | |
226 | #include "i18n_p.h" |
227 | |
228 | -#define DYNAMIC_PROPERTY "__q_property" |
229 | +static const char dynamicProperty[] = "__q_property"; |
230 | +static const QString dbusInterface = QStringLiteral("org.freedesktop.DBus.Properties"); |
231 | |
232 | UT_NAMESPACE_BEGIN |
233 | |
234 | @@ -35,7 +36,7 @@ |
235 | |
236 | DBusServiceProperties::DBusServiceProperties(UCServiceProperties *qq) |
237 | : UCServicePropertiesPrivate(qq) |
238 | - , connection("") |
239 | + , connection(QStringLiteral("")) |
240 | , watcher(0) |
241 | , iface(0) |
242 | { |
243 | @@ -53,7 +54,7 @@ |
244 | |
245 | if (service.isEmpty() || path.isEmpty()) { |
246 | setStatus(UCServiceProperties::ConnectionError); |
247 | - setError("No service/path specified"); |
248 | + setError(QStringLiteral("No service/path specified")); |
249 | return false; |
250 | } |
251 | |
252 | @@ -98,14 +99,15 @@ |
253 | */ |
254 | bool DBusServiceProperties::setupInterface() |
255 | { |
256 | - QDBusReply<QDBusObjectPath> dbusObjectPath = iface->call("FindUserById", qlonglong(getuid())); |
257 | + QDBusReply<QDBusObjectPath> dbusObjectPath = |
258 | + iface->call(QStringLiteral("FindUserById"), qlonglong(getuid())); |
259 | if (dbusObjectPath.isValid()) { |
260 | objectPath = dbusObjectPath.value().path(); |
261 | iface->connection().connect( |
262 | service, |
263 | objectPath, |
264 | - "org.freedesktop.DBus.Properties", |
265 | - "PropertiesChanged", |
266 | + dbusInterface, |
267 | + QStringLiteral("PropertiesChanged"), |
268 | this, |
269 | SLOT(updateProperties(QString,QVariantMap,QStringList))); |
270 | return true; |
271 | @@ -134,7 +136,7 @@ |
272 | return false; |
273 | } |
274 | Q_Q(UCServiceProperties); |
275 | - QDBusInterface readIFace(iface->interface(), objectPath, "org.freedesktop.DBus.Properties", connection); |
276 | + QDBusInterface readIFace(iface->interface(), objectPath, dbusInterface, connection); |
277 | if (!readIFace.isValid()) { |
278 | // report invalid interface only if the property's first letter was with capital one! |
279 | if (property[0].isUpper()) { |
280 | @@ -142,7 +144,7 @@ |
281 | } |
282 | return false; |
283 | } |
284 | - QDBusPendingCall pending = readIFace.asyncCall("Get", adaptor, property); |
285 | + QDBusPendingCall pending = readIFace.asyncCall(QStringLiteral("Get"), adaptor, property); |
286 | if (pending.isError()) { |
287 | warning(pending.error().message()); |
288 | return false; |
289 | @@ -152,7 +154,7 @@ |
290 | this, SLOT(readFinished(QDBusPendingCallWatcher*))); |
291 | |
292 | // set a dynamic property so we know which property are we reading |
293 | - callWatcher->setProperty(DYNAMIC_PROPERTY, property); |
294 | + callWatcher->setProperty(dynamicProperty, property); |
295 | return true; |
296 | } |
297 | |
298 | @@ -164,12 +166,13 @@ |
299 | if (objectPath.isEmpty()) { |
300 | return false; |
301 | } |
302 | - QDBusInterface writeIFace(iface->interface(), objectPath, "org.freedesktop.DBus.Properties", connection); |
303 | + QDBusInterface writeIFace(iface->interface(), objectPath, dbusInterface, connection); |
304 | if (!writeIFace.isValid()) { |
305 | // invalid interface |
306 | return false; |
307 | } |
308 | - QDBusMessage msg = writeIFace.call("Set", adaptor, property, QVariant::fromValue(QDBusVariant(value))); |
309 | + QDBusMessage msg = writeIFace.call( |
310 | + QStringLiteral("Set"), adaptor, property, QVariant::fromValue(QDBusVariant(value))); |
311 | return msg.type() == QDBusMessage::ReplyMessage; |
312 | } |
313 | |
314 | @@ -180,7 +183,7 @@ |
315 | { |
316 | Q_Q(UCServiceProperties); |
317 | QDBusPendingReply<QVariant> reply = *call; |
318 | - QString property = call->property(DYNAMIC_PROPERTY).toString(); |
319 | + QString property = call->property(dynamicProperty).toString(); |
320 | scannedProperties.removeAll(property); |
321 | if (reply.isError()) { |
322 | // remove the property from being watched, as it has no property like that |
323 | |
324 | === modified file 'src/UbuntuToolkit/i18n.cpp' |
325 | --- src/UbuntuToolkit/i18n.cpp 2016-09-09 17:49:07 +0000 |
326 | +++ src/UbuntuToolkit/i18n.cpp 2016-09-15 14:53:25 +0000 |
327 | @@ -68,7 +68,7 @@ |
328 | * Note: $LANGUAGE is implicitly respected by gettext() calls and |
329 | * defines the order of multiple locales |
330 | */ |
331 | - m_language = setlocale(LC_ALL, ""); |
332 | + m_language = QString::fromLocal8Bit(setlocale(LC_ALL, "")); |
333 | } |
334 | |
335 | UbuntuI18n::~UbuntuI18n() |
336 | @@ -119,11 +119,11 @@ |
337 | For click we use APP_DIR/share/locale |
338 | e.g. /usr/share/click/preinstalled/com.example.foo/current/share/locale |
339 | */ |
340 | - QString appDir(getenv("APP_DIR")); |
341 | + QString appDir = QString::fromLocal8Bit(getenv("APP_DIR")); |
342 | if (!QDir::isAbsolutePath (appDir)) { |
343 | - appDir = "/usr"; |
344 | + appDir = QStringLiteral("/usr"); |
345 | } |
346 | - QString localePath(QDir(appDir).filePath("share/locale")); |
347 | + QString localePath(QDir(appDir).filePath(QStringLiteral("share/locale"))); |
348 | C::bindtextdomain(domain.toUtf8(), localePath.toUtf8()); |
349 | Q_EMIT domainChanged(); |
350 | } |
351 | @@ -275,70 +275,89 @@ |
352 | */ |
353 | QString UbuntuI18n::relativeDateTime(const QDateTime& datetime) |
354 | { |
355 | + static const QString ubuntuUiToolkit = QStringLiteral("ubuntu-ui-toolkit"); |
356 | + |
357 | QDateTime relativeTo(QDateTime::currentDateTime()); |
358 | const date_proximity_t prox = getDateProximity(relativeTo, datetime); |
359 | |
360 | switch (prox) { |
361 | case DATE_PROXIMITY_NOW: |
362 | /* TRANSLATORS: Time based "this is happening/happened now" */ |
363 | - return dtr("ubuntu-ui-toolkit", "Now"); |
364 | + return dtr(ubuntuUiToolkit, QStringLiteral("Now")); |
365 | |
366 | case DATE_PROXIMITY_HOUR: |
367 | { |
368 | qint64 diff = datetime.toMSecsSinceEpoch() - relativeTo.toMSecsSinceEpoch(); |
369 | qint64 minutes = qRound(float(diff) / 60000); |
370 | if (minutes < 0) { |
371 | - return dtr("ubuntu-ui-toolkit", "%1 minute ago", "%1 minutes ago", qAbs(minutes)).arg(qAbs(minutes)); |
372 | + return dtr(ubuntuUiToolkit, QStringLiteral("%1 minute ago"), |
373 | + QStringLiteral("%1 minutes ago"), qAbs(minutes)).arg(qAbs(minutes)); |
374 | } |
375 | - return dtr("ubuntu-ui-toolkit", "%1 minute", "%1 minutes", minutes).arg(minutes); |
376 | + return dtr(ubuntuUiToolkit, QStringLiteral("%1 minute"), |
377 | + QStringLiteral("%1 minutes"), minutes).arg(minutes); |
378 | } |
379 | |
380 | case DATE_PROXIMITY_TODAY: |
381 | /* en_US example: "1:00 PM" */ |
382 | - /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by |
383 | - https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
384 | - return datetime.toString(isLocale12h() ? dtr("ubuntu-ui-toolkit", "h:mm ap"): |
385 | - /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by |
386 | - https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
387 | - dtr("ubuntu-ui-toolkit", "HH:mm")); |
388 | + /* TRANSLATORS: Please translate these to your locale datetime |
389 | + format using the format specified by |
390 | + https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
391 | + return datetime.toString(isLocale12h() |
392 | + ? dtr(ubuntuUiToolkit, QStringLiteral("h:mm ap")) |
393 | + /* TRANSLATORS: Please translate these to your locale datetime |
394 | + format using the format specified by |
395 | + https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
396 | + : dtr(ubuntuUiToolkit, QStringLiteral("HH:mm"))); |
397 | |
398 | case DATE_PROXIMITY_YESTERDAY: |
399 | /* en_US example: "Yesterday 13:00" */ |
400 | - /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by |
401 | - https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
402 | - return datetime.toString(isLocale12h() ? dtr("ubuntu-ui-toolkit", "'Yesterday\u2003'h:mm ap") : |
403 | - /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by |
404 | - https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
405 | - dtr("ubuntu-ui-toolkit", "'Yesterday\u2003'HH:mm")); |
406 | + /* TRANSLATORS: Please translate these to your locale datetime |
407 | + format using the format specified by |
408 | + https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
409 | + return datetime.toString(isLocale12h() |
410 | + ? dtr(ubuntuUiToolkit, QStringLiteral("'Yesterday\u2003'h:mm ap")) |
411 | + /* TRANSLATORS: Please translate these to your locale datetime |
412 | + format using the format specified by |
413 | + https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
414 | + : dtr(ubuntuUiToolkit, QStringLiteral("'Yesterday\u2003'HH:mm"))); |
415 | |
416 | case DATE_PROXIMITY_TOMORROW: |
417 | /* en_US example: "Tomorrow 1:00 PM" */ |
418 | - /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by |
419 | - https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
420 | - return datetime.toString(isLocale12h() ? dtr("ubuntu-ui-toolkit", "'Tomorrow\u2003'h:mm ap") : |
421 | - /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by |
422 | - https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
423 | - dtr("ubuntu-ui-toolkit", "'Tomorrow\u2003'HH:mm")); |
424 | + /* TRANSLATORS: Please translate these to your locale datetime |
425 | + format using the format specified by |
426 | + https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
427 | + return datetime.toString(isLocale12h() |
428 | + ? dtr(ubuntuUiToolkit, QStringLiteral("'Tomorrow\u2003'h:mm ap")) |
429 | + /* TRANSLATORS: Please translate these to your locale datetime |
430 | + format using the format specified by |
431 | + https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
432 | + : dtr(ubuntuUiToolkit, QStringLiteral("'Tomorrow\u2003'HH:mm"))); |
433 | |
434 | case DATE_PROXIMITY_LAST_WEEK: |
435 | case DATE_PROXIMITY_NEXT_WEEK: |
436 | /* en_US example: "Fri 1:00 PM" */ |
437 | - /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by |
438 | - https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
439 | - return datetime.toString(isLocale12h() ? dtr("ubuntu-ui-toolkit", "ddd'\u2003'h:mm ap") : |
440 | - /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by |
441 | - https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
442 | - dtr("ubuntu-ui-toolkit", "ddd'\u2003'HH:mm")); |
443 | + /* TRANSLATORS: Please translate these to your locale datetime |
444 | + format using the format specified by |
445 | + https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
446 | + return datetime.toString(isLocale12h() |
447 | + ? dtr(ubuntuUiToolkit, QStringLiteral("ddd'\u2003'h:mm ap")) |
448 | + /* TRANSLATORS: Please translate these to your locale datetime |
449 | + format using the format specified by |
450 | + https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
451 | + : dtr(ubuntuUiToolkit, QStringLiteral("ddd'\u2003'HH:mm"))); |
452 | |
453 | case DATE_PROXIMITY_FAR_BACK: |
454 | case DATE_PROXIMITY_FAR_FORWARD: |
455 | default: |
456 | - /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by |
457 | - https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
458 | - return datetime.toString(isLocale12h() ? dtr("ubuntu-ui-toolkit", "ddd d MMM'\u2003'h:mm ap") : |
459 | - /* TRANSLATORS: Please translated these to your locale datetime format using the format specified by |
460 | - https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
461 | - dtr("ubuntu-ui-toolkit", "ddd d MMM'\u2003'HH:mm")); |
462 | + /* TRANSLATORS: Please translate these to your locale datetime |
463 | + format using the format specified by |
464 | + https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
465 | + return datetime.toString(isLocale12h() |
466 | + ? dtr(ubuntuUiToolkit, QStringLiteral("ddd d MMM'\u2003'h:mm ap")) |
467 | + /* TRANSLATORS: Please translate these to your locale datetime |
468 | + format using the format specified by |
469 | + https://qt-project.org/doc/qt-5-snapshot/qdatetime.html#fromString-2 */ |
470 | + : dtr(ubuntuUiToolkit, QStringLiteral("ddd d MMM'\u2003'HH:mm"))); |
471 | } |
472 | return datetime.toString(Qt::DefaultLocaleShortDate); |
473 | } |
474 | |
475 | === modified file 'src/UbuntuToolkit/livetimer_p.cpp' |
476 | --- src/UbuntuToolkit/livetimer_p.cpp 2016-09-09 17:49:07 +0000 |
477 | +++ src/UbuntuToolkit/livetimer_p.cpp 2016-09-15 14:53:25 +0000 |
478 | @@ -20,6 +20,8 @@ |
479 | |
480 | #include "timeutils_p.h" |
481 | |
482 | +static const QString dbusService = QStringLiteral("org.freedesktop.timedate1"); |
483 | + |
484 | UT_NAMESPACE_BEGIN |
485 | |
486 | SharedLiveTimer::SharedLiveTimer(QObject* parent) |
487 | @@ -29,12 +31,10 @@ |
488 | m_timer.setSingleShot(true); |
489 | connect(&m_timer, &QTimer::timeout, this, &SharedLiveTimer::timeout); |
490 | |
491 | - QDBusConnection::systemBus().connect("org.freedesktop.timedate1", |
492 | - "/org/freedesktop/timedate1", |
493 | - "org.freedesktop.DBus.Properties", |
494 | - "PropertiesChanged", |
495 | - this, |
496 | - SLOT(timedate1PropertiesChanged(QString, QVariantMap, QStringList))); |
497 | + QDBusConnection::systemBus().connect( |
498 | + dbusService, QStringLiteral("/org/freedesktop/timedate1"), |
499 | + QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("PropertiesChanged"), |
500 | + this, SLOT(timedate1PropertiesChanged(QString, QVariantMap, QStringList))); |
501 | } |
502 | |
503 | void SharedLiveTimer::registerTimer(LiveTimer *timer) |
504 | @@ -161,8 +161,8 @@ |
505 | |
506 | void SharedLiveTimer::timedate1PropertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &) |
507 | { |
508 | - if (interface != "org.freedesktop.timedate1") return; |
509 | - if (!changed.contains("Timezone")) return; |
510 | + if (interface != dbusService) return; |
511 | + if (!changed.contains(QStringLiteral("Timezone"))) return; |
512 | |
513 | QList<LiveTimer*> tmpTimers(m_liveTimers); |
514 | Q_FOREACH(LiveTimer* timer, tmpTimers) { |
515 | |
516 | === modified file 'src/UbuntuToolkit/privates/appheaderbase.cpp' |
517 | --- src/UbuntuToolkit/privates/appheaderbase.cpp 2016-09-09 17:49:07 +0000 |
518 | +++ src/UbuntuToolkit/privates/appheaderbase.cpp 2016-09-15 14:53:25 +0000 |
519 | @@ -36,7 +36,7 @@ |
520 | , m_animate(true) |
521 | { |
522 | connect(this, &UCHeader::themeChanged, this, &UCAppHeaderBase::themeChanged2); |
523 | - UCStyledItemBasePrivate::get(this)->styleDocument = "PageHeadStyle"; |
524 | + UCStyledItemBasePrivate::get(this)->styleDocument = QStringLiteral("PageHeadStyle"); |
525 | } |
526 | |
527 | UCTheme* UCAppHeaderBase::theme2() |
528 | |
529 | === modified file 'src/UbuntuToolkit/privates/listitemdragarea.cpp' |
530 | --- src/UbuntuToolkit/privates/listitemdragarea.cpp 2016-09-09 17:49:07 +0000 |
531 | +++ src/UbuntuToolkit/privates/listitemdragarea.cpp 2016-09-15 14:53:25 +0000 |
532 | @@ -48,7 +48,7 @@ |
533 | setAcceptedMouseButtons(Qt::LeftButton); |
534 | |
535 | // for testing purposes |
536 | - setObjectName("drag_area"); |
537 | + setObjectName(QStringLiteral("drag_area")); |
538 | } |
539 | |
540 | void ListItemDragArea::init(UCViewItemsAttached *viewItems) |
541 | |
542 | === modified file 'src/UbuntuToolkit/privates/listitemdraghandler.cpp' |
543 | --- src/UbuntuToolkit/privates/listitemdraghandler.cpp 2016-09-09 17:49:07 +0000 |
544 | +++ src/UbuntuToolkit/privates/listitemdraghandler.cpp 2016-09-15 14:53:25 +0000 |
545 | @@ -61,7 +61,7 @@ |
546 | connect(animation, &QQuickAbstractAnimation::stopped, |
547 | this, &ListItemDragHandler::dropItem, Qt::DirectConnection); |
548 | // force properties to contain only the 'y' coordinate |
549 | - animation->setProperties("y"); |
550 | + animation->setProperties(QStringLiteral("y")); |
551 | animation->setTargetObject(listItem); |
552 | animation->setFrom(listItem->y()); |
553 | animation->setTo(targetPos.y()); |
554 | |
555 | === modified file 'src/UbuntuToolkit/privates/splitviewhandler.cpp' |
556 | --- src/UbuntuToolkit/privates/splitviewhandler.cpp 2016-09-09 17:49:07 +0000 |
557 | +++ src/UbuntuToolkit/privates/splitviewhandler.cpp 2016-09-15 14:53:25 +0000 |
558 | @@ -32,7 +32,7 @@ |
559 | : QQuickMouseArea(parent) |
560 | { |
561 | // for testing purposes |
562 | - setObjectName("resize_handle"); |
563 | + setObjectName(QStringLiteral("resize_handle")); |
564 | setFlag(ItemHasContents); |
565 | setHoverEnabled(true); |
566 | setAcceptedButtons(Qt::LeftButton); |
567 | @@ -115,7 +115,7 @@ |
568 | // and set the new delegate - if any |
569 | if (SplitViewPrivate::get(view)->handleDelegate) { |
570 | QQmlContext *context = new QQmlContext(qmlContext(this), this); |
571 | - context->setContextProperty("handle", QVariant::fromValue(this)); |
572 | + context->setContextProperty(QStringLiteral("handle"), QVariant::fromValue(this)); |
573 | QObject *object = SplitViewPrivate::get(view)->handleDelegate->beginCreate(context); |
574 | if (object) { |
575 | QQuickItem *item = qobject_cast<QQuickItem*>(object); |
576 | |
577 | === modified file 'src/UbuntuToolkit/qquickmimedata.cpp' |
578 | --- src/UbuntuToolkit/qquickmimedata.cpp 2016-09-09 17:49:07 +0000 |
579 | +++ src/UbuntuToolkit/qquickmimedata.cpp 2016-09-15 14:53:25 +0000 |
580 | @@ -198,11 +198,14 @@ |
581 | QMimeDatabase db; |
582 | for (int i = 0; i < mlist.length() / 2; i++) { |
583 | QString type = mlist[2 * i].toString(); |
584 | - if (db.mimeTypeForName(type).isValid() || type == "application/x-color") { |
585 | + // FIXME(loicm) Just went through that while converting the code base to |
586 | + // QStringLiteral, the else can't be executed here and that smells |
587 | + // like a bug. |
588 | + if (db.mimeTypeForName(type).isValid() || type == QStringLiteral("application/x-color")) { |
589 | QByteArray data = mlist[2 * i + 1].toByteArray(); |
590 | mimeData->setData(type, data); |
591 | ret = true; |
592 | - } else if (type == "application/x-color") { |
593 | + } else if (type == QStringLiteral("application/x-color")) { |
594 | // for some reason colors are not taken in other way... |
595 | mimeData->setColorData(mlist[2 * i + 1]); |
596 | ret = true; |
597 | |
598 | === modified file 'src/UbuntuToolkit/quickutils.cpp' |
599 | --- src/UbuntuToolkit/quickutils.cpp 2016-09-09 17:49:07 +0000 |
600 | +++ src/UbuntuToolkit/quickutils.cpp 2016-09-15 14:53:25 +0000 |
601 | @@ -40,7 +40,7 @@ |
602 | m_keyboardAttached(false) |
603 | { |
604 | QGuiApplication::instance()->installEventFilter(this); |
605 | - m_omitIM << "ibus" << "none" << "compose"; |
606 | + m_omitIM << QStringLiteral("ibus") << QStringLiteral("none") << QStringLiteral("compose"); |
607 | } |
608 | |
609 | /*! |
610 | @@ -113,7 +113,7 @@ |
611 | |
612 | QString QuickUtils::inputMethodProvider() const |
613 | { |
614 | - QString im(getenv("QT_IM_MODULE")); |
615 | + QString im = QString::fromLocal8Bit(getenv("QT_IM_MODULE")); |
616 | |
617 | return m_omitIM.contains(im) ? QString() : im; |
618 | } |
619 | @@ -137,10 +137,10 @@ |
620 | QString QuickUtils::className(QObject *item) |
621 | { |
622 | if (!item) { |
623 | - return QString("(null)"); |
624 | + return QStringLiteral("(null)"); |
625 | } |
626 | - QString result = item->metaObject()->className(); |
627 | - return result.left(result.indexOf("_QML")); |
628 | + QString result = QString::fromLatin1(item->metaObject()->className()); |
629 | + return result.left(result.indexOf(QStringLiteral("_QML"))); |
630 | } |
631 | |
632 | /*! |
633 | @@ -155,8 +155,8 @@ |
634 | const QMetaObject *mo = object->metaObject(); |
635 | QString className; |
636 | while (mo) { |
637 | - className = mo->className(); |
638 | - className = className.left(className.indexOf("_QML")); |
639 | + className = QString::fromLatin1(mo->className()); |
640 | + className = className.left(className.indexOf(QStringLiteral("_QML"))); |
641 | if (className == fromClass) { |
642 | return true; |
643 | } |
644 | |
645 | === modified file 'src/UbuntuToolkit/sortfiltermodel.cpp' |
646 | --- src/UbuntuToolkit/sortfiltermodel.cpp 2016-08-16 08:43:28 +0000 |
647 | +++ src/UbuntuToolkit/sortfiltermodel.cpp 2016-09-15 14:53:25 +0000 |
648 | @@ -113,11 +113,12 @@ |
649 | int |
650 | QSortFilterProxyModelQML::roleByName(const QString& roleName) const |
651 | { |
652 | + const QByteArray roleNameByteArray = roleName.toUtf8(); |
653 | const QHash<int, QByteArray> roles = roleNames(); |
654 | QHashIterator<int, QByteArray> i(roles); |
655 | while (i.hasNext()) { |
656 | i.next(); |
657 | - if (i.value() == roleName) |
658 | + if (i.value() == roleNameByteArray) |
659 | return i.key(); |
660 | } |
661 | return 0; |
662 | @@ -224,7 +225,7 @@ |
663 | QHashIterator<int, QByteArray> i(roles); |
664 | while (i.hasNext()) { |
665 | i.next(); |
666 | - res.insert(i.value(), index(row, 0).data(i.key())); |
667 | + res.insert(QString::fromUtf8(i.value()), index(row, 0).data(i.key())); |
668 | } |
669 | return res; |
670 | } |
671 | |
672 | === modified file 'src/UbuntuToolkit/statesaverbackend_p.cpp' |
673 | --- src/UbuntuToolkit/statesaverbackend_p.cpp 2016-09-09 17:49:07 +0000 |
674 | +++ src/UbuntuToolkit/statesaverbackend_p.cpp 2016-09-15 14:53:25 +0000 |
675 | @@ -91,13 +91,13 @@ |
676 | // see bug https://bugreports.qt-project.org/browse/QTBUG-41735 |
677 | QString runtimeDir = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation); |
678 | if (runtimeDir.isEmpty()) { |
679 | - runtimeDir = qgetenv("XDG_RUNTIME_DIR"); |
680 | + runtimeDir = QString::fromLocal8Bit(qgetenv("XDG_RUNTIME_DIR")); |
681 | } |
682 | if (runtimeDir.isEmpty()) { |
683 | qCritical() << "[StateSaver] No XDG_RUNTIME_DIR path set, cannot create appstate file."; |
684 | return; |
685 | } |
686 | - m_archive = new QSettings(QString("%1/%2/statesaver.appstate"). |
687 | + m_archive = new QSettings(QStringLiteral("%1/%2/statesaver.appstate"). |
688 | arg(runtimeDir). |
689 | arg(applicationName), QSettings::NativeFormat); |
690 | m_archive->setFallbacksEnabled(false); |
691 | @@ -171,7 +171,8 @@ |
692 | // skip the property |
693 | continue; |
694 | } |
695 | - QQmlProperty qmlProperty(item, propertyName.toLocal8Bit().constData(), qmlContext(item)); |
696 | + QQmlProperty qmlProperty( |
697 | + item, QString::fromLatin1(propertyName.toLocal8Bit().constData()), qmlContext(item)); |
698 | if (qmlProperty.isValid() && qmlProperty.isWritable()) { |
699 | QVariant type = m_archive.data()->value(propertyName + "_TYPE"); |
700 | value.convert(type.toInt()); |
701 | @@ -183,9 +184,9 @@ |
702 | "object %2 has type %3 and cannot be set to value \"%4\" of" |
703 | " type %5").arg(propertyName) |
704 | .arg(qmlContext(item)->nameForObject(item)) |
705 | - .arg(qmlProperty.propertyTypeName()) |
706 | + .arg(QString::fromLatin1(qmlProperty.propertyTypeName())) |
707 | .arg(value.toString()) |
708 | - .arg(value.typeName()); |
709 | + .arg(QString::fromLatin1(value.typeName())); |
710 | } |
711 | } else { |
712 | qmlInfo(item) << QStringLiteral("property \"%1\" does not exist or is not writable for object %2") |
713 | @@ -193,7 +194,7 @@ |
714 | } |
715 | } |
716 | // drop cache once properties are successfully restored |
717 | - m_archive.data()->remove(""); |
718 | + m_archive.data()->remove(QStringLiteral("")); |
719 | m_archive.data()->endGroup(); |
720 | // restore leaved group if needed |
721 | if (restorePreviousGroup) { |
722 | @@ -210,7 +211,8 @@ |
723 | m_archive.data()->beginGroup(id); |
724 | int result = 0; |
725 | Q_FOREACH(const QString &propertyName, properties) { |
726 | - QQmlProperty qmlProperty(item, propertyName.toLocal8Bit().constData()); |
727 | + QQmlProperty qmlProperty( |
728 | + item, QString::fromLatin1(propertyName.toLocal8Bit().constData())); |
729 | if (qmlProperty.isValid()) { |
730 | QVariant value = qmlProperty.read(); |
731 | if (static_cast<QMetaType::Type>(value.type()) != QMetaType::QObjectStar) { |
732 | |
733 | === modified file 'src/UbuntuToolkit/timeutils_p.h' |
734 | --- src/UbuntuToolkit/timeutils_p.h 2016-09-09 17:49:07 +0000 |
735 | +++ src/UbuntuToolkit/timeutils_p.h 2016-09-15 14:53:25 +0000 |
736 | @@ -31,8 +31,8 @@ |
737 | inline bool isLocale12h(void) |
738 | { |
739 | QString strTimeFormat = QLocale::system().timeFormat(); |
740 | - QStringList includes; includes << "AP"; includes << "ap"; |
741 | - QStringList excludes; excludes << "H"; excludes << "HH"; |
742 | + QStringList includes; includes << QStringLiteral("AP"); includes << QStringLiteral("ap"); |
743 | + QStringList excludes; excludes << QStringLiteral("H"); excludes << QStringLiteral("HH"); |
744 | |
745 | Q_FOREACH(const QString& exclude, excludes) { |
746 | if (strTimeFormat.contains(exclude)) { |
747 | |
748 | === modified file 'src/UbuntuToolkit/ubuntutoolkitmodule.cpp' |
749 | --- src/UbuntuToolkit/ubuntutoolkitmodule.cpp 2016-09-09 17:49:07 +0000 |
750 | +++ src/UbuntuToolkit/ubuntutoolkitmodule.cpp 2016-09-15 14:53:25 +0000 |
751 | @@ -102,7 +102,8 @@ |
752 | |
753 | UT_NAMESPACE_BEGIN |
754 | |
755 | -const char *EngineProperty("__ubuntu_toolkit_plugin_data"); |
756 | +static const QString notInstantiatable = QStringLiteral("Not instantiatable"); |
757 | +static const char engineProperty[] = "__ubuntu_toolkit_plugin_data"; |
758 | |
759 | /****************************************************************************** |
760 | * UbuntuToolkitModule |
761 | @@ -114,7 +115,7 @@ |
762 | } |
763 | UbuntuToolkitModule *data = new UbuntuToolkitModule(engine); |
764 | data->m_baseUrl = QUrl(baseUrl.toString() + '/'); |
765 | - engine->setProperty(EngineProperty, QVariant::fromValue(data)); |
766 | + engine->setProperty(engineProperty, QVariant::fromValue(data)); |
767 | return data; |
768 | } |
769 | |
770 | @@ -139,7 +140,7 @@ |
771 | QQuickView* view = qobject_cast<QQuickView*>(focusWindow); |
772 | |
773 | if (view != NULL) { |
774 | - view->rootContext()->setContextProperty("window", view); |
775 | + view->rootContext()->setContextProperty(QStringLiteral("window"), view); |
776 | } |
777 | } |
778 | |
779 | @@ -156,37 +157,37 @@ |
780 | |
781 | // register root object watcher that sets a global property with the root object |
782 | // that can be accessed from any object |
783 | - context->setContextProperty("QuickUtils", QuickUtils::instance()); |
784 | + context->setContextProperty(QStringLiteral("QuickUtils"), QuickUtils::instance()); |
785 | |
786 | UCDeprecatedTheme::registerToContext(context); |
787 | |
788 | - context->setContextProperty("i18n", UbuntuI18n::instance()); |
789 | + context->setContextProperty(QStringLiteral("i18n"), UbuntuI18n::instance()); |
790 | ContextPropertyChangeListener *i18nChangeListener = |
791 | - new ContextPropertyChangeListener(context, "i18n"); |
792 | + new ContextPropertyChangeListener(context, QStringLiteral("i18n")); |
793 | QObject::connect(UbuntuI18n::instance(), SIGNAL(domainChanged()), |
794 | i18nChangeListener, SLOT(updateContextProperty())); |
795 | QObject::connect(UbuntuI18n::instance(), SIGNAL(languageChanged()), |
796 | i18nChangeListener, SLOT(updateContextProperty())); |
797 | |
798 | // We can't use 'Application' because it exists (undocumented) |
799 | - context->setContextProperty("UbuntuApplication", UCApplication::instance()); |
800 | + context->setContextProperty(QStringLiteral("UbuntuApplication"), UCApplication::instance()); |
801 | ContextPropertyChangeListener *applicationChangeListener = |
802 | - new ContextPropertyChangeListener(context, "UbuntuApplication"); |
803 | + new ContextPropertyChangeListener(context, QStringLiteral("UbuntuApplication")); |
804 | QObject::connect(UCApplication::instance(), SIGNAL(applicationNameChanged()), |
805 | applicationChangeListener, SLOT(updateContextProperty())); |
806 | // Give the application object access to the engine |
807 | UCApplication::instance()->setContext(context); |
808 | |
809 | - context->setContextProperty("units", UCUnits::instance()); |
810 | + context->setContextProperty(QStringLiteral("units"), UCUnits::instance()); |
811 | ContextPropertyChangeListener *unitsChangeListener = |
812 | - new ContextPropertyChangeListener(context, "units"); |
813 | + new ContextPropertyChangeListener(context, QStringLiteral("units")); |
814 | QObject::connect(UCUnits::instance(), SIGNAL(gridUnitChanged()), |
815 | unitsChangeListener, SLOT(updateContextProperty())); |
816 | |
817 | // register FontUtils |
818 | - context->setContextProperty("FontUtils", UCFontUtils::instance()); |
819 | + context->setContextProperty(QStringLiteral("FontUtils"), UCFontUtils::instance()); |
820 | ContextPropertyChangeListener *fontUtilsListener = |
821 | - new ContextPropertyChangeListener(context, "FontUtils"); |
822 | + new ContextPropertyChangeListener(context, QStringLiteral("FontUtils")); |
823 | QObject::connect(UCUnits::instance(), SIGNAL(gridUnitChanged()), |
824 | fontUtilsListener, SLOT(updateContextProperty())); |
825 | } |
826 | @@ -195,13 +196,16 @@ |
827 | { |
828 | qmlRegisterType<UCAction>(uri, major, minor, "Action"); |
829 | qmlRegisterType<UCActionContext>(uri, major, minor, "ActionContext"); |
830 | - qmlRegisterUncreatableType<UCApplication>(uri, major, minor, "UCApplication", "Not instantiable"); |
831 | + qmlRegisterUncreatableType<UCApplication>( |
832 | + uri, major, minor, "UCApplication", notInstantiatable); |
833 | qmlRegisterType<UCActionManager>(uri, major, minor, "ActionManager"); |
834 | - qmlRegisterUncreatableType<UCFontUtils>(uri, major, minor, "UCFontUtils", "Not instantiable"); |
835 | + qmlRegisterUncreatableType<UCFontUtils>(uri, major, minor, "UCFontUtils", notInstantiatable); |
836 | qmlRegisterType<UCStyledItemBase>(uri, major, minor, "StyledItem"); |
837 | - qmlRegisterUncreatableType<UbuntuI18n>(uri, major, minor, "i18n", "Singleton object"); |
838 | - qmlRegisterExtendedType<QQuickImageBase, UCQQuickImageExtension>(uri, major, minor, "QQuickImageBase"); |
839 | - qmlRegisterUncreatableType<UCUnits>(uri, major, minor, "UCUnits", "Not instantiable"); |
840 | + qmlRegisterUncreatableType<UbuntuI18n>( |
841 | + uri, major, minor, "i18n", QStringLiteral("Singleton object")); |
842 | + qmlRegisterExtendedType< |
843 | + QQuickImageBase, UCQQuickImageExtension>(uri, major, minor, "QQuickImageBase"); |
844 | + qmlRegisterUncreatableType<UCUnits>(uri, major, minor, "UCUnits", notInstantiatable); |
845 | qmlRegisterType<UCUbuntuShape>(uri, major, minor, "UbuntuShape"); |
846 | // FIXME/DEPRECATED: Shape is exported for backwards compatibility only |
847 | qmlRegisterType<UCUbuntuShape>(uri, major, minor, "Shape"); |
848 | @@ -238,7 +242,7 @@ |
849 | if (!engine) { |
850 | return QUrl(); |
851 | } |
852 | - UbuntuToolkitModule *data = engine->property(EngineProperty).value<UbuntuToolkitModule*>(); |
853 | + UbuntuToolkitModule *data = engine->property(engineProperty).value<UbuntuToolkitModule*>(); |
854 | return !data ? QUrl() : data->m_baseUrl; |
855 | } |
856 | |
857 | @@ -277,23 +281,24 @@ |
858 | |
859 | // Application monitoring. |
860 | UMApplicationMonitor* applicationMonitor = UMApplicationMonitor::instance(); |
861 | - const QByteArray metricsLoggingFilter = qgetenv("UC_METRICS_LOGGING_FILTER"); |
862 | + const QString metricsLoggingFilter = |
863 | + QString::fromLocal8Bit(qgetenv("UC_METRICS_LOGGING_FILTER")); |
864 | if (!metricsLoggingFilter.isNull()) { |
865 | - QStringList filterList = QString(metricsLoggingFilter).split( |
866 | - QChar(','), QString::SkipEmptyParts); |
867 | + QStringList filterList = |
868 | + metricsLoggingFilter.split(QStringLiteral(","), QString::SkipEmptyParts); |
869 | UMApplicationMonitor::LoggingFilters filter = 0; |
870 | const int size = filterList.size(); |
871 | for (int i = 0; i < size; ++i) { |
872 | - if (filterList[i] == "*") { |
873 | + if (filterList[i] == QStringLiteral("*")) { |
874 | filter |= UMApplicationMonitor::AllEvents; |
875 | break; |
876 | - } else if (filterList[i] == "window") { |
877 | + } else if (filterList[i] == QStringLiteral("window")) { |
878 | filter |= UMApplicationMonitor::WindowEvent; |
879 | - } else if (filterList[i] == "process") { |
880 | + } else if (filterList[i] == QStringLiteral("process")) { |
881 | filter |= UMApplicationMonitor::ProcessEvent; |
882 | - } else if (filterList[i] == "frame") { |
883 | + } else if (filterList[i] == QStringLiteral("frame")) { |
884 | filter |= UMApplicationMonitor::FrameEvent; |
885 | - } else if (filterList[i] == "generic") { |
886 | + } else if (filterList[i] == QStringLiteral("generic")) { |
887 | filter |= UMApplicationMonitor::GenericEvent; |
888 | } |
889 | } |
890 | @@ -307,7 +312,7 @@ |
891 | } else if (metricsLogging == "lttng") { |
892 | logger = new UMLTTNGLogger(); |
893 | } else { |
894 | - logger = new UMFileLogger(metricsLogging); |
895 | + logger = new UMFileLogger(QString::fromLocal8Bit(metricsLogging)); |
896 | } |
897 | if (logger->isOpen()) { |
898 | applicationMonitor->installLogger(logger); |
899 | @@ -321,7 +326,8 @@ |
900 | } |
901 | |
902 | // register performance monitor |
903 | - engine->rootContext()->setContextProperty("performanceMonitor", new UCPerformanceMonitor(engine)); |
904 | + engine->rootContext()->setContextProperty( |
905 | + QStringLiteral("performanceMonitor"), new UCPerformanceMonitor(engine)); |
906 | } |
907 | |
908 | void UbuntuToolkitModule::defineModule() |
909 | @@ -335,22 +341,25 @@ |
910 | ForwardedEvent::registerForwardedEvent(); |
911 | |
912 | // register parent type so that properties can get/ set it |
913 | - qmlRegisterUncreatableType<QAbstractItemModel>(uri, 1, 1, "QAbstractItemModel", "Not instantiable"); |
914 | + qmlRegisterUncreatableType<QAbstractItemModel>( |
915 | + uri, 1, 1, "QAbstractItemModel", notInstantiatable); |
916 | |
917 | // register 1.1 only API |
918 | qmlRegisterType<UCStyledItemBase, 1>(uri, 1, 1, "StyledItem"); |
919 | qmlRegisterType<QSortFilterProxyModelQML>(uri, 1, 1, "SortFilterModel"); |
920 | - qmlRegisterUncreatableType<FilterBehavior>(uri, 1, 1, "FilterBehavior", "Not instantiable"); |
921 | - qmlRegisterUncreatableType<SortBehavior>(uri, 1, 1, "SortBehavior", "Not instantiable"); |
922 | + qmlRegisterUncreatableType<FilterBehavior>(uri, 1, 1, "FilterBehavior", notInstantiatable); |
923 | + qmlRegisterUncreatableType<SortBehavior>(uri, 1, 1, "SortBehavior", notInstantiatable); |
924 | qmlRegisterType<UCServiceProperties, 1>(uri, 1, 1, "ServiceProperties"); |
925 | |
926 | // register 1.2 only API |
927 | qmlRegisterType<UCListItem>(uri, 1, 2, "ListItem"); |
928 | qmlRegisterType<UCListItemDivider>(); |
929 | - qmlRegisterUncreatableType<UCSwipeEvent>(uri, 1, 2, "SwipeEvent", "This is an event object."); |
930 | - qmlRegisterUncreatableType<UCDragEvent>(uri, 1, 2, "ListItemDrag", "This is an event object"); |
931 | + qmlRegisterUncreatableType<UCSwipeEvent>( |
932 | + uri, 1, 2, "SwipeEvent", QStringLiteral("This is an event object.")); |
933 | + qmlRegisterUncreatableType<UCDragEvent>( |
934 | + uri, 1, 2, "ListItemDrag", QStringLiteral("This is an event object")); |
935 | qmlRegisterType<UCListItemActions>(uri, 1, 2, "ListItemActions"); |
936 | - qmlRegisterUncreatableType<UCViewItemsAttached>(uri, 1, 2, "ViewItems", "Not instantiable"); |
937 | + qmlRegisterUncreatableType<UCViewItemsAttached>(uri, 1, 2, "ViewItems", notInstantiatable); |
938 | qmlRegisterType<UCUbuntuShape, 1>(uri, 1, 2, "UbuntuShape"); |
939 | qmlRegisterType<UCUbuntuShapeOverlay>(uri, 1, 2, "UbuntuShapeOverlay"); |
940 | |
941 | @@ -368,8 +377,9 @@ |
942 | qmlRegisterType<LiveTimer>(uri, 1, 3, "LiveTimer"); |
943 | qmlRegisterType<UCAbstractButton>(uri, 1, 3, "AbstractButton"); |
944 | qmlRegisterType<UCMargins>(); |
945 | - qmlRegisterUncreatableType<UCSlotsAttached>(uri, 1, 3, "SlotsAttached", "Not instantiable"); |
946 | - qmlRegisterUncreatableType<UCSlotsLayoutPadding>(uri, 1, 3, "SlotsLayoutPadding", "Not instantiable"); |
947 | + qmlRegisterUncreatableType<UCSlotsAttached>(uri, 1, 3, "SlotsAttached", notInstantiatable); |
948 | + qmlRegisterUncreatableType<UCSlotsLayoutPadding>( |
949 | + uri, 1, 3, "SlotsLayoutPadding", notInstantiatable); |
950 | qmlRegisterType<UCListItemLayout>(uri, 1, 3, "ListItemLayout"); |
951 | qmlRegisterType<UCHeader>(uri, 1, 3, "Header"); |
952 | qmlRegisterType<UCLabel>(uri, 1, 3, "Label"); |
953 | |
954 | === modified file 'src/UbuntuToolkit/ucaction.cpp' |
955 | --- src/UbuntuToolkit/ucaction.cpp 2016-09-09 18:16:57 +0000 |
956 | +++ src/UbuntuToolkit/ucaction.cpp 2016-09-15 14:53:25 +0000 |
957 | @@ -201,9 +201,9 @@ |
958 | // if we have a mnemonic, underscore it |
959 | if (!m_mnemonic.isEmpty()) { |
960 | |
961 | - QString mnemonic = "&" + m_mnemonic.toString().remove("Alt+"); |
962 | + QString mnemonic = "&" + m_mnemonic.toString().remove(QStringLiteral("Alt+")); |
963 | // patch special cases |
964 | - mnemonic.replace("Space", " "); |
965 | + mnemonic.replace(QStringLiteral("Space"), QStringLiteral(" ")); |
966 | int mnemonicIndex = m_text.indexOf(mnemonic); |
967 | if (mnemonicIndex < 0) { |
968 | // try lower case |
969 | @@ -311,7 +311,7 @@ |
970 | void UCAction::generateName() |
971 | { |
972 | static int id = 0; |
973 | - m_name = QString("unity-action-%1").arg(id++); |
974 | + m_name = QStringLiteral("unity-action-%1").arg(id++); |
975 | } |
976 | |
977 | /*! |
978 | |
979 | === modified file 'src/UbuntuToolkit/ucactionitem.cpp' |
980 | --- src/UbuntuToolkit/ucactionitem.cpp 2016-09-09 17:49:07 +0000 |
981 | +++ src/UbuntuToolkit/ucactionitem.cpp 2016-09-15 14:53:25 +0000 |
982 | @@ -281,7 +281,8 @@ |
983 | if (d->action) { |
984 | return d->action->m_iconSource; |
985 | } |
986 | - return !iconName().isEmpty() ? QUrl(QString("image://theme/%1").arg(iconName())) : QUrl(); |
987 | + return !iconName().isEmpty() ? |
988 | + QUrl(QStringLiteral("image://theme/%1").arg(iconName())) : QUrl(); |
989 | } |
990 | void UCActionItem::setIconSource(const QUrl &iconSource) |
991 | { |
992 | |
993 | === modified file 'src/UbuntuToolkit/ucargument.cpp' |
994 | --- src/UbuntuToolkit/ucargument.cpp 2016-07-07 07:21:48 +0000 |
995 | +++ src/UbuntuToolkit/ucargument.cpp 2016-09-15 14:53:25 +0000 |
996 | @@ -136,7 +136,7 @@ |
997 | |
998 | if (!m_name.isEmpty()) { |
999 | // for named argument: --name=value1 value2 |
1000 | - syntax.append("--"); |
1001 | + syntax.append(QStringLiteral("--")); |
1002 | syntax.append(m_name); |
1003 | |
1004 | if (!m_valueNames.empty()) { |
1005 | |
1006 | === modified file 'src/UbuntuToolkit/ucarguments.cpp' |
1007 | --- src/UbuntuToolkit/ucarguments.cpp 2016-09-09 17:49:07 +0000 |
1008 | +++ src/UbuntuToolkit/ucarguments.cpp 2016-09-15 14:53:25 +0000 |
1009 | @@ -405,9 +405,10 @@ |
1010 | |
1011 | // pass the values to the defaultArgument |
1012 | if (m_defaultArgument != NULL) { |
1013 | - if (argumentsValues.contains("")) { |
1014 | + if (argumentsValues.contains(QStringLiteral(""))) { |
1015 | int numberArguments = m_defaultArgument->valueNames().size(); |
1016 | - m_defaultArgument->setValues(argumentsValues.value("").mid(0, numberArguments)); |
1017 | + m_defaultArgument->setValues( |
1018 | + argumentsValues.value(QStringLiteral("")).mid(0, numberArguments)); |
1019 | if (numberArguments > 0) { |
1020 | // FIXME: not very elegant way to inform that values have changed |
1021 | Q_EMIT(defaultArgumentChanged()); |
1022 | @@ -447,7 +448,7 @@ |
1023 | // remove all prepended '-' |
1024 | rawArgument = rawArgument.split('-', QString::SkipEmptyParts).join('-'); |
1025 | // string after the '=' sign is a value for the argument |
1026 | - values = rawArgument.split("="); |
1027 | + values = rawArgument.split(QStringLiteral("=")); |
1028 | name = values.takeAt(0); |
1029 | |
1030 | if (expectedArguments.contains(name)) { |
1031 | @@ -456,7 +457,7 @@ |
1032 | argumentsValues.insert(name, values); |
1033 | } else { |
1034 | // default/unnamed argument |
1035 | - argumentsValues[""].append(rawArgument); |
1036 | + argumentsValues[QStringLiteral("")].append(rawArgument); |
1037 | } |
1038 | } |
1039 | |
1040 | @@ -486,9 +487,9 @@ |
1041 | } |
1042 | |
1043 | bool UCArguments::usageRequested(const QStringList& argumentNames) { |
1044 | - return argumentNames.contains("help") || |
1045 | - argumentNames.contains("h") || |
1046 | - argumentNames.contains("usage"); |
1047 | + return argumentNames.contains(QStringLiteral("help")) || |
1048 | + argumentNames.contains(QStringLiteral("h")) || |
1049 | + argumentNames.contains(QStringLiteral("usage")); |
1050 | } |
1051 | |
1052 | bool UCArguments::requiredArgumentsProvided(const QHash<QString, QStringList>& argumentsValues, QString& error) |
1053 | @@ -517,8 +518,8 @@ |
1054 | { |
1055 | // check if the required default argument was passed |
1056 | if (m_defaultArgument != NULL && m_defaultArgument->required() && |
1057 | - ((!argumentsValues.contains("") && m_defaultArgument->valueNames().size() > 0) |
1058 | - || (argumentsValues.value("").size() < m_defaultArgument->valueNames().size()))) { |
1059 | + ((!argumentsValues.contains(QStringLiteral("")) && m_defaultArgument->valueNames().size() > 0) |
1060 | + || (argumentsValues.value(QStringLiteral("")).size() < m_defaultArgument->valueNames().size()))) { |
1061 | UbuntuI18n* i18n = UbuntuI18n::instance(); |
1062 | error = i18n->tr("%1 is expecting additional arguments: %2").arg(m_applicationBinary).arg(m_defaultArgument->syntax()); |
1063 | return false; |
1064 | |
1065 | === modified file 'src/UbuntuToolkit/ucbottomedge.cpp' |
1066 | --- src/UbuntuToolkit/ucbottomedge.cpp 2016-09-09 17:49:07 +0000 |
1067 | +++ src/UbuntuToolkit/ucbottomedge.cpp 2016-09-15 14:53:25 +0000 |
1068 | @@ -187,11 +187,11 @@ |
1069 | } |
1070 | QRectF rect(stackedRegion->rect(boundingRect)); |
1071 | if (rect.contains(regionRect)) { |
1072 | - qmlInfo(region) << QString("Region at index %1 contains this region. This region will never activate.").arg(i); |
1073 | + qmlInfo(region) << QStringLiteral("Region at index %1 contains this region. This region will never activate.").arg(i); |
1074 | } else { |
1075 | QRectF intersect = regionRect.intersected(stackedRegion->rect(boundingRect)); |
1076 | if (!intersect.isNull()) { |
1077 | - qmlInfo(region) << QString("Region intersects the one from index %1 having from: %2 and to: %3") |
1078 | + qmlInfo(region) << QStringLiteral("Region intersects the one from index %1 having from: %2 and to: %3") |
1079 | .arg(i) |
1080 | .arg(UCBottomEdgeRegionPrivate::get(stackedRegion)->from) |
1081 | .arg(UCBottomEdgeRegionPrivate::get(stackedRegion)->to); |
1082 | @@ -391,7 +391,7 @@ |
1083 | |
1084 | void UCCollapseAction::activate() |
1085 | { |
1086 | - setIconName("down"); |
1087 | + setIconName(QStringLiteral("down")); |
1088 | } |
1089 | |
1090 | // inject collapse action into the content if the content has a PageHeader |
1091 | @@ -399,7 +399,7 @@ |
1092 | { |
1093 | // ugly, as it can be, as we don't have the PageHeader in cpp to detect the type |
1094 | UCHeader *header = currentContentItem ? currentContentItem->findChild<UCHeader*>() : Q_NULLPTR; |
1095 | - if (!header || !QuickUtils::inherits(header, "PageHeader")) { |
1096 | + if (!header || !QuickUtils::inherits(header, QStringLiteral("PageHeader"))) { |
1097 | return; |
1098 | } |
1099 | |
1100 | |
1101 | === modified file 'src/UbuntuToolkit/ucbottomedgehint.cpp' |
1102 | --- src/UbuntuToolkit/ucbottomedgehint.cpp 2016-09-09 17:49:07 +0000 |
1103 | +++ src/UbuntuToolkit/ucbottomedgehint.cpp 2016-09-15 14:53:25 +0000 |
1104 | @@ -59,7 +59,7 @@ |
1105 | * Therefore we simply set the style name default. Style loading will |
1106 | * happen during component completion. |
1107 | */ |
1108 | - styleDocument = "BottomEdgeHintStyle"; |
1109 | + styleDocument = QStringLiteral("BottomEdgeHintStyle"); |
1110 | |
1111 | // connect old stateChanged |
1112 | QObject::connect(q, &QQuickItem::stateChanged, q, &UCBottomEdgeHint::stateChanged); |
1113 | @@ -179,7 +179,7 @@ |
1114 | { |
1115 | UCActionItem::itemChange(change, data); |
1116 | if (change == ItemParentHasChanged) { |
1117 | - QQmlProperty bottomAnchors(this, "anchors.bottom", qmlContext(this)); |
1118 | + QQmlProperty bottomAnchors(this, QStringLiteral("anchors.bottom"), qmlContext(this)); |
1119 | if (data.item && !QQmlPropertyPrivate::binding(bottomAnchors)) { |
1120 | QQuickAnchors *anchors = QQuickItemPrivate::get(this)->anchors(); |
1121 | anchors->setBottom(QQuickItemPrivate::get(data.item)->bottom()); |
1122 | @@ -357,10 +357,10 @@ |
1123 | if (!style) { |
1124 | return; |
1125 | } |
1126 | - if (state == "Hidden") { |
1127 | + if (state == QStringLiteral("Hidden")) { |
1128 | setStatus(Hidden); |
1129 | } |
1130 | - if (state == "Visible") { |
1131 | + if (state == QStringLiteral("Visible")) { |
1132 | setStatus(Inactive); |
1133 | } |
1134 | } |
1135 | |
1136 | === modified file 'src/UbuntuToolkit/ucbottomedgeregion.cpp' |
1137 | --- src/UbuntuToolkit/ucbottomedgeregion.cpp 2016-09-09 17:49:07 +0000 |
1138 | +++ src/UbuntuToolkit/ucbottomedgeregion.cpp 2016-09-15 14:53:25 +0000 |
1139 | @@ -457,7 +457,7 @@ |
1140 | UCBottomEdgeRegionPrivate *d = UCBottomEdgeRegionPrivate::get(this); |
1141 | d->from = 0.0; |
1142 | d->to = 1.0; |
1143 | - setObjectName("default_BottomEdgeRegion"); |
1144 | + setObjectName(QStringLiteral("default_BottomEdgeRegion")); |
1145 | } |
1146 | |
1147 | bool DefaultRegion::canCommit(qreal dragRatio) |
1148 | |
1149 | === modified file 'src/UbuntuToolkit/ucdefaulttheme.cpp' |
1150 | --- src/UbuntuToolkit/ucdefaulttheme.cpp 2016-09-09 17:49:07 +0000 |
1151 | +++ src/UbuntuToolkit/ucdefaulttheme.cpp 2016-09-15 14:53:25 +0000 |
1152 | @@ -28,28 +28,27 @@ |
1153 | |
1154 | UT_NAMESPACE_BEGIN |
1155 | |
1156 | -/* |
1157 | - User theme settings are stored in $XDG_CONFIG_HOME/ubuntu-ui-toolkit/theme.ini file, which contains |
1158 | - the current global theme name. |
1159 | -*/ |
1160 | - |
1161 | -const QString SETTINGS_FILE_FORMAT("%1/ubuntu-ui-toolkit/theme.ini"); |
1162 | -const QString THEME_KEY("theme"); |
1163 | -const QString DEFAULT_THEME("Ubuntu.Components.Themes.Ambiance"); |
1164 | +// User theme settings are stored in |
1165 | +// $XDG_CONFIG_HOME/ubuntu-ui-toolkit/theme.ini, which contains the current |
1166 | +// global theme name. |
1167 | +static const QString settingsFileFormat = QStringLiteral("%1/ubuntu-ui-toolkit/theme.ini"); |
1168 | +static const QString defaultTheme = QStringLiteral("Ubuntu.Components.Themes.Ambiance"); |
1169 | +static const QString themeKey = QStringLiteral("theme"); |
1170 | |
1171 | UCDefaultTheme::UCDefaultTheme(QObject *parent) : |
1172 | QObject(parent), |
1173 | - m_settings(SETTINGS_FILE_FORMAT.arg(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)), QSettings::IniFormat) |
1174 | + m_settings(settingsFileFormat.arg( |
1175 | + QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)), QSettings::IniFormat) |
1176 | { |
1177 | // fundamental features rely on the default theme, so bail out if it's absent |
1178 | - if (!pathFromThemeName(DEFAULT_THEME).isValid()) { |
1179 | - qWarning() << "Mandatory default theme" << DEFAULT_THEME << "missing!"; |
1180 | + if (!pathFromThemeName(defaultTheme).isValid()) { |
1181 | + qWarning() << "Mandatory default theme" << defaultTheme << "missing!"; |
1182 | } |
1183 | |
1184 | // check if there is a theme settings file, if not, create one |
1185 | if (!QFile::exists(m_settings.fileName())) { |
1186 | // create the file by writing the default theme |
1187 | - m_settings.setValue(THEME_KEY, DEFAULT_THEME); |
1188 | + m_settings.setValue(themeKey, defaultTheme); |
1189 | m_settings.sync(); |
1190 | } |
1191 | |
1192 | @@ -63,7 +62,7 @@ |
1193 | m_settings.sync(); |
1194 | m_settingsFileWatcher.addPath(m_settings.fileName()); |
1195 | |
1196 | - QString themeName = m_settings.value(THEME_KEY).toString(); |
1197 | + QString themeName = m_settings.value(themeKey).toString(); |
1198 | if (themeName != m_themeName) { |
1199 | m_themeName = themeName; |
1200 | Q_EMIT themeNameChanged(); |
1201 | @@ -79,7 +78,7 @@ |
1202 | { |
1203 | if (themeName != m_themeName) { |
1204 | m_themeName = themeName; |
1205 | - m_settings.setValue(THEME_KEY, themeName); |
1206 | + m_settings.setValue(themeKey, themeName); |
1207 | Q_EMIT themeNameChanged(); |
1208 | } |
1209 | } |
1210 | |
1211 | === modified file 'src/UbuntuToolkit/ucdeprecatedtheme.cpp' |
1212 | --- src/UbuntuToolkit/ucdeprecatedtheme.cpp 2016-09-09 17:49:07 +0000 |
1213 | +++ src/UbuntuToolkit/ucdeprecatedtheme.cpp 2016-09-15 14:53:25 +0000 |
1214 | @@ -91,13 +91,14 @@ |
1215 | |
1216 | QQmlContext ctx(QQmlEngine::contextForObject(onItem)); |
1217 | // No warnings due to deprecated code used in the components themselves |
1218 | - if (ctx.baseUrl().toString().contains("/Ubuntu/Components/")) |
1219 | + if (ctx.baseUrl().toString().contains(QStringLiteral("/Ubuntu/Components/"))) |
1220 | return; |
1221 | // Warnings without a filename are not helpful |
1222 | if (ctx.baseUrl().isEmpty()) |
1223 | return; |
1224 | |
1225 | - QString noteId(QString("%1.%2").arg(note).arg(onItem->metaObject()->className())); |
1226 | + QString noteId(QStringLiteral("%1.%2").arg( |
1227 | + QString::fromLatin1(note)).arg(QString::fromLatin1(onItem->metaObject()->className()))); |
1228 | if (m_notes.contains(noteId)) |
1229 | return; |
1230 | QByteArray suppressNote = qgetenv("SUPPRESS_DEPRECATED_NOTE"); |
1231 | @@ -160,10 +161,10 @@ |
1232 | QQmlEngine::setContextForObject(oldTheme, context); |
1233 | |
1234 | // register deprecated Theme property |
1235 | - context->setContextProperty("Theme", oldTheme); |
1236 | + context->setContextProperty(QStringLiteral("Theme"), oldTheme); |
1237 | |
1238 | ContextPropertyChangeListener *themeChangeListener = |
1239 | - new ContextPropertyChangeListener(context, "Theme"); |
1240 | + new ContextPropertyChangeListener(context, QStringLiteral("Theme")); |
1241 | QObject::connect(oldTheme, SIGNAL(nameChanged()), |
1242 | themeChangeListener, SLOT(updateContextProperty())); |
1243 | } |
1244 | |
1245 | === modified file 'src/UbuntuToolkit/uchaptics.cpp' |
1246 | --- src/UbuntuToolkit/uchaptics.cpp 2016-09-09 17:49:07 +0000 |
1247 | +++ src/UbuntuToolkit/uchaptics.cpp 2016-09-15 14:53:25 +0000 |
1248 | @@ -159,7 +159,8 @@ |
1249 | return; |
1250 | } |
1251 | // load haptics proxy from file system/qrc |
1252 | - QUrl path(UbuntuToolkitModule::baseUrl(m_engine).resolved(QUrl("1.1/Haptics.qml"))); |
1253 | + QUrl path(UbuntuToolkitModule::baseUrl(m_engine).resolved( |
1254 | + QUrl(QStringLiteral("1.1/Haptics.qml")))); |
1255 | |
1256 | QQmlComponent component(m_engine, path, QQmlComponent::PreferSynchronous); |
1257 | if (!component.isError()) { |
1258 | |
1259 | === modified file 'src/UbuntuToolkit/ucheader.cpp' |
1260 | --- src/UbuntuToolkit/ucheader.cpp 2016-09-09 17:49:07 +0000 |
1261 | +++ src/UbuntuToolkit/ucheader.cpp 2016-09-15 14:53:25 +0000 |
1262 | @@ -89,7 +89,7 @@ |
1263 | { |
1264 | m_showHideAnimation->setParent(this); |
1265 | m_showHideAnimation->setTargetObject(this); |
1266 | - m_showHideAnimation->setProperty("y"); |
1267 | + m_showHideAnimation->setProperty(QStringLiteral("y")); |
1268 | m_showHideAnimation->setEasing(s_ubuntuAnimation->StandardEasing()); |
1269 | m_showHideAnimation->setDuration(s_ubuntuAnimation->BriskDuration()); |
1270 | |
1271 | |
1272 | === modified file 'src/UbuntuToolkit/uclabel.cpp' |
1273 | --- src/UbuntuToolkit/uclabel.cpp 2016-09-09 17:49:07 +0000 |
1274 | +++ src/UbuntuToolkit/uclabel.cpp 2016-09-15 14:53:25 +0000 |
1275 | @@ -135,7 +135,7 @@ |
1276 | |
1277 | updatePixelSize(); |
1278 | QFont defaultFont = q->font(); |
1279 | - defaultFont.setFamily("Ubuntu"); |
1280 | + defaultFont.setFamily(QStringLiteral("Ubuntu")); |
1281 | defaultFont.setWeight(QFont::Light); |
1282 | q->setFont(defaultFont); |
1283 | updateRenderType(); |
1284 | @@ -247,11 +247,13 @@ |
1285 | { |
1286 | Q_D(const UCLabel); |
1287 | if (d->flags & UCLabelPrivate::TextSizeSet) { |
1288 | - return ""; |
1289 | + return QStringLiteral(""); |
1290 | } |
1291 | - const char* const sizes[] = |
1292 | - { "xx-small", "x-small", "small", "medium", "large", "x-large" }; |
1293 | - return QString(sizes[d->textSize]); |
1294 | + static const QString sizes[] = { |
1295 | + QStringLiteral("xx-small"), QStringLiteral("x-small"), QStringLiteral("small"), |
1296 | + QStringLiteral("medium"), QStringLiteral("large"), QStringLiteral("x-large") |
1297 | + }; |
1298 | + return sizes[d->textSize]; |
1299 | } |
1300 | void UCLabel::setFontSize(const QString& fontSize) |
1301 | { |
1302 | |
1303 | === modified file 'src/UbuntuToolkit/uclistitem.cpp' |
1304 | --- src/UbuntuToolkit/uclistitem.cpp 2016-09-09 17:49:07 +0000 |
1305 | +++ src/UbuntuToolkit/uclistitem.cpp 2016-09-15 14:53:25 +0000 |
1306 | @@ -223,7 +223,7 @@ |
1307 | void UCListItemPrivate::init() |
1308 | { |
1309 | Q_Q(UCListItem); |
1310 | - contentItem->setObjectName("ListItemHolder"); |
1311 | + contentItem->setObjectName(QStringLiteral("ListItemHolder")); |
1312 | divider->init(q); |
1313 | QQml_setParent_noEvent(contentItem, q); |
1314 | contentItem->setParentItem(q); |
1315 | @@ -247,7 +247,7 @@ |
1316 | // watch grid unit size change and set implicit size |
1317 | QObject::connect(UCUnits::instance(), SIGNAL(gridUnitChanged()), q, SLOT(_q_updateSize())); |
1318 | _q_updateSize(); |
1319 | - styleDocument = "ListItemStyle"; |
1320 | + styleDocument = QStringLiteral("ListItemStyle"); |
1321 | |
1322 | // create selection object |
1323 | selection = new ListItemSelection(q); |
1324 | @@ -379,7 +379,7 @@ |
1325 | Q_Q(UCListItem); |
1326 | // is there an index context property? |
1327 | QQmlContext *context = qmlContext(q); |
1328 | - QVariant index = context->contextProperty("index"); |
1329 | + QVariant index = context->contextProperty(QStringLiteral("index")); |
1330 | return index.isValid() ? |
1331 | index.toInt() : |
1332 | (parentItem ? QQuickItemPrivate::get(parentItem)->childItems.indexOf(q) : -1); |
1333 | @@ -1074,7 +1074,7 @@ |
1334 | } |
1335 | // set the object name for testing purposes |
1336 | if (d->dragging()) { |
1337 | - setObjectName("DraggedListItem"); |
1338 | + setObjectName(QStringLiteral("DraggedListItem")); |
1339 | } |
1340 | } |
1341 | } |
1342 | |
1343 | === modified file 'src/UbuntuToolkit/uclistitemstyle.cpp' |
1344 | --- src/UbuntuToolkit/uclistitemstyle.cpp 2016-09-09 17:49:07 +0000 |
1345 | +++ src/UbuntuToolkit/uclistitemstyle.cpp 2016-09-15 14:53:25 +0000 |
1346 | @@ -56,10 +56,11 @@ |
1347 | // grab the animated context property and transfer it to the property |
1348 | QQuickItem::classBegin(); |
1349 | QQmlContext *context = qmlContext(this); |
1350 | - if (context && context->contextProperty("animated").isValid()) { |
1351 | - setAnimatePanels(context->contextProperty("animated").toBool()); |
1352 | + if (context && context->contextProperty(QStringLiteral("animated")).isValid()) { |
1353 | + setAnimatePanels(context->contextProperty(QStringLiteral("animated")).toBool()); |
1354 | } |
1355 | - m_listItem = qmlContext(this)->contextProperty("styledItem").value<UCListItem*>(); |
1356 | + m_listItem = qmlContext(this)->contextProperty( |
1357 | + QStringLiteral("styledItem")).value<UCListItem*>(); |
1358 | // get the flickable value |
1359 | if (m_listItem) { |
1360 | m_flickable = UCListItemPrivate::get(m_listItem)->flickable.data(); |
1361 | |
1362 | === modified file 'src/UbuntuToolkit/ucmainviewbase.cpp' |
1363 | --- src/UbuntuToolkit/ucmainviewbase.cpp 2016-09-09 18:16:57 +0000 |
1364 | +++ src/UbuntuToolkit/ucmainviewbase.cpp 2016-09-15 14:53:25 +0000 |
1365 | @@ -150,7 +150,7 @@ |
1366 | |
1367 | d->m_applicationName = applicationName; |
1368 | |
1369 | - if (applicationName != "") { |
1370 | + if (applicationName != QStringLiteral("")) { |
1371 | UbuntuI18n::instance()->setDomain(applicationName); |
1372 | UCApplication::instance()->setApplicationName(applicationName); |
1373 | } |
1374 | |
1375 | === modified file 'src/UbuntuToolkit/ucmousefilters.cpp' |
1376 | --- src/UbuntuToolkit/ucmousefilters.cpp 2016-09-09 17:49:07 +0000 |
1377 | +++ src/UbuntuToolkit/ucmousefilters.cpp 2016-09-15 14:53:25 +0000 |
1378 | @@ -400,7 +400,7 @@ |
1379 | |
1380 | UCMouse *UCMouse::qmlAttachedProperties(QObject *owner) |
1381 | { |
1382 | - return createAttachedFilter<UCMouse>(owner, "Mouse"); |
1383 | + return createAttachedFilter<UCMouse>(owner, QStringLiteral("Mouse")); |
1384 | } |
1385 | |
1386 | bool UCMouse::eventFilter(QObject *target, QEvent *event) |
1387 | @@ -1037,7 +1037,7 @@ |
1388 | |
1389 | UCInverseMouse *UCInverseMouse::qmlAttachedProperties(QObject *owner) |
1390 | { |
1391 | - return createAttachedFilter<UCInverseMouse>(owner, "InverseMouse"); |
1392 | + return createAttachedFilter<UCInverseMouse>(owner, QStringLiteral("InverseMouse")); |
1393 | } |
1394 | |
1395 | QMouseEvent UCInverseMouse::mapMouseToOwner(QObject *target, QMouseEvent* event) |
1396 | |
1397 | === modified file 'src/UbuntuToolkit/ucpagetreenode.cpp' |
1398 | --- src/UbuntuToolkit/ucpagetreenode.cpp 2016-09-09 17:49:07 +0000 |
1399 | +++ src/UbuntuToolkit/ucpagetreenode.cpp 2016-09-15 14:53:25 +0000 |
1400 | @@ -293,36 +293,36 @@ |
1401 | //print the current nodes properties we are interested in |
1402 | switch(QQmlEngine::objectOwnership(currNode)) { |
1403 | case QQmlEngine::CppOwnership: |
1404 | - PT_TRACE(QString("%1| ->ownership: ").arg(depth)<<"C++"); |
1405 | + PT_TRACE(QStringLiteral("%1| ->ownership: ").arg(depth)<<"C++"); |
1406 | break; |
1407 | case QQmlEngine::JavaScriptOwnership: |
1408 | - PT_TRACE(QString("%1| ->ownership: ").arg(depth)<<"JS"); |
1409 | + PT_TRACE(QStringLiteral("%1| ->ownership: ").arg(depth)<<"JS"); |
1410 | break; |
1411 | } |
1412 | |
1413 | - PT_TRACE(QString("%1| ->parentNode: ").arg(depth)<<currNode->parentNode()); |
1414 | - PT_TRACE(QString("%1| ->parent: ").arg(depth)<<currNode->parent()); |
1415 | - PT_TRACE(QString("%1| ->pageStack: ").arg(depth)<<currNode->pageStack() |
1416 | + PT_TRACE(QStringLiteral("%1| ->parentNode: ").arg(depth)<<currNode->parentNode()); |
1417 | + PT_TRACE(QStringLiteral("%1| ->parent: ").arg(depth)<<currNode->parent()); |
1418 | + PT_TRACE(QStringLiteral("%1| ->pageStack: ").arg(depth)<<currNode->pageStack() |
1419 | <<" custom:"<<((currNode->d_func()->m_flags & UCPageTreeNodePrivate::CustomPageStack) ? true : false)); |
1420 | - PT_TRACE(QString("%1| ->propagated: ").arg(depth)<<currNode->propagated() |
1421 | + PT_TRACE(QStringLiteral("%1| ->propagated: ").arg(depth)<<currNode->propagated() |
1422 | <<" custom:"<<((currNode->d_func()->m_flags & UCPageTreeNodePrivate::CustomPropagated) ? true : false)); |
1423 | - PT_TRACE(QString("%1| ->active: ").arg(depth)<<currNode->active() |
1424 | + PT_TRACE(QStringLiteral("%1| ->active: ").arg(depth)<<currNode->active() |
1425 | <<" custom:"<<((currNode->d_func()->m_flags & UCPageTreeNodePrivate::CustomActive) ? true : false)); |
1426 | - PT_TRACE(QString("%1| ->activeLeaf: ").arg(depth)<<currNode->activeLeafNode()); |
1427 | + PT_TRACE(QStringLiteral("%1| ->activeLeaf: ").arg(depth)<<currNode->activeLeafNode()); |
1428 | |
1429 | if (n.m_children.length()) |
1430 | - PT_TRACE(QString("%1| ->isLeaf: ").arg(depth)<<currNode->isLeaf()); |
1431 | + PT_TRACE(QStringLiteral("%1| ->isLeaf: ").arg(depth)<<currNode->isLeaf()); |
1432 | else |
1433 | - PT_TRACE(QString("%1└ ->isLeaf: ").arg(depth)<<currNode->isLeaf()); |
1434 | + PT_TRACE(QStringLiteral("%1└ ->isLeaf: ").arg(depth)<<currNode->isLeaf()); |
1435 | |
1436 | //print the current nodes children |
1437 | for (int i = 0; i < n.m_children.length(); i++) { |
1438 | QString subDepth = depth; |
1439 | |
1440 | if (i == n.m_children.length() - 1 ) //last |
1441 | - subDepth.append(" "); |
1442 | + subDepth.append(QStringLiteral(" ")); |
1443 | else |
1444 | - subDepth.append("| "); |
1445 | + subDepth.append(QStringLiteral("| ")); |
1446 | |
1447 | dumpNode(n.m_children.at(i), depth, subDepth, false); |
1448 | } |
1449 | |
1450 | === modified file 'src/UbuntuToolkit/ucqquickimageextension.cpp' |
1451 | --- src/UbuntuToolkit/ucqquickimageextension.cpp 2016-09-09 17:49:07 +0000 |
1452 | +++ src/UbuntuToolkit/ucqquickimageextension.cpp 2016-09-15 14:53:25 +0000 |
1453 | @@ -87,14 +87,15 @@ |
1454 | return; |
1455 | } |
1456 | |
1457 | - int separatorPosition = resolved.indexOf("/"); |
1458 | + int separatorPosition = resolved.indexOf(QStringLiteral("/")); |
1459 | QString scaleFactor = resolved.left(separatorPosition); |
1460 | QString selectedFilePath = resolved.mid(separatorPosition+1); |
1461 | - QString fragment(m_source.hasFragment() ? "#" + m_source.fragment() : QString("")); |
1462 | + QString fragment(m_source.hasFragment() ? "#" + m_source.fragment() : QStringLiteral("")); |
1463 | |
1464 | - if (scaleFactor == "1") { |
1465 | + if (scaleFactor == QStringLiteral("1")) { |
1466 | if (qFuzzyCompare(qGuiApp->devicePixelRatio(), (qreal)1.0) |
1467 | - || selectedFilePath.endsWith(".svg") || selectedFilePath.endsWith(".svgz")) { |
1468 | + || selectedFilePath.endsWith(QStringLiteral(".svg")) |
1469 | + || selectedFilePath.endsWith(QStringLiteral(".svgz"))) { |
1470 | // Take care to pass the original fragment |
1471 | QUrl selectedFileUrl(QUrl::fromLocalFile(selectedFilePath)); |
1472 | selectedFileUrl.setFragment(fragment); |
1473 | @@ -109,8 +110,8 @@ |
1474 | } |
1475 | } else { |
1476 | // Prepend "image://scaling" for the image to be loaded by UCScalingImageProvider. |
1477 | - if (!m_source.path().endsWith(".sci")) { |
1478 | - // Regular image file |
1479 | + if (!m_source.path().endsWith(QStringLiteral(".sci"))) { |
1480 | + // Regular image file |
1481 | m_image->setSource(QUrl("image://scaling/" + resolved + fragment)); |
1482 | } else { |
1483 | // .sci image file. Rewrite the .sci file into a temporary file. |
1484 | @@ -161,9 +162,9 @@ |
1485 | QTextStream sciStream(&sciFile); |
1486 | while (!sciStream.atEnd()) { |
1487 | QString line = sciStream.readLine(); |
1488 | - if (line.startsWith("border")) { |
1489 | + if (line.startsWith(QStringLiteral("border"))) { |
1490 | output << scaledBorder(line, scaleFactor) << endl; |
1491 | - } else if (line.startsWith("source")) { |
1492 | + } else if (line.startsWith(QStringLiteral("source"))) { |
1493 | output << scaledSource(line, sciFilePath, scaleFactor) << endl; |
1494 | } else { |
1495 | output << line << endl; |
1496 | @@ -178,7 +179,7 @@ |
1497 | QString UCQQuickImageExtension::scaledBorder(const QString &border, const QString &scaleFactor) |
1498 | { |
1499 | // Rewrite the border line with a scaled border value |
1500 | - QStringList parts = border.split(":"); |
1501 | + QStringList parts = border.split(QStringLiteral(":")); |
1502 | float scaledValue = parts[1].toFloat() * scaleFactor.toFloat(); |
1503 | return parts[0] + ": " + QString::number(qRound(scaledValue)); |
1504 | } |
1505 | @@ -200,7 +201,8 @@ |
1506 | source.remove(quoteLastIndex, 1); |
1507 | } |
1508 | |
1509 | - return source.replace("source: ", "source: " + QString(quote) + baseUrl).append(quote); |
1510 | + return source.replace( |
1511 | + QStringLiteral("source: "), "source: " + QString(quote) + baseUrl).append(quote); |
1512 | } |
1513 | |
1514 | UT_NAMESPACE_END |
1515 | |
1516 | === modified file 'src/UbuntuToolkit/ucscalingimageprovider.cpp' |
1517 | --- src/UbuntuToolkit/ucscalingimageprovider.cpp 2016-07-07 07:21:48 +0000 |
1518 | +++ src/UbuntuToolkit/ucscalingimageprovider.cpp 2016-09-15 14:53:25 +0000 |
1519 | @@ -40,9 +40,9 @@ |
1520 | |
1521 | QImage UCScalingImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) |
1522 | { |
1523 | - int separatorPosition = id.indexOf("/"); |
1524 | + int separatorPosition = id.indexOf(QStringLiteral("/")); |
1525 | float scaleFactor = id.left(separatorPosition).toFloat(); |
1526 | - int fragmentPosition = id.lastIndexOf("#"); |
1527 | + int fragmentPosition = id.lastIndexOf(QStringLiteral("#")); |
1528 | int pathLength = fragmentPosition > -1 ? fragmentPosition - separatorPosition - 1 : -1; |
1529 | QString path = id.mid(separatorPosition + 1, pathLength); |
1530 | QFile file(path); |
1531 | |
1532 | === modified file 'src/UbuntuToolkit/ucserviceproperties.cpp' |
1533 | --- src/UbuntuToolkit/ucserviceproperties.cpp 2016-09-09 17:49:07 +0000 |
1534 | +++ src/UbuntuToolkit/ucserviceproperties.cpp 2016-09-15 14:53:25 +0000 |
1535 | @@ -48,10 +48,10 @@ |
1536 | if (error.isEmpty()) { |
1537 | setError(message); |
1538 | } else { |
1539 | - setError(QString("%1\n%2").arg(error).arg(message)); |
1540 | + setError(QStringLiteral("%1\n%2").arg(error).arg(message)); |
1541 | } |
1542 | - QString env = qgetenv("SHOW_SERVICEPROPERTIES_WARNINGS"); |
1543 | - if (!env.isEmpty() && (env == "1" || env.toLower() == "true")) { |
1544 | + QString env = QString::fromLocal8Bit(qgetenv("SHOW_SERVICEPROPERTIES_WARNINGS")); |
1545 | + if (!env.isEmpty() && (env == QStringLiteral("1") || env.toLower() == QStringLiteral("true"))) { |
1546 | qmlInfo(q_ptr) << message; |
1547 | } |
1548 | } |
1549 | @@ -154,7 +154,7 @@ |
1550 | const QMetaObject *mo = metaObject(); |
1551 | for (int i = mo->propertyOffset(); i < mo->propertyCount(); i++) { |
1552 | const QMetaProperty prop = mo->property(i); |
1553 | - QString property(prop.name()); |
1554 | + QString property(QString::fromLatin1(prop.name())); |
1555 | |
1556 | // check the binding on the property and warn if there is one. |
1557 | QQmlProperty qmlProperty(this, property); |
1558 | |
1559 | === modified file 'src/UbuntuToolkit/ucstatesaver.cpp' |
1560 | --- src/UbuntuToolkit/ucstatesaver.cpp 2016-09-09 18:16:57 +0000 |
1561 | +++ src/UbuntuToolkit/ucstatesaver.cpp 2016-09-15 14:53:25 +0000 |
1562 | @@ -102,7 +102,7 @@ |
1563 | QObject *parent = m_attachee->parent(); |
1564 | |
1565 | // check whether we have an "index" context property defined |
1566 | - QVariant indexValue = attacheeContext->contextProperty("index"); |
1567 | + QVariant indexValue = attacheeContext->contextProperty(QStringLiteral("index")); |
1568 | if (indexValue.isValid() && (indexValue.type() == QVariant::Int)) { |
1569 | path += indexValue.toString(); |
1570 | } |
1571 | |
1572 | === modified file 'src/UbuntuToolkit/ucstyleditembase.cpp' |
1573 | --- src/UbuntuToolkit/ucstyleditembase.cpp 2016-09-09 17:49:07 +0000 |
1574 | +++ src/UbuntuToolkit/ucstyleditembase.cpp 2016-09-15 14:53:25 +0000 |
1575 | @@ -386,8 +386,8 @@ |
1576 | } |
1577 | styleItemContext = new QQmlContext(creationContext); |
1578 | styleItemContext->setContextObject(q); |
1579 | - styleItemContext->setContextProperty("styledItem", q); |
1580 | - styleItemContext->setContextProperty("animated", animated); |
1581 | + styleItemContext->setContextProperty(QStringLiteral("styledItem"), q); |
1582 | + styleItemContext->setContextProperty(QStringLiteral("animated"), animated); |
1583 | QObject *object = component->beginCreate(styleItemContext); |
1584 | if (!object) { |
1585 | delete styleItemContext; |
1586 | @@ -415,7 +415,7 @@ |
1587 | |
1588 | // make sure we reset the animated property to true |
1589 | if (!animated) { |
1590 | - styleItemContext->setContextProperty("animated", true); |
1591 | + styleItemContext->setContextProperty(QStringLiteral("animated"), true); |
1592 | } |
1593 | |
1594 | // set implicit size |
1595 | |
1596 | === modified file 'src/UbuntuToolkit/ucstylehints.cpp' |
1597 | --- src/UbuntuToolkit/ucstylehints.cpp 2016-09-09 17:49:07 +0000 |
1598 | +++ src/UbuntuToolkit/ucstylehints.cpp 2016-09-15 14:53:25 +0000 |
1599 | @@ -36,7 +36,8 @@ |
1600 | void UCStyleHintsParser::verifyProperty(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding) |
1601 | { |
1602 | if (binding->type == QV4::CompiledData::Binding::Type_Object) { |
1603 | - error(qmlUnit->objectAt(binding->value.objectIndex), "StyleHints does not support creating state-specific objects."); |
1604 | + error(qmlUnit->objectAt(binding->value.objectIndex), |
1605 | + QStringLiteral("StyleHints does not support creating state-specific objects.")); |
1606 | return; |
1607 | } |
1608 | |
1609 | @@ -52,8 +53,8 @@ |
1610 | |
1611 | // filter out signals! |
1612 | QString propertyName = qmlUnit->stringAt(binding->propertyNameIndex); |
1613 | - if (propertyName.startsWith("on") && propertyName.at(2).isUpper()) { |
1614 | - error(binding, "Signal properties are not supported."); |
1615 | + if (propertyName.startsWith(QStringLiteral("on")) && propertyName.at(2).isUpper()) { |
1616 | + error(binding, QStringLiteral("Signal properties are not supported.")); |
1617 | return; |
1618 | } |
1619 | } |
1620 | @@ -142,7 +143,7 @@ |
1621 | void UCStyleHints::propertyNotFound(const QString &styleName, const QString &property) |
1622 | { |
1623 | if (!m_ignoreUnknownProperties) { |
1624 | - qmlInfo(this) << QString("Style '%1' has no property called '%2'.").arg(styleName).arg(property); |
1625 | + qmlInfo(this) << QStringLiteral("Style '%1' has no property called '%2'.").arg(styleName).arg(property); |
1626 | } |
1627 | } |
1628 | |
1629 | |
1630 | === modified file 'src/UbuntuToolkit/uctheme.cpp' |
1631 | --- src/UbuntuToolkit/uctheme.cpp 2016-09-09 17:49:07 +0000 |
1632 | +++ src/UbuntuToolkit/uctheme.cpp 2016-09-15 14:53:25 +0000 |
1633 | @@ -46,8 +46,6 @@ |
1634 | |
1635 | UT_NAMESPACE_BEGIN |
1636 | |
1637 | -const char *CONTEXT_THEME = "theme"; |
1638 | -quint16 UCTheme::previousVersion = 0; |
1639 | /*! |
1640 | * \qmltype ThemeSettings |
1641 | * \instantiates UCTheme |
1642 | @@ -147,8 +145,11 @@ |
1643 | * \sa {StyledItem} |
1644 | */ |
1645 | |
1646 | -const QString THEME_FOLDER_FORMAT("%1/%2/"); |
1647 | -const QString PARENT_THEME_FILE("parent_theme"); |
1648 | +static const QString contextTheme = QStringLiteral("theme"); |
1649 | +static const QString themeFolderFormat = QStringLiteral("%1/%2/"); |
1650 | +static const QString parentThemeFile = QStringLiteral("parent_theme"); |
1651 | + |
1652 | +quint16 UCTheme::previousVersion = 0; |
1653 | |
1654 | static inline void updateBinding (QQmlAbstractBinding *binding) |
1655 | { |
1656 | @@ -177,7 +178,7 @@ |
1657 | } |
1658 | |
1659 | // append QML import path(s); we must explicitly support env override here |
1660 | - QString qml2ImportPath(getenv("QML2_IMPORT_PATH")); |
1661 | + const QString qml2ImportPath = QString::fromLocal8Bit(getenv("QML2_IMPORT_PATH")); |
1662 | if (!qml2ImportPath.isEmpty()) { |
1663 | pathList << qml2ImportPath.split(':', QString::SkipEmptyParts); |
1664 | } |
1665 | @@ -201,7 +202,7 @@ |
1666 | themeName.replace('.', '/'); |
1667 | QStringList pathList = themeSearchPath(); |
1668 | Q_FOREACH(const QString &path, pathList) { |
1669 | - QString themeFolder = THEME_FOLDER_FORMAT.arg(path, themeName); |
1670 | + QString themeFolder = themeFolderFormat.arg(path, themeName); |
1671 | // QUrl needs a trailing slash to understand it's a directory |
1672 | QString absoluteThemeFolder = QDir(themeFolder).absolutePath().append('/'); |
1673 | if (QDir(absoluteThemeFolder).exists()) { |
1674 | @@ -220,7 +221,7 @@ |
1675 | if (!themePath.isValid()) { |
1676 | qWarning() << qPrintable(QStringLiteral("Theme not found: \"%1\"").arg(themePath.name)); |
1677 | } else { |
1678 | - QFile file(themePath.path.resolved(PARENT_THEME_FILE).toLocalFile()); |
1679 | + QFile file(themePath.path.resolved(parentThemeFile).toLocalFile()); |
1680 | if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { |
1681 | QTextStream in(&file); |
1682 | parentTheme = in.readLine(); |
1683 | @@ -306,17 +307,18 @@ |
1684 | if (!palette) { |
1685 | return; |
1686 | } |
1687 | - const char *valueSetList[10] = {"normal", "selected"}; |
1688 | + const char* valueSetString[2] = { "normal", "selected" }; |
1689 | + const QString valueSetQString[2] = { QStringLiteral("normal"), QStringLiteral("selected") }; |
1690 | QQmlContext *configContext = qmlContext(palette); |
1691 | |
1692 | for (int i = 0; i < 2; i++) { |
1693 | - const char *valueSet = valueSetList[i]; |
1694 | - QObject *configObject = palette->property(valueSet).value<QObject*>(); |
1695 | + QObject *configObject = palette->property(valueSetString[i]).value<QObject*>(); |
1696 | const QMetaObject *mo = configObject->metaObject(); |
1697 | |
1698 | for (int ii = mo->propertyOffset(); ii < mo->propertyCount(); ii++) { |
1699 | const QMetaProperty prop = mo->property(ii); |
1700 | - QString propertyName = QString("%1.%2").arg(valueSet).arg(prop.name()); |
1701 | + QString propertyName = QStringLiteral("%1.%2") |
1702 | + .arg(valueSetQString[i]).arg(QString::fromLatin1(prop.name())); |
1703 | QQmlProperty configProperty(palette, propertyName, configContext); |
1704 | |
1705 | // first we need to check whether the property has a binding or not |
1706 | @@ -390,7 +392,7 @@ |
1707 | } |
1708 | UCTheme *theme = Q_NULLPTR; |
1709 | for (int tryCount = 0; !theme && tryCount < 2; tryCount++) { |
1710 | - theme = engine->rootContext()->contextProperty(CONTEXT_THEME).value<UCTheme*>(); |
1711 | + theme = engine->rootContext()->contextProperty(contextTheme).value<UCTheme*>(); |
1712 | if (!theme) { |
1713 | createDefaultTheme(engine); |
1714 | } |
1715 | @@ -403,11 +405,11 @@ |
1716 | // FIXME: move this into QPA |
1717 | // set the default font |
1718 | QFont defaultFont = QGuiApplication::font(); |
1719 | - defaultFont.setFamily("Ubuntu"); |
1720 | - defaultFont.setPixelSize(UCFontUtils::instance()->sizeToPixels("medium")); |
1721 | + defaultFont.setFamily(QStringLiteral("Ubuntu")); |
1722 | + defaultFont.setPixelSize(UCFontUtils::instance()->sizeToPixels(QStringLiteral("medium"))); |
1723 | defaultFont.setWeight(QFont::Light); |
1724 | QGuiApplication::setFont(defaultFont); |
1725 | - setObjectName("default"); |
1726 | + setObjectName(QStringLiteral("default")); |
1727 | } |
1728 | |
1729 | void UCTheme::init() |
1730 | @@ -584,7 +586,7 @@ |
1731 | if (config == m_palette || config == m_config.palette) { |
1732 | return; |
1733 | } |
1734 | - if (config && !QuickUtils::inherits(config, "Palette")) { |
1735 | + if (config && !QuickUtils::inherits(config, QStringLiteral("Palette"))) { |
1736 | qmlInfo(config) << QStringLiteral("Not a Palette component."); |
1737 | return; |
1738 | } |
1739 | @@ -671,13 +673,13 @@ |
1740 | |
1741 | UCTheme *theme = new UCTheme(engine); |
1742 | QQmlEngine::setContextForObject(theme, context); |
1743 | - context->setContextProperty(CONTEXT_THEME, theme); |
1744 | + context->setContextProperty(contextTheme, theme); |
1745 | |
1746 | theme->setupDefault(); |
1747 | theme->updateEnginePaths(engine); |
1748 | |
1749 | ContextPropertyChangeListener *listener = |
1750 | - new ContextPropertyChangeListener(context, CONTEXT_THEME); |
1751 | + new ContextPropertyChangeListener(context, contextTheme); |
1752 | QObject::connect(theme, &UCTheme::nameChanged, |
1753 | listener, &ContextPropertyChangeListener::updateContextProperty); |
1754 | } |
1755 | @@ -776,7 +778,8 @@ |
1756 | m_palette = 0; |
1757 | } |
1758 | // theme may not have palette defined |
1759 | - QUrl paletteUrl = styleUrl("Palette.qml", previousVersion ? previousVersion : LATEST_UITK_VERSION); |
1760 | + QUrl paletteUrl = styleUrl( |
1761 | + QStringLiteral("Palette.qml"), previousVersion ? previousVersion : LATEST_UITK_VERSION); |
1762 | if (paletteUrl.isValid()) { |
1763 | m_palette = QuickUtils::instance()->createQmlObject(paletteUrl, engine); |
1764 | if (m_palette) { |
1765 | |
1766 | === modified file 'src/UbuntuToolkit/ucthemingextension.cpp' |
1767 | --- src/UbuntuToolkit/ucthemingextension.cpp 2016-09-09 17:49:07 +0000 |
1768 | +++ src/UbuntuToolkit/ucthemingextension.cpp 2016-09-15 14:53:25 +0000 |
1769 | @@ -226,8 +226,9 @@ |
1770 | if (!theme) { |
1771 | theme = UCTheme::defaultTheme(qmlEngine(themedItem)); |
1772 | if (!theme) { |
1773 | - QString msg = QStringLiteral("The item %1 was created without a valid QML Engine. Styling will not be possible.") |
1774 | - .arg(themedItem->metaObject()->className()); |
1775 | + QString msg = QStringLiteral( |
1776 | + "The item %1 was created without a valid QML Engine. Styling will not be possible.") |
1777 | + .arg(QString::fromLatin1(themedItem->metaObject()->className())); |
1778 | qCritical().noquote() << msg; |
1779 | return Q_NULLPTR; |
1780 | } |
1781 | |
1782 | === modified file 'src/UbuntuToolkit/ucubuntushape.cpp' |
1783 | --- src/UbuntuToolkit/ucubuntushape.cpp 2016-09-09 17:49:07 +0000 |
1784 | +++ src/UbuntuToolkit/ucubuntushape.cpp 2016-09-15 14:53:25 +0000 |
1785 | @@ -411,7 +411,8 @@ |
1786 | */ |
1787 | void UCUbuntuShape::setRadius(const QString& radius) |
1788 | { |
1789 | - const Radius newRadius = (radius == "medium") ? Medium : ((radius == "large") ? Large : Small); |
1790 | + const Radius newRadius = (radius == QStringLiteral("medium")) ? |
1791 | + Medium : ((radius == QStringLiteral("large")) ? Large : Small); |
1792 | if (m_radius != newRadius) { |
1793 | m_radius = newRadius; |
1794 | update(); |
1795 | @@ -855,9 +856,9 @@ |
1796 | |
1797 | if (!(m_flags & AspectSet)) { |
1798 | quint8 aspect; |
1799 | - if (borderSource.endsWith(QString("radius_idle.sci"))) { |
1800 | + if (borderSource.endsWith(QStringLiteral("radius_idle.sci"))) { |
1801 | aspect = Inset; |
1802 | - } else if (borderSource.endsWith(QString("radius_pressed.sci"))) { |
1803 | + } else if (borderSource.endsWith(QStringLiteral("radius_pressed.sci"))) { |
1804 | aspect = Pressed; |
1805 | } else { |
1806 | aspect = Flat; |
1807 | |
1808 | === modified file 'src/UbuntuToolkit/ucubuntushape_p.h' |
1809 | --- src/UbuntuToolkit/ucubuntushape_p.h 2016-09-09 17:49:07 +0000 |
1810 | +++ src/UbuntuToolkit/ucubuntushape_p.h 2016-09-15 14:53:25 +0000 |
1811 | @@ -197,7 +197,8 @@ |
1812 | enum WrapMode { Transparent = 0, Repeat = 1 }; |
1813 | |
1814 | QString radius() const { |
1815 | - return (m_radius == Small) ? "small" : ((m_radius == Medium) ? "medium" : "large"); } |
1816 | + return (m_radius == Small) ? QStringLiteral("small") |
1817 | + : ((m_radius == Medium) ? QStringLiteral("medium") : QStringLiteral("large")); } |
1818 | void setRadius(const QString& radius); |
1819 | Aspect aspect() const { return (m_flags & AspectSet) ? static_cast<Aspect>(m_aspect) : Flat; } |
1820 | void setAspect(Aspect aspect); |
1821 | @@ -239,9 +240,10 @@ |
1822 | void setBackgroundMode(BackgroundMode backgroundMode); |
1823 | |
1824 | QString borderSource() const { |
1825 | - return (m_flags & AspectSet) ? "" : |
1826 | - ((m_aspect == Flat) ? "" : |
1827 | - ((m_aspect == Inset) ? "radius_idle.sci" : "radius_pressed.sci")); } |
1828 | + return (m_flags & AspectSet) ? QStringLiteral("") : |
1829 | + ((m_aspect == Flat) ? QStringLiteral("") : |
1830 | + ((m_aspect == Inset) ? QStringLiteral("radius_idle.sci") : |
1831 | + QStringLiteral("radius_pressed.sci"))); } |
1832 | void setBorderSource(const QString& borderSource); |
1833 | QColor color() const { |
1834 | return (m_flags & BackgroundApiSet) ? |
1835 | |
1836 | === modified file 'src/UbuntuToolkit/ucunits.cpp' |
1837 | --- src/UbuntuToolkit/ucunits.cpp 2016-09-09 17:49:07 +0000 |
1838 | +++ src/UbuntuToolkit/ucunits.cpp 2016-09-15 14:53:25 +0000 |
1839 | @@ -249,7 +249,7 @@ |
1840 | |
1841 | float UCUnits::gridUnitSuffixFromFileName(const QString& fileName) |
1842 | { |
1843 | - QRegularExpression re("^.*@([0-9]*).*$"); |
1844 | + QRegularExpression re(QStringLiteral("^.*@([0-9]*).*$")); |
1845 | QRegularExpressionMatch match = re.match(fileName); |
1846 | if (match.hasMatch()) { |
1847 | return match.captured(1).toFloat(); |
1848 | @@ -281,13 +281,13 @@ |
1849 | */ |
1850 | if (qGuiApp->allWindows().count() > 1) { |
1851 | if (window && window->screen() |
1852 | - && window->screen()->name().contains("LVDS")) { |
1853 | + && window->screen()->name().contains(QStringLiteral("LVDS"))) { |
1854 | return; |
1855 | } |
1856 | } |
1857 | |
1858 | auto nativeInterface = qGuiApp->platformNativeInterface(); |
1859 | - QVariant scaleVal = nativeInterface->windowProperty(window, "scale"); |
1860 | + QVariant scaleVal = nativeInterface->windowProperty(window, QStringLiteral("scale")); |
1861 | if (!scaleVal.isValid()) { |
1862 | return; |
1863 | } |
1864 | |
1865 | === modified file 'src/UbuntuToolkit/ucurihandler.cpp' |
1866 | --- src/UbuntuToolkit/ucurihandler.cpp 2016-09-09 17:49:07 +0000 |
1867 | +++ src/UbuntuToolkit/ucurihandler.cpp 2016-09-15 14:53:25 +0000 |
1868 | @@ -76,7 +76,7 @@ |
1869 | return; |
1870 | } |
1871 | char* path = nih_dbus_path(NULL, "", applicationId.constData(), NULL); |
1872 | - objectPath = QString(path); |
1873 | + objectPath = QString::fromLocal8Bit(path); |
1874 | nih_free(path); |
1875 | |
1876 | // Ensure handler is running on the main thread. |
1877 | |
1878 | === modified file 'src/UbuntuToolkit/unitythemeiconprovider.cpp' |
1879 | --- src/UbuntuToolkit/unitythemeiconprovider.cpp 2016-09-09 17:49:07 +0000 |
1880 | +++ src/UbuntuToolkit/unitythemeiconprovider.cpp 2016-09-15 14:53:25 +0000 |
1881 | @@ -96,10 +96,13 @@ |
1882 | if (QFileInfo::exists(filename)) { |
1883 | QSettings settings(filename, QSettings::IniFormat); |
1884 | |
1885 | - Q_FOREACH(const QString &path, settings.value("Icon Theme/Directories").toStringList()) { |
1886 | + const QStringList themeDirectories = |
1887 | + settings.value(QStringLiteral("Icon Theme/Directories")).toStringList(); |
1888 | + Q_FOREACH(const QString &path, themeDirectories) { |
1889 | Directory dir; |
1890 | dir.path = path; |
1891 | - dir.sizeType = sizeTypeFromString(settings.value(path + "/Type", "Fixed").toString()); |
1892 | + dir.sizeType = sizeTypeFromString( |
1893 | + settings.value(path + "/Type", QStringLiteral("Fixed")).toString()); |
1894 | dir.size = settings.value(path + "/Size", 32).toInt(); |
1895 | dir.minSize = settings.value(path + "/MinSize", 0).toInt(); |
1896 | dir.maxSize = settings.value(path + "/MaxSize", 0).toInt(); |
1897 | @@ -107,7 +110,9 @@ |
1898 | directories.append(dir); |
1899 | } |
1900 | |
1901 | - Q_FOREACH(const QString &name, settings.value("Icon Theme/Inherits").toStringList()) { |
1902 | + const QStringList themeInherits = |
1903 | + settings.value(QStringLiteral("Icon Theme/Inherits")).toStringList(); |
1904 | + Q_FOREACH(const QString &name, themeInherits) { |
1905 | if (name != QLatin1String("hicolor")) { |
1906 | parents.append(IconTheme::get(name)); |
1907 | } |
PASSED: Continuous integration, rev:2103 /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- devel/1171/ /jenkins. ubuntu. com/ubuntu- sdk/job/ generic- update- mp/6227/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-amd64- devel/1171/ rebuild
https:/