]>
vaikene.ee Git - evaf/blob - src/apps/ScosTime/gui.h
42516e5ec736af20be2a74a0a9fe776a55c3143d
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
25 #include <Plugins/iPlugin>
42 * SCOS date/time class
48 /// Type of the date/time entry
58 * Creates an invalid date/time value with the default epoch
68 * Sets the date/time value from a string.
69 * @param s Input string
71 * @return Type of the input string
73 * The input string can be:
74 * @li Date/time in ISO format yyyy-MM-ddThh:mm[:ss[.zzz]]
75 * @li Date/time in ASD format yyyy.ddd.hh.mm[.ss[.zzz]]
76 * @li CUC hex string cccccccc[ffff]
78 * If the string is invalid, creates an invalid date/time value.
80 Type
setDateTime(QString
const & s
, QDateTime
const & epoch
);
83 * Sets the date/time value from a string using the previously set epoch.
84 * @param s Input string
85 * @return Type of the input string
87 * The input string can be:
88 * @li Date/time in ISO format yyyy-MM-ddThh:mm[:ss[.zzz]]
89 * @li Date/time in ASD format yyyy.ddd.hh.mm[.ss[.zzz]]
90 * @li CUC hex string cccccccc[ffff]
92 * If the input string is invalid or no epoch is set, creates an invalid
95 Type
setDateTime(QString
const & s
);
101 void setEpoch(QDateTime
const & epoch
);
104 * Returns the current epoch
106 QDateTime
const & epoch() const { return mEpoch
; }
109 * Returns true if the date/time value is valid.
111 bool isValid() const { return mDateTime
.isValid(); }
114 * Returns the type of the date/time string from which the date/time
117 Type
type() const { return mType
; }
120 * Returns the current date/time value
122 QDateTime
const & dateTime() const { return mDateTime
; }
125 * Returns the date/time value a string in the ISO format yyyy-MM-ddThh:mm:ss.zzz
127 QString
asISOstring() const;
130 * Returns the date/time value as a string in the ASD format yyyy.ddd.hh.mm.ss.zzz
132 QString
asASDstring() const;
135 * Returns the date/time value as a CUC hex string in the format ccccccccffff
137 QString
asCUChexString() const;
142 Type
getDateTimeType(QString
const & s
) const;
144 QDateTime
strToDateTime(QString
const & s
, Type t
) const;
149 /// Type of the input string
158 /// Regular expression for ISO date/time strings
161 /// Regular expression for ASD date/time strings
164 /// Regular expression for CUC date/time strings
169 } // namespace eVaf::ScosTime::Internal
172 * Graphical User Interface for the ScosTime application.
174 * This module adds a GUI window to the ScosTime application using the SdiWindow module.
176 class Module
: public Plugins::iPlugin
179 Q_INTERFACES(eVaf::Plugins::iPlugin
)
180 Q_PLUGIN_METADATA(IID VER_MODULE_NAME_STR
)
195 virtual bool init(const QString
& args
);
199 virtual bool isReady() const { return mReady
; }
204 void epochChanged(QString
const & s
);
206 void dateTimeClicked();
208 void dateTimeEdited(QString
const & s
);
210 void cucHexEdited(QString
const & s
);
218 /// Flag indicating that the module is ready
221 /// Current date/time value
222 Internal::DateTime mDateTime
;
224 /// Last date/time format type used in the date/time entry field
225 Internal::DateTime::Type mLastDateTimeType
;
227 /// Widgets on the screen
229 QLineEdit
* wDateTime
;
230 QPushButton
* wConvertDateTime
;
235 } // namespace eVaf::ScosTime