Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d13cf7d15 | ||
|
|
366d9df634 | ||
|
|
f4b7c9dcf8 | ||
|
|
48c448e6f3 | ||
|
|
9c757e5175 | ||
|
|
626edca8ba | ||
|
|
b202d98ae5 | ||
|
|
949cc17ed1 | ||
|
|
e9feeffdc3 | ||
|
|
7d7d1042c0 | ||
|
|
9cbfd39da0 | ||
|
|
5338ad0b29 | ||
|
|
970127cc16 |
@@ -291,11 +291,13 @@ const (
|
|||||||
|
|
||||||
keyScpEnabled = "scp.enabled" // Super Check Partial / N+1 suggestions on
|
keyScpEnabled = "scp.enabled" // Super Check Partial / N+1 suggestions on
|
||||||
|
|
||||||
keyBackupEnabled = "backup.enabled"
|
keyBackupEnabled = "backup.enabled"
|
||||||
keyBackupFolder = "backup.folder"
|
keyBackupFolder = "backup.folder"
|
||||||
keyBackupRotation = "backup.rotation"
|
keyBackupRotation = "backup.rotation"
|
||||||
keyBackupZip = "backup.zip"
|
keyBackupZip = "backup.zip"
|
||||||
keyBackupLast = "backup.last_at"
|
keyBackupEveryExit = "backup.every_exit" // "1" → back up on every quit, not just once/day
|
||||||
|
keyBackupKeepAll = "backup.keep_all" // "1" → each backup is a distinct time-stamped file (no same-day overwrite)
|
||||||
|
keyBackupLast = "backup.last_at"
|
||||||
|
|
||||||
keyQSLDefaultQSLSent = "qsl.qsl_sent"
|
keyQSLDefaultQSLSent = "qsl.qsl_sent"
|
||||||
keyQSLDefaultQSLRcvd = "qsl.qsl_rcvd"
|
keyQSLDefaultQSLRcvd = "qsl.qsl_rcvd"
|
||||||
@@ -569,8 +571,8 @@ type App struct {
|
|||||||
// wcbm is an in-memory "CALL|BAND|MODE" worked-index so the alert engine never
|
// wcbm is an in-memory "CALL|BAND|MODE" worked-index so the alert engine never
|
||||||
// queries the DB per cluster spot (an FT8 firehose would swamp a remote MySQL).
|
// queries the DB per cluster spot (an FT8 firehose would swamp a remote MySQL).
|
||||||
// Loaded once, appended to on each log, rebuilt after bulk changes.
|
// Loaded once, appended to on each log, rebuilt after bulk changes.
|
||||||
wcbm map[string]struct{}
|
wcbm map[string]struct{}
|
||||||
wcbmMu sync.RWMutex
|
wcbmMu sync.RWMutex
|
||||||
// clusterStatusIdx caches the whole-logbook maps ClusterSpotStatuses colours
|
// clusterStatusIdx caches the whole-logbook maps ClusterSpotStatuses colours
|
||||||
// spots against (worked entities/calls/counties/POTA/prefixes). Building them
|
// spots against (worked entities/calls/counties/POTA/prefixes). Building them
|
||||||
// per spot batch re-scanned the entire logbook ~20×/second under an RBN
|
// per spot batch re-scanned the entire logbook ~20×/second under an RBN
|
||||||
@@ -580,30 +582,30 @@ type App struct {
|
|||||||
clusterStatusIdx *clusterStatusCache
|
clusterStatusIdx *clusterStatusCache
|
||||||
clusterStatusMu sync.Mutex
|
clusterStatusMu sync.Mutex
|
||||||
pota *pota.Cache
|
pota *pota.Cache
|
||||||
uls *uls.Store // US callsign→county/grid (offline FCC ULS), lazily opened
|
uls *uls.Store // US callsign→county/grid (offline FCC ULS), lazily opened
|
||||||
awardRefs *awardref.Repo
|
awardRefs *awardref.Repo
|
||||||
qslTemplates *qslcard.Repo
|
qslTemplates *qslcard.Repo
|
||||||
operating *operating.Repo
|
operating *operating.Repo
|
||||||
udp *udp.Manager
|
udp *udp.Manager
|
||||||
udpRepo *udp.Repo
|
udpRepo *udp.Repo
|
||||||
extsvc *extsvc.Manager
|
extsvc *extsvc.Manager
|
||||||
winkeyer *winkeyer.Manager
|
winkeyer *winkeyer.Manager
|
||||||
clublog *clublog.Manager
|
clublog *clublog.Manager
|
||||||
clublogMW *clublog.MostWanted // ClubLog "Most Wanted" DXCC ranking (opt-in)
|
clublogMW *clublog.MostWanted // ClubLog "Most Wanted" DXCC ranking (opt-in)
|
||||||
motorAnt motorAntenna // motorized antenna (Ultrabeam or SteppIR); nil when disabled
|
motorAnt motorAntenna // motorized antenna (Ultrabeam or SteppIR); nil when disabled
|
||||||
ubFollowStop chan struct{} // stops the "follow frequency" loop; nil when off
|
ubFollowStop chan struct{} // stops the "follow frequency" loop; nil when off
|
||||||
motorInhibStop chan struct{} // stops the "inhibit TX while moving" loop; nil when off
|
motorInhibStop chan struct{} // stops the "inhibit TX while moving" loop; nil when off
|
||||||
motorMoveCmdNs atomic.Int64 // unixnano of the last commanded antenna move (grace window)
|
motorMoveCmdNs atomic.Int64 // unixnano of the last commanded antenna move (grace window)
|
||||||
motorInhibited atomic.Bool // TX currently inhibited by the motor-antenna watcher
|
motorInhibited atomic.Bool // TX currently inhibited by the motor-antenna watcher
|
||||||
antgenius *antgenius.Client // Antenna Genius (4O3A) switch (TCP); nil when disabled
|
antgenius *antgenius.Client // Antenna Genius (4O3A) switch (TCP); nil when disabled
|
||||||
tunergenius *tunergenius.Client // Tuner Genius XL (4O3A) ATU (TCP); nil when disabled
|
tunergenius *tunergenius.Client // Tuner Genius XL (4O3A) ATU (TCP); nil when disabled
|
||||||
pgxl *powergenius.Client // PowerGenius XL (4O3A) amp fan control (TCP); nil when disabled
|
pgxl *powergenius.Client // PowerGenius XL (4O3A) amp fan control (TCP); nil when disabled
|
||||||
spe *spe.Client // legacy pointer: FIRST enabled SPE amp (kept for the pre-multi bindings)
|
spe *spe.Client // legacy pointer: FIRST enabled SPE amp (kept for the pre-multi bindings)
|
||||||
acom *acom.Client // legacy pointer: FIRST enabled ACOM amp
|
acom *acom.Client // legacy pointer: FIRST enabled ACOM amp
|
||||||
ampsMu sync.Mutex // guards ampInsts
|
ampsMu sync.Mutex // guards ampInsts
|
||||||
ampInsts map[string]*ampInst // one running client per enabled configured amplifier, by config ID
|
ampInsts map[string]*ampInst // one running client per enabled configured amplifier, by config ID
|
||||||
audioMgr *audio.Manager
|
audioMgr *audio.Manager
|
||||||
qsoRec *audio.Recorder // continuous QSO recorder (rolling pre-roll)
|
qsoRec *audio.Recorder // continuous QSO recorder (rolling pre-roll)
|
||||||
// qsoRecManual marks a take the operator started by hand while automatic
|
// qsoRecManual marks a take the operator started by hand while automatic
|
||||||
// recording is OFF. Such a take opened the sound devices itself, so it must
|
// recording is OFF. Such a take opened the sound devices itself, so it must
|
||||||
// close them again when it ends — an operator who records one contact does
|
// close them again when it ends — an operator who records one contact does
|
||||||
@@ -1450,7 +1452,8 @@ func (a *App) plannedShutdownSteps() []shutdownStep {
|
|||||||
if folder == "" {
|
if folder == "" {
|
||||||
folder = s.DefaultFolder
|
folder = s.DefaultFolder
|
||||||
}
|
}
|
||||||
if !backup.HasBackupToday(folder) {
|
// "Back up on every exit" bypasses the once-a-day gate.
|
||||||
|
if s.EveryExit || !backup.HasBackupToday(folder) {
|
||||||
out = append(out, shutdownStep{ID: "backup", Label: "Backing up database", Status: "pending"})
|
out = append(out, shutdownStep{ID: "backup", Label: "Backing up database", Status: "pending"})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1530,10 +1533,10 @@ func (a *App) runBackupForShutdown() error {
|
|||||||
if mysql {
|
if mysql {
|
||||||
done = backup.HasADIFBackupToday(folder)
|
done = backup.HasADIFBackupToday(folder)
|
||||||
}
|
}
|
||||||
if done {
|
if done && !s.EveryExit { // "every exit" backs up regardless of a prior backup today
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if _, err := a.runConfiguredBackup(folder, s.Rotation, s.Zip); err != nil {
|
if _, err := a.runConfiguredBackup(folder, s.Rotation, s.Zip, s.KeepAll); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return a.settings.Set(a.ctx, keyBackupLast, time.Now().UTC().Format(time.RFC3339))
|
return a.settings.Set(a.ctx, keyBackupLast, time.Now().UTC().Format(time.RFC3339))
|
||||||
@@ -11581,6 +11584,12 @@ func (a *App) LogUDPLoggedADIF(adifText string) (int64, error) {
|
|||||||
a.extsvc.OnQSOLogged(id)
|
a.extsvc.OnQSOLogged(id)
|
||||||
}
|
}
|
||||||
a.maybeAutoSendEQSL(qc)
|
a.maybeAutoSendEQSL(qc)
|
||||||
|
// Forward to the outbound UDP integrations, exactly like the manual log
|
||||||
|
// path — otherwise a QSO logged FROM WSJT-X/JTDX/MSHV was never re-emitted
|
||||||
|
// to the outbound ADIF listeners (Log4OM, N1MM, gridtracker…).
|
||||||
|
if a.udp != nil {
|
||||||
|
a.udp.EmitLoggedADIF(adif.SingleRecordADIF(qc))
|
||||||
|
}
|
||||||
if a.ctx != nil {
|
if a.ctx != nil {
|
||||||
wruntime.EventsEmit(a.ctx, "qso:logged", id) // refresh again so award_refs show
|
wruntime.EventsEmit(a.ctx, "qso:logged", id) // refresh again so award_refs show
|
||||||
}
|
}
|
||||||
@@ -11775,6 +11784,8 @@ type BackupSettings struct {
|
|||||||
Folder string `json:"folder"`
|
Folder string `json:"folder"`
|
||||||
Rotation int `json:"rotation"`
|
Rotation int `json:"rotation"`
|
||||||
Zip bool `json:"zip"`
|
Zip bool `json:"zip"`
|
||||||
|
EveryExit bool `json:"every_exit"` // back up on every quit, not just the first of the day
|
||||||
|
KeepAll bool `json:"keep_all"` // time-stamped file per backup instead of one-per-day (kept up to Rotation)
|
||||||
LastBackupAt string `json:"last_backup_at"`
|
LastBackupAt string `json:"last_backup_at"`
|
||||||
DefaultFolder string `json:"default_folder"` // computed, read-only — shown as a hint
|
DefaultFolder string `json:"default_folder"` // computed, read-only — shown as a hint
|
||||||
}
|
}
|
||||||
@@ -11789,7 +11800,7 @@ func (a *App) GetBackupSettings() (BackupSettings, error) {
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
m, err := a.settings.GetMany(a.ctx,
|
m, err := a.settings.GetMany(a.ctx,
|
||||||
keyBackupEnabled, keyBackupFolder, keyBackupRotation, keyBackupZip, keyBackupLast)
|
keyBackupEnabled, keyBackupFolder, keyBackupRotation, keyBackupZip, keyBackupEveryExit, keyBackupKeepAll, keyBackupLast)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
@@ -11799,6 +11810,8 @@ func (a *App) GetBackupSettings() (BackupSettings, error) {
|
|||||||
out.Rotation = n
|
out.Rotation = n
|
||||||
}
|
}
|
||||||
out.Zip = m[keyBackupZip] == "1"
|
out.Zip = m[keyBackupZip] == "1"
|
||||||
|
out.EveryExit = m[keyBackupEveryExit] == "1"
|
||||||
|
out.KeepAll = m[keyBackupKeepAll] == "1"
|
||||||
out.LastBackupAt = m[keyBackupLast]
|
out.LastBackupAt = m[keyBackupLast]
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
@@ -11821,10 +11834,12 @@ func (a *App) SaveBackupSettings(s BackupSettings) error {
|
|||||||
doZip = "1"
|
doZip = "1"
|
||||||
}
|
}
|
||||||
for k, v := range map[string]string{
|
for k, v := range map[string]string{
|
||||||
keyBackupEnabled: enabled,
|
keyBackupEnabled: enabled,
|
||||||
keyBackupFolder: strings.TrimSpace(s.Folder),
|
keyBackupFolder: strings.TrimSpace(s.Folder),
|
||||||
keyBackupRotation: strconv.Itoa(s.Rotation),
|
keyBackupRotation: strconv.Itoa(s.Rotation),
|
||||||
keyBackupZip: doZip,
|
keyBackupZip: doZip,
|
||||||
|
keyBackupEveryExit: boolStr(s.EveryExit),
|
||||||
|
keyBackupKeepAll: boolStr(s.KeepAll),
|
||||||
} {
|
} {
|
||||||
if err := a.settings.Set(a.ctx, k, v); err != nil {
|
if err := a.settings.Set(a.ctx, k, v); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -11841,15 +11856,15 @@ func (a *App) SaveBackupSettings(s BackupSettings) error {
|
|||||||
// backing up the QSOs once the logbook was split out. On MySQL the contacts
|
// backing up the QSOs once the logbook was split out. On MySQL the contacts
|
||||||
// aren't in a local file, so they're exported to ADIF instead. Returns the path
|
// aren't in a local file, so they're exported to ADIF instead. Returns the path
|
||||||
// of the contacts backup.
|
// of the contacts backup.
|
||||||
func (a *App) runConfiguredBackup(folder string, rotation int, zip bool) (string, error) {
|
func (a *App) runConfiguredBackup(folder string, rotation int, zip, unique bool) (string, error) {
|
||||||
// Config snapshot (profiles, hardware, awards). Best-effort — a config-backup
|
// Config snapshot (profiles, hardware, awards). Best-effort — a config-backup
|
||||||
// failure must never stop the contacts from being protected.
|
// failure must never stop the contacts from being protected.
|
||||||
if _, err := backup.Run(a.ctx, a.db, a.dbPath, folder, rotation, zip, "opslogcfg"); err != nil {
|
if _, err := backup.Run(a.ctx, a.db, a.dbPath, folder, rotation, zip, "opslogcfg", unique); err != nil {
|
||||||
applog.Printf("backup: config snapshot failed: %v", err)
|
applog.Printf("backup: config snapshot failed: %v", err)
|
||||||
}
|
}
|
||||||
if a.dbBackend == "mysql" {
|
if a.dbBackend == "mysql" {
|
||||||
// The live log is on MySQL; VACUUM INTO can't reach it — export to ADIF.
|
// The live log is on MySQL; VACUUM INTO can't reach it — export to ADIF.
|
||||||
return a.backupLogADIF(folder, rotation, zip)
|
return a.backupLogADIF(folder, rotation, zip, unique)
|
||||||
}
|
}
|
||||||
// SQLite: snapshot the logbook file that holds the contacts. Fall back to the
|
// SQLite: snapshot the logbook file that holds the contacts. Fall back to the
|
||||||
// settings db only when it doubles as the logbook (rare split-failure case).
|
// settings db only when it doubles as the logbook (rare split-failure case).
|
||||||
@@ -11857,7 +11872,7 @@ func (a *App) runConfiguredBackup(folder string, rotation int, zip bool) (string
|
|||||||
if conn == nil || path == "" {
|
if conn == nil || path == "" {
|
||||||
conn, path = a.db, a.dbPath
|
conn, path = a.db, a.dbPath
|
||||||
}
|
}
|
||||||
return backup.Run(a.ctx, conn, path, folder, rotation, zip, "opslog")
|
return backup.Run(a.ctx, conn, path, folder, rotation, zip, "opslog", unique)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunBackupNow forces an immediate backup using the persisted settings.
|
// RunBackupNow forces an immediate backup using the persisted settings.
|
||||||
@@ -11871,7 +11886,7 @@ func (a *App) RunBackupNow() (string, error) {
|
|||||||
if folder == "" {
|
if folder == "" {
|
||||||
folder = s.DefaultFolder
|
folder = s.DefaultFolder
|
||||||
}
|
}
|
||||||
path, err := a.runConfiguredBackup(folder, s.Rotation, s.Zip)
|
path, err := a.runConfiguredBackup(folder, s.Rotation, s.Zip, s.KeepAll)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return path, err
|
return path, err
|
||||||
}
|
}
|
||||||
@@ -11882,11 +11897,11 @@ func (a *App) RunBackupNow() (string, error) {
|
|||||||
// backupLogADIF writes a rotating ADIF export of the (MySQL) logbook into the
|
// backupLogADIF writes a rotating ADIF export of the (MySQL) logbook into the
|
||||||
// backup folder. The full set of ADIF + app fields is included so the backup is
|
// backup folder. The full set of ADIF + app fields is included so the backup is
|
||||||
// a complete, re-importable copy of the log.
|
// a complete, re-importable copy of the log.
|
||||||
func (a *App) backupLogADIF(folder string, rotation int, zip bool) (string, error) {
|
func (a *App) backupLogADIF(folder string, rotation int, zip, unique bool) (string, error) {
|
||||||
if a.qso == nil {
|
if a.qso == nil {
|
||||||
return "", fmt.Errorf("logbook not initialized")
|
return "", fmt.Errorf("logbook not initialized")
|
||||||
}
|
}
|
||||||
return backup.RunADIF(folder, rotation, zip, func(p string) error {
|
return backup.RunADIF(folder, rotation, zip, unique, func(p string) error {
|
||||||
ex := &adif.Exporter{Repo: a.qso, AppName: "OpsLog", AppVersion: "0.1", IncludeAppFields: true}
|
ex := &adif.Exporter{Repo: a.qso, AppName: "OpsLog", AppVersion: "0.1", IncludeAppFields: true}
|
||||||
_, e := ex.ExportFile(a.ctx, p)
|
_, e := ex.ExportFile(a.ctx, p)
|
||||||
return e
|
return e
|
||||||
@@ -11917,10 +11932,10 @@ func (a *App) maybeShutdownBackup() {
|
|||||||
if mysql {
|
if mysql {
|
||||||
done = backup.HasADIFBackupToday(folder)
|
done = backup.HasADIFBackupToday(folder)
|
||||||
}
|
}
|
||||||
if done {
|
if done && !s.EveryExit { // "every exit" backs up regardless of a prior backup today
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _, err := a.runConfiguredBackup(folder, s.Rotation, s.Zip); err != nil {
|
if _, err := a.runConfiguredBackup(folder, s.Rotation, s.Zip, s.KeepAll); err != nil {
|
||||||
fmt.Println("OpsLog: shutdown backup failed:", err)
|
fmt.Println("OpsLog: shutdown backup failed:", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -13125,6 +13140,21 @@ func (a *App) reloadCAT() {
|
|||||||
kw.SetDataMode(s.KenwoodDataMode)
|
kw.SetDataMode(s.KenwoodDataMode)
|
||||||
a.cat.Start(kw)
|
a.cat.Start(kw)
|
||||||
}
|
}
|
||||||
|
case "elecraft":
|
||||||
|
// Elecraft K3/K4: the Kenwood-dialect client with the Elecraft specifics on
|
||||||
|
// (digital modes → DATA A via MD6+DT0). Reuses the Kenwood port/baud/host
|
||||||
|
// settings — the K3 emulates the Kenwood command set, so a separate transport
|
||||||
|
// would be a near-total duplicate.
|
||||||
|
if h := strings.TrimSpace(s.KenwoodHost); h != "" {
|
||||||
|
kw := cat.NewKenwoodTCP(h, s.DigitalDefault)
|
||||||
|
kw.SetElecraft(true)
|
||||||
|
a.cat.Start(kw)
|
||||||
|
} else {
|
||||||
|
kw := cat.NewKenwood(s.KenwoodPort, s.KenwoodBaud, s.DigitalDefault)
|
||||||
|
kw.SetLowerLines(s.KenwoodLowLines)
|
||||||
|
kw.SetElecraft(true)
|
||||||
|
a.cat.Start(kw)
|
||||||
|
}
|
||||||
case "icom":
|
case "icom":
|
||||||
// Native Icom CI-V over the radio's USB serial port (local control).
|
// Native Icom CI-V over the radio's USB serial port (local control).
|
||||||
// Same civ protocol the network backend reuses for remote.
|
// Same civ protocol the network backend reuses for remote.
|
||||||
|
|||||||
+58
-8
@@ -31,13 +31,20 @@ import (
|
|||||||
const (
|
const (
|
||||||
keyQSLEmailSubject = "qsl.email_subject"
|
keyQSLEmailSubject = "qsl.email_subject"
|
||||||
keyQSLEmailBody = "qsl.email_body"
|
keyQSLEmailBody = "qsl.email_body"
|
||||||
keyQSLAutoSend = "qsl.auto_send" // "1" → render+send an eQSL on log when an e-mail and default template exist
|
keyQSLAutoSend = "qsl.auto_send" // "1" → render+send an eQSL on log when an e-mail and default template exist
|
||||||
|
keyQSLDefaultMsg = "qsl.default_message" // fallback QSL message printed on the card when the QSO's own QSLMSG is empty
|
||||||
)
|
)
|
||||||
|
|
||||||
// appQSLCardSentField is the ADIF APP_ field stamping when OpsLog e-mailed its
|
// appQSLCardSentField is the ADIF APP_ field stamping when OpsLog e-mailed its
|
||||||
// own QSL card. Deliberately NOT eqsl_sent (that's eQSL.cc's, kept independent).
|
// own QSL card. Deliberately NOT eqsl_sent (that's eQSL.cc's, kept independent).
|
||||||
const appQSLCardSentField = "APP_OPSLOG_QSL_SENT"
|
const appQSLCardSentField = "APP_OPSLOG_QSL_SENT"
|
||||||
|
|
||||||
|
// appQSLCardRcvdField marks that a QSL was RECEIVED for this QSO (set by the
|
||||||
|
// operator, e.g. when a card arrives by e-mail). It drives the PSE/TNX stamp on
|
||||||
|
// the card: received → "TNX" (thanks for your card), not received → "PSE QSL"
|
||||||
|
// (please send one). Independent of ADIF qsl_rcvd, like the sent field.
|
||||||
|
const appQSLCardRcvdField = "APP_OPSLOG_QSL_RCVD"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
defaultQSLEmailSubject = "eQSL — {CALL} de {MYCALL}"
|
defaultQSLEmailSubject = "eQSL — {CALL} de {MYCALL}"
|
||||||
defaultQSLEmailBody = "Hi,\n\nThank you for our QSO! Please find attached your eQSL card.\n\n{DATE} · {BAND} · {MODE}\n\n73,\n{MYCALL}"
|
defaultQSLEmailBody = "Hi,\n\nThank you for our QSO! Please find attached your eQSL card.\n\n{DATE} · {BAND} · {MODE}\n\n73,\n{MYCALL}"
|
||||||
@@ -453,11 +460,37 @@ func (a *App) SendEQSL(qsoID int64, templateID int64, jpegB64 string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// QSLEmailTemplates is the eQSL e-mail subject/body plus the auto-send toggle.
|
// qslDefaultMessage returns the operator's default QSL message (Settings), used
|
||||||
|
// on the card when a QSO has no QSLMSG of its own.
|
||||||
|
func (a *App) qslDefaultMessage() string {
|
||||||
|
if a.settings == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
s, _ := a.settings.Get(a.ctx, keyQSLDefaultMsg)
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetOpsLogQSLReceived marks (or clears) that a QSL was received for a QSO. This
|
||||||
|
// flips the card's PSE/TNX stamp. Stored as a timestamp in the QSO extras (a
|
||||||
|
// single-key UPDATE, like the sent marker) so it survives concurrent uploads.
|
||||||
|
func (a *App) SetOpsLogQSLReceived(qsoID int64, on bool) error {
|
||||||
|
if a.qso == nil {
|
||||||
|
return fmt.Errorf("db not initialized")
|
||||||
|
}
|
||||||
|
v := ""
|
||||||
|
if on {
|
||||||
|
v = time.Now().UTC().Format(time.RFC3339)
|
||||||
|
}
|
||||||
|
return a.qso.SetExtra(a.ctx, qsoID, appQSLCardRcvdField, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// QSLEmailTemplates is the eQSL e-mail subject/body, the auto-send toggle, and
|
||||||
|
// the default QSL message printed on the card when a QSO has none of its own.
|
||||||
type QSLEmailTemplates struct {
|
type QSLEmailTemplates struct {
|
||||||
Subject string `json:"subject"`
|
Subject string `json:"subject"`
|
||||||
Body string `json:"body"`
|
Body string `json:"body"`
|
||||||
AutoSend bool `json:"auto_send"`
|
AutoSend bool `json:"auto_send"`
|
||||||
|
DefaultMessage string `json:"default_message"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// QSLGetEmailTemplates returns the eQSL e-mail templates (with defaults).
|
// QSLGetEmailTemplates returns the eQSL e-mail templates (with defaults).
|
||||||
@@ -466,7 +499,7 @@ func (a *App) QSLGetEmailTemplates() (QSLEmailTemplates, error) {
|
|||||||
if a.settings == nil {
|
if a.settings == nil {
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
m, err := a.settings.GetMany(a.ctx, keyQSLEmailSubject, keyQSLEmailBody, keyQSLAutoSend)
|
m, err := a.settings.GetMany(a.ctx, keyQSLEmailSubject, keyQSLEmailBody, keyQSLAutoSend, keyQSLDefaultMsg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
@@ -477,6 +510,7 @@ func (a *App) QSLGetEmailTemplates() (QSLEmailTemplates, error) {
|
|||||||
out.Body = b
|
out.Body = b
|
||||||
}
|
}
|
||||||
out.AutoSend = m[keyQSLAutoSend] == "1"
|
out.AutoSend = m[keyQSLAutoSend] == "1"
|
||||||
|
out.DefaultMessage = m[keyQSLDefaultMsg]
|
||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -495,7 +529,10 @@ func (a *App) QSLSaveEmailTemplates(t QSLEmailTemplates) error {
|
|||||||
if t.AutoSend {
|
if t.AutoSend {
|
||||||
v = "1"
|
v = "1"
|
||||||
}
|
}
|
||||||
return a.settings.Set(a.ctx, keyQSLAutoSend, v)
|
if err := a.settings.Set(a.ctx, keyQSLAutoSend, v); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return a.settings.Set(a.ctx, keyQSLDefaultMsg, t.DefaultMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
// maybeAutoSendEQSL fires an eQSL render+send for a freshly-logged QSO when the
|
// maybeAutoSendEQSL fires an eQSL render+send for a freshly-logged QSO when the
|
||||||
@@ -634,6 +671,18 @@ func (a *App) qslVars(q qso.QSO) (map[string]string, qslcard.CountryInfo, error)
|
|||||||
}
|
}
|
||||||
return strconv.Itoa(z)
|
return strconv.Itoa(z)
|
||||||
}
|
}
|
||||||
|
// The QSL message on the card: the QSO's own QSLMSG wins; when it's empty the
|
||||||
|
// operator's default message (Settings) is used instead.
|
||||||
|
msg := q.QSLMsg
|
||||||
|
if strings.TrimSpace(msg) == "" {
|
||||||
|
msg = a.qslDefaultMessage()
|
||||||
|
}
|
||||||
|
// PSE/TNX stamp, chosen automatically by whether a QSL was received for this
|
||||||
|
// QSO (appQSLCardRcvdField): received → thank them, otherwise ask for a card.
|
||||||
|
pseTnx := "PSE QSL"
|
||||||
|
if q.Extras != nil && strings.TrimSpace(q.Extras[appQSLCardRcvdField]) != "" {
|
||||||
|
pseTnx = "TNX"
|
||||||
|
}
|
||||||
vars := map[string]string{
|
vars := map[string]string{
|
||||||
"profile.callsign": info.Callsign,
|
"profile.callsign": info.Callsign,
|
||||||
"profile.operator_name": info.Operator,
|
"profile.operator_name": info.Operator,
|
||||||
@@ -650,7 +699,8 @@ func (a *App) qslVars(q qso.QSO) (map[string]string, qslcard.CountryInfo, error)
|
|||||||
"qso.mode": q.Mode,
|
"qso.mode": q.Mode,
|
||||||
"qso.submode": q.Submode,
|
"qso.submode": q.Submode,
|
||||||
"qso.rst_sent": q.RSTSent,
|
"qso.rst_sent": q.RSTSent,
|
||||||
"qso.qsl_msg": q.QSLMsg,
|
"qso.qsl_msg": msg,
|
||||||
|
"qso.pse_tnx": pseTnx,
|
||||||
"qso.name": q.Name,
|
"qso.name": q.Name,
|
||||||
}
|
}
|
||||||
vars["qso.my_rig"], vars["qso.my_antenna"] = a.qslRigAntenna(q)
|
vars["qso.my_rig"], vars["qso.my_antenna"] = a.qslRigAntenna(q)
|
||||||
|
|||||||
@@ -1,4 +1,36 @@
|
|||||||
[
|
[
|
||||||
|
{
|
||||||
|
"version": "0.23.9",
|
||||||
|
"date": "",
|
||||||
|
"en": [
|
||||||
|
"Backup: new \"Back up on every exit\" option (Settings → Backup). With it on, OpsLog backs up the database each time you quit instead of only the first time of the day — so a second session's QSOs are always captured.",
|
||||||
|
"Cluster details (My station): removed the example placeholders in My rig / My antenna (and the satellite name/mode) — they looked like real values, so an empty field read as already filled.",
|
||||||
|
"QSL: new \"OpsLog QSL received\" marker on the QSO edit window (next to QSL Message), with a live PSE QSL / TNX indicator. When a QSL was received the card prints TNX (thanks), otherwise PSE QSL (please send one) — automatic. The stamp uses the {qso.pse_tnx} token (in the default card footer; placeable anywhere in the designer). A \"QSL received\" column was added to Recent QSOs.",
|
||||||
|
"QSL: a default QSL message (Settings → E-mail, under the QSL card e-mail) now prints on the card when a QSO has no QSL Message of its own — a QSO's own QSL Message always takes precedence.",
|
||||||
|
"UDP outbound: a QSO logged from WSJT-X / JTDX / MSHV (via the inbound UDP listener) is now forwarded to the outbound ADIF integrations too — previously only QSOs typed directly into OpsLog were re-emitted.",
|
||||||
|
"Backup: with \"back up on every exit\", a new \"Keep every backup\" sub-option writes a distinct time-stamped file per exit (opslog-YYYY-MM-DD-HHMMSS.db) instead of overwriting the day's file. Rotation still keeps the newest N — raise it for more history.",
|
||||||
|
"Awards editor: the PRIMARY QSOFIELDS search now has a Prefix field too (prepended to each found reference, e.g. captured 01 → D01) — previously only the OR fallback searches could add a prefix, so a DOK-style award couldn't match on its main rule.",
|
||||||
|
"CAT: new Elecraft K3/K4 backend in the rig list. Select it (it reuses the Kenwood USB/network settings) and digital modes automatically use DATA A (MD6+DT0) — the sub-mode FT8 audio needs, so the K3 no longer keys the transmitter without modulating.",
|
||||||
|
"Settings database: the New / Open existing / Save a copy / Rename / Reset buttons are back (Settings → Database). Only \"Open folder\" was left, which opens Windows Explorer — where a .db can't be selected, it just asks which program should open it. Picking a database now uses a proper file dialog and offers a one-click restart.",
|
||||||
|
"Recent QSOs: a column dragged to sit AFTER an award column now stays there. Award columns were left out of the saved layout, so on reload they were pushed to the far right and jumped back in front of the column you had placed after them.",
|
||||||
|
"Entry form and QSO editor: Name and QTH are capitalised word by word (\"JEAN-PIERRE\" → \"Jean-Pierre\"), Comment and Note get a capital first letter. Applied when you leave the field, so typing is never interrupted; the rest of a comment is left alone, since it usually holds callsigns and modes.",
|
||||||
|
"Recent QSOs: the search box only ever takes callsigns, so it now upper-cases as you type and carries a small clear button."
|
||||||
|
],
|
||||||
|
"fr": [
|
||||||
|
"Sauvegarde : nouvelle option \"Sauvegarder à chaque fermeture\" (Réglages → Sauvegarde). Activée, OpsLog sauvegarde la base à chaque fois que tu quittes au lieu d'une seule fois par jour — les QSO d'une seconde session sont ainsi toujours pris.",
|
||||||
|
"Détails cluster (Ma station) : suppression des exemples en filigrane dans Mon rig / Mon antenne (et nom/mode satellite) — ils ressemblaient à de vraies valeurs, faisant croire qu'un champ vide était déjà rempli.",
|
||||||
|
"QSL : nouveau marqueur \"QSL OpsLog reçue\" dans la fenêtre d'édition du QSO (à côté du Message QSL), avec un indicateur PSE QSL / TNX en direct. Si une QSL a été reçue, la carte imprime TNX (merci), sinon PSE QSL (envoie-moi une carte) — automatique. Le tampon utilise le token {qso.pse_tnx} (dans le pied de carte par défaut ; plaçable où tu veux dans le designer). Une colonne \"QSL reçue\" a été ajoutée aux QSO récents.",
|
||||||
|
"QSL : un message QSL par défaut (Réglages → E-mail, sous l'e-mail de carte QSL) s'imprime désormais sur la carte quand un QSO n'a pas son propre Message QSL — le Message QSL du QSO l'emporte toujours.",
|
||||||
|
"UDP sortant : un QSO enregistré depuis WSJT-X / JTDX / MSHV (via l'écouteur UDP entrant) est désormais aussi transmis aux intégrations ADIF sortantes — avant, seuls les QSO saisis directement dans OpsLog étaient réémis.",
|
||||||
|
"Sauvegarde : avec \"sauvegarder à chaque fermeture\", une nouvelle sous-option \"Garder chaque sauvegarde\" écrit un fichier horodaté distinct par fermeture (opslog-AAAA-MM-JJ-HHMMSS.db) au lieu d'écraser le fichier du jour. La rotation garde les N plus récents — augmente-la pour plus d'historique.",
|
||||||
|
"Éditeur de diplômes : la recherche PRINCIPALE QSOFIELDS a aussi un champ Préfixe (ajouté devant chaque référence trouvée, ex. 01 capturé → D01) — avant, seules les recherches OR de repli pouvaient ajouter un préfixe, empêchant un diplôme type DOK de matcher sur sa règle principale.",
|
||||||
|
"CAT : nouveau backend Elecraft K3/K4 dans la liste des rigs. Sélectionne-le (il réutilise les réglages USB/réseau Kenwood) et les modes numériques passent automatiquement en DATA A (MD6+DT0) — le sous-mode dont l'audio FT8 a besoin, donc le K3 ne passe plus en émission sans moduler.",
|
||||||
|
"Base de réglages : les boutons Nouvelle base / Ouvrir existante / Enregistrer une copie / Renommer / Réinitialiser sont de retour (Réglages → Base de données). Il ne restait que \"Ouvrir le dossier\", qui lance l'Explorateur Windows — où un .db n'est pas sélectionnable, il demande juste avec quel logiciel l'ouvrir. Choisir une base passe désormais par un vrai sélecteur de fichier, avec redémarrage en un clic.",
|
||||||
|
"QSO récents : une colonne déplacée APRÈS une colonne de diplôme y reste. Les colonnes de diplômes étaient exclues de la disposition enregistrée, donc au rechargement elles étaient repoussées tout à droite et repassaient devant la colonne que tu avais placée après elles.",
|
||||||
|
"Saisie et éditeur de QSO : Name et QTH sont capitalisés mot par mot (« JEAN-PIERRE » → « Jean-Pierre »), Comment et Note prennent une majuscule en première lettre. Appliqué quand tu quittes le champ, donc la frappe n'est jamais perturbée ; la suite d'un commentaire est laissée telle quelle, puisqu'elle contient souvent des indicatifs et des modes.",
|
||||||
|
"QSO récents : le champ de recherche ne prend que des indicatifs — il passe donc en majuscules à la frappe et reçoit un petit bouton d'effacement."
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "0.23.8",
|
"version": "0.23.8",
|
||||||
"date": "",
|
"date": "",
|
||||||
|
|||||||
+33
-12
@@ -103,6 +103,7 @@ import { WinkeyerPanel, type WKStatus, type WKMacro } from '@/components/Winkeye
|
|||||||
import { RotorCompass } from '@/components/RotorCompass';
|
import { RotorCompass } from '@/components/RotorCompass';
|
||||||
import { writeUiPref } from '@/lib/uiPref';
|
import { writeUiPref } from '@/lib/uiPref';
|
||||||
import { formatDateTimeUTC } from '@/lib/dateFormat';
|
import { formatDateTimeUTC } from '@/lib/dateFormat';
|
||||||
|
import { titleCase, sentenceCase } from '@/lib/textCase';
|
||||||
import { setGridPrefsProfile, flushGridPrefs } from '@/lib/gridPrefs';
|
import { setGridPrefsProfile, flushGridPrefs } from '@/lib/gridPrefs';
|
||||||
import { DvkPanel, type DVKMsg, type DVKStat } from '@/components/DvkPanel';
|
import { DvkPanel, type DVKMsg, type DVKStat } from '@/components/DvkPanel';
|
||||||
|
|
||||||
@@ -4222,7 +4223,8 @@ export default function App() {
|
|||||||
);
|
);
|
||||||
const nameBlock = (
|
const nameBlock = (
|
||||||
<div className="flex flex-col flex-1 min-w-[110px]"><Label className="mb-1 h-3.5">{t('field.name')}</Label>
|
<div className="flex flex-col flex-1 min-w-[110px]"><Label className="mb-1 h-3.5">{t('field.name')}</Label>
|
||||||
<Input value={name} onChange={(e) => { setName(e.target.value); markEdited('name'); }} />
|
<Input value={name} onChange={(e) => { setName(e.target.value); markEdited('name'); }}
|
||||||
|
onBlur={() => setName(titleCase)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
// In contest mode QTH is replaced by the sent (read-only, auto) and received
|
// In contest mode QTH is replaced by the sent (read-only, auto) and received
|
||||||
@@ -4242,7 +4244,8 @@ export default function App() {
|
|||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex flex-col flex-1 min-w-[80px]"><Label className="mb-1 h-3.5">{t('field.qth')}</Label>
|
<div className="flex flex-col flex-1 min-w-[80px]"><Label className="mb-1 h-3.5">{t('field.qth')}</Label>
|
||||||
<Input value={qth} onChange={(e) => { setQth(e.target.value); markEdited('qth'); }} />
|
<Input value={qth} onChange={(e) => { setQth(e.target.value); markEdited('qth'); }}
|
||||||
|
onBlur={() => setQth(titleCase)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
const gridBlock = (
|
const gridBlock = (
|
||||||
@@ -4387,7 +4390,7 @@ export default function App() {
|
|||||||
);
|
);
|
||||||
const commentSm = (
|
const commentSm = (
|
||||||
<div className="flex flex-col w-40"><Label className="mb-1 h-3.5">{t('field.comment')}</Label>
|
<div className="flex flex-col w-40"><Label className="mb-1 h-3.5">{t('field.comment')}</Label>
|
||||||
<Input value={comment} onChange={(e) => setComment(e.target.value)} />
|
<Input value={comment} onChange={(e) => setComment(e.target.value)} onBlur={() => setComment(sentenceCase)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
// Inline-label variants (label to the LEFT of the control, Log4OM-style) —
|
// Inline-label variants (label to the LEFT of the control, Log4OM-style) —
|
||||||
@@ -4503,12 +4506,12 @@ export default function App() {
|
|||||||
// column). No flex-1 so they stay one row tall.
|
// column). No flex-1 so they stay one row tall.
|
||||||
const commentLine = (
|
const commentLine = (
|
||||||
<div className="flex flex-col"><Label className="mb-1 h-3.5">{t('field.comment')}</Label>
|
<div className="flex flex-col"><Label className="mb-1 h-3.5">{t('field.comment')}</Label>
|
||||||
<Input value={comment} onChange={(e) => setComment(e.target.value)} />
|
<Input value={comment} onChange={(e) => setComment(e.target.value)} onBlur={() => setComment(sentenceCase)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
const noteLine = (
|
const noteLine = (
|
||||||
<div className="flex flex-col"><Label className="mb-1 h-3.5">{t('field.note')}</Label>
|
<div className="flex flex-col"><Label className="mb-1 h-3.5">{t('field.note')}</Label>
|
||||||
<Input value={note} onChange={(e) => setNote(e.target.value)} />
|
<Input value={note} onChange={(e) => setNote(e.target.value)} onBlur={() => setNote(sentenceCase)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
const logButtons = (
|
const logButtons = (
|
||||||
@@ -5605,7 +5608,8 @@ export default function App() {
|
|||||||
it to its own line instead, which stays readable. */}
|
it to its own line instead, which stays readable. */}
|
||||||
<div className="flex gap-4 items-end flex-wrap">
|
<div className="flex gap-4 items-end flex-wrap">
|
||||||
<div className="flex flex-col w-[300px] shrink-0"><Label className="mb-1 h-3.5">Name</Label>
|
<div className="flex flex-col w-[300px] shrink-0"><Label className="mb-1 h-3.5">Name</Label>
|
||||||
<Input value={name} onChange={(e) => { setName(e.target.value); markEdited('name'); }} />
|
<Input value={name} onChange={(e) => { setName(e.target.value); markEdited('name'); }}
|
||||||
|
onBlur={() => setName(titleCase)} />
|
||||||
</div>
|
</div>
|
||||||
{qthBlock}
|
{qthBlock}
|
||||||
{gridBlock}
|
{gridBlock}
|
||||||
@@ -6045,12 +6049,29 @@ export default function App() {
|
|||||||
|
|
||||||
<TabsContent value="recent" className="mt-0 flex flex-col min-h-0 flex-1">
|
<TabsContent value="recent" className="mt-0 flex flex-col min-h-0 flex-1">
|
||||||
<div className="flex gap-2 p-2.5 border-b border-border/60">
|
<div className="flex gap-2 p-2.5 border-b border-border/60">
|
||||||
<Input
|
{/* Callsign-only search: forced upper-case (a call is never
|
||||||
className="flex-1"
|
lower-case, and the operator shouldn't have to hold shift)
|
||||||
placeholder="Search callsign…"
|
with an inline clear so wiping the filter is one click
|
||||||
value={filterCallsign}
|
instead of a select-all + delete. */}
|
||||||
onChange={(e) => setFilterCallsign(e.target.value)}
|
<div className="relative flex-1">
|
||||||
/>
|
<Input
|
||||||
|
className="w-full pr-8 font-mono"
|
||||||
|
placeholder="Search callsign…"
|
||||||
|
value={filterCallsign}
|
||||||
|
onChange={(e) => setFilterCallsign(e.target.value.toUpperCase())}
|
||||||
|
/>
|
||||||
|
{filterCallsign && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
aria-label={t('btn.clear')}
|
||||||
|
title={t('btn.clear')}
|
||||||
|
className="absolute right-1.5 top-1/2 -translate-y-1/2 inline-flex items-center justify-center size-5 rounded text-muted-foreground hover:text-foreground hover:bg-foreground/10"
|
||||||
|
onClick={() => setFilterCallsign('')}
|
||||||
|
>
|
||||||
|
<X className="size-3.5" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
<Button variant="outline" size="sm" onClick={() => refresh()}>
|
<Button variant="outline" size="sm" onClick={() => refresh()}>
|
||||||
<RefreshCw className="size-3.5" /> Refresh
|
<RefreshCw className="size-3.5" /> Refresh
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export type AwardDef = {
|
|||||||
url?: string; download_url?: string; ref_url?: string; valid_from?: string; valid_to?: string; alias?: string;
|
url?: string; download_url?: string; ref_url?: string; valid_from?: string; valid_to?: string; alias?: string;
|
||||||
ref_display?: string; // grid column shows: ref | name | both
|
ref_display?: string; // grid column shows: ref | name | both
|
||||||
type?: string; field: string; match_by?: string; exact_match?: boolean; one_ref_per_qso?: boolean; pattern: string;
|
type?: string; field: string; match_by?: string; exact_match?: boolean; one_ref_per_qso?: boolean; pattern: string;
|
||||||
leading_str?: string; trailing_str?: string; dynamic?: boolean;
|
leading_str?: string; trailing_str?: string; prefix?: string; dynamic?: boolean;
|
||||||
or_rules?: AwardOrRule[];
|
or_rules?: AwardOrRule[];
|
||||||
dxcc_filter: number[] | null; valid_bands?: string[]; valid_modes?: string[]; emission?: string[];
|
dxcc_filter: number[] | null; valid_bands?: string[]; valid_modes?: string[]; emission?: string[];
|
||||||
confirm: string[] | null; validate?: string[] | null; grant_codes?: string; export_credit_granted?: boolean;
|
confirm: string[] | null; validate?: string[] | null; grant_codes?: string; export_credit_granted?: boolean;
|
||||||
@@ -556,9 +556,10 @@ export function AwardEditor({ open, onClose, onSaved }: Props) {
|
|||||||
<label className="flex items-center gap-2 text-xs cursor-pointer pl-[128px]"><Checkbox checked={!!cur.exact_match} onCheckedChange={(c) => patch({ exact_match: !!c })} /> {t('awed.exactMatch')}</label>
|
<label className="flex items-center gap-2 text-xs cursor-pointer pl-[128px]"><Checkbox checked={!!cur.exact_match} onCheckedChange={(c) => patch({ exact_match: !!c })} /> {t('awed.exactMatch')}</label>
|
||||||
<label className="flex items-center gap-2 text-xs cursor-pointer pl-[128px]" title={t('awed.oneRefHint')}><Checkbox checked={!!cur.one_ref_per_qso} onCheckedChange={(c) => patch({ one_ref_per_qso: !!c })} /> {t('awed.oneRef')}</label>
|
<label className="flex items-center gap-2 text-xs cursor-pointer pl-[128px]" title={t('awed.oneRefHint')}><Checkbox checked={!!cur.one_ref_per_qso} onCheckedChange={(c) => patch({ one_ref_per_qso: !!c })} /> {t('awed.oneRef')}</label>
|
||||||
<Field2 label={t('awed.patternRegex')}><Input className="h-8 font-mono text-xs" value={cur.pattern} onChange={(e) => patch({ pattern: e.target.value })} placeholder={t('awed.patternPlaceholder')} /></Field2>
|
<Field2 label={t('awed.patternRegex')}><Input className="h-8 font-mono text-xs" value={cur.pattern} onChange={(e) => patch({ pattern: e.target.value })} placeholder={t('awed.patternPlaceholder')} /></Field2>
|
||||||
<div className="grid grid-cols-2 gap-3">
|
<div className="grid grid-cols-3 gap-3">
|
||||||
<Field2 label={t('awed.leadingString')}><Input className="h-8 font-mono text-xs" value={cur.leading_str ?? ''} onChange={(e) => patch({ leading_str: e.target.value })} /></Field2>
|
<Field2 label={t('awed.leadingString')}><Input className="h-8 font-mono text-xs" value={cur.leading_str ?? ''} onChange={(e) => patch({ leading_str: e.target.value })} /></Field2>
|
||||||
<Field2 label={t('awed.trailingString')}><Input className="h-8 font-mono text-xs" value={cur.trailing_str ?? ''} onChange={(e) => patch({ trailing_str: e.target.value })} /></Field2>
|
<Field2 label={t('awed.trailingString')}><Input className="h-8 font-mono text-xs" value={cur.trailing_str ?? ''} onChange={(e) => patch({ trailing_str: e.target.value })} /></Field2>
|
||||||
|
<Field2 label={t('awed.prefix')}><Input className="h-8 font-mono text-xs" value={cur.prefix ?? ''} onChange={(e) => patch({ prefix: e.target.value })} placeholder={t('awed.prefixPlaceholder')} title={t('awed.prefixTitle')} /></Field2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Fallback searches: tried in order, only while nothing
|
{/* Fallback searches: tried in order, only while nothing
|
||||||
|
|||||||
@@ -465,18 +465,18 @@ export function DetailsPanel({ callsign, prefix, operatorGrid, remoteGrid, qth,
|
|||||||
</Select>
|
</Select>
|
||||||
</Field>
|
</Field>
|
||||||
<Field label={t('detp.rig')} span={3}>
|
<Field label={t('detp.rig')} span={3}>
|
||||||
<Input value={details.my_rig} placeholder="Flex 8600" onChange={(e) => onChange({ my_rig: e.target.value })} />
|
<Input value={details.my_rig} onChange={(e) => onChange({ my_rig: e.target.value })} />
|
||||||
</Field>
|
</Field>
|
||||||
<Field label={t('detp.antenna')} span={3}>
|
<Field label={t('detp.antenna')} span={3}>
|
||||||
<Input value={details.my_antenna} placeholder="UB640" onChange={(e) => onChange({ my_antenna: e.target.value })} />
|
<Input value={details.my_antenna} onChange={(e) => onChange({ my_antenna: e.target.value })} />
|
||||||
</Field>
|
</Field>
|
||||||
{satelliteMode && (
|
{satelliteMode && (
|
||||||
<>
|
<>
|
||||||
<Field label={t('detp.satName')} span={3}>
|
<Field label={t('detp.satName')} span={3}>
|
||||||
<Input value={details.sat_name} placeholder="AO-91" onChange={(e) => onChange({ sat_name: e.target.value })} />
|
<Input value={details.sat_name} onChange={(e) => onChange({ sat_name: e.target.value })} />
|
||||||
</Field>
|
</Field>
|
||||||
<Field label={t('detp.satelliteMode')} span={3}>
|
<Field label={t('detp.satelliteMode')} span={3}>
|
||||||
<Input value={details.sat_mode} placeholder="U/V" onChange={(e) => onChange({ sat_mode: e.target.value })} />
|
<Input value={details.sat_mode} onChange={(e) => onChange({ sat_mode: e.target.value })} />
|
||||||
</Field>
|
</Field>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { Trash2, Search, Loader2, CalendarDays } from 'lucide-react';
|
import { Trash2, Search, Loader2, CalendarDays } from 'lucide-react';
|
||||||
import { LookupCallsign, LookupCallsignFresh, DXCCForCountry, GetAwardDefs, ComputeQSOAwardRefs, GetListsSettings, OpenExternalURL } from '../../wailsjs/go/main/App';
|
import { LookupCallsign, LookupCallsignFresh, DXCCForCountry, GetAwardDefs, ComputeQSOAwardRefs, GetListsSettings, OpenExternalURL, SetOpsLogQSLReceived } from '../../wailsjs/go/main/App';
|
||||||
import { rstOptions, type RSTLists } from '@/lib/rst';
|
import { rstOptions, type RSTLists } from '@/lib/rst';
|
||||||
import { AwardRefSelector } from '@/components/AwardRefSelector';
|
import { AwardRefSelector } from '@/components/AwardRefSelector';
|
||||||
import { AdifExtrasEditor } from '@/components/AdifExtrasEditor';
|
import { AdifExtrasEditor } from '@/components/AdifExtrasEditor';
|
||||||
@@ -22,6 +22,7 @@ import { Combobox } from '@/components/ui/combobox';
|
|||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { flagURL } from '@/lib/flags';
|
import { flagURL } from '@/lib/flags';
|
||||||
import { useI18n } from '@/lib/i18n';
|
import { useI18n } from '@/lib/i18n';
|
||||||
|
import { titleCase, sentenceCase } from '@/lib/textCase';
|
||||||
import type { QSOForm } from '@/types';
|
import type { QSOForm } from '@/types';
|
||||||
|
|
||||||
type QSO = QSOForm;
|
type QSO = QSOForm;
|
||||||
@@ -428,6 +429,22 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
|
|||||||
[draft.extras],
|
[draft.extras],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// OpsLog QSL "received" marker (ADIF extra). Drives the card's PSE/TNX stamp:
|
||||||
|
// received → TNX (thanks for your card), otherwise PSE QSL (please send one).
|
||||||
|
// Saved with the normal Save via draft.extras.
|
||||||
|
const OPSLOG_QSL_RCVD = 'APP_OPSLOG_QSL_RCVD';
|
||||||
|
const qslReceived = !!String(draft.extras?.[OPSLOG_QSL_RCVD] ?? '').trim();
|
||||||
|
const toggleQslReceived = (on: boolean) => {
|
||||||
|
// Reflect immediately in the draft (for the PSE/TNX indicator)…
|
||||||
|
const next = { ...(draft.extras ?? {}) };
|
||||||
|
if (on) next[OPSLOG_QSL_RCVD] = new Date().toISOString();
|
||||||
|
else delete next[OPSLOG_QSL_RCVD];
|
||||||
|
set('extras', next as any);
|
||||||
|
// …and persist right away with a targeted write that reliably sets OR clears
|
||||||
|
// the key (the modal's extras-merge on Save wouldn't clear a removed key).
|
||||||
|
if ((draft as any).id) SetOpsLogQSLReceived((draft as any).id, on).catch(() => {});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open onOpenChange={(o) => { if (!o) onClose(); }}>
|
<Dialog open onOpenChange={(o) => { if (!o) onClose(); }}>
|
||||||
<DialogContent className="max-w-5xl max-h-[92vh] grid grid-rows-[auto_1fr_auto] gap-0 p-0">
|
<DialogContent className="max-w-5xl max-h-[92vh] grid grid-rows-[auto_1fr_auto] gap-0 p-0">
|
||||||
@@ -498,7 +515,8 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
|
|||||||
<div className="grid grid-cols-2 gap-x-6 gap-y-2.5">
|
<div className="grid grid-cols-2 gap-x-6 gap-y-2.5">
|
||||||
{/* ── Left column ── */}
|
{/* ── Left column ── */}
|
||||||
<div className="flex flex-col gap-2.5">
|
<div className="flex flex-col gap-2.5">
|
||||||
<div><Label>{t('qedit.name')}</Label><Input value={draft.name ?? ''} onChange={(e) => set('name', e.target.value)} /></div>
|
<div><Label>{t('qedit.name')}</Label><Input value={draft.name ?? ''} onChange={(e) => set('name', e.target.value)}
|
||||||
|
onBlur={() => set('name', titleCase(draft.name ?? '') as any)} /></div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Label className="w-20 shrink-0">{t('qedit.band')}</Label>
|
<Label className="w-20 shrink-0">{t('qedit.band')}</Label>
|
||||||
<Select value={draft.band || ''} onValueChange={(v) => set('band', v)}>
|
<Select value={draft.band || ''} onValueChange={(v) => set('band', v)}>
|
||||||
@@ -564,8 +582,10 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
|
|||||||
<div className="flex flex-col flex-1"><Label>{t('qedit.grid')}</Label><Input value={draft.grid ?? ''} onChange={(e) => set('grid', e.target.value)} className="font-mono uppercase" /></div>
|
<div className="flex flex-col flex-1"><Label>{t('qedit.grid')}</Label><Input value={draft.grid ?? ''} onChange={(e) => set('grid', e.target.value)} className="font-mono uppercase" /></div>
|
||||||
<div className="flex flex-col w-24"><Label>PFX</Label><Input readOnly value={pfxOf(draft.callsign ?? '')} className="font-mono bg-muted/40" /></div>
|
<div className="flex flex-col w-24"><Label>PFX</Label><Input readOnly value={pfxOf(draft.callsign ?? '')} className="font-mono bg-muted/40" /></div>
|
||||||
</div>
|
</div>
|
||||||
<div><Label>{t('qedit.comment')}</Label><Input value={draft.comment ?? ''} onChange={(e) => set('comment', e.target.value)} /></div>
|
<div><Label>{t('qedit.comment')}</Label><Input value={draft.comment ?? ''} onChange={(e) => set('comment', e.target.value)}
|
||||||
<div><Label>{t('qedit.note')}</Label><Textarea rows={3} value={draft.notes ?? ''} onChange={(e) => set('notes', e.target.value)} /></div>
|
onBlur={() => set('comment', sentenceCase(draft.comment ?? '') as any)} /></div>
|
||||||
|
<div><Label>{t('qedit.note')}</Label><Textarea rows={3} value={draft.notes ?? ''} onChange={(e) => set('notes', e.target.value)}
|
||||||
|
onBlur={() => set('notes', sentenceCase(draft.notes ?? '') as any)} /></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
@@ -586,7 +606,8 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
|
|||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
<div><Label>QTH</Label><Input value={draft.qth ?? ''} onChange={(e) => set('qth', e.target.value)} /></div>
|
<div><Label>QTH</Label><Input value={draft.qth ?? ''} onChange={(e) => set('qth', e.target.value)}
|
||||||
|
onBlur={() => set('qth', titleCase(draft.qth ?? '') as any)} /></div>
|
||||||
<div><Label>{t('qedit.address')}</Label><Textarea rows={4} value={draft.address ?? ''} onChange={(e) => set('address', e.target.value)} /></div>
|
<div><Label>{t('qedit.address')}</Label><Textarea rows={4} value={draft.address ?? ''} onChange={(e) => set('address', e.target.value)} /></div>
|
||||||
</div>
|
</div>
|
||||||
{/* Right column */}
|
{/* Right column */}
|
||||||
@@ -596,7 +617,19 @@ export function QSOEditModal({ qso, onSave, onDelete, onClose, countries = [], b
|
|||||||
<div className="flex flex-col flex-1"><Label>Lat</Label><Input type="number" step="0.000001" value={draft.lat ?? ''} onChange={(e) => set('lat', numOrUndef(e.target.value) as any)} className="font-mono" /></div>
|
<div className="flex flex-col flex-1"><Label>Lat</Label><Input type="number" step="0.000001" value={draft.lat ?? ''} onChange={(e) => set('lat', numOrUndef(e.target.value) as any)} className="font-mono" /></div>
|
||||||
<div className="flex flex-col flex-1"><Label>Lon</Label><Input type="number" step="0.000001" value={draft.lon ?? ''} onChange={(e) => set('lon', numOrUndef(e.target.value) as any)} className="font-mono" /></div>
|
<div className="flex flex-col flex-1"><Label>Lon</Label><Input type="number" step="0.000001" value={draft.lon ?? ''} onChange={(e) => set('lon', numOrUndef(e.target.value) as any)} className="font-mono" /></div>
|
||||||
</div>
|
</div>
|
||||||
<div><Label>{t('qedit.qslMsg')}</Label><Input value={draft.qsl_msg ?? ''} onChange={(e) => set('qsl_msg', e.target.value)} /></div>
|
<div>
|
||||||
|
<Label>{t('qedit.qslMsg')}</Label>
|
||||||
|
<Input value={draft.qsl_msg ?? ''} onChange={(e) => set('qsl_msg', e.target.value)} />
|
||||||
|
<div className="mt-1 flex items-center gap-2">
|
||||||
|
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||||
|
<Checkbox checked={qslReceived} onCheckedChange={(c) => toggleQslReceived(!!c)} />
|
||||||
|
{t('qedit.qslReceived')}
|
||||||
|
</label>
|
||||||
|
<span className="text-[11px] font-mono px-1.5 py-0.5 rounded bg-muted text-muted-foreground" title={t('qedit.pseTnxHint')}>
|
||||||
|
{qslReceived ? 'TNX' : 'PSE QSL'}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div><Label>{t('qedit.qslVia')}</Label><Input value={draft.qsl_via ?? ''} onChange={(e) => set('qsl_via', e.target.value)} /></div>
|
<div><Label>{t('qedit.qslVia')}</Label><Input value={draft.qsl_via ?? ''} onChange={(e) => set('qsl_via', e.target.value)} /></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -195,6 +195,8 @@ export const makeColCatalog = (t: TFn, myGrid?: string): ColEntry[] => [
|
|||||||
{ group: 'eQSL', label: t('rqg.c.eqsl_rcvd_date'), colId: 'eqsl_rcvd_date', headerName: t('rqg.h.eqsl_rcvd_date'), field: 'eqsl_rcvd_date' as any, width: 120, valueFormatter: (p) => fmtDateOnly(p.value) },
|
{ group: 'eQSL', label: t('rqg.c.eqsl_rcvd_date'), colId: 'eqsl_rcvd_date', headerName: t('rqg.h.eqsl_rcvd_date'), field: 'eqsl_rcvd_date' as any, width: 120, valueFormatter: (p) => fmtDateOnly(p.value) },
|
||||||
// App-specific: when OpsLog e-mailed its own QSL card. Distinct from eQSL.cc.
|
// App-specific: when OpsLog e-mailed its own QSL card. Distinct from eQSL.cc.
|
||||||
{ group: 'QSL', label: t('rqg.c.opslog_qsl_card_sent'), colId: 'opslog_qsl_card_sent', headerName: t('rqg.c.opslog_qsl_card_sent'), width: 100, cellClass: qslStatusCellClass, valueGetter: (p) => { const e = (p.data as any)?.extras ?? {}; return (e['APP_OPSLOG_QSL_SENT'] || e['APP_OPSLOG_QSL_CARD_SENT']) ? 'Y' : 'N'; }, defaultVisible: true },
|
{ group: 'QSL', label: t('rqg.c.opslog_qsl_card_sent'), colId: 'opslog_qsl_card_sent', headerName: t('rqg.c.opslog_qsl_card_sent'), width: 100, cellClass: qslStatusCellClass, valueGetter: (p) => { const e = (p.data as any)?.extras ?? {}; return (e['APP_OPSLOG_QSL_SENT'] || e['APP_OPSLOG_QSL_CARD_SENT']) ? 'Y' : 'N'; }, defaultVisible: true },
|
||||||
|
// App-specific: operator marked a QSL as RECEIVED for this QSO (drives PSE/TNX).
|
||||||
|
{ group: 'QSL', label: t('rqg.c.opslog_qsl_card_rcvd'), colId: 'opslog_qsl_card_rcvd', headerName: t('rqg.c.opslog_qsl_card_rcvd'), width: 100, cellClass: qslStatusCellClass, valueGetter: (p) => { const e = (p.data as any)?.extras ?? {}; return e['APP_OPSLOG_QSL_RCVD'] ? 'Y' : 'N'; }, defaultVisible: false },
|
||||||
// App-specific: when the QSO's audio recording was e-mailed to the station.
|
// App-specific: when the QSO's audio recording was e-mailed to the station.
|
||||||
{ group: 'QSL', label: t('rqg.c.opslog_recording_sent'), colId: 'opslog_recording_sent', headerName: t('rqg.h.opslog_recording_sent'), width: 100, cellClass: qslStatusCellClass, valueGetter: (p) => { const e = (p.data as any)?.extras ?? {}; return e['APP_OPSLOG_RECORDING_SENT'] ? 'Y' : 'N'; }, defaultVisible: false },
|
{ group: 'QSL', label: t('rqg.c.opslog_recording_sent'), colId: 'opslog_recording_sent', headerName: t('rqg.h.opslog_recording_sent'), width: 100, cellClass: qslStatusCellClass, valueGetter: (p) => { const e = (p.data as any)?.extras ?? {}; return e['APP_OPSLOG_RECORDING_SENT'] ? 'Y' : 'N'; }, defaultVisible: false },
|
||||||
|
|
||||||
@@ -280,12 +282,22 @@ const GRP_KEYS: Record<string, string> = {
|
|||||||
};
|
};
|
||||||
export const groupLabel = (t: TFn, g: string): string => t(GRP_KEYS[g] ?? g);
|
export const groupLabel = (t: TFn, g: string): string => t(GRP_KEYS[g] ?? g);
|
||||||
|
|
||||||
// Award columns are governed SOLELY by the awardShown code-set, never by AG
|
// Award-column VISIBILITY is governed SOLELY by the awardShown code-set, never
|
||||||
// Grid's saved column state. Stripping them here (on both save and restore)
|
// by AG Grid's saved column state: dropping `hide` here (on both save and
|
||||||
// stops a stale saved state from re-hiding a shown award column on every
|
// restore) stops a stale saved state from re-hiding a shown award column on
|
||||||
// awardCols rebuild — the desync that made award columns vanish mid-session.
|
// every awardCols rebuild — the desync that made award columns vanish
|
||||||
const stripAwardCols = (st: any[] | null | undefined): any[] =>
|
// mid-session.
|
||||||
(st ?? []).filter((s) => !String(s?.colId ?? '').startsWith('award_'));
|
//
|
||||||
|
// Their POSITION, however, has to stay in the state. Filtering the entries out
|
||||||
|
// entirely left applyColumnState({applyOrder:true}) with no place for them, and
|
||||||
|
// AG Grid appends what the state doesn't mention — so a column the operator
|
||||||
|
// dragged to sit AFTER an award column jumped back in front of it on reload.
|
||||||
|
const sanitizeAwardCols = (st: any[] | null | undefined): any[] =>
|
||||||
|
(st ?? []).map((s) => {
|
||||||
|
if (!String(s?.colId ?? '').startsWith('award_')) return s;
|
||||||
|
const { hide: _hide, ...rest } = s as any;
|
||||||
|
return rest;
|
||||||
|
});
|
||||||
|
|
||||||
export function RecentQSOsGrid({ rows, myGrid, selectAllSignal, selectRowSignal, rowDragCall, passOrder, onGridApi, storageKey, onRowDoubleClicked, onRowClicked, onRowSelected, onRowSelectedQso, onUpdateFromCty, onUpdateFromQRZ, onUpdateFromClublog, onSendTo, onSendRecording, onSendEQSL, onBulkEdit, onExportSelected, onExportSelectedFields, onExportFiltered, onExportCabrilloSelected, onExportCabrilloFiltered, onDelete, onFilteredCountChange, awardCols }: Props) {
|
export function RecentQSOsGrid({ rows, myGrid, selectAllSignal, selectRowSignal, rowDragCall, passOrder, onGridApi, storageKey, onRowDoubleClicked, onRowClicked, onRowSelected, onRowSelectedQso, onUpdateFromCty, onUpdateFromQRZ, onUpdateFromClublog, onSendTo, onSendRecording, onSendEQSL, onBulkEdit, onExportSelected, onExportSelectedFields, onExportFiltered, onExportCabrilloSelected, onExportCabrilloFiltered, onDelete, onFilteredCountChange, awardCols }: Props) {
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@@ -468,12 +480,12 @@ export function RecentQSOsGrid({ rows, myGrid, selectAllSignal, selectRowSignal,
|
|||||||
function onGridReady(e: GridReadyEvent) {
|
function onGridReady(e: GridReadyEvent) {
|
||||||
onGridApi?.(e.api);
|
onGridApi?.(e.api);
|
||||||
const local = loadLocal(colStateKey);
|
const local = loadLocal(colStateKey);
|
||||||
if (local) e.api.applyColumnState({ state: sanitizeState(stripAwardCols(local)) as ColumnState[], applyOrder: true });
|
if (local) e.api.applyColumnState({ state: sanitizeState(sanitizeAwardCols(local)) as ColumnState[], applyOrder: true });
|
||||||
// Fall back to the portable DB copy when the local cache is empty
|
// Fall back to the portable DB copy when the local cache is empty
|
||||||
// (fresh machine / after a reinstall), then re-seed the cache.
|
// (fresh machine / after a reinstall), then re-seed the cache.
|
||||||
loadRemote(colStateKey).then((remote) => {
|
loadRemote(colStateKey).then((remote) => {
|
||||||
if (remote && !local) {
|
if (remote && !local) {
|
||||||
e.api.applyColumnState({ state: sanitizeState(stripAwardCols(remote)) as ColumnState[], applyOrder: true });
|
e.api.applyColumnState({ state: sanitizeState(sanitizeAwardCols(remote)) as ColumnState[], applyOrder: true });
|
||||||
seedLocal(colStateKey, remote);
|
seedLocal(colStateKey, remote);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -497,7 +509,7 @@ export function RecentQSOsGrid({ rows, myGrid, selectAllSignal, selectRowSignal,
|
|||||||
if (restoringRef.current) return; // ignore the events fired by a column rebuild
|
if (restoringRef.current) return; // ignore the events fired by a column rebuild
|
||||||
const state = gridRef.current?.api?.getColumnState();
|
const state = gridRef.current?.api?.getColumnState();
|
||||||
if (!state) return;
|
if (!state) return;
|
||||||
saveState(colStateKey, stripAwardCols(state));
|
saveState(colStateKey, sanitizeAwardCols(state));
|
||||||
// Award columns are stripped above, so persist their widths on the side.
|
// Award columns are stripped above, so persist their widths on the side.
|
||||||
let changed = false;
|
let changed = false;
|
||||||
for (const s of state) {
|
for (const s of state) {
|
||||||
@@ -525,7 +537,7 @@ export function RecentQSOsGrid({ rows, myGrid, selectAllSignal, selectRowSignal,
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const api = gridRef.current?.api;
|
const api = gridRef.current?.api;
|
||||||
const local = loadLocal(colStateKey);
|
const local = loadLocal(colStateKey);
|
||||||
if (api && local) api.applyColumnState({ state: sanitizeState(stripAwardCols(local)) as ColumnState[], applyOrder: true });
|
if (api && local) api.applyColumnState({ state: sanitizeState(sanitizeAwardCols(local)) as ColumnState[], applyOrder: true });
|
||||||
// Re-enable saving once AG Grid has settled the column events from the rebuild.
|
// Re-enable saving once AG Grid has settled the column events from the rebuild.
|
||||||
const t = window.setTimeout(() => { restoringRef.current = false; }, 0);
|
const t = window.setTimeout(() => { restoringRef.current = false; }, 0);
|
||||||
return () => window.clearTimeout(t);
|
return () => window.clearTimeout(t);
|
||||||
|
|||||||
@@ -1373,8 +1373,8 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
|||||||
const [emailMsg, setEmailMsg] = useState('');
|
const [emailMsg, setEmailMsg] = useState('');
|
||||||
const setEmailField = (patch: Partial<EmailCfg>) => setEmailCfg((s) => ({ ...s, ...patch }));
|
const setEmailField = (patch: Partial<EmailCfg>) => setEmailCfg((s) => ({ ...s, ...patch }));
|
||||||
// eQSL card e-mail (subject/body templates + auto-send on log).
|
// eQSL card e-mail (subject/body templates + auto-send on log).
|
||||||
type EQSLCfg = { subject: string; body: string; auto_send: boolean };
|
type EQSLCfg = { subject: string; body: string; auto_send: boolean; default_message: string };
|
||||||
const [eqslCfg, setEqslCfg] = useState<EQSLCfg>({ subject: '', body: '', auto_send: false });
|
const [eqslCfg, setEqslCfg] = useState<EQSLCfg>({ subject: '', body: '', auto_send: false, default_message: '' });
|
||||||
const setEqslField = (patch: Partial<EQSLCfg>) => setEqslCfg((s) => ({ ...s, ...patch }));
|
const setEqslField = (patch: Partial<EQSLCfg>) => setEqslCfg((s) => ({ ...s, ...patch }));
|
||||||
// ClubLog Country File (cty.xml) exception status.
|
// ClubLog Country File (cty.xml) exception status.
|
||||||
type ClubInfo = { enabled: boolean; loaded: boolean; date: string; count: number };
|
type ClubInfo = { enabled: boolean; loaded: boolean; date: string; count: number };
|
||||||
@@ -2527,6 +2527,7 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
|||||||
<SelectItem value="flex">{t('cat.optFlex')}</SelectItem>
|
<SelectItem value="flex">{t('cat.optFlex')}</SelectItem>
|
||||||
<SelectItem value="yaesu">{t('cat.optYaesu')}</SelectItem>
|
<SelectItem value="yaesu">{t('cat.optYaesu')}</SelectItem>
|
||||||
<SelectItem value="kenwood">{t('cat.optKenwood')}</SelectItem>
|
<SelectItem value="kenwood">{t('cat.optKenwood')}</SelectItem>
|
||||||
|
<SelectItem value="elecraft">{t('cat.optElecraft')}</SelectItem>
|
||||||
<SelectItem value="xiegu">{t('cat.optXiegu')}</SelectItem>
|
<SelectItem value="xiegu">{t('cat.optXiegu')}</SelectItem>
|
||||||
<SelectItem value="icom">{t('cat.optIcom')}</SelectItem>
|
<SelectItem value="icom">{t('cat.optIcom')}</SelectItem>
|
||||||
<SelectItem value="icom-net">{t('cat.optIcomNet')}</SelectItem>
|
<SelectItem value="icom-net">{t('cat.optIcomNet')}</SelectItem>
|
||||||
@@ -2688,7 +2689,7 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
|||||||
{t('cat.civTrace')}
|
{t('cat.civTrace')}
|
||||||
</label> </div>
|
</label> </div>
|
||||||
)}
|
)}
|
||||||
{catCfg.backend === 'kenwood' && (
|
{(catCfg.backend === 'kenwood' || catCfg.backend === 'elecraft') && (
|
||||||
<>
|
<>
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<Label>{t('cat.kenwoodPort')}</Label>
|
<Label>{t('cat.kenwoodPort')}</Label>
|
||||||
@@ -2725,16 +2726,21 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
|||||||
</label>
|
</label>
|
||||||
<span className="text-xs text-muted-foreground">{t('cat.lowerLinesHint')}</span>
|
<span className="text-xs text-muted-foreground">{t('cat.lowerLinesHint')}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="space-y-1">
|
{catCfg.backend === 'kenwood' ? (
|
||||||
<Label>{t('cat.kwDataMode')}</Label>
|
<div className="space-y-1">
|
||||||
<Select value={(catCfg as any).kenwood_data_mode || 'usb'} onValueChange={(v) => setCatCfg((s) => ({ ...s, kenwood_data_mode: v } as any))}>
|
<Label>{t('cat.kwDataMode')}</Label>
|
||||||
<SelectTrigger className="h-8"><SelectValue /></SelectTrigger>
|
<Select value={(catCfg as any).kenwood_data_mode || 'usb'} onValueChange={(v) => setCatCfg((s) => ({ ...s, kenwood_data_mode: v } as any))}>
|
||||||
<SelectContent>
|
<SelectTrigger className="h-8"><SelectValue /></SelectTrigger>
|
||||||
<SelectItem value="usb">{t('cat.kwDataUsb')}</SelectItem>
|
<SelectContent>
|
||||||
<SelectItem value="data">{t('cat.kwDataMd6')}</SelectItem>
|
<SelectItem value="usb">{t('cat.kwDataUsb')}</SelectItem>
|
||||||
<SelectItem value="keep">{t('cat.kwDataKeep')}</SelectItem>
|
<SelectItem value="data">{t('cat.kwDataMd6')}</SelectItem>
|
||||||
</SelectContent>
|
<SelectItem value="keep">{t('cat.kwDataKeep')}</SelectItem>
|
||||||
</Select> </div>
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<span className="text-xs text-muted-foreground">{t('cat.elecraftHint')}</span>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{catCfg.backend === 'icom' && (
|
{catCfg.backend === 'icom' && (
|
||||||
@@ -4305,7 +4311,7 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
|||||||
title={t('sec.backup')}
|
title={t('sec.backup')}
|
||||||
hint={mysqlCfg.enabled ? t('bk.hintMysql') : t('bk.hint')}
|
hint={mysqlCfg.enabled ? t('bk.hintMysql') : t('bk.hint')}
|
||||||
/>
|
/>
|
||||||
<div className="space-y-4 max-w-xl">
|
<div className="space-y-5 max-w-2xl">
|
||||||
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={!!backupCfg.enabled}
|
checked={!!backupCfg.enabled}
|
||||||
@@ -4346,28 +4352,53 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-end gap-3">
|
<div className="space-y-1.5">
|
||||||
<div className="space-y-1.5">
|
<Label className="text-xs text-muted-foreground">{t('bk.rotation')}</Label>
|
||||||
<Label className="text-xs text-muted-foreground">{t('bk.rotation')}</Label>
|
<Input
|
||||||
<Input
|
type="number"
|
||||||
type="number"
|
min={1}
|
||||||
min={1}
|
max={365}
|
||||||
max={365}
|
className="w-24 font-mono text-xs"
|
||||||
className="w-24 font-mono text-xs"
|
value={backupCfg.rotation || 5}
|
||||||
value={backupCfg.rotation || 5}
|
onChange={(e) => {
|
||||||
onChange={(e) => {
|
const n = Number(e.target.value);
|
||||||
const n = Number(e.target.value);
|
if (Number.isFinite(n) && n > 0) setBackupCfg((b) => ({ ...b, rotation: Math.floor(n) }));
|
||||||
if (Number.isFinite(n) && n > 0) setBackupCfg((b) => ({ ...b, rotation: Math.floor(n) }));
|
}}
|
||||||
}}
|
/>
|
||||||
/>
|
</div>
|
||||||
</div>
|
|
||||||
<label className="flex items-center gap-2 text-sm cursor-pointer pb-2">
|
{/* Stacked, not one flex row: these labels are full sentences and the
|
||||||
|
"keep every backup" hint is two lines — side by side they wrapped
|
||||||
|
into unreadable slivers. It also puts keep-all under the option it
|
||||||
|
depends on rather than beside it. */}
|
||||||
|
<div className="space-y-2.5">
|
||||||
|
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={!!backupCfg.zip}
|
checked={!!backupCfg.zip}
|
||||||
onCheckedChange={(c) => setBackupCfg((b) => ({ ...b, zip: !!c }))}
|
onCheckedChange={(c) => setBackupCfg((b) => ({ ...b, zip: !!c }))}
|
||||||
/>
|
/>
|
||||||
<span>{t('bk.zip')}</span>
|
<span>{t('bk.zip')}</span>
|
||||||
</label>
|
</label>
|
||||||
|
<label className="flex items-center gap-2 text-sm cursor-pointer">
|
||||||
|
<Checkbox
|
||||||
|
checked={!!(backupCfg as any).every_exit}
|
||||||
|
onCheckedChange={(c) => setBackupCfg((b) => ({ ...b, every_exit: !!c } as any))}
|
||||||
|
/>
|
||||||
|
<span>{t('bk.everyExit')}</span>
|
||||||
|
</label>
|
||||||
|
{!!(backupCfg as any).every_exit && (
|
||||||
|
<label className="flex items-start gap-2 text-sm cursor-pointer pl-6">
|
||||||
|
<Checkbox
|
||||||
|
className="mt-0.5"
|
||||||
|
checked={!!(backupCfg as any).keep_all}
|
||||||
|
onCheckedChange={(c) => setBackupCfg((b) => ({ ...b, keep_all: !!c } as any))}
|
||||||
|
/>
|
||||||
|
<span>
|
||||||
|
{t('bk.keepAll')}
|
||||||
|
<span className="block text-xs text-muted-foreground mt-0.5 leading-relaxed">{t('bk.keepAllHint')}</span>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="border-t border-border/60 pt-3 flex items-center gap-3">
|
<div className="border-t border-border/60 pt-3 flex items-center gap-3">
|
||||||
@@ -5179,8 +5210,23 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
|||||||
</div>
|
</div>
|
||||||
<p className="text-[11px] text-muted-foreground">{t('db.appDbHint')}</p>
|
<p className="text-[11px] text-muted-foreground">{t('db.appDbHint')}</p>
|
||||||
<div className="flex flex-wrap gap-2">
|
<div className="flex flex-wrap gap-2">
|
||||||
|
<Button variant="outline" size="sm" onClick={createNew}><Plus className="size-3.5" /> {t('db.newDb')}</Button>
|
||||||
|
<Button variant="outline" size="sm" onClick={openExisting}><Database className="size-3.5" /> {t('db.openExisting')}</Button>
|
||||||
|
<Button variant="outline" size="sm" onClick={saveCopy}><Copy className="size-3.5" /> {t('db.saveCopy')}</Button>
|
||||||
|
<Button variant="outline" size="sm" onClick={renameDb} title={t('db.renameTip')}><Pencil className="size-3.5" /> {t('db.rename')}</Button>
|
||||||
<Button variant="outline" size="sm" onClick={revealFolder}><FolderOpen className="size-3.5" /> {t('db.openFolder')}</Button>
|
<Button variant="outline" size="sm" onClick={revealFolder}><FolderOpen className="size-3.5" /> {t('db.openFolder')}</Button>
|
||||||
|
{dbSettings.is_custom && <Button variant="ghost" size="sm" onClick={resetDefault}>{t('db.resetDefault')}</Button>}
|
||||||
</div>
|
</div>
|
||||||
|
{/* The DB pointer is only read at startup, so offer the restart inline. */}
|
||||||
|
{dbMsg && (
|
||||||
|
<div className="text-[11px] text-success space-y-1 pt-1">
|
||||||
|
<div>{t('db.savedRestart')} <span className="font-mono break-all">{dbMsg}</span></div>
|
||||||
|
<Button size="sm" className="h-7" onClick={() => RestartApp().catch((e: any) => setErr(String(e?.message ?? e)))}>
|
||||||
|
<Power className="size-3.5" /> {t('db.restartNow')}
|
||||||
|
</Button>
|
||||||
|
<span className="ml-2 text-muted-foreground">{t('db.restartHint')}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Logbook (QSOs) — this profile: default SQLite file, a dedicated file, or MySQL. */}
|
{/* Logbook (QSOs) — this profile: default SQLite file, a dedicated file, or MySQL. */}
|
||||||
@@ -5829,6 +5875,12 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
|||||||
<div className="text-[11px] text-muted-foreground">
|
<div className="text-[11px] text-muted-foreground">
|
||||||
{t('em.autoSendHint')}
|
{t('em.autoSendHint')}
|
||||||
</div>
|
</div>
|
||||||
|
<div className="pt-2 space-y-1">
|
||||||
|
<Label className="text-sm">{t('em.qslDefaultMsg')}</Label>
|
||||||
|
<Input className="h-8" placeholder={t('em.qslDefaultMsgPh')} value={eqslCfg.default_message ?? ''}
|
||||||
|
onChange={(e) => setEqslField({ default_message: e.target.value })} />
|
||||||
|
<div className="text-[11px] text-muted-foreground">{t('em.qslDefaultMsgHint')}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
+12
-12
File diff suppressed because one or more lines are too long
@@ -0,0 +1,28 @@
|
|||||||
|
// Capitalisation helpers for the free-text QSO fields (Name / QTH / Comment /
|
||||||
|
// Note).
|
||||||
|
//
|
||||||
|
// The same station reaches the log SHOUTED by QRZ, lower-cased by a hurried
|
||||||
|
// operator, and in whatever case the other logger stored it in an imported
|
||||||
|
// ADIF — so one callsign ends up as "JEAN", "jean" and "Jean" across a log,
|
||||||
|
// and sorting or reading a QTH column becomes a mess.
|
||||||
|
//
|
||||||
|
// Both helpers are meant to run on BLUR, never per keystroke: rewriting the
|
||||||
|
// value while the operator is still typing a word fights them mid-word (see
|
||||||
|
// the controlled-input note in CLAUDE.md).
|
||||||
|
|
||||||
|
// titleCase upper-cases the first letter of every word and lower-cases the
|
||||||
|
// rest. Separators are kept, so "SAINT-JULIEN" → "Saint-Julien" and
|
||||||
|
// "o'brien" → "O'Brien".
|
||||||
|
export function titleCase(s: string): string {
|
||||||
|
return s
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/(^|[\s\-'’/.])(\p{L})/gu, (_m, sep: string, ch: string) => sep + ch.toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
// sentenceCase upper-cases the first letter and leaves everything after it as
|
||||||
|
// typed. A comment routinely carries callsigns, modes and abbreviations
|
||||||
|
// ("TNX QSO F5ABC, FT8 59") that lower-casing would quietly destroy — which is
|
||||||
|
// why this is NOT titleCase.
|
||||||
|
export function sentenceCase(s: string): string {
|
||||||
|
return s.replace(/^(\s*)(\p{L})/u, (_m, sp: string, ch: string) => sp + ch.toUpperCase());
|
||||||
|
}
|
||||||
Vendored
+2
@@ -949,6 +949,8 @@ export function SetDVKLabel(arg1:number,arg2:string):Promise<void>;
|
|||||||
|
|
||||||
export function SetKenwoodKeySpeed(arg1:number):Promise<void>;
|
export function SetKenwoodKeySpeed(arg1:number):Promise<void>;
|
||||||
|
|
||||||
|
export function SetOpsLogQSLReceived(arg1:number,arg2:boolean):Promise<void>;
|
||||||
|
|
||||||
export function SetPassphrase(arg1:string):Promise<void>;
|
export function SetPassphrase(arg1:string):Promise<void>;
|
||||||
|
|
||||||
export function SetScpEnabled(arg1:boolean):Promise<void>;
|
export function SetScpEnabled(arg1:boolean):Promise<void>;
|
||||||
|
|||||||
@@ -1846,6 +1846,10 @@ export function SetKenwoodKeySpeed(arg1) {
|
|||||||
return window['go']['main']['App']['SetKenwoodKeySpeed'](arg1);
|
return window['go']['main']['App']['SetKenwoodKeySpeed'](arg1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function SetOpsLogQSLReceived(arg1, arg2) {
|
||||||
|
return window['go']['main']['App']['SetOpsLogQSLReceived'](arg1, arg2);
|
||||||
|
}
|
||||||
|
|
||||||
export function SetPassphrase(arg1) {
|
export function SetPassphrase(arg1) {
|
||||||
return window['go']['main']['App']['SetPassphrase'](arg1);
|
return window['go']['main']['App']['SetPassphrase'](arg1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -315,6 +315,7 @@ export namespace award {
|
|||||||
pattern: string;
|
pattern: string;
|
||||||
leading_str?: string;
|
leading_str?: string;
|
||||||
trailing_str?: string;
|
trailing_str?: string;
|
||||||
|
prefix?: string;
|
||||||
dynamic?: boolean;
|
dynamic?: boolean;
|
||||||
one_ref_per_qso?: boolean;
|
one_ref_per_qso?: boolean;
|
||||||
or_rules?: OrRule[];
|
or_rules?: OrRule[];
|
||||||
@@ -356,6 +357,7 @@ export namespace award {
|
|||||||
this.pattern = source["pattern"];
|
this.pattern = source["pattern"];
|
||||||
this.leading_str = source["leading_str"];
|
this.leading_str = source["leading_str"];
|
||||||
this.trailing_str = source["trailing_str"];
|
this.trailing_str = source["trailing_str"];
|
||||||
|
this.prefix = source["prefix"];
|
||||||
this.dynamic = source["dynamic"];
|
this.dynamic = source["dynamic"];
|
||||||
this.one_ref_per_qso = source["one_ref_per_qso"];
|
this.one_ref_per_qso = source["one_ref_per_qso"];
|
||||||
this.or_rules = this.convertValues(source["or_rules"], OrRule);
|
this.or_rules = this.convertValues(source["or_rules"], OrRule);
|
||||||
@@ -1894,6 +1896,8 @@ export namespace main {
|
|||||||
folder: string;
|
folder: string;
|
||||||
rotation: number;
|
rotation: number;
|
||||||
zip: boolean;
|
zip: boolean;
|
||||||
|
every_exit: boolean;
|
||||||
|
keep_all: boolean;
|
||||||
last_backup_at: string;
|
last_backup_at: string;
|
||||||
default_folder: string;
|
default_folder: string;
|
||||||
|
|
||||||
@@ -1907,6 +1911,8 @@ export namespace main {
|
|||||||
this.folder = source["folder"];
|
this.folder = source["folder"];
|
||||||
this.rotation = source["rotation"];
|
this.rotation = source["rotation"];
|
||||||
this.zip = source["zip"];
|
this.zip = source["zip"];
|
||||||
|
this.every_exit = source["every_exit"];
|
||||||
|
this.keep_all = source["keep_all"];
|
||||||
this.last_backup_at = source["last_backup_at"];
|
this.last_backup_at = source["last_backup_at"];
|
||||||
this.default_folder = source["default_folder"];
|
this.default_folder = source["default_folder"];
|
||||||
}
|
}
|
||||||
@@ -2635,6 +2641,7 @@ export namespace main {
|
|||||||
subject: string;
|
subject: string;
|
||||||
body: string;
|
body: string;
|
||||||
auto_send: boolean;
|
auto_send: boolean;
|
||||||
|
default_message: string;
|
||||||
|
|
||||||
static createFrom(source: any = {}) {
|
static createFrom(source: any = {}) {
|
||||||
return new QSLEmailTemplates(source);
|
return new QSLEmailTemplates(source);
|
||||||
@@ -2645,6 +2652,7 @@ export namespace main {
|
|||||||
this.subject = source["subject"];
|
this.subject = source["subject"];
|
||||||
this.body = source["body"];
|
this.body = source["body"];
|
||||||
this.auto_send = source["auto_send"];
|
this.auto_send = source["auto_send"];
|
||||||
|
this.default_message = source["default_message"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class QSLFontInfo {
|
export class QSLFontInfo {
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ type Def struct {
|
|||||||
Pattern string `json:"pattern"` // award-level Go regexp; group 1 = reference
|
Pattern string `json:"pattern"` // award-level Go regexp; group 1 = reference
|
||||||
LeadingStr string `json:"leading_str,omitempty"` // strip this prefix before matching
|
LeadingStr string `json:"leading_str,omitempty"` // strip this prefix before matching
|
||||||
TrailingStr string `json:"trailing_str,omitempty"` // strip this suffix before matching
|
TrailingStr string `json:"trailing_str,omitempty"` // strip this suffix before matching
|
||||||
|
Prefix string `json:"prefix,omitempty"` // prepended to each found reference (e.g. captured "01" + "D" → "D01"), same as OrRule.Prefix
|
||||||
Dynamic bool `json:"dynamic,omitempty"` // references not predefined (any value counts)
|
Dynamic bool `json:"dynamic,omitempty"` // references not predefined (any value counts)
|
||||||
// OneRefPerQSO refuses an AMBIGUOUS match rather than guessing.
|
// OneRefPerQSO refuses an AMBIGUOUS match rather than guessing.
|
||||||
//
|
//
|
||||||
@@ -960,7 +961,7 @@ func candidatesTrace(d *Def, re *regexp.Regexp, q *qso.QSO, rl refList, hasList
|
|||||||
// Testing the raw candidate would call that a hit, skip every fallback, and
|
// Testing the raw candidate would call that a hit, skip every fallback, and
|
||||||
// only then drop it as unlisted — leaving the QSO unmatched even though the
|
// only then drop it as unlisted — leaving the QSO unmatched even though the
|
||||||
// next rule ("find the code inside the QTH") would have found BG.
|
// next rule ("find the code inside the QTH") would have found BG.
|
||||||
found := run("primary", d.Field, d.MatchBy, d.Pattern, re, d.ExactMatch, d.LeadingStr, d.TrailingStr, "")
|
found := run("primary", d.Field, d.MatchBy, d.Pattern, re, d.ExactMatch, d.LeadingStr, d.TrailingStr, d.Prefix)
|
||||||
for i := range d.OrRules {
|
for i := range d.OrRules {
|
||||||
r := &d.OrRules[i]
|
r := &d.OrRules[i]
|
||||||
label := fmt.Sprintf("OR %d", i+1)
|
label := fmt.Sprintf("OR %d", i+1)
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ import (
|
|||||||
// every time we add a field).
|
// every time we add a field).
|
||||||
type Settings struct {
|
type Settings struct {
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
Folder string `json:"folder"` // empty → DefaultFolder
|
Folder string `json:"folder"` // empty → DefaultFolder
|
||||||
Rotation int `json:"rotation"` // how many backups to keep; 0/neg = 5
|
Rotation int `json:"rotation"` // how many backups to keep; 0/neg = 5
|
||||||
Zip bool `json:"zip"` // compress with deflate
|
Zip bool `json:"zip"` // compress with deflate
|
||||||
LastBackupAt string `json:"last_backup_at"`// RFC3339; empty if never
|
LastBackupAt string `json:"last_backup_at"` // RFC3339; empty if never
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultFolder returns the folder used when Settings.Folder is empty.
|
// DefaultFolder returns the folder used when Settings.Folder is empty.
|
||||||
@@ -44,7 +44,7 @@ func DefaultFolder(dataDir string) string {
|
|||||||
// statement (no torn-copy window while the app keeps writing), and compacts
|
// statement (no torn-copy window while the app keeps writing), and compacts
|
||||||
// the destination as a bonus. It replaces the old "checkpoint + raw io.Copy",
|
// the destination as a bonus. It replaces the old "checkpoint + raw io.Copy",
|
||||||
// which could capture a half-written page during a concurrent write.
|
// which could capture a half-written page during a concurrent write.
|
||||||
func Run(ctx context.Context, dbConn *sql.DB, dbPath, folder string, rotation int, doZip bool, prefix string) (string, error) {
|
func Run(ctx context.Context, dbConn *sql.DB, dbPath, folder string, rotation int, doZip bool, prefix string, unique bool) (string, error) {
|
||||||
if dbConn == nil {
|
if dbConn == nil {
|
||||||
return "", fmt.Errorf("nil db connection")
|
return "", fmt.Errorf("nil db connection")
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,12 @@ func Run(ctx context.Context, dbConn *sql.DB, dbPath, folder string, rotation in
|
|||||||
return "", fmt.Errorf("create backup folder: %w", err)
|
return "", fmt.Errorf("create backup folder: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// One file per DAY by default (same-day runs overwrite). With `unique`, add the
|
||||||
|
// time so every run is a distinct file — rotation still keeps the newest N.
|
||||||
stamp := time.Now().Format("2006-01-02")
|
stamp := time.Now().Format("2006-01-02")
|
||||||
|
if unique {
|
||||||
|
stamp = time.Now().Format("2006-01-02-150405")
|
||||||
|
}
|
||||||
base := fmt.Sprintf("%s-%s", prefix, stamp)
|
base := fmt.Sprintf("%s-%s", prefix, stamp)
|
||||||
|
|
||||||
// VACUUM INTO requires a non-existent target → use a temp file, then
|
// VACUUM INTO requires a non-existent target → use a temp file, then
|
||||||
@@ -106,7 +111,7 @@ func Run(ctx context.Context, dbConn *sql.DB, dbPath, folder string, rotation in
|
|||||||
// log lives on a shared MySQL server, where VACUUM INTO can't snapshot it — an
|
// log lives on a shared MySQL server, where VACUUM INTO can't snapshot it — an
|
||||||
// ADIF export is a portable, re-importable backup of the actual contacts.
|
// ADIF export is a portable, re-importable backup of the actual contacts.
|
||||||
// writeADIF must write the full ADIF to the path it's handed.
|
// writeADIF must write the full ADIF to the path it's handed.
|
||||||
func RunADIF(folder string, rotation int, doZip bool, writeADIF func(path string) error) (string, error) {
|
func RunADIF(folder string, rotation int, doZip bool, unique bool, writeADIF func(path string) error) (string, error) {
|
||||||
if rotation <= 0 {
|
if rotation <= 0 {
|
||||||
rotation = 5
|
rotation = 5
|
||||||
}
|
}
|
||||||
@@ -116,7 +121,11 @@ func RunADIF(folder string, rotation int, doZip bool, writeADIF func(path string
|
|||||||
if err := os.MkdirAll(folder, 0o755); err != nil {
|
if err := os.MkdirAll(folder, 0o755); err != nil {
|
||||||
return "", fmt.Errorf("create backup folder: %w", err)
|
return "", fmt.Errorf("create backup folder: %w", err)
|
||||||
}
|
}
|
||||||
base := "opslog-log-" + time.Now().Format("2006-01-02")
|
stamp := time.Now().Format("2006-01-02")
|
||||||
|
if unique {
|
||||||
|
stamp = time.Now().Format("2006-01-02-150405")
|
||||||
|
}
|
||||||
|
base := "opslog-log-" + stamp
|
||||||
tmp := filepath.Join(folder, base+".adi.tmp")
|
tmp := filepath.Join(folder, base+".adi.tmp")
|
||||||
_ = os.Remove(tmp)
|
_ = os.Remove(tmp)
|
||||||
if err := writeADIF(tmp); err != nil {
|
if err := writeADIF(tmp); err != nil {
|
||||||
|
|||||||
+32
-1
@@ -62,6 +62,10 @@ type Kenwood struct {
|
|||||||
// leave the rig's current mode untouched (safest for a TS-590SG/TS-990S whose
|
// leave the rig's current mode untouched (safest for a TS-590SG/TS-990S whose
|
||||||
// data mode is a USB modifier the operator sets on the rig). See SetMode.
|
// data mode is a USB modifier the operator sets on the rig). See SetMode.
|
||||||
dataMode string
|
dataMode string
|
||||||
|
// elecraft marks a K3/K4 (the "Elecraft" backend). It reuses this Kenwood-dialect
|
||||||
|
// client but, being an Elecraft, always drives digital modes to DATA A (MD6+DT0)
|
||||||
|
// — the sub-mode FT8 audio needs — instead of going through the dataMode option.
|
||||||
|
elecraft bool
|
||||||
|
|
||||||
mu sync.Mutex
|
mu sync.Mutex
|
||||||
port serial.Port
|
port serial.Port
|
||||||
@@ -391,11 +395,30 @@ func (k *Kenwood) SetMode(mode string) error {
|
|||||||
// mode digit fits every rig, so the operator picks: keep the rig's mode, use
|
// mode digit fits every rig, so the operator picks: keep the rig's mode, use
|
||||||
// MD6 (K3/K4 DATA), or fall through to the default USB from kenwoodModeDigit.
|
// MD6 (K3/K4 DATA), or fall through to the default USB from kenwoodModeDigit.
|
||||||
if isKenwoodDataMode(mode) {
|
if isKenwoodDataMode(mode) {
|
||||||
|
// An Elecraft always uses DATA A for a soundcard digital mode — that's what
|
||||||
|
// the "Elecraft" backend means, so the dataMode option doesn't apply.
|
||||||
|
if k.elecraft {
|
||||||
|
if err := k.write("MD6;"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return k.write("DT0;")
|
||||||
|
}
|
||||||
switch k.dataMode {
|
switch k.dataMode {
|
||||||
case "keep":
|
case "keep":
|
||||||
return nil // leave whatever data mode the operator set on the rig
|
return nil // leave whatever data mode the operator set on the rig
|
||||||
case "data":
|
case "data":
|
||||||
return k.write("MD6;") // Elecraft K3/K4 DATA mode
|
// Elecraft K3/K4 DATA mode (MD6) PLUS the DATA-A submode (DT0). MD6 alone
|
||||||
|
// can leave the rig in an FSK/PSK data submode (from a prior RTTY/PSK
|
||||||
|
// session), where FT8 keys the transmitter but the rear sound-card audio
|
||||||
|
// never modulates — "transmits but nothing comes out". DT0 forces DATA A,
|
||||||
|
// the audio submode FT8 needs. This is the Elecraft path (the option is
|
||||||
|
// labelled K3/K4); a real K3/K4 answers DT with nothing. A plain Kenwood
|
||||||
|
// has no DT command and would "?;" it — but that's a misconfiguration
|
||||||
|
// (pick USB there), and IF is never latched so the link self-recovers.
|
||||||
|
if err := k.write("MD6;"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return k.write("DT0;")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d := kenwoodModeDigit(mode, k.curFreq)
|
d := kenwoodModeDigit(mode, k.curFreq)
|
||||||
@@ -413,6 +436,14 @@ func (k *Kenwood) SetDataMode(m string) {
|
|||||||
k.mu.Unlock()
|
k.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetElecraft marks this client as driving a K3/K4 (the "Elecraft" backend), so
|
||||||
|
// digital modes always land in DATA A (MD6+DT0). Set before Start.
|
||||||
|
func (k *Kenwood) SetElecraft(v bool) {
|
||||||
|
k.mu.Lock()
|
||||||
|
k.elecraft = v
|
||||||
|
k.mu.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
// isKenwoodDataMode reports whether a mode name is a soundcard/data mode (FT8,
|
// isKenwoodDataMode reports whether a mode name is a soundcard/data mode (FT8,
|
||||||
// PSK, JT…) rather than a voice/CW/RTTY mode the rig sets natively.
|
// PSK, JT…) rather than a voice/CW/RTTY mode the rig sets natively.
|
||||||
func isKenwoodDataMode(mode string) bool {
|
func isKenwoodDataMode(mode string) bool {
|
||||||
|
|||||||
@@ -734,7 +734,10 @@ func placeQSOBox(profile ProfileInfo, zone pxRect, occupied []pxRect) QSOBox {
|
|||||||
BG: "#ffffff", BGOpacity: 0.88, Radius: 12,
|
BG: "#ffffff", BGOpacity: 0.88, Radius: 12,
|
||||||
Title: "Confirming QSO with {qso.callsign}",
|
Title: "Confirming QSO with {qso.callsign}",
|
||||||
Fields: []string{"qso_date", "time_on", "band", "mode", "rst_sent"},
|
Fields: []string{"qso_date", "time_on", "band", "mode", "rst_sent"},
|
||||||
Footer: "{qso.qsl_msg}",
|
// PSE/TNX stamp (auto: TNX if a QSL was received, else PSE QSL) leads the
|
||||||
|
// message. {qso.pse_tnx} is a normal token — it can be moved to its own
|
||||||
|
// element anywhere on the card in the designer.
|
||||||
|
Footer: "{qso.pse_tnx} {qso.qsl_msg}",
|
||||||
}
|
}
|
||||||
box.Y = cardH - box.H - 110
|
box.Y = cardH - box.H - 110
|
||||||
if zone.y+zone.h/2 > cardH/2 {
|
if zone.y+zone.h/2 > cardH/2 {
|
||||||
|
|||||||
Reference in New Issue
Block a user