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