Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Konsole
Commits
07fa804a
Commit
07fa804a
authored
Jul 12, 2020
by
Gustavo Carneiro
Committed by
Kurt Hindenburg
Jul 16, 2020
Browse files
Separates the connection between session and display
parent
7826979e
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
07fa804a
...
...
@@ -110,6 +110,7 @@ set(konsoleprivate_SRCS ${sessionadaptors_SRCS}
CharacterWidth.cpp
CompositeWidgetFocusWatcher.cpp
AutoScrollHandler.cpp
SessionDisplayConnection.cpp
${
CMAKE_CURRENT_BINARY_DIR
}
/org.kde.konsole.Window.xml
${
CMAKE_CURRENT_BINARY_DIR
}
/org.kde.konsole.Session.xml
)
...
...
src/SessionDisplayConnection.cpp
0 → 100644
View file @
07fa804a
/*
Copyright 2020-2020 by Gustavo Carneiro <gcarneiroa@hotmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/
// Own
#include "SessionDisplayConnection.h"
// Konsole
#include "Session.h"
#include "widgets/TerminalDisplay.h"
namespace
Konsole
{
SessionDisplayConnection
::
SessionDisplayConnection
(
Session
*
session
,
TerminalDisplay
*
view
,
QObject
*
parent
)
:
QObject
(
parent
)
{
mSession
=
session
;
mView
=
view
;
}
QPointer
<
Session
>
SessionDisplayConnection
::
session
()
{
return
mSession
;
}
QPointer
<
TerminalDisplay
>
SessionDisplayConnection
::
view
()
{
return
mView
;
}
bool
SessionDisplayConnection
::
isValid
()
const
{
return
!
mSession
.
isNull
()
&&
!
mView
.
isNull
();
}
}
// namespace Konsole
src/SessionDisplayConnection.h
0 → 100644
View file @
07fa804a
/*
Copyright 2020-2020 by Gustavo Carneiro <gcarneiroa@hotmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/
#ifndef SESSIONDISPLAYCONNECTION_H
#define SESSIONDISPLAYCONNECTION_H
// Qt
#include <QPointer>
// Konsole
#include "konsoleprivate_export.h"
namespace
Konsole
{
class
Session
;
class
TerminalDisplay
;
class
KONSOLEPRIVATE_EXPORT
SessionDisplayConnection
:
public
QObject
{
Q_OBJECT
public:
SessionDisplayConnection
(
Session
*
session
,
TerminalDisplay
*
view
,
QObject
*
parent
=
nullptr
);
~
SessionDisplayConnection
()
=
default
;
QPointer
<
Session
>
session
();
QPointer
<
TerminalDisplay
>
view
();
/**
* Returns true if the controller is valid.
* A valid controller is one which has a non-null session() and view().
*
* Equivalent to "!session().isNull() && !view().isNull()"
*/
bool
isValid
()
const
;
private:
QPointer
<
Session
>
mSession
;
QPointer
<
TerminalDisplay
>
mView
;
};
}
#endif
src/session/SessionController.cpp
View file @
07fa804a
This diff is collapsed.
Click to expand it.
src/session/SessionController.h
View file @
07fa804a
...
...
@@ -31,6 +31,7 @@
#include <KXMLGUIClient>
// Konsole
#include "SessionDisplayConnection.h"
#include "ViewProperties.h"
#include "Profile.h"
#include "Enumeration.h"
...
...
@@ -96,13 +97,13 @@ public:
/** Returns the session associated with this controller */
QPointer
<
Session
>
session
()
{
return
_session
;
return
_session
DisplayConnection
->
session
()
;
}
/** Returns the view associated with this controller */
QPointer
<
TerminalDisplay
>
view
()
{
return
_view
;
return
_
sessionDisplayConnection
->
view
()
;
}
/**
...
...
@@ -315,6 +316,8 @@ private:
QPointer
<
TerminalDisplay
>
_view
;
SessionGroup
*
_copyToGroup
;
SessionDisplayConnection
*
_sessionDisplayConnection
;
ProfileList
*
_profileList
;
QIcon
_sessionIcon
;
...
...
@@ -361,10 +364,6 @@ private:
QString
_previousForegroundProcessName
;
bool
_monitorProcessFinish
;
};
inline
bool
SessionController
::
isValid
()
const
{
return
!
_session
.
isNull
()
&&
!
_view
.
isNull
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment