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.
master
Vlad Zahorodnii 2020-09-23 21:39:59 +03:00
parent 70b18ae404
commit 0c266e760b
32 changed files with 152 additions and 147 deletions

View File

@ -632,7 +632,7 @@ void TestXdgShellClient::testWindowOpensLargerThanScreen()
// the window should get resized to fit into the screen, BUG: 366632 // the window should get resized to fit into the screen, BUG: 366632
QScopedPointer<Surface> surface(Test::createSurface()); QScopedPointer<Surface> surface(Test::createSurface());
QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data())); QScopedPointer<XdgShellSurface> shellSurface(Test::createXdgShellStableSurface(surface.data()));
QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), SIGNAL(sizeChanged(QSize))); QSignalSpy sizeChangeRequestedSpy(shellSurface.data(), &XdgShellSurface::sizeChanged);
QVERIFY(sizeChangeRequestedSpy.isValid()); QVERIFY(sizeChangeRequestedSpy.isValid());
// create deco // create deco

View File

@ -50,10 +50,10 @@ GetAddrInfo::GetAddrInfo(const QByteArray &hostName, QObject *parent)
{ {
// watcher will be deleted together with the GetAddrInfo once the future // watcher will be deleted together with the GetAddrInfo once the future
// got canceled or finished // got canceled or finished
connect(m_watcher, SIGNAL(canceled()), SLOT(deleteLater())); connect(m_watcher, &QFutureWatcher<int>::canceled, this, &GetAddrInfo::deleteLater);
connect(m_watcher, SIGNAL(finished()), SLOT(slotResolved())); connect(m_watcher, &QFutureWatcher<int>::finished, this, &GetAddrInfo::slotResolved);
connect(m_ownAddressWatcher, SIGNAL(canceled()), SLOT(deleteLater())); connect(m_ownAddressWatcher, &QFutureWatcher<int>::canceled, this, &GetAddrInfo::deleteLater);
connect(m_ownAddressWatcher, SIGNAL(finished()), SLOT(slotOwnAddressResolved())); connect(m_ownAddressWatcher, &QFutureWatcher<int>::finished, this, &GetAddrInfo::slotOwnAddressResolved);
} }
GetAddrInfo::~GetAddrInfo() GetAddrInfo::~GetAddrInfo()
@ -210,8 +210,8 @@ void ClientMachine::checkForLocalhost()
// check using information from get addr info // check using information from get addr info
// GetAddrInfo gets automatically destroyed once it finished or not // GetAddrInfo gets automatically destroyed once it finished or not
GetAddrInfo *info = new GetAddrInfo(lowerHostName, this); GetAddrInfo *info = new GetAddrInfo(lowerHostName, this);
connect(info, SIGNAL(local()), SLOT(setLocal())); connect(info, &GetAddrInfo::local, this, &ClientMachine::setLocal);
connect(info, SIGNAL(destroyed(QObject*)), SLOT(resolveFinished())); connect(info, &GetAddrInfo::destroyed, this, &ClientMachine::resolveFinished);
info->resolve(); info->resolve();
} }
} }

View File

@ -49,7 +49,7 @@ DBusInterface::DBusInterface(QObject *parent)
} }
if (!dbus.registerService(m_serviceName)) { if (!dbus.registerService(m_serviceName)) {
QDBusServiceWatcher *dog = new QDBusServiceWatcher(m_serviceName, dbus, QDBusServiceWatcher::WatchForUnregistration, this); 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 { } else {
announceService(); announceService();
} }

View File

@ -2061,11 +2061,11 @@ void EffectWindowImpl::registerThumbnail(AbstractThumbnailItem *item)
{ {
if (WindowThumbnailItem *thumb = qobject_cast<WindowThumbnailItem*>(item)) { if (WindowThumbnailItem *thumb = qobject_cast<WindowThumbnailItem*>(item)) {
insertThumbnail(thumb); insertThumbnail(thumb);
connect(thumb, SIGNAL(destroyed(QObject*)), SLOT(thumbnailDestroyed(QObject*))); connect(thumb, &QObject::destroyed, this, &EffectWindowImpl::thumbnailDestroyed);
connect(thumb, &WindowThumbnailItem::wIdChanged, this, &EffectWindowImpl::thumbnailTargetChanged); connect(thumb, &WindowThumbnailItem::wIdChanged, this, &EffectWindowImpl::thumbnailTargetChanged);
} else if (DesktopThumbnailItem *desktopThumb = qobject_cast<DesktopThumbnailItem*>(item)) { } else if (DesktopThumbnailItem *desktopThumb = qobject_cast<DesktopThumbnailItem*>(item)) {
m_desktopThumbnails.append(desktopThumb); 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) { if (m_style == EffectFrameStyled) {
m_frame.setImagePath(QStringLiteral("widgets/background")); m_frame.setImagePath(QStringLiteral("widgets/background"));
m_frame.setCacheAllRenderedFrames(true); 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.setImagePath(QStringLiteral("widgets/viewitem"));
m_selection.setElementPrefix(QStringLiteral("hover")); m_selection.setElementPrefix(QStringLiteral("hover"));

View File

@ -41,17 +41,17 @@ MagnifierEffect::MagnifierEffect()
{ {
initConfig<MagnifierConfig>(); initConfig<MagnifierConfig>();
QAction* a; QAction* a;
a = KStandardAction::zoomIn(this, SLOT(zoomIn()), this); a = KStandardAction::zoomIn(this, &MagnifierEffect::zoomIn, this);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal); KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal); KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Equal);
effects->registerGlobalShortcut(Qt::META + Qt::Key_Equal, a); 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<QKeySequence>() << Qt::META + Qt::Key_Minus); KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus); KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Minus);
effects->registerGlobalShortcut(Qt::META + Qt::Key_Minus, a); 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<QKeySequence>() << Qt::META + Qt::Key_0); KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0); KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
effects->registerGlobalShortcut(Qt::META + Qt::Key_0, a); effects->registerGlobalShortcut(Qt::META + Qt::Key_0, a);

View File

@ -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 // 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. // X errors are reported to the event loop and logged by Qt.
m_scheduledRelease = true; m_scheduledRelease = true;
QTimer::singleShot(1, this, SLOT(release())); QTimer::singleShot(1, this, [this]() { release(); });
break; break;
} }
case XCB_CONFIGURE_NOTIFY: case XCB_CONFIGURE_NOTIFY:

View File

@ -42,8 +42,8 @@ RulesDialog::RulesDialog(QWidget* parent, const char* name)
layout()->addWidget(m_quickWidget); layout()->addWidget(m_quickWidget);
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
connect(buttons, SIGNAL(accepted()), SLOT(accept())); connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttons, SIGNAL(rejected()), SLOT(reject())); connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);
layout()->addWidget(buttons); layout()->addWidget(buttons);
} }

View File

@ -48,7 +48,7 @@ public:
// reset to default settings and assess for saveNeeded and default changed // reset to default settings and assess for saveNeeded and default changed
virtual void setDefaults(); virtual void setDefaults();
private Q_SLOTS: public Q_SLOTS:
void onChanged(); void onChanged();
void createConnection(); void createConnection();

View File

@ -20,14 +20,14 @@ KWinScreenEdgesConfigForm::KWinScreenEdgesConfigForm(QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(ui->kcfg_ElectricBorderDelay, SIGNAL(valueChanged(int)), this, SLOT(sanitizeCooldown())); connect(ui->kcfg_ElectricBorderDelay, qOverload<int>(&QSpinBox::valueChanged), this, &KWinScreenEdgesConfigForm::sanitizeCooldown);
// Visual feedback of action group conflicts // Visual feedback of action group conflicts
connect(ui->kcfg_ElectricBorders, SIGNAL(currentIndexChanged(int)), this, SLOT(groupChanged())); connect(ui->kcfg_ElectricBorders, qOverload<int>(&QComboBox::currentIndexChanged), this, &KWinScreenEdgesConfigForm::groupChanged);
connect(ui->kcfg_ElectricBorderMaximize, SIGNAL(stateChanged(int)), this, SLOT(groupChanged())); connect(ui->kcfg_ElectricBorderMaximize, &QCheckBox::stateChanged, this, &KWinScreenEdgesConfigForm::groupChanged);
connect(ui->kcfg_ElectricBorderTiling, SIGNAL(stateChanged(int)), this, SLOT(groupChanged())); connect(ui->kcfg_ElectricBorderTiling, &QCheckBox::stateChanged, this, &KWinScreenEdgesConfigForm::groupChanged);
connect(ui->electricBorderCornerRatioSpin, SIGNAL(valueChanged(int)), this, SLOT(onChanged())); connect(ui->electricBorderCornerRatioSpin, qOverload<int>(&QSpinBox::valueChanged), this, &KWinScreenEdgesConfigForm::onChanged);
} }
KWinScreenEdgesConfigForm::~KWinScreenEdgesConfigForm() KWinScreenEdgesConfigForm::~KWinScreenEdgesConfigForm()

View File

@ -39,29 +39,29 @@ KWinTabBoxConfigForm::KWinTabBoxConfigForm(TabboxType type, QWidget *parent)
connect(ui->effectConfigButton, &QPushButton::clicked, this, &KWinTabBoxConfigForm::effectConfigButtonClicked); 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->filterScreens, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterScreen);
connect(ui->currentScreen, SIGNAL(clicked(bool)), SLOT(onFilterScreen())); connect(ui->currentScreen, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterScreen);
connect(ui->otherScreens, SIGNAL(clicked(bool)), SLOT(onFilterScreen())); connect(ui->otherScreens, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterScreen);
connect(ui->filterDesktops, SIGNAL(clicked(bool)), SLOT(onFilterDesktop())); connect(ui->filterDesktops, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterDesktop);
connect(ui->currentDesktop, SIGNAL(clicked(bool)), SLOT(onFilterDesktop())); connect(ui->currentDesktop, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterDesktop);
connect(ui->otherDesktops, SIGNAL(clicked(bool)), SLOT(onFilterDesktop())); connect(ui->otherDesktops, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterDesktop);
connect(ui->filterActivities, SIGNAL(clicked(bool)), SLOT(onFilterActivites())); connect(ui->filterActivities, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterActivites);
connect(ui->currentActivity, SIGNAL(clicked(bool)), SLOT(onFilterActivites())); connect(ui->currentActivity, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterActivites);
connect(ui->otherActivities, SIGNAL(clicked(bool)), SLOT(onFilterActivites())); connect(ui->otherActivities, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterActivites);
connect(ui->filterMinimization, SIGNAL(clicked(bool)), SLOT(onFilterMinimization())); connect(ui->filterMinimization, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterMinimization);
connect(ui->visibleWindows, SIGNAL(clicked(bool)), SLOT(onFilterMinimization())); connect(ui->visibleWindows, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterMinimization);
connect(ui->hiddenWindows, SIGNAL(clicked(bool)), SLOT(onFilterMinimization())); connect(ui->hiddenWindows, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterMinimization);
connect(ui->oneAppWindow, SIGNAL(clicked(bool)), SLOT(onApplicationMode())); connect(ui->oneAppWindow, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onApplicationMode);
connect(ui->showDesktop, SIGNAL(clicked(bool)), SLOT(onShowDesktopMode())); connect(ui->showDesktop, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onShowDesktopMode);
connect(ui->switchingModeCombo, SIGNAL(currentIndexChanged(int)), SLOT(onSwitchingMode())); connect(ui->switchingModeCombo, qOverload<int>(&QComboBox::currentIndexChanged), this, &KWinTabBoxConfigForm::onSwitchingMode);
connect(ui->effectCombo, SIGNAL(currentIndexChanged(int)), SLOT(onEffectCombo())); connect(ui->effectCombo, qOverload<int>(&QComboBox::currentIndexChanged), this, &KWinTabBoxConfigForm::onEffectCombo);
auto addShortcut = [this](const char *name, KKeySequenceWidget *widget, const QKeySequence &sequence = QKeySequence()) { auto addShortcut = [this](const char *name, KKeySequenceWidget *widget, const QKeySequence &sequence = QKeySequence()) {
QAction *a = m_actionCollection->addAction(name); QAction *a = m_actionCollection->addAction(name);
@ -69,7 +69,7 @@ KWinTabBoxConfigForm::KWinTabBoxConfigForm(TabboxType type, QWidget *parent)
widget->setProperty("shortcutAction", name); widget->setProperty("shortcutAction", name);
a->setText(i18n(name)); a->setText(i18n(name));
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << sequence); KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << 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"! // Shortcut config. The shortcut belongs to the component "kwin"!

View File

@ -66,7 +66,7 @@ KWinTabBoxConfig::KWinTabBoxConfig(QWidget* parent, const QVariantList& args)
tabWidget->addTab(m_alternativeTabBoxUi, i18n("Alternative")); tabWidget->addTab(m_alternativeTabBoxUi, i18n("Alternative"));
QPushButton* ghnsButton = new QPushButton(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")), i18n("Get New Task Switchers...")); 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(); QHBoxLayout* buttonBar = new QHBoxLayout();
QSpacerItem* buttonBarSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); 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) 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, &KWinTabBoxConfigForm::filterScreenChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, SIGNAL(filterDesktopChanged(int)), this, SLOT(updateUnmanagedState())); connect(form, &KWinTabBoxConfigForm::filterDesktopChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, SIGNAL(filterActivitiesChanged(int)), this, SLOT(updateUnmanagedState())); connect(form, &KWinTabBoxConfigForm::filterActivitiesChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, SIGNAL(filterMinimizationChanged(int)), this, SLOT(updateUnmanagedState())); connect(form, &KWinTabBoxConfigForm::filterMinimizationChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, SIGNAL(applicationModeChanged(int)), this, SLOT(updateUnmanagedState())); connect(form, &KWinTabBoxConfigForm::applicationModeChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, SIGNAL(showDesktopModeChanged(int)), this, SLOT(updateUnmanagedState())); connect(form, &KWinTabBoxConfigForm::showDesktopModeChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, SIGNAL(switchingModeChanged(int)), this, SLOT(updateUnmanagedState())); connect(form, &KWinTabBoxConfigForm::switchingModeChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, SIGNAL(layoutNameChanged(QString)), this, SLOT(updateUnmanagedState())); connect(form, &KWinTabBoxConfigForm::layoutNameChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
} }
void KWinTabBoxConfig::updateUnmanagedState() void KWinTabBoxConfig::updateUnmanagedState()
@ -432,8 +432,8 @@ void KWinTabBoxConfig::configureEffectClicked()
configDialog->setLayout(new QVBoxLayout); configDialog->setLayout(new QVBoxLayout);
configDialog->setWindowTitle(form->effectComboCurrentData(Qt::DisplayRole).toString()); configDialog->setWindowTitle(form->effectComboCurrentData(Qt::DisplayRole).toString());
QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults, configDialog); QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults, configDialog);
connect(buttonBox, SIGNAL(accepted()), configDialog, SLOT(accept())); connect(buttonBox, &QDialogButtonBox::accepted, configDialog.data(), &QDialog::accept);
connect(buttonBox, SIGNAL(rejected()), configDialog, SLOT(reject())); connect(buttonBox, &QDialogButtonBox::rejected, configDialog.data(), &QDialog::reject);
const QString name = form->effectComboCurrentData().toString(); const QString name = form->effectComboCurrentData().toString();
KCModule *kcm = KPluginTrader::createInstanceFromQuery<KCModule>(QStringLiteral("kwin/effects/configs/"), QString(), KCModule *kcm = KPluginTrader::createInstanceFromQuery<KCModule>(QStringLiteral("kwin/effects/configs/"), QString(),

4
main.h
View File

@ -113,6 +113,7 @@ public:
static void setCrashCount(int count); static void setCrashCount(int count);
static bool wasCrash(); static bool wasCrash();
void resetCrashesCount();
/** /**
* Creates the KAboutData object for the KWin instance and registers it as * Creates the KAboutData object for the KWin instance and registers it as
@ -237,9 +238,6 @@ protected:
protected: protected:
static int crashes; static int crashes;
private Q_SLOTS:
void resetCrashesCount();
private: private:
QScopedPointer<XcbEventFilter> m_eventFilter; QScopedPointer<XcbEventFilter> m_eventFilter;
bool m_configLock; bool m_configLock;

View File

@ -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); fputs(i18n("kwin: unable to claim manager selection, another wm running? (try using --replace)\n").toLocal8Bit().constData(), stderr);
::exit(1); ::exit(1);
}); });
connect(owner.data(), SIGNAL(lostOwnership()), SLOT(lostSelection())); connect(owner.data(), &KSelectionOwner::lostOwnership, this, &ApplicationX11::lostSelection);
connect(owner.data(), &KSelectionOwner::claimedOwnership, [this]{ connect(owner.data(), &KSelectionOwner::claimedOwnership, [this]{
installNativeX11EventFilter(); installNativeX11EventFilter();
// first load options - done internally by a different thread // first load options - done internally by a different thread
@ -311,7 +311,7 @@ void ApplicationX11::crashChecking()
compgroup.writeEntry("Enabled", false); compgroup.writeEntry("Enabled", false);
} }
// Reset crashes count if we stay up for more that 15 seconds // 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() void ApplicationX11::notifyKSplash()

View File

@ -33,7 +33,7 @@ Outline::Outline(QObject *parent)
: QObject(parent) : QObject(parent)
, m_active(false) , m_active(false)
{ {
connect(Compositor::self(), SIGNAL(compositingToggled(bool)), SLOT(compositingChanged())); connect(Compositor::self(), &Compositor::compositingToggled, this, &Outline::compositingChanged);
} }
Outline::~Outline() Outline::~Outline()

View File

@ -73,8 +73,8 @@ AuroraeTheme::AuroraeTheme(QObject* parent)
: QObject(parent) : QObject(parent)
, d(new AuroraeThemePrivate) , d(new AuroraeThemePrivate)
{ {
connect(this, SIGNAL(themeChanged()), SIGNAL(borderSizesChanged())); connect(this, &AuroraeTheme::themeChanged, this, &AuroraeTheme::borderSizesChanged);
connect(this, SIGNAL(buttonSizesChanged()), SIGNAL(borderSizesChanged())); connect(this, &AuroraeTheme::buttonSizesChanged, this, &AuroraeTheme::borderSizesChanged);
} }
AuroraeTheme::~AuroraeTheme() AuroraeTheme::~AuroraeTheme()

View File

@ -32,10 +32,10 @@ X11Cursor::X11Cursor(QObject *parent, bool xInputSupport)
{ {
Cursors::self()->setMouse(this); Cursors::self()->setMouse(this);
m_resetTimeStampTimer->setSingleShot(true); 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? // TODO: How often do we really need to poll?
m_mousePollingTimer->setInterval(50); 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(); }); connect(this, &Cursor::themeChanged, this, [this] { m_cursors.clear(); });

View File

@ -1407,9 +1407,10 @@ InputRedirectionCursor::InputRedirectionCursor(QObject *parent)
, m_currentButtons(Qt::NoButton) , m_currentButtons(Qt::NoButton)
{ {
Cursors::self()->setMouse(this); Cursors::self()->setMouse(this);
connect(input(), SIGNAL(globalPointerChanged(QPointF)), SLOT(slotPosChanged(QPointF))); connect(input(), &InputRedirection::globalPointerChanged,
connect(input(), SIGNAL(pointerButtonStateChanged(uint32_t,InputRedirection::PointerButtonState)), this, &InputRedirectionCursor::slotPosChanged);
SLOT(slotPointerButtonChanged())); connect(input(), &InputRedirection::pointerButtonStateChanged,
this, &InputRedirectionCursor::slotPointerButtonChanged);
#ifndef KCMRULES #ifndef KCMRULES
connect(input(), &InputRedirection::keyboardModifiersChanged, connect(input(), &InputRedirection::keyboardModifiersChanged,
this, &InputRedirectionCursor::slotModifiersChanged); this, &InputRedirectionCursor::slotModifiersChanged);

View File

@ -928,7 +928,7 @@ RuleBook::RuleBook(QObject *parent)
initializeX11(); initializeX11();
connect(kwinApp(), &Application::x11ConnectionChanged, this, &RuleBook::initializeX11); connect(kwinApp(), &Application::x11ConnectionChanged, this, &RuleBook::initializeX11);
connect(kwinApp(), &Application::x11ConnectionAboutToBeDestroyed, this, &RuleBook::cleanupX11); 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->setInterval(1000);
m_updateTimer->setSingleShot(true); m_updateTimer->setSingleShot(true);
} }
@ -946,7 +946,7 @@ void RuleBook::initializeX11()
return; return;
} }
m_temporaryRulesMessages.reset(new KXMessages(c, kwinApp()->x11RootWindow(), "_KDE_NET_WM_TEMPORARY_RULES", nullptr)); 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() void RuleBook::cleanupX11()
@ -1047,7 +1047,7 @@ void RuleBook::temporaryRulesMessage(const QString& message)
Rules* rule = new Rules(message, true); Rules* rule = new Rules(message, true);
m_rules.prepend(rule); // highest priority first m_rules.prepend(rule); // highest priority first
if (!was_temporary) if (!was_temporary)
QTimer::singleShot(60000, this, SLOT(cleanupTemporaryRules())); QTimer::singleShot(60000, this, &RuleBook::cleanupTemporaryRules);
} }
void RuleBook::cleanupTemporaryRules() void RuleBook::cleanupTemporaryRules()
@ -1065,7 +1065,7 @@ void RuleBook::cleanupTemporaryRules()
} }
} }
if (has_temporary) if (has_temporary)
QTimer::singleShot(60000, this, SLOT(cleanupTemporaryRules())); QTimer::singleShot(60000, this, &RuleBook::cleanupTemporaryRules);
} }
void RuleBook::discardUsed(AbstractClient* c, bool withdrawn) void RuleBook::discardUsed(AbstractClient* c, bool withdrawn)

View File

@ -406,7 +406,7 @@ void Scene::addToplevel(Toplevel *c)
Scene::Window *w = createWindow(c); Scene::Window *w = createWindow(c);
m_windows[ c ] = w; 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()) { if (c->surface()) {
// We generate window quads for sub-surfaces so it's quite important to discard // 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. // the pixmap tree and cached window quads when the sub-surface tree is changed.

View File

@ -117,7 +117,7 @@ void Edge::reserve()
void Edge::reserve(QObject *object, const char *slot) void Edge::reserve(QObject *object, const char *slot)
{ {
connect(object, SIGNAL(destroyed(QObject*)), SLOT(unreserve(QObject*))); connect(object, &QObject::destroyed, this, qOverload<QObject *>(&Edge::unreserve));
m_callBacks.insert(object, QByteArray(slot)); m_callBacks.insert(object, QByteArray(slot));
reserve(); reserve();
} }
@ -158,7 +158,7 @@ void Edge::unreserve(QObject *object)
{ {
if (m_callBacks.contains(object)) { if (m_callBacks.contains(object)) {
m_callBacks.remove(object); m_callBacks.remove(object);
disconnect(object, SIGNAL(destroyed(QObject*)), this, SLOT(unreserve(QObject*))); disconnect(object, &QObject::destroyed, this, qOverload<QObject *>(&Edge::unreserve));
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()) { if (edge->isScreenEdge()) {
connect(this, SIGNAL(checkBlocking()), edge, SLOT(checkBlocking())); connect(this, &ScreenEdges::checkBlocking, edge, &Edge::checkBlocking);
} }
return edge; return edge;
} }

View File

@ -40,13 +40,15 @@ ScreenLockerWatcher::~ScreenLockerWatcher()
void ScreenLockerWatcher::initialize() 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->setWatchMode(QDBusServiceWatcher::WatchForOwnerChange);
m_serviceWatcher->addWatchedService(SCREEN_LOCKER_SERVICE_NAME); m_serviceWatcher->addWatchedService(SCREEN_LOCKER_SERVICE_NAME);
// check whether service is registered // check whether service is registered
QFutureWatcher<QDBusReply<bool> > *watcher = new QFutureWatcher<QDBusReply<bool> >(this); QFutureWatcher<QDBusReply<bool> > *watcher = new QFutureWatcher<QDBusReply<bool> >(this);
connect(watcher, SIGNAL(finished()), SLOT(serviceRegisteredQueried())); connect(watcher, &QFutureWatcher<QDBusReply<bool>>::finished,
connect(watcher, SIGNAL(canceled()), watcher, SLOT(deleteLater())); this, &ScreenLockerWatcher::serviceRegisteredQueried);
connect(watcher, &QFutureWatcher<QDBusReply<bool>>::canceled,
watcher, &QFutureWatcher<QDBusReply<bool>>::deleteLater);
watcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(), watcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(),
&QDBusConnectionInterface::isServiceRegistered, &QDBusConnectionInterface::isServiceRegistered,
SCREEN_LOCKER_SERVICE_NAME)); SCREEN_LOCKER_SERVICE_NAME));
@ -67,9 +69,11 @@ void ScreenLockerWatcher::serviceOwnerChanged(const QString &serviceName, const
if (!newOwner.isEmpty()) { if (!newOwner.isEmpty()) {
m_interface = new OrgFreedesktopScreenSaverInterface(newOwner, QStringLiteral("/ScreenSaver"), QDBusConnection::sessionBus(), this); m_interface = new OrgFreedesktopScreenSaverInterface(newOwner, QStringLiteral("/ScreenSaver"), QDBusConnection::sessionBus(), this);
m_kdeInterface = new OrgKdeScreensaverInterface(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); 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); connect(m_kdeInterface, &OrgKdeScreensaverInterface::AboutToLock, this, &ScreenLockerWatcher::aboutToLock);
} }
} }
@ -83,8 +87,10 @@ void ScreenLockerWatcher::serviceRegisteredQueried()
const QDBusReply<bool> &reply = watcher->result(); const QDBusReply<bool> &reply = watcher->result();
if (reply.isValid() && reply.value()) { if (reply.isValid() && reply.value()) {
QFutureWatcher<QDBusReply<QString> > *ownerWatcher = new QFutureWatcher<QDBusReply<QString> >(this); QFutureWatcher<QDBusReply<QString> > *ownerWatcher = new QFutureWatcher<QDBusReply<QString> >(this);
connect(ownerWatcher, SIGNAL(finished()), SLOT(serviceOwnerQueried())); connect(ownerWatcher, &QFutureWatcher<QDBusReply<QString>>::finished,
connect(ownerWatcher, SIGNAL(canceled()), ownerWatcher, SLOT(deleteLater())); this, &ScreenLockerWatcher::serviceOwnerQueried);
connect(ownerWatcher, &QFutureWatcher<QDBusReply<QString>>::canceled,
ownerWatcher, &QFutureWatcher<QDBusReply<QString>>::deleteLater);
ownerWatcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(), ownerWatcher->setFuture(QtConcurrent::run(QDBusConnection::sessionBus().interface(),
&QDBusConnectionInterface::serviceOwner, &QDBusConnectionInterface::serviceOwner,
SCREEN_LOCKER_SERVICE_NAME)); SCREEN_LOCKER_SERVICE_NAME));

View File

@ -56,8 +56,8 @@ void Screens::init()
{ {
m_changedTimer->setSingleShot(true); m_changedTimer->setSingleShot(true);
m_changedTimer->setInterval(100); m_changedTimer->setInterval(100);
connect(m_changedTimer, SIGNAL(timeout()), SLOT(updateCount())); connect(m_changedTimer, &QTimer::timeout, this, &Screens::updateCount);
connect(m_changedTimer, SIGNAL(timeout()), SIGNAL(changed())); connect(m_changedTimer, &QTimer::timeout, this, &Screens::changed);
connect(this, &Screens::countChanged, this, &Screens::changed, Qt::QueuedConnection); connect(this, &Screens::countChanged, this, &Screens::changed, Qt::QueuedConnection);
connect(this, &Screens::changed, this, &Screens::updateSize); connect(this, &Screens::changed, this, &Screens::updateSize);
connect(this, &Screens::sizeChanged, this, &Screens::geometryChanged); connect(this, &Screens::sizeChanged, this, &Screens::geometryChanged);

View File

@ -580,7 +580,7 @@ ScriptedEffect::ScriptedEffect()
, m_chainPosition(0) , m_chainPosition(0)
{ {
Q_ASSERT(effects); 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]() { connect(effects, &EffectsHandler::activeFullScreenEffectChanged, this, [this]() {
Effect* fullScreenEffect = effects->activeFullScreenEffect(); Effect* fullScreenEffect = effects->activeFullScreenEffect();
if (fullScreenEffect == m_activeFullScreenEffect) { if (fullScreenEffect == m_activeFullScreenEffect) {
@ -809,7 +809,7 @@ void ScriptedEffect::reconfigure(ReconfigureFlags flags)
void ScriptedEffect::registerShortcut(QAction *a, QScriptValue callback) void ScriptedEffect::registerShortcut(QAction *a, QScriptValue callback)
{ {
m_shortcutCallbacks.insert(a, callback); m_shortcutCallbacks.insert(a, callback);
connect(a, SIGNAL(triggered(bool)), SLOT(globalShortcutTriggered())); connect(a, &QAction::triggered, this, &ScriptedEffect::globalShortcutTriggered);
} }
void ScriptedEffect::globalShortcutTriggered() void ScriptedEffect::globalShortcutTriggered()

View File

@ -211,7 +211,7 @@ QScriptValue kwinCallDBus(QScriptContext *context, QScriptEngine *engine)
// with a callback // with a callback
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(QDBusConnection::sessionBus().asyncCall(msg), script); QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(QDBusConnection::sessionBus().asyncCall(msg), script);
watcher->setProperty("callback", script->registerCallback(context->argument(context->argumentCount()-1))); 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(); return engine->undefinedValue();
} }
@ -251,7 +251,7 @@ void KWin::AbstractScript::printMessage(const QString &message)
void KWin::AbstractScript::registerShortcut(QAction *a, QScriptValue callback) void KWin::AbstractScript::registerShortcut(QAction *a, QScriptValue callback)
{ {
m_shortcutCallbacks.insert(a, callback); m_shortcutCallbacks.insert(a, callback);
connect(a, SIGNAL(triggered(bool)), SLOT(globalShortcutTriggered())); connect(a, &QAction::triggered, this, &AbstractScript::globalShortcutTriggered);
} }
void KWin::AbstractScript::globalShortcutTriggered() void KWin::AbstractScript::globalShortcutTriggered()
@ -405,8 +405,8 @@ QAction *KWin::AbstractScript::createAction(const QString &title, bool checkable
action->setChecked(checked); action->setChecked(checked);
// TODO: rename m_shortcutCallbacks // TODO: rename m_shortcutCallbacks
m_shortcutCallbacks.insert(action, callback); m_shortcutCallbacks.insert(action, callback);
connect(action, SIGNAL(triggered(bool)), SLOT(globalShortcutTriggered())); connect(action, &QAction::triggered, this, &AbstractScript::globalShortcutTriggered);
connect(action, SIGNAL(destroyed(QObject*)), SLOT(actionDestroyed(QObject*))); connect(action, &QObject::destroyed, this, &AbstractScript::actionDestroyed);
return action; return action;
} }
@ -462,7 +462,7 @@ void KWin::Script::run()
m_starting = true; m_starting = true;
QFutureWatcher<QByteArray> *watcher = new QFutureWatcher<QByteArray>(this); QFutureWatcher<QByteArray> *watcher = new QFutureWatcher<QByteArray>(this);
connect(watcher, SIGNAL(finished()), SLOT(slotScriptLoadedFromFile())); connect(watcher, &QFutureWatcherBase::finished, this, &Script::slotScriptLoadedFromFile);
watcher->setFuture(QtConcurrent::run(this, &KWin::Script::loadScriptFromFile, fileName())); watcher->setFuture(QtConcurrent::run(this, &KWin::Script::loadScriptFromFile, fileName()));
} }
@ -501,7 +501,7 @@ void KWin::Script::slotScriptLoadedFromFile()
QScriptEngine::ExcludeSuperClassContents | QScriptEngine::ExcludeDeleteLater); QScriptEngine::ExcludeSuperClassContents | QScriptEngine::ExcludeDeleteLater);
m_engine->globalObject().setProperty(QStringLiteral("options"), optionsValue, QScriptValue::Undeletable); m_engine->globalObject().setProperty(QStringLiteral("options"), optionsValue, QScriptValue::Undeletable);
m_engine->globalObject().setProperty(QStringLiteral("QTimer"), constructTimerClass(m_engine)); 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); KWin::MetaScripting::supplyConfig(m_engine);
installScriptFunctions(m_engine); installScriptFunctions(m_engine);
@ -684,8 +684,8 @@ KWin::Scripting::Scripting(QObject *parent)
{ {
init(); init();
QDBusConnection::sessionBus().registerObject(QStringLiteral("/Scripting"), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables); QDBusConnection::sessionBus().registerObject(QStringLiteral("/Scripting"), this, QDBusConnection::ExportScriptableContents | QDBusConnection::ExportScriptableInvokables);
connect(Workspace::self(), SIGNAL(configChanged()), SLOT(start())); connect(Workspace::self(), &Workspace::configChanged, this, &Scripting::start);
connect(Workspace::self(), SIGNAL(workspaceInitialized()), SLOT(start())); connect(Workspace::self(), &Workspace::workspaceInitialized, this, &Scripting::start);
} }
void KWin::Scripting::init() 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 // TODO make this threaded again once KConfigGroup is sufficiently thread safe, bug #305361 and friends
// perform querying for the services in a thread // perform querying for the services in a thread
QFutureWatcher<LoadScriptList> *watcher = new QFutureWatcher<LoadScriptList>(this); QFutureWatcher<LoadScriptList> *watcher = new QFutureWatcher<LoadScriptList>(this);
connect(watcher, SIGNAL(finished()), this, SLOT(slotScriptsQueried())); connect(watcher, &QFutureWatcher<LoadScriptList>::finished, this, &Scripting::slotScriptsQueried);
watcher->setFuture(QtConcurrent::run(this, &KWin::Scripting::queryScriptsToLoad, pluginStates, offers)); watcher->setFuture(QtConcurrent::run(this, &KWin::Scripting::queryScriptsToLoad, pluginStates, offers));
#else #else
LoadScriptList scriptsToLoad = queryScriptsToLoad(); LoadScriptList scriptsToLoad = queryScriptsToLoad();
@ -853,7 +853,7 @@ int KWin::Scripting::loadScript(const QString &filePath, const QString& pluginNa
} }
const int id = scripts.size(); const int id = scripts.size();
KWin::Script *script = new KWin::Script(id, filePath, pluginName, this); 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); scripts.append(script);
return id; return id;
} }
@ -866,7 +866,7 @@ int KWin::Scripting::loadDeclarativeScript(const QString& filePath, const QStrin
} }
const int id = scripts.size(); const int id = scripts.size();
KWin::DeclarativeScript *script = new KWin::DeclarativeScript(id, filePath, pluginName, this); 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); scripts.append(script);
return id; return id;
} }

View File

@ -35,7 +35,7 @@ ClientLevel::ClientLevel(ClientModel *model, AbstractLevel *parent)
connect(VirtualDesktopManager::self(), &VirtualDesktopManager::currentChanged, this, &ClientLevel::reInit); connect(VirtualDesktopManager::self(), &VirtualDesktopManager::currentChanged, this, &ClientLevel::reInit);
connect(Workspace::self(), &Workspace::clientAdded, this, &ClientLevel::clientAdded); connect(Workspace::self(), &Workspace::clientAdded, this, &ClientLevel::clientAdded);
connect(Workspace::self(), &Workspace::clientRemoved, this, &ClientLevel::clientRemoved); connect(Workspace::self(), &Workspace::clientRemoved, this, &ClientLevel::clientRemoved);
connect(model, SIGNAL(exclusionsChanged()), SLOT(reInit())); connect(model, &ClientModel::exclusionsChanged, this, &ClientLevel::reInit);
} }
ClientLevel::~ClientLevel() ClientLevel::~ClientLevel()
@ -400,12 +400,12 @@ ForkLevel::ForkLevel(const QList<ClientModel::LevelRestriction> &childRestrictio
: AbstractLevel(model, parent) : AbstractLevel(model, parent)
, m_childRestrictions(childRestrictions) , m_childRestrictions(childRestrictions)
{ {
connect(VirtualDesktopManager::self(), SIGNAL(countChanged(uint,uint)), SLOT(desktopCountChanged(uint,uint))); connect(VirtualDesktopManager::self(), &VirtualDesktopManager::countChanged, this, &ForkLevel::desktopCountChanged);
connect(screens(), SIGNAL(countChanged(int,int)), SLOT(screenCountChanged(int,int))); connect(screens(), &Screens::countChanged, this, &ForkLevel::screenCountChanged);
#ifdef KWIN_BUILD_ACTIVITIES #ifdef KWIN_BUILD_ACTIVITIES
if (Activities *activities = Activities::self()) { if (Activities *activities = Activities::self()) {
connect(activities, SIGNAL(added(QString)), SLOT(activityAdded(QString))); connect(activities, &Activities::added, this, &ForkLevel::activityAdded);
connect(activities, SIGNAL(removed(QString)), SLOT(activityRemoved(QString))); connect(activities, &Activities::removed, this, &ForkLevel::activityRemoved);
} }
#endif #endif
} }
@ -531,10 +531,10 @@ int ForkLevel::count() const
void ForkLevel::addChild(AbstractLevel *child) void ForkLevel::addChild(AbstractLevel *child)
{ {
m_children.append(child); m_children.append(child);
connect(child, SIGNAL(beginInsert(int,int,quint32)), SIGNAL(beginInsert(int,int,quint32))); connect(child, &AbstractLevel::beginInsert, this, &AbstractLevel::beginInsert);
connect(child, SIGNAL(beginRemove(int,int,quint32)), SIGNAL(beginRemove(int,int,quint32))); connect(child, &AbstractLevel::beginRemove, this, &AbstractLevel::beginRemove);
connect(child, SIGNAL(endInsert()), SIGNAL(endInsert())); connect(child, &AbstractLevel::endInsert, this, &AbstractLevel::endInsert);
connect(child, SIGNAL(endRemove()), SIGNAL(endRemove())); connect(child, &AbstractLevel::endRemove, this, &AbstractLevel::endRemove);
} }
void ForkLevel::setActivity(const QString &activity) void ForkLevel::setActivity(const QString &activity)
@ -654,10 +654,10 @@ void ClientModel::setLevels(QList< ClientModel::LevelRestriction > restrictions)
delete m_root; delete m_root;
} }
m_root = AbstractLevel::create(restrictions, NoRestriction, this); m_root = AbstractLevel::create(restrictions, NoRestriction, this);
connect(m_root, SIGNAL(beginInsert(int,int,quint32)), SLOT(levelBeginInsert(int,int,quint32))); connect(m_root, &AbstractLevel::beginInsert, this, &ClientModel::levelBeginInsert);
connect(m_root, SIGNAL(beginRemove(int,int,quint32)), SLOT(levelBeginRemove(int,int,quint32))); connect(m_root, &AbstractLevel::beginRemove, this, &ClientModel::levelBeginRemove);
connect(m_root, SIGNAL(endInsert()), SLOT(levelEndInsert())); connect(m_root, &AbstractLevel::endInsert, this, &ClientModel::levelEndInsert);
connect(m_root, SIGNAL(endRemove()), SLOT(levelEndRemove())); connect(m_root, &AbstractLevel::endRemove, this, &ClientModel::levelEndRemove);
m_root->init(); m_root->init();
endResetModel(); endResetModel();
} }

View File

@ -34,16 +34,16 @@ WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent)
connect(ws, &Workspace::clientAdded, this, &WorkspaceWrapper::setupClientConnections); connect(ws, &Workspace::clientAdded, this, &WorkspaceWrapper::setupClientConnections);
connect(ws, &Workspace::clientRemoved, this, &WorkspaceWrapper::clientRemoved); connect(ws, &Workspace::clientRemoved, this, &WorkspaceWrapper::clientRemoved);
connect(ws, &Workspace::clientActivated, this, &WorkspaceWrapper::clientActivated); connect(ws, &Workspace::clientActivated, this, &WorkspaceWrapper::clientActivated);
connect(vds, SIGNAL(countChanged(uint,uint)), SIGNAL(numberDesktopsChanged(uint))); connect(vds, &VirtualDesktopManager::countChanged, this, &WorkspaceWrapper::numberDesktopsChanged);
connect(vds, SIGNAL(layoutChanged(int,int)), SIGNAL(desktopLayoutChanged())); connect(vds, &VirtualDesktopManager::layoutChanged, this, &WorkspaceWrapper::desktopLayoutChanged);
connect(ws, &Workspace::clientDemandsAttentionChanged, this, &WorkspaceWrapper::clientDemandsAttentionChanged); connect(ws, &Workspace::clientDemandsAttentionChanged, this, &WorkspaceWrapper::clientDemandsAttentionChanged);
#ifdef KWIN_BUILD_ACTIVITIES #ifdef KWIN_BUILD_ACTIVITIES
if (KWin::Activities *activities = KWin::Activities::self()) { if (KWin::Activities *activities = KWin::Activities::self()) {
connect(activities, SIGNAL(currentChanged(QString)), SIGNAL(currentActivityChanged(QString))); connect(activities, &Activities::currentChanged, this, &WorkspaceWrapper::currentActivityChanged);
connect(activities, SIGNAL(added(QString)), SIGNAL(activitiesChanged(QString))); connect(activities, &Activities::added, this, &WorkspaceWrapper::activitiesChanged);
connect(activities, SIGNAL(added(QString)), SIGNAL(activityAdded(QString))); connect(activities, &Activities::added, this, &WorkspaceWrapper::activityAdded);
connect(activities, SIGNAL(removed(QString)), SIGNAL(activitiesChanged(QString))); connect(activities, &Activities::removed, this, &WorkspaceWrapper::activitiesChanged);
connect(activities, SIGNAL(removed(QString)), SIGNAL(activityRemoved(QString))); connect(activities, &Activities::removed, this, &WorkspaceWrapper::activityRemoved);
} }
#endif #endif
connect(screens(), &Screens::sizeChanged, this, &WorkspaceWrapper::virtualScreenSizeChanged); connect(screens(), &Screens::sizeChanged, this, &WorkspaceWrapper::virtualScreenSizeChanged);
@ -54,7 +54,7 @@ WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent)
emit numberScreensChanged(currentCount); 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()) { foreach (KWin::X11Client *client, ws->clientList()) {
setupClientConnections(client); setupClientConnections(client);
} }

View File

@ -65,11 +65,11 @@ TabBoxHandlerImpl::TabBoxHandlerImpl(TabBox* tabBox)
{ {
// connects for DesktopFocusChainManager // connects for DesktopFocusChainManager
VirtualDesktopManager *vds = VirtualDesktopManager::self(); VirtualDesktopManager *vds = VirtualDesktopManager::self();
connect(vds, SIGNAL(countChanged(uint,uint)), m_desktopFocusChain, SLOT(resize(uint,uint))); connect(vds, &VirtualDesktopManager::countChanged, m_desktopFocusChain, &DesktopChainManager::resize);
connect(vds, SIGNAL(currentChanged(uint,uint)), m_desktopFocusChain, SLOT(addDesktop(uint,uint))); connect(vds, &VirtualDesktopManager::currentChanged, m_desktopFocusChain, &DesktopChainManager::addDesktop);
#ifdef KWIN_BUILD_ACTIVITIES #ifdef KWIN_BUILD_ACTIVITIES
if (Activities::self()) { if (Activities::self()) {
connect(Activities::self(), SIGNAL(currentChanged(QString)), m_desktopFocusChain, SLOT(useChain(QString))); connect(Activities::self(), &Activities::currentChanged, m_desktopFocusChain, &DesktopChainManager::useChain);
} }
#endif #endif
} }
@ -486,11 +486,11 @@ TabBox::TabBox(QObject *parent)
m_desktopListConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient); m_desktopListConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient);
m_desktopListConfig.setDesktopSwitchingMode(TabBoxConfig::StaticDesktopSwitching); m_desktopListConfig.setDesktopSwitchingMode(TabBoxConfig::StaticDesktopSwitching);
m_tabBox = new TabBoxHandlerImpl(this); m_tabBox = new TabBoxHandlerImpl(this);
QTimer::singleShot(0, this, SLOT(handlerReady())); QTimer::singleShot(0, this, &TabBox::handlerReady);
m_tabBoxMode = TabBoxDesktopMode; // init variables m_tabBoxMode = TabBoxDesktopMode; // init variables
connect(&m_delayedShowTimer, SIGNAL(timeout()), this, SLOT(show())); connect(&m_delayedShowTimer, &QTimer::timeout, this, &TabBox::show);
connect(Workspace::self(), SIGNAL(configChanged()), this, SLOT(reconfigure())); connect(Workspace::self(), &Workspace::configChanged, this, &TabBox::reconfigure);
} }
TabBox::~TabBox() TabBox::~TabBox()

View File

@ -382,7 +382,7 @@ void TabBoxHandler::show()
// QMetaObject::invokeMethod(this, "initHighlightWindows", Qt::QueuedConnection); // QMetaObject::invokeMethod(this, "initHighlightWindows", Qt::QueuedConnection);
// but we somehow need to cross > 1 event cycle (likely because of queued invocation in the effects) // 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 // 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);
} }
} }

View File

@ -28,9 +28,9 @@ AbstractThumbnailItem::AbstractThumbnailItem(QQuickItem *parent)
, m_saturation(1.0) , m_saturation(1.0)
, m_clipToItem() , m_clipToItem()
{ {
connect(Compositor::self(), SIGNAL(compositingToggled(bool)), SLOT(compositingToggled())); connect(Compositor::self(), &Compositor::compositingToggled, this, &AbstractThumbnailItem::compositingToggled);
compositingToggled(); compositingToggled();
QTimer::singleShot(0, this, SLOT(init())); QTimer::singleShot(0, this, &AbstractThumbnailItem::init);
} }
AbstractThumbnailItem::~AbstractThumbnailItem() AbstractThumbnailItem::~AbstractThumbnailItem()
@ -41,8 +41,8 @@ void AbstractThumbnailItem::compositingToggled()
{ {
m_parent.clear(); m_parent.clear();
if (effects) { if (effects) {
connect(effects, SIGNAL(windowAdded(KWin::EffectWindow*)), SLOT(effectWindowAdded())); connect(effects, &EffectsHandler::windowAdded, this, &AbstractThumbnailItem::effectWindowAdded);
connect(effects, SIGNAL(windowDamaged(KWin::EffectWindow*,QRegion)), SLOT(repaint(KWin::EffectWindow*))); connect(effects, &EffectsHandler::windowDamaged, this, &AbstractThumbnailItem::repaint);
effectWindowAdded(); effectWindowAdded();
} }
} }

View File

@ -46,8 +46,8 @@ Toplevel::Toplevel()
, m_skipCloseAnimation(false) , m_skipCloseAnimation(false)
{ {
connect(this, &Toplevel::damaged, this, &Toplevel::needsRepaint); connect(this, &Toplevel::damaged, this, &Toplevel::needsRepaint);
connect(screens(), SIGNAL(changed()), SLOT(checkScreen())); connect(screens(), &Screens::changed, this, &Toplevel::checkScreen);
connect(screens(), SIGNAL(countChanged(int,int)), SLOT(checkScreen())); connect(screens(), &Screens::countChanged, this, &Toplevel::checkScreen);
setupCheckScreenConnection(); setupCheckScreenConnection();
connect(this, &Toplevel::bufferGeometryChanged, this, &Toplevel::inputTransformationChanged); connect(this, &Toplevel::bufferGeometryChanged, this, &Toplevel::inputTransformationChanged);

View File

@ -34,7 +34,7 @@ const NET::WindowTypes SUPPORTED_UNMANAGED_WINDOW_TYPES_MASK = NET::NormalMask |
Unmanaged::Unmanaged() Unmanaged::Unmanaged()
: Toplevel() : Toplevel()
{ {
QTimer::singleShot(50, this, SLOT(setReadyForPainting())); QTimer::singleShot(50, this, &Unmanaged::setReadyForPainting);
} }
Unmanaged::~Unmanaged() Unmanaged::~Unmanaged()

View File

@ -132,7 +132,7 @@ Workspace::Workspace()
activities = Activities::create(this); activities = Activities::create(this);
} }
if (activities) { if (activities) {
connect(activities, SIGNAL(currentChanged(QString)), SLOT(updateCurrentActivity(QString))); connect(activities, &Activities::currentChanged, this, &Workspace::updateCurrentActivity);
} }
#endif #endif
@ -200,23 +200,23 @@ void Workspace::init()
KSharedConfigPtr config = kwinApp()->config(); KSharedConfigPtr config = kwinApp()->config();
Screens *screens = Screens::self(); Screens *screens = Screens::self();
// get screen support // get screen support
connect(screens, SIGNAL(changed()), SLOT(desktopResized())); connect(screens, &Screens::changed, this, &Workspace::desktopResized);
screens->setConfig(config); screens->setConfig(config);
screens->reconfigure(); screens->reconfigure();
connect(options, SIGNAL(configChanged()), screens, SLOT(reconfigure())); connect(options, &Options::configChanged, screens, &Screens::reconfigure);
ScreenEdges *screenEdges = ScreenEdges::self(); ScreenEdges *screenEdges = ScreenEdges::self();
screenEdges->setConfig(config); screenEdges->setConfig(config);
screenEdges->init(); screenEdges->init();
connect(options, SIGNAL(configChanged()), screenEdges, SLOT(reconfigure())); connect(options, &Options::configChanged, screenEdges, &ScreenEdges::reconfigure);
connect(VirtualDesktopManager::self(), SIGNAL(layoutChanged(int,int)), screenEdges, SLOT(updateLayout())); connect(VirtualDesktopManager::self(), &VirtualDesktopManager::layoutChanged, screenEdges, &ScreenEdges::updateLayout);
connect(this, &Workspace::clientActivated, screenEdges, &ScreenEdges::checkBlocking); connect(this, &Workspace::clientActivated, screenEdges, &ScreenEdges::checkBlocking);
FocusChain *focusChain = FocusChain::create(this); FocusChain *focusChain = FocusChain::create(this);
connect(this, &Workspace::clientRemoved, focusChain, &FocusChain::remove); connect(this, &Workspace::clientRemoved, focusChain, &FocusChain::remove);
connect(this, &Workspace::clientActivated, focusChain, &FocusChain::setActiveClient); connect(this, &Workspace::clientActivated, focusChain, &FocusChain::setActiveClient);
connect(VirtualDesktopManager::self(), SIGNAL(countChanged(uint,uint)), focusChain, SLOT(resize(uint,uint))); connect(VirtualDesktopManager::self(), &VirtualDesktopManager::countChanged, focusChain, &FocusChain::resize);
connect(VirtualDesktopManager::self(), SIGNAL(currentChanged(uint,uint)), focusChain, SLOT(setCurrentDesktop(uint,uint))); connect(VirtualDesktopManager::self(), &VirtualDesktopManager::currentChanged, focusChain, &FocusChain::setCurrentDesktop);
connect(options, SIGNAL(separateScreenFocusChanged(bool)), focusChain, SLOT(setSeparateScreenFocus(bool))); connect(options, &Options::separateScreenFocusChanged, focusChain, &FocusChain::setSeparateScreenFocus);
focusChain->setSeparateScreenFocus(options->isSeparateScreenFocus()); focusChain->setSeparateScreenFocus(options->isSeparateScreenFocus());
// create VirtualDesktopManager and perform dependency injection // 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, &VirtualDesktopManager::countChanged, this, &Workspace::slotDesktopCountChanged);
connect(vds, SIGNAL(currentChanged(uint,uint)), SLOT(slotCurrentDesktopChanged(uint,uint))); connect(vds, &VirtualDesktopManager::currentChanged, this, &Workspace::slotCurrentDesktopChanged);
vds->setNavigationWrappingAround(options->isRollOverDesktops()); vds->setNavigationWrappingAround(options->isRollOverDesktops());
connect(options, SIGNAL(rollOverDesktopsChanged(bool)), vds, SLOT(setNavigationWrappingAround(bool))); connect(options, &Options::rollOverDesktopsChanged, vds, &VirtualDesktopManager::setNavigationWrappingAround);
vds->setConfig(config); vds->setConfig(config);
// Now we know how many desktops we'll have, thus we initialize the positioning object // 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); reconfigureTimer.setSingleShot(true);
updateToolWindowsTimer.setSingleShot(true); updateToolWindowsTimer.setSingleShot(true);
connect(&reconfigureTimer, SIGNAL(timeout()), this, SLOT(slotReconfigure())); connect(&reconfigureTimer, &QTimer::timeout, this, &Workspace::slotReconfigure);
connect(&updateToolWindowsTimer, SIGNAL(timeout()), this, SLOT(slotUpdateToolWindows())); connect(&updateToolWindowsTimer, &QTimer::timeout, this, &Workspace::slotUpdateToolWindows);
// TODO: do we really need to reconfigure everything when fonts change? // TODO: do we really need to reconfigure everything when fonts change?
// maybe just reconfigure the decorations? Move this into libkdecoration? // 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()) { if (X11Compositor *compositor = X11Compositor::self()) {
connect(c, &X11Client::blockingCompositingChanged, compositor, &X11Compositor::updateClientCompositeBlocking); 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)) { if (!c->manage(w, is_mapped)) {
X11Client::deleteClient(c); X11Client::deleteClient(c);
return nullptr; return nullptr;
@ -1249,7 +1249,7 @@ void Workspace::requestDelayFocus(AbstractClient* c)
delayfocus_client = c; delayfocus_client = c;
delete delayFocusTimer; delete delayFocusTimer;
delayFocusTimer = new QTimer(this); delayFocusTimer = new QTimer(this);
connect(delayFocusTimer, SIGNAL(timeout()), this, SLOT(delayFocus())); connect(delayFocusTimer, &QTimer::timeout, this, &Workspace::delayFocus);
delayFocusTimer->setSingleShot(true); delayFocusTimer->setSingleShot(true);
delayFocusTimer->start(options->delayFocusInterval()); delayFocusTimer->start(options->delayFocusInterval());
} }