3 * @brief GUI for the ScosTime application
6 * Copyright (c) 2012 Enar Vaikene
8 * This file is part of the eVaf C++ cross-platform application development framework.
10 * This file can be used under the terms of the GNU General Public License
11 * version 3.0 as published by the Free Software Foundation and appearing in
12 * the file LICENSE included in the packaging of this file. Please review the
13 * the following information to ensure the GNU General Public License version
14 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
20 #ifndef __SCOSTIME_GUI_H
21 # define __SCOSTIME_GUI_H
23 #include <Plugins/iPlugin>
40 * SCOS date/time class
47 * Creates an invalid date/time value
52 * Creates a date/time value from the string.
53 * @param s Input string
56 * The input string can be:
57 * @li Date/time in ISO format yyyy-MM-ddThh:mm[:ss[.zzz]]
58 * @li Date/time in ASD format yyyy.ddd.hh.mm[.ss[.zzz]]
59 * @li CUC hex string cccccccc[ffff]
61 * If the string is invalid, creates an invalid date/time value.
63 DateTime(String
const & s
, String
const & epoch
);
66 * Returns true if the date/time value is valid.
68 bool isValid() const { return mDateTime
.isValid(); }
71 * Returns the date/time value a string in the ISO format yyyy-MM-ddThh:mm:ss.zzz
73 QString
asIsoString() const;
76 * Returns the date/time value as a string in the ASD format yyyy.ddd.hh.mm.ss.zzz
78 QString
asAsdString() const;
81 * Returns the date/time value as a CUC hex string in the format ccccccccffff
83 QString
asCucHexString() const;
96 } // namespace eVaf::ScosTime::Internal
99 * Graphical User Interface for the ScosTime application.
101 * This module adds a GUI window to the ScosTime application using the SdiWindow module.
103 class Module
: public Plugins::iPlugin
106 Q_INTERFACES(eVaf::Plugins::iPlugin
)
128 virtual bool init(const QString
& args
);
132 virtual bool isReady() const { return mReady
; }
137 void epochChanged(QString
const & s
);
139 void dateTimeClicked();
141 void dateTimeEdited(QString
const & s
);
143 void cucHexEdited(QString
const & s
);
148 DateTimeType
getDateTimeType(QString
const & s
) const;
150 QDateTime
strToDateTime(QString
const & s
, DateTimeType type
) const;
152 QString
dateTimeToAsdStr(QDateTime
const & tm
) const;
154 void setDateTimeFromCucHex(QString
const & s
);
156 void setCucHexFromDateTime(QString
const & s
, DateTimeType type
);
161 /// Flag indicating that the module is ready
164 /// Last valid entry (field modified by the user)
165 ValidEntry mLastValidEntry
;
167 /// Regular expressions
168 QRegExp
* rxIsoDateTime
;
169 QRegExp
* rxAsdDateTime
;
171 /// Widgets on the screen
173 QLineEdit
* wDateTime
;
174 QPushButton
* wConvertDateTime
;
179 } // namespace eVaf::ScosTime