From 1b39d39b2459afaf24d78ac027ce6689aaf92168 Mon Sep 17 00:00:00 2001 From: Shmuel Hazan Date: Sat, 4 Dec 2021 17:53:39 +0200 Subject: [PATCH] Recoding: Disable recording buttons when recording is unavailable Instead of hiding the record action buttons, disable them and indicate the issue on the tooltip. --- src/gui/editors/SongEditor.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/editors/SongEditor.cpp b/src/gui/editors/SongEditor.cpp index 6024b9184..99f62f638 100644 --- a/src/gui/editors/SongEditor.cpp +++ b/src/gui/editors/SongEditor.cpp @@ -910,7 +910,7 @@ ComboBoxModel *SongEditor::snappingModel() const SongEditorWindow::SongEditorWindow(Song* song) : - Editor(Engine::audioEngine()->audioDev()->supportsCapture(), false), + Editor(true, false), m_editor(new SongEditor(song)), m_crtlAction( nullptr ), m_snapSizeLabel( new QLabel( m_toolBar ) ) @@ -1024,6 +1024,15 @@ SongEditorWindow::SongEditorWindow(Song* song) : connect(song, SIGNAL(projectLoaded()), this, SLOT(adjustUiAfterProjectLoad())); connect(this, SIGNAL(resized()), m_editor, SLOT(updatePositionLine())); + + // In case our current audio device does not support capture, + // disable the record buttons. + if(!Engine::audioEngine()->audioDev()->supportsCapture()) { + for(auto &recordAction : {m_recordAccompanyAction, m_recordAction}) { + recordAction->setEnabled(false); + recordAction->setToolTip(tr("Recording is unavailable: try connecting an input device or switching backend")); + } + } } QSize SongEditorWindow::sizeHint() const