From 662021ebabde9d13853c86e75c45434ce2c960f5 Mon Sep 17 00:00:00 2001 From: EspoTek Date: Tue, 7 Nov 2017 13:31:26 +1100 Subject: [PATCH] User can select which channel they want to record, and get file dialog prompt. --- Desktop_Interface/mainwindow.cpp | 63 +++++++++++++++++++ Desktop_Interface/mainwindow.h | 5 ++ .../ui_elements/buffercontrol.cpp | 6 +- Desktop_Interface/ui_elements/buffercontrol.h | 1 + .../ui_files_desktop/mainwindow.ui | 33 +++++++--- 5 files changed, 98 insertions(+), 10 deletions(-) diff --git a/Desktop_Interface/mainwindow.cpp b/Desktop_Interface/mainwindow.cpp index 082cdd8f..71a5189b 100644 --- a/Desktop_Interface/mainwindow.cpp +++ b/Desktop_Interface/mainwindow.cpp @@ -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; +} diff --git a/Desktop_Interface/mainwindow.h b/Desktop_Interface/mainwindow.h index cf9ff92c..011f91ac 100644 --- a/Desktop_Interface/mainwindow.h +++ b/Desktop_Interface/mainwindow.h @@ -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; diff --git a/Desktop_Interface/ui_elements/buffercontrol.cpp b/Desktop_Interface/ui_elements/buffercontrol.cpp index 3542aaf6..399b0b8f 100644 --- a/Desktop_Interface/ui_elements/buffercontrol.cpp +++ b/Desktop_Interface/ui_elements/buffercontrol.cpp @@ -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); } diff --git a/Desktop_Interface/ui_elements/buffercontrol.h b/Desktop_Interface/ui_elements/buffercontrol.h index c67e908d..83bd857e 100644 --- a/Desktop_Interface/ui_elements/buffercontrol.h +++ b/Desktop_Interface/ui_elements/buffercontrol.h @@ -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; diff --git a/Desktop_Interface/ui_files_desktop/mainwindow.ui b/Desktop_Interface/ui_files_desktop/mainwindow.ui index 0f12bff3..8abbfda9 100644 --- a/Desktop_Interface/ui_files_desktop/mainwindow.ui +++ b/Desktop_Interface/ui_files_desktop/mainwindow.ui @@ -1346,7 +1346,14 @@ - + + + Record + + + + + @@ -2011,14 +2018,6 @@ None - - - true - - - Record - - true @@ -2201,6 +2200,22 @@ CH2 + + + true + + + CH1 + + + + + true + + + CH2 + +