eliot/qt/training_widget.h
Olivier Teulière 0e9711da25 Accept various inputs for the same tile in the Qt interface.
The dictionary format still needs to support that.
2009-06-27 18:09:44 +00:00

87 lines
2.6 KiB
C++

/*****************************************************************************
* 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
*****************************************************************************/
#ifndef TRAINING_WIDGET_H_
#define TRAINING_WIDGET_H_
#include <QtGui/QWidget>
#include "ui/training_widget.ui.h"
class QStandardItemModel;
class QString;
class CoordModel;
class PlayWordMediator;
class PublicGame;
class TrainingWidget: public QWidget, private Ui::TrainingWidget
{
Q_OBJECT;
public:
explicit TrainingWidget(QWidget *parent, CoordModel &iCoordModel, PublicGame *iGame);
public slots:
void refresh();
signals:
void gameUpdated();
void notifyProblem(QString iMsg);
void notifyInfo(QString iMsg);
void rackUpdated(const QString &iRack);
protected:
/// Define a default size
virtual QSize sizeHint() const;
private slots:
void enablePlayButton(const QItemSelection &, const QItemSelection &);
void showPreview(const QItemSelection &, const QItemSelection &);
// These slots are automatically connected
void on_lineEditRack_textEdited(const QString &iText);
void on_pushButtonRack_clicked();
void on_pushButtonComplement_clicked();
void on_pushButtonSearch_clicked();
void on_pushButtonPlaySelected_clicked();
void on_treeViewResults_doubleClicked(const QModelIndex &iIndex);
private:
/// Encapsulated training game, can be NULL
PublicGame *m_game;
/// Model of the search results
QStandardItemModel *m_model;
/// Mediator for the "play word" controls
PlayWordMediator *m_mediator;
/// Palette to write text in red
QPalette redPalette;
/// Palette to write text in black
QPalette blackPalette;
/// Force synchronizing the model with the contents of the search results
void updateModel();
};
#endif