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
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef BAG_WIDGET_H_
|
|
|
|
#define BAG_WIDGET_H_
|
|
|
|
|
|
|
|
#include <QtGui/QTreeView>
|
|
|
|
|
|
|
|
|
2008-11-30 21:53:44 +01:00
|
|
|
class PublicGame;
|
2008-01-20 19:40:12 +01:00
|
|
|
class QStandardItemModel;
|
|
|
|
|
|
|
|
class BagWidget: public QTreeView
|
|
|
|
{
|
|
|
|
Q_OBJECT;
|
|
|
|
|
|
|
|
public:
|
2008-01-22 16:30:20 +01:00
|
|
|
explicit BagWidget(QWidget *parent = 0);
|
2008-01-20 19:40:12 +01:00
|
|
|
|
|
|
|
public slots:
|
2008-11-30 21:53:44 +01:00
|
|
|
void setGame(const PublicGame *iGame);
|
2008-01-22 16:30:20 +01:00
|
|
|
void refresh();
|
2008-01-20 19:40:12 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/// Define a default size
|
|
|
|
virtual QSize sizeHint() const;
|
|
|
|
|
|
|
|
private:
|
2008-01-22 16:30:20 +01:00
|
|
|
/// Encapsulated game, can be NULL
|
2008-11-30 21:53:44 +01:00
|
|
|
const PublicGame *m_game;
|
2008-01-20 19:40:12 +01:00
|
|
|
|
|
|
|
/// Model of the bag
|
|
|
|
QStandardItemModel *m_model;
|
|
|
|
|
|
|
|
/// Force synchronizing the model with the contents of the bag
|
|
|
|
void updateModel();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|