Connection syntax migration (#637)
This commit is contained in:
@@ -33,7 +33,6 @@
|
||||
#include <QAction>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "core/closure.h"
|
||||
#include "core/logging.h"
|
||||
#include "globalshortcuts.h"
|
||||
#include "globalshortcutbackend.h"
|
||||
@@ -69,7 +68,7 @@ bool GlobalShortcutBackendGSD::DoRegister() {
|
||||
QDBusPendingReply<> reply = interface_->GrabMediaPlayerKeys(QCoreApplication::applicationName(), QDateTime::currentDateTime().toSecsSinceEpoch());
|
||||
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
|
||||
NewClosure(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(RegisterFinished(QDBusPendingCallWatcher*)), watcher);
|
||||
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, &GlobalShortcutBackendGSD::RegisterFinished);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -85,7 +84,7 @@ void GlobalShortcutBackendGSD::RegisterFinished(QDBusPendingCallWatcher *watcher
|
||||
return;
|
||||
}
|
||||
|
||||
connect(interface_, SIGNAL(MediaPlayerKeyPressed(QString, QString)), this, SLOT(GnomeMediaKeyPressed(QString, QString)));
|
||||
QObject::connect(interface_, &OrgGnomeSettingsDaemonMediaKeysInterface::MediaPlayerKeyPressed, this, &GlobalShortcutBackendGSD::GnomeMediaKeyPressed);
|
||||
is_connected_ = true;
|
||||
|
||||
qLog(Debug) << "Registered";
|
||||
@@ -104,7 +103,7 @@ void GlobalShortcutBackendGSD::DoUnregister() {
|
||||
is_connected_ = false;
|
||||
|
||||
interface_->ReleaseMediaPlayerKeys(QCoreApplication::applicationName());
|
||||
disconnect(interface_, SIGNAL(MediaPlayerKeyPressed(QString, QString)), this, SLOT(GnomeMediaKeyPressed(QString, QString)));
|
||||
QObject::disconnect(interface_, &OrgGnomeSettingsDaemonMediaKeysInterface::MediaPlayerKeyPressed, this, &GlobalShortcutBackendGSD::GnomeMediaKeyPressed);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#endif
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "core/closure.h"
|
||||
|
||||
#include "globalshortcutbackend-kde.h"
|
||||
|
||||
@@ -63,7 +62,7 @@ bool GlobalShortcutBackendKDE::DoRegister() {
|
||||
|
||||
QDBusPendingReply<QDBusObjectPath> reply = interface_->getComponent(QCoreApplication::applicationName());
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
|
||||
NewClosure(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(RegisterFinished(QDBusPendingCallWatcher*)), watcher);
|
||||
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, &GlobalShortcutBackendKDE::RegisterFinished);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -90,7 +89,7 @@ void GlobalShortcutBackendKDE::RegisterFinished(QDBusPendingCallWatcher *watcher
|
||||
return;
|
||||
}
|
||||
|
||||
connect(component_, SIGNAL(globalShortcutPressed(QString, QString, qlonglong)), this, SLOT(GlobalShortcutPressed(QString, QString, qlonglong)), Qt::UniqueConnection);
|
||||
QObject::connect(component_, &org::kde::kglobalaccel::Component::globalShortcutPressed, this, &GlobalShortcutBackendKDE::GlobalShortcutPressed, Qt::UniqueConnection);
|
||||
|
||||
qLog(Debug) << "Registered";
|
||||
|
||||
@@ -110,7 +109,7 @@ void GlobalShortcutBackendKDE::DoUnregister() {
|
||||
}
|
||||
}
|
||||
|
||||
if (component_) disconnect(component_, nullptr, this, nullptr);
|
||||
if (component_) QObject::disconnect(component_, nullptr, this, nullptr);
|
||||
|
||||
qLog(Debug) << "Unregistered";
|
||||
|
||||
|
||||
@@ -62,4 +62,3 @@ class GlobalShortcutBackendMacOS : public GlobalShortcutBackend {
|
||||
};
|
||||
|
||||
#endif // GLOBALSHORTCUTBACKEND_MACOS_H
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ bool GlobalShortcutBackendSystem::AddShortcut(QAction *action) {
|
||||
if (action->shortcut().isEmpty()) return false;
|
||||
|
||||
GlobalShortcut *shortcut = new GlobalShortcut(action->shortcut(), this, this);
|
||||
connect(shortcut, SIGNAL(activated()), action, SLOT(trigger()));
|
||||
QObject::connect(shortcut, &GlobalShortcut::activated, action, &QAction::trigger);
|
||||
shortcuts_ << shortcut;
|
||||
return true;
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ class GlobalShortcutBackendSystem : public GlobalShortcutBackend {
|
||||
void DoUnregister() override;
|
||||
|
||||
private:
|
||||
|
||||
bool AddShortcut(QAction *action);
|
||||
bool RemoveShortcut(QAction *action);
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ GlobalShortcutGrabber::GlobalShortcutGrabber(QWidget *parent)
|
||||
|
||||
modifier_keys_ << Qt::Key_Shift << Qt::Key_Control << Qt::Key_Meta << Qt::Key_Alt << Qt::Key_AltGr;
|
||||
|
||||
connect(ui_->buttonBox, SIGNAL(accepted()), this, SLOT(Accepted()));
|
||||
connect(ui_->buttonBox, SIGNAL(rejected()), this, SLOT(Rejected()));
|
||||
QObject::connect(ui_->buttonBox, &QDialogButtonBox::accepted, this, &GlobalShortcutGrabber::Accepted);
|
||||
QObject::connect(ui_->buttonBox, &QDialogButtonBox::rejected, this, &GlobalShortcutGrabber::Rejected);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ void GlobalShortcuts::ReloadSettings() {
|
||||
void GlobalShortcuts::AddShortcut(const QString &id, const QString &name, const char *signal, const QKeySequence &default_key) {
|
||||
|
||||
Shortcut shortcut = AddShortcut(id, name, default_key);
|
||||
connect(shortcut.action, SIGNAL(triggered()), this, signal);
|
||||
QObject::connect(shortcut.action, SIGNAL(triggered()), this, signal);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -100,4 +100,4 @@ class GlobalShortcuts : public QWidget {
|
||||
bool use_x11_;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // GLOBALSHORTCUTS_H
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef KEYMAPPER_WIN_H
|
||||
#define KEYMAPPER_WIN_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
@@ -132,3 +135,5 @@ static const QMap<Qt::Key, quint32> keymapper_win_ = {
|
||||
|
||||
};
|
||||
} // namespace
|
||||
|
||||
#endif // KEYMAPPER_WIN_H
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef KEYMAPPER_X11_H
|
||||
#define KEYMAPPER_X11_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
@@ -249,3 +252,4 @@ static const QMap<Qt::Key, quint32> keymapper_x11_ = {
|
||||
};
|
||||
} // namespace
|
||||
|
||||
#endif // KEYMAPPER_X11_H
|
||||
|
||||
Reference in New Issue
Block a user