Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/CloudlogHelper/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ private async Task PostExec(IClassicDesktopStyleApplicationLifetime desktop)
{
var nmiExit = new NativeMenuItem
{
Header = TranslationHelper.GetString(LangKeys.exit),
Header = TranslationHelper.GetString(LangKeys.Exit),
Command = _exitCommand
};
var nmiOpen = new NativeMenuItem
{
Header = TranslationHelper.GetString(LangKeys.open),
Header = TranslationHelper.GetString(LangKeys.Open),
Command = _openCommand
};

Expand Down Expand Up @@ -231,8 +231,8 @@ private async Task<bool> _requestDisclaimerAgreementAsync(Window splashLevel)
await Dispatcher.UIThread.InvokeAsync(async () =>
{
splashLevel.Topmost = false;
var accept = TranslationHelper.GetString(LangKeys.accept);
var deny = TranslationHelper.GetString(LangKeys.deny);
var accept = TranslationHelper.GetString(LangKeys.Accept);
var deny = TranslationHelper.GetString(LangKeys.Deny);
var clickResult = await msgBox.DoShowCustomMessageboxDialogAsync(new MessageBoxCustomParams
{
ButtonDefinitions = new[]
Expand All @@ -247,7 +247,7 @@ await Dispatcher.UIThread.InvokeAsync(async () =>
}
},
ContentTitle = "User Agreement",
ContentMessage = TranslationHelper.GetString(LangKeys.disclaimer)
ContentMessage = TranslationHelper.GetString(LangKeys.Disclaimer)
.Replace("{1}", VersionInfo.Version),
Icon = Icon.Info,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
Expand Down Expand Up @@ -297,7 +297,7 @@ private Task PreExec(IClassicDesktopStyleApplicationLifetime desktop)
Directory.CreateDirectory(ApplicationStartUpUtil.GetConfigDir());
_mutex = new Mutex(true, DefaultConfigs.MutexId, out var createdNew);
// check if init is allowed?
if (!createdNew) throw new DuplicateProcessException(TranslationHelper.GetString(LangKeys.dupeinstance));
if (!createdNew) throw new DuplicateProcessException(TranslationHelper.GetString(LangKeys.DuplicateInstance));

return Task.CompletedTask;
}
Expand Down
16 changes: 13 additions & 3 deletions src/CloudlogHelper/Converters/UploadStatusToLangKeyConverter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System;
using System.Globalization;
using Avalonia.Data.Converters;
using CloudlogHelper.Enums;
using CloudlogHelper.Resources;
using CloudlogHelper.Utils;

namespace CloudlogHelper.Converters;
Expand All @@ -9,12 +11,20 @@ public class UploadStatusToLangKeyConverter : IValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (value is null) return "Unknown";
return "t_" + value;
return value switch
{
UploadStatus.Uploading => LangKeys.UploadStatusUploading,
UploadStatus.Retrying => LangKeys.UploadStatusRetrying,
UploadStatus.Pending => LangKeys.UploadStatusPending,
UploadStatus.Success => LangKeys.UploadStatusSuccess,
UploadStatus.Fail => LangKeys.UploadStatusFailed,
UploadStatus.Ignored => LangKeys.UploadStatusIgnored,
_ => LangKeys.Unknown
};
}

public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
8 changes: 4 additions & 4 deletions src/CloudlogHelper/LogService/ClublogThirdPartyLogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ public class ClublogThirdPartyLogService : ThirdPartyLogService
private const string ClublogTestEndpoint = "https://clublog.org/getadif.php";


[UserInput("callsign", Description = "Enter your callsign registered at clublog.")]
[UserInput(nameof(LangKeys.Callsign), Description = "Enter your callsign registered at clublog.")]
public string Callsign { get; set; }

[UserInput("password", InputType = FieldType.Password)]
[UserInput(nameof(LangKeys.Password), InputType = FieldType.Password)]
public string Password { get; set; }

[UserInput("email")] public string Email { get; set; }
[UserInput(nameof(LangKeys.Email))] public string Email { get; set; }


public override async Task TestConnectionAsync(CancellationToken token)
Expand Down Expand Up @@ -87,4 +87,4 @@ public override async Task UploadQSOAsync(string? adif, CancellationToken token)
if (code == 200) return;
throw new Exception(responseText);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ namespace CloudlogHelper.LogService;
[LogService("Custom API", Description = "Custom API Log Service")]
public class CustomAPIThirdPartyLogService : ThirdPartyLogService
{
[UserInput("qsouploadendpoint", InputType = FieldType.Text, IsRequired = false, Description = "Endpoints for uploading QSO info. Spilt by Semicolon. See readme for more.")]
[UserInput(nameof(LangKeys.QsoUploadEndpoint), InputType = FieldType.Text, IsRequired = false, Description = "Endpoints for uploading QSO info. Spilt by Semicolon. See readme for more.")]
public string QSOEndpoint { get; set; }

[UserInput("riginfouploadendpoint", InputType = FieldType.Text, IsRequired = false, Description = "Endpoints for uploading RIG info. Spilt by Semicolon. See readme for more.")]
[UserInput(nameof(LangKeys.RigInfoUploadEndpoint), InputType = FieldType.Text, IsRequired = false, Description = "Endpoints for uploading RIG info. Spilt by Semicolon. See readme for more.")]
public string RIGEndpoint { get; set; }

[UserInput("uploadriginfo", InputType = FieldType.CheckBox)]
[UserInput(nameof(LangKeys.UploadRigInfo), InputType = FieldType.CheckBox)]
public bool AllowUploadRigInfo { get; set; } = false;

public override Task TestConnectionAsync(CancellationToken token)
Expand Down Expand Up @@ -72,4 +72,4 @@ public override async Task UploadRigInfoAsync(RadioData rigData, CancellationTok

await Task.WhenAll(eps);
}
}
}
8 changes: 4 additions & 4 deletions src/CloudlogHelper/LogService/EqslThirdPartyLogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public class EqslThirdPartyLogService : ThirdPartyLogService
private const string EqslQsoUploadEndpoint =
"https://www.eQSL.cc/qslcard/importADIF.cfm";

[UserInput("username")] public string Username { get; set; }
[UserInput(nameof(LangKeys.Username))] public string Username { get; set; }

[UserInput("password", InputType = FieldType.Password)]
[UserInput(nameof(LangKeys.Password), InputType = FieldType.Password)]
public string Password { get; set; }

[UserInput("qthnickname", IsRequired = false)]
[UserInput(nameof(LangKeys.QthNickname), IsRequired = false)]
public string QTHNickname { get; set; }


Expand Down Expand Up @@ -92,4 +92,4 @@ public override async Task UploadQSOAsync(string? adif, CancellationToken token)

throw new Exception("Fail log eQSL.cc due to unknown reason.");
}
}
}
6 changes: 3 additions & 3 deletions src/CloudlogHelper/LogService/HRDLogThirdPartyLogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public class HRDLogThirdPartyLogService : ThirdPartyLogService
private const string HRDLOGUploadEndpoint = "https://robot.hrdlog.net/NewEntry.aspx";
private const string HRDLOGOnAirEndpoint = "https://robot.hrdlog.net/OnAir.aspx";

[UserInput("callsign")] public string Callsign { get; set; }
[UserInput(nameof(LangKeys.Callsign))] public string Callsign { get; set; }

[UserInput("Code", Description = "Upload code received via email after registration to HRDLOG.net")]
public string Code { get; set; }

[UserInput("uploadriginfo", InputType = FieldType.CheckBox)]
[UserInput(nameof(LangKeys.UploadRigInfo), InputType = FieldType.CheckBox)]
public bool AllowUploadRigInfo { get; set; } = false;

public override async Task TestConnectionAsync(CancellationToken token)
Expand Down Expand Up @@ -105,4 +105,4 @@ public override async Task UploadRigInfoAsync(RadioData rigData, CancellationTok

throw new Exception($"Error parsing result: {responseText.Trim()}");
}
}
}
8 changes: 4 additions & 4 deletions src/CloudlogHelper/LogService/HamCQThirdPartyLogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class HamCQThirdPartyLogService : ThirdPartyLogService
{
private const string HamCQQsoUploadEndpoint = "https://api.hamcq.cn/v1/logbook?from=gridtracker";

[UserInput("apikey")] public string ApiKey { get; set; }
[UserInput(nameof(LangKeys.ApiKey))] public string ApiKey { get; set; }

public override Task TestConnectionAsync(CancellationToken token)
{
Expand Down Expand Up @@ -43,9 +43,9 @@ public override async Task UploadQSOAsync(string? adif, CancellationToken token)
var node = JsonNode.Parse(responseText);
if (node is JsonObject obj)
{
throw new Exception($"HamCQ Error: {TranslationHelper.GetString(LangKeys.invalidapikey)} ({obj["message"]})");
throw new Exception($"HamCQ Error: {TranslationHelper.GetString(LangKeys.InvalidApiKey)} ({obj["message"]})");
}

throw new Exception($"HamCQ Error: {TranslationHelper.GetString(LangKeys.invalidapikey)}({responseText})");
throw new Exception($"HamCQ Error: {TranslationHelper.GetString(LangKeys.InvalidApiKey)}({responseText})");
}
}
}
8 changes: 4 additions & 4 deletions src/CloudlogHelper/LogService/LoTWThirdPartyLogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public class LoTWThirdPartyLogService : ThirdPartyLogService

public string?[]? Stations = Array.Empty<string>();

[UserInput("tqslpath", InputType = FieldType.FilePicker)]
[UserInput(nameof(LangKeys.TqslPath), InputType = FieldType.FilePicker)]
public string LotwFilePath { get; set; }


[UserInput("stationname", InputType = FieldType.ComboBox, SelectionsArrayName = nameof(Stations))]
[UserInput(nameof(LangKeys.StationName), InputType = FieldType.ComboBox, SelectionsArrayName = nameof(Stations))]
public string? StationName { get; set; }

[UserInput("tqslpassword", InputType = FieldType.Password, IsRequired = false)]
[UserInput(nameof(LangKeys.TqslPassword), InputType = FieldType.Password, IsRequired = false)]
public string? TqslPassword { get; set; }

public override async Task TestConnectionAsync(CancellationToken token)
Expand Down Expand Up @@ -169,4 +169,4 @@ Stations is not null && Stations.Length > 0 &&
}
}
}
}
}
5 changes: 3 additions & 2 deletions src/CloudlogHelper/LogService/QRZThirdPartyLogService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Threading.Tasks;
using System.Web;
using CloudlogHelper.LogService.Attributes;
using CloudlogHelper.Resources;
using Flurl.Http;

namespace CloudlogHelper.LogService;
Expand All @@ -13,7 +14,7 @@ public class QRZThirdPartyLogService : ThirdPartyLogService
{
private const string QRZQsoUploadEndpoint = "https://logbook.qrz.com/api";

[UserInput("apikey", Description = "API Key of your logbook. Note you must have an" +
[UserInput(nameof(LangKeys.ApiKey), Description = "API Key of your logbook. Note you must have an" +
" active subscription of qrz to use this function.")]
public string ApiKey { get; set; }

Expand Down Expand Up @@ -46,4 +47,4 @@ public override async Task UploadQSOAsync(string? adif, CancellationToken token)
if (nameValueCollection.Get("RESULT") == "OK") return;
throw new Exception($"QRZ Test failed: {nameValueCollection.Get("REASON")?.Trim()}");
}
}
}
8 changes: 7 additions & 1 deletion src/CloudlogHelper/Models/ApplicationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public class ApplicationSettings : ReactiveValidationObject
[Reactive]
public ProgramShutdownMode ShutdownMode { get; set; } = ProgramShutdownMode.NotSpecified;

/// <summary>
/// Skip first-run wizard when application starts.
/// </summary>
[Reactive]
public bool SkipWizard { get; set; } = true;

/// <summary>
/// Some basic settings.
/// </summary>
Expand Down Expand Up @@ -65,4 +71,4 @@ public class ApplicationSettings : ReactiveValidationObject

[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(List<ThirdPartyLogService>))]
public ApplicationSettings(){}
}
}
6 changes: 3 additions & 3 deletions src/CloudlogHelper/Models/CloudlogSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public StationInfo? CloudlogStationInfo
set => CloudlogStationInfoId = value?.StationId;
}

[Reactive] public bool AutoQSOUploadEnabled { get; set; } = true;
[Reactive] public bool AutoRigUploadEnabled { get; set; } = true;
[Reactive] public bool AutoPollStationStatus { get; set; } = true;
[Reactive] public bool AutoQSOUploadEnabled { get; set; } = false;
[Reactive] public bool AutoRigUploadEnabled { get; set; } = false;
[Reactive] public bool AutoPollStationStatus { get; set; } = false;

[Reactive]
public ObservableCollection<StationInfo> AvailableCloudlogStationInfo { get; set; } = new();
Expand Down
3 changes: 3 additions & 0 deletions src/CloudlogHelper/Models/CommandlineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class CommandLineOptions
[Option("reinit-hamlib", HelpText = "Force reinitialize hamlib.")]
public bool ReinitHamlib { get; set; }

[Option("run-wizard", HelpText = "Run wizard.")]
public bool RunWizard { get; set; }

[Option("dev", HelpText = "Developer mode (throw exceptions).")]
public bool DeveloperMode { get; set; }

Expand Down
6 changes: 3 additions & 3 deletions src/CloudlogHelper/Models/FLRigSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ public void ReinitRules()
this.ClearValidationRules();
this.ValidationRule(x => x.FLRigPort,
SettingsValidation.CheckHttpPort,
TranslationHelper.GetString(LangKeys.invalidport)
TranslationHelper.GetString(LangKeys.InvalidPort)
);
this.ValidationRule(x => x.FLRigHost,
SettingsValidation.CheckHttpIp!,
TranslationHelper.GetString(LangKeys.invalidaddr)
TranslationHelper.GetString(LangKeys.InvalidAddress)
);
this.ValidationRule(x => x.PollInterval,
SettingsValidation.CheckInt,
TranslationHelper.GetString(LangKeys.pollintervalreq)
TranslationHelper.GetString(LangKeys.PollIntervalRequired)
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/CloudlogHelper/Models/HamlibSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,19 @@ public void ReinitRules()
this.ClearValidationRules();
this.ValidationRule(x => x.SelectedRigInfo,
st => st?.Id is not null,
TranslationHelper.GetString(LangKeys.notnull)
TranslationHelper.GetString(LangKeys.Required)
);
this.ValidationRule(x => x.SelectedPort,
SettingsValidation.CheckStringNotNull,
TranslationHelper.GetString(LangKeys.notnull)
TranslationHelper.GetString(LangKeys.Required)
);
this.ValidationRule(x => x.ExternalRigctldHostAddress,
IPAddrUtil.CheckAddress!,
TranslationHelper.GetString(LangKeys.invalidaddr)
TranslationHelper.GetString(LangKeys.InvalidAddress)
);
this.ValidationRule(x => x.PollInterval,
SettingsValidation.CheckInt,
TranslationHelper.GetString(LangKeys.pollintervalreq)
TranslationHelper.GetString(LangKeys.PollIntervalRequired)
);

// skip 4: refer to CloudlogHelper.ViewModels.SettingsWindowViewModel._initializeHamlibAsync
Expand Down
2 changes: 1 addition & 1 deletion src/CloudlogHelper/Models/OmniRigSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void ReinitRules()
this.ClearValidationRules();
this.ValidationRule(x => x.PollInterval,
SettingsValidation.CheckInt,
TranslationHelper.GetString(LangKeys.pollintervalreq)
TranslationHelper.GetString(LangKeys.PollIntervalRequired)
);
this.WhenAnyValue(
x => x.SelectedRig,
Expand Down
4 changes: 2 additions & 2 deletions src/CloudlogHelper/Models/QsoSyncAssistantSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ public void ReinitRules()

this.ValidationRule(x => x.CloudlogUserName,
SettingsValidation.CheckStringNotNull,
TranslationHelper.GetString(LangKeys.notnull)
TranslationHelper.GetString(LangKeys.Required)
);

this.ValidationRule(x => x.CloudlogPassword,
SettingsValidation.CheckStringNotNull,
TranslationHelper.GetString(LangKeys.notnull)
TranslationHelper.GetString(LangKeys.Required)
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/CloudlogHelper/Models/RecordedCallsignDetail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ public bool IsUploadable()
public string FormatToReadableContent(bool concise = false)
{
var template = TranslationHelper.GetString(concise
? LangKeys.qsoconcisetemplate
: LangKeys.qsotemplate);
? LangKeys.QsoConciseTemplate
: LangKeys.QsoTemplate);

return string.Format(template,
DXCall ?? "N/A",
Expand Down
4 changes: 2 additions & 2 deletions src/CloudlogHelper/Models/UDPServerSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void ReinitRules()
if (!int.TryParse(st, out var res)) return false;
return res is <= 65535 and >= 0;
},
TranslationHelper.GetString(LangKeys.invalidport)
TranslationHelper.GetString(LangKeys.InvalidPort)
);
this.ValidationRule(
x => x.RetryCount,
Expand All @@ -59,7 +59,7 @@ public void ReinitRules()
if (!int.TryParse(st, out var res)) return false;
return !string.IsNullOrEmpty(st) && res >= 0;
},
TranslationHelper.GetString(LangKeys.retrycountreq)
TranslationHelper.GetString(LangKeys.RetryCountRequired)
);
}

Expand Down
3 changes: 3 additions & 0 deletions src/CloudlogHelper/Resources/DefaultConfigs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ public class DefaultConfigs

public const string AvaresFlagTemplate = "avares://CloudlogHelper/Assets/Flags/";

public const int CoastlineOverlaySize = 1100;
public const double EarthRadiusKm = 6371.0;

/// <summary>
/// The default expiration time for the cached return values of the rigctld In seconds.
/// This is calculated dynamically when jtdx sending requests.
Expand Down
Loading
Loading