Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight the current workspace and device in their dialogs #2126

Merged
merged 2 commits into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdrgui/channel/channelgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion sdrgui/device/devicegui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
2 changes: 1 addition & 1 deletion sdrgui/feature/featuregui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
12 changes: 12 additions & 0 deletions sdrgui/gui/devicesetselectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ DeviceSetSelectionDialog::DeviceSetSelectionDialog(std::vector<DeviceUISet*>& de
m_deviceSetIndexes.push_back(i);
}
}
selectIndex(channelDeviceSetIndex);
}

DeviceSetSelectionDialog::~DeviceSetSelectionDialog()
Expand All @@ -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;
}
}
}
1 change: 1 addition & 0 deletions sdrgui/gui/devicesetselectiondialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class SDRGUI_API DeviceSetSelectionDialog : public QDialog

bool hasChanged() const { return m_hasChanged; }
int getSelectedIndex() const { return m_selectedDeviceSetIndex; }
void selectIndex(int channelDeviceSetIndex);

private:
Ui::WorkspaceSelectionDialog *ui;
Expand Down
3 changes: 2 additions & 1 deletion sdrgui/gui/workspaceselectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion sdrgui/gui/workspaceselectiondialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
2 changes: 1 addition & 1 deletion sdrgui/mainspectrum/mainspectrumgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Loading