1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Merge pull request #1492 from srcejon/fix_1474

Satellite tracker settings
This commit is contained in:
Edouard Griffiths 2022-10-28 18:34:57 +02:00 committed by GitHub
commit 1e1434e1a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 4 deletions

View File

@ -76,7 +76,6 @@ bool SatelliteTrackerGUI::deserialize(const QByteArray& data)
m_feature->setWorkspaceIndex(m_settings.m_workspaceIndex);
updateSelectedSats();
displaySettings();
qDebug() << " deserialize " << m_settings.m_satellites;
applySettings(true);
return true;
}
@ -348,18 +347,21 @@ void SatelliteTrackerGUI::displaySettings()
blockApplySettings(true);
ui->latitude->setValue(m_settings.m_latitude);
ui->longitude->setValue(m_settings.m_longitude);
ui->target->clear();
ui->target->blockSignals(true);
ui->target->clear();
for (const QString& s : m_settings.m_satellites) {
ui->target->addItem(s);
}
ui->target->blockSignals(false);
ui->target->setCurrentIndex(ui->target->findText(m_settings.m_target));
ui->dateTimeSelect->setCurrentIndex((int)m_settings.m_dateTimeSelect);
ui->dateTime->setVisible(m_settings.m_dateTimeSelect == SatelliteTrackerSettings::CUSTOM);
ui->dateTime->setDateTime(QDateTime::fromString(m_settings.m_dateTime, Qt::ISODateWithMs));
ui->autoTarget->setChecked(m_settings.m_autoTarget);
ui->darkTheme->setChecked(m_settings.m_chartsDarkTheme);
ui->satTable->horizontalHeader()->setSortIndicator(m_settings.m_columnSort, m_settings.m_columnSortOrder);
getRollupContents()->restoreState(m_rollupState);
plotChart();
blockApplySettings(false);
@ -1204,7 +1206,13 @@ void SatelliteTrackerGUI::on_satTable_cellDoubleClicked(int row, int column)
QString sat = ui->satTable->item(row, SAT_COL_NAME)->text();
FeatureWebAPIUtils::mapFind(sat);
}
void SatelliteTrackerGUI::on_satTableHeader_sortIndicatorChanged(int logicalIndex, Qt::SortOrder order)
{
m_settings.m_columnSort = logicalIndex;
m_settings.m_columnSortOrder = order;
applySettings();
}
// Columns in table reordered
@ -1347,5 +1355,6 @@ void SatelliteTrackerGUI::makeUIConnections()
QObject::connect(ui->prevPass, &QToolButton::clicked, this, &SatelliteTrackerGUI::on_prevPass_clicked);
QObject::connect(ui->darkTheme, &QToolButton::clicked, this, &SatelliteTrackerGUI::on_darkTheme_clicked);
QObject::connect(ui->satTable, &QTableWidget::cellDoubleClicked, this, &SatelliteTrackerGUI::on_satTable_cellDoubleClicked);
QObject::connect(ui->satTable->horizontalHeader(), &QHeaderView::sortIndicatorChanged, this, &SatelliteTrackerGUI::on_satTableHeader_sortIndicatorChanged);
QObject::connect(ui->deviceFeatureSelect, qOverload<int>(&QComboBox::currentIndexChanged), this, &SatelliteTrackerGUI::on_deviceFeatureSelect_currentIndexChanged);
}

View File

@ -161,6 +161,7 @@ private slots:
void on_satTable_cellDoubleClicked(int row, int column);
void satTable_sectionMoved(int logicalIndex, int oldVisualIndex, int newVisualIndex);
void satTable_sectionResized(int logicalIndex, int oldSize, int newSize);
void on_satTableHeader_sortIndicatorChanged(int logicalIndex, Qt::SortOrder order);
void columnSelectMenu(QPoint pos);
void columnSelectMenuChecked(bool checked = false);
void on_deviceFeatureSelect_currentIndexChanged(int index);

View File

@ -79,7 +79,8 @@ void SatelliteTrackerSettings::resetToDefaults()
m_mapFeature = "";
m_fileInputDevice = "";
m_workspaceIndex = 0;
m_columnSort = -1;
m_columnSortOrder = Qt::AscendingOrder;
for (int i = 0; i < SAT_COL_COLUMNS; i++)
{
m_columnIndexes[i] = i;
@ -138,6 +139,8 @@ QByteArray SatelliteTrackerSettings::serialize() const
s.writeString(44, m_fileInputDevice);
s.writeS32(45, m_workspaceIndex);
s.writeBlob(46, m_geometryBytes);
s.writeS32(47, m_columnSort);
s.writeS32(48, (int)m_columnSortOrder);
for (int i = 0; i < SAT_COL_COLUMNS; i++) {
s.writeS32(100 + i, m_columnIndexes[i]);
@ -231,6 +234,8 @@ bool SatelliteTrackerSettings::deserialize(const QByteArray& data)
d.readString(44, &m_fileInputDevice, "");
d.readS32(45, &m_workspaceIndex, 0);
d.readBlob(46, &m_geometryBytes);
d.readS32(47, &m_columnSort, -1);
d.readS32(48, (int *)&m_columnSortOrder, (int)Qt::AscendingOrder);
for (int i = 0; i < SAT_COL_COLUMNS; i++) {
d.readS32(100 + i, &m_columnIndexes[i], i);

View File

@ -83,6 +83,8 @@ struct SatelliteTrackerSettings
QString m_mapFeature; //!< Which feature when FROM_MAP
QString m_fileInputDevice; //!< Which device when FROM_FILE
int m_columnSort; //!< Which column is used for sorting (-1 for none)
Qt::SortOrder m_columnSortOrder;
int m_columnIndexes[SAT_COL_COLUMNS];//!< How the columns are ordered in the table
int m_columnSizes[SAT_COL_COLUMNS]; //!< Size of the coumns in the table