/*************************************************************************** * Copyright (C) 1980-2005 Artur Wiebe * * artur@wiebenet.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _VIEW_H_ #define _VIEW_H_ #include "field.h" #include "checkers.h" #include #include #include class Pdn; class myServerSocket; class myClientSocket; class myThread; class myPlayer; class myView : public QFrame { Q_OBJECT public: myView(QWidget* parent); ~myView(); void newGame(myPlayer* first, myPlayer* second, int skill); void openGame(Pdn*, bool board_only); void setPattern(const QString& pattern, const QString& tile_size); void getPdn(Pdn*); bool isNetworkGame() const; bool isAborted() const { return m_aborted; } bool isServer() const; public slots: virtual void setEnabled(bool); void undo(); void slotStopGame(); void slotNextRound(); void slotShowNotation(bool); signals: void message(int msg_type, const QString& msg_text); // void working(bool); void enableUndo(bool); // void sendText(const QString&); private slots: void slotClick(int); void slotStopped(); void slotMoveDone(const QString& board); void slotPlayerMessage(const QString& msg); private: void init_game(myPlayer* m_player, myPlayer* opp, int rules, int skill); void begin_game(bool white_begins); QWidget* create_board(); QWidget* create_info(); void setColorWhite(bool); void draw_board(); // instead of taking standard board, this myboard void reset_board(int myboard[32]); void drawNotation(); void setError(const QString& text, int msec); void stop_game(const QString&); void you_won(bool really); bool check_game_over(); private: bool m_notation; bool m_game_over; // need this to avoid multiple calls to isGameOver() bool m_aborted; Field* field[64]; // Fields of board QPixmap* xpmPat1; QPixmap* xpmPat2; QPixmap* xpmFrame; QPixmap* xpmMan1; QPixmap* xpmMan2; QPixmap* xpmKing1; QPixmap* xpmKing2; QPixmap* xpmManBlack; QPixmap* xpmManWhite; QPixmap* xpmKingBlack; QPixmap* xpmKingWhite; QString pdnEvent; QString pdnSite; QString pdnDate; QString pdnResult; QString pdnRound; // struct info_struct { QHBox* frm; QLabel* rounds; QLabel* name; }; QLabel* m_rules; struct info_struct m_white; struct info_struct m_black; Checkers* game; myPlayer* m_player; myPlayer* m_current; int m_players_ready; QFrame* m_board; QLabel* m_status; QLabel* m_error; }; #endif