File indexing completed on 2024-04-28 04:03:04

0001 /*
0002     SPDX-FileCopyrightText: 2007 Paolo Capriotti <p.capriotti@gmail.com>
0003     SPDX-FileCopyrightText: 2007 Riccardo Iaconelli <ruphy@fsfe.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef NETWORKDIALOG_H
0009 #define NETWORKDIALOG_H
0010 
0011 #include <QDialog>
0012 #include <QUrl>
0013 
0014 class KComboBox;
0015 class KPluralHandlingSpinBox;
0016 class KLineEdit;
0017 class QLabel;
0018 class QTcpSocket;
0019 class QPushButton;
0020 namespace KDNSSD { class PublicService; }
0021 
0022 class NetworkDialog : public QDialog
0023 {
0024 Q_OBJECT
0025     QPushButton *m_okButton;
0026     KLineEdit* m_nickname;
0027     KLineEdit* m_hostname;
0028     QTcpSocket* m_socket;
0029     KPluralHandlingSpinBox* m_port;
0030     QLabel* m_feedback;
0031     KComboBox* m_games;
0032     KDNSSD::PublicService* m_publisher;
0033     bool m_client;
0034     
0035     QString hostname() const;
0036     int port() const;
0037 private Q_SLOTS:
0038     void savePreferences();
0039     
0040     void clientOK();
0041     void clientError();
0042     void serverOK();
0043     void serviceSelected(int idx);
0044     void slotOkClicked();
0045 public:
0046     explicit NetworkDialog(bool client, QWidget* parent = nullptr, const QUrl* url = nullptr);
0047     ~NetworkDialog() override;
0048     
0049     QString nickname() const;
0050     QTcpSocket* socket() const;
0051 Q_SIGNALS:
0052     void ok();
0053 };
0054 
0055 #endif // NETWORKDIALOG_H