File indexing completed on 2024-05-12 04:04:15

0001 /*
0002     This file is part of Knights, a chess board for KDE SC 4.
0003     SPDX-FileCopyrightText: 2009, 2010, 2011 Miha Čančula <miha@noughmad.eu>
0004 
0005     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #ifndef KNIGHTS_FICSDIALOG_H
0009 #define KNIGHTS_FICSDIALOG_H
0010 
0011 #include "proto/ficsprotocol.h"
0012 
0013 #include <QWidget>
0014 #include <QStringListModel>
0015 
0016 namespace Ui {
0017 class FicsDialog;
0018 }
0019 
0020 namespace Knights {
0021 class FicsDialog : public QWidget {
0022     Q_OBJECT
0023 public:
0024     explicit FicsDialog ( QWidget* parent = nullptr, Qt::WindowFlags f = {} );
0025     ~FicsDialog() override;
0026 
0027     QString userName();
0028     QString password();
0029     bool remember();
0030 
0031     void setServerName(const QString& name);
0032 
0033     QSize sizeHint() const override;
0034 
0035     bool autoAcceptChallenge();
0036     bool rated();
0037 
0038 public Q_SLOTS:
0039     void slotSessionStarted();
0040     void addGameOffer ( const FicsGameOffer& offer );
0041     void removeGameOffer ( int id );
0042     void addChallenge ( const FicsChallenge& challenge );
0043     void removeChallenge ( int id );
0044 
0045     void clearOffers();
0046     void accept();
0047     void decline();
0048 
0049     void currentTabChanged ( int tab );
0050     void slotCreateAccount();
0051     void slotLogin();
0052     void setConsoleWidget(QWidget* widget);
0053     void focusOnLogin();
0054     void setStatus(const QString& status, bool error = false);
0055     void setLoginEnabled ( bool enable );
0056 
0057 Q_SIGNALS:
0058     void login ( const QString &username, const QString &password );
0059 
0060     void seekingChanged ( bool seek );
0061     void declineButtonNeeded ( bool needed );
0062     void acceptButtonNeeded ( bool needed );
0063 
0064     void acceptSeek ( int seekId );
0065     void acceptChallenge ( int challengeId );
0066     void declineChallenge ( int challengeId );
0067 
0068 private Q_SLOTS:
0069     void rememberCheckBoxChanged( int state );
0070 
0071 private:
0072     void saveFicsSettings();
0073     Ui::FicsDialog* ui;
0074     QList<int> m_gameId;
0075     QList<int> m_challengeId;
0076     QStringListModel m_challengeModel;
0077     QString serverName;
0078 };
0079 }
0080 
0081 #endif // KNIGHTS_FICSDIALOG_H