]>
vaikene.ee Git - evaf/blob - src/apps/ScosTime/gui.h
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
46 /// Type of the date/time entry
56 * Creates an invalid date/time value with the default epoch
66 * Sets the date/time value from a string.
67 * @param s Input string
69 * @return Type of the input string
71 * The input string can be:
72 * @li Date/time in ISO format yyyy-MM-ddThh:mm[:ss[.zzz]]
73 * @li Date/time in ASD format yyyy.ddd.hh.mm[.ss[.zzz]]
74 * @li CUC hex string cccccccc[ffff]
76 * If the string is invalid, creates an invalid date/time value.
78 Type
setDateTime(QString
const & s
, QDateTime
const & epoch
);
81 * Sets the date/time value from a string using the previously set epoch.
82 * @param s Input string
83 * @return Type of the input string
85 * The input string can be:
86 * @li Date/time in ISO format yyyy-MM-ddThh:mm[:ss[.zzz]]
87 * @li Date/time in ASD format yyyy.ddd.hh.mm[.ss[.zzz]]
88 * @li CUC hex string cccccccc[ffff]
90 * If the input string is invalid or no epoch is set, creates an invalid
93 Type
setDateTime(QString
const & s
);
99 void setEpoch(QDateTime
const & epoch
);
102 * Returns the current epoch
104 QDateTime
const & epoch() const { return mEpoch
; }
107 * Returns true if the date/time value is valid.
109 bool isValid() const { return mDateTime
.isValid(); }
112 * Returns the type of the date/time string from which the date/time
115 Type
type() const { return mType
; }
118 * Returns the current date/time value
120 QDateTime
const & dateTime() const { return mDateTime
; }
123 * Returns the date/time value a string in the ISO format yyyy-MM-ddThh:mm:ss.zzz
125 QString
asISOstring() const;
128 * Returns the date/time value as a string in the ASD format yyyy.ddd.hh.mm.ss.zzz
130 QString
asASDstring() const;
133 * Returns the date/time value as a CUC hex string in the format ccccccccffff
135 QString
asCUChexString() const;
140 Type
getDateTimeType(QString
const & s
) const;
142 QDateTime
strToDateTime(QString
const & s
, Type t
) const;
147 /// Type of the input string
156 /// Regular expression for ISO date/time strings
159 /// Regular expression for ASD date/time strings
162 /// Regular expression for CUC date/time strings
167 } // namespace eVaf::ScosTime::Internal
170 * Graphical User Interface for the ScosTime application.
172 * This module adds a GUI window to the ScosTime application using the SdiWindow module.
174 class Module
: public Plugins::iPlugin
177 Q_INTERFACES(eVaf::Plugins::iPlugin
)
192 virtual bool init(const QString
& args
);
196 virtual bool isReady() const { return mReady
; }
201 void epochChanged(QString
const & s
);
203 void dateTimeClicked();
205 void dateTimeEdited(QString
const & s
);
207 void cucHexEdited(QString
const & s
);
215 /// Flag indicating that the module is ready
218 /// Current date/time value
219 Internal::DateTime mDateTime
;
221 /// Last date/time format type used in the date/time entry field
222 Internal::DateTime::Type mLastDateTimeType
;
224 /// Widgets on the screen
226 QLineEdit
* wDateTime
;
227 QPushButton
* wConvertDateTime
;
232 } // namespace eVaf::ScosTime