2008-01-20 19:40:12 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* Eliot
|
|
|
|
* Copyright (C) 2008 Olivier Teulière
|
|
|
|
* Authors: Olivier Teulière <ipkiss @@ gmail.com>
|
|
|
|
*
|
|
|
|
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2009-02-19 19:25:17 +01:00
|
|
|
#ifndef PLAYER_WIDGET_H_
|
|
|
|
#define PLAYER_WIDGET_H_
|
2008-01-20 19:40:12 +01:00
|
|
|
|
|
|
|
#include <QtGui/QWidget>
|
2008-01-22 16:30:20 +01:00
|
|
|
#include <QtGui/QTabWidget>
|
2008-01-20 19:40:12 +01:00
|
|
|
#include "ui/player_widget.ui.h"
|
|
|
|
|
|
|
|
|
|
|
|
class QLineEdit;
|
2008-11-30 21:53:44 +01:00
|
|
|
class PublicGame;
|
2009-02-19 19:25:17 +01:00
|
|
|
class PlayWordMediator;
|
|
|
|
class CoordModel;
|
|
|
|
class Coord;
|
2008-01-20 19:40:12 +01:00
|
|
|
|
|
|
|
class PlayerWidget: public QWidget, private Ui::PlayerWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT;
|
|
|
|
|
|
|
|
public:
|
2009-02-19 19:25:17 +01:00
|
|
|
explicit PlayerWidget(QWidget *parent,
|
|
|
|
CoordModel &iCoordModel,
|
2008-01-20 19:40:12 +01:00
|
|
|
unsigned int iPlayerNb = 0,
|
2008-11-30 21:53:44 +01:00
|
|
|
PublicGame *iGame = NULL);
|
2008-01-20 19:40:12 +01:00
|
|
|
|
|
|
|
signals:
|
2008-01-25 19:42:59 +01:00
|
|
|
void gameUpdated();
|
|
|
|
void notifyProblem(QString iMsg);
|
2008-11-04 22:31:13 +01:00
|
|
|
void notifyInfo(QString iMsg);
|
2008-01-20 19:40:12 +01:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void refresh();
|
|
|
|
|
2008-01-22 16:30:20 +01:00
|
|
|
protected:
|
|
|
|
virtual QSize sizeHint() const;
|
|
|
|
|
2008-01-20 19:40:12 +01:00
|
|
|
private slots:
|
|
|
|
void on_pushButtonShuffle_clicked();
|
|
|
|
void on_pushButtonChange_clicked() { on_lineEditChange_returnPressed(); }
|
|
|
|
void on_pushButtonPass_clicked() { on_lineEditChange_returnPressed(); }
|
|
|
|
void on_lineEditChange_textChanged();
|
|
|
|
void on_lineEditChange_returnPressed();
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// Encapsulated game, can be NULL
|
2008-11-30 21:53:44 +01:00
|
|
|
PublicGame *m_game;
|
2008-01-20 19:40:12 +01:00
|
|
|
|
2009-02-19 19:25:17 +01:00
|
|
|
/// Mediator for the "play word" controls
|
|
|
|
PlayWordMediator *m_mediator;
|
|
|
|
|
2008-01-20 19:40:12 +01:00
|
|
|
/// Encapsulated player, valid iff m_game is not NULL
|
|
|
|
unsigned int m_player;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2008-01-22 16:30:20 +01:00
|
|
|
|
|
|
|
class PlayerTabWidget: public QTabWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT;
|
|
|
|
|
|
|
|
public:
|
2009-02-19 19:25:17 +01:00
|
|
|
explicit PlayerTabWidget(CoordModel &iCoordModel, QWidget *parent = 0);
|
2008-01-22 16:30:20 +01:00
|
|
|
|
|
|
|
public slots:
|
2008-11-30 21:53:44 +01:00
|
|
|
void setGame(PublicGame *iGame);
|
2008-01-22 16:30:20 +01:00
|
|
|
void refresh();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void refreshSignal();
|
2008-01-24 21:18:00 +01:00
|
|
|
void gameUpdated();
|
2008-01-25 19:42:59 +01:00
|
|
|
void notifyProblem(QString iMsg);
|
2008-11-04 22:31:13 +01:00
|
|
|
void notifyInfo(QString iMsg);
|
2008-12-14 14:20:38 +01:00
|
|
|
void trainingRackUpdated(const QString &iRack);
|
2008-09-14 19:56:18 +02:00
|
|
|
|
|
|
|
private slots:
|
|
|
|
void changeCurrentPlayer(int);
|
|
|
|
|
|
|
|
private:
|
|
|
|
/// Encapsulated game, can be NULL
|
2008-11-30 21:53:44 +01:00
|
|
|
PublicGame *m_game;
|
2009-02-19 19:25:17 +01:00
|
|
|
|
|
|
|
/// Model for the word coordinates
|
|
|
|
CoordModel &m_coordModel;
|
2008-01-22 16:30:20 +01:00
|
|
|
};
|
|
|
|
|
2008-01-20 19:40:12 +01:00
|
|
|
#endif
|
|
|
|
|