Added ability to change time format string for when you're in System

Clock mode. Fixed code so that editing settings in the settings dialog
will now immediately take effect in the program.
This commit is contained in:
Collin Kidder
2017-07-12 20:02:20 -04:00
parent 2764c9bc52
commit 2d01f695e2
7 changed files with 37 additions and 4 deletions
+9 -1
View File
@@ -69,6 +69,7 @@ CANFrameModel::CANFrameModel(QObject *parent)
timeOffset = 0;
needFilterRefresh = false;
lastUpdateNumFrames = 0;
timeFormat = "MMM-dd HH:mm:ss.zzz";
}
void CANFrameModel::setHexMode(bool mode)
@@ -114,6 +115,13 @@ void CANFrameModel::setInterpetMode(bool mode)
}
}
void CANFrameModel::setTimeFormat(QString format)
{
timeFormat = format;
beginResetModel(); //reset model to show new time format
endResetModel();
}
void CANFrameModel::normalizeTiming()
{
mutex.lock();
@@ -252,7 +260,7 @@ QVariant CANFrameModel::data(const QModelIndex &index, int role) const
if (!timeSeconds) return QString::number(thisFrame.timestamp);
else return QString::number((double)thisFrame.timestamp / 1000000.0, 'f', 6);
}
else return QDateTime::fromMSecsSinceEpoch(thisFrame.timestamp / 1000).toString("MMM-dd HH:mm:ss.zzz");
else return QDateTime::fromMSecsSinceEpoch(thisFrame.timestamp / 1000).toString(timeFormat);
break;
case 1: //id
return Utility::formatNumber(thisFrame.ID);