File indexing completed on 2024-04-21 07:49:41

0001 /***************************************************************************
0002  *   Copyright (C) 2005, 2008 by Albert Astals Cid <aacid@kde.org>         *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  ***************************************************************************/
0009 
0010 #ifndef SCORES_H
0011 #define SCORES_H
0012 
0013 #include <QAbstractTableModel>
0014 
0015 #include "player.h"
0016 #include "row.h"
0017 
0018 class QPainter;
0019 
0020 class scores : public QAbstractTableModel
0021 {
0022     public:
0023         scores();
0024 
0025         bool allScores() const;
0026 
0027         void nextPlayer();
0028         const player &currentPlayer() const;
0029         int currentPlayerNumber() const;
0030         const player &winner() const;
0031         Row row(int row) const;
0032         int rowForScoreRow(int scoreRow) const;
0033         
0034         int rowCount(const QModelIndex &index) const override;
0035         int columnCount(const QModelIndex &index) const override;
0036         QVariant data(const QModelIndex &index, int role) const override;
0037         bool setData(const QModelIndex &mi, const QVariant &value, int role) override;
0038         
0039         void askForRedraw();
0040         void print(QPainter &painter, double width, double height) const;
0041     
0042     private:
0043         QList<player> m_players;
0044         QList<Row> m_rows;
0045         int m_currentPlayer;
0046 };
0047 
0048 #endif