File indexing completed on 2025-02-16 03:48:06
0001 /* 0002 This file is part of the KDE games library 0003 SPDX-FileCopyrightText: 2001 Martin Heni (kde at heni-online.de) 0004 SPDX-FileCopyrightText: 2001 Andreas Beckermann (b_mann@gmx.de) 0005 0006 SPDX-License-Identifier: LGPL-2.0-only 0007 */ 0008 0009 #ifndef __KGAMECONNECTDIALOG_H__ 0010 #define __KGAMECONNECTDIALOG_H__ 0011 0012 // Qt 0013 #include <QWidget> 0014 0015 class KGameConnectWidgetPrivate; 0016 class QAbstractButton; 0017 /** 0018 * \class KGameConnectWidget kgameconnectdialog.h <KGameConnectWidget> 0019 */ 0020 class KGameConnectWidget : public QWidget 0021 { 0022 Q_OBJECT 0023 public: 0024 explicit KGameConnectWidget(QWidget *parent); 0025 ~KGameConnectWidget() override; 0026 0027 /** 0028 * @param host The host to connect to by default 0029 */ 0030 void setHost(const QString &host); 0031 0032 /** 0033 * @return The host to connect to or QString() if the user wants to 0034 * be the MASTER 0035 */ 0036 QString host() const; 0037 0038 /** 0039 * @param port The port that will be shown by default 0040 */ 0041 void setPort(unsigned short int port); 0042 0043 /** 0044 * @return The port to connect to / to listen 0045 */ 0046 unsigned short int port() const; 0047 0048 /** 0049 * Specifies which state is the default (0 = server game; 1 = join game) 0050 * @param state The default state. 0 For a server game, 1 to join a game 0051 */ 0052 void setDefault(int state); 0053 0054 /** 0055 * Sets DNS-SD service type, both for publishing and browsing 0056 * @param type Service type (something like _kwin4._tcp). 0057 * It should be unique for application. 0058 */ 0059 void setType(const QString &type); 0060 0061 /** 0062 * @return service type 0063 */ 0064 QString type() const; 0065 0066 /** 0067 * Set game name for publishing. 0068 * @param name Game name. Important only for server mode. If not 0069 * set hostname will be used. In case of name conflict -2, -3 and so on will be added to name. 0070 */ 0071 void setName(const QString &name); 0072 0073 /** 0074 * @return game name. 0075 */ 0076 QString gameName() const; 0077 0078 protected Q_SLOTS: 0079 /** 0080 * The type has changed, ie the user switched between creating or 0081 * joining. 0082 */ 0083 void slotTypeChanged(QAbstractButton *button); 0084 void slotGamesFound(); 0085 void slotGameSelected(int); 0086 0087 Q_SIGNALS: 0088 void signalNetworkSetup(); 0089 void signalServerTypeChanged(int); 0090 0091 private: 0092 void showDnssdControls(); 0093 KGameConnectWidgetPrivate *d; 0094 }; 0095 0096 #endif