mirror of https://github.com/EspoTek/Labrador.git
Prompt when loadingDAQ file.
This commit is contained in:
parent
277df7a7a1
commit
1bd7af8b48
|
@ -38,7 +38,8 @@ SOURCES += main.cpp\
|
|||
genericusbdriver.cpp \
|
||||
isobufferbuffer.cpp \
|
||||
uartstyledecoder.cpp \
|
||||
daqform.cpp
|
||||
daqform.cpp \
|
||||
daqloadprompt.cpp
|
||||
|
||||
HEADERS += mainwindow.h \
|
||||
functiongencontrol.h \
|
||||
|
@ -52,16 +53,19 @@ HEADERS += mainwindow.h \
|
|||
q_debugstream.h \
|
||||
unified_debug_structure.h \
|
||||
uartstyledecoder.h \
|
||||
daqform.h
|
||||
daqform.h \
|
||||
daqloadprompt.h
|
||||
|
||||
android:{
|
||||
FORMS += ui_files_mobile/mainwindow.ui \
|
||||
ui_files_mobile/scoperangeenterdialog.ui
|
||||
ui_files_mobile/scoperangeenterdialog.ui \
|
||||
}
|
||||
|
||||
!android:{
|
||||
FORMS += ui_files_desktop/mainwindow.ui \
|
||||
ui_files_desktop/scoperangeenterdialog.ui
|
||||
ui_files_desktop/scoperangeenterdialog.ui \
|
||||
ui_files_desktop/daqform.ui \
|
||||
ui_files_desktop/daqloadprompt.ui
|
||||
}
|
||||
|
||||
|
||||
|
@ -279,6 +283,3 @@ DISTFILES += \
|
|||
build_android/package_source/gradle/wrapper/gradle-wrapper.properties \
|
||||
build_android/package_source/gradlew.bat \
|
||||
build_android/package_source/res/xml/device_filter.xml
|
||||
|
||||
FORMS += \
|
||||
ui_files_desktop/daqform.ui
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
#include "daqloadprompt.h"
|
||||
#include "ui_daqloadprompt.h"
|
||||
#include <QDebug>
|
||||
|
||||
daqLoadPrompt::daqLoadPrompt(QWidget *parent, double minTime, double maxTime) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::daqLoadPrompt)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
min_interval = minTime;
|
||||
ui->startTimeDoubleSpinBox->setMinimum(minTime);
|
||||
ui->endTimeDoubleSpinBox->setMinimum(minTime);
|
||||
ui->startTimeDoubleSpinBox->setMaximum(maxTime);
|
||||
ui->endTimeDoubleSpinBox->setMaximum(maxTime);
|
||||
|
||||
//Internal signals
|
||||
connect(ui->startTimeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(valueChange()));
|
||||
connect(ui->endTimeDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(valueChange()));
|
||||
|
||||
}
|
||||
|
||||
daqLoadPrompt::~daqLoadPrompt()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void daqLoadPrompt::valueChange(){
|
||||
ui->startTimeDoubleSpinBox->setMaximum(ui->endTimeDoubleSpinBox->value() - min_interval);
|
||||
ui->endTimeDoubleSpinBox->setMinimum(ui->startTimeDoubleSpinBox->value() + min_interval);
|
||||
|
||||
startTime(ui->startTimeDoubleSpinBox->value());
|
||||
endTime(ui->endTimeDoubleSpinBox->value());
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef DAQLOADPROMPT_H
|
||||
#define DAQLOADPROMPT_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class daqLoadPrompt;
|
||||
}
|
||||
|
||||
class daqLoadPrompt : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit daqLoadPrompt(QWidget *parent, double minTime, double maxTime);
|
||||
~daqLoadPrompt();
|
||||
|
||||
private:
|
||||
double min_interval;
|
||||
Ui::daqLoadPrompt *ui;
|
||||
signals:
|
||||
void startTime(double);
|
||||
void endTime(double);
|
||||
|
||||
public slots:
|
||||
void valueChange(void);
|
||||
};
|
||||
|
||||
#endif // DAQLOADPROMPT_H
|
|
@ -57,7 +57,7 @@ void isoBuffer::writeBuffer_char(char* data, int len)
|
|||
sprintf(numStr,"%7.5f, ", average_sample_temp/((double)fileIO_maxIncrementedSampleValue));
|
||||
currentFile->write(numStr);
|
||||
currentColumn++;
|
||||
if (currentColumn > COLUMN_BREAK){
|
||||
if (currentColumn >= COLUMN_BREAK){
|
||||
currentFile->write("\n");
|
||||
currentColumn = 0;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ void isoBuffer::writeBuffer_short(short* data, int len)
|
|||
sprintf(numStr,"%7.5f, ", average_sample_temp/((double)fileIO_maxIncrementedSampleValue));
|
||||
currentFile->write(numStr);
|
||||
currentColumn++;
|
||||
if (currentColumn > COLUMN_BREAK){
|
||||
if (currentColumn >= COLUMN_BREAK){
|
||||
currentFile->write("\n");
|
||||
currentColumn = 0;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "isobuffer.h"
|
||||
#include "platformspecific.h"
|
||||
#include <math.h>
|
||||
#include "daqloadprompt.h"
|
||||
|
||||
|
||||
isoDriver::isoDriver(QWidget *parent) : QLabel(parent)
|
||||
|
@ -1279,16 +1280,52 @@ void isoDriver::loadFileBuffer(QFile *fileToLoad){
|
|||
qDebug() << averages;
|
||||
|
||||
//Mode line
|
||||
tempList.clear();
|
||||
currentLine = fileToLoad->readLine();
|
||||
qDebug() << currentLine;
|
||||
tempList.append(currentLine.split('\n'));
|
||||
tempList.append(currentLine.split('\r'));
|
||||
tempList.append(tempList.first().split(' '));
|
||||
qDebug() << tempList;
|
||||
int mode = tempList.back().toInt();
|
||||
qDebug() << mode;
|
||||
|
||||
|
||||
|
||||
tempList.clear();
|
||||
//Count the number of elements
|
||||
qulonglong numel = 0;
|
||||
while (!fileToLoad->atEnd()) {
|
||||
currentLine = fileToLoad->readLine();
|
||||
//tempList = currentLine.split(',').first();
|
||||
tempList.append(currentLine.split(','));
|
||||
numel += tempList.count() - 1;
|
||||
tempList.clear();
|
||||
}
|
||||
|
||||
qDebug("There are %d elements!", numel);
|
||||
//Prompt user for start and end times
|
||||
double defaultSampleRate = 375000;
|
||||
if(mode == 6){
|
||||
defaultSampleRate = 750000;
|
||||
}
|
||||
double minTime = ((double)averages) / defaultSampleRate;
|
||||
double maxTime = numel * ((double)averages) / defaultSampleRate;
|
||||
qDebug() << "maxTime =" << maxTime;
|
||||
|
||||
daqLoadPrompt dlp(this, minTime, maxTime);
|
||||
connect(&dlp, SIGNAL(startTime(double)), this, SLOT(daqLoad_startChanged(double)));
|
||||
connect(&dlp, SIGNAL(endTime(double)), this, SLOT(daqLoad_endChanged(double)));
|
||||
dlp.exec();
|
||||
//Copy the data into the isoBuffer
|
||||
}
|
||||
|
||||
void isoDriver::daqLoad_startChanged(double newStart){
|
||||
qDebug() << "isoDriver::daqLoad_startChanged" << newStart;
|
||||
daqLoad_startTime = newStart;
|
||||
}
|
||||
|
||||
void isoDriver::daqLoad_endChanged(double newEnd){
|
||||
qDebug() << "isoDriver::daqLoad_endChanged" << newEnd;
|
||||
daqLoad_endTime = newEnd;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -111,6 +111,7 @@ private:
|
|||
unsigned int length;
|
||||
QFile *snapshotFile_CH1;
|
||||
QFile *snapshotFile_CH2;
|
||||
double daqLoad_startTime, daqLoad_endTime;
|
||||
|
||||
signals:
|
||||
void setGain(double newGain);
|
||||
|
@ -190,6 +191,8 @@ public slots:
|
|||
void takeSnapshot(QString *fileName, unsigned char channel);
|
||||
void rSourceChanged(int newSource);
|
||||
void serialNeedsDisabling(int channel);
|
||||
void daqLoad_startChanged(double newStart);
|
||||
void daqLoad_endChanged(double newEnd);
|
||||
};
|
||||
|
||||
#endif // ISODRIVER_H
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>daqLoadPrompt</class>
|
||||
<widget class="QDialog" name="daqLoadPrompt">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>320</width>
|
||||
<height>240</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Load DAQ file</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="startTimeLabel">
|
||||
<property name="text">
|
||||
<string>Start Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="startTimeDoubleSpinBox">
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="endTimeLabel">
|
||||
<property name="text">
|
||||
<string>End Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="endTimeDoubleSpinBox">
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>daqLoadPrompt</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>daqLoadPrompt</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue