37 lines
724 B
C
Raw Normal View History

2023-10-29 23:33:08 +01:00
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef SERVER_H
#define SERVER_H
2023-12-04 18:42:35 +01:00
#include <QApplication>
2023-10-29 23:33:08 +01:00
#include <QDialog>
2023-12-04 18:42:35 +01:00
#include <QLabel>
#include <QLineEdit>
#include <QLocalServer>
#include <QPushButton>
2023-10-29 23:33:08 +01:00
class Server : public QDialog
{
2023-12-04 18:42:35 +01:00
Q_DECLARE_TR_FUNCTIONS(Server)
2023-10-29 23:33:08 +01:00
public:
explicit Server(QWidget *parent = nullptr);
2023-12-04 18:42:35 +01:00
private:
2023-10-29 23:33:08 +01:00
void sendFortune();
2023-12-04 18:42:35 +01:00
void toggleListenButton();
void listenToServer();
void stopListening();
2023-10-29 23:33:08 +01:00
QLocalServer *server;
2023-12-04 18:42:35 +01:00
QLineEdit *hostLineEdit;
QLabel *statusLabel;
QPushButton *listenButton;
QPushButton *stopListeningButton;
2023-10-29 23:33:08 +01:00
QStringList fortunes;
2023-12-04 18:42:35 +01:00
QString name;
2023-10-29 23:33:08 +01:00
};
#endif