From c7c0247f81ea421e2e5602e79ebf2b02a4954f04 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sun, 26 May 2024 09:54:11 +0200 Subject: [PATCH] Highlight the current device --- sdrgui/gui/devicesetselectiondialog.cpp | 12 ++++++++++++ sdrgui/gui/devicesetselectiondialog.h | 1 + 2 files changed, 13 insertions(+) diff --git a/sdrgui/gui/devicesetselectiondialog.cpp b/sdrgui/gui/devicesetselectiondialog.cpp index 0455216c7..769621f19 100644 --- a/sdrgui/gui/devicesetselectiondialog.cpp +++ b/sdrgui/gui/devicesetselectiondialog.cpp @@ -52,6 +52,7 @@ DeviceSetSelectionDialog::DeviceSetSelectionDialog(std::vector& de m_deviceSetIndexes.push_back(i); } } + selectIndex(channelDeviceSetIndex); } DeviceSetSelectionDialog::~DeviceSetSelectionDialog() @@ -65,3 +66,14 @@ void DeviceSetSelectionDialog::accept() m_hasChanged = true; QDialog::accept(); } + +void DeviceSetSelectionDialog::selectIndex(int channelDeviceSetIndex) +{ + for (int i = 0; i < (int) m_deviceSetIndexes.size(); i++) + { + if (channelDeviceSetIndex == m_deviceSetIndexes[i]) { + ui->workspaceList->setCurrentRow(i); + break; + } + } +} diff --git a/sdrgui/gui/devicesetselectiondialog.h b/sdrgui/gui/devicesetselectiondialog.h index 7260bbda3..5ca86d68d 100644 --- a/sdrgui/gui/devicesetselectiondialog.h +++ b/sdrgui/gui/devicesetselectiondialog.h @@ -40,6 +40,7 @@ public: bool hasChanged() const { return m_hasChanged; } int getSelectedIndex() const { return m_selectedDeviceSetIndex; } + void selectIndex(int channelDeviceSetIndex); private: Ui::WorkspaceSelectionDialog *ui;