]> ruin.nu Git - hbs.git/blob - bs/fleetview.h
some
[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         void slotSetResultMode(int i);
56         
57 signals:
58         void fleetChanged(const Fleet*);
59
60 protected slots:
61         void unitsChanged(const QString& number);
62         void slotRoidsChanged(const QString& type, int value);
63
64 protected:
65         void findNames();
66         void buildUnitTable();
67         void fillTable();
68         
69         QVBoxLayout* m_MainLayout;
70         QGridLayout* m_UnitsLayout;
71         QLabel*      m_UnitName; 
72
73         RoidsEditView* m_RoidsEditView;
74         ResourceView*  m_ResourceView;
75
76         Fleet* m_Fleet;
77         bool  m_bHome;
78         bool  m_bFriendly;
79
80         bool m_Modified;
81
82         int m_iMinTick;
83         int m_iMaxTick;
84         int m_iResultMode;
85
86         std::vector<QString>      m_Names;
87         std::map<QString, QLabel*>    m_UnitsLabel;
88         std::map<QString, QLineEdit*> m_UnitsEdit;
89         std::map<QString, QLineEdit*> m_UnitsLostSurvivedView;
90 };
91
92 #endif