File indexing completed on 2024-05-12 04:04:16
0001 /*************************************************************************** 0002 File : xboardprotocol.h 0003 Project : Knights 0004 Description : Wrapper for the XBoard protocol 0005 -------------------------------------------------------------------- 0006 SPDX-FileCopyrightText: 2016 Alexander Semke (alexander.semke@web.de) 0007 SPDX-FileCopyrightText: 2009-2011 Miha Čančula (miha@noughmad.eu) 0008 0009 ***************************************************************************/ 0010 0011 /*************************************************************************** 0012 * * 0013 * SPDX-License-Identifier: GPL-2.0-or-later 0014 * * 0015 * This program is distributed in the hope that it will be useful, * 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0018 * GNU General Public License for more details. * 0019 * * 0020 * You should have received a copy of the GNU General Public License * 0021 * along with this program; if not, write to the Free Software * 0022 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 0023 * Boston, MA 02110-1301 USA * 0024 * * 0025 ***************************************************************************/ 0026 0027 #ifndef XBOARDPROTOCOL_H 0028 #define XBOARDPROTOCOL_H 0029 0030 #include "proto/computerprotocol.h" 0031 0032 namespace Knights { 0033 0034 class XBoardProtocol : public ComputerProtocol { 0035 Q_OBJECT 0036 0037 public: 0038 explicit XBoardProtocol(QObject* parent = nullptr); 0039 ~XBoardProtocol() override; 0040 0041 void move(const Move&) override; 0042 Features supportedFeatures() override; 0043 0044 QList<ToolWidgetData> toolWidgets() override; 0045 0046 bool parseLine(const QString& line) override; 0047 bool parseStub(const QString& line) override; 0048 0049 private: 0050 QString lastMoveString; 0051 bool m_resumePending; 0052 int m_moves; 0053 int m_increment; 0054 int m_baseTime; 0055 bool m_timeLimit; 0056 0057 public Q_SLOTS: 0058 void init () override; 0059 void startGame() override; 0060 void setWinner(Color) override; 0061 0062 void makeOffer(const Offer&) override; 0063 void acceptOffer(const Offer&) override; 0064 void declineOffer(const Offer&) override; 0065 0066 void setDifficulty(int depth, int memory) override; 0067 }; 0068 } 0069 0070 #endif //XBOARDPROTOCOL_H