# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2018-07-07 12:58:08 # Node ID b390600dec07628dd60e9c15840ebf318b908786 # Parent e798d26ab38b60f4fb223f0564d4b3606b656b65 revert record button if recording fails to start (file can't be opened etc) diff --git a/src/recordpanel.cpp b/src/recordpanel.cpp --- a/src/recordpanel.cpp +++ b/src/recordpanel.cpp @@ -210,7 +210,9 @@ void RecordPanel::onRecord(bool start) else { overwriteSelected = false; - startRecording(fn); + // TODO: show more visible error message when recording fails + if (!startRecording(fn)) + recordAction.setChecked(false); } } @@ -289,7 +291,7 @@ bool RecordPanel::confirmOverwrite(QStri } } -void RecordPanel::startRecording(QString fileName) +bool RecordPanel::startRecording(QString fileName) { QStringList channelNames; if (ui->cbHeader->isChecked()) @@ -300,6 +302,11 @@ void RecordPanel::startRecording(QString channelNames, ui->cbTimestamp->isChecked())) { _stream->connectFollower(&recorder); + return true; + } + else + { + return false; } } diff --git a/src/recordpanel.h b/src/recordpanel.h --- a/src/recordpanel.h +++ b/src/recordpanel.h @@ -108,7 +108,7 @@ private: /// Formats timestamp in given text QString formatTimeStamp(QString t) const; - void startRecording(QString fileName); + bool startRecording(QString fileName); void stopRecording(void); /// Returns separator text from ui. "\t" is converted to TAB