diff options
author | Daniel Poelzleithner <git@poelzi.org> | 2018-05-16 01:02:33 +0200 |
---|---|---|
committer | Daniel Poelzleithner <git@poelzi.org> | 2018-05-16 01:02:33 +0200 |
commit | 4d9d1def3bbb33c07d8a517c8f01d5132a034bf5 (patch) | |
tree | c2c2006fe949e9b5de7e8c252f6a145ac993509a /src/recording | |
parent | a37193829d69742f6c942fbb65a7f600efcce2b1 (diff) |
Use ErrorDialogHandler for free disk warning
Diffstat (limited to 'src/recording')
-rw-r--r-- | src/recording/recordingmanager.cpp | 25 | ||||
-rw-r--r-- | src/recording/recordingmanager.h | 1 |
2 files changed, 19 insertions, 7 deletions
diff --git a/src/recording/recordingmanager.cpp b/src/recording/recordingmanager.cpp index a3979d8b4c..e1a975b6bf 100644 --- a/src/recording/recordingmanager.cpp +++ b/src/recording/recordingmanager.cpp @@ -181,7 +181,6 @@ void RecordingManager::stopRecording() m_secondsRecorded = 0; } - void RecordingManager::setRecordingDir() { QDir recordDir(m_pConfig->getValueString( ConfigKey(RECORDING_PREF_KEY, "Directory"))); @@ -204,8 +203,6 @@ QString& RecordingManager::getRecordingDir() { return m_recordingDir; } - - // Only called when recording is active. void RecordingManager::slotDurationRecorded(quint64 duration) { @@ -269,13 +266,27 @@ void RecordingManager::slotBytesRecorded(int bytes) m_dfSilence = true; // we run out of diskspace and should warn the user. // FIXME(poelzi) temporary display a error message. Replace this with Message Infrastructure when ready - QMessageBox::warning( - NULL, - tr("Low Disk Space Warning"), - tr("There is less then 1 GiB of useable space in the recording folder")); + warnFreespace(); } } +void RecordingManager::warnFreespace() { + qWarning() << "RecordingManager: less then 1 GiB free space"; + ErrorDialogProperties* props = ErrorDialogHandler::instance()->newDialogProperties(); + props->setType(DLG_WARNING); + props->setTitle(tr("Low Disk Space Warning")); + props->setText(tr("There is less then 1 GiB of useable space in the recording folder")); + props->setKey("RecordingManager::warnFreespace"); // To prevent multiple windows for the same error + + // Allow user to suppress further notifications about this particular error + props->addButton(QMessageBox::Ok); + props->setDefaultButton(QMessageBox::Ok); + props->setEscapeButton(QMessageBox::Ok); + props->setModal(false); + + ErrorDialogHandler::instance()->requestErrorDialog(props); +} + void RecordingManager::slotIsRecording(bool isRecordingActive, bool error) { //qDebug() << "SlotIsRecording " << isRecording << error; diff --git a/src/recording/recordingmanager.h b/src/recording/recordingmanager.h index 574ef72f9e..3211eec468 100644 --- a/src/recording/recordingmanager.h +++ b/src/recording/recordingmanager.h @@ -66,6 +66,7 @@ class RecordingManager : public QObject // to split the file. The nth filename will follow the date/time // name of the first split but with a suffix. void splitContinueRecording(); + void warnFreespace(); ControlProxy* m_recReady; ControlObject* m_recReadyCO; ControlPushButton* m_pToggleRecording; |