summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Hindenburg <[email protected]>2018-01-08 22:24:35 -0500
committerKurt Hindenburg <[email protected]>2018-01-08 22:24:35 -0500
commitbed79d9fdf3eb96ecc8cd8a672c61cdd6cdca212 (patch)
tree7448f00025ee64ec2ab37998c7a4b12f176c0eb2
parent6cc32028e1adfe7d4833e4c68296ae9148e474b9 (diff)
convert QSignalMapper (session finished) to lambda
-rw-r--r--src/SessionManager.cpp17
-rw-r--r--src/SessionManager.h2
2 files changed, 6 insertions, 13 deletions
diff --git a/src/SessionManager.cpp b/src/SessionManager.cpp
index dda1b0c..565c6c7 100644
--- a/src/SessionManager.cpp
+++ b/src/SessionManager.cpp
@@ -26,7 +26,6 @@
// Qt
#include <QStringList>
-#include <QSignalMapper>
#include <QTextCodec>
// KDE
@@ -43,11 +42,6 @@ using namespace Konsole;
SessionManager::SessionManager()
{
- //map finished() signals from sessions
- _sessionMapper = new QSignalMapper(this);
- connect(_sessionMapper, static_cast<void (QSignalMapper::*)(QObject *)>(&QSignalMapper::mapped),
- this, &Konsole::SessionManager::sessionTerminated);
-
ProfileManager *profileMananger = ProfileManager::instance();
connect(profileMananger, &Konsole::ProfileManager::profileChanged, this,
&Konsole::SessionManager::profileChanged);
@@ -107,9 +101,10 @@ Session *SessionManager::createSession(Profile::Ptr profile)
&Konsole::SessionManager::sessionProfileCommandReceived);
//ask for notification when session dies
- _sessionMapper->setMapping(session, session);
- connect(session, &Konsole::Session::finished, _sessionMapper,
- static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
+ connect(session, &Konsole::Session::finished, this,
+ [this, session]() {
+ sessionTerminated(session);
+ });
//add session to active list
_sessions << session;
@@ -123,10 +118,8 @@ void SessionManager::profileChanged(Profile::Ptr profile)
applyProfile(profile, true);
}
-void SessionManager::sessionTerminated(QObject *sessionObject)
+void SessionManager::sessionTerminated(Session *session)
{
- Session *session = qobject_cast<Session *>(sessionObject);
-
Q_ASSERT(session);
_sessions.removeAll(session);
diff --git a/src/SessionManager.h b/src/SessionManager.h
index 76202b5..e8e64f6 100644
--- a/src/SessionManager.h
+++ b/src/SessionManager.h
@@ -107,7 +107,7 @@ protected Q_SLOTS:
*
* @param session The Session which has finished executing.
*/
- void sessionTerminated(QObject *sessionObject);
+ void sessionTerminated(Session *session);
private Q_SLOTS:
void sessionProfileCommandReceived(const QString &text);