diff --git a/sdrbase/mainwindow.cpp b/sdrbase/mainwindow.cpp index 38afbfa10..c40dab525 100644 --- a/sdrbase/mainwindow.cpp +++ b/sdrbase/mainwindow.cpp @@ -397,12 +397,14 @@ QTreeWidgetItem* MainWindow::addPresetToTree(const Preset* preset) } QStringList sl; - sl.append(QString("%1 kHz").arg(preset->getCenterFrequency() / 1000)); - sl.append(preset->getDescription()); + sl.append(QString("%1").arg(preset->getCenterFrequency() / 1e6f, 0, 'f', 3)); // frequency column + sl.append(QString("%1").arg(preset->isSourcePreset() ? 'R' : 'T')); // mode column + sl.append(preset->getDescription()); // description column PresetItem* item = new PresetItem(group, sl, preset->getCenterFrequency(), PItem); item->setTextAlignment(0, Qt::AlignRight); item->setData(0, Qt::UserRole, qVariantFromValue(preset)); - ui->presetTree->resizeColumnToContents(0); + ui->presetTree->resizeColumnToContents(0); // Resize frequency column to minimum + ui->presetTree->resizeColumnToContents(1); // Resize mode column to minimum updatePresetControls(); return item; diff --git a/sdrbase/mainwindow.ui b/sdrbase/mainwindow.ui index 5dc56225c..03dc2dc22 100644 --- a/sdrbase/mainwindow.ui +++ b/sdrbase/mainwindow.ui @@ -244,12 +244,29 @@ + + 10 + true + + 5 + - Frequency + Freq (MHz) + + + Center frequency in MHz + + + + + M + + + Mode: R: Rx or source, T: Tx or sink diff --git a/sdrbase/settings/preset.cpp b/sdrbase/settings/preset.cpp index 08526745d..105d77f9a 100644 --- a/sdrbase/settings/preset.cpp +++ b/sdrbase/settings/preset.cpp @@ -24,8 +24,9 @@ void Preset::resetToDefaults() QByteArray Preset::serialize() const { - qDebug("Preset::serialize: m_group: %s m_description: %s m_centerFrequency: %llu", + qDebug("Preset::serialize: m_group: %s mode: %s m_description: %s m_centerFrequency: %llu", qPrintable(m_group), + m_sourcePreset ? "Rx" : "Tx", qPrintable(m_description), m_centerFrequency); @@ -36,6 +37,7 @@ QByteArray Preset::serialize() const s.writeU64(3, m_centerFrequency); s.writeBlob(4, m_layout); s.writeBlob(5, m_spectrumConfig); + s.writeBool(6, m_sourcePreset); s.writeS32(20, m_deviceConfigs.size()); @@ -87,9 +89,11 @@ bool Preset::deserialize(const QByteArray& data) d.readU64(3, &m_centerFrequency, 0); d.readBlob(4, &m_layout); d.readBlob(5, &m_spectrumConfig); + d.readBool(6, &m_sourcePreset, true); - qDebug("Preset::deserialize: m_group: %s m_description: %s m_centerFrequency: %llu", + qDebug("Preset::deserialize: m_group: %s mode: %s m_description: %s m_centerFrequency: %llu", qPrintable(m_group), + m_sourcePreset ? "Rx" : "Tx", qPrintable(m_description), m_centerFrequency);