From d3b22f8828c646bcf56476068c9e4d5404981e5b Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 30 Aug 2019 17:26:54 +0200 Subject: [PATCH] Port trivial connects to the new style --- src/declarativeimports/core/datamodel.cpp | 30 +++++++++---------- src/declarativeimports/core/datasource.cpp | 10 +++---- src/declarativeimports/core/units.cpp | 2 +- .../plasmacomponentsplugin.cpp | 4 +-- .../plasmacomponents/qmenuitem.cpp | 2 +- .../platformcomponents/application.cpp | 4 +-- src/plasma/applet.cpp | 4 +-- src/plasma/containment.cpp | 6 ++-- src/plasma/corona.cpp | 8 ++--- src/plasma/datacontainer.cpp | 8 ++--- src/plasma/dataengine.cpp | 2 +- src/plasma/private/storage.cpp | 2 +- src/plasma/private/theme_p.cpp | 14 ++++----- src/plasma/private/timetracker.cpp | 2 +- src/plasma/private/timetracker.h | 2 +- src/plasmaquick/dialog.cpp | 4 +-- .../qml/plasmoid/containmentinterface.cpp | 2 +- tests/dpi/dpitest.cpp | 2 +- tests/kplugins/plugintest.cpp | 2 +- 19 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/declarativeimports/core/datamodel.cpp b/src/declarativeimports/core/datamodel.cpp index 4c15c46ed..801e73880 100644 --- a/src/declarativeimports/core/datamodel.cpp +++ b/src/declarativeimports/core/datamodel.cpp @@ -32,13 +32,13 @@ SortFilterModel::SortFilterModel(QObject *parent) { setObjectName(QStringLiteral("SortFilterModel")); setDynamicSortFilter(true); - connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SIGNAL(countChanged())); - connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SIGNAL(countChanged())); - connect(this, SIGNAL(modelReset()), - this, SIGNAL(countChanged())); - connect(this, SIGNAL(countChanged()), this, SLOT(syncRoleNames())); + connect(this, &QAbstractItemModel::rowsInserted, + this, &SortFilterModel::countChanged); + connect(this, &QAbstractItemModel::rowsRemoved, + this, &SortFilterModel::countChanged); + connect(this, &QAbstractItemModel::modelReset, + this, &SortFilterModel::countChanged); + connect(this, &SortFilterModel::countChanged, this, &SortFilterModel::syncRoleNames); } SortFilterModel::~SortFilterModel() @@ -82,13 +82,13 @@ void SortFilterModel::setModel(QAbstractItemModel *model) } if (sourceModel()) { - disconnect(sourceModel(), SIGNAL(modelReset()), this, SLOT(syncRoleNames())); + disconnect(sourceModel(), &QAbstractItemModel::modelReset, this, &SortFilterModel::syncRoleNames); } QSortFilterProxyModel::setSourceModel(model); if (model) { - connect(model, SIGNAL(modelReset()), this, SLOT(syncRoleNames())); + connect(model, &QAbstractItemModel::modelReset, this, &SortFilterModel::syncRoleNames); syncRoleNames(); } @@ -245,12 +245,12 @@ DataModel::DataModel(QObject *parent) ++m_maxRoleId; setObjectName(QStringLiteral("DataModel")); - connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SIGNAL(countChanged())); - connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SIGNAL(countChanged())); - connect(this, SIGNAL(modelReset()), - this, SIGNAL(countChanged())); + connect(this, &QAbstractItemModel::rowsInserted, + this, &DataModel::countChanged); + connect(this, &QAbstractItemModel::rowsRemoved, + this, &DataModel::countChanged); + connect(this, &QAbstractItemModel::modelReset, + this, &DataModel::countChanged); } DataModel::~DataModel() diff --git a/src/declarativeimports/core/datasource.cpp b/src/declarativeimports/core/datasource.cpp index a4813d589..72d4be30d 100644 --- a/src/declarativeimports/core/datasource.cpp +++ b/src/declarativeimports/core/datasource.cpp @@ -116,12 +116,12 @@ void DataSource::setEngine(const QString &e) * recommendations engine. */ m_dataEngine = engine; - connect(m_dataEngine, SIGNAL(sourceAdded(QString)), this, SLOT(updateSources()), Qt::QueuedConnection); - connect(m_dataEngine, SIGNAL(sourceRemoved(QString)), this, SLOT(updateSources())); + connect(m_dataEngine, &DataEngine::sourceAdded, this, &DataSource::updateSources, Qt::QueuedConnection); + connect(m_dataEngine, &DataEngine::sourceRemoved, this, &DataSource::updateSources); - connect(m_dataEngine, SIGNAL(sourceAdded(QString)), this, SIGNAL(sourceAdded(QString)), Qt::QueuedConnection); - connect(m_dataEngine, SIGNAL(sourceRemoved(QString)), this, SLOT(removeSource(QString))); - connect(m_dataEngine, SIGNAL(sourceRemoved(QString)), this, SIGNAL(sourceRemoved(QString))); + connect(m_dataEngine, &DataEngine::sourceAdded, this, &DataSource::sourceAdded, Qt::QueuedConnection); + connect(m_dataEngine, &DataEngine::sourceRemoved, this, &DataSource::removeSource); + connect(m_dataEngine, &DataEngine::sourceRemoved, this, &DataSource::sourceRemoved); updateSources(); diff --git a/src/declarativeimports/core/units.cpp b/src/declarativeimports/core/units.cpp index 02cc172c9..a9d6ddc16 100644 --- a/src/declarativeimports/core/units.cpp +++ b/src/declarativeimports/core/units.cpp @@ -77,7 +77,7 @@ Units::Units(QObject *parent) updateSpacing(); // updates gridUnit and *Spacing properties connect(KIconLoader::global(), &KIconLoader::iconLoaderSettingsChanged, this, &Units::iconLoaderSettingsChanged); - QObject::connect(s_sharedAppFilter, SIGNAL(fontChanged()), this, SLOT(updateSpacing())); + QObject::connect(s_sharedAppFilter, &SharedAppFilter::fontChanged, this, &Units::updateSpacing); const QString configFile = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + plasmarc(); KDirWatch::self()->addFile(configFile); diff --git a/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp b/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp index 64f6feaeb..28667c0bf 100644 --- a/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp +++ b/src/declarativeimports/plasmacomponents/plasmacomponentsplugin.cpp @@ -63,8 +63,8 @@ QQmlEngine *EngineBookKeeping::engine() const void EngineBookKeeping::insertEngine(QQmlEngine *engine) { - connect(engine, SIGNAL(destroyed(QObject*)), - this, SLOT(engineDestroyed(QObject*))); + connect(engine, &QObject::destroyed, + this, &EngineBookKeeping::engineDestroyed); m_engines.insert(engine); } diff --git a/src/declarativeimports/plasmacomponents/qmenuitem.cpp b/src/declarativeimports/plasmacomponents/qmenuitem.cpp index 0d598491a..2e1a2e574 100644 --- a/src/declarativeimports/plasmacomponents/qmenuitem.cpp +++ b/src/declarativeimports/plasmacomponents/qmenuitem.cpp @@ -58,7 +58,7 @@ void QMenuItem::setAction(QAction *a) connect(m_action, &QAction::changed, this, &QMenuItem::textChanged); connect(m_action, &QAction::changed, this, &QMenuItem::checkableChanged); - connect(m_action, SIGNAL(toggled(bool)), this, SIGNAL(toggled(bool))); + connect(m_action, &QAction::toggled, this, &QMenuItem::toggled); connect(m_action, &QAction::triggered, this, &QMenuItem::clicked); connect(this, &QQuickItem::visibleChanged, this, &QMenuItem::updateAction); diff --git a/src/declarativeimports/platformcomponents/application.cpp b/src/declarativeimports/platformcomponents/application.cpp index 1326a7b46..3bc9b3069 100644 --- a/src/declarativeimports/platformcomponents/application.cpp +++ b/src/declarativeimports/platformcomponents/application.cpp @@ -30,8 +30,8 @@ Application::Private::Private(Application *parent) , q(parent) { connect( - &process, SIGNAL(stateChanged(QProcess::ProcessState)), - this, SLOT(stateChanged(QProcess::ProcessState)) + &process, &QProcess::stateChanged, + this, &Private::stateChanged ); connect( &process, SIGNAL(error(QProcess::ProcessError)), diff --git a/src/plasma/applet.cpp b/src/plasma/applet.cpp index 5ca148388..715bcc195 100644 --- a/src/plasma/applet.cpp +++ b/src/plasma/applet.cpp @@ -557,7 +557,7 @@ void Applet::flushPendingConstraintsEvents() QAction *runAssociatedApplication = d->actions->action(QStringLiteral("run associated application")); if (runAssociatedApplication) { - connect(runAssociatedApplication, SIGNAL(triggered(bool)), this, SLOT(runAssociatedApplication()), Qt::UniqueConnection); + connect(runAssociatedApplication, &QAction::triggered, this, &Applet::runAssociatedApplication, Qt::UniqueConnection); } d->updateShortcuts(); @@ -670,7 +670,7 @@ void Applet::setGlobalShortcut(const QKeySequence &shortcut) d->activationAction = new QAction(this); d->activationAction->setText(i18n("Activate %1 Widget", title())); d->activationAction->setObjectName(QStringLiteral("activate widget %1").arg(id())); // NO I18N - connect(d->activationAction, SIGNAL(triggered()), this, SIGNAL(activated())); + connect(d->activationAction, &QAction::triggered, this, &Applet::activated); connect(d->activationAction, SIGNAL(changed()), this, SLOT(globalShortcutChanged())); } else if (d->activationAction->shortcut() == shortcut) { diff --git a/src/plasma/containment.cpp b/src/plasma/containment.cpp index c8fdfb204..25d3272b2 100644 --- a/src/plasma/containment.cpp +++ b/src/plasma/containment.cpp @@ -412,7 +412,7 @@ void Containment::addApplet(Applet *applet) oldConfig.reparent(&c); applet->d->resetConfigurationObject(); - disconnect(applet, SIGNAL(activated()), currentContainment, SIGNAL(activated())); + disconnect(applet, &Applet::activated, currentContainment, &Applet::activated); //change the group to its configloader, if any //FIXME: this is very, very brutal if (applet->configScheme()) { @@ -439,10 +439,10 @@ void Containment::addApplet(Applet *applet) d->loadingApplets << applet; } - connect(applet, SIGNAL(configNeedsSaving()), this, SIGNAL(configNeedsSaving())); + connect(applet, &Applet::configNeedsSaving, this, &Applet::configNeedsSaving); connect(applet, SIGNAL(appletDeleted(Plasma::Applet*)), this, SLOT(appletDeleted(Plasma::Applet*))); connect(applet, SIGNAL(statusChanged(Plasma::Types::ItemStatus)), this, SLOT(checkStatus(Plasma::Types::ItemStatus))); - connect(applet, SIGNAL(activated()), this, SIGNAL(activated())); + connect(applet, &Applet::activated, this, &Applet::activated); if (!currentContainment) { const bool isNew = applet->d->mainConfigGroup()->entryMap().isEmpty(); diff --git a/src/plasma/corona.cpp b/src/plasma/corona.cpp index fff3e7405..d059c9dc6 100644 --- a/src/plasma/corona.cpp +++ b/src/plasma/corona.cpp @@ -561,10 +561,10 @@ Containment *CoronaPrivate::addContainment(const QString &name, const QVariantLi QObject::connect(containment, SIGNAL(destroyed(QObject*)), q, SLOT(containmentDestroyed(QObject*))); - QObject::connect(containment, SIGNAL(configNeedsSaving()), - q, SLOT(requestConfigSync())); - QObject::connect(containment, SIGNAL(screenChanged(int)), - q, SIGNAL(screenOwnerChanged(int))); + QObject::connect(containment, &Applet::configNeedsSaving, + q, &Corona::requestConfigSync); + QObject::connect(containment, &Containment::screenChanged, + q, &Corona::screenOwnerChanged); if (!delayedInit) { containment->init(); diff --git a/src/plasma/datacontainer.cpp b/src/plasma/datacontainer.cpp index 193ea7db3..0c083cebf 100644 --- a/src/plasma/datacontainer.cpp +++ b/src/plasma/datacontainer.cpp @@ -158,8 +158,8 @@ void DataContainer::connectVisualization(QObject *visualization, uint pollingInt } } } else { - connect(visualization, SIGNAL(destroyed(QObject*)), - this, SLOT(disconnectVisualization(QObject*))); //, Qt::QueuedConnection); + connect(visualization, &QObject::destroyed, + this, &DataContainer::disconnectVisualization); //, Qt::QueuedConnection); } if (pollingInterval < 1) { @@ -312,8 +312,8 @@ void DataContainerPrivate::populateFromStoredData(KJob *job) void DataContainer::disconnectVisualization(QObject *visualization) { QMap::iterator objIt = d->relayObjects.find(visualization); - disconnect(visualization, SIGNAL(destroyed(QObject*)), - this, SLOT(disconnectVisualization(QObject*))); //, Qt::QueuedConnection); + disconnect(visualization, &QObject::destroyed, + this, &DataContainer::disconnectVisualization); //, Qt::QueuedConnection); if (objIt == d->relayObjects.end() || !objIt.value()) { // it is connected directly to the DataContainer itself diff --git a/src/plasma/dataengine.cpp b/src/plasma/dataengine.cpp index a51270158..ee86354b3 100644 --- a/src/plasma/dataengine.cpp +++ b/src/plasma/dataengine.cpp @@ -597,7 +597,7 @@ DataContainer *DataEnginePrivate::requestSource(const QString &sourceName, bool if (newSource) { *newSource = true; } - QObject::connect(s, SIGNAL(becameUnused(QString)), q, SLOT(removeSource(QString))); + QObject::connect(s, &DataContainer::becameUnused, q, &DataEngine::removeSource); emit q->sourceAdded(sourceName); } } diff --git a/src/plasma/private/storage.cpp b/src/plasma/private/storage.cpp index e00bc0d38..6d4c5c41d 100644 --- a/src/plasma/private/storage.cpp +++ b/src/plasma/private/storage.cpp @@ -46,7 +46,7 @@ StorageJob::StorageJob(const QString &destination, m_clientName(destination) { Plasma::StorageThread::self()->start(); - connect(Plasma::StorageThread::self(), SIGNAL(newResult(StorageJob*,QVariant)), this, SLOT(resultSlot(StorageJob*,QVariant))); + connect(Plasma::StorageThread::self(), &Plasma::StorageThread::newResult, this, &StorageJob::resultSlot); qRegisterMetaType(); qRegisterMetaType >(); } diff --git a/src/plasma/private/theme_p.cpp b/src/plasma/private/theme_p.cpp index d4917388e..5d050755a 100644 --- a/src/plasma/private/theme_p.cpp +++ b/src/plasma/private/theme_p.cpp @@ -84,18 +84,18 @@ ThemePrivate::ThemePrivate(QObject *parent) pixmapSaveTimer = new QTimer(this); pixmapSaveTimer->setSingleShot(true); pixmapSaveTimer->setInterval(600); - QObject::connect(pixmapSaveTimer, SIGNAL(timeout()), this, SLOT(scheduledCacheUpdate())); + QObject::connect(pixmapSaveTimer, &QTimer::timeout, this, &ThemePrivate::scheduledCacheUpdate); rectSaveTimer = new QTimer(this); rectSaveTimer->setSingleShot(true); //2 minutes rectSaveTimer->setInterval(2 * 60 * 1000); - QObject::connect(rectSaveTimer, SIGNAL(timeout()), this, SLOT(saveSvgElementsCache())); + QObject::connect(rectSaveTimer, &QTimer::timeout, this, &ThemePrivate::saveSvgElementsCache); updateNotificationTimer = new QTimer(this); updateNotificationTimer->setSingleShot(true); updateNotificationTimer->setInterval(100); - QObject::connect(updateNotificationTimer, SIGNAL(timeout()), this, SLOT(notifyOfChanged())); + QObject::connect(updateNotificationTimer, &QTimer::timeout, this, &ThemePrivate::notifyOfChanged); if (QPixmap::defaultDepth() > 8) { #if HAVE_X11 @@ -200,11 +200,11 @@ bool ThemePrivate::useCache() // watch the metadata file for changes at runtime KDirWatch::self()->addFile(themeMetadataPath); - QObject::connect(KDirWatch::self(), SIGNAL(created(QString)), - this, SLOT(settingsFileChanged(QString)), + QObject::connect(KDirWatch::self(), &KDirWatch::created, + this, &ThemePrivate::settingsFileChanged, Qt::UniqueConnection); - QObject::connect(KDirWatch::self(), SIGNAL(dirty(QString)), - this, SLOT(settingsFileChanged(QString)), + QObject::connect(KDirWatch::self(), &KDirWatch::dirty, + this, &ThemePrivate::settingsFileChanged, Qt::UniqueConnection); if (!iconThemeMetadataPath.isEmpty()) { diff --git a/src/plasma/private/timetracker.cpp b/src/plasma/private/timetracker.cpp index a6a25ae5c..26f4e5afe 100644 --- a/src/plasma/private/timetracker.cpp +++ b/src/plasma/private/timetracker.cpp @@ -88,7 +88,7 @@ TimeTracker::TimeTracker(QObject* o) QTimer* t = new QTimer(this); t->setInterval(2000); t->setSingleShot(false); - connect(t, SIGNAL(timeout()), this, SLOT(sync())); + connect(t, &QTimer::timeout, this, &TimeTracker::sync); t->start(); QMetaObject::invokeMethod(this, "init", Qt::QueuedConnection); diff --git a/src/plasma/private/timetracker.h b/src/plasma/private/timetracker.h index 13bf1d3c9..dc14705b9 100644 --- a/src/plasma/private/timetracker.h +++ b/src/plasma/private/timetracker.h @@ -56,7 +56,7 @@ struct ObjectHistory * as the process has quit. */ -class PLASMA_EXPORT TimeTracker : QObject +class PLASMA_EXPORT TimeTracker : public QObject { Q_OBJECT public: diff --git a/src/plasmaquick/dialog.cpp b/src/plasmaquick/dialog.cpp index c9f9cd87d..0323c5bdf 100644 --- a/src/plasmaquick/dialog.cpp +++ b/src/plasmaquick/dialog.cpp @@ -741,8 +741,8 @@ Dialog::Dialog(QQuickItem *parent) } }); - connect(this, SIGNAL(visibleChanged(bool)), - this, SIGNAL(visibleChangedProxy())); + connect(this, &QWindow::visibleChanged, + this, &Dialog::visibleChangedProxy); connect(this, SIGNAL(visibleChanged(bool)), this, SLOT(updateInputShape())); connect(this, SIGNAL(outputOnlyChanged()), diff --git a/src/scriptengines/qml/plasmoid/containmentinterface.cpp b/src/scriptengines/qml/plasmoid/containmentinterface.cpp index d7f579f5c..51bd6731a 100644 --- a/src/scriptengines/qml/plasmoid/containmentinterface.cpp +++ b/src/scriptengines/qml/plasmoid/containmentinterface.cpp @@ -472,7 +472,7 @@ void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y, KI KIO::MimetypeJob *job = KIO::mimetype(url, flags); m_dropPoints[job] = QPoint(x, y); - QObject::connect(job, SIGNAL(result(KJob*)), this, SLOT(dropJobResult(KJob*))); + QObject::connect(job, &KJob::result, this, &ContainmentInterface::dropJobResult); QObject::connect(job, SIGNAL(mimetype(KIO::Job*,QString)), this, SLOT(mimeTypeRetrieved(KIO::Job*,QString))); diff --git a/tests/dpi/dpitest.cpp b/tests/dpi/dpitest.cpp index c3d2c3e68..10bf8e2f3 100644 --- a/tests/dpi/dpitest.cpp +++ b/tests/dpi/dpitest.cpp @@ -43,7 +43,7 @@ DPITest::DPITest(int &argc, char **argv, QCommandLineParser *parser) : { d = new DPITestPrivate; d->parser = parser; - QTimer::singleShot(0, this, SLOT(runMain())); + QTimer::singleShot(0, this, &DPITest::runMain); } DPITest::~DPITest() diff --git a/tests/kplugins/plugintest.cpp b/tests/kplugins/plugintest.cpp index 3c267ab58..828da79a3 100644 --- a/tests/kplugins/plugintest.cpp +++ b/tests/kplugins/plugintest.cpp @@ -62,7 +62,7 @@ PluginTest::PluginTest(int &argc, char **argv, QCommandLineParser *parser) : { d = new PluginTestPrivate; d->parser = parser; - QTimer::singleShot(0, this, SLOT(runMain())); + QTimer::singleShot(0, this, &PluginTest::runMain); } PluginTest::~PluginTest()