| 7145 | } |
| 7146 | |
| 7147 | void SpectrumWidget::showAddSpotDialog(double freqMhz) |
| 7148 | { |
| 7149 | // Snap to step size |
| 7150 | if (m_stepHz > 0) { |
| 7151 | const double stepMhz = m_stepHz / 1e6; |
| 7152 | freqMhz = std::round(freqMhz / stepMhz) * stepMhz; |
| 7153 | } |
| 7154 | auto& as = AppSettings::instance(); |
| 7155 | QDialog dlg(this); |
| 7156 | dlg.setWindowTitle("Add Spot"); |
| 7157 | AetherSDR::ThemeManager::instance().applyStyleSheet(&dlg, "QDialog { background: {{color.background.0}}; color: {{color.text.primary}}; }" |
| 7158 | "QLineEdit { background: {{color.background.0}}; color: {{color.text.primary}}; border: 1px solid #304060; padding: 4px; }" |
| 7159 | "QDoubleSpinBox { background: {{color.background.0}}; color: {{color.text.primary}}; border: 1px solid #304060; padding: 4px; }" |
| 7160 | "QDoubleSpinBox::up-button { background: #304060; width: 16px; }" |
| 7161 | "QDoubleSpinBox::down-button { background: #304060; width: 16px; }" |
| 7162 | "QComboBox { background: {{color.background.0}}; color: {{color.text.primary}}; border: 1px solid #304060; padding: 4px; }" |
| 7163 | "QLabel { color: {{color.text.primary}}; }" |
| 7164 | "QCheckBox { color: {{color.text.primary}}; }"); |
| 7165 | |
| 7166 | auto* layout = new QFormLayout(&dlg); |
| 7167 | |
| 7168 | auto* freqSpin = new QDoubleSpinBox; |
| 7169 | freqSpin->setRange(0.030, 50000.000); // 50 GHz cap matches VfoWidget convention |
| 7170 | freqSpin->setDecimals(6); |
| 7171 | freqSpin->setSingleStep(m_stepHz > 0 ? m_stepHz / 1e6 : 0.001); |
| 7172 | freqSpin->setSuffix(" MHz"); |
| 7173 | freqSpin->setValue(freqMhz); |
| 7174 | freqSpin->setAlignment(Qt::AlignRight); |
| 7175 | layout->addRow("Frequency (MHz):", freqSpin); |
| 7176 | |
| 7177 | auto* callEdit = new QLineEdit; |
| 7178 | callEdit->setPlaceholderText("Callsign (required)"); |
| 7179 | layout->addRow("Callsign:", callEdit); |
| 7180 | |
| 7181 | auto* commentEdit = new QLineEdit; |
| 7182 | commentEdit->setPlaceholderText("Optional comment"); |
| 7183 | layout->addRow("Comment:", commentEdit); |
| 7184 | |
| 7185 | auto* lifetimeCombo = new QComboBox; |
| 7186 | lifetimeCombo->addItem("5 minutes", 300); |
| 7187 | lifetimeCombo->addItem("15 minutes", 900); |
| 7188 | lifetimeCombo->addItem("30 minutes", 1800); |
| 7189 | lifetimeCombo->addItem("1 hour", 3600); |
| 7190 | lifetimeCombo->addItem("2 hours", 7200); |
| 7191 | int defaultLifetime = as.value("ManualSpotLifetime", 1800).toInt(); |
| 7192 | for (int i = 0; i < lifetimeCombo->count(); ++i) { |
| 7193 | if (lifetimeCombo->itemData(i).toInt() == defaultLifetime) { |
| 7194 | lifetimeCombo->setCurrentIndex(i); |
| 7195 | break; |
| 7196 | } |
| 7197 | } |
| 7198 | layout->addRow("Lifetime:", lifetimeCombo); |
| 7199 | |
| 7200 | auto* forwardCheck = new QCheckBox("Forward to DX Cluster"); |
| 7201 | forwardCheck->setChecked(as.value("SpotForwardToCluster", "False").toString() == "True"); |
| 7202 | layout->addRow("", forwardCheck); |
| 7203 | |
| 7204 | auto* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); |
no test coverage detected