From 0c266e760bfe5d3b4f5745b538c93fc363996981 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 23 Sep 2020 21:39:59 +0300 Subject: [PATCH] Replace remaining usages of old connect syntax with new connect syntax This change replaces the remaining usages of the old connect syntax with the new connect syntax. Unfortunately, there are still places where we have to use SIGNAL() and SLOT() macros, for example the stuff that deals with d-bus business. Clazy was used to create this change. There were a few cases that needed manual intervention, the majority of those cases were about resolving ambiguity caused by overloaded signals. --- autotests/integration/xdgshellclient_test.cpp | 2 +- client_machine.cpp | 12 +++---- dbusinterface.cpp | 2 +- effects.cpp | 6 ++-- effects/magnifier/magnifier.cpp | 6 ++-- events.cpp | 2 +- kcmkwin/kwinrules/rulesdialog.cpp | 4 +-- kcmkwin/kwinscreenedges/kwinscreenedge.h | 2 +- .../kwinscreenedgeconfigform.cpp | 10 +++--- kcmkwin/kwintabbox/kwintabboxconfigform.cpp | 36 +++++++++---------- kcmkwin/kwintabbox/main.cpp | 24 ++++++------- main.h | 4 +-- main_x11.cpp | 4 +-- outline.cpp | 2 +- .../aurorae/src/lib/auroraetheme.cpp | 4 +-- .../platforms/x11/standalone/x11cursor.cpp | 4 +-- pointer_input.cpp | 7 ++-- rules.cpp | 8 ++--- scene.cpp | 2 +- screenedge.cpp | 8 ++--- screenlockerwatcher.cpp | 20 +++++++---- screens.cpp | 4 +-- scripting/scriptedeffect.cpp | 4 +-- scripting/scripting.cpp | 22 ++++++------ scripting/scripting_model.cpp | 26 +++++++------- scripting/workspace_wrapper.cpp | 16 ++++----- tabbox/tabbox.cpp | 12 +++---- tabbox/tabboxhandler.cpp | 2 +- thumbnailitem.cpp | 8 ++--- toplevel.cpp | 4 +-- unmanaged.cpp | 2 +- workspace.cpp | 30 ++++++++-------- 32 files changed, 152 insertions(+), 147 deletions(-) diff --git a/autotests/integration/xdgshellclient_test.cpp b/autotests/integration/xdgshellclient_test.cpp index c0833b1f7..89470083b 100644 --- a/autotests/integration/xdgshellclient_test.cpp +++ b/autotests/integration/xdgshellclient_test.cpp @@ -632,7 +632,7 @@ void TestXdgShellClient::testWindowOpensLargerThanScreen() // the window should get resized to fit into the screen, BUG: 366632 QScopedPointer surface(Test::createSurface()); QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data())); - QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), SIGNAL(sizeChanged(QSize))); + QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged); QVERIFY(sizeChangeRequestedSpy.isValid()); // create deco diff --git a/client_machine.cpp b/client_machine.cpp index 7bff56ae4..86e1073e0 100644 --- a/client_machine.cpp +++ b/client_machine.cpp @@ -50,10 +50,10 @@ GetAddrInfo::GetAddrInfo(const QByteArray &hostName, QObject *parent) { // watcher will be deleted together with the GetAddrInfo once the future // got canceled or finished - connect(m_watcher, SIGNAL(canceled()), SLOT(deleteLater())); - connect(m_watcher, SIGNAL(finished()), SLOT(slotResolved())); - connect(m_ownAddressWatcher, SIGNAL(canceled()), SLOT(deleteLater())); - connect(m_ownAddressWatcher, SIGNAL(finished()), SLOT(slotOwnAddressResolved())); + connect(m_watcher, &QFutureWatcher::canceled, this, &GetAddrInfo::deleteLater); + connect(m_watcher, &QFutureWatcher::finished, this, &GetAddrInfo::slotResolved); + connect(m_ownAddressWatcher, &QFutureWatcher::canceled, this, &GetAddrInfo::deleteLater); + connect(m_ownAddressWatcher, &QFutureWatcher::finished, this, &GetAddrInfo::slotOwnAddressResolved); } GetAddrInfo::~GetAddrInfo() @@ -210,8 +210,8 @@ void ClientMachine::checkForLocalhost() // check using information from get addr info // GetAddrInfo gets automatically destroyed once it finished or not GetAddrInfo *info = new GetAddrInfo(lowerHostName, this); - connect(info, SIGNAL(local()), SLOT(setLocal())); - connect(info, SIGNAL(destroyed(QObject*)), SLOT(resolveFinished())); + connect(info, &GetAddrInfo::local, this, &ClientMachine::setLocal); + connect(info, &GetAddrInfo::destroyed, this, &ClientMachine::resolveFinished); info->resolve(); } } diff --git a/dbusinterface.cpp b/dbusinterface.cpp index 6832fbb97..3f8ae2e3f 100644 --- a/dbusinterface.cpp +++ b/dbusinterface.cpp @@ -49,7 +49,7 @@ DBusInterface::DBusInterface(QObject *parent) } if (!dbus.registerService(m_serviceName)) { QDBusServiceWatcher *dog = new QDBusServiceWatcher(m_serviceName, dbus, QDBusServiceWatcher::WatchForUnregistration, this); - connect (dog, SIGNAL(serviceUnregistered(QString)), SLOT(becomeKWinService(QString))); + connect(dog, &QDBusServiceWatcher::serviceUnregistered, this, &DBusInterface::becomeKWinService); } else { announceService(); } diff --git a/effects.cpp b/effects.cpp index 67d9ab298..ef93b83f2 100644 --- a/effects.cpp +++ b/effects.cpp @@ -2061,11 +2061,11 @@ void EffectWindowImpl::registerThumbnail(AbstractThumbnailItem *item) { if (WindowThumbnailItem *thumb = qobject_cast(item)) { insertThumbnail(thumb); - connect(thumb, SIGNAL(destroyed(QObject*)), SLOT(thumbnailDestroyed(QObject*))); + connect(thumb, &QObject::destroyed, this, &EffectWindowImpl::thumbnailDestroyed); connect(thumb, &WindowThumbnailItem::wIdChanged, this, &EffectWindowImpl::thumbnailTargetChanged); } else if (DesktopThumbnailItem *desktopThumb = qobject_cast(item)) { m_desktopThumbnails.append(desktopThumb); - connect(desktopThumb, SIGNAL(destroyed(QObject*)), SLOT(desktopThumbnailDestroyed(QObject*))); + connect(desktopThumb, &QObject::destroyed, this, &EffectWindowImpl::desktopThumbnailDestroyed); } } @@ -2182,7 +2182,7 @@ EffectFrameImpl::EffectFrameImpl(EffectFrameStyle style, bool staticSize, QPoint if (m_style == EffectFrameStyled) { m_frame.setImagePath(QStringLiteral("widgets/background")); m_frame.setCacheAllRenderedFrames(true); - connect(m_theme, SIGNAL(themeChanged()), this, SLOT(plasmaThemeChanged())); + connect(m_theme, &Plasma::Theme::themeChanged, this, &EffectFrameImpl::plasmaThemeChanged); } m_selection.setImagePath(QStringLiteral("widgets/viewitem")); m_selection.setElementPrefix(QStringLiteral("hover")); diff --git a/effects/magnifier/magnifier.cpp b/effects/magnifier/magnifier.cpp index 8882ac130..8c2176ef1 100644 --- a/effects/magnifier/magnifier.cpp +++ b/effects/magnifier/magnifier.cpp @@ -41,17 +41,17 @@ MagnifierEffect::MagnifierEffect() { initConfig(); QAction* a; - a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this); + a = KStandardAction::zoomIn(this, &MagnifierEffect::zoomIn, this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Equal); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Equal); effects->registerGlobalShortcut(Qt::META + Qt::Key_Equal, a); - a = KStandardAction::zoomOut(this, SLOT(zoomOut()), this); + a = KStandardAction::zoomOut(this, &MagnifierEffect::zoomOut, this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_Minus); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_Minus); effects->registerGlobalShortcut(Qt::META + Qt::Key_Minus, a); - a = KStandardAction::actualSize(this, SLOT(toggle()), this); + a = KStandardAction::actualSize(this, &MagnifierEffect::toggle, this); KGlobalAccel::self()->setDefaultShortcut(a, QList() << Qt::META + Qt::Key_0); KGlobalAccel::self()->setShortcut(a, QList() << Qt::META + Qt::Key_0); effects->registerGlobalShortcut(Qt::META + Qt::Key_0, a); diff --git a/events.cpp b/events.cpp index eb3572d13..f1f497e16 100644 --- a/events.cpp +++ b/events.cpp @@ -1290,7 +1290,7 @@ bool Unmanaged::windowEvent(xcb_generic_event_t *e) // It's of course still possible that we miss the destroy in which case non-fatal // X errors are reported to the event loop and logged by Qt. m_scheduledRelease = true; - QTimer::singleShot(1, this, SLOT(release())); + QTimer::singleShot(1, this, [this]() { release(); }); break; } case XCB_CONFIGURE_NOTIFY: diff --git a/kcmkwin/kwinrules/rulesdialog.cpp b/kcmkwin/kwinrules/rulesdialog.cpp index 370ff673c..d6ee4937d 100644 --- a/kcmkwin/kwinrules/rulesdialog.cpp +++ b/kcmkwin/kwinrules/rulesdialog.cpp @@ -42,8 +42,8 @@ RulesDialog::RulesDialog(QWidget* parent, const char* name) layout()->addWidget(m_quickWidget); QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); - connect(buttons, SIGNAL(accepted()), SLOT(accept())); - connect(buttons, SIGNAL(rejected()), SLOT(reject())); + connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject); layout()->addWidget(buttons); } diff --git a/kcmkwin/kwinscreenedges/kwinscreenedge.h b/kcmkwin/kwinscreenedges/kwinscreenedge.h index 48bd73cc2..e56258e1c 100644 --- a/kcmkwin/kwinscreenedges/kwinscreenedge.h +++ b/kcmkwin/kwinscreenedges/kwinscreenedge.h @@ -48,7 +48,7 @@ public: // reset to default settings and assess for saveNeeded and default changed virtual void setDefaults(); -private Q_SLOTS: +public Q_SLOTS: void onChanged(); void createConnection(); diff --git a/kcmkwin/kwinscreenedges/kwinscreenedgeconfigform.cpp b/kcmkwin/kwinscreenedges/kwinscreenedgeconfigform.cpp index 86e8a04b2..c31e96763 100644 --- a/kcmkwin/kwinscreenedges/kwinscreenedgeconfigform.cpp +++ b/kcmkwin/kwinscreenedges/kwinscreenedgeconfigform.cpp @@ -20,14 +20,14 @@ KWinScreenEdgesConfigForm::KWinScreenEdgesConfigForm(QWidget *parent) { ui->setupUi(this); - connect(ui->kcfg_ElectricBorderDelay, SIGNAL(valueChanged(int)), this, SLOT(sanitizeCooldown())); + connect(ui->kcfg_ElectricBorderDelay, qOverload(&QSpinBox::valueChanged), this, &KWinScreenEdgesConfigForm::sanitizeCooldown); // Visual feedback of action group conflicts - connect(ui->kcfg_ElectricBorders, SIGNAL(currentIndexChanged(int)), this, SLOT(groupChanged())); - connect(ui->kcfg_ElectricBorderMaximize, SIGNAL(stateChanged(int)), this, SLOT(groupChanged())); - connect(ui->kcfg_ElectricBorderTiling, SIGNAL(stateChanged(int)), this, SLOT(groupChanged())); + connect(ui->kcfg_ElectricBorders, qOverload(&QComboBox::currentIndexChanged), this, &KWinScreenEdgesConfigForm::groupChanged); + connect(ui->kcfg_ElectricBorderMaximize, &QCheckBox::stateChanged, this, &KWinScreenEdgesConfigForm::groupChanged); + connect(ui->kcfg_ElectricBorderTiling, &QCheckBox::stateChanged, this, &KWinScreenEdgesConfigForm::groupChanged); - connect(ui->electricBorderCornerRatioSpin, SIGNAL(valueChanged(int)), this, SLOT(onChanged())); + connect(ui->electricBorderCornerRatioSpin, qOverload(&QSpinBox::valueChanged), this, &KWinScreenEdgesConfigForm::onChanged); } KWinScreenEdgesConfigForm::~KWinScreenEdgesConfigForm() diff --git a/kcmkwin/kwintabbox/kwintabboxconfigform.cpp b/kcmkwin/kwintabbox/kwintabboxconfigform.cpp index 3840fde68..d8db88c08 100644 --- a/kcmkwin/kwintabbox/kwintabboxconfigform.cpp +++ b/kcmkwin/kwintabbox/kwintabboxconfigform.cpp @@ -39,29 +39,29 @@ KWinTabBoxConfigForm::KWinTabBoxConfigForm(TabboxType type, QWidget *parent) connect(ui->effectConfigButton, &QPushButton::clicked, this, &KWinTabBoxConfigForm::effectConfigButtonClicked); - connect(ui->kcfg_ShowTabBox, SIGNAL(clicked(bool)), SLOT(tabBoxToggled(bool))); + connect(ui->kcfg_ShowTabBox, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::tabBoxToggled); - connect(ui->filterScreens, SIGNAL(clicked(bool)), SLOT(onFilterScreen())); - connect(ui->currentScreen, SIGNAL(clicked(bool)), SLOT(onFilterScreen())); - connect(ui->otherScreens, SIGNAL(clicked(bool)), SLOT(onFilterScreen())); + connect(ui->filterScreens, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterScreen); + connect(ui->currentScreen, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterScreen); + connect(ui->otherScreens, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterScreen); - connect(ui->filterDesktops, SIGNAL(clicked(bool)), SLOT(onFilterDesktop())); - connect(ui->currentDesktop, SIGNAL(clicked(bool)), SLOT(onFilterDesktop())); - connect(ui->otherDesktops, SIGNAL(clicked(bool)), SLOT(onFilterDesktop())); + connect(ui->filterDesktops, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterDesktop); + connect(ui->currentDesktop, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterDesktop); + connect(ui->otherDesktops, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterDesktop); - connect(ui->filterActivities, SIGNAL(clicked(bool)), SLOT(onFilterActivites())); - connect(ui->currentActivity, SIGNAL(clicked(bool)), SLOT(onFilterActivites())); - connect(ui->otherActivities, SIGNAL(clicked(bool)), SLOT(onFilterActivites())); + connect(ui->filterActivities, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterActivites); + connect(ui->currentActivity, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterActivites); + connect(ui->otherActivities, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterActivites); - connect(ui->filterMinimization, SIGNAL(clicked(bool)), SLOT(onFilterMinimization())); - connect(ui->visibleWindows, SIGNAL(clicked(bool)), SLOT(onFilterMinimization())); - connect(ui->hiddenWindows, SIGNAL(clicked(bool)), SLOT(onFilterMinimization())); + connect(ui->filterMinimization, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterMinimization); + connect(ui->visibleWindows, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterMinimization); + connect(ui->hiddenWindows, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterMinimization); - connect(ui->oneAppWindow, SIGNAL(clicked(bool)), SLOT(onApplicationMode())); - connect(ui->showDesktop, SIGNAL(clicked(bool)), SLOT(onShowDesktopMode())); + connect(ui->oneAppWindow, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onApplicationMode); + connect(ui->showDesktop, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onShowDesktopMode); - connect(ui->switchingModeCombo, SIGNAL(currentIndexChanged(int)), SLOT(onSwitchingMode())); - connect(ui->effectCombo, SIGNAL(currentIndexChanged(int)), SLOT(onEffectCombo())); + connect(ui->switchingModeCombo, qOverload(&QComboBox::currentIndexChanged), this, &KWinTabBoxConfigForm::onSwitchingMode); + connect(ui->effectCombo, qOverload(&QComboBox::currentIndexChanged), this, &KWinTabBoxConfigForm::onEffectCombo); auto addShortcut = [this](const char *name, KKeySequenceWidget *widget, const QKeySequence &sequence = QKeySequence()) { QAction *a = m_actionCollection->addAction(name); @@ -69,7 +69,7 @@ KWinTabBoxConfigForm::KWinTabBoxConfigForm(TabboxType type, QWidget *parent) widget->setProperty("shortcutAction", name); a->setText(i18n(name)); KGlobalAccel::self()->setShortcut(a, QList() << sequence); - connect(widget, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(shortcutChanged(QKeySequence))); + connect(widget, &KKeySequenceWidget::keySequenceChanged, this, &KWinTabBoxConfigForm::shortcutChanged); }; // Shortcut config. The shortcut belongs to the component "kwin"! diff --git a/kcmkwin/kwintabbox/main.cpp b/kcmkwin/kwintabbox/main.cpp index 73cd8d7a7..b8bf6f466 100644 --- a/kcmkwin/kwintabbox/main.cpp +++ b/kcmkwin/kwintabbox/main.cpp @@ -66,7 +66,7 @@ KWinTabBoxConfig::KWinTabBoxConfig(QWidget* parent, const QVariantList& args) tabWidget->addTab(m_alternativeTabBoxUi, i18n("Alternative")); QPushButton* ghnsButton = new QPushButton(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")), i18n("Get New Task Switchers...")); - connect(ghnsButton, SIGNAL(clicked(bool)), SLOT(slotGHNS())); + connect(ghnsButton, &QAbstractButton::clicked, this, &KWinTabBoxConfig::slotGHNS); QHBoxLayout* buttonBar = new QHBoxLayout(); QSpacerItem* buttonBarSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); @@ -219,16 +219,16 @@ void KWinTabBoxConfig::setEnabledUi(KWinTabBoxConfigForm *form, const TabBoxSett void KWinTabBoxConfig::createConnections(KWinTabBoxConfigForm *form) { - connect(form, SIGNAL(effectConfigButtonClicked()), this, SLOT(configureEffectClicked())); + connect(form, &KWinTabBoxConfigForm::effectConfigButtonClicked, this, &KWinTabBoxConfig::configureEffectClicked); - connect(form, SIGNAL(filterScreenChanged(int)), this, SLOT(updateUnmanagedState())); - connect(form, SIGNAL(filterDesktopChanged(int)), this, SLOT(updateUnmanagedState())); - connect(form, SIGNAL(filterActivitiesChanged(int)), this, SLOT(updateUnmanagedState())); - connect(form, SIGNAL(filterMinimizationChanged(int)), this, SLOT(updateUnmanagedState())); - connect(form, SIGNAL(applicationModeChanged(int)), this, SLOT(updateUnmanagedState())); - connect(form, SIGNAL(showDesktopModeChanged(int)), this, SLOT(updateUnmanagedState())); - connect(form, SIGNAL(switchingModeChanged(int)), this, SLOT(updateUnmanagedState())); - connect(form, SIGNAL(layoutNameChanged(QString)), this, SLOT(updateUnmanagedState())); + connect(form, &KWinTabBoxConfigForm::filterScreenChanged, this, &KWinTabBoxConfig::updateUnmanagedState); + connect(form, &KWinTabBoxConfigForm::filterDesktopChanged, this, &KWinTabBoxConfig::updateUnmanagedState); + connect(form, &KWinTabBoxConfigForm::filterActivitiesChanged, this, &KWinTabBoxConfig::updateUnmanagedState); + connect(form, &KWinTabBoxConfigForm::filterMinimizationChanged, this, &KWinTabBoxConfig::updateUnmanagedState); + connect(form, &KWinTabBoxConfigForm::applicationModeChanged, this, &KWinTabBoxConfig::updateUnmanagedState); + connect(form, &KWinTabBoxConfigForm::showDesktopModeChanged, this, &KWinTabBoxConfig::updateUnmanagedState); + connect(form, &KWinTabBoxConfigForm::switchingModeChanged, this, &KWinTabBoxConfig::updateUnmanagedState); + connect(form, &KWinTabBoxConfigForm::layoutNameChanged, this, &KWinTabBoxConfig::updateUnmanagedState); } void KWinTabBoxConfig::updateUnmanagedState() @@ -432,8 +432,8 @@ void KWinTabBoxConfig::configureEffectClicked() configDialog->setLayout(new QVBoxLayout); configDialog->setWindowTitle(form->effectComboCurrentData(Qt::DisplayRole).toString()); QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults, configDialog); - connect(buttonBox, SIGNAL(accepted()), configDialog, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), configDialog, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, configDialog.data(), &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, configDialog.data(), &QDialog::reject); const QString name = form->effectComboCurrentData().toString(); KCModule *kcm = KPluginTrader::createInstanceFromQuery(QStringLiteral("kwin/effects/configs/"), QString(), diff --git a/main.h b/main.h index a6bf43d04..43ffb6a90 100644 --- a/main.h +++ b/main.h @@ -113,6 +113,7 @@ public: static void setCrashCount(int count); static bool wasCrash(); + void resetCrashesCount(); /** * Creates the KAboutData object for the KWin instance and registers it as @@ -237,9 +238,6 @@ protected: protected: static int crashes; -private Q_SLOTS: - void resetCrashesCount(); - private: QScopedPointer m_eventFilter; bool m_configLock; diff --git a/main_x11.cpp b/main_x11.cpp index ea5306456..1f356d4fd 100644 --- a/main_x11.cpp +++ b/main_x11.cpp @@ -224,7 +224,7 @@ void ApplicationX11::performStartup() fputs(i18n("kwin: unable to claim manager selection, another wm running? (try using --replace)\n").toLocal8Bit().constData(), stderr); ::exit(1); }); - connect(owner.data(), SIGNAL(lostOwnership()), SLOT(lostSelection())); + connect(owner.data(), &KSelectionOwner::lostOwnership, this, &ApplicationX11::lostSelection); connect(owner.data(), &KSelectionOwner::claimedOwnership, [this]{ installNativeX11EventFilter(); // first load options - done internally by a different thread @@ -311,7 +311,7 @@ void ApplicationX11::crashChecking() compgroup.writeEntry("Enabled", false); } // Reset crashes count if we stay up for more that 15 seconds - QTimer::singleShot(15 * 1000, this, SLOT(resetCrashesCount())); + QTimer::singleShot(15 * 1000, this, &Application::resetCrashesCount); } void ApplicationX11::notifyKSplash() diff --git a/outline.cpp b/outline.cpp index 66415d1fa..154362512 100644 --- a/outline.cpp +++ b/outline.cpp @@ -33,7 +33,7 @@ Outline::Outline(QObject *parent) : QObject(parent) , m_active(false) { - connect(Compositor::self(), SIGNAL(compositingToggled(bool)), SLOT(compositingChanged())); + connect(Compositor::self(), &Compositor::compositingToggled, this, &Outline::compositingChanged); } Outline::~Outline() diff --git a/plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp b/plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp index d3af48503..d44c997ec 100644 --- a/plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp +++ b/plugins/kdecorations/aurorae/src/lib/auroraetheme.cpp @@ -73,8 +73,8 @@ AuroraeTheme::AuroraeTheme(QObject* parent) : QObject(parent) , d(new AuroraeThemePrivate) { - connect(this, SIGNAL(themeChanged()), SIGNAL(borderSizesChanged())); - connect(this, SIGNAL(buttonSizesChanged()), SIGNAL(borderSizesChanged())); + connect(this, &AuroraeTheme::themeChanged, this, &AuroraeTheme::borderSizesChanged); + connect(this, &AuroraeTheme::buttonSizesChanged, this, &AuroraeTheme::borderSizesChanged); } AuroraeTheme::~AuroraeTheme() diff --git a/plugins/platforms/x11/standalone/x11cursor.cpp b/plugins/platforms/x11/standalone/x11cursor.cpp index ad61221a4..40a8a9dac 100644 --- a/plugins/platforms/x11/standalone/x11cursor.cpp +++ b/plugins/platforms/x11/standalone/x11cursor.cpp @@ -32,10 +32,10 @@ X11Cursor::X11Cursor(QObject *parent, bool xInputSupport) { Cursors::self()->setMouse(this); m_resetTimeStampTimer->setSingleShot(true); - connect(m_resetTimeStampTimer, SIGNAL(timeout()), SLOT(resetTimeStamp())); + connect(m_resetTimeStampTimer, &QTimer::timeout, this, &X11Cursor::resetTimeStamp); // TODO: How often do we really need to poll? m_mousePollingTimer->setInterval(50); - connect(m_mousePollingTimer, SIGNAL(timeout()), SLOT(mousePolled())); + connect(m_mousePollingTimer, &QTimer::timeout, this, &X11Cursor::mousePolled); connect(this, &Cursor::themeChanged, this, [this] { m_cursors.clear(); }); diff --git a/pointer_input.cpp b/pointer_input.cpp index 289fe20bb..4812a11d3 100644 --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -1407,9 +1407,10 @@ InputRedirectionCursor::InputRedirectionCursor(QObject *parent) , m_currentButtons(Qt::NoButton) { Cursors::self()->setMouse(this); - connect(input(), SIGNAL(globalPointerChanged(QPointF)), SLOT(slotPosChanged(QPointF))); - connect(input(), SIGNAL(pointerButtonStateChanged(uint32_t,InputRedirection::PointerButtonState)), - SLOT(slotPointerButtonChanged())); + connect(input(), &InputRedirection::globalPointerChanged, + this, &InputRedirectionCursor::slotPosChanged); + connect(input(), &InputRedirection::pointerButtonStateChanged, + this, &InputRedirectionCursor::slotPointerButtonChanged); #ifndef KCMRULES connect(input(), &InputRedirection::keyboardModifiersChanged, this, &InputRedirectionCursor::slotModifiersChanged); diff --git a/rules.cpp b/rules.cpp index a37c5dbd4..2db13454d 100644 --- a/rules.cpp +++ b/rules.cpp @@ -928,7 +928,7 @@ RuleBook::RuleBook(QObject *parent) initializeX11(); connect(kwinApp(), &Application::x11ConnectionChanged, this, &RuleBook::initializeX11); connect(kwinApp(), &Application::x11ConnectionAboutToBeDestroyed, this, &RuleBook::cleanupX11); - connect(m_updateTimer, SIGNAL(timeout()), SLOT(save())); + connect(m_updateTimer, &QTimer::timeout, this, &RuleBook::save); m_updateTimer->setInterval(1000); m_updateTimer->setSingleShot(true); } @@ -946,7 +946,7 @@ void RuleBook::initializeX11() return; } m_temporaryRulesMessages.reset(new KXMessages(c, kwinApp()->x11RootWindow(), "_KDE_NET_WM_TEMPORARY_RULES", nullptr)); - connect(m_temporaryRulesMessages.data(), SIGNAL(gotMessage(QString)), SLOT(temporaryRulesMessage(QString))); + connect(m_temporaryRulesMessages.data(), &KXMessages::gotMessage, this, &RuleBook::temporaryRulesMessage); } void RuleBook::cleanupX11() @@ -1047,7 +1047,7 @@ void RuleBook::temporaryRulesMessage(const QString& message) Rules* rule = new Rules(message, true); m_rules.prepend(rule); // highest priority first if (!was_temporary) - QTimer::singleShot(60000, this, SLOT(cleanupTemporaryRules())); + QTimer::singleShot(60000, this, &RuleBook::cleanupTemporaryRules); } void RuleBook::cleanupTemporaryRules() @@ -1065,7 +1065,7 @@ void RuleBook::cleanupTemporaryRules() } } if (has_temporary) - QTimer::singleShot(60000, this, SLOT(cleanupTemporaryRules())); + QTimer::singleShot(60000, this, &RuleBook::cleanupTemporaryRules); } void RuleBook::discardUsed(AbstractClient* c, bool withdrawn) diff --git a/scene.cpp b/scene.cpp index 9b346e14c..cb121ef10 100644 --- a/scene.cpp +++ b/scene.cpp @@ -406,7 +406,7 @@ void Scene::addToplevel(Toplevel *c) Scene::Window *w = createWindow(c); m_windows[ c ] = w; - connect(c, SIGNAL(windowClosed(KWin::Toplevel*,KWin::Deleted*)), SLOT(windowClosed(KWin::Toplevel*,KWin::Deleted*))); + connect(c, &Toplevel::windowClosed, this, &Scene::windowClosed); if (c->surface()) { // We generate window quads for sub-surfaces so it's quite important to discard // the pixmap tree and cached window quads when the sub-surface tree is changed. diff --git a/screenedge.cpp b/screenedge.cpp index 9f8cfebc9..db6190081 100644 --- a/screenedge.cpp +++ b/screenedge.cpp @@ -117,7 +117,7 @@ void Edge::reserve() void Edge::reserve(QObject *object, const char *slot) { - connect(object, SIGNAL(destroyed(QObject*)), SLOT(unreserve(QObject*))); + connect(object, &QObject::destroyed, this, qOverload(&Edge::unreserve)); m_callBacks.insert(object, QByteArray(slot)); reserve(); } @@ -158,7 +158,7 @@ void Edge::unreserve(QObject *object) { if (m_callBacks.contains(object)) { m_callBacks.remove(object); - disconnect(object, SIGNAL(destroyed(QObject*)), this, SLOT(unreserve(QObject*))); + disconnect(object, &QObject::destroyed, this, qOverload(&Edge::unreserve)); unreserve(); } } @@ -1136,9 +1136,9 @@ Edge *ScreenEdges::createEdge(ElectricBorder border, int x, int y, int width, in } } } - connect(edge, SIGNAL(approaching(ElectricBorder,qreal,QRect)), SIGNAL(approaching(ElectricBorder,qreal,QRect))); + connect(edge, &Edge::approaching, this, &ScreenEdges::approaching); if (edge->isScreenEdge()) { - connect(this, SIGNAL(checkBlocking()), edge, SLOT(checkBlocking())); + connect(this, &ScreenEdges::checkBlocking, edge, &Edge::checkBlocking); } return edge; } diff --git a/screenlockerwatcher.cpp b/screenlockerwatcher.cpp index 44d148e3a..87f5c91c0 100644 --- a/screenlockerwatcher.cpp +++ b/screenlockerwatcher.cpp @@ -40,13 +40,15 @@ ScreenLockerWatcher::~ScreenLockerWatcher() void ScreenLockerWatcher::initialize() { - connect(m_serviceWatcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)), SLOT(serviceOwnerChanged(QString,QString,QString))); + connect(m_serviceWatcher, &QDBusServiceWatcher::serviceOwnerChanged, this, &ScreenLockerWatcher::serviceOwnerChanged); m_serviceWatcher->setWatchMode(QDBusServiceWatcher::WatchForOwnerChange); m_serviceWatcher->addWatchedService(SCREEN_LOCKER_SERVICE_NAME); // check whether service is registered QFutureWatcher > *watcher = new QFutureWatcher >(this); - connect(watcher, SIGNAL(finished()), SLOT(serviceRegisteredQueried())); - connect(watcher, SIGNAL(canceled()), watcher, SLOT(deleteLater())); + connect(watcher, &QFutureWatcher>::finished, + this, &ScreenLockerWatcher::serviceRegisteredQueried); + connect(watcher, &QFutureWatcher>::canceled, + watcher, &QFutureWatcher>::deleteLater); watcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::isServiceRegistered, SCREEN_LOCKER_SERVICE_NAME)); @@ -67,9 +69,11 @@ void ScreenLockerWatcher::serviceOwnerChanged(const QString &serviceName, const if (!newOwner.isEmpty()) { m_interface = new OrgFreedesktopScreenSaverInterface(newOwner, QStringLiteral("/ScreenSaver"), QDBusConnection::sessionBus(), this); m_kdeInterface = new OrgKdeScreensaverInterface(newOwner, QStringLiteral("/ScreenSaver"), QDBusConnection::sessionBus(), this); - connect(m_interface, SIGNAL(ActiveChanged(bool)), SLOT(setLocked(bool))); + connect(m_interface, &OrgFreedesktopScreenSaverInterface::ActiveChanged, + this, &ScreenLockerWatcher::setLocked); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(m_interface->GetActive(), this); - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(activeQueried(QDBusPendingCallWatcher*))); + connect(watcher, &QDBusPendingCallWatcher::finished, + this, &ScreenLockerWatcher::activeQueried); connect(m_kdeInterface, &OrgKdeScreensaverInterface::AboutToLock, this, &ScreenLockerWatcher::aboutToLock); } } @@ -83,8 +87,10 @@ void ScreenLockerWatcher::serviceRegisteredQueried() const QDBusReply &reply = watcher->result(); if (reply.isValid() && reply.value()) { QFutureWatcher > *ownerWatcher = new QFutureWatcher >(this); - connect(ownerWatcher, SIGNAL(finished()), SLOT(serviceOwnerQueried())); - connect(ownerWatcher, SIGNAL(canceled()), ownerWatcher, SLOT(deleteLater())); + connect(ownerWatcher, &QFutureWatcher>::finished, + this, &ScreenLockerWatcher::serviceOwnerQueried); + connect(ownerWatcher, &QFutureWatcher>::canceled, + ownerWatcher, &QFutureWatcher>::deleteLater); ownerWatcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(), &QDBusConnectionInterface::serviceOwner, SCREEN_LOCKER_SERVICE_NAME)); diff --git a/screens.cpp b/screens.cpp index 7909a7e2d..81954f49f 100644 --- a/screens.cpp +++ b/screens.cpp @@ -56,8 +56,8 @@ void Screens::init() { m_changedTimer->setSingleShot(true); m_changedTimer->setInterval(100); - connect(m_changedTimer, SIGNAL(timeout()), SLOT(updateCount())); - connect(m_changedTimer, SIGNAL(timeout()), SIGNAL(changed())); + connect(m_changedTimer, &QTimer::timeout, this, &Screens::updateCount); + connect(m_changedTimer, &QTimer::timeout, this, &Screens::changed); connect(this, &Screens::countChanged, this, &Screens::changed, Qt::QueuedConnection); connect(this, &Screens::changed, this, &Screens::updateSize); connect(this, &Screens::sizeChanged, this, &Screens::geometryChanged); diff --git a/scripting/scriptedeffect.cpp b/scripting/scriptedeffect.cpp index a63b3cf56..eb7dce680 100644 --- a/scripting/scriptedeffect.cpp +++ b/scripting/scriptedeffect.cpp @@ -580,7 +580,7 @@ ScriptedEffect::ScriptedEffect() , m_chainPosition(0) { Q_ASSERT(effects); - connect(m_engine, SIGNAL(signalHandlerException(QScriptValue)), SLOT(signalHandlerException(QScriptValue))); + connect(m_engine, &QScriptEngine::signalHandlerException, this, &ScriptedEffect::signalHandlerException); connect(effects, &EffectsHandler::activeFullScreenEffectChanged, this, [this]() { Effect* fullScreenEffect = effects->activeFullScreenEffect(); if (fullScreenEffect == m_activeFullScreenEffect) { @@ -809,7 +809,7 @@ void ScriptedEffect::reconfigure(ReconfigureFlags flags) void ScriptedEffect::registerShortcut(QAction *a, QScriptValue callback) { m_shortcutCallbacks.insert(a, callback); - connect(a, SIGNAL(triggered(bool)), SLOT(globalShortcutTriggered())); + connect(a, &QAction::triggered, this, &ScriptedEffect::globalShortcutTriggered); } void ScriptedEffect::globalShortcutTriggered() diff --git a/scripting/scripting.cpp b/scripting/scripting.cpp index 6d9500af6..7f3b2fe9d 100644 --- a/scripting/scripting.cpp +++ b/scripting/scripting.cpp @@ -211,7 +211,7 @@ QScriptValue kwinCallDBus(QScriptContext *context, QScriptEngine *engine) // with a callback QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(QDBusConnection::sessionBus().asyncCall(msg), script); watcher->setProperty("callback", script->registerCallback(context->argument(context->argumentCount()-1))); - QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), script, SLOT(slotPendingDBusCall(QDBusPendingCallWatcher*))); + QObject::connect(watcher, &QDBusPendingCallWatcher::finished, script, &KWin::AbstractScript::slotPendingDBusCall); } return engine->undefinedValue(); } @@ -251,7 +251,7 @@ void KWin::AbstractScript::printMessage(const QString &message) void KWin::AbstractScript::registerShortcut(QAction *a, QScriptValue callback) { m_shortcutCallbacks.insert(a, callback); - connect(a, SIGNAL(triggered(bool)), SLOT(globalShortcutTriggered())); + connect(a, &QAction::triggered, this, &AbstractScript::globalShortcutTriggered); } void KWin::AbstractScript::globalShortcutTriggered() @@ -405,8 +405,8 @@ QAction *KWin::AbstractScript::createAction(const QString &title, bool checkable action->setChecked(checked); // TODO: rename m_shortcutCallbacks m_shortcutCallbacks.insert(action, callback); - connect(action, SIGNAL(triggered(bool)), SLOT(globalShortcutTriggered())); - connect(action, SIGNAL(destroyed(QObject*)), SLOT(actionDestroyed(QObject*))); + connect(action, &QAction::triggered, this, &AbstractScript::globalShortcutTriggered); + connect(action, &QObject::destroyed, this, &AbstractScript::actionDestroyed); return action; } @@ -462,7 +462,7 @@ void KWin::Script::run() m_starting = true; QFutureWatcher *watcher = new QFutureWatcher(this); - connect(watcher, SIGNAL(finished()), SLOT(slotScriptLoadedFromFile())); + connect(watcher, &QFutureWatcherBase::finished, this, &Script::slotScriptLoadedFromFile); watcher->setFuture(QtConcurrent::run(this, &KWin::Script::loadScriptFromFile, fileName())); } @@ -501,7 +501,7 @@ void KWin::Script::slotScriptLoadedFromFile() QScriptEngine::ExcludeSuperClassContents | QScriptEngine::ExcludeDeleteLater); m_engine->globalObject().setProperty(QStringLiteral("options"), optionsValue, QScriptValue::Undeletable); m_engine->globalObject().setProperty(QStringLiteral("QTimer"), constructTimerClass(m_engine)); - QObject::connect(m_engine, SIGNAL(signalHandlerException(QScriptValue)), this, SLOT(sigException(QScriptValue))); + QObject::connect(m_engine, &QScriptEngine::signalHandlerException, this, &Script::sigException); KWin::MetaScripting::supplyConfig(m_engine); installScriptFunctions(m_engine); @@ -684,8 +684,8 @@ KWin::Scripting::Scripting(QObject *parent) { init(); QDBusConnection::sessionBus().registerObject(QStringLiteral("/Scripting"), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables); - connect(Workspace::self(), SIGNAL(configChanged()), SLOT(start())); - connect(Workspace::self(), SIGNAL(workspaceInitialized()), SLOT(start())); + connect(Workspace::self(), &Workspace::configChanged, this, &Scripting::start); + connect(Workspace::self(), &Workspace::workspaceInitialized, this, &Scripting::start); } void KWin::Scripting::init() @@ -719,7 +719,7 @@ void KWin::Scripting::start() // TODO make this threaded again once KConfigGroup is sufficiently thread safe, bug #305361 and friends // perform querying for the services in a thread QFutureWatcher *watcher = new QFutureWatcher(this); - connect(watcher, SIGNAL(finished()), this, SLOT(slotScriptsQueried())); + connect(watcher, &QFutureWatcher::finished, this, &Scripting::slotScriptsQueried); watcher->setFuture(QtConcurrent::run(this, &KWin::Scripting::queryScriptsToLoad, pluginStates, offers)); #else LoadScriptList scriptsToLoad = queryScriptsToLoad(); @@ -853,7 +853,7 @@ int KWin::Scripting::loadScript(const QString &filePath, const QString& pluginNa } const int id = scripts.size(); KWin::Script *script = new KWin::Script(id, filePath, pluginName, this); - connect(script, SIGNAL(destroyed(QObject*)), SLOT(scriptDestroyed(QObject*))); + connect(script, &QObject::destroyed, this, &Scripting::scriptDestroyed); scripts.append(script); return id; } @@ -866,7 +866,7 @@ int KWin::Scripting::loadDeclarativeScript(const QString& filePath, const QStrin } const int id = scripts.size(); KWin::DeclarativeScript *script = new KWin::DeclarativeScript(id, filePath, pluginName, this); - connect(script, SIGNAL(destroyed(QObject*)), SLOT(scriptDestroyed(QObject*))); + connect(script, &QObject::destroyed, this, &Scripting::scriptDestroyed); scripts.append(script); return id; } diff --git a/scripting/scripting_model.cpp b/scripting/scripting_model.cpp index 2e72f0704..ac8195526 100644 --- a/scripting/scripting_model.cpp +++ b/scripting/scripting_model.cpp @@ -35,7 +35,7 @@ ClientLevel::ClientLevel(ClientModel *model, AbstractLevel *parent) connect(VirtualDesktopManager::self(), &VirtualDesktopManager::currentChanged, this, &ClientLevel::reInit); connect(Workspace::self(), &Workspace::clientAdded, this, &ClientLevel::clientAdded); connect(Workspace::self(), &Workspace::clientRemoved, this, &ClientLevel::clientRemoved); - connect(model, SIGNAL(exclusionsChanged()), SLOT(reInit())); + connect(model, &ClientModel::exclusionsChanged, this, &ClientLevel::reInit); } ClientLevel::~ClientLevel() @@ -400,12 +400,12 @@ ForkLevel::ForkLevel(const QList &childRestrictio : AbstractLevel(model, parent) , m_childRestrictions(childRestrictions) { - connect(VirtualDesktopManager::self(), SIGNAL(countChanged(uint,uint)), SLOT(desktopCountChanged(uint,uint))); - connect(screens(), SIGNAL(countChanged(int,int)), SLOT(screenCountChanged(int,int))); + connect(VirtualDesktopManager::self(), &VirtualDesktopManager::countChanged, this, &ForkLevel::desktopCountChanged); + connect(screens(), &Screens::countChanged, this, &ForkLevel::screenCountChanged); #ifdef KWIN_BUILD_ACTIVITIES if (Activities *activities = Activities::self()) { - connect(activities, SIGNAL(added(QString)), SLOT(activityAdded(QString))); - connect(activities, SIGNAL(removed(QString)), SLOT(activityRemoved(QString))); + connect(activities, &Activities::added, this, &ForkLevel::activityAdded); + connect(activities, &Activities::removed, this, &ForkLevel::activityRemoved); } #endif } @@ -531,10 +531,10 @@ int ForkLevel::count() const void ForkLevel::addChild(AbstractLevel *child) { m_children.append(child); - connect(child, SIGNAL(beginInsert(int,int,quint32)), SIGNAL(beginInsert(int,int,quint32))); - connect(child, SIGNAL(beginRemove(int,int,quint32)), SIGNAL(beginRemove(int,int,quint32))); - connect(child, SIGNAL(endInsert()), SIGNAL(endInsert())); - connect(child, SIGNAL(endRemove()), SIGNAL(endRemove())); + connect(child, &AbstractLevel::beginInsert, this, &AbstractLevel::beginInsert); + connect(child, &AbstractLevel::beginRemove, this, &AbstractLevel::beginRemove); + connect(child, &AbstractLevel::endInsert, this, &AbstractLevel::endInsert); + connect(child, &AbstractLevel::endRemove, this, &AbstractLevel::endRemove); } void ForkLevel::setActivity(const QString &activity) @@ -654,10 +654,10 @@ void ClientModel::setLevels(QList< ClientModel::LevelRestriction > restrictions) delete m_root; } m_root = AbstractLevel::create(restrictions, NoRestriction, this); - connect(m_root, SIGNAL(beginInsert(int,int,quint32)), SLOT(levelBeginInsert(int,int,quint32))); - connect(m_root, SIGNAL(beginRemove(int,int,quint32)), SLOT(levelBeginRemove(int,int,quint32))); - connect(m_root, SIGNAL(endInsert()), SLOT(levelEndInsert())); - connect(m_root, SIGNAL(endRemove()), SLOT(levelEndRemove())); + connect(m_root, &AbstractLevel::beginInsert, this, &ClientModel::levelBeginInsert); + connect(m_root, &AbstractLevel::beginRemove, this, &ClientModel::levelBeginRemove); + connect(m_root, &AbstractLevel::endInsert, this, &ClientModel::levelEndInsert); + connect(m_root, &AbstractLevel::endRemove, this, &ClientModel::levelEndRemove); m_root->init(); endResetModel(); } diff --git a/scripting/workspace_wrapper.cpp b/scripting/workspace_wrapper.cpp index 9be305ade..57016cd3f 100644 --- a/scripting/workspace_wrapper.cpp +++ b/scripting/workspace_wrapper.cpp @@ -34,16 +34,16 @@ WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent) connect(ws, &Workspace::clientAdded, this, &WorkspaceWrapper::setupClientConnections); connect(ws, &Workspace::clientRemoved, this, &WorkspaceWrapper::clientRemoved); connect(ws, &Workspace::clientActivated, this, &WorkspaceWrapper::clientActivated); - connect(vds, SIGNAL(countChanged(uint,uint)), SIGNAL(numberDesktopsChanged(uint))); - connect(vds, SIGNAL(layoutChanged(int,int)), SIGNAL(desktopLayoutChanged())); + connect(vds, &VirtualDesktopManager::countChanged, this, &WorkspaceWrapper::numberDesktopsChanged); + connect(vds, &VirtualDesktopManager::layoutChanged, this, &WorkspaceWrapper::desktopLayoutChanged); connect(ws, &Workspace::clientDemandsAttentionChanged, this, &WorkspaceWrapper::clientDemandsAttentionChanged); #ifdef KWIN_BUILD_ACTIVITIES if (KWin::Activities *activities = KWin::Activities::self()) { - connect(activities, SIGNAL(currentChanged(QString)), SIGNAL(currentActivityChanged(QString))); - connect(activities, SIGNAL(added(QString)), SIGNAL(activitiesChanged(QString))); - connect(activities, SIGNAL(added(QString)), SIGNAL(activityAdded(QString))); - connect(activities, SIGNAL(removed(QString)), SIGNAL(activitiesChanged(QString))); - connect(activities, SIGNAL(removed(QString)), SIGNAL(activityRemoved(QString))); + connect(activities, &Activities::currentChanged, this, &WorkspaceWrapper::currentActivityChanged); + connect(activities, &Activities::added, this, &WorkspaceWrapper::activitiesChanged); + connect(activities, &Activities::added, this, &WorkspaceWrapper::activityAdded); + connect(activities, &Activities::removed, this, &WorkspaceWrapper::activitiesChanged); + connect(activities, &Activities::removed, this, &WorkspaceWrapper::activityRemoved); } #endif connect(screens(), &Screens::sizeChanged, this, &WorkspaceWrapper::virtualScreenSizeChanged); @@ -54,7 +54,7 @@ WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent) emit numberScreensChanged(currentCount); } ); - connect(QApplication::desktop(), SIGNAL(resized(int)), SIGNAL(screenResized(int))); + connect(QApplication::desktop(), &QDesktopWidget::resized, this, &WorkspaceWrapper::screenResized); foreach (KWin::X11Client *client, ws->clientList()) { setupClientConnections(client); } diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index 5d54f023e..9ab82a85d 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -65,11 +65,11 @@ TabBoxHandlerImpl::TabBoxHandlerImpl(TabBox* tabBox) { // connects for DesktopFocusChainManager VirtualDesktopManager *vds = VirtualDesktopManager::self(); - connect(vds, SIGNAL(countChanged(uint,uint)), m_desktopFocusChain, SLOT(resize(uint,uint))); - connect(vds, SIGNAL(currentChanged(uint,uint)), m_desktopFocusChain, SLOT(addDesktop(uint,uint))); + connect(vds, &VirtualDesktopManager::countChanged, m_desktopFocusChain, &DesktopChainManager::resize); + connect(vds, &VirtualDesktopManager::currentChanged, m_desktopFocusChain, &DesktopChainManager::addDesktop); #ifdef KWIN_BUILD_ACTIVITIES if (Activities::self()) { - connect(Activities::self(), SIGNAL(currentChanged(QString)), m_desktopFocusChain, SLOT(useChain(QString))); + connect(Activities::self(), &Activities::currentChanged, m_desktopFocusChain, &DesktopChainManager::useChain); } #endif } @@ -486,11 +486,11 @@ TabBox::TabBox(QObject *parent) m_desktopListConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient); m_desktopListConfig.setDesktopSwitchingMode(TabBoxConfig::StaticDesktopSwitching); m_tabBox = new TabBoxHandlerImpl(this); - QTimer::singleShot(0, this, SLOT(handlerReady())); + QTimer::singleShot(0, this, &TabBox::handlerReady); m_tabBoxMode = TabBoxDesktopMode; // init variables - connect(&m_delayedShowTimer, SIGNAL(timeout()), this, SLOT(show())); - connect(Workspace::self(), SIGNAL(configChanged()), this, SLOT(reconfigure())); + connect(&m_delayedShowTimer, &QTimer::timeout, this, &TabBox::show); + connect(Workspace::self(), &Workspace::configChanged, this, &TabBox::reconfigure); } TabBox::~TabBox() diff --git a/tabbox/tabboxhandler.cpp b/tabbox/tabboxhandler.cpp index 0d98610ba..d14d2c42f 100644 --- a/tabbox/tabboxhandler.cpp +++ b/tabbox/tabboxhandler.cpp @@ -382,7 +382,7 @@ void TabBoxHandler::show() // QMetaObject::invokeMethod(this, "initHighlightWindows", Qt::QueuedConnection); // but we somehow need to cross > 1 event cycle (likely because of queued invocation in the effects) // to ensure the EffectWindow is present when updateHighlightWindows, thus elevating the window/tabbox - QTimer::singleShot(1, this, SLOT(initHighlightWindows())); + QTimer::singleShot(1, this, &TabBoxHandler::initHighlightWindows); } } diff --git a/thumbnailitem.cpp b/thumbnailitem.cpp index 74183647c..a3168e8e2 100644 --- a/thumbnailitem.cpp +++ b/thumbnailitem.cpp @@ -28,9 +28,9 @@ AbstractThumbnailItem::AbstractThumbnailItem(QQuickItem *parent) , m_saturation(1.0) , m_clipToItem() { - connect(Compositor::self(), SIGNAL(compositingToggled(bool)), SLOT(compositingToggled())); + connect(Compositor::self(), &Compositor::compositingToggled, this, &AbstractThumbnailItem::compositingToggled); compositingToggled(); - QTimer::singleShot(0, this, SLOT(init())); + QTimer::singleShot(0, this, &AbstractThumbnailItem::init); } AbstractThumbnailItem::~AbstractThumbnailItem() @@ -41,8 +41,8 @@ void AbstractThumbnailItem::compositingToggled() { m_parent.clear(); if (effects) { - connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), SLOT(effectWindowAdded())); - connect(effects, SIGNAL(windowDamaged(KWin::EffectWindow*,QRegion)), SLOT(repaint(KWin::EffectWindow*))); + connect(effects, &EffectsHandler::windowAdded, this, &AbstractThumbnailItem::effectWindowAdded); + connect(effects, &EffectsHandler::windowDamaged, this, &AbstractThumbnailItem::repaint); effectWindowAdded(); } } diff --git a/toplevel.cpp b/toplevel.cpp index 234f6d4ff..a83367a81 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -46,8 +46,8 @@ Toplevel::Toplevel() , m_skipCloseAnimation(false) { connect(this, &Toplevel::damaged, this, &Toplevel::needsRepaint); - connect(screens(), SIGNAL(changed()), SLOT(checkScreen())); - connect(screens(), SIGNAL(countChanged(int,int)), SLOT(checkScreen())); + connect(screens(), &Screens::changed, this, &Toplevel::checkScreen); + connect(screens(), &Screens::countChanged, this, &Toplevel::checkScreen); setupCheckScreenConnection(); connect(this, &Toplevel::bufferGeometryChanged, this, &Toplevel::inputTransformationChanged); diff --git a/unmanaged.cpp b/unmanaged.cpp index f226cecc8..93061449e 100644 --- a/unmanaged.cpp +++ b/unmanaged.cpp @@ -34,7 +34,7 @@ const NET::WindowTypes SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK = NET::NormalMask | Unmanaged::Unmanaged() : Toplevel() { - QTimer::singleShot(50, this, SLOT(setReadyForPainting())); + QTimer::singleShot(50, this, &Unmanaged::setReadyForPainting); } Unmanaged::~Unmanaged() diff --git a/workspace.cpp b/workspace.cpp index f8018f186..6aa71fc48 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -132,7 +132,7 @@ Workspace::Workspace() activities = Activities::create(this); } if (activities) { - connect(activities, SIGNAL(currentChanged(QString)), SLOT(updateCurrentActivity(QString))); + connect(activities, &Activities::currentChanged, this, &Workspace::updateCurrentActivity); } #endif @@ -200,23 +200,23 @@ void Workspace::init() KSharedConfigPtr config = kwinApp()->config(); Screens *screens = Screens::self(); // get screen support - connect(screens, SIGNAL(changed()), SLOT(desktopResized())); + connect(screens, &Screens::changed, this, &Workspace::desktopResized); screens->setConfig(config); screens->reconfigure(); - connect(options, SIGNAL(configChanged()), screens, SLOT(reconfigure())); + connect(options, &Options::configChanged, screens, &Screens::reconfigure); ScreenEdges *screenEdges = ScreenEdges::self(); screenEdges->setConfig(config); screenEdges->init(); - connect(options, SIGNAL(configChanged()), screenEdges, SLOT(reconfigure())); - connect(VirtualDesktopManager::self(), SIGNAL(layoutChanged(int,int)), screenEdges, SLOT(updateLayout())); + connect(options, &Options::configChanged, screenEdges, &ScreenEdges::reconfigure); + connect(VirtualDesktopManager::self(), &VirtualDesktopManager::layoutChanged, screenEdges, &ScreenEdges::updateLayout); connect(this, &Workspace::clientActivated, screenEdges, &ScreenEdges::checkBlocking); FocusChain *focusChain = FocusChain::create(this); connect(this, &Workspace::clientRemoved, focusChain, &FocusChain::remove); connect(this, &Workspace::clientActivated, focusChain, &FocusChain::setActiveClient); - connect(VirtualDesktopManager::self(), SIGNAL(countChanged(uint,uint)), focusChain, SLOT(resize(uint,uint))); - connect(VirtualDesktopManager::self(), SIGNAL(currentChanged(uint,uint)), focusChain, SLOT(setCurrentDesktop(uint,uint))); - connect(options, SIGNAL(separateScreenFocusChanged(bool)), focusChain, SLOT(setSeparateScreenFocus(bool))); + connect(VirtualDesktopManager::self(), &VirtualDesktopManager::countChanged, focusChain, &FocusChain::resize); + connect(VirtualDesktopManager::self(), &VirtualDesktopManager::currentChanged, focusChain, &FocusChain::setCurrentDesktop); + connect(options, &Options::separateScreenFocusChanged, focusChain, &FocusChain::setSeparateScreenFocus); focusChain->setSeparateScreenFocus(options->isSeparateScreenFocus()); // create VirtualDesktopManager and perform dependency injection @@ -247,10 +247,10 @@ void Workspace::init() } ); - connect(vds, SIGNAL(countChanged(uint,uint)), SLOT(slotDesktopCountChanged(uint,uint))); - connect(vds, SIGNAL(currentChanged(uint,uint)), SLOT(slotCurrentDesktopChanged(uint,uint))); + connect(vds, &VirtualDesktopManager::countChanged, this, &Workspace::slotDesktopCountChanged); + connect(vds, &VirtualDesktopManager::currentChanged, this, &Workspace::slotCurrentDesktopChanged); vds->setNavigationWrappingAround(options->isRollOverDesktops()); - connect(options, SIGNAL(rollOverDesktopsChanged(bool)), vds, SLOT(setNavigationWrappingAround(bool))); + connect(options, &Options::rollOverDesktopsChanged, vds, &VirtualDesktopManager::setNavigationWrappingAround); vds->setConfig(config); // Now we know how many desktops we'll have, thus we initialize the positioning object @@ -269,8 +269,8 @@ void Workspace::init() reconfigureTimer.setSingleShot(true); updateToolWindowsTimer.setSingleShot(true); - connect(&reconfigureTimer, SIGNAL(timeout()), this, SLOT(slotReconfigure())); - connect(&updateToolWindowsTimer, SIGNAL(timeout()), this, SLOT(slotUpdateToolWindows())); + connect(&reconfigureTimer, &QTimer::timeout, this, &Workspace::slotReconfigure); + connect(&updateToolWindowsTimer, &QTimer::timeout, this, &Workspace::slotUpdateToolWindows); // TODO: do we really need to reconfigure everything when fonts change? // maybe just reconfigure the decorations? Move this into libkdecoration? @@ -539,7 +539,7 @@ X11Client *Workspace::createClient(xcb_window_t w, bool is_mapped) if (X11Compositor *compositor = X11Compositor::self()) { connect(c, &X11Client::blockingCompositingChanged, compositor, &X11Compositor::updateClientCompositeBlocking); } - connect(c, SIGNAL(clientFullScreenSet(KWin::X11Client *,bool,bool)), ScreenEdges::self(), SIGNAL(checkBlocking())); + connect(c, &X11Client::clientFullScreenSet, ScreenEdges::self(), &ScreenEdges::checkBlocking); if (!c->manage(w, is_mapped)) { X11Client::deleteClient(c); return nullptr; @@ -1249,7 +1249,7 @@ void Workspace::requestDelayFocus(AbstractClient* c) delayfocus_client = c; delete delayFocusTimer; delayFocusTimer = new QTimer(this); - connect(delayFocusTimer, SIGNAL(timeout()), this, SLOT(delayFocus())); + connect(delayFocusTimer, &QTimer::timeout, this, &Workspace::delayFocus); delayFocusTimer->setSingleShot(true); delayFocusTimer->start(options->delayFocusInterval()); }