modernize: Replace most remaining old-style connects by PMF ones
[quassel.git] / src / common / eventmanager.cpp
index ca1a95f..606356d 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2012 by the Quassel Project                        *
+ *   Copyright (C) 2005-2018 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -126,7 +126,7 @@ int EventManager::findEventType(const QString &methodSignature_, const QString &
         int num = methodSignature.right(3).toUInt();
         if (num > 0) {
             QString numericSig = methodSignature.left(methodSignature.length() - 3) + "Numeric";
-            eventType = eventEnum().keyToValue(numericSig.toAscii());
+            eventType = eventEnum().keyToValue(numericSig.toLatin1());
             if (eventType < 0) {
                 qWarning() << Q_FUNC_INFO << "Could not find EventType" << numericSig << "for handling" << methodSignature;
                 return -1;
@@ -136,7 +136,7 @@ int EventManager::findEventType(const QString &methodSignature_, const QString &
     }
 
     if (eventType < 0)
-        eventType = eventEnum().keyToValue(methodSignature.toAscii());
+        eventType = eventEnum().keyToValue(methodSignature.toLatin1());
     if (eventType < 0) {
         qWarning() << Q_FUNC_INFO << "Could not find EventType" << methodSignature;
         return -1;
@@ -148,8 +148,7 @@ int EventManager::findEventType(const QString &methodSignature_, const QString &
 void EventManager::registerObject(QObject *object, Priority priority, const QString &methodPrefix, const QString &filterPrefix)
 {
     for (int i = object->metaObject()->methodOffset(); i < object->metaObject()->methodCount(); i++) {
-        QString methodSignature(object->metaObject()->method(i).signature());
-
+        QString methodSignature = object->metaObject()->method(i).methodSignature();
         int eventType = findEventType(methodSignature, methodPrefix);
         if (eventType > 0) {
             Handler handler(object, i, priority);
@@ -208,7 +207,7 @@ void EventManager::registerEventHandler(QList<EventType> events, QObject *object
 void EventManager::postEvent(Event *event)
 {
     if (sender() && sender()->thread() != this->thread()) {
-        QueuedQuasselEvent *queuedEvent = new QueuedQuasselEvent(event);
+        auto *queuedEvent = new QueuedQuasselEvent(event);
         QCoreApplication::postEvent(this, queuedEvent);
     }
     else {
@@ -224,7 +223,7 @@ void EventManager::postEvent(Event *event)
 void EventManager::customEvent(QEvent *event)
 {
     if (event->type() == QEvent::User) {
-        QueuedQuasselEvent *queuedEvent = static_cast<QueuedQuasselEvent *>(event);
+        auto *queuedEvent = static_cast<QueuedQuasselEvent *>(event);
         processEvent(queuedEvent->event);
         event->accept();
     }
@@ -259,7 +258,7 @@ void EventManager::dispatchEvent(Event *event)
 
     // special handling for numeric IrcEvents
     if ((type & ~IrcEventNumericMask) == IrcEventNumeric) {
-        ::IrcEventNumeric *numEvent = static_cast< ::IrcEventNumeric *>(event);
+        auto *numEvent = static_cast< ::IrcEventNumeric *>(event);
         if (!numEvent)
             qWarning() << "Invalid event type for IrcEventNumeric!";
         else {
@@ -302,7 +301,7 @@ void EventManager::dispatchEvent(Event *event)
         }
 
         // finally, deliverance!
-        void *param[] = { 0, Q_ARG(Event *, event).data() };
+        void *param[] = { nullptr, Q_ARG(Event *, event).data() };
         obj->qt_metacall(QMetaObject::InvokeMetaMethod, it->methodIndex, param);
     }