Commit 6b990498 authored by Kurt Hindenburg's avatar Kurt Hindenburg

convert QSignalMapper (viewAdded/Removed) to lambda

parent efde8569
......@@ -23,7 +23,6 @@
#include <config-konsole.h>
// Qt
#include <QSignalMapper>
#include <QStringList>
#include <QAction>
......@@ -54,7 +53,6 @@ ViewManager::ViewManager(QObject *parent, KActionCollection *collection) :
QObject(parent),
_viewSplitter(nullptr),
_actionCollection(collection),
_containerSignalMapper(new QSignalMapper(this)),
_navigationMethod(TabbedNavigation),
_navigationVisibility(ViewContainer::AlwaysShowNavigation),
_navigationPosition(ViewContainer::NavigationPositionTop),
......@@ -86,11 +84,6 @@ ViewManager::ViewManager(QObject *parent, KActionCollection *collection) :
connect(_viewSplitter.data(), &Konsole::ViewSplitter::empty, this,
&Konsole::ViewManager::empty);
// listen for addition or removal of views from associated containers
connect(_containerSignalMapper,
static_cast<void (QSignalMapper::*)(QObject *)>(&QSignalMapper::mapped),
this, &Konsole::ViewManager::containerViewsChanged);
// listen for profile changes
connect(ProfileManager::instance(), &Konsole::ProfileManager::profileChanged,
this, &Konsole::ViewManager::profileChanged);
......@@ -689,11 +682,15 @@ ViewContainer *ViewManager::createContainer()
}
// connect signals and slots
connect(container, &Konsole::ViewContainer::viewAdded, _containerSignalMapper,
static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
connect(container, &Konsole::ViewContainer::viewRemoved, _containerSignalMapper,
static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
_containerSignalMapper->setMapping(container, container);
connect(container, &Konsole::ViewContainer::viewAdded, this,
[this, container]() {
containerViewsChanged(container);
});
connect(container, &Konsole::ViewContainer::viewRemoved, this,
[this, container]() {
containerViewsChanged(container);
});
connect(container,
static_cast<void (ViewContainer::*)()>(&Konsole::ViewContainer::newViewRequest), this,
......@@ -811,7 +808,7 @@ ViewManager::NavigationMethod ViewManager::navigationMethod() const
return _navigationMethod;
}
void ViewManager::containerViewsChanged(QObject *container)
void ViewManager::containerViewsChanged(ViewContainer *container)
{
if ((_viewSplitter != nullptr) && container == _viewSplitter->activeContainer()) {
emit viewPropertiesChanged(viewProperties());
......
......@@ -29,7 +29,6 @@
#include "Profile.h"
#include "ViewContainer.h"
class QSignalMapper;
class KActionCollection;
class KConfigGroup;
......@@ -334,7 +333,7 @@ private Q_SLOTS:
// called when the views in a container owned by this view manager
// changes
void containerViewsChanged(QObject *container);
void containerViewsChanged(ViewContainer *container);
// called when a profile changes
void profileChanged(Profile::Ptr profile);
......@@ -397,7 +396,6 @@ private:
QHash<TerminalDisplay *, Session *> _sessionMap;
KActionCollection *_actionCollection;
QSignalMapper *_containerSignalMapper;
NavigationMethod _navigationMethod;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment