File indexing completed on 2025-01-05 04:46:27
0001 /*************************************************************************** 0002 * SPDX-FileCopyrightText: 2013 Volker Krause <vkrause@kde.org> * 0003 * * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later * 0005 ***************************************************************************/ 0006 0007 #pragma once 0008 0009 #include <QElapsedTimer> 0010 #include <QLocalSocket> 0011 #include <QObject> 0012 0013 class QIODevice; 0014 class QSocketNotifier; 0015 0016 /** ASAP CLI session. */ 0017 class Session : public QObject 0018 { 0019 Q_OBJECT 0020 public: 0021 explicit Session(const QString &input, QObject *parent = nullptr); 0022 ~Session() override; 0023 0024 void printStats() const; 0025 0026 public Q_SLOTS: 0027 void connectToHost(); 0028 0029 Q_SIGNALS: 0030 void disconnected(); 0031 0032 private Q_SLOTS: 0033 void inputAvailable(); 0034 void serverDisconnected(); 0035 void serverError(QLocalSocket::LocalSocketError socketError); 0036 void serverRead(); 0037 0038 private: 0039 QIODevice *m_input = nullptr; 0040 QIODevice *m_session = nullptr; 0041 QSocketNotifier *m_notifier = nullptr; 0042 0043 QElapsedTimer m_connectionTime; 0044 qint64 m_receivedBytes = 0; 0045 qint64 m_sentBytes = 0; 0046 };