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
 
@@ -184,12 +184,15 @@ MainWindow::MainWindow(QWidget *parent) 
 
                         if (ui->actionPause->isChecked() && enabled)
 
                         {
 
                             dataFormatPanel.pause(false);
 
                         }
 
                     });
 

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

	
 
    // init data arrays and plot
 
    numOfSamples = plotControlPanel.numOfSamples();
 
    unsigned numOfChannels = dataFormatPanel.numOfChannels();
 

	
 
    channelMan.setNumOfSamples(numOfSamples);
 
    channelMan.setNumOfChannels(dataFormatPanel.numOfChannels());
src/recordpanel.cpp
Show inline comments
 
@@ -213,25 +213,26 @@ bool RecordPanel::confirmOverwrite(QStri
 
        return selectFile();
 
    }
 
}
 

	
 
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();
 
}
 

	
 
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
 
@@ -46,12 +46,16 @@ public:
 

	
 
signals:
 
    void recordStarted();
 
    void recordStopped();
 
    void recordPausedChanged(bool enabled);
 

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

	
 
private:
 
    Ui::RecordPanel *ui;
 
    QToolBar recordToolBar;
 
    QAction recordAction;
 
    QString selectedFile;
 
    bool overwriteSelected;
src/recordpanel.ui
Show inline comments
 
@@ -67,13 +67,13 @@
 
       <property name="checked">
 
        <bool>true</bool>
 
       </property>
 
      </widget>
 
     </item>
 
     <item>
 
      <widget class="QCheckBox" name="cpStopOnClose">
 
      <widget class="QCheckBox" name="cbStopOnClose">
 
       <property name="text">
 
        <string>Stop recording when port closed</string>
 
       </property>
 
       <property name="checked">
 
        <bool>true</bool>
 
       </property>
0 comments (0 inline, 0 general)