+ // Get the date/time string, type and QDateTime value
+ QString s = wDateTime->text();
+ DateTimeType type = getDateTimeType(s);
+ QDateTime tm = strToDateTime(s, type);
+
+ // Convert to another type
+ switch (type)
+ {
+ case IsoDateTime:
+ {
+ wDateTime->setText(dateTimeToAsdStr(tm));
+ wConvertDateTime->setText(tr("&to ISO", VER_MODULE_NAME_STR));
+ break;
+ }
+ case AsdDateTime:
+ {
+ wDateTime->setText(tm.toString("yyyy-MM-ddThh:mm:ss.zzz"));
+ wConvertDateTime->setText(tr("&to ASD", VER_MODULE_NAME_STR));
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+void Module::dateTimeEdited(QString const & s)
+{
+ if (mLastValidEntry == DateTimeEntry)
+ mLastValidEntry = NoValidEntry;
+ wConvertDateTime->setDisabled(true);
+ wConvertDateTime->setText(QString());
+
+ if (s.isEmpty())
+ return;
+
+ // Detect the type of the date/time string
+ DateTimeType type = getDateTimeType(s);
+ if (type == InvalidDateTime)
+ return;
+
+ // Set the date/time field as the last valid entry done by the user
+ mLastValidEntry = DateTimeEntry;
+
+ // Set the CUC hex string from this date/time string
+ setCucHexFromDateTime(s);
+
+ // Enable the button that converts between ISO and ASD date/time strings
+ if (type == IsoDateTime) {
+ wConvertDateTime->setEnabled(true);
+ wConvertDateTime->setText(tr("&to ASD", VER_MODULE_NAME_STR));
+ }
+ else if (type == AsdDateTime) {
+ wConvertDateTime->setEnabled(true);
+ wConvertDateTime->setText(tr("&to ISO", VER_MODULE_NAME_STR));
+ }
+}
+
+void Module::cucHexEdited(QString const & s)
+{
+ if (mLastValidEntry == CUCEntry)
+ mLastValidEntry = NoValidEntry;
+ if (s.isEmpty() || s.size() < 8)
+ return;
+
+ // Get the CUC coarse and fine values