File indexing completed on 2024-07-14 04:02:15

0001 /* This file is part of KsirK.
0002    Copyright (C) 2008 Gael Clouet <pelouas@hotmail.fr>
0003 
0004    KsirK is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU General Public
0006    License as published by the Free Software Foundation, either version 2
0007    of the License, or (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    General Public License for more details.
0013 
0014    You should have received a copy of the GNU General Public License
0015    along with this program; if not, write to the Free Software
0016    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0017    02110-1301, USA
0018 */
0019 
0020 /* begin                : Thu Jan 17 2008 */
0021 
0022 
0023 #ifndef KRIGHTDIALOG_H
0024 #define KRIGHTDIALOG_H
0025 
0026 #include "KsirkGlobalDefinitions.h"
0027 
0028 #include "GameLogic/onu.h"
0029 #include "GameLogic/country.h"
0030 #include "GameLogic/player.h"
0031 #include <stdlib.h>
0032 #include <QGroupBox>
0033 #include <QGridLayout>
0034 #include <QPointF>
0035 #include <QDockWidget>
0036 #include <QList>
0037 #include <QLabel>
0038 #include <QPixmap>
0039 
0040 #include <KConfig>
0041 #include <KConfigGroup>
0042 #include <QPushButton>
0043 
0044 #include "kgamewin.h"
0045 namespace Ksirk
0046 {
0047   class KGameWindow;
0048 namespace GameLogic
0049 {
0050   class ONU;
0051   class Country;
0052 }
0053    /**
0054    * The KRightDialog class is the widget displayed on the right of
0055    * the application
0056    */
0057    class KRightDialog: public QWidget
0058    {
0059       Q_OBJECT
0060       
0061       public:
0062       /**
0063       * Creates the group box which will contains the needed widgets
0064       */
0065       KRightDialog(QDockWidget * parent,GameLogic::ONU * world,KGameWindow* m_game);
0066       
0067       /**
0068       * Destroy the widget
0069       */
0070       ~KRightDialog() override;
0071 
0072       /**
0073       * Display the country information after a right click mouse
0074       * @param contryPoint which is the point clicked
0075       */
0076       void displayCountryDetails(const QPointF& countryPoint);
0077 
0078       /**
0079       * Display the fight details
0080       */
0081       void displayFightDetails(GameLogic::Country * attaker, GameLogic::Country * defender,int nb_A, int nb_D);
0082 
0083       /**
0084        * Display information about the recycling processus
0085        * @param player which we want to see information
0086        */
0087       void displayRecycleDetails(GameLogic::Player* player, int nbAvailArmies);
0088 
0089       /**
0090        * Update information about the recycling processus
0091        * @param country country which gives his information
0092        * @param recyclePhase shows if we are in recycle phase or not
0093        */
0094       void updateRecycleDetails(GameLogic::Country* country, bool recyclePhase, int nbAvailArmies);
0095 
0096       /**
0097       * Display the dice
0098       */
0099       void displayFightResult(int A1, int A2, int A3, int D1, int D2,int nbA,int nbD, bool win);
0100 
0101       void initListLabel(int i);
0102 
0103       void removeListLabel(); 
0104      
0105       void clearLabel();
0106 
0107       void clearLayout() ;
0108 
0109       inline void close() {m_parentWidget->hide();};
0110 
0111       inline void open() {m_parentWidget->show();};
0112 
0113       inline bool isOpen() {return m_parentWidget->isVisible();};
0114 
0115       private:
0116  
0117       QGridLayout * mainLayout;
0118       
0119       QLabel * loadingLabel;
0120       
0121       QLabel *infoProcess;
0122       
0123       QDockWidget * m_parentWidget;
0124 
0125       Ksirk::GameLogic::ONU * world;
0126     
0127       QList<QLabel*> rightContents;
0128 
0129       QLabel * flag1;
0130 
0131       QLabel * flag2;
0132 
0133       QWidget * bas; 
0134 
0135       QWidget * haut;
0136 
0137       QWidget * milieu;
0138 
0139       QWidget * milieu2;
0140 
0141       // Widgets and buttons used in displayRecycleDetails
0142       QWidget * btRecycleWidget;
0143 
0144       QWidget * btValidWidget;
0145 
0146       // images for buttons
0147       QPixmap soldat;
0148       QPixmap stopAttackAuto;
0149       QPixmap recycleContinue;
0150       QPixmap recycleDone;
0151       QPixmap recycleNextPlayer;
0152 
0153       KGameWindow * game;
0154 
0155       QPushButton* buttonStopAttack;
0156       QPushButton* buttonStopDefense;
0157       
0158       private slots:
0159       
0160       void slotStopAttackAuto();
0161       void slotStopDefenseAuto();
0162       
0163    };
0164    
0165 }
0166 
0167 #endif // KRIGHTDIALOG_H