1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-21 04:16:34 -04:00

Merge pull request #2126 from dforsi/feature/highlight

Highlight the current workspace and device in their dialogs
This commit is contained in:
Edouard Griffiths 2024-05-26 18:04:23 +00:00 committed by GitHub
commit bace0951bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 20 additions and 6 deletions

View File

@ -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()) {

View File

@ -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()) {

View File

@ -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()) {

View File

@ -52,6 +52,7 @@ DeviceSetSelectionDialog::DeviceSetSelectionDialog(std::vector<DeviceUISet*>& 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;
}
}
}

View File

@ -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;

View File

@ -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()

View File

@ -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; }

View File

@ -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()) {