]> ruin.nu Git - hbs.git/blob - bs/fleetview.h
Roids/score for planets are now editable
[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         void slotRoidsChanged(const QString& type, int value);
59
60 protected:
61         void findNames();
62         void buildUnitTable();
63         void fillTable();
64         
65         QVBoxLayout* m_MainLayout;
66         QGridLayout* m_UnitsLayout;
67         QLabel*      m_UnitName; 
68
69         RoidsEditView* m_RoidsEditView;
70         ResourceView*  m_ResourceView;
71
72         Fleet* m_Fleet;
73         bool  m_bHome;
74         bool  m_bFriendly;
75
76         bool m_Modified;
77
78         std::vector<QString>      m_Names;
79         std::map<QString, QLabel*>    m_UnitsLabel;
80         std::map<QString, QLineEdit*> m_UnitsEdit;
81         std::map<QString, QLineEdit*> m_UnitsLostSurvivedView;
82 };
83
84 #endif