X-Git-Url: https://vaikene.ee/gitweb/pswgen09.html?a=blobdiff_plain;ds=sidebyside;f=src%2Fapps%2FScosTime%2Fgui.cpp;h=4888288757739d3b1889df6fc672144211085f0c;hb=4c0329c5c2690bde28212c89029015a5da4c7e34;hp=ed7f09841dbc2f0d0a729d50aa22b8e3490be1ee;hpb=66f5040b87e8071012efbc928a4f28f8bdd615b1;p=evaf
diff --git a/src/apps/ScosTime/gui.cpp b/src/apps/ScosTime/gui.cpp
index ed7f098..4888288 100644
--- a/src/apps/ScosTime/gui.cpp
+++ b/src/apps/ScosTime/gui.cpp
@@ -3,7 +3,7 @@
* @brief GUI for the ScosTime application
* @author Enar Vaikene
*
- * Copyright (c) 2012 Enar Vaikene
+ * Copyright (c) 2012-2019 Enar Vaikene
*
* This file is part of the eVaf C++ cross-platform application development framework.
*
@@ -18,7 +18,6 @@
*/
#include "gui.h"
-#include "version.h"
#include
#include
@@ -26,11 +25,10 @@
#include
#include
-#include
+#include
VER_EXPORT_VERSION_INFO()
-Q_EXPORT_PLUGIN2(VER_MODULE_NAME_STR, eVaf::ScosTime::Module)
//-------------------------------------------------------------------
@@ -91,7 +89,8 @@ void Internal::DateTime::setEpoch(QDateTime const & epoch)
if (epoch != mEpoch)
{
- if (mDateTime.isValid())
+ // Adjust the date/time if the value was set from a CUC HEX string
+ if (mType == CUC && mDateTime.isValid())
{
qint64 diff = mEpoch.msecsTo(epoch);
mDateTime = mDateTime.addMSecs(diff);
@@ -174,7 +173,6 @@ QDateTime Internal::DateTime::strToDateTime(QString const & s, Type type) const
dt = dt.addDays(days - 1);
return QDateTime(dt, QTime(hours, minutes, secs, msecs), Qt::UTC);
- break;
}
case ISO:
{
@@ -187,13 +185,12 @@ QDateTime Internal::DateTime::strToDateTime(QString const & s, Type type) const
QDateTime dt = QDateTime::fromString(tmp, Qt::ISODate);
dt.setTimeSpec(Qt::UTC);
return dt;
- break;
}
case CUC:
{
// Get the CUC coarse and fine values
bool ok = false;
- int coarse = s.left(8).toLong(&ok, 16);
+ int const coarse = static_cast(s.left(8).toLong(&ok, 16));
if (!ok)
{
return QDateTime();
@@ -201,7 +198,7 @@ QDateTime Internal::DateTime::strToDateTime(QString const & s, Type type) const
int fine = 0;
if (s.size() == 12)
{
- fine = s.mid(8, 4).toLong(&ok, 16);
+ fine = static_cast(s.mid(8, 4).toLong(&ok, 16));
if (!ok)
{
return QDateTime();
@@ -210,10 +207,8 @@ QDateTime Internal::DateTime::strToDateTime(QString const & s, Type type) const
// Get the date/time value
QDateTime tm = mEpoch.addSecs(coarse);
- tm = tm.addMSecs(rint((double(fine) / 58.0 * 885.0) / 1000.0));
+ tm = tm.addMSecs(static_cast(rint((double(fine) / 58.0 * 885.0) / 1000.0)));
return tm;
-
- break;
}
default:
{
@@ -282,11 +277,11 @@ Module::~Module()
bool Module::init(QString const & args)
{
- Q_UNUSED(args);
+ Q_UNUSED(args)
// Get the main window interface and fill it with the widgets
SdiWindow::iSdiWindow * win = evafQueryInterface("iSdiWindow");
- EVAF_TEST_X(win, "No iSdiWindow interface");
+ EVAF_TEST_X(win, "No iSdiWindow interface")
Gui::Panel * panel = new Gui::Panel;
win->addPanel("PswGen", panel);
@@ -429,7 +424,7 @@ void Module::dateTimeEdited(QString const & s)
wConvertDateTime->setEnabled(true);
wConvertDateTime->setText(tr("&to ASD", VER_MODULE_NAME_STR));
}
- else if (mDateTime.type() == Internal::DateTime::ISO)
+ else if (mDateTime.type() == Internal::DateTime::ASD)
{
wConvertDateTime->setEnabled(true);
wConvertDateTime->setText(tr("&to ISO", VER_MODULE_NAME_STR));