Skip to content

Commit

Permalink
Part of Issue #36 - Merge branch 'naqp' into 36-fd-prototype
Browse files Browse the repository at this point in the history
Adds NCJ NAQP Contest
  • Loading branch information
w7sst committed Sep 30, 2022
2 parents ea3e9fa + 8943b5d commit e3d2807
Show file tree
Hide file tree
Showing 10 changed files with 15,281 additions and 12 deletions.
13 changes: 12 additions & 1 deletion DxStn.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
interface

uses
SysUtils, Classes, Station, RndFunc, Dialogs, Ini, ARRLFD, CWOPS,
SysUtils, Classes, Station, RndFunc, Dialogs, Ini, ARRLFD, NAQP, CWOPS,
CallLst, Qsb, DxOper, Log, SndTypes;

type
Expand Down Expand Up @@ -50,6 +50,10 @@ constructor TDxStation.CreateStation;
Operid := gARRLFD.pickStation();
MyCall := gARRLFD.getCall(Operid);
end;
scNaQp: begin
Operid := gNAQP.pickStation();
MyCall := gNAQP.getCall(Operid);
end;
else
MyCall := PickCall; // Pick one Callsign from Calllist
end;
Expand All @@ -73,6 +77,12 @@ constructor TDxStation.CreateStation;
Exch2 := gARRLFD.getExch2(Operid);
UserText := gARRLFD.getUserText(Operid);
end;
scNaQp: begin
Exch1 := gNAQP.getExch1(Operid);
OpName := Exch1; // TODO - refactor etOpName to use Exch1
Exch2 := gNAQP.getExch2(Operid);
UserText := gNAQP.getUserText(Operid);
end;
else
NR := Oper.GetNR;
end;
Expand Down Expand Up @@ -206,6 +216,7 @@ procedure TDxStation.DataToLastQso;
etSerialNr: TrueExch2 := IntToStr(Self.NR);
etCwopsNumber: TrueExch2 := IntToStr(Self.NR);
etArrlSection: TrueExch2 := Self.Exch2;
etStateProv: TrueExch2 := Self.Exch2;
else
assert(false);
end;
Expand Down
14 changes: 13 additions & 1 deletion Ini.pas
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface

DEFAULTWEBSERVER = 'http://www.dxatlas.com/MorseRunner/MrScore.asp';
type
TSimContest = (scWpx, scCwt, scFieldDay, scHst);
TSimContest = (scWpx, scCwt, scFieldDay, scNaQp, scHst);
TRunMode = (rmStop, rmPileup, rmSingle, rmWpx, rmHst);

// Exchange Field #1 types
Expand Down Expand Up @@ -89,6 +89,16 @@ TContestDefinition = record
T:scFieldDay),
// expecting two strings [Class,Section] (e.g. 3A OR)

(Name: 'NCJ NAQP';
Key: 'NAQP';
ExchType1: etOpName;
ExchType2: etStateProv;
ExchFieldEditable: True;
ExchDefault: 'MIKE OR';
Msg: '''<name> <state-prov>'' (e.g. MIKE OR)';
T:scNaQp),
// expecting two strings [Name,State-Prov] (e.g. MIKE OR)

(Name: 'HST (High Speed Test)';
Key: 'HST';
ExchType1: etRST;
Expand Down Expand Up @@ -170,6 +180,7 @@ procedure FromIni;
UserExchangeTbl[scCwt] := ReadString(SEC_STN, 'CwtExchange',
Format('%s 1234', [HamName]));
UserExchangeTbl[scFieldDay] := ReadString(SEC_STN, 'ArrlFdExchange', '3A OR');
UserExchangeTbl[scNaQp] := ReadString(SEC_STN, 'NAQPExchange', 'MIKE OR');
UserExchangeTbl[scHst] := ReadString(SEC_STN, 'HSTExchange', '5NN #');

ArrlClass := ReadString(SEC_STN, 'ArrlClass', '3A');
Expand Down Expand Up @@ -246,6 +257,7 @@ procedure ToIni;
WriteString(SEC_STN, 'CqWpxExchange', UserExchangeTbl[scWpx]);
WriteString(SEC_STN, 'CwtExchange', UserExchangeTbl[scCwt]);
WriteString(SEC_STN, 'ArrlFdExchange', UserExchangeTbl[scFieldDay]);
WriteString(SEC_STN, 'NAQPExchange', UserExchangeTbl[scNaQp]);
WriteString(SEC_STN, 'HSTExchange', UserExchangeTbl[scHst]);

WriteString(SEC_STN, 'ArrlClass', ArrlClass);
Expand Down
17 changes: 13 additions & 4 deletions Log.pas
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface

uses
Windows, SysUtils, Classes, Graphics, RndFunc, Math, Controls,
StdCtrls, ExtCtrls, ARRL, ARRLFD, PerlRegEx, pcre;
StdCtrls, ExtCtrls, ARRL, ARRLFD, NAQP, PerlRegEx, pcre;


procedure SaveQso;
Expand Down Expand Up @@ -147,6 +147,8 @@ procedure UpdateSbar(const ACallsign: string);
case Ini.SimContest of
scFieldDay:
s := gArrlFd.GetStationInfo(ACallsign);
scNaQp:
s := gNAQP.GetStationInfo(ACallsign);
else
s := ARRLDX.Search(ACallsign);
end;
Expand Down Expand Up @@ -183,6 +185,8 @@ procedure Clear;
ScoreTableSetTitle('UTC', 'Call', 'Name', 'NR', 'Pref', 'Chk', 'Wpm');
scFieldDay:
ScoreTableSetTitle('UTC', 'Call', 'Class', 'Section', 'Pref', 'Chk', 'Wpm');
scNaQp:
ScoreTableSetTitle('UTC', 'Call', 'Name', 'State', 'Pref', 'Chk', 'Wpm');
else
ScoreTableSetTitle('UTC', 'Call', 'Recv', 'Sent', 'Pref', 'Chk', 'Wpm');
end;
Expand Down Expand Up @@ -418,7 +422,7 @@ procedure SaveQso;
etSerialNr: Result := Length(text) > 0;
etCwopsNumber: Result := Length(text) > 0;
etArrlSection: Result := Length(text) > 1;
//etStateProv:
etStateProv: Result := Length(text) > 1;
//etCqZone:
//etItuZone:
//etAge:
Expand Down Expand Up @@ -462,7 +466,7 @@ procedure SaveQso;
etSerialNr: Qso.Nr := StrToInt(Edit3.Text);
etCwopsNumber: Qso.Nr := StrToInt(Edit3.Text);
etArrlSection: Qso.Exch2 := Edit3.Text;
//etStateProv:
etStateProv: Qso.Exch2 := Edit3.Text;
//etCqZone:
//etItuZone:
//etAge:
Expand Down Expand Up @@ -540,6 +544,11 @@ procedure LastQsoToScreen;
, Exch1
, Exch2
, Pfx, Err, format('%.2d', [TrueWpm]));
scNaQp:
ScoreTableInsert(FormatDateTime('hh:nn:ss', t), Call
, Exch1
, Exch2
, Pfx, Err, format('%.2d', [TrueWpm]));
scWpx, scHst:
ScoreTableInsert(FormatDateTime('hh:nn:ss', t), Call
, format('%.3d %.4d', [Rst, Nr])
Expand Down Expand Up @@ -573,7 +582,7 @@ procedure CheckErr;
etSerialNr: if TrueNr <> NR then Err := 'NR ';
etCwopsNumber: if TrueNr <> NR then Err := 'NR ';
etArrlSection: if TrueExch2 <> Exch2 then Err := 'SEC';
//etStateProv:
etStateProv: if TrueExch2 <> Exch2 then Err := 'ST ';
//etCqZone:
//etItuZone:
//etAge:
Expand Down
1 change: 1 addition & 0 deletions Main.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,7 @@ object MainForm: TMainForm
'CQ WPX'
'CWOPS CWT'
'ARRL Field Day'
'NCJ NAQP'
'HST (High Speed Test)')
end
object ExchangeEdit: TEdit
Expand Down
20 changes: 17 additions & 3 deletions Main.pas
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface
Buttons, SndCustm, SndOut, Contest, Ini, MorseKey, CallLst,
VolmSldr, VolumCtl, StdCtrls, Station, Menus, ExtCtrls, MAth,
ComCtrls, Spin, SndTypes, ShellApi, jpeg, ToolWin, ImgList, Crc32,
WavFile, IniFiles, Idhttp, ARRL, ARRLFD, CWOPS, System.ImageList;
WavFile, IniFiles, Idhttp, ARRL, ARRLFD, NAQP, CWOPS, System.ImageList;

const
WM_TBDOWN = WM_USER+1;
Expand Down Expand Up @@ -439,6 +439,7 @@ procedure TMainForm.FormCreate(Sender: TObject);
// Adding a contest: load call history file (be sure to delete it below).
ARRLDX:= TARRL.Create;
gARRLFD := TArrlFieldDay.Create;
gNAQP := TNcjNaQp.Create;
CWOPSCWT := TCWOPS.Create;

Histo:= THisto.Create(PaintBox1);
Expand All @@ -459,6 +460,7 @@ procedure TMainForm.FormDestroy(Sender: TObject);
ToIni;
ARRLDX.Free;
gARRLFD.Free;
gNAQP.Free;
CWOPSCWT.Free;
Histo.Free;
Tst.Free;
Expand Down Expand Up @@ -577,6 +579,12 @@ procedure TMainForm.Edit3KeyPress(Sender: TObject; var Key: Char);
if not CharInSet(Key, ['A'..'Z', 'a'..'z', #8]) then
Key := #0;
end;
etStateProv:
begin
// valid State/Prov characters (e.g. OR or BC)
if not CharInSet(Key, ['A'..'Z', 'a'..'z', #8]) then
Key := #0;
end;
else
assert(false, Format('invalid exchange field 2 type: %s',
[ToStr(ExchangeField2Type)]));
Expand Down Expand Up @@ -848,7 +856,7 @@ procedure TMainForm.ExchangeEditExit(Sender: TObject);
procedure TMainForm.SetContest(AContestNum: TSimContest);
begin
// validate selected contest
if not (AContestNum in [scWpx, scCwt, scFieldDay, scHst]) then
if not (AContestNum in [scWpx, scCwt, scFieldDay, scNaQp, scHst]) then
begin
ShowMessage('The selected contest is not yet supported.');
SimContestCombo.ItemIndex:= Ord(Ini.SimContest);
Expand Down Expand Up @@ -1074,7 +1082,13 @@ procedure TMainForm.SetMyExch2(const AExchType: TExchange2Type;
Tst.Me.Exch2 := Avalue;
if BDebugExchSettings then Edit3.Text := Avalue; // testing only
end;
//etStateProv:
etStateProv: // e.g. NAQP (OR)
begin
// 'expecting State or Providence (e.g. OR)'
Ini.UserExchange2[SimContest] := Avalue;
Tst.Me.Exch2 := Avalue;
if BDebugExchSettings then Edit3.Text := Avalue; // testing only
end;
//etCqZone:
//etItuZone:
//etAge:
Expand Down
1 change: 1 addition & 0 deletions MorseRunner.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ uses
PerlRegEx in 'PerlRegEx\PerlRegEx.pas',
ARRL in 'ARRL.pas',
ArrlFd in 'ArrlFd.pas',
NaQp in 'NaQp.pas',
CWOPS in 'CWOPS.pas';

{$R *.RES}
Expand Down
5 changes: 2 additions & 3 deletions MorseRunner.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>
<Profile Condition="'$(Platform)'=='Win32'">AAAA</Profile>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
Expand Down Expand Up @@ -81,7 +80,6 @@
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<Icon_MainIcon>MorseRunner_Icon4.ico</Icon_MainIcon>
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
Expand Down Expand Up @@ -155,6 +153,7 @@
<DCCReference Include="ARRL.pas"/>
<DCCReference Include="ArrlFd.pas"/>
<DCCReference Include="CWOPS.pas"/>
<DCCReference Include="NaQp.pas"/>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
Expand Down Expand Up @@ -218,7 +217,7 @@
</Excluded_Packages>
</Delphi.Personality>
<Platforms>
<Platform value="Win32" Profile="AAAA">True</Platform>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
<Deployment Version="3">
Expand Down
Loading

0 comments on commit e3d2807

Please sign in to comment.