File indexing completed on 2024-04-21 04:02:29

0001 /***************************************************************************
0002  *   Copyright (C) 2005 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 DICESWIDGET_H
0011 #define DICESWIDGET_H
0012 
0013 #include <QPixmap>
0014 #include <QWidget>
0015 
0016 class dicesWidget : public QWidget
0017 {
0018     public:
0019         explicit dicesWidget(QWidget *parent);
0020         
0021         void setEnabled(bool enabled);
0022         
0023         bool roll();
0024         void rollAll();
0025 
0026         int getDice(int dice) const;
0027         void selectDice(int dice, bool select);
0028         void highlightDice(int dice, bool highlight);
0029         
0030         int getOnes() const;
0031         int getTwos() const;
0032         int getThrees() const;
0033         int getFours() const;
0034         int getFives() const;
0035         int getSixs() const;
0036         int getThreeOfAKind() const;
0037         int getFourOfAKind() const;
0038         int getFullHouse() const;
0039         int getSStraight() const;
0040         int getLStraight() const;
0041         int getKiriki() const;
0042         int totalSum() const;
0043     
0044     protected:
0045         void paintEvent(QPaintEvent *p) override;
0046         void mousePressEvent(QMouseEvent *e) override;
0047     
0048     private:
0049         bool generateDices();
0050         int getSimilar(int number) const;
0051         int getNOfKind(int number) const;
0052         
0053         bool m_enabled;
0054         bool m_rollDice[5];
0055         bool m_highlightDice[5];
0056         int m_dice[5];
0057         QPixmap m_images[7];
0058 };
0059 
0060 #endif