User can select which channel they want to record, and get file dialog prompt.

This commit is contained in:
EspoTek 2017-11-07 13:31:26 +11:00
parent 6e8e03d4a4
commit 662021ebab
5 changed files with 98 additions and 10 deletions

View File

@ -1120,6 +1120,7 @@ void MainWindow::readSettingsFile(){
void MainWindow::on_actionRecord_triggered(bool checked)
{
/*
if(!checked){
ui->controller_iso->internalBuffer375_CH1->disableFileIO();
ui->controller_iso->internalBuffer375_CH2->disableFileIO();
@ -1155,6 +1156,7 @@ void MainWindow::on_actionRecord_triggered(bool checked)
delete(outputDir);
return;
*/
}
void MainWindow::on_actionTake_Snapshot_triggered()
@ -1592,3 +1594,64 @@ void MainWindow::on_actionSnapshot_CH2_triggered()
if(len==0) return; //User cancelled
ui->controller_iso->takeSnapshot(&fileName, 2);
}
void MainWindow::on_actionRecord_CH1_triggered(bool checked)
{
qDebug() << "on_actionRecord_CH1_triggered(bool checked)";
if(!checked){
if(ui->controller_iso->driver->deviceMode!=6){
ui->controller_iso->internalBuffer375_CH1->disableFileIO();
delete(output375_CH1);
} else {
ui->controller_iso->internalBuffer750->disableFileIO();
delete(output750);
}
ui->bufferDisplay->scopeDsrDisableOverride = false;
ui->bufferDisplay->poke();
return;
}
QString fileName;
showFileDialog(&fileName);
qDebug() << fileName;
int len = fileName.length();
if(len==0){
ui->actionRecord_CH1->setChecked(0);
return; //User cancelled
}
if(ui->controller_iso->driver->deviceMode!=6){
output375_CH1 = new QFile(fileName);
ui->controller_iso->internalBuffer375_CH1->enableFileIO(output375_CH1);
} else {
output750 = new QFile(fileName);
ui->controller_iso->internalBuffer750->enableFileIO(output750);
}
ui->bufferDisplay->scopeDsrDisableOverride = true;
ui->bufferDisplay->poke();
return;
}
void MainWindow::on_actionRecord_CH2_triggered(bool checked)
{
qDebug() << "on_actionRecord_CH2_triggered(bool checked)";
if(!checked){
ui->controller_iso->internalBuffer375_CH2->disableFileIO();
delete(output375_CH2);
return;
}
QString fileName;
showFileDialog(&fileName);
qDebug() << fileName;
int len = fileName.length();
if(len==0){
ui->actionRecord_CH2->setChecked(0);
return; //User cancelled
}
output375_CH2 = new QFile(outputDir->filePath("375_CH2.csv"));
ui->controller_iso->internalBuffer375_CH2->enableFileIO(output375_CH2);
return;
}

View File

@ -149,6 +149,11 @@ private slots:
void on_actionSnapshot_CH2_triggered();
void on_actionRecord_CH1_triggered(bool checked);
void on_actionRecord_CH2_triggered(bool checked);
private:
//Generic Vars
Ui::MainWindow *ui;

View File

@ -38,7 +38,7 @@ void bufferControl::scopeIn_CH1(bool state){ //What about DSR!?
}
//Turn off the DSR when CH1 is disabled.
if(!state){
if(!state && !scopeDsrDisableOverride){
scopeDsrUncheck(0);
}
@ -159,6 +159,9 @@ void bufferControl::updateBuffer(bool decrement, int amount){
qFatal("numBuffers is not equal to 0, 1 or 2");
}
if(scopeDsrDisableOverride){
scopeDsrOut(0);
}
}
void bufferControl::digIn_CH1(bool state){
@ -249,5 +252,6 @@ void bufferControl::updateMode(void){
void bufferControl::poke(void){
updateDig(digState);
updateMode();
updateBuffer(0,0);
}

View File

@ -14,6 +14,7 @@ public:
explicit bufferControl(QWidget *parent = 0);
void refreshImage(void);
bool busSnifferState_CH1 = false;
bool scopeDsrDisableOverride = false;
private:
QPixmap bufferImage;
int numBuffers = 1;

View File

@ -1346,7 +1346,14 @@
<addaction name="actionSnapshot_CH1"/>
<addaction name="actionSnapshot_CH2"/>
</widget>
<addaction name="actionRecord"/>
<widget class="QMenu" name="menuRecord">
<property name="title">
<string>Record</string>
</property>
<addaction name="actionRecord_CH1"/>
<addaction name="actionRecord_CH2"/>
</widget>
<addaction name="menuRecord"/>
<addaction name="menuTake_Snapshot"/>
</widget>
<widget class="QMenu" name="menuOscilloscope_2">
@ -2011,14 +2018,6 @@
<string>None</string>
</property>
</action>
<action name="actionRecord">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Record</string>
</property>
</action>
<action name="actionForce_Square">
<property name="checkable">
<bool>true</bool>
@ -2201,6 +2200,22 @@
<string>CH2</string>
</property>
</action>
<action name="actionRecord_CH1">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>CH1</string>
</property>
</action>
<action name="actionRecord_CH2">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>CH2</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>