VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
weaponSelectionWidget.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
13 #if !defined(Q_MOC_RUN)
17 #include <vrfutil/rwUUID.h>
18 #endif
19 #include <boost/signals2.hpp>
20 
21 class QLabel;
22 class QBoxLayout;
23 class QString;
24 class QListWidget;
25 class QComboBox;
26 class QLineEdit;
27 class QCheckBox;
28 
29 namespace makVrv
30 {
31  class DtSimEntry;
32  class DtUnicode;
33 }
34 
35 namespace makVrf
36 {
39  {
40  Q_OBJECT
41 
48  Q_PROPERTY(bool allowMultipleSelecion READ allowMultipleSelection WRITE setAllowMultipleSelection)
49 
50  public:
51  DtWeaponSelectionWidget(makVrv::DtDe& de, QWidget* parent, const Qt::WindowFlags& flags = 0, const CreationFlags& cflags = NormalMode);
52 
53  //DTOR
54  virtual ~DtWeaponSelectionWidget();
55 
58  virtual void setWeaponFilterType(DtWeaponSystemType type);
59  virtual DtWeaponSystemType weaponFilterType() const;
60 
63  virtual void setFireTaskType(DtSimTaskMessageType fireTaskType);
64  virtual void setFireTaskTypes(const std::vector<DtSimTaskMessageType>& fireTaskTypes);
65  virtual const std::vector<DtSimTaskMessageType>& fireTaskTypes() const;
66 
68  virtual void setRange(double bottom, double top);
69 
71  virtual void setDefaultValue(const std::string&);
72 
74  virtual void setVariableData(const QString&);
75 
77  virtual void setupFrom(const std::vector<makVrv::DtSimEntry*>& data);
78 
80  virtual DtReaderWriter* createBoundVariable(const std::string& variableName);
81 
83  virtual void setupFromBoundVariable(const DtReaderWriter* variableName);
84 
88  virtual void requestWeaponsFor(const std::vector<makVrv::DtSimEntry*>& data);
89  virtual void slot_receivedWeaponList(const DtUUID& entity);
90 
94  virtual bool includeResources() const;
95  virtual void setIncludeResources(const bool doInclude);
97 
100  virtual bool displayWeapons() const;
101  virtual void setDisplayWeapons(const bool doDisplay);
103 
106  virtual bool displayResources() const;
107  virtual void setDisplayResources(const bool doDisplay);
109 
116  virtual void setAllowMultipleSelection(bool);
117  virtual bool allowMultipleSelection() const;
118 
121  virtual QStringList selectedWeaponsNames() const;
122 
124  virtual QStringList selectedWeaponsIds() const;
125 
127  virtual std::list<DtString> selectedWeaponResources() const;
128 
130  virtual std::list<DtString> selectedResources() const;
131 
133  virtual void selectWeapons(const QStringList&);
134 
136  virtual void updateWeapons();
137 
139  virtual void selectResource(const DtString&);
140 
142  virtual void updateResources();
143 
145  {
146  return makVrv::DtUnicode::tr("String (weapon name)");
147  }
148  static std::string designerGroup()
149  {
150  return tr("VR-Forces Weapon Selection").toUtf8().constData();
151  }
152 
153  static std::string headerFile()
154  {
155  return tr("<vrfGuiDataEntryWidgets/weaponSelectionWidget.h>").toUtf8().constData();
156  }
157 
158  static std::string variableName()
159  {
160  return tr("weapon").toUtf8().constData();
161  }
162 
163  boost::signals2::signal<void ()> signal_receivedWeaponsList;
164  boost::signals2::signal<void ()> signal_weaponSelectionChanged;
165  boost::signals2::signal<void()> signal_resourceSelectionChanged;
166 
167  protected:
174  virtual std::string variableDataFromUiDesigner(const QDomElement& element, const DtScriptedTaskVariableLayoutConverter& converter) const;
175 
176  virtual void addWeapon(const WeaponSystem&);
177  virtual void weaponUpdated(const WeaponSystem&);
178  virtual void weaponChanged();
179  virtual void weaponCheckingDisabled();
180  virtual void weaponCheckComplete();
181  virtual void nextRequest();
182  virtual void setupForComboBox();
183 
185  virtual QString weaponId(QString& qweaponName) const;
186 
188  virtual std::list<DtString> weaponResources(QString& qweaponName) const;
189 
190  virtual DtTaskSetVariableWidgetExtensionInterface* parameterContents(QWidget* parent, const Qt::WindowFlags& flags = 0) const override;
191 
192  protected slots:
193  virtual void weaponSelectionChanged();
194  virtual void resourceSelectionChanged();
195 
196  protected:
197  std::set<DtUUID> myToRequest;
199  std::set<DtUUID> myDidRequest;
200  std::vector<DtUUID> myCurrSelected;
201 
204 
209 
215 
222 
226 
228  std::vector<DtSimTaskMessageType> myFireTaskTypes;
229 
230  public:
233  QHBoxLayout* myWeaponContentLayout;
237  QString myDefaultValue;
238  };
239 
242  {
243  Q_OBJECT
244 
245  public:
246  DtDirectFireWeaponSelectionWidget(makVrv::DtDe& de, QWidget* parent, const Qt::WindowFlags& flags = 0, const CreationFlags& cflags = NormalMode);
247 
248  //DTOR
250 
251  static std::string designerGroup()
252  {
253  return tr("VR-Forces Weapon Selection").toUtf8().constData();
254  }
255 
256  static std::string headerFile()
257  {
258  return tr("<vrfGuiDataEntryWidgets/weaponSelectionWidget.h>").toUtf8().constData();
259  }
260 
261  static std::string variableName()
262  {
263  return tr("directFire").toUtf8().constData();
264  }
265 
266  protected:
267  virtual void addWeapon(const WeaponSystem&);
268  };
269 
272  {
273  Q_OBJECT
274 
275  public:
276  DtIndirectFireWeaponSelectionWidget(makVrv::DtDe& de, QWidget* parent, const Qt::WindowFlags& flags = 0, const CreationFlags& cflags = NormalMode);
277 
278  //DTOR
280 
281  static std::string designerGroup()
282  {
283  return tr("VR-Forces Weapon Selection").toUtf8().constData();
284  }
285 
286  static std::string headerFile()
287  {
288  return tr("<vrfGuiDataEntryWidgets/weaponSelectionWidget.h>").toUtf8().constData();
289  }
290 
291  static std::string variableName()
292  {
293  return tr("indirectFire").toUtf8().constData();
294  }
295 
296  protected:
297  virtual void addWeapon(const WeaponSystem&);
298  };
299 
303 
305  {
306  Q_OBJECT
307  public:
308  DtWeaponSelectionWidgetExtension(makVrv::DtDe&, QWidget* w, const Qt::WindowFlags& f = 0);
310 
311  virtual int setFrom(const DtScriptedTaskVariable&, QGridLayout* parentLayout, int startRow);
312  virtual void setTo(DtScriptedTaskVariable&) const;
313 
314  virtual void setReadOnly(bool);
315 
316  public:
321  };
322 }
std::vector< DtSimTaskMessageType > myFireTaskTypes
Filters the weapon systems on their capability to execute tasks.
Definition: weaponSelectionWidget.h:228
UUID is a unique ID wrapper class.
Definition: uuid.h:59
A unicode string. DtUnicode stores a UTF-16 encoded unicode string. Code Point, a Unicode character...
Definition: DtUnicode.h:33
Widget that allows users to select weapons for the given entity.
Definition: weaponSelectionWidget.h:38
CreationFlags
Definition: taskSetVariableWidget.h:119
static std::string headerFile()
Definition: weaponSelectionWidget.h:153
Widget that only displays direct fire weapons.
Definition: weaponSelectionWidget.h:241
bool myDisplayResources
Specifies if the resources list combo-box will be displayed - so the user to select a resource for a ...
Definition: weaponSelectionWidget.h:221
boost::signals2::signal< void()> signal_weaponSelectionChanged
Definition: weaponSelectionWidget.h:164
This class will parse the UI file for known scripted task variable types and pull out specified scrip...
Definition: scriptedTaskVariableLayoutConverter.h:32
QComboBox * myWeaponSystemsCombo
Definition: weaponSelectionWidget.h:232
Definition: readerWriter.h:85
static std::string variableName()
Definition: weaponSelectionWidget.h:158
Widget that only displays indirect fire weapons.
Definition: weaponSelectionWidget.h:271
QLabel * myResourcesLabel
Definition: weaponSelectionWidget.h:234
static makVrv::DtUnicode codeVariableType()
Definition: weaponSelectionWidget.h:144
Contains the DtUUID class declaration.
static std::string headerFile()
Definition: weaponSelectionWidget.h:286
DtWeaponSystemType
This now allows us to query the backend for specific types of weapons.
Definition: weaponListResponseAdmin.h:17
DtTaskSetVariableWidgetCreator< DtDirectFireWeaponSelectionWidget > DtDirectFireWeaponSelectionWidgetCreator
Definition: weaponSelectionWidget.h:301
std::set< DtUUID > myDidRequest
Definition: weaponSelectionWidget.h:199
bool myIncludeResources
Indicates whether the back end will be asked to include resources with the weapon names it returns; a...
Definition: weaponSelectionWidget.h:208
static std::string designerGroup()
Definition: weaponSelectionWidget.h:251
Basic implementation that has a label at the top.
Definition: taskSetVariableWidget.h:233
static std::string variableName()
Definition: weaponSelectionWidget.h:261
std::vector< DtUUID > myCurrSelected
Definition: weaponSelectionWidget.h:200
static DtUnicode tr(const char *ascii)
Ascii translation function, used to be compatible with Qt&#39;s translation tools. This will simply call ...
Definition: DtUnicode.h:92
DtString myResourceToSelect
If no resources yet when selectResource is called, hold on until the resources come in from the back-...
Definition: weaponSelectionWidget.h:203
QString myDefaultValue
Definition: weaponSelectionWidget.h:237
Definition: taskSetVariableWidget.h:426
static std::string headerFile()
Definition: weaponSelectionWidget.h:256
std::set< DtUUID > myAwaitingWeaponSystemResponse
Definition: weaponSelectionWidget.h:198
A class for keeping track of meta data for variables of scripted tasks. The information is currently ...
Definition: scriptedTaskVariable.h:34
#define DT_DLL_VRFGUIDATAENTRYWIDGETS
Definition: vrfGuiDataEntryWidgets.h:22
std::set< DtUUID > myToRequest
Definition: weaponSelectionWidget.h:197
QCheckBox * myDisplayWeapons
Definition: weaponSelectionWidget.h:319
DtWeaponSystemType myWeaponFilterType
Used for pre VRF-5.1 scenarios - should be deprecated. Option to allow user to filter by a particular...
Definition: weaponSelectionWidget.h:225
QLabel * myFireTaskTypeLabel
Definition: weaponSelectionWidget.h:317
QHBoxLayout * myResourcesContentLayout
Definition: weaponSelectionWidget.h:236
QHBoxLayout * myWeaponContentLayout
Definition: weaponSelectionWidget.h:233
QComboBox * myResourcesCombo
Definition: weaponSelectionWidget.h:235
QLabel * myWeaponLabel
Definition: weaponSelectionWidget.h:231
static std::string designerGroup()
Definition: weaponSelectionWidget.h:148
bool myDisplayWeapons
Specifies if the weapons list combo-box will be displayed - so the user to select a weapon...
Definition: weaponSelectionWidget.h:214
QCheckBox * myDisplayResources
Definition: weaponSelectionWidget.h:320
DtTaskSetVariableWidgetCreator< DtWeaponSelectionWidget > DtWeaponSelectionWidgetCreator
Definition: weaponSelectionWidget.h:300
QLineEdit * myFireTaskType
Definition: weaponSelectionWidget.h:318
static std::string designerGroup()
Definition: weaponSelectionWidget.h:281
Definition: weaponListResponseAdmin.h:27
static std::string variableName()
Definition: weaponSelectionWidget.h:291
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:72
boost::signals2::signal< void()> signal_receivedWeaponsList
Definition: weaponSelectionWidget.h:163
boost::signals2::signal< void()> signal_resourceSelectionChanged
Definition: weaponSelectionWidget.h:165
DtTaskSetVariableWidgetCreator< DtIndirectFireWeaponSelectionWidget > DtIndirectFireWeaponSelectionWidgetCreator
Definition: weaponSelectionWidget.h:302
Extension interface for contents for definition of variables in the scripted task meta data variable ...
Definition: taskSetVariableWidget.h:84
Definition: weaponSelectionWidget.h:304

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)