2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2017 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#ifndef CLIENT_H
|
|
|
|
#define CLIENT_H
|
|
|
|
|
2017-09-27 09:59:59 +00:00
|
|
|
#include <QDataStream>
|
2011-04-27 10:05:43 +00:00
|
|
|
#include <QDialog>
|
|
|
|
#include <QTcpSocket>
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
2012-02-15 20:12:15 +00:00
|
|
|
class QComboBox;
|
2011-04-27 10:05:43 +00:00
|
|
|
class QLabel;
|
|
|
|
class QLineEdit;
|
|
|
|
class QPushButton;
|
|
|
|
class QTcpSocket;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
//! [0]
|
|
|
|
class Client : public QDialog
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-09-27 09:59:59 +00:00
|
|
|
explicit Client(QWidget *parent = nullptr);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void requestNewFortune();
|
|
|
|
void readFortune();
|
|
|
|
void displayError(QAbstractSocket::SocketError socketError);
|
|
|
|
void enableGetFortuneButton();
|
|
|
|
|
|
|
|
private:
|
2017-09-27 09:59:59 +00:00
|
|
|
QComboBox *hostCombo = nullptr;
|
|
|
|
QLineEdit *portLineEdit = nullptr;
|
|
|
|
QLabel *statusLabel = nullptr;
|
|
|
|
QPushButton *getFortuneButton = nullptr;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2017-09-27 09:59:59 +00:00
|
|
|
QTcpSocket *tcpSocket = nullptr;
|
2015-03-05 08:52:17 +00:00
|
|
|
QDataStream in;
|
2011-04-27 10:05:43 +00:00
|
|
|
QString currentFortune;
|
|
|
|
};
|
|
|
|
//! [0]
|
|
|
|
|
|
|
|
#endif
|