| 142 | } |
| 143 | |
| 144 | QString buildTnfTooltip(const TnfModel& tnfModel) |
| 145 | { |
| 146 | QString html = QStringLiteral( |
| 147 | "<html><body style='white-space:nowrap;'>" |
| 148 | "<div style='font-size:10pt; font-weight:600; color:#c8d8e8; margin-bottom:5px;'>" |
| 149 | "Tracking Notch Filters — click to toggle" |
| 150 | "</div>"); |
| 151 | |
| 152 | if (tnfModel.tnfs().isEmpty()) { |
| 153 | html += QStringLiteral( |
| 154 | "<div style='color:#8aa8c0;'>No TNF filters exist.</div>" |
| 155 | "</body></html>"); |
| 156 | return html; |
| 157 | } |
| 158 | |
| 159 | QVector<TnfEntry> filters; |
| 160 | filters.reserve(tnfModel.tnfs().size()); |
| 161 | for (const TnfEntry& tnf : tnfModel.tnfs()) { |
| 162 | filters.append(tnf); |
| 163 | } |
| 164 | std::sort(filters.begin(), filters.end(), [](const TnfEntry& lhs, const TnfEntry& rhs) { |
| 165 | const long long lhsHz = tnfFrequencyHz(lhs.freqMhz); |
| 166 | const long long rhsHz = tnfFrequencyHz(rhs.freqMhz); |
| 167 | if (lhsHz != rhsHz) { |
| 168 | return lhsHz < rhsHz; |
| 169 | } |
| 170 | return lhs.id < rhs.id; |
| 171 | }); |
| 172 | |
| 173 | html += QStringLiteral( |
| 174 | "<table cellspacing='0' cellpadding='3'>" |
| 175 | "<tr style='color:#8aa8c0; font-size:8pt;'>" |
| 176 | "<th align='left'>Band</th>" |
| 177 | "<th align='left'>Frequency</th>" |
| 178 | "<th align='right'>Width</th>" |
| 179 | "<th align='left'>Depth</th>" |
| 180 | "<th align='left'>State</th>" |
| 181 | "</tr>"); |
| 182 | |
| 183 | for (const TnfEntry& tnf : filters) { |
| 184 | const QString band = BandSettings::bandForFrequency(tnf.freqMhz).toHtmlEscaped(); |
| 185 | const QString frequency = formatTnfFrequency(tnf.freqMhz).toHtmlEscaped(); |
| 186 | const QString width = QStringLiteral("%1 Hz").arg(tnf.widthHz).toHtmlEscaped(); |
| 187 | const QString depth = formatTnfDepth(tnf.depthDb).toHtmlEscaped(); |
| 188 | const QString state = tnf.permanent |
| 189 | ? QStringLiteral("Persistent") |
| 190 | : QStringLiteral("Temporary"); |
| 191 | const QString stateColor = tnf.permanent |
| 192 | ? QStringLiteral("#30c030") |
| 193 | : QStringLiteral("#ffc000"); |
| 194 | |
| 195 | html += QStringLiteral( |
| 196 | "<tr>" |
| 197 | "<td style='color:#c8d8e8;'>%1</td>" |
| 198 | "<td style='color:#c8d8e8;'>%2 MHz</td>" |
| 199 | "<td align='right' style='color:#c8d8e8;'>%3</td>" |
| 200 | "<td style='color:#c8d8e8;'>%4</td>" |
| 201 | "<td style='color:%5;'>● %6</td>" |
no test coverage detected