File indexing completed on 2025-05-11 03:57:14

0001 /* This file is part of KsirK.
0002    Copyright (C) 2008 Gael de Chalendar <kleag@free.fr>
0003 
0004    KsirK is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation, either version 2
0007    of the License, or (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    General Public License for more details.
0013 
0014    You should have received a copy of the GNU General Public License
0015    along with this program; if not, write to the Free Software
0016    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0017    02110-1301, USA
0018 */
0019 
0020 #ifndef JABBERGAMEUI_H
0021 #define JABBERGAMEUI_H
0022 
0023 #include "ui_jabbergameui.h"
0024 #include "Jabber/jabberclient.h"
0025 
0026 #include <QWidget>
0027 
0028 #include <qca.h>
0029 
0030 namespace Ksirk
0031 {
0032   namespace GameLogic
0033   {
0034     class GameAutomaton;
0035   }
0036 }
0037 class KsirkJabberGameWidget : public QWidget, public Ui::KsirkJabberGameWidget
0038 {
0039   Q_OBJECT
0040 public:
0041   explicit KsirkJabberGameWidget(QWidget* parent);
0042 
0043   ~KsirkJabberGameWidget() override {}
0044                          
0045   inline void setPreviousGuiIndex(int previousIndex) {m_previousGuiIndex = previousIndex;}
0046 
0047   void init(Ksirk::GameLogic::GameAutomaton* automaton);
0048 
0049 Q_SIGNALS:
0050   void cancelled(int);
0051   
0052 public Q_SLOTS:
0053   void slotNewJabberGame(const QString& nick,
0054                           int nbPlayers,
0055                           const QString& skin);
0056 
0057 private Q_SLOTS:
0058   void slotJabberConnectButtonClicked();
0059   void slotJabberDisconnected();
0060   void slotJabberError(int);
0061   void slotHandleTLSWarning(QCA::TLS::IdentityResult, QCA::Validity);
0062   void slotJabberConnected();
0063   void slotJabberClientError(JabberClient::ErrorCode);
0064 
0065   void slotRosterRequestFinished ( bool );
0066   
0067   void slotJoinRoom();
0068   void slotGroupChatJoined (const XMPP::Jid & jid);
0069   void slotGroupChatLeft (const XMPP::Jid & jid);
0070   void slotGroupChatPresence (const XMPP::Jid & jid, const XMPP::Status & status);
0071   void slotGroupChatError (const XMPP::Jid & jid, int error, const QString & reason);
0072 
0073   void slotJoinJabberGame();
0074   
0075   void slotCellClicked(int row, int column);
0076 
0077   void slotCancel();
0078   
0079 private:
0080   Ksirk::GameLogic::GameAutomaton* m_automaton;
0081   QString m_nick;
0082   int m_nbPlayers;
0083   int m_previousGuiIndex;
0084 };
0085 
0086 #endif