From c7c0247f81ea421e2e5602e79ebf2b02a4954f04 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sun, 26 May 2024 09:54:11 +0200 Subject: [PATCH 1/2] 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; From af712de404aa55d23766673662a71388756bedb1 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sun, 26 May 2024 12:03:33 +0200 Subject: [PATCH 2/2] Highlight the current workspace --- sdrgui/channel/channelgui.cpp | 2 +- sdrgui/device/devicegui.cpp | 2 +- sdrgui/feature/featuregui.cpp | 2 +- sdrgui/gui/workspaceselectiondialog.cpp | 3 ++- sdrgui/gui/workspaceselectiondialog.h | 2 +- sdrgui/mainspectrum/mainspectrumgui.cpp | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sdrgui/channel/channelgui.cpp b/sdrgui/channel/channelgui.cpp index 3aeaa0591..556857fad 100644 --- a/sdrgui/channel/channelgui.cpp +++ b/sdrgui/channel/channelgui.cpp @@ -299,7 +299,7 @@ void ChannelGUI::showHelp() void ChannelGUI::openMoveToWorkspaceDialog() { int numberOfWorkspaces = MainWindow::getInstance()->getNumberOfWorkspaces(); - WorkspaceSelectionDialog dialog(numberOfWorkspaces, this); + WorkspaceSelectionDialog dialog(numberOfWorkspaces, getWorkspaceIndex(), this); dialog.exec(); if (dialog.hasChanged()) { diff --git a/sdrgui/device/devicegui.cpp b/sdrgui/device/devicegui.cpp index 9b7eb4c08..a804812fb 100644 --- a/sdrgui/device/devicegui.cpp +++ b/sdrgui/device/devicegui.cpp @@ -370,7 +370,7 @@ void DeviceGUI::showHelp() void DeviceGUI::openMoveToWorkspaceDialog() { int numberOfWorkspaces = MainWindow::getInstance()->getNumberOfWorkspaces(); - WorkspaceSelectionDialog dialog(numberOfWorkspaces, this); + WorkspaceSelectionDialog dialog(numberOfWorkspaces, getWorkspaceIndex(), this); dialog.exec(); if (dialog.hasChanged()) { diff --git a/sdrgui/feature/featuregui.cpp b/sdrgui/feature/featuregui.cpp index 123a26edb..acd8e69e7 100644 --- a/sdrgui/feature/featuregui.cpp +++ b/sdrgui/feature/featuregui.cpp @@ -250,7 +250,7 @@ void FeatureGUI::showHelp() void FeatureGUI::openMoveToWorkspaceDialog() { int numberOfWorkspaces = MainWindow::getInstance()->getNumberOfWorkspaces(); - WorkspaceSelectionDialog dialog(numberOfWorkspaces, this); + WorkspaceSelectionDialog dialog(numberOfWorkspaces, getWorkspaceIndex(), this); dialog.exec(); if (dialog.hasChanged()) { diff --git a/sdrgui/gui/workspaceselectiondialog.cpp b/sdrgui/gui/workspaceselectiondialog.cpp index 897556357..b96b48164 100644 --- a/sdrgui/gui/workspaceselectiondialog.cpp +++ b/sdrgui/gui/workspaceselectiondialog.cpp @@ -23,7 +23,7 @@ #include "workspaceselectiondialog.h" #include "ui_workspaceselectiondialog.h" -WorkspaceSelectionDialog::WorkspaceSelectionDialog(int numberOfWorkspaces, QWidget *parent) : +WorkspaceSelectionDialog::WorkspaceSelectionDialog(int numberOfWorkspaces, int workspaceIndex, QWidget *parent) : QDialog(parent), ui(new Ui::WorkspaceSelectionDialog), m_numberOfWorkspaces(numberOfWorkspaces), @@ -34,6 +34,7 @@ WorkspaceSelectionDialog::WorkspaceSelectionDialog(int numberOfWorkspaces, QWidg for (int i = 0; i < m_numberOfWorkspaces; i++) { ui->workspaceList->addItem(tr("W:%1").arg(i)); } + ui->workspaceList->setCurrentRow(workspaceIndex); } WorkspaceSelectionDialog::~WorkspaceSelectionDialog() diff --git a/sdrgui/gui/workspaceselectiondialog.h b/sdrgui/gui/workspaceselectiondialog.h index b8e700b5b..d1129d715 100644 --- a/sdrgui/gui/workspaceselectiondialog.h +++ b/sdrgui/gui/workspaceselectiondialog.h @@ -33,7 +33,7 @@ class SDRGUI_API WorkspaceSelectionDialog : public QDialog { Q_OBJECT public: - explicit WorkspaceSelectionDialog(int numberOfWorkspaces, QWidget *parent = nullptr); + explicit WorkspaceSelectionDialog(int numberOfWorkspaces, int workspaceIndex, QWidget *parent = nullptr); ~WorkspaceSelectionDialog(); bool hasChanged() const { return m_hasChanged; } diff --git a/sdrgui/mainspectrum/mainspectrumgui.cpp b/sdrgui/mainspectrum/mainspectrumgui.cpp index d01381e13..9f7881b0c 100644 --- a/sdrgui/mainspectrum/mainspectrumgui.cpp +++ b/sdrgui/mainspectrum/mainspectrumgui.cpp @@ -257,7 +257,7 @@ void MainSpectrumGUI::showHelp() void MainSpectrumGUI::openMoveToWorkspaceDialog() { int numberOfWorkspaces = MainWindow::getInstance()->getNumberOfWorkspaces(); - WorkspaceSelectionDialog dialog(numberOfWorkspaces, this); + WorkspaceSelectionDialog dialog(numberOfWorkspaces, getWorkspaceIndex(), this); dialog.exec(); if (dialog.hasChanged()) {