Skip to content

Instantly share code, notes, and snippets.

@errtro
Last active August 1, 2017 09:40
Show Gist options
  • Save errtro/7ed93b88a99de999a14de49632477ff4 to your computer and use it in GitHub Desktop.
Save errtro/7ed93b88a99de999a14de49632477ff4 to your computer and use it in GitHub Desktop.
import nach export
diff -u dmm.cpp.org dmm.cpp
--- dmm.cpp.org 2017-02-18 20:06:49.000000000 +0100
+++ dmm.cpp 2017-07-21 08:27:46.000000000 +0200
@@ -141,7 +141,7 @@
void DMM::close()
{
// mt: added timer id
- killTimer(m_delayTimer);
+ //killTimer(m_delayTimer);
m_error = tr( "Not connected" );
Q_EMIT error( m_error );
==================================================================================
diff -u dmmgraph.cpp.org dmmgraph.cpp
--- dmmgraph.cpp.org 2017-02-18 20:06:49.000000000 +0100
+++ dmmgraph.cpp 2017-08-01 10:04:07.136832102 +0200
@@ -545,7 +545,7 @@
if (m_mode == DMMGraph::Time && !m_running)
{
// we may miss the start due to aliasing otherwise
- int diff = m_startTime.secsTo( QTime::currentTime() );
+ int diff = m_startTime.msecsTo( QTime::currentTime() );
if (diff >= 0 && diff < 2)
{
@@ -714,7 +714,6 @@
double idiv = (double)(w-2-50)/80.;
double ddiv = m_size*m_sampleTime/10./idiv;
-
hUnit = tr( "[sec]" );
hUnitFact = xfactor*m_sampleTime/10.;
maxUnit = (m_length-1)*m_sampleTime/10.;
@@ -1153,10 +1152,10 @@
QTextStream ts( &file );
- for (int i=0; i<m_pointer; i++)
+ for (int i=0; i<m_pointer; i++)
{
- QDateTime dt = m_graphStartDateTime.addSecs( i*(int)qRound(m_sampleTime/10.) );
- QString line=QString("%1\t%2\t%3\n").arg(dt.toString("dd.MM.yyyy\tHH:mm:ss")).arg((*m_array)[i],0,'f').arg(m_unit);
+ QDateTime dt = m_graphStartDateTime.addMSecs( i*(float)qRound(m_sampleTime*100.0) );
+ QString line=QString("%1\t%2\t%3\n").arg(dt.toString("dd.MM.yyyy\thh:mm:ss.zzz")).arg((*m_array)[i],0,'f').arg(m_unit);
ts << line;
}
m_dirty = false;
@@ -1221,22 +1220,20 @@
if (!line.isNull())
{
- QRegExp re( "[0-9]+\\.[0-9]+\\.[0-9]+\t[0-9]+:[0-9]+:[0-9]+\t[-]?[0-9]*\\.[0-9]+\t.*");
+ QRegExp rx( "[0-9]+\\.[0-9]+\\.[0-9]+\t+[0-9]+:[0-9]+:[0-9]+\\.[0-9]+\t+[-]?[0-9]*\\.[0-9]+\t+.*");
// mt: changed (ups, was obsolete in Qt3 already)
- if (!re.exactMatch(line))
+ if (!rx.exactMatch(line))
{
Q_EMIT error( tr("Oops! Seems not to be a valid file") );
return;
}
- token =line.split("\t");
+ token = line.split("\t");
dateToken = token[0].split(".");
timeToken = token[1].split(":");
- QTime startTime = QTime( timeToken[0].toInt(),
- timeToken[1].toInt(),
- timeToken[2].toInt() );
+ QTime startTime = QTime::fromString(token[1], "hh:mm:ss.zzz");
QDate startDate = QDate( dateToken[2].toInt(),
dateToken[1].toInt(),
dateToken[0].toInt() );
@@ -1244,7 +1241,7 @@
m_graphStartDateTime = QDateTime( startDate, startTime );
graphEnd = QDateTime( startDate, startTime );
- setUnit( line.mid( 27, 3 ) );
+ setUnit( token[3] );
cnt++;
@@ -1258,16 +1255,13 @@
dateToken = token[0].split(".");
timeToken = token[1].split(":");
- QTime nowTime = QTime( timeToken[0].toInt(),
- timeToken[1].toInt(),
- timeToken[2].toInt() );
+ QTime nowTime = QTime::fromString(token[1], "hh:mm:ss.zzz");
QDate nowDate = QDate( dateToken[2].toInt(),
dateToken[1].toInt(),
dateToken[0].toInt() );
- sample += QDateTime( startDate, startTime ).secsTo(QDateTime( nowDate, nowTime ) );
-
- startTime = nowTime;
+ sample += QDateTime( startDate, startTime ).msecsTo(QDateTime( nowDate, nowTime ) );
+ startTime = nowTime;
startDate = nowDate;
graphEnd = QDateTime( startDate, startTime );
==================================================================================
diff -u recorderprefs.cpp.org recorderprefs.cpp
--- recorderprefs.cpp.org 2017-02-18 20:06:49.000000000 +0100
+++ recorderprefs.cpp 2017-08-01 07:11:49.590786841 +0200
@@ -132,15 +132,18 @@
switch (ui_sampleUnit->currentIndex())
{
case 0:
- thenthOfSec *= 10;
+ thenthOfSec *= 1;
break;
case 1:
- thenthOfSec *= MINUTE_SECS * 10;
+ thenthOfSec *= 10;
break;
case 2:
- thenthOfSec *= HOUR_SECS * 10;
+ thenthOfSec *= MINUTE_SECS * 10;
break;
case 3:
+ thenthOfSec *= HOUR_SECS * 10;
+ break;
+ case 4:
thenthOfSec *= DAY_SECS * 10;
break;
}
@@ -154,15 +157,18 @@
switch (timeUnit->currentIndex())
{
case 0:
- thenthOfSec *= 10;
+ thenthOfSec *= 1;
break;
case 1:
- thenthOfSec *= MINUTE_SECS*10;
+ thenthOfSec *= 10;
break;
case 2:
- thenthOfSec *= HOUR_SECS*10;
+ thenthOfSec *= MINUTE_SECS*10;
break;
case 3:
+ thenthOfSec *= HOUR_SECS*10;
+ break;
+ case 4:
thenthOfSec *= DAY_SECS*10;
break;
}
==================================================================================
diff -u uirecorderprefs.ui.org uirecorderprefs.ui
--- uirecorderprefs.ui.org 2017-02-18 20:06:49.000000000 +0100
+++ uirecorderprefs.ui 2017-08-01 07:09:29.489466986 +0200
@@ -70,6 +70,11 @@
</property>
<item>
<property name="text">
+ <string>1/10 Seconds</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
<string>Seconds</string>
</property>
</item>
@@ -129,6 +134,11 @@
</property>
<item>
<property name="text">
+ <string>1/10 Seconds</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
<string>Seconds</string>
</property>
</item>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment