diff options
22 files changed, 39 insertions, 44 deletions
diff --git a/examples/ivicore/qface-ivi-addressbook/demo/main.cpp b/examples/ivicore/qface-ivi-addressbook/demo/main.cpp index 4e69799..a42ad17 100644 --- a/examples/ivicore/qface-ivi-addressbook/demo/main.cpp +++ b/examples/ivicore/qface-ivi-addressbook/demo/main.cpp @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) AddressBookModule::registerTypes(); AddressBookModule::registerQmlTypes(QLatin1String("IviAddressBook"), 1, 0); - QQuickStyle::setStyle("Material"); + QQuickStyle::setStyle(QStringLiteral("Material")); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); diff --git a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp index e554ef8..3f20ec9 100644 --- a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp +++ b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp @@ -54,7 +54,7 @@ //! [0] ProcessingService::ProcessingService() { - setLastMessage("Service online."); + setLastMessage(QStringLiteral("Service online.")); } int ProcessingService::process(const QString & data) diff --git a/src/ivicore/qiviabstractzonedfeature.cpp b/src/ivicore/qiviabstractzonedfeature.cpp index 92f32ad..5633322 100644 --- a/src/ivicore/qiviabstractzonedfeature.cpp +++ b/src/ivicore/qiviabstractzonedfeature.cpp @@ -140,11 +140,10 @@ QIviZonedFeatureInterface *QIviAbstractZonedFeature::backend(const QString &inte if (iface.isEmpty()) iface = interfaceName(); - if (auto *parentFeature = qobject_cast<QIviAbstractZonedFeature*>(parent())) { + if (auto *parentFeature = qobject_cast<QIviAbstractZonedFeature*>(parent())) return parentFeature->backend(); - } else if (QIviServiceObject *so = serviceObject()) { + else if (QIviServiceObject *so = serviceObject()) return qobject_cast<QIviZonedFeatureInterface*>(so->interfaceInstance(iface)); - } return nullptr; } diff --git a/src/ivicore/qivipendingreply.cpp b/src/ivicore/qivipendingreply.cpp index 44a9452..7b55559 100644 --- a/src/ivicore/qivipendingreply.cpp +++ b/src/ivicore/qivipendingreply.cpp @@ -79,7 +79,6 @@ QIviPendingReplyWatcherPrivate::QIviPendingReplyWatcherPrivate(int userType, QIv , m_type(userType) , m_resultAvailable(false) , m_success(false) - , m_data() , m_callbackEngine(nullptr) { @@ -409,7 +408,7 @@ QVariant QIviPendingReplyWatcher::value() const bool QIviPendingReplyWatcher::isValid() const { Q_D(const QIviPendingReplyWatcher); - return d->m_type == -1 ? false : true; + return d->m_type != -1; } /*! @@ -695,7 +694,6 @@ void QIviPendingReplyBase::then(const QJSValue &success, const QJSValue &failed) { if (m_watcher) m_watcher->then(success, failed); - return; } /*! @@ -722,7 +720,6 @@ void QIviPendingReplyBase::setSuccess(const QVariant &value) { if (m_watcher) m_watcher->setSuccess(value); - return; } /*! @@ -745,7 +742,6 @@ void QIviPendingReplyBase::setFailed() { if (m_watcher) m_watcher->setFailed(); - return; } /*! @@ -759,7 +755,6 @@ void QIviPendingReplyBase::setSuccessNoCheck(const QVariant &value) { if (m_watcher) m_watcher->d_func()->setSuccess(value); - return; } /*! diff --git a/src/ivicore/qivisearchandbrowsemodel.cpp b/src/ivicore/qivisearchandbrowsemodel.cpp index 1703a3b..8f7e5f7 100644 --- a/src/ivicore/qivisearchandbrowsemodel.cpp +++ b/src/ivicore/qivisearchandbrowsemodel.cpp @@ -111,7 +111,7 @@ void QIviSearchAndBrowseModelPrivate::parseQuery() setupFilter(queryTerm, orderTerms); } -void QIviSearchAndBrowseModelPrivate::setupFilter(QIviAbstractQueryTerm* queryTerm, QList<QIviOrderTerm> orderTerms) +void QIviSearchAndBrowseModelPrivate::setupFilter(QIviAbstractQueryTerm* queryTerm, const QList<QIviOrderTerm> &orderTerms) { //1. Tell the backend about the new filter (or none) QIviSearchAndBrowseModelInterface* backend = searchBackend(); diff --git a/src/ivicore/qivisearchandbrowsemodel_p.h b/src/ivicore/qivisearchandbrowsemodel_p.h index 118ab66..dd8442d 100644 --- a/src/ivicore/qivisearchandbrowsemodel_p.h +++ b/src/ivicore/qivisearchandbrowsemodel_p.h @@ -74,7 +74,7 @@ public: void resetModel() override; void parseQuery(); - void setupFilter(QIviAbstractQueryTerm* queryTerm, QList<QIviOrderTerm> orderTerms); + void setupFilter(QIviAbstractQueryTerm* queryTerm, const QList<QIviOrderTerm> &orderTerms); void checkType(); void clearToDefaults() override; void setCanGoBack(bool canGoBack); diff --git a/src/ivicore/qiviservicemanager.cpp b/src/ivicore/qiviservicemanager.cpp index 0adea74..1bb9aa6 100644 --- a/src/ivicore/qiviservicemanager.cpp +++ b/src/ivicore/qiviservicemanager.cpp @@ -76,7 +76,7 @@ namespace qtivi_helper { static const QString debugSuffixLiteral = QStringLiteral("_debug"); #endif - QString backendBaseName(const QString fileName) + QString backendBaseName(const QString &fileName) { if (fileName.isEmpty()) return fileName; @@ -285,9 +285,8 @@ void QIviServiceManagerPrivate::unloadAllBackends() if (backend->loader) { backend->loader->unload(); delete backend->loader; - } else if (backend->interfaceObject) { - delete backend->interfaceObject; } + delete backend->interfaceObject; delete backend->proxyServiceObject; i.remove(); diff --git a/src/ivicore/queryparser/qiviqueryterm.cpp b/src/ivicore/queryparser/qiviqueryterm.cpp index 6808130..8bd57cb 100644 --- a/src/ivicore/queryparser/qiviqueryterm.cpp +++ b/src/ivicore/queryparser/qiviqueryterm.cpp @@ -54,7 +54,8 @@ QIviScopeTermPrivate::QIviScopeTermPrivate() } QIviFilterTermPrivate::QIviFilterTermPrivate() - : m_negated(false) + : m_property(QIviFilterTerm::Equals) + , m_negated(false) { } diff --git a/src/ivimedia/qivimediadevicediscoverymodel.cpp b/src/ivimedia/qivimediadevicediscoverymodel.cpp index 44ea26b..2adab0e 100644 --- a/src/ivimedia/qivimediadevicediscoverymodel.cpp +++ b/src/ivimedia/qivimediadevicediscoverymodel.cpp @@ -73,7 +73,7 @@ void QIviMediaDeviceDiscoveryModelPrivate::clearToDefaults() m_deviceList.clear(); } -void QIviMediaDeviceDiscoveryModelPrivate::resetModel(const QList<QIviServiceObject*> deviceList) +void QIviMediaDeviceDiscoveryModelPrivate::resetModel(const QList<QIviServiceObject*> &deviceList) { Q_Q(QIviMediaDeviceDiscoveryModel); q->beginResetModel(); diff --git a/src/ivimedia/qivimediadevicediscoverymodel_p.h b/src/ivimedia/qivimediadevicediscoverymodel_p.h index 41fd50b..5c2b26d 100644 --- a/src/ivimedia/qivimediadevicediscoverymodel_p.h +++ b/src/ivimedia/qivimediadevicediscoverymodel_p.h @@ -68,7 +68,7 @@ public: virtual void initialize() override; void clearToDefaults(); - void resetModel(const QList<QIviServiceObject *> deviceList); + void resetModel(const QList<QIviServiceObject *> &deviceList); void onDeviceAdded(QIviServiceObject *device); void onDeviceRemoved(QIviServiceObject *device); diff --git a/src/ivimedia/qivitunerstation.cpp b/src/ivimedia/qivitunerstation.cpp index 85e8856..231cd34 100644 --- a/src/ivimedia/qivitunerstation.cpp +++ b/src/ivimedia/qivitunerstation.cpp @@ -241,7 +241,7 @@ QString QIviTunerStation::stationLogoUrl() const return d->m_stationLogoUrl; } -void QIviTunerStation::setStationLogoUrl(QString stationLogoUrl) +void QIviTunerStation::setStationLogoUrl(const QString &stationLogoUrl) { d->m_stationLogoUrl = stationLogoUrl; } @@ -251,7 +251,7 @@ QString QIviTunerStation::category() const return d->m_category; } -void QIviTunerStation::setCategory(QString category) +void QIviTunerStation::setCategory(const QString &category) { d->m_category = category; } @@ -261,7 +261,7 @@ QString QIviTunerStation::radioText() const return d->m_radioText; } -void QIviTunerStation::setRadioText(QString radioText) +void QIviTunerStation::setRadioText(const QString &radioText) { d->m_radioText = radioText; } diff --git a/src/ivimedia/qivitunerstation.h b/src/ivimedia/qivitunerstation.h index b121cec..fe0d863 100644 --- a/src/ivimedia/qivitunerstation.h +++ b/src/ivimedia/qivitunerstation.h @@ -73,11 +73,11 @@ public: virtual int frequency() const; virtual void setFrequency(int frequency); QString stationLogoUrl() const; - void setStationLogoUrl(QString stationLogoUrl); + void setStationLogoUrl(const QString &stationLogoUrl); QString category() const; - void setCategory(QString category); + void setCategory(const QString &category); QString radioText() const; - void setRadioText(QString radioText); + void setRadioText(const QString &radioText); int receptionQuality() const; void setReceptionQuality(int receptionQuality); virtual QString name() const override; diff --git a/src/plugins/ivimedia/media_simulator/searchandbrowsebackend.cpp b/src/plugins/ivimedia/media_simulator/searchandbrowsebackend.cpp index c4594cc..2105bab 100644 --- a/src/plugins/ivimedia/media_simulator/searchandbrowsebackend.cpp +++ b/src/plugins/ivimedia/media_simulator/searchandbrowsebackend.cpp @@ -148,7 +148,7 @@ void SearchAndBrowseBackend::fetchData(const QUuid &identifier, int start, int c if (!filterClause.isEmpty()) where_clauses.append(filterClause); - QString whereClause = where_clauses.join(" AND "); + QString whereClause = where_clauses.join(QStringLiteral(" AND ")); QString countQuery = QStringLiteral("SELECT count() FROM (SELECT %1 FROM track %2 %3)") .arg(columns, @@ -287,7 +287,7 @@ QString SearchAndBrowseBackend::createWhereClause(const QString &type, QIviAbstr switch (term->type()) { case QIviAbstractQueryTerm::ScopeTerm: { auto *scope = static_cast<QIviScopeTerm*>(term); - return QStringLiteral("%1 (%2)").arg(scope->isNegated() ? QStringLiteral("NOT") : QStringLiteral(""),createWhereClause(type, scope->term())); + return QStringLiteral("%1 (%2)").arg(scope->isNegated() ? QStringLiteral("NOT") : QString(), createWhereClause(type, scope->term())); } case QIviAbstractQueryTerm::ConjunctionTerm: { auto *conjunctionTerm = static_cast<QIviConjunctionTerm*>(term); diff --git a/src/plugins/ivimedia/media_simulator/usbbrowsebackend.cpp b/src/plugins/ivimedia/media_simulator/usbbrowsebackend.cpp index 6526ec0..0a9705a 100644 --- a/src/plugins/ivimedia/media_simulator/usbbrowsebackend.cpp +++ b/src/plugins/ivimedia/media_simulator/usbbrowsebackend.cpp @@ -100,7 +100,7 @@ void UsbBrowseBackend::fetchData(const QUuid &identifier, int start, int count) for (int i = start; i < infoList.count() && i < count; i++) { SearchAndBrowseItem item; - item.setType("file"); + item.setType(fileLiteral); item.setName(infoList.at(i).fileName()); list.append(QVariant::fromValue(item)); } diff --git a/src/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl b/src/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl index f43ec4e..f388a37 100644 --- a/src/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl +++ b/src/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl @@ -184,9 +184,9 @@ void {{class}}::initialize() {% endif %} {% if 'simulator' in features %} - mConnection = new QSimulatorConnection("{{interface}}", QVersionNumber(1, 0, 0)); - mConnection->addPeerInfo("versionInfo", "1.0.0"); - mConnection->addPeerInfo("name", "{{class}}"); + mConnection = new QSimulatorConnection(QStringLiteral("{{interface}}"), QVersionNumber(1, 0, 0)); + mConnection->addPeerInfo(QStringLiteral("versionInfo"), QStringLiteral("1.0.0")); + mConnection->addPeerInfo(QStringLiteral("name"), QStringLiteral("{{class}}")); QString hostname = QSimulatorConnection::simulatorHostName(false); if (hostname.isEmpty()) { qWarning() << "SIMULATOR_HOSTNAME environment variable not set! Disabling the QtSimulator connection"; diff --git a/src/tools/ivigenerator/templates_backend_simulator/plugin.cpp.tpl b/src/tools/ivigenerator/templates_backend_simulator/plugin.cpp.tpl index 446e07e..fe95f7e 100644 --- a/src/tools/ivigenerator/templates_backend_simulator/plugin.cpp.tpl +++ b/src/tools/ivigenerator/templates_backend_simulator/plugin.cpp.tpl @@ -63,7 +63,7 @@ extern {{class}}::InterfaceBuilder {{module.tags.config.interfaceBuilder}}; /*! \internal */ {{class}}::{{class}}(QObject *parent) : QObject(parent) - , m_simulationEngine(new QIviSimulationEngine("{{module.name|lower}}", this)) + , m_simulationEngine(new QIviSimulationEngine(QStringLiteral("{{module.name|lower}}"), this)) { {% if module.tags.config.interfaceBuilder %} m_interfaces = {{module.tags.config.interfaceBuilder}}(this); @@ -72,7 +72,7 @@ extern {{class}}::InterfaceBuilder {{module.tags.config.interfaceBuilder}}; {% for interface in module.interfaces %} auto {{interface}}Instance = new {{interface}}Backend(m_simulationEngine, this); //Register the types for the SimulationEngine - {{module.module_name|upperfirst}}Module::registerQmlTypes("{{module.name|lower}}.simulation", 1, 0); + {{module.module_name|upperfirst}}Module::registerQmlTypes(QStringLiteral("{{module.name|lower}}.simulation"), 1, 0); m_simulationEngine->registerSimulationInstance({{interface}}Instance, "{{module.name|lower}}.simulation", 1, 0, "{{interface}}Backend"); m_interfaces << {{interface}}Instance; {% endfor %} diff --git a/src/tools/ivigenerator/templates_frontend/modulefactory.cpp.tpl b/src/tools/ivigenerator/templates_frontend/modulefactory.cpp.tpl index ede6670..0ed1012 100644 --- a/src/tools/ivigenerator/templates_frontend/modulefactory.cpp.tpl +++ b/src/tools/ivigenerator/templates_frontend/modulefactory.cpp.tpl @@ -70,9 +70,9 @@ QT_BEGIN_NAMESPACE \sa {{struct}} */ -{{struct}} {{class}}::{{struct|lowerfirst}}({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %}) const +{{struct}} {{class}}::{{struct|lowerfirst}}({{struct.fields|map('parameter_type')|join(', ')}}) const { - return {{struct}}({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field}}{% endfor %}); + return {{struct}}({{struct.fields|join(', ')}}); } {% endfor %} diff --git a/src/tools/ivigenerator/templates_frontend/modulefactory.h.tpl b/src/tools/ivigenerator/templates_frontend/modulefactory.h.tpl index 02736d8..d69770c 100644 --- a/src/tools/ivigenerator/templates_frontend/modulefactory.h.tpl +++ b/src/tools/ivigenerator/templates_frontend/modulefactory.h.tpl @@ -64,7 +64,7 @@ public: {% for struct in module.structs %} Q_INVOKABLE {{struct}} {{struct|lowerfirst}}() const; - Q_INVOKABLE {{struct}} {{struct|lowerfirst}}({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %}) const; + Q_INVOKABLE {{struct}} {{struct|lowerfirst}}({{struct.fields|map('parameter_type')|join(', ')}}) const; {% endfor %} }; diff --git a/src/tools/ivigenerator/templates_frontend/struct.cpp.tpl b/src/tools/ivigenerator/templates_frontend/struct.cpp.tpl index 7670f36..e9f8063 100644 --- a/src/tools/ivigenerator/templates_frontend/struct.cpp.tpl +++ b/src/tools/ivigenerator/templates_frontend/struct.cpp.tpl @@ -51,8 +51,9 @@ class {{class}}Private : public QSharedData { public: {{class}}Private() + : QSharedData() {% for field in struct.fields %} - {% if loop.first %}:{% else %},{% endif %} m_{{field}}({{field|default_type_value}}) + , m_{{field}}({{field|default_type_value}}) {% endfor %} {} @@ -63,7 +64,7 @@ public: {% endfor %} {} - {{class}}Private({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %}) + {{class}}Private({{struct.fields|map('parameter_type')|join(', ')}}) : QSharedData() {% for field in struct.fields %} , m_{{field}}({{field}}) @@ -101,9 +102,9 @@ public: return *this; } -{{class}}::{{class}}({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %}) +{{class}}::{{class}}({{struct.fields|map('parameter_type')|join(', ')}}) : QIviStandardItem() - , d(new {{class}}Private({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field}}{% endfor %})) + , d(new {{class}}Private({{struct.fields|join(', ')}})) { } diff --git a/src/tools/ivigenerator/templates_frontend/struct.h.tpl b/src/tools/ivigenerator/templates_frontend/struct.h.tpl index da67518..e12e4a7 100644 --- a/src/tools/ivigenerator/templates_frontend/struct.h.tpl +++ b/src/tools/ivigenerator/templates_frontend/struct.h.tpl @@ -74,7 +74,7 @@ public: Q_INVOKABLE {{class}}(); Q_INVOKABLE {{class}}(const {{class}} &rhs); {{class}} &operator=(const {{class}} &); - Q_INVOKABLE {{class}}({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %}); + Q_INVOKABLE {{class}}({{struct.fields|map('parameter_type')|join(', ')}}); Q_INVOKABLE {{class}}(const QVariant &variant); ~{{class}}(); diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/echoservice.cpp b/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/echoservice.cpp index 0751330..ff15cb2 100644 --- a/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/echoservice.cpp +++ b/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/echoservice.cpp @@ -29,8 +29,8 @@ #include "echoservice.h" EchoService::EchoService() - :m_testCombo(Contact("Antti", 34, true), EchoModule::Friday), - m_testId("id123") + :m_testCombo(Contact(QStringLiteral("Antti"), 34, true), EchoModule::Friday), + m_testId(QStringLiteral("id123")) { } diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/server.cpp b/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/server.cpp index 38bc5fd..ba66258 100644 --- a/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/server.cpp +++ b/tests/auto/core/ivigenerator/projects/org-example-echo-qtro/server_qtro_test/server.cpp @@ -31,7 +31,7 @@ bool Server::start() { - return Core::instance()->host()->enableRemoting(&m_service, "org.example.echo.Echo"); + return Core::instance()->host()->enableRemoting(&m_service, QStringLiteral("org.example.echo.Echo")); } bool Server::stop() |