Changeset - 1bdd2654701b
[Not reviewed]
recording
0 4 0
Hasan Yavuz Ă–ZDERYA - 9 years ago 2017-02-14 09:54:37
hy@ozderya.net
implemented stop recording when port closed
4 files changed with 18 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/mainwindow.cpp
Show inline comments
 
@@ -187,6 +187,9 @@ MainWindow::MainWindow(QWidget *parent) 
 
                         }
 
                     });
 

	
 
    connect(&serialPort, &QIODevice::aboutToClose,
 
            &recordPanel, &RecordPanel::onPortClose);
 

	
 
    // init data arrays and plot
 
    numOfSamples = plotControlPanel.numOfSamples();
 
    unsigned numOfChannels = dataFormatPanel.numOfChannels();
src/recordpanel.cpp
Show inline comments
 
@@ -216,17 +216,9 @@ bool RecordPanel::confirmOverwrite(QStri
 

	
 
void RecordPanel::startRecording(void)
 
{
 
    qDebug() << "start recording";
 

	
 
    // TEST CODE
 
    // TODO: channel names
 
    QStringList cn;
 
    // cn << "chan0" << "chan1" << "chan2";
 

	
 
    _recorder->startRecording(selectedFile, cn);
 

	
 
    // add test data
 
    // double data[3] = {15., 15., 15.};
 
    // _recorder.addData(data, 3, 3);
 
    emit recordStarted();
 
}
 

	
 
@@ -235,3 +227,12 @@ void RecordPanel::stopRecording(void)
 
    emit recordStopped();
 
    _recorder->stopRecording();
 
}
 

	
 
void RecordPanel::onPortClose()
 
{
 
    if (recordAction.isChecked() && ui->cbStopOnClose->isChecked())
 
    {
 
        stopRecording();
 
        recordAction.setChecked(false);
 
    }
 
}
src/recordpanel.h
Show inline comments
 
@@ -49,6 +49,10 @@ signals:
 
    void recordStopped();
 
    void recordPausedChanged(bool enabled);
 

	
 
public slots:
 
    /// Must be called when port is closed
 
    void onPortClose();
 

	
 
private:
 
    Ui::RecordPanel *ui;
 
    QToolBar recordToolBar;
src/recordpanel.ui
Show inline comments
 
@@ -70,7 +70,7 @@
 
      </widget>
 
     </item>
 
     <item>
 
      <widget class="QCheckBox" name="cpStopOnClose">
 
      <widget class="QCheckBox" name="cbStopOnClose">
 
       <property name="text">
 
        <string>Stop recording when port closed</string>
 
       </property>
0 comments (0 inline, 0 general)