File indexing completed on 2024-04-28 05:50:48

0001 /*
0002     SPDX-FileCopyrightText: 2020-2020 Gustavo Carneiro <gcarneiroa@hotmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef SESSIONDISPLAYCONNECTION_H
0008 #define SESSIONDISPLAYCONNECTION_H
0009 
0010 // Qt
0011 #include <QObject>
0012 #include <QPointer>
0013 
0014 #include "konsoleprivate_export.h"
0015 
0016 namespace Konsole
0017 {
0018 class Session;
0019 class TerminalDisplay;
0020 
0021 class KONSOLEPRIVATE_EXPORT SessionDisplayConnection : public QObject
0022 {
0023     Q_OBJECT
0024 public:
0025     SessionDisplayConnection(Session *session, TerminalDisplay *view, QObject *parent = nullptr);
0026     ~SessionDisplayConnection() override = default;
0027 
0028     QPointer<Session> session();
0029     QPointer<TerminalDisplay> view();
0030 
0031     /**
0032      * Returns true if the session and view is valid.
0033      * A valid connection and view is one which has a non-null session() and view().
0034      *
0035      * Equivalent to "!session().isNull() && !view().isNull()"
0036      */
0037     bool isValid() const;
0038 
0039 private:
0040     QPointer<Session> _session;
0041     QPointer<TerminalDisplay> _view;
0042 };
0043 
0044 }
0045 
0046 #endif