mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-10-30 20:40:20 -04:00 
			
		
		
		
	Use tabs rather than a table, for satellite device set settings to workaround #840.
This commit is contained in:
		
							parent
							
								
									268318e02c
								
							
						
					
					
						commit
						fd5a6b61e8
					
				| @ -44,7 +44,7 @@ Pressing this button displays the SDRangel Control dialog. | |||||||
| 
 | 
 | ||||||
| This dialog determines the actions the Satellite Tracker will take when AOS or LOS occurs for a satellite. First, select a satellite from the dropdown box. Information about the satellite's transmit and receive modes should appear in the field at the bottom of the dialog, if available in the SatNogs database. | This dialog determines the actions the Satellite Tracker will take when AOS or LOS occurs for a satellite. First, select a satellite from the dropdown box. Information about the satellite's transmit and receive modes should appear in the field at the bottom of the dialog, if available in the SatNogs database. | ||||||
| 
 | 
 | ||||||
| To perform an action on an SDRangel device set on AOS or LOS, press the + button. This will add a row in the table, allowing you to select: | To perform an action on an SDRangel device set on AOS or LOS, press the "Add device set" button. This will add a new, allowing you to select: | ||||||
| 
 | 
 | ||||||
| * The device set that will be controlled. This will list all currently open device sets. You can also type the name of a new device set. | * The device set that will be controlled. This will list all currently open device sets. You can also type the name of a new device set. | ||||||
| * The preset to load on AOS. This allows preset device settings (E.g. centre frequency) and demodulators to be opened when the satellite becomes visible. | * The preset to load on AOS. This allows preset device settings (E.g. centre frequency) and demodulators to be opened when the satellite becomes visible. | ||||||
| @ -56,7 +56,7 @@ To perform an action on an SDRangel device set on AOS or LOS, press the + button | |||||||
| * A command or script to execute on AOS. | * A command or script to execute on AOS. | ||||||
| * A command or script to execute on LOS. | * A command or script to execute on LOS. | ||||||
| 
 | 
 | ||||||
| Multiple rows can be added, to allow independent control of multiple device sets. To remove a row, select the row by clicking the row number, then press the - button. | Multiple tabs can be added, to allow independent control of multiple device sets. To remove a tab, click the cross next to the device set name in the tab list. | ||||||
| 
 | 
 | ||||||
| <h3>6: Show Satellite Selection dialog</h3> | <h3>6: Show Satellite Selection dialog</h3> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ | |||||||
| ///////////////////////////////////////////////////////////////////////////////////
 | ///////////////////////////////////////////////////////////////////////////////////
 | ||||||
| 
 | 
 | ||||||
| #include <QDebug> | #include <QDebug> | ||||||
| #include <QHBoxLayout> | #include <QFormLayout> | ||||||
| #include <QSizePolicy> | #include <QSizePolicy> | ||||||
| 
 | 
 | ||||||
| #include "satellitedevicesettingsgui.h" | #include "satellitedevicesettingsgui.h" | ||||||
| @ -28,20 +28,25 @@ | |||||||
| #include "plugin/pluginapi.h" | #include "plugin/pluginapi.h" | ||||||
| 
 | 
 | ||||||
| SatelliteDeviceSettingsGUI::SatelliteDeviceSettingsGUI(SatelliteTrackerSettings::SatelliteDeviceSettings *devSettings, | SatelliteDeviceSettingsGUI::SatelliteDeviceSettingsGUI(SatelliteTrackerSettings::SatelliteDeviceSettings *devSettings, | ||||||
|                                                        QTableWidget *table) |                                                        QTabWidget *tab, QWidget *parent) : | ||||||
|  |     QWidget(parent), | ||||||
|  |     m_tab(tab) | ||||||
| { | { | ||||||
|     m_devSettings = devSettings; |     m_devSettings = devSettings; | ||||||
| 
 | 
 | ||||||
|  |     QFormLayout *formLayout = new QFormLayout(); | ||||||
|  | 
 | ||||||
|     // Device set
 |     // Device set
 | ||||||
|     m_deviceSetWidget = new QComboBox(); |     m_deviceSetWidget = new QComboBox(); | ||||||
|     m_deviceSetWidget->setEditable(true); |     m_deviceSetWidget->setEditable(true); | ||||||
|     m_deviceSetWidget->setToolTip(table->horizontalHeaderItem(SAT_DEVICE_COL_DEVICESET)->toolTip()); |     m_deviceSetWidget->setToolTip("Device set to control"); | ||||||
|     m_deviceSetItem = new QWidget(); |     formLayout->addRow("Device set", m_deviceSetWidget); | ||||||
|     layout(m_deviceSetItem, m_deviceSetWidget); |  | ||||||
|     addDeviceSets(); |     addDeviceSets(); | ||||||
|     int devSetIdx = m_deviceSetWidget->findText(devSettings->m_deviceSet); |     int devSetIdx = m_deviceSetWidget->findText(devSettings->m_deviceSet); | ||||||
|     if (devSetIdx != -1) |     if (devSetIdx != -1) | ||||||
|  |     { | ||||||
|         m_deviceSetWidget->setCurrentIndex(devSetIdx); |         m_deviceSetWidget->setCurrentIndex(devSetIdx); | ||||||
|  |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
|         m_deviceSetWidget->addItem(devSettings->m_deviceSet); |         m_deviceSetWidget->addItem(devSettings->m_deviceSet); | ||||||
| @ -52,9 +57,8 @@ SatelliteDeviceSettingsGUI::SatelliteDeviceSettingsGUI(SatelliteTrackerSettings: | |||||||
|     m_presetWidget = new QComboBox(); |     m_presetWidget = new QComboBox(); | ||||||
|     m_presetWidget->setEditable(false); |     m_presetWidget->setEditable(false); | ||||||
|     m_presetWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |     m_presetWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); | ||||||
|     m_presetWidget->setToolTip(table->horizontalHeaderItem(SAT_DEVICE_COL_PRESET)->toolTip()); |     m_presetWidget->setToolTip("Preset to load on AOS"); | ||||||
|     m_presetItem = new QWidget(); |     formLayout->addRow("Preset", m_presetWidget); | ||||||
|     layout(m_presetItem, m_presetWidget); |  | ||||||
|     addPresets(devSettings->m_deviceSet); |     addPresets(devSettings->m_deviceSet); | ||||||
| 
 | 
 | ||||||
|     const MainSettings& mainSettings = MainCore::instance()->getSettings(); |     const MainSettings& mainSettings = MainCore::instance()->getSettings(); | ||||||
| @ -82,11 +86,10 @@ SatelliteDeviceSettingsGUI::SatelliteDeviceSettingsGUI(SatelliteTrackerSettings: | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Doppler
 |     // Doppler
 | ||||||
|     m_dopplerWidget =  new QComboBox(); |     m_dopplerWidget =  new QListView(); | ||||||
|     m_dopplerWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |     m_dopplerWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); | ||||||
|     m_dopplerWidget->setToolTip(table->horizontalHeaderItem(SAT_DEVICE_COL_DOPPLER)->toolTip()); |     m_dopplerWidget->setToolTip("Channels that will have Doppler correction applied"); | ||||||
|     m_dopplerItem = new QWidget(); |     formLayout->addRow("Doppler correction", m_dopplerWidget); | ||||||
|     layout(m_dopplerItem, m_dopplerWidget); |  | ||||||
|     m_dopplerWidget->setModel(&m_dopplerModel); |     m_dopplerWidget->setModel(&m_dopplerModel); | ||||||
|     addChannels(); |     addChannels(); | ||||||
| 
 | 
 | ||||||
| @ -96,66 +99,48 @@ SatelliteDeviceSettingsGUI::SatelliteDeviceSettingsGUI(SatelliteTrackerSettings: | |||||||
|     // Start on AOS
 |     // Start on AOS
 | ||||||
|     m_startOnAOSWidget = new QCheckBox(); |     m_startOnAOSWidget = new QCheckBox(); | ||||||
|     m_startOnAOSWidget->setChecked(devSettings->m_startOnAOS); |     m_startOnAOSWidget->setChecked(devSettings->m_startOnAOS); | ||||||
|     m_startOnAOSWidget->setToolTip(table->horizontalHeaderItem(SAT_DEVICE_COL_START)->toolTip()); |     m_startOnAOSWidget->setToolTip("Start acquisition on AOS"); | ||||||
|     m_startOnAOSItem = new QWidget(); |     formLayout->addRow("Start acquisition on AOS", m_startOnAOSWidget); | ||||||
|     layout(m_startOnAOSItem, m_startOnAOSWidget); |  | ||||||
| 
 | 
 | ||||||
|     // Stop on AOS
 |     // Stop on AOS
 | ||||||
|     m_stopOnLOSWidget = new QCheckBox(); |     m_stopOnLOSWidget = new QCheckBox(); | ||||||
|     m_stopOnLOSWidget->setChecked(devSettings->m_stopOnLOS); |     m_stopOnLOSWidget->setChecked(devSettings->m_stopOnLOS); | ||||||
|     m_stopOnLOSWidget->setToolTip(table->horizontalHeaderItem(SAT_DEVICE_COL_STOP)->toolTip()); |     m_stopOnLOSWidget->setToolTip("Stop acquisition on LOS"); | ||||||
|     m_stopOnLOSItem = new QWidget(); |     formLayout->addRow("Stop acquisition on LOS", m_stopOnLOSWidget); | ||||||
|     layout(m_stopOnLOSItem, m_stopOnLOSWidget); |  | ||||||
| 
 | 
 | ||||||
|     // Start file sink
 |     // Start file sink
 | ||||||
|     m_startStopFileSinkWidget = new QCheckBox(); |     m_startStopFileSinkWidget = new QCheckBox(); | ||||||
|     m_startStopFileSinkWidget->setChecked(devSettings->m_startStopFileSink); |     m_startStopFileSinkWidget->setChecked(devSettings->m_startStopFileSink); | ||||||
|     m_startStopFileSinkWidget->setToolTip(table->horizontalHeaderItem(SAT_DEVICE_COL_START_FILE_SINK)->toolTip()); |     m_startStopFileSinkWidget->setToolTip("Start file sinks recording on AOS and stop recording on LOS"); | ||||||
|     m_startStopFileSinkItem = new QWidget(); |     formLayout->addRow("Start/stop file sinks on AOS/LOS", m_startStopFileSinkWidget); | ||||||
|     layout(m_startStopFileSinkItem, m_startStopFileSinkWidget); |  | ||||||
| 
 | 
 | ||||||
|     // Frequency override
 |     // Frequency override
 | ||||||
|     m_frequencyItem = new QTableWidgetItem(); |     m_frequencyWidget = new QLineEdit(); | ||||||
|     m_frequencyItem->setToolTip(table->horizontalHeaderItem(SAT_DEVICE_COL_FREQUENCY)->toolTip()); |     m_frequencyWidget->setToolTip("Override the center frequency in the preset with a value specified here in MHz.\nThis allows a single preset to be shared between different satellites that differ only in frequency."); | ||||||
|     if (devSettings->m_frequency != 0) |     // FIXME: Set mask for numeric or blank
 | ||||||
|         m_frequencyItem->setData(Qt::DisplayRole, QString("%1").arg(devSettings->m_frequency/1000000.0, 0, 'f', 3, QLatin1Char(' '))); |     if (devSettings->m_frequency != 0) { | ||||||
|  |         m_frequencyWidget->setText(QString("%1").arg(devSettings->m_frequency/1000000.0, 0, 'f', 3, QLatin1Char(' '))); | ||||||
|  |     } | ||||||
|  |     formLayout->addRow("Override preset frequency (MHz)", m_frequencyWidget); | ||||||
| 
 | 
 | ||||||
|     // AOS command
 |     // AOS command
 | ||||||
|     m_aosCommandItem = new QTableWidgetItem(); |     m_aosCommandWidget = new QLineEdit(); | ||||||
|     m_aosCommandItem->setText(devSettings->m_aosCommand); |     m_aosCommandWidget->setText(devSettings->m_aosCommand); | ||||||
|     m_aosCommandItem->setToolTip(table->horizontalHeaderItem(SAT_DEVICE_COL_AOS_COMMAND)->toolTip()); |     m_aosCommandWidget->setToolTip("Command to execute on AOS"); | ||||||
|  |     formLayout->addRow("AOS command", m_aosCommandWidget); | ||||||
| 
 | 
 | ||||||
|     // LOS command
 |     // LOS command
 | ||||||
|     m_losCommandItem = new QTableWidgetItem(); |     m_losCommandWidget = new QLineEdit(); | ||||||
|     m_losCommandItem->setText(devSettings->m_losCommand); |     m_losCommandWidget->setText(devSettings->m_losCommand); | ||||||
|     m_losCommandItem->setToolTip(table->horizontalHeaderItem(SAT_DEVICE_COL_LOS_COMMAND)->toolTip()); |     m_losCommandWidget->setToolTip("Command to execute on LOS"); | ||||||
|  |     formLayout->addRow("LOS command", m_losCommandWidget); | ||||||
| 
 | 
 | ||||||
|     int row = table->rowCount(); |     setLayout(formLayout); | ||||||
|     table->setRowCount(row + 1); |  | ||||||
|     table->setCellWidget(row, SAT_DEVICE_COL_DEVICESET, m_deviceSetItem); |  | ||||||
|     table->setCellWidget(row, SAT_DEVICE_COL_PRESET, m_presetItem); |  | ||||||
|     table->setCellWidget(row, SAT_DEVICE_COL_DOPPLER, m_dopplerItem); |  | ||||||
|     table->setCellWidget(row, SAT_DEVICE_COL_START, m_startOnAOSItem); |  | ||||||
|     table->setCellWidget(row, SAT_DEVICE_COL_STOP, m_stopOnLOSItem); |  | ||||||
|     table->setCellWidget(row, SAT_DEVICE_COL_START_FILE_SINK, m_startStopFileSinkItem); |  | ||||||
|     table->setItem(row, SAT_DEVICE_COL_FREQUENCY, m_frequencyItem); |  | ||||||
|     table->setItem(row, SAT_DEVICE_COL_AOS_COMMAND, m_aosCommandItem); |  | ||||||
|     table->setItem(row, SAT_DEVICE_COL_LOS_COMMAND, m_losCommandItem); |  | ||||||
|     table->resizeColumnsToContents(); |  | ||||||
| 
 | 
 | ||||||
|     connect(m_deviceSetWidget, SIGNAL(currentTextChanged(const QString &)), this, SLOT(on_m_deviceSetWidget_currentTextChanged(const QString &))); |     connect(m_deviceSetWidget, SIGNAL(currentTextChanged(const QString &)), this, SLOT(on_m_deviceSetWidget_currentTextChanged(const QString &))); | ||||||
|     connect(m_presetWidget, SIGNAL(currentIndexChanged(int)), this, SLOT(on_m_presetWidget_currentIndexChanged(int))); |     connect(m_presetWidget, SIGNAL(currentIndexChanged(int)), this, SLOT(on_m_presetWidget_currentIndexChanged(int))); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void SatelliteDeviceSettingsGUI::layout(QWidget *parent, QWidget *child) |  | ||||||
| { |  | ||||||
|     QHBoxLayout* pLayout = new QHBoxLayout(parent); |  | ||||||
|     pLayout->addWidget(child); |  | ||||||
|     pLayout->setAlignment(Qt::AlignCenter); |  | ||||||
|     pLayout->setContentsMargins(0, 0, 0, 0); |  | ||||||
|     parent->setLayout(pLayout); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // Add available devicesets to the combobox
 | // Add available devicesets to the combobox
 | ||||||
| void SatelliteDeviceSettingsGUI::addDeviceSets() | void SatelliteDeviceSettingsGUI::addDeviceSets() | ||||||
| { | { | ||||||
| @ -210,8 +195,9 @@ const Preset* SatelliteDeviceSettingsGUI::getSelectedPreset() | |||||||
|             || ((preset->isSinkPreset() && (m_currentPresets == "T"))) |             || ((preset->isSinkPreset() && (m_currentPresets == "T"))) | ||||||
|             || ((preset->isMIMOPreset() && (m_currentPresets == "M")))) |             || ((preset->isMIMOPreset() && (m_currentPresets == "M")))) | ||||||
|         { |         { | ||||||
|             if (listIdx == presetIdx) |             if (listIdx == presetIdx) { | ||||||
|                 return preset; |                 return preset; | ||||||
|  |             } | ||||||
|             presetIdx++; |             presetIdx++; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @ -247,9 +233,13 @@ void SatelliteDeviceSettingsGUI::on_m_deviceSetWidget_currentTextChanged(const Q | |||||||
| { | { | ||||||
|     if (!text.isEmpty()) |     if (!text.isEmpty()) | ||||||
|     { |     { | ||||||
|         if (text[0] != m_currentPresets) |         if (text[0] != m_currentPresets) { | ||||||
|             addPresets(text[0]); |             addPresets(text[0]); | ||||||
|         } |         } | ||||||
|  |         // Set name of tab to match
 | ||||||
|  |         int currentTabIndex = m_tab->currentIndex(); | ||||||
|  |         m_tab->setTabText(currentTabIndex, text); | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Update doppler combo, to correspond to selected preset
 | // Update doppler combo, to correspond to selected preset
 | ||||||
| @ -279,13 +269,14 @@ void SatelliteDeviceSettingsGUI::accept() | |||||||
|     m_devSettings->m_doppler.clear(); |     m_devSettings->m_doppler.clear(); | ||||||
|     for (int i = 0; i < m_dopplerItems.size(); i++) |     for (int i = 0; i < m_dopplerItems.size(); i++) | ||||||
|     { |     { | ||||||
|         if (m_dopplerItems[i]->checkState() == Qt::Checked) |         if (m_dopplerItems[i]->checkState() == Qt::Checked) { | ||||||
|             m_devSettings->m_doppler.append(i); |             m_devSettings->m_doppler.append(i); | ||||||
|         } |         } | ||||||
|  |     } | ||||||
|     m_devSettings->m_startOnAOS = m_startOnAOSWidget->isChecked(); |     m_devSettings->m_startOnAOS = m_startOnAOSWidget->isChecked(); | ||||||
|     m_devSettings->m_stopOnLOS = m_stopOnLOSWidget->isChecked(); |     m_devSettings->m_stopOnLOS = m_stopOnLOSWidget->isChecked(); | ||||||
|     m_devSettings->m_startStopFileSink = m_startStopFileSinkWidget->isChecked(); |     m_devSettings->m_startStopFileSink = m_startStopFileSinkWidget->isChecked(); | ||||||
|     m_devSettings->m_frequency = (quint64)(m_frequencyItem->data(Qt::DisplayRole).toDouble() * 1000000.0); |     m_devSettings->m_frequency = (quint64)(m_frequencyWidget->text().toDouble() * 1000000.0); | ||||||
|     m_devSettings->m_aosCommand = m_aosCommandItem->text(); |     m_devSettings->m_aosCommand = m_aosCommandWidget->text(); | ||||||
|     m_devSettings->m_losCommand = m_losCommandItem->text(); |     m_devSettings->m_losCommand = m_losCommandWidget->text(); | ||||||
| } | } | ||||||
|  | |||||||
| @ -19,7 +19,10 @@ | |||||||
| #define INCLUDE_FEATURE_SATELLITEDEVICESETTINGSGUI_H | #define INCLUDE_FEATURE_SATELLITEDEVICESETTINGSGUI_H | ||||||
| 
 | 
 | ||||||
| #include <QComboBox> | #include <QComboBox> | ||||||
|  | #include <QListView> | ||||||
|  | #include <QLineEdit> | ||||||
| #include <QCheckBox> | #include <QCheckBox> | ||||||
|  | #include <QTabWidget> | ||||||
| #include <QTableWidget> | #include <QTableWidget> | ||||||
| #include <QTableWidgetItem> | #include <QTableWidgetItem> | ||||||
| #include <QStandardItemModel> | #include <QStandardItemModel> | ||||||
| @ -30,19 +33,18 @@ | |||||||
| 
 | 
 | ||||||
| class SatelliteRadioControlDialog; | class SatelliteRadioControlDialog; | ||||||
| 
 | 
 | ||||||
| class SatelliteDeviceSettingsGUI : public QObject | class SatelliteDeviceSettingsGUI : public QWidget | ||||||
| { | { | ||||||
|     Q_OBJECT |     Q_OBJECT | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
| 
 | 
 | ||||||
|     SatelliteDeviceSettingsGUI(SatelliteTrackerSettings::SatelliteDeviceSettings *devSettings, |     explicit SatelliteDeviceSettingsGUI(SatelliteTrackerSettings::SatelliteDeviceSettings *devSettings, | ||||||
|                                QTableWidget *table); |                                QTabWidget *tab, QWidget *parent = nullptr); | ||||||
|     void accept(); |     void accept(); | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
| 
 | 
 | ||||||
|     void layout(QWidget *parent, QWidget *child); |  | ||||||
|     void addDeviceSets(); |     void addDeviceSets(); | ||||||
|     void addPresets(const QString& deviceSet); |     void addPresets(const QString& deviceSet); | ||||||
|     void addChannels(); |     void addChannels(); | ||||||
| @ -56,21 +58,16 @@ private slots: | |||||||
| protected: | protected: | ||||||
| 
 | 
 | ||||||
|     friend SatelliteRadioControlDialog; |     friend SatelliteRadioControlDialog; | ||||||
|     QWidget *m_deviceSetItem; |     QTabWidget *m_tab; | ||||||
|     QComboBox *m_deviceSetWidget; |     QComboBox *m_deviceSetWidget; | ||||||
|     QWidget *m_presetItem; |  | ||||||
|     QComboBox *m_presetWidget; |     QComboBox *m_presetWidget; | ||||||
|     QWidget *m_dopplerItem; |     QListView *m_dopplerWidget; | ||||||
|     QComboBox *m_dopplerWidget; |  | ||||||
|     QWidget *m_startOnAOSItem; |  | ||||||
|     QCheckBox *m_startOnAOSWidget; |     QCheckBox *m_startOnAOSWidget; | ||||||
|     QWidget *m_stopOnLOSItem; |  | ||||||
|     QCheckBox *m_stopOnLOSWidget; |     QCheckBox *m_stopOnLOSWidget; | ||||||
|     QWidget *m_startStopFileSinkItem; |  | ||||||
|     QCheckBox *m_startStopFileSinkWidget; |     QCheckBox *m_startStopFileSinkWidget; | ||||||
|     QTableWidgetItem *m_frequencyItem; |     QLineEdit *m_frequencyWidget; | ||||||
|     QTableWidgetItem *m_aosCommandItem; |     QLineEdit *m_aosCommandWidget; | ||||||
|     QTableWidgetItem *m_losCommandItem; |     QLineEdit *m_losCommandWidget; | ||||||
|     QChar m_currentPresets; |     QChar m_currentPresets; | ||||||
| 
 | 
 | ||||||
|     QStandardItemModel m_dopplerModel; |     QStandardItemModel m_dopplerModel; | ||||||
| @ -78,17 +75,6 @@ protected: | |||||||
| 
 | 
 | ||||||
|     SatelliteTrackerSettings::SatelliteDeviceSettings *m_devSettings; |     SatelliteTrackerSettings::SatelliteDeviceSettings *m_devSettings; | ||||||
| 
 | 
 | ||||||
|     enum SatDeviceCol { |  | ||||||
|         SAT_DEVICE_COL_DEVICESET, |  | ||||||
|         SAT_DEVICE_COL_PRESET, |  | ||||||
|         SAT_DEVICE_COL_DOPPLER, |  | ||||||
|         SAT_DEVICE_COL_START, |  | ||||||
|         SAT_DEVICE_COL_STOP, |  | ||||||
|         SAT_DEVICE_COL_START_FILE_SINK, |  | ||||||
|         SAT_DEVICE_COL_FREQUENCY, |  | ||||||
|         SAT_DEVICE_COL_AOS_COMMAND, |  | ||||||
|         SAT_DEVICE_COL_LOS_COMMAND |  | ||||||
|     }; |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #endif // INCLUDE_FEATURE_SATELLITEDEVICESETTINGSGUI_H
 | #endif // INCLUDE_FEATURE_SATELLITEDEVICESETTINGSGUI_H
 | ||||||
|  | |||||||
| @ -37,13 +37,13 @@ SatelliteRadioControlDialog::SatelliteRadioControlDialog(SatelliteTrackerSetting | |||||||
| { | { | ||||||
|     ui->setupUi(this); |     ui->setupUi(this); | ||||||
| 
 | 
 | ||||||
|     // Must resize before setting m_deviceSettings
 |  | ||||||
|     resizeTable(); |  | ||||||
| 
 |  | ||||||
|     m_deviceSettings = m_settings->m_deviceSettings; |     m_deviceSettings = m_settings->m_deviceSettings; | ||||||
| 
 | 
 | ||||||
|     for (int i = 0; i < settings->m_satellites.size(); i++) |     for (int i = 0; i < settings->m_satellites.size(); i++) { | ||||||
|         ui->satelliteSelect->addItem(settings->m_satellites[i]); |         ui->satelliteSelect->addItem(settings->m_satellites[i]); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(on_tabCloseRequested(int))); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| SatelliteRadioControlDialog::~SatelliteRadioControlDialog() | SatelliteRadioControlDialog::~SatelliteRadioControlDialog() | ||||||
| @ -53,28 +53,22 @@ SatelliteRadioControlDialog::~SatelliteRadioControlDialog() | |||||||
| 
 | 
 | ||||||
| void SatelliteRadioControlDialog::accept() | void SatelliteRadioControlDialog::accept() | ||||||
| { | { | ||||||
|     for (int i = 0; i < m_devSettingsGUIs.size(); i++) |     for (int i = 0; i < m_devSettingsGUIs.size(); i++) { | ||||||
|         m_devSettingsGUIs[i]->accept(); |         m_devSettingsGUIs[i]->accept(); | ||||||
|  |     } | ||||||
|     QDialog::accept(); |     QDialog::accept(); | ||||||
|     m_settings->m_deviceSettings = m_deviceSettings; |     m_settings->m_deviceSettings = m_deviceSettings; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void SatelliteRadioControlDialog::resizeTable() |  | ||||||
| { |  | ||||||
|     on_add_clicked(); |  | ||||||
|     ui->table->resizeColumnsToContents(); |  | ||||||
|     ui->table->selectRow(0); |  | ||||||
|     on_remove_clicked(); |  | ||||||
|     ui->table->selectRow(-1); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void SatelliteRadioControlDialog::on_add_clicked() | void SatelliteRadioControlDialog::on_add_clicked() | ||||||
| { | { | ||||||
|     QString name = ui->satelliteSelect->currentText(); |     QString name = ui->satelliteSelect->currentText(); | ||||||
|     if (!name.isEmpty()) |     if (!name.isEmpty()) | ||||||
|     { |     { | ||||||
|         SatelliteTrackerSettings::SatelliteDeviceSettings *devSettings = new SatelliteTrackerSettings::SatelliteDeviceSettings(); |         SatelliteTrackerSettings::SatelliteDeviceSettings *devSettings = new SatelliteTrackerSettings::SatelliteDeviceSettings(); | ||||||
|         SatelliteDeviceSettingsGUI *devSettingsGUI = new SatelliteDeviceSettingsGUI(devSettings, ui->table); |         SatelliteDeviceSettingsGUI *devSettingsGUI = new SatelliteDeviceSettingsGUI(devSettings, ui->tabWidget, ui->tabWidget); | ||||||
|  |         int index = ui->tabWidget->addTab(devSettingsGUI, "R0"); | ||||||
|  |         ui->tabWidget->setCurrentIndex(index); | ||||||
| 
 | 
 | ||||||
|         m_devSettingsGUIs.append(devSettingsGUI); |         m_devSettingsGUIs.append(devSettingsGUI); | ||||||
|         QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *devSettingsList = m_deviceSettings.value(name); |         QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *devSettingsList = m_deviceSettings.value(name); | ||||||
| @ -82,21 +76,15 @@ void SatelliteRadioControlDialog::on_add_clicked() | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Remove selected row
 | // Remove tab
 | ||||||
| void SatelliteRadioControlDialog::on_remove_clicked() | void SatelliteRadioControlDialog::on_tabCloseRequested(int index) | ||||||
| { | { | ||||||
|     // Selection mode is single, so only a single row should be returned
 |     ui->tabWidget->removeTab(index); | ||||||
|     QModelIndexList indexList = ui->table->selectionModel()->selectedRows(); |     delete m_devSettingsGUIs.takeAt(index); | ||||||
|     if (!indexList.isEmpty()) |  | ||||||
|     { |  | ||||||
|         int row = indexList.at(0).row(); |  | ||||||
|         ui->table->removeRow(row); |  | ||||||
|         delete m_devSettingsGUIs.takeAt(row); |  | ||||||
| 
 | 
 | ||||||
|     QString name = ui->satelliteSelect->currentText(); |     QString name = ui->satelliteSelect->currentText(); | ||||||
|     QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *devSettingsList = m_deviceSettings.value(name); |     QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *devSettingsList = m_deviceSettings.value(name); | ||||||
|         delete devSettingsList->takeAt(row); |     delete devSettingsList->takeAt(index); | ||||||
|     } |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void SatelliteRadioControlDialog::on_satelliteSelect_currentIndexChanged(int index) | void SatelliteRadioControlDialog::on_satelliteSelect_currentIndexChanged(int index) | ||||||
| @ -104,23 +92,26 @@ void SatelliteRadioControlDialog::on_satelliteSelect_currentIndexChanged(int ind | |||||||
|     (void) index; |     (void) index; | ||||||
| 
 | 
 | ||||||
|     // Save details from current GUI elements
 |     // Save details from current GUI elements
 | ||||||
|     for (int i = 0; i < m_devSettingsGUIs.size(); i++) |     for (int i = 0; i < m_devSettingsGUIs.size(); i++) { | ||||||
|         m_devSettingsGUIs[i]->accept(); |         m_devSettingsGUIs[i]->accept(); | ||||||
|  |     } | ||||||
|     // Clear GUI
 |     // Clear GUI
 | ||||||
|     ui->table->setRowCount(0); |     ui->tabWidget->clear(); | ||||||
|     qDeleteAll(m_devSettingsGUIs); |     qDeleteAll(m_devSettingsGUIs); | ||||||
|     m_devSettingsGUIs.clear(); |     m_devSettingsGUIs.clear(); | ||||||
| 
 | 
 | ||||||
|     // Create settings list for newly selected satellite, if one doesn't already exist
 |     // Create settings list for newly selected satellite, if one doesn't already exist
 | ||||||
|     QString name = ui->satelliteSelect->currentText(); |     QString name = ui->satelliteSelect->currentText(); | ||||||
|     if (!m_deviceSettings.contains(name)) |     if (!m_deviceSettings.contains(name)) { | ||||||
|          m_deviceSettings.insert(name, new QList<SatelliteTrackerSettings::SatelliteDeviceSettings *>()); |          m_deviceSettings.insert(name, new QList<SatelliteTrackerSettings::SatelliteDeviceSettings *>()); | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     // Add existing settings to GUI
 |     // Add existing settings to GUI
 | ||||||
|     QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *devSettingsList = m_deviceSettings.value(name); |     QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *devSettingsList = m_deviceSettings.value(name); | ||||||
|     for (int i = 0; i < devSettingsList->size(); i++) |     for (int i = 0; i < devSettingsList->size(); i++) | ||||||
|     { |     { | ||||||
|         SatelliteDeviceSettingsGUI *devSettingsGUI = new SatelliteDeviceSettingsGUI(devSettingsList->at(i), ui->table); |         SatelliteDeviceSettingsGUI *devSettingsGUI = new SatelliteDeviceSettingsGUI(devSettingsList->at(i), ui->tabWidget, ui->tabWidget); | ||||||
|  |         ui->tabWidget->addTab(devSettingsGUI, devSettingsList->at(i)->m_deviceSet); | ||||||
|         m_devSettingsGUIs.append(devSettingsGUI); |         m_devSettingsGUIs.append(devSettingsGUI); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -35,12 +35,11 @@ public: | |||||||
|    SatelliteTrackerSettings *m_settings; |    SatelliteTrackerSettings *m_settings; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     void resizeTable(); |  | ||||||
| 
 | 
 | ||||||
| private slots: | private slots: | ||||||
|     void accept(); |     void accept(); | ||||||
|     void on_add_clicked(); |     void on_add_clicked(); | ||||||
|     void on_remove_clicked(); |     void on_tabCloseRequested(int index); | ||||||
|     void on_satelliteSelect_currentIndexChanged(int index); |     void on_satelliteSelect_currentIndexChanged(int index); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|  | |||||||
| @ -7,7 +7,7 @@ | |||||||
|     <x>0</x> |     <x>0</x> | ||||||
|     <y>0</y> |     <y>0</y> | ||||||
|     <width>955</width> |     <width>955</width> | ||||||
|     <height>400</height> |     <height>771</height> | ||||||
|    </rect> |    </rect> | ||||||
|   </property> |   </property> | ||||||
|   <property name="font"> |   <property name="font"> | ||||||
| @ -26,98 +26,15 @@ | |||||||
|    <item> |    <item> | ||||||
|     <widget class="QGroupBox" name="groupBox"> |     <widget class="QGroupBox" name="groupBox"> | ||||||
|      <layout class="QGridLayout" name="gridLayout"> |      <layout class="QGridLayout" name="gridLayout"> | ||||||
|       <item row="5" column="0"> |       <item row="7" column="0"> | ||||||
|        <widget class="QTableWidget" name="table"> |        <widget class="QLabel" name="satelliteModesLabel"> | ||||||
|         <property name="selectionMode"> |  | ||||||
|          <enum>QAbstractItemView::SingleSelection</enum> |  | ||||||
|         </property> |  | ||||||
|         <property name="selectionBehavior"> |  | ||||||
|          <enum>QAbstractItemView::SelectRows</enum> |  | ||||||
|         </property> |  | ||||||
|         <column> |  | ||||||
|         <property name="text"> |         <property name="text"> | ||||||
|           <string>Device set</string> |          <string>Satellite modes</string> | ||||||
|         </property> |         </property> | ||||||
|          <property name="toolTip"> |  | ||||||
|           <string>Device set to control</string> |  | ||||||
|          </property> |  | ||||||
|         </column> |  | ||||||
|         <column> |  | ||||||
|          <property name="text"> |  | ||||||
|           <string>Preset to load on AOS</string> |  | ||||||
|          </property> |  | ||||||
|          <property name="toolTip"> |  | ||||||
|           <string>Preset to load to device set</string> |  | ||||||
|          </property> |  | ||||||
|         </column> |  | ||||||
|         <column> |  | ||||||
|          <property name="text"> |  | ||||||
|           <string>Doppler correction</string> |  | ||||||
|          </property> |  | ||||||
|          <property name="toolTip"> |  | ||||||
|           <string>Channel numbers that will have Doppler correction applied</string> |  | ||||||
|          </property> |  | ||||||
|         </column> |  | ||||||
|         <column> |  | ||||||
|          <property name="text"> |  | ||||||
|           <string>Start on AOS</string> |  | ||||||
|          </property> |  | ||||||
|          <property name="toolTip"> |  | ||||||
|           <string>Start acquisition on AOS</string> |  | ||||||
|          </property> |  | ||||||
|         </column> |  | ||||||
|         <column> |  | ||||||
|          <property name="text"> |  | ||||||
|           <string>Stop on LOS</string> |  | ||||||
|          </property> |  | ||||||
|          <property name="toolTip"> |  | ||||||
|           <string>Stop acquisition on LOS</string> |  | ||||||
|          </property> |  | ||||||
|         </column> |  | ||||||
|         <column> |  | ||||||
|          <property name="text"> |  | ||||||
|           <string>Start/stop file sinks</string> |  | ||||||
|          </property> |  | ||||||
|          <property name="toolTip"> |  | ||||||
|           <string>Start file sinks recording on AOS and stop recording on LOS</string> |  | ||||||
|          </property> |  | ||||||
|         </column> |  | ||||||
|         <column> |  | ||||||
|          <property name="text"> |  | ||||||
|           <string>Override frequency (MHz)</string> |  | ||||||
|          </property> |  | ||||||
|          <property name="toolTip"> |  | ||||||
|           <string>Override the center frequency in the preset with a value specified here in MHz. |  | ||||||
| This allows a single preset to be shared between different satellites that differ only in frequency.</string> |  | ||||||
|          </property> |  | ||||||
|         </column> |  | ||||||
|         <column> |  | ||||||
|          <property name="text"> |  | ||||||
|           <string>AOS command</string> |  | ||||||
|          </property> |  | ||||||
|          <property name="toolTip"> |  | ||||||
|           <string>Command to execute on AOS</string> |  | ||||||
|          </property> |  | ||||||
|         </column> |  | ||||||
|         <column> |  | ||||||
|          <property name="text"> |  | ||||||
|           <string>LOS command</string> |  | ||||||
|          </property> |  | ||||||
|          <property name="toolTip"> |  | ||||||
|           <string>Command to execute on LOS</string> |  | ||||||
|          </property> |  | ||||||
|         </column> |  | ||||||
|        </widget> |        </widget> | ||||||
|       </item> |       </item> | ||||||
|       <item row="8" column="0"> |       <item row="5" column="0"> | ||||||
|        <widget class="QTextEdit" name="satelliteModes"> |        <layout class="QHBoxLayout" name="buttonsHorizontalLayout"/> | ||||||
|         <property name="toolTip"> |  | ||||||
|          <string>Satellite modes from SatNOGS</string> |  | ||||||
|         </property> |  | ||||||
|         <property name="readOnly"> |  | ||||||
|          <bool>true</bool> |  | ||||||
|         </property> |  | ||||||
|        </widget> |  | ||||||
|       </item> |       </item> | ||||||
|       <item row="1" column="0"> |       <item row="1" column="0"> | ||||||
|        <layout class="QHBoxLayout" name="satHorizontalLayout"> |        <layout class="QHBoxLayout" name="satHorizontalLayout"> | ||||||
| @ -138,6 +55,16 @@ This allows a single preset to be shared between different satellites that diffe | |||||||
|           </property> |           </property> | ||||||
|          </widget> |          </widget> | ||||||
|         </item> |         </item> | ||||||
|  |         <item> | ||||||
|  |          <widget class="QPushButton" name="add"> | ||||||
|  |           <property name="toolTip"> | ||||||
|  |            <string>Add device set control settings tab</string> | ||||||
|  |           </property> | ||||||
|  |           <property name="text"> | ||||||
|  |            <string>Add device set</string> | ||||||
|  |           </property> | ||||||
|  |          </widget> | ||||||
|  |         </item> | ||||||
|         <item> |         <item> | ||||||
|          <spacer name="satHorizontalSpacer"> |          <spacer name="satHorizontalSpacer"> | ||||||
|           <property name="orientation"> |           <property name="orientation"> | ||||||
| @ -153,47 +80,23 @@ This allows a single preset to be shared between different satellites that diffe | |||||||
|         </item> |         </item> | ||||||
|        </layout> |        </layout> | ||||||
|       </item> |       </item> | ||||||
|       <item row="6" column="0"> |       <item row="8" column="0"> | ||||||
|        <layout class="QHBoxLayout" name="buttonsHorizontalLayout"> |        <widget class="QTextEdit" name="satelliteModes"> | ||||||
|         <item> |  | ||||||
|          <widget class="QPushButton" name="add"> |  | ||||||
|         <property name="toolTip"> |         <property name="toolTip"> | ||||||
|            <string>Add device set control</string> |          <string>Satellite modes from SatNOGS</string> | ||||||
|         </property> |         </property> | ||||||
|           <property name="text"> |         <property name="readOnly"> | ||||||
|            <string>+</string> |          <bool>true</bool> | ||||||
|         </property> |         </property> | ||||||
|        </widget> |        </widget> | ||||||
|       </item> |       </item> | ||||||
|         <item> |       <item row="2" column="0"> | ||||||
|          <widget class="QPushButton" name="remove"> |        <widget class="QTabWidget" name="tabWidget"> | ||||||
|           <property name="toolTip"> |         <property name="currentIndex"> | ||||||
|            <string>Remove device set control</string> |          <number>-1</number> | ||||||
|         </property> |         </property> | ||||||
|           <property name="text"> |         <property name="tabsClosable"> | ||||||
|            <string>-</string> |          <bool>true</bool> | ||||||
|           </property> |  | ||||||
|          </widget> |  | ||||||
|         </item> |  | ||||||
|         <item> |  | ||||||
|          <spacer name="buttonsHorizontalSpacer"> |  | ||||||
|           <property name="orientation"> |  | ||||||
|            <enum>Qt::Horizontal</enum> |  | ||||||
|           </property> |  | ||||||
|           <property name="sizeHint" stdset="0"> |  | ||||||
|            <size> |  | ||||||
|             <width>40</width> |  | ||||||
|             <height>20</height> |  | ||||||
|            </size> |  | ||||||
|           </property> |  | ||||||
|          </spacer> |  | ||||||
|         </item> |  | ||||||
|        </layout> |  | ||||||
|       </item> |  | ||||||
|       <item row="7" column="0"> |  | ||||||
|        <widget class="QLabel" name="satelliteModesLabel"> |  | ||||||
|         <property name="text"> |  | ||||||
|          <string>Satellite modes</string> |  | ||||||
|         </property> |         </property> | ||||||
|        </widget> |        </widget> | ||||||
|       </item> |       </item> | ||||||
| @ -214,9 +117,6 @@ This allows a single preset to be shared between different satellites that diffe | |||||||
|  </widget> |  </widget> | ||||||
|  <tabstops> |  <tabstops> | ||||||
|   <tabstop>satelliteSelect</tabstop> |   <tabstop>satelliteSelect</tabstop> | ||||||
|   <tabstop>table</tabstop> |  | ||||||
|   <tabstop>add</tabstop> |  | ||||||
|   <tabstop>remove</tabstop> |  | ||||||
|   <tabstop>satelliteModes</tabstop> |   <tabstop>satelliteModes</tabstop> | ||||||
|  </tabstops> |  </tabstops> | ||||||
|  <resources> |  <resources> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user