eVaf
gui.h
Go to the documentation of this file.
1 
20 #ifndef __SCOSTIME_GUI_H
21 # define __SCOSTIME_GUI_H
22 
23 #include "version.h"
24 
25 #include <Plugins/iPlugin>
26 
27 #include <QObject>
28 #include <QString>
29 #include <QDateTime>
30 
31 class QLineEdit;
32 class QComboBox;
33 class QRegExp;
34 class QPushButton;
35 
36 namespace eVaf {
37 namespace ScosTime {
38 
39 namespace Internal {
40 
44 class DateTime
45 {
46 public:
47 
49  enum Type
50  {
52  ASD,
53  ISO,
55  };
56 
60  DateTime();
61 
65  ~DateTime();
66 
80  Type setDateTime(QString const & s, QDateTime const & epoch);
81 
95  Type setDateTime(QString const & s);
96 
101  void setEpoch(QDateTime const & epoch);
102 
106  QDateTime const & epoch() const { return mEpoch; }
107 
111  bool isValid() const { return mDateTime.isValid(); }
112 
117  Type type() const { return mType; }
118 
122  QDateTime const & dateTime() const { return mDateTime; }
123 
127  QString asISOstring() const;
128 
132  QString asASDstring() const;
133 
137  QString asCUChexString() const;
138 
139 
140 private: // methods
141 
142  Type getDateTimeType(QString const & s) const;
143 
144  QDateTime strToDateTime(QString const & s, Type t) const;
145 
146 
147 private: // members
148 
150  Type mType;
151 
153  QDateTime mEpoch;
154 
156  QDateTime mDateTime;
157 
159  QRegExp * mRxIso;
160 
162  QRegExp * mRxAsd;
163 
165  QRegExp * mRxCUC;
166 
167 };
168 
169 } // namespace eVaf::ScosTime::Internal
170 
176 class Module : public Plugins::iPlugin
177 {
178  Q_OBJECT
179  Q_INTERFACES(eVaf::Plugins::iPlugin)
180  Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR)
181 
182  enum ValidEntry
183  {
184  NoValidEntry,
185  DateTimeEntry,
186  CUCEntry
187  };
188 
189 public:
190 
191  Module();
192 
193  virtual ~Module();
194 
195  virtual bool init(const QString & args);
196 
197  virtual void done();
198 
199  virtual bool isReady() const { return mReady; }
200 
201 
202 private slots:
203 
204  void epochChanged(QString const & s);
205 
206  void dateTimeClicked();
207 
208  void dateTimeEdited(QString const & s);
209 
210  void cucHexEdited(QString const & s);
211 
212 
213 private: // Methods
214 
215 
216 private: // Members
217 
219  bool mReady;
220 
222  Internal::DateTime mDateTime;
223 
225  Internal::DateTime::Type mLastDateTimeType;
226 
228  QComboBox * wEpoch;
229  QLineEdit * wDateTime;
230  QPushButton * wConvertDateTime;
231  QLineEdit * wCucHex;
232 
233 };
234 
235 } // namespace eVaf::ScosTime
236 } // namespace eVaf
237 
238 #endif // gui.h
virtual bool isReady() const
Ready flag.
Definition: gui.h:199
QDateTime const & dateTime() const
Returns the current date/time value.
Definition: gui.h:122
QString asCUChexString() const
Returns the date/time value as a CUC hex string in the format ccccccccffff.
bool COMMON_EXPORT init()
eVaf common library initialized
bool isValid() const
Returns true if the date/time value is valid.
Definition: gui.h:111
SCOS date/time class.
Definition: gui.h:44
QString asASDstring() const
Returns the date/time value as a string in the ASD format yyyy.ddd.hh.mm.ss.zzz.
QString asISOstring() const
Returns the date/time value a string in the ISO format yyyy-MM-ddThh:mm:ss.zzz.
DateTime()
Creates an invalid date/time value with the default epoch.
#define VER_MODULE_NAME_STR
Module/library name (shall end with \0)
Definition: version.h:38
Type setDateTime(QString const &s, QDateTime const &epoch)
Sets the date/time value from a string.
Type
Type of the date/time entry.
Definition: gui.h:49
void setEpoch(QDateTime const &epoch)
Sets the epoch.
Global eVaf namespace.
Definition: engine.h:37
Graphical User Interface for the ScosTime application.
Definition: gui.h:176
Common interface for all the eVaf modules.
Definition: iplugin.h:38
QDateTime const & epoch() const
Returns the current epoch.
Definition: gui.h:106
Version information for eVaf modules.
Type type() const
Returns the type of the date/time string from which the date/time value was created.
Definition: gui.h:117