Skip to content

Commit

Permalink
remove the frequency dependent visualization effects from the spots t…
Browse files Browse the repository at this point in the history
…able to mitigate performance issues
  • Loading branch information
ftl committed May 29, 2024
1 parent 2b3b81d commit 7735955
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
10 changes: 9 additions & 1 deletion core/bandmap/bandmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

const (
// DefaultUpdatePeriod: the bandmap is updated with this period
DefaultUpdatePeriod time.Duration = 1 * time.Second
DefaultUpdatePeriod time.Duration = 5 * time.Second
// DefaultMaximumAge of entries in the bandmap
// entries that were not seen within this period are removed from the bandmap
DefaultMaximumAge time.Duration = 10 * time.Minute
Expand Down Expand Up @@ -197,6 +197,10 @@ func (m *Bandmap) VFOFrequencyChanged(frequency core.Frequency) {

func (m *Bandmap) VFOBandChanged(band core.Band) {
m.do <- func() {
if band == m.activeBand {
return
}

if m.activeBand == m.visibleBand {
m.visibleBand = band
}
Expand All @@ -207,6 +211,10 @@ func (m *Bandmap) VFOBandChanged(band core.Band) {

func (m *Bandmap) VFOModeChanged(mode core.Mode) {
m.do <- func() {
if m.activeMode == mode {
return
}

m.activeMode = mode
m.update()
}
Expand Down
29 changes: 8 additions & 21 deletions ui/spotsTableView.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ui
import (
"fmt"
"log"
"math"
"strings"
"time"

Expand Down Expand Up @@ -149,8 +148,8 @@ func (v *spotsView) fillEntryToTableRow(row *gtk.TreeIter, entry core.BandmapEnt
spotColumnBackground,
},
[]any{
formatSpotFrequency(entry.Frequency, entry.ProximityFactor(v.currentFrame.Frequency), entry.OnFrequency(v.currentFrame.Frequency)),
formatSpotCall(entry.Call, entry.ProximityFactor(v.currentFrame.Frequency), entry.OnFrequency(v.currentFrame.Frequency)),
formatSpotFrequency(entry.Frequency),
formatSpotCall(entry.Call),
entry.Quality.Tag(),
entry.Info.ExchangeText,
formatPoints(entry.Info.Points, entry.Info.Duplicate, 1),
Expand All @@ -165,24 +164,12 @@ func (v *spotsView) fillEntryToTableRow(row *gtk.TreeIter, entry core.BandmapEnt
)
}

func formatSpotFrequency(frequency core.Frequency, proximity float64, onFrequency bool) string {
size := 100 + math.Abs(proximity)*30
result := fmt.Sprintf("<span size=\"%.0f%%\">%.2f kHz</span>", size, frequency/1000)
if onFrequency {
return fmt.Sprintf("<b>%s</b>", result)
}

return result
func formatSpotFrequency(frequency core.Frequency) string {
return fmt.Sprintf("%.2f kHz", frequency/1000)
}

func formatSpotCall(call callsign.Callsign, proximity float64, onFrequency bool) string {
size := 100 + math.Abs(proximity)*30
result := fmt.Sprintf("<span size=\"%.0f%%\">%s</span>", size, call)
if onFrequency {
return fmt.Sprintf("<b>%s</b>", result)
}

return result
func formatSpotCall(call callsign.Callsign) string {
return call.String()
}

func formatPoints(value int, duplicate bool, threshold int) string {
Expand Down Expand Up @@ -238,8 +225,8 @@ func (v *spotsView) updateHighlightedColumns(entry core.BandmapEntry) error {
spotColumnWeightedValue,
},
[]any{
formatSpotFrequency(entry.Frequency, entry.ProximityFactor(v.currentFrame.Frequency), entry.OnFrequency(v.currentFrame.Frequency)),
formatSpotCall(entry.Call, entry.ProximityFactor(v.currentFrame.Frequency), entry.OnFrequency(v.currentFrame.Frequency)),
formatSpotFrequency(entry.Frequency),
formatSpotCall(entry.Call),
entry.Quality.Tag(),
formatSpotAge(entry.LastHeard),
fmt.Sprintf("%.1f", entry.Info.WeightedValue),
Expand Down

0 comments on commit 7735955

Please sign in to comment.