2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#ifndef BLOCKINGCLIENT_H
|
|
|
|
#define BLOCKINGCLIENT_H
|
|
|
|
|
2011-04-27 17:16:41 +00:00
|
|
|
#include <QWidget>
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
#include "fortunethread.h"
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QDialogButtonBox;
|
|
|
|
class QLabel;
|
|
|
|
class QLineEdit;
|
|
|
|
class QPushButton;
|
2011-04-27 17:16:41 +00:00
|
|
|
class QAction;
|
2011-04-27 10:05:43 +00:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
//! [0]
|
2011-04-27 17:16:41 +00:00
|
|
|
class BlockingClient : public QWidget
|
2011-04-27 10:05:43 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2019-11-01 12:21:32 +00:00
|
|
|
BlockingClient(QWidget *parent = nullptr);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void requestNewFortune();
|
|
|
|
void showFortune(const QString &fortune);
|
|
|
|
void displayError(int socketError, const QString &message);
|
|
|
|
void enableGetFortuneButton();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QLabel *hostLabel;
|
|
|
|
QLabel *portLabel;
|
|
|
|
QLineEdit *hostLineEdit;
|
|
|
|
QLineEdit *portLineEdit;
|
|
|
|
QLabel *statusLabel;
|
|
|
|
QPushButton *getFortuneButton;
|
|
|
|
QPushButton *quitButton;
|
|
|
|
QDialogButtonBox *buttonBox;
|
|
|
|
|
|
|
|
FortuneThread thread;
|
|
|
|
QString currentFortune;
|
|
|
|
};
|
|
|
|
//! [0]
|
|
|
|
|
|
|
|
#endif
|