summaryrefslogtreecommitdiffstats
path: root/src/qdbus/qdbusviewer
diff options
context:
space:
mode:
Diffstat (limited to 'src/qdbus/qdbusviewer')
-rw-r--r--src/qdbus/qdbusviewer/CMakeLists.txt7
-rw-r--r--src/qdbus/qdbusviewer/logviewer.cpp29
-rw-r--r--src/qdbus/qdbusviewer/logviewer.h29
-rw-r--r--src/qdbus/qdbusviewer/main.cpp45
-rw-r--r--src/qdbus/qdbusviewer/mainwindow.cpp83
-rw-r--r--src/qdbus/qdbusviewer/mainwindow.h29
-rw-r--r--src/qdbus/qdbusviewer/propertydialog.cpp39
-rw-r--r--src/qdbus/qdbusviewer/propertydialog.h29
-rw-r--r--src/qdbus/qdbusviewer/qdbusmodel.cpp109
-rw-r--r--src/qdbus/qdbusviewer/qdbusmodel.h29
-rw-r--r--src/qdbus/qdbusviewer/qdbusviewer.cpp131
-rw-r--r--src/qdbus/qdbusviewer/qdbusviewer.h32
-rw-r--r--src/qdbus/qdbusviewer/qdbusviewer.qrc6
-rw-r--r--src/qdbus/qdbusviewer/servicesproxymodel.cpp35
-rw-r--r--src/qdbus/qdbusviewer/servicesproxymodel.h29
15 files changed, 182 insertions, 479 deletions
diff --git a/src/qdbus/qdbusviewer/CMakeLists.txt b/src/qdbus/qdbusviewer/CMakeLists.txt
index 79df486c8..9bd959bd1 100644
--- a/src/qdbus/qdbusviewer/CMakeLists.txt
+++ b/src/qdbus/qdbusviewer/CMakeLists.txt
@@ -1,4 +1,5 @@
-# Generated from qdbusviewer.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
#####################################################################
## qdbusviewer App:
@@ -13,7 +14,7 @@ qt_internal_add_app(qdbusviewer
qdbusmodel.cpp qdbusmodel.h
qdbusviewer.cpp qdbusviewer.h
servicesproxymodel.cpp servicesproxymodel.h
- PUBLIC_LIBRARIES
+ LIBRARIES
Qt::DBusPrivate
Qt::Gui
Qt::Widgets
@@ -49,11 +50,9 @@ if(APPLE)
target_sources(qdbusviewer PRIVATE
images/qdbusviewer.icns
)
- # special case end
# Set values to be replaced in the custom Info_mac.plist.
set(ICON "qdbusviewer.icns")
set(EXECUTABLE "qdbusviewer")
- # special case end
endif()
if(WIN32)
diff --git a/src/qdbus/qdbusviewer/logviewer.cpp b/src/qdbus/qdbusviewer/logviewer.cpp
index 7dd1ba6d6..f1fc43d15 100644
--- a/src/qdbus/qdbusviewer/logviewer.cpp
+++ b/src/qdbus/qdbusviewer/logviewer.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Tasuku Suzuki <stasuku@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Tasuku Suzuki <stasuku@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "logviewer.h"
diff --git a/src/qdbus/qdbusviewer/logviewer.h b/src/qdbus/qdbusviewer/logviewer.h
index 4f56387bb..b9f18b0a5 100644
--- a/src/qdbus/qdbusviewer/logviewer.h
+++ b/src/qdbus/qdbusviewer/logviewer.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 Tasuku Suzuki <stasuku@gmail.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 Tasuku Suzuki <stasuku@gmail.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef LOGVIEWER_H
#define LOGVIEWER_H
diff --git a/src/qdbus/qdbusviewer/main.cpp b/src/qdbus/qdbusviewer/main.cpp
index 9040c8375..4fd24b2d9 100644
--- a/src/qdbus/qdbusviewer/main.cpp
+++ b/src/qdbus/qdbusviewer/main.cpp
@@ -1,56 +1,31 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include <QtWidgets/qapplication.h>
#include "mainwindow.h"
-#include <stdio.h>
+using namespace Qt::StringLiterals;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- QCoreApplication::setOrganizationName(QStringLiteral("QtProject"));
- QCoreApplication::setApplicationName(QStringLiteral("QDBusViewer"));
+ QCoreApplication::setOrganizationName(u"QtProject"_s);
+ QCoreApplication::setApplicationName(u"QDBusViewer"_s);
MainWindow mw;
-#if !defined(Q_OS_OSX) && !defined(Q_OS_WIN)
- app.setWindowIcon(QIcon(QLatin1String(":/qt-project.org/qdbusviewer/images/qdbusviewer.png")));
+#if !defined(Q_OS_MACOS) && !defined(Q_OS_WIN)
+ app.setWindowIcon(QIcon(":/qt-project.org/qdbusviewer/images/qdbusviewer.png"_L1));
#endif
-#ifdef Q_OS_OSX
+#ifdef Q_OS_MACOS
mw.setWindowTitle(qApp->translate("QtDBusViewer", "Qt D-Bus Viewer"));
#endif
QStringList args = app.arguments();
- while (args.count()) {
+ while (args.size()) {
QString arg = args.takeFirst();
- if (arg == QLatin1String("--bus"))
+ if (arg == "--bus"_L1)
mw.addCustomBusTab(args.takeFirst());
}
diff --git a/src/qdbus/qdbusviewer/mainwindow.cpp b/src/qdbus/qdbusviewer/mainwindow.cpp
index 7eb83309a..ef75dbeb7 100644
--- a/src/qdbus/qdbusviewer/mainwindow.cpp
+++ b/src/qdbus/qdbusviewer/mainwindow.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "mainwindow.h"
@@ -40,8 +15,11 @@
#include <QtDBus/QDBusConnection>
#include <QtCore/QSettings>
+using namespace Qt::StringLiterals;
+
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
+ , systemBusViewer(nullptr)
{
QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
QAction *quitAction = fileMenu->addAction(tr("&Quit"), this, &QWidget::close);
@@ -61,9 +39,13 @@ MainWindow::MainWindow(QWidget *parent)
setCentralWidget(tabWidget);
sessionBusViewer = new QDBusViewer(QDBusConnection::sessionBus());
- systemBusViewer = new QDBusViewer(QDBusConnection::systemBus());
tabWidget->addTab(sessionBusViewer, tr("Session Bus"));
- tabWidget->addTab(systemBusViewer, tr("System Bus"));
+
+ QDBusConnection connection = QDBusConnection::systemBus();
+ if (connection.isConnected()) {
+ systemBusViewer = new QDBusViewer(connection);
+ tabWidget->addTab(systemBusViewer, tr("System Bus"));
+ }
restoreSettings();
}
@@ -86,18 +68,29 @@ void MainWindow::about()
{
QMessageBox box(this);
- box.setText(QString::fromLatin1("<center><img src=\":/qt-project.org/qdbusviewer/images/qdbusviewer-128.png\">"
- "<h3>%1</h3>"
- "<p>Version %2</p></center>"
- "<p>Copyright (C) %3 The Qt Company Ltd.</p>")
- .arg(tr("D-Bus Viewer"), QLatin1String(QT_VERSION_STR), QStringLiteral("2021")));
+ box.setText(tr("<center><img src=\":/qt-project.org/qdbusviewer/images/qdbusviewer-128.png\">"
+ "<h3>%1</h3>"
+ "<p>Version %2</p></center>"
+ "<p>Copyright (C) %3 The Qt Company Ltd.</p>")
+ .arg(tr("D-Bus Viewer"), QLatin1String(QT_VERSION_STR), QString()));
box.setWindowTitle(tr("D-Bus Viewer"));
box.exec();
}
-static inline QString windowGeometryKey() { return QStringLiteral("WindowGeometry"); }
-static inline QString sessionTabGroup() { return QStringLiteral("SessionTab"); }
-static inline QString systemTabGroup() { return QStringLiteral("SystemTab"); }
+static inline QString windowGeometryKey()
+{
+ return u"WindowGeometry"_s;
+}
+
+static inline QString sessionTabGroup()
+{
+ return u"SessionTab"_s;
+}
+
+static inline QString systemTabGroup()
+{
+ return u"SystemTab"_s;
+}
void MainWindow::saveSettings()
{
@@ -109,9 +102,11 @@ void MainWindow::saveSettings()
sessionBusViewer->saveState(&settings);
settings.endGroup();
- settings.beginGroup(systemTabGroup());
- systemBusViewer->saveState(&settings);
- settings.endGroup();
+ if (systemBusViewer) {
+ settings.beginGroup(systemTabGroup());
+ systemBusViewer->saveState(&settings);
+ settings.endGroup();
+ }
}
void MainWindow::restoreSettings()
@@ -124,7 +119,9 @@ void MainWindow::restoreSettings()
sessionBusViewer->restoreState(&settings);
settings.endGroup();
- settings.beginGroup(systemTabGroup());
- systemBusViewer->restoreState(&settings);
- settings.endGroup();
+ if (systemBusViewer) {
+ settings.beginGroup(systemTabGroup());
+ systemBusViewer->restoreState(&settings);
+ settings.endGroup();
+ }
}
diff --git a/src/qdbus/qdbusviewer/mainwindow.h b/src/qdbus/qdbusviewer/mainwindow.h
index d01027c5e..5159881f2 100644
--- a/src/qdbus/qdbusviewer/mainwindow.h
+++ b/src/qdbus/qdbusviewer/mainwindow.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
diff --git a/src/qdbus/qdbusviewer/propertydialog.cpp b/src/qdbus/qdbusviewer/propertydialog.cpp
index fb3949379..5fbfd94bc 100644
--- a/src/qdbus/qdbusviewer/propertydialog.cpp
+++ b/src/qdbus/qdbusviewer/propertydialog.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "propertydialog.h"
@@ -32,6 +7,8 @@
#include <QLayout>
#include <QDebug>
+using namespace Qt::StringLiterals;
+
PropertyDialog::PropertyDialog(QWidget *parent, Qt::WindowFlags f)
: QDialog(parent, f)
{
@@ -41,7 +18,7 @@ PropertyDialog::PropertyDialog(QWidget *parent, Qt::WindowFlags f)
buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
propertyTable->setColumnCount(2);
- const QStringList labels = QStringList() << QLatin1String("Name") << QLatin1String("Value");
+ const QStringList labels = QStringList() << tr("Name") << tr("Value");
propertyTable->setHorizontalHeaderLabels(labels);
propertyTable->horizontalHeader()->setStretchLastSection(true);
propertyTable->setEditTriggers(QAbstractItemView::AllEditTriggers);
@@ -67,10 +44,10 @@ void PropertyDialog::addProperty(const QString &aname, int type)
QString name = aname;
if (name.isEmpty())
- name = QLatin1String("argument ") + QString::number(rowCount + 1);
- name += QLatin1String(" (");
+ name = tr("argument %1").arg(rowCount + 1);
+ name += " ("_L1;
name += QLatin1String(QMetaType(type).name());
- name += QLatin1String(")");
+ name += ")"_L1;
QTableWidgetItem *nameItem = new QTableWidgetItem(name);
nameItem->setFlags(nameItem->flags() &
~(Qt::ItemIsEditable | Qt::ItemIsSelectable));
diff --git a/src/qdbus/qdbusviewer/propertydialog.h b/src/qdbus/qdbusviewer/propertydialog.h
index 086a3e130..84381b220 100644
--- a/src/qdbus/qdbusviewer/propertydialog.h
+++ b/src/qdbus/qdbusviewer/propertydialog.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef PROPERTYDIALOG_H
#define PROPERTYDIALOG_H
diff --git a/src/qdbus/qdbusviewer/qdbusmodel.cpp b/src/qdbus/qdbusviewer/qdbusmodel.cpp
index 8fdc679b1..97c0094e6 100644
--- a/src/qdbus/qdbusviewer/qdbusmodel.cpp
+++ b/src/qdbus/qdbusviewer/qdbusmodel.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdbusmodel.h"
@@ -37,6 +12,8 @@
#include <QtXml/QDomDocument>
+using namespace Qt::StringLiterals;
+
struct QDBusItem
{
inline QDBusItem(QDBusModel::Type aType, const QString &aName, QDBusItem *aParent = 0)
@@ -57,7 +34,7 @@ struct QDBusItem
s.prepend(item->name);
item = item->parent;
}
- if (s.length() > 1)
+ if (s.size() > 1)
s.chop(1); // remove tailing slash
return s;
}
@@ -75,29 +52,34 @@ QDomDocument QDBusModel::introspect(const QString &path)
{
QDomDocument doc;
- QDBusInterface iface(service, path, QLatin1String("org.freedesktop.DBus.Introspectable"), c);
+ QDBusInterface iface(service, path, "org.freedesktop.DBus.Introspectable"_L1, c);
if (!iface.isValid()) {
QDBusError err(iface.lastError());
- emit busError(QString::fromLatin1("Cannot introspect object %1 at %2:\n %3 (%4)\n").arg(path).arg(
- service).arg(err.name()).arg(err.message()));
+ emit busError(tr("Cannot introspect object %1 at %2:\n %3 (%4)\n")
+ .arg(path)
+ .arg(service)
+ .arg(err.name())
+ .arg(err.message()));
return doc;
}
- QDBusReply<QString> xml = iface.call(QLatin1String("Introspect"));
+ QDBusReply<QString> xml = iface.call("Introspect"_L1);
if (!xml.isValid()) {
QDBusError err(xml.error());
if (err.isValid()) {
- emit busError(QString::fromLatin1("Call to object %1 at %2:\n %3 (%4) failed\n").arg(
- path).arg(service).arg(err.name()).arg(err.message()));
+ emit busError(tr("Call to object %1 at %2:\n %3 (%4) failed\n")
+ .arg(path)
+ .arg(service)
+ .arg(err.name())
+ .arg(err.message()));
} else {
- emit busError(QString::fromLatin1("Invalid XML received from object %1 at %2\n").arg(
- path).arg(service));
+ emit busError(tr("Invalid XML received from object %1 at %2\n").arg(path).arg(service));
}
return doc;
}
- doc.setContent(xml);
+ doc.setContent(xml.value());
return doc;
}
@@ -108,25 +90,22 @@ void QDBusModel::addMethods(QDBusItem *parent, const QDomElement &iface)
QDomElement child = iface.firstChildElement();
while (!child.isNull()) {
QDBusItem *item = nullptr;
- if (child.tagName() == QLatin1String("method")) {
- item = new QDBusItem(QDBusModel::MethodItem,
- child.attribute(QLatin1String("name")), parent);
- item->caption = QLatin1String("Method: ") + item->name;
+ if (child.tagName() == "method"_L1) {
+ item = new QDBusItem(QDBusModel::MethodItem, child.attribute("name"_L1), parent);
+ item->caption = tr("Method: %1").arg(item->name);
//get "type" from <arg> where "direction" is "in"
QDomElement n = child.firstChildElement();
while (!n.isNull()) {
- if (n.attribute(QLatin1String("direction")) == QLatin1String("in"))
- item->typeSignature += n.attribute(QLatin1String("type"));
+ if (n.attribute("direction"_L1) == "in"_L1)
+ item->typeSignature += n.attribute("type"_L1);
n = n.nextSiblingElement();
}
- } else if (child.tagName() == QLatin1String("signal")) {
- item = new QDBusItem(QDBusModel::SignalItem,
- child.attribute(QLatin1String("name")), parent);
- item->caption = QLatin1String("Signal: ") + item->name;
- } else if (child.tagName() == QLatin1String("property")) {
- item = new QDBusItem(QDBusModel::PropertyItem,
- child.attribute(QLatin1String("name")), parent);
- item->caption = QLatin1String("Property: ") + item->name;
+ } else if (child.tagName() == "signal"_L1) {
+ item = new QDBusItem(QDBusModel::SignalItem, child.attribute("name"_L1), parent);
+ item->caption = tr("Signal: %1").arg(item->name);
+ } else if (child.tagName() == "property"_L1) {
+ item = new QDBusItem(QDBusModel::PropertyItem, child.attribute("name"_L1), parent);
+ item->caption = tr("Property: %1").arg(item->name);
} else {
qDebug() << "addMethods: unknown tag:" << child.tagName();
}
@@ -147,15 +126,15 @@ void QDBusModel::addPath(QDBusItem *parent)
QDomElement node = doc.documentElement();
QDomElement child = node.firstChildElement();
while (!child.isNull()) {
- if (child.tagName() == QLatin1String("node")) {
+ if (child.tagName() == "node"_L1) {
QDBusItem *item = new QDBusItem(QDBusModel::PathItem,
- child.attribute(QLatin1String("name")) + QLatin1Char('/'), parent);
+ child.attribute("name"_L1) + '/'_L1, parent);
parent->children.append(item);
addMethods(item, child);
- } else if (child.tagName() == QLatin1String("interface")) {
- QDBusItem *item = new QDBusItem(QDBusModel::InterfaceItem,
- child.attribute(QLatin1String("name")), parent);
+ } else if (child.tagName() == "interface"_L1) {
+ QDBusItem *item =
+ new QDBusItem(QDBusModel::InterfaceItem, child.attribute("name"_L1), parent);
parent->children.append(item);
addMethods(item, child);
@@ -171,7 +150,7 @@ void QDBusModel::addPath(QDBusItem *parent)
QDBusModel::QDBusModel(const QString &aService, const QDBusConnection &connection)
: service(aService), c(connection), root(0)
{
- root = new QDBusItem(QDBusModel::PathItem, QLatin1String("/"));
+ root = new QDBusItem(QDBusModel::PathItem, "/"_L1);
}
QDBusModel::~QDBusModel()
@@ -185,7 +164,7 @@ QModelIndex QDBusModel::index(int row, int column, const QModelIndex &parent) co
if (!item)
item = root;
- if (column != 0 || row < 0 || row >= item->children.count())
+ if (column != 0 || row < 0 || row >= item->children.size())
return QModelIndex();
return createIndex(row, 0, item->children.at(row));
@@ -208,7 +187,7 @@ int QDBusModel::rowCount(const QModelIndex &parent) const
if (!item->isPrefetched)
const_cast<QDBusModel *>(this)->addPath(item);
- return item->children.count();
+ return item->children.size();
}
int QDBusModel::columnCount(const QModelIndex &) const
@@ -233,7 +212,7 @@ QVariant QDBusModel::headerData(int section, Qt::Orientation orientation, int ro
if (role != Qt::DisplayRole || orientation == Qt::Vertical || section != 0)
return QVariant();
- return QLatin1String("Methods");
+ return tr("Methods");
}
QDBusModel::Type QDBusModel::itemType(const QModelIndex &index) const
@@ -254,7 +233,7 @@ void QDBusModel::refresh(const QModelIndex &aIndex)
item = root;
if (!item->children.isEmpty()) {
- beginRemoveRows(index, 0, item->children.count() - 1);
+ beginRemoveRows(index, 0, item->children.size() - 1);
qDeleteAll(item->children);
item->children.clear();
endRemoveRows();
@@ -262,7 +241,7 @@ void QDBusModel::refresh(const QModelIndex &aIndex)
addPath(item);
if (!item->children.isEmpty()) {
- beginInsertRows(index, 0, item->children.count() - 1);
+ beginInsertRows(index, 0, item->children.size() - 1);
endInsertRows();
}
}
@@ -307,16 +286,16 @@ QString QDBusModel::dBusTypeSignature(const QModelIndex &index) const
QModelIndex QDBusModel::findObject(const QDBusObjectPath &objectPath)
{
- QStringList path = objectPath.path().split(QLatin1Char('/'), Qt::SkipEmptyParts);
+ QStringList path = objectPath.path().split('/'_L1, Qt::SkipEmptyParts);
QDBusItem *item = root;
int childIdx = -1;
while (item && !path.isEmpty()) {
- const QString branch = path.takeFirst() + QLatin1Char('/');
+ const QString branch = path.takeFirst() + '/'_L1;
childIdx = -1;
// do a linear search over all the children
- for (int i = 0; i < item->children.count(); ++i) {
+ for (int i = 0; i < item->children.size(); ++i) {
QDBusItem *child = item->children.at(i);
if (child->type == PathItem && child->name == branch) {
item = child;
diff --git a/src/qdbus/qdbusviewer/qdbusmodel.h b/src/qdbus/qdbusviewer/qdbusmodel.h
index 44b9fdad8..22ec6fc8c 100644
--- a/src/qdbus/qdbusviewer/qdbusmodel.h
+++ b/src/qdbus/qdbusviewer/qdbusmodel.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDBUSMODEL_H
#define QDBUSMODEL_H
diff --git a/src/qdbus/qdbusviewer/qdbusviewer.cpp b/src/qdbus/qdbusviewer/qdbusviewer.cpp
index d278baa93..5bfb0a4c7 100644
--- a/src/qdbus/qdbusviewer/qdbusviewer.cpp
+++ b/src/qdbus/qdbusviewer/qdbusviewer.cpp
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "qdbusviewer.h"
#include "qdbusmodel.h"
@@ -45,6 +20,7 @@
#include <QtDBus/QDBusConnectionInterface>
#include <QtDBus/QDBusInterface>
#include <QtDBus/QDBusMetaType>
+#include <QtDBus/QDBusServiceWatcher>
#include <QtGui/QAction>
#include <QtGui/QKeyEvent>
@@ -56,6 +32,8 @@
#include <private/qdbusutil_p.h>
+using namespace Qt::StringLiterals;
+
class QDBusViewModel: public QDBusModel
{
public:
@@ -87,10 +65,8 @@ public:
}
};
-QDBusViewer::QDBusViewer(const QDBusConnection &connection, QWidget *parent) :
- QWidget(parent),
- c(connection),
- objectPathRegExp(QLatin1String("\\[ObjectPath: (.*)\\]"))
+QDBusViewer::QDBusViewer(const QDBusConnection &connection, QWidget *parent)
+ : QWidget(parent), c(connection), objectPathRegExp("\\[ObjectPath: (.*)\\]"_L1)
{
serviceFilterLine = new QLineEdit(this);
serviceFilterLine->setPlaceholderText(tr("Search..."));
@@ -141,6 +117,7 @@ QDBusViewer::QDBusViewer(const QDBusConnection &connection, QWidget *parent) :
QWidget *servicesWidget = new QWidget;
QVBoxLayout *servicesLayout = new QVBoxLayout(servicesWidget);
+ servicesLayout->setContentsMargins(QMargins());
servicesLayout->addWidget(serviceFilterLine);
servicesLayout->addWidget(servicesView);
splitter->addWidget(servicesWidget);
@@ -152,23 +129,30 @@ QDBusViewer::QDBusViewer(const QDBusConnection &connection, QWidget *parent) :
connect(servicesView->selectionModel(), &QItemSelectionModel::currentChanged, this, &QDBusViewer::serviceChanged);
connect(tree, &QWidget::customContextMenuRequested, this, &QDBusViewer::showContextMenu);
- QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection);
+ QMetaObject::invokeMethod(this, &QDBusViewer::refresh, Qt::QueuedConnection);
if (c.isConnected()) {
- logMessage(QLatin1String("Connected to D-Bus."));
- QDBusConnectionInterface *iface = c.interface();
- connect(iface, &QDBusConnectionInterface::serviceRegistered, this, &QDBusViewer::serviceRegistered);
- connect(iface, &QDBusConnectionInterface::serviceUnregistered, this, &QDBusViewer::serviceUnregistered);
- connect(iface, &QDBusConnectionInterface::serviceOwnerChanged, this, &QDBusViewer::serviceOwnerChanged);
+ QDBusServiceWatcher *watcher =
+ new QDBusServiceWatcher("*", c, QDBusServiceWatcher::WatchForOwnerChange, this);
+ connect(watcher, &QDBusServiceWatcher::serviceOwnerChanged, this,
+ &QDBusViewer::serviceOwnerChanged);
+ logMessage(tr("Connected to D-Bus."));
} else {
- logError(QLatin1String("Cannot connect to D-Bus: ") + c.lastError().message());
+ logError(tr("Cannot connect to D-Bus: %1").arg(c.lastError().message()));
}
objectPathRegExp.setPatternOptions(QRegularExpression::InvertedGreedinessOption);
}
-static inline QString topSplitterStateKey() { return QStringLiteral("topSplitterState"); }
-static inline QString splitterStateKey() { return QStringLiteral("splitterState"); }
+static inline QString topSplitterStateKey()
+{
+ return u"topSplitterState"_s;
+}
+
+static inline QString splitterStateKey()
+{
+ return u"splitterState"_s;
+}
void QDBusViewer::saveState(QSettings *settings) const
{
@@ -184,7 +168,7 @@ void QDBusViewer::restoreState(const QSettings *settings)
void QDBusViewer::logMessage(const QString &msg)
{
- log->append(msg + QLatin1Char('\n'));
+ log->append(msg + '\n'_L1);
}
void QDBusViewer::showEvent(QShowEvent *)
@@ -209,7 +193,7 @@ bool QDBusViewer::eventFilter(QObject *obj, QEvent *event)
void QDBusViewer::logError(const QString &msg)
{
- log->append(QLatin1String("<font color=\"red\">Error: </font>") + msg.toHtmlEscaped() + QLatin1String("<br>"));
+ log->append(tr("<font color=\"red\">Error: </font>%1<br>").arg(msg.toHtmlEscaped()));
}
void QDBusViewer::refresh()
@@ -253,7 +237,8 @@ void QDBusViewer::activate(const QModelIndex &item)
void QDBusViewer::getProperty(const BusSignature &sig)
{
- QDBusMessage message = QDBusMessage::createMethodCall(sig.mService, sig.mPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("Get"));
+ QDBusMessage message = QDBusMessage::createMethodCall(
+ sig.mService, sig.mPath, "org.freedesktop.DBus.Properties"_L1, "Get"_L1);
QList<QVariant> arguments;
arguments << sig.mInterface << sig.mName;
message.setArguments(arguments);
@@ -280,7 +265,8 @@ void QDBusViewer::setProperty(const BusSignature &sig)
return;
}
- QDBusMessage message = QDBusMessage::createMethodCall(sig.mService, sig.mPath, QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("Set"));
+ QDBusMessage message = QDBusMessage::createMethodCall(
+ sig.mService, sig.mPath, "org.freedesktop.DBus.Properties"_L1, "Set"_L1);
QList<QVariant> arguments;
arguments << sig.mInterface << sig.mName << QVariant::fromValue(QDBusVariant(value));
message.setArguments(arguments);
@@ -305,7 +291,7 @@ void QDBusViewer::callMethod(const BusSignature &sig)
QMetaMethod method;
for (int i = 0; i < mo->methodCount(); ++i) {
const QString signature = QString::fromLatin1(mo->method(i).methodSignature());
- if (signature.startsWith(sig.mName) && signature.at(sig.mName.length()) == QLatin1Char('('))
+ if (signature.startsWith(sig.mName) && signature.at(sig.mName.size()) == '('_L1)
if (getDbusSignature(mo->method(i)) == sig.mTypeSig)
method = mo->method(i);
}
@@ -322,7 +308,7 @@ void QDBusViewer::callMethod(const BusSignature &sig)
const QList<QByteArray> paramTypes = method.parameterTypes();
const QList<QByteArray> paramNames = method.parameterNames();
QList<int> types; // remember the low-level D-Bus type
- for (int i = 0; i < paramTypes.count(); ++i) {
+ for (int i = 0; i < paramTypes.size(); ++i) {
const QByteArray paramType = paramTypes.at(i);
if (paramType.endsWith('&'))
continue; // ignore OUT parameters
@@ -343,7 +329,7 @@ void QDBusViewer::callMethod(const BusSignature &sig)
// Try to convert the values we got as closely as possible to the
// dbus signature. This is especially important for those input as strings
- for (int i = 0; i < args.count(); ++i) {
+ for (int i = 0; i < args.size(); ++i) {
QVariant a = args.at(i);
int desttype = types.at(i);
if (desttype < int(QMetaType::User) && desttype != qMetaTypeId<QVariantMap>()) {
@@ -393,9 +379,13 @@ void QDBusViewer::showContextMenu(const QPoint &point)
menu.addAction(action);
break; }
case QDBusModel::PropertyItem: {
+ QDBusInterface iface(sig.mService, sig.mPath, sig.mInterface, c);
+ QMetaProperty prop = iface.metaObject()->property(iface.metaObject()->indexOfProperty(sig.mName.toLatin1()));
QAction *actionSet = new QAction(tr("&Set value"), &menu);
actionSet->setData(3);
+ actionSet->setEnabled(prop.isWritable());
QAction *actionGet = new QAction(tr("&Get value"), &menu);
+ actionGet->setEnabled(prop.isReadable());
actionGet->setData(4);
menu.addAction(actionSet);
menu.addAction(actionGet);
@@ -439,46 +429,45 @@ void QDBusViewer::connectionRequested(const BusSignature &sig)
void QDBusViewer::dumpMessage(const QDBusMessage &message)
{
QList<QVariant> args = message.arguments();
- QString out = QLatin1String("Received ");
+ QString messageType;
switch (message.type()) {
case QDBusMessage::SignalMessage:
- out += QLatin1String("signal ");
+ messageType = tr("signal");
break;
case QDBusMessage::ErrorMessage:
- out += QLatin1String("error message ");
+ messageType = tr("error message");
break;
case QDBusMessage::ReplyMessage:
- out += QLatin1String("reply ");
+ messageType = tr("reply");
break;
default:
- out += QLatin1String("message ");
+ messageType = tr("message");
break;
}
- out += QLatin1String("from ");
- out += message.service();
+ QString out = tr("Received %1 from %2").arg(messageType).arg(message.service());
+
if (!message.path().isEmpty())
- out += QLatin1String(", path ") + message.path();
+ out += tr(", path %1").arg(message.path());
if (!message.interface().isEmpty())
- out += QLatin1String(", interface <i>") + message.interface() + QLatin1String("</i>");
+ out += tr(", interface <i>%1</i>").arg(message.interface());
if (!message.member().isEmpty())
- out += QLatin1String(", member ") + message.member();
- out += QLatin1String("<br>");
+ out += tr(", member %1").arg(message.member());
+ out += "<br>"_L1;
if (args.isEmpty()) {
- out += QLatin1String("&nbsp;&nbsp;(no arguments)");
+ out += tr("&nbsp;&nbsp;(no arguments)");
} else {
- out += QLatin1String("&nbsp;&nbsp;Arguments: ");
- for (const QVariant &arg : qAsConst(args)) {
+ QStringList argStrings;
+ for (const QVariant &arg : std::as_const(args)) {
QString str = QDBusUtil::argumentToString(arg).toHtmlEscaped();
// turn object paths into clickable links
- str.replace(objectPathRegExp, QLatin1String("[ObjectPath: <a href=\"qdbus://bus\\1\">\\1</a>]"));
+ str.replace(objectPathRegExp, tr("[ObjectPath: <a href=\"qdbus://bus\\1\">\\1</a>]"));
// convert new lines from command to proper HTML line breaks
- str.replace(QStringLiteral("\n"), QStringLiteral("<br/>"));
- out += str;
- out += QLatin1String(", ");
+ str.replace("\n"_L1, "<br/>"_L1);
+ argStrings.append(str);
}
- out.chop(2);
+ out += tr("&nbsp;&nbsp;Arguments: %1").arg(argStrings.join(tr(", ")));
}
log->append(out);
@@ -521,14 +510,6 @@ static QModelIndex findItem(QStringListModel *servicesModel, const QString &name
return hits.first();
}
-void QDBusViewer::serviceUnregistered(const QString &name)
-{
- QModelIndex hit = findItem(servicesModel, name);
- if (!hit.isValid())
- return;
- servicesModel->removeRows(hit.row(), 1);
-}
-
void QDBusViewer::serviceOwnerChanged(const QString &name, const QString &oldOwner,
const QString &newOwner)
{
@@ -563,7 +544,7 @@ void QDBusViewer::refreshChildren()
void QDBusViewer::anchorClicked(const QUrl &url)
{
- if (url.scheme() != QLatin1String("qdbus"))
+ if (url.scheme() != "qdbus"_L1)
// not ours
return;
diff --git a/src/qdbus/qdbusviewer/qdbusviewer.h b/src/qdbus/qdbusviewer/qdbusviewer.h
index 57868a5ed..4272d6957 100644
--- a/src/qdbus/qdbusviewer/qdbusviewer.h
+++ b/src/qdbus/qdbusviewer/qdbusviewer.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef QDBUSVIEWER_H
#define QDBUSVIEWER_H
@@ -75,8 +50,6 @@ private slots:
void dumpError(const QDBusError &error);
void refreshChildren();
- void serviceRegistered(const QString &service);
- void serviceUnregistered(const QString &service);
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
void serviceFilterReturnPressed();
@@ -86,6 +59,7 @@ private slots:
void anchorClicked(const QUrl &url);
private:
+ void serviceRegistered(const QString &service);
void logMessage(const QString &msg);
void showEvent(QShowEvent *) override;
bool eventFilter(QObject *obj, QEvent *event) override;
diff --git a/src/qdbus/qdbusviewer/qdbusviewer.qrc b/src/qdbus/qdbusviewer/qdbusviewer.qrc
deleted file mode 100644
index 8be6643bc..000000000
--- a/src/qdbus/qdbusviewer/qdbusviewer.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/qt-project.org/qdbusviewer" >
- <file>images/qdbusviewer-128.png</file>
- <file>images/qdbusviewer.png</file>
- </qresource>
-</RCC>
diff --git a/src/qdbus/qdbusviewer/servicesproxymodel.cpp b/src/qdbus/qdbusviewer/servicesproxymodel.cpp
index fff348e14..f79c6dfa5 100644
--- a/src/qdbus/qdbusviewer/servicesproxymodel.cpp
+++ b/src/qdbus/qdbusviewer/servicesproxymodel.cpp
@@ -1,33 +1,10 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "servicesproxymodel.h"
+using namespace Qt::StringLiterals;
+
ServicesProxyModel::ServicesProxyModel(QObject *parent)
: QSortFilterProxyModel(parent)
{
@@ -48,8 +25,8 @@ bool ServicesProxyModel::lessThan(const QModelIndex &left,
QString s1 = sourceModel()->data(left).toString();
QString s2 = sourceModel()->data(right).toString();
- const bool isNumber1 = s1.startsWith(QLatin1String(":1."));
- const bool isNumber2 = s2.startsWith(QLatin1String(":1."));
+ const bool isNumber1 = s1.startsWith(":1."_L1);
+ const bool isNumber2 = s2.startsWith(":1."_L1);
if (isNumber1 == isNumber2) {
if (isNumber1) {
int number1 = QStringView{s1}.mid(3).toInt();
diff --git a/src/qdbus/qdbusviewer/servicesproxymodel.h b/src/qdbus/qdbusviewer/servicesproxymodel.h
index 966b92d11..08d2fd6bd 100644
--- a/src/qdbus/qdbusviewer/servicesproxymodel.h
+++ b/src/qdbus/qdbusviewer/servicesproxymodel.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#ifndef SERVICESFILTERPROXYMODEL_H
#define SERVICESFILTERPROXYMODEL_H