]> ruin.nu Git - hbs.git/blob - bs/fleetview.h
battle algorithms are getting more and more mature and stats.conf is updated.
[hbs.git] / bs / fleetview.h
1 /***************************************************************************
2                           fleetview.h  -  description
3                              -------------------
4     begin                : Sun Mar 10 2002
5     copyright            : (C) 2002 by Michael Andreen
6     email                : whale@linux.nu
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18 #ifndef FLEETVIEW_H
19 #define FLEETVIEW_H
20
21 #include <map>
22 #include <vector>
23
24 #include <qwidget.h>
25 #include <qlayout.h>
26 #include <qlabel.h>
27 #include <qlineedit.h>
28 #include <qsignalmapper.h>
29
30 #include "fleet.h"
31
32 class RoidsEditView;
33 class ResourceView;
34
35 /**
36   *@author Michael Andreen
37   */
38 class FleetView : public QWidget
39 {
40    Q_OBJECT
41 public: 
42         FleetView(const Fleet* fleet, bool friendly, QWidget *parent=0, const char *name=0);
43         ~FleetView();
44
45         void viewFleet(const Fleet* fleet, bool friendly);
46
47         const Fleet* fleet();
48         bool isHome();
49         bool isFriendly();
50
51         bool isModified();
52
53 public slots:
54         void slotViewTickRange(int min = -1 , int max = -1);
55         
56 signals:
57         void fleetChanged(const Fleet*);
58
59 protected slots:
60         void unitsChanged(const QString& number);
61         void slotRoidsChanged(const QString& type, int value);
62
63 protected:
64         void findNames();
65         void buildUnitTable();
66         void fillTable();
67         
68         QVBoxLayout* m_MainLayout;
69         QGridLayout* m_UnitsLayout;
70         QLabel*      m_UnitName; 
71
72         RoidsEditView* m_RoidsEditView;
73         ResourceView*  m_ResourceView;
74
75         Fleet* m_Fleet;
76         bool  m_bHome;
77         bool  m_bFriendly;
78
79         bool m_Modified;
80
81         int m_iMinTick;
82         int m_iMaxTick;
83
84         std::vector<QString>      m_Names;
85         std::map<QString, QLabel*>    m_UnitsLabel;
86         std::map<QString, QLineEdit*> m_UnitsEdit;
87         std::map<QString, QLineEdit*> m_UnitsLostSurvivedView;
88 };
89
90 #endif