mirror of
https://github.com/ok2cqr/cqrlog.git
synced 2024-09-21 10:27:17 +00:00
-Added LocalDbg value -2 to adifimport and import progress
-Modified CVersion string compose -importprogress combined source code of lotw and eqsl process to "commonImport" procedure -fixed NewQSO remote adif to be sure that mode tag does not override submode if they are in order where submode comes first in record -moved lotw erro file to user home dir (as eqsl error is) It is easier to find from there than from hidden folder .config/cqrlog -changed errors found prompts to open error file from both lotw qnd eqsl imports. ERROR FILE OPENING DOES NOT WORK! Check next!
This commit is contained in:
parent
13307fd7af
commit
f1b8d784c5
@ -39,7 +39,7 @@
|
|||||||
</PublishOptions>
|
</PublishOptions>
|
||||||
<RunParams>
|
<RunParams>
|
||||||
<local>
|
<local>
|
||||||
<CommandLineParams Value="--DEBUG=0"/>
|
<CommandLineParams Value="--debug=0"/>
|
||||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||||
</local>
|
</local>
|
||||||
<environment>
|
<environment>
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<Modes Count="1">
|
<Modes Count="1">
|
||||||
<Mode0 Name="default">
|
<Mode0 Name="default">
|
||||||
<local>
|
<local>
|
||||||
<CommandLineParams Value="--DEBUG=0"/>
|
<CommandLineParams Value="--debug=0"/>
|
||||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||||
</local>
|
</local>
|
||||||
<environment>
|
<environment>
|
||||||
|
@ -55,6 +55,7 @@ begin
|
|||||||
Writeln(' 1 All debug messages');
|
Writeln(' 1 All debug messages');
|
||||||
Writeln(' 2 All debug messages + some additional RBNmonitor & DXCluster debugs');
|
Writeln(' 2 All debug messages + some additional RBNmonitor & DXCluster debugs');
|
||||||
Writeln('Negative values can be combined (binary bitwise OR)');
|
Writeln('Negative values can be combined (binary bitwise OR)');
|
||||||
|
Writeln(' -2 AdifImport & ImportProgress debug messages');
|
||||||
Writeln(' -4 Wsjtx remote & Worked grids debug messages');
|
Writeln(' -4 Wsjtx remote & Worked grids debug messages');
|
||||||
Writeln(' -8 CW keying & TRXControl debug messages');
|
Writeln(' -8 CW keying & TRXControl debug messages');
|
||||||
Writeln(' -16 Grayline map RBN debug messages');
|
Writeln(' -16 Grayline map RBN debug messages');
|
||||||
|
@ -141,6 +141,7 @@ type
|
|||||||
procedure mnuImportClick(Sender: TObject);
|
procedure mnuImportClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
LockSubMode : boolean; //if we replace mode with submode we set lock in case that submode and mode are in opposite order in qso record.
|
LockSubMode : boolean; //if we replace mode with submode we set lock in case that submode and mode are in opposite order in qso record.
|
||||||
|
LocalDbg : Boolean;
|
||||||
AbortImport : boolean;
|
AbortImport : boolean;
|
||||||
ERR_FILE : String;
|
ERR_FILE : String;
|
||||||
Do_Err_Import : Boolean;
|
Do_Err_Import : Boolean;
|
||||||
@ -164,6 +165,7 @@ type
|
|||||||
{ private declarations }
|
{ private declarations }
|
||||||
public
|
public
|
||||||
function getNextAdifTag(var vstup,prik,data:string):boolean;
|
function getNextAdifTag(var vstup,prik,data:string):boolean;
|
||||||
|
procedure OpenInTextEditor(OpenName:String);
|
||||||
{ public declarations }
|
{ public declarations }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -224,7 +226,7 @@ var z,x:longint;
|
|||||||
DataLen := 0
|
DataLen := 0
|
||||||
else
|
else
|
||||||
DataLen := StrToInt(slen);
|
DataLen := StrToInt(slen);
|
||||||
//if dmData.DebugLevel >=1 then Write('Got length:',DataLen);
|
//if LocalDbg then Write('Got length:',DataLen);
|
||||||
|
|
||||||
if z<>0 then
|
if z<>0 then
|
||||||
prik:=trim(copy(aaa,1,z-1))
|
prik:=trim(copy(aaa,1,z-1))
|
||||||
@ -235,14 +237,14 @@ var z,x:longint;
|
|||||||
|
|
||||||
z:=pos('<',aaa);
|
z:=pos('<',aaa);
|
||||||
i:= pos('_INTL',upcase(prik));
|
i:= pos('_INTL',upcase(prik));
|
||||||
//if dmData.DebugLevel >=1 then Write(' pos INTL:',i);
|
//if LocalDbg then Write(' pos INTL:',i);
|
||||||
if z=0 then
|
if z=0 then
|
||||||
begin
|
begin
|
||||||
if i>0 then //tags with '_intl' have UTF8 charactes
|
if i>0 then //tags with '_intl' have UTF8 charactes
|
||||||
Begin
|
Begin
|
||||||
prik:= copy(prik,1,i-1); //remove '_INTL'
|
prik:= copy(prik,1,i-1); //remove '_INTL'
|
||||||
data:=UTF8copy(aaa,1,DataLen);
|
data:=UTF8copy(aaa,1,DataLen);
|
||||||
//if dmData.DebugLevel >=1 then Write(' as UTF8');
|
//if LocalDbg then Write(' as UTF8');
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
data:=copy(aaa,1,DataLen);
|
data:=copy(aaa,1,DataLen);
|
||||||
@ -253,14 +255,14 @@ var z,x:longint;
|
|||||||
Begin
|
Begin
|
||||||
prik:= copy(prik,1,i-1); //remove '_INTL'
|
prik:= copy(prik,1,i-1); //remove '_INTL'
|
||||||
data:=UTF8copy(aaa,1,DataLen);
|
data:=UTF8copy(aaa,1,DataLen);
|
||||||
//if dmData.DebugLevel >=1 then Write(' as UTF8');
|
//if LocalDbg then Write(' as UTF8');
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
data:=copy(aaa,1,DataLen);
|
data:=copy(aaa,1,DataLen);
|
||||||
vstup:=copy(aaa,z,length(aaa))
|
vstup:=copy(aaa,z,length(aaa))
|
||||||
end;
|
end;
|
||||||
data :=trim(data);
|
data :=trim(data);
|
||||||
//if dmData.DebugLevel >=1 then Writeln(' for tag:',prik,' with data:',data);
|
//if LocalDbg then Writeln(' for tag:',prik,' with data:',data);
|
||||||
getNextAdifTag:=true
|
getNextAdifTag:=true
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -507,19 +509,19 @@ begin
|
|||||||
Q4.SQL.Text := 'SELECT nr FROM profiles WHERE locator='+QuotedStr(pLoc) +
|
Q4.SQL.Text := 'SELECT nr FROM profiles WHERE locator='+QuotedStr(pLoc) +
|
||||||
' and qth='+QuotedStr(pQTH)+' and rig='+QuotedStr(pEq) +
|
' and qth='+QuotedStr(pQTH)+' and rig='+QuotedStr(pEq) +
|
||||||
' and remarks='+QuotedStr(pNote);
|
' and remarks='+QuotedStr(pNote);
|
||||||
if dmData.DebugLevel >=1 then Writeln(Q4.SQL.Text);
|
if LocalDbg then Writeln(Q4.SQL.Text);
|
||||||
Q4.Open;
|
Q4.Open;
|
||||||
if Q4.Fields[0].AsInteger = 0 then
|
if Q4.Fields[0].AsInteger = 0 then
|
||||||
begin
|
begin
|
||||||
Q4.Close();
|
Q4.Close();
|
||||||
Q4.SQL.Text := 'select nr from profiles where nr = '+pProf;
|
Q4.SQL.Text := 'select nr from profiles where nr = '+pProf;
|
||||||
if dmData.DebugLevel >=1 then Writeln(Q4.SQL.Text);
|
if LocalDbg then Writeln(Q4.SQL.Text);
|
||||||
Q4.Open();
|
Q4.Open();
|
||||||
if (Q4.Fields[0].AsInteger > 0) then //if profile with this number doesnt exists,
|
if (Q4.Fields[0].AsInteger > 0) then //if profile with this number doesnt exists,
|
||||||
begin //we can save the number
|
begin //we can save the number
|
||||||
Q4.Close();
|
Q4.Close();
|
||||||
Q4.SQL.Text := 'select max(nr) from profiles';
|
Q4.SQL.Text := 'select max(nr) from profiles';
|
||||||
if dmData.DebugLevel >=1 then Writeln(Q4.SQL.Text);
|
if LocalDbg then Writeln(Q4.SQL.Text);
|
||||||
Q4.Open();
|
Q4.Open();
|
||||||
pProf := IntToStr(Q4.Fields[0].AsInteger+1)
|
pProf := IntToStr(Q4.Fields[0].AsInteger+1)
|
||||||
end;
|
end;
|
||||||
@ -539,7 +541,7 @@ begin
|
|||||||
pProf+','+QuotedStr(pLoc)+','+QuotedStr(pQTH)+','+QuotedStr(pEq)+','+
|
pProf+','+QuotedStr(pLoc)+','+QuotedStr(pQTH)+','+QuotedStr(pEq)+','+
|
||||||
QuotedStr(pNote)+',1)';
|
QuotedStr(pNote)+',1)';
|
||||||
}
|
}
|
||||||
if dmData.DebugLevel >=1 then Writeln(Q4.SQL.Text);
|
if LocalDbg then Writeln(Q4.SQL.Text);
|
||||||
Q4.ExecSQL;
|
Q4.ExecSQL;
|
||||||
Q4.Close();
|
Q4.Close();
|
||||||
end
|
end
|
||||||
@ -559,7 +561,7 @@ begin
|
|||||||
' AND time_on = ' + QuotedStr(d.TIME_ON) + ' AND callsign = '+QuotedStr(d.CALL)+
|
' AND time_on = ' + QuotedStr(d.TIME_ON) + ' AND callsign = '+QuotedStr(d.CALL)+
|
||||||
' AND band = ' + QuotedStr(d.BAND) + ' AND mode = '+QuotedStr(d.MODE);
|
' AND band = ' + QuotedStr(d.BAND) + ' AND mode = '+QuotedStr(d.MODE);
|
||||||
|
|
||||||
if dmData.DebugLevel >=1 then Writeln(dmData.Q.SQL.Text);
|
if LocalDbg then Writeln(dmData.Q.SQL.Text);
|
||||||
if dmData.trQ.Active then
|
if dmData.trQ.Active then
|
||||||
dmData.trQ.Rollback;
|
dmData.trQ.Rollback;
|
||||||
dmData.trQ.StartTransaction;
|
dmData.trQ.StartTransaction;
|
||||||
@ -627,7 +629,7 @@ begin
|
|||||||
':lotw_qslr,:qsls_date,:qslr_date,:eqsl_qslsdate,:eqsl_qsl_sent,:eqsl_qslrdate,'+
|
':lotw_qslr,:qsls_date,:qslr_date,:eqsl_qslsdate,:eqsl_qsl_sent,:eqsl_qslrdate,'+
|
||||||
':eqsl_qsl_rcvd, :prop_mode, :satellite, :rxfreq, :stx, :srx, :stx_string, :srx_string,'+
|
':eqsl_qsl_rcvd, :prop_mode, :satellite, :rxfreq, :stx, :srx, :stx_string, :srx_string,'+
|
||||||
':contestname,:dok,:operator)';
|
':contestname,:dok,:operator)';
|
||||||
if dmData.DebugLevel >=1 then Writeln(Q1.SQL.Text);
|
if LocalDbg then Writeln(Q1.SQL.Text);
|
||||||
Q1.Prepare;
|
Q1.Prepare;
|
||||||
Q1.Params[0].AsString := d.QSO_DATE;
|
Q1.Params[0].AsString := d.QSO_DATE;
|
||||||
Q1.Params[1].AsString := d.TIME_ON;
|
Q1.Params[1].AsString := d.TIME_ON;
|
||||||
@ -756,7 +758,7 @@ begin
|
|||||||
else
|
else
|
||||||
Q1.Params[47].Clear;
|
Q1.Params[47].Clear;
|
||||||
|
|
||||||
if dmData.DebugLevel >=1 then Writeln(Q1.SQL.Text);
|
if LocalDbg then Writeln(Q1.SQL.Text);
|
||||||
Q1.ExecSQL;
|
Q1.ExecSQL;
|
||||||
inc(RecNR);
|
inc(RecNR);
|
||||||
if (RecNR mod 100 = 0) then
|
if (RecNR mod 100 = 0) then
|
||||||
@ -792,7 +794,7 @@ begin
|
|||||||
// If that failed use default configured locator
|
// If that failed use default configured locator
|
||||||
if not dmUtils.IsLocOK(FMyLoc) then
|
if not dmUtils.IsLocOK(FMyLoc) then
|
||||||
FMyLoc := cqrini.ReadString('Station', 'LOC', '');
|
FMyLoc := cqrini.ReadString('Station', 'LOC', '');
|
||||||
if dmData.DebugLevel >=1 then WriteLn('Using '+FMyLoc+' as locator for imports');
|
if LocalDbg then WriteLn('Using '+FMyLoc+' as locator for imports');
|
||||||
RecNR := 0;
|
RecNR := 0;
|
||||||
WrongRecNr := 0;
|
WrongRecNr := 0;
|
||||||
FFilteredOutRecNr := 0;
|
FFilteredOutRecNr := 0;
|
||||||
@ -852,7 +854,7 @@ begin
|
|||||||
tr.Commit;
|
tr.Commit;
|
||||||
dt := dt - now;
|
dt := dt - now;
|
||||||
DecodeTime(dt,hh,m,s,ms);
|
DecodeTime(dt,hh,m,s,ms);
|
||||||
if dmData.DebugLevel >=1 then WriteLn('It takes about ',m,' minutes and ',s,' seconds ',ms,' milliseconds');
|
if LocalDbg then WriteLn('It takes about ',m,' minutes and ',s,' seconds ',ms,' milliseconds');
|
||||||
lblCount.Caption := IntToStr(RecNR);
|
lblCount.Caption := IntToStr(RecNR);
|
||||||
lblFilteredOut.Visible := FFilterByDate;
|
lblFilteredOut.Visible := FFilterByDate;
|
||||||
lblFilteredOutCount.Visible := FFilterByDate;
|
lblFilteredOutCount.Visible := FFilterByDate;
|
||||||
@ -874,23 +876,27 @@ procedure TfrmAdifImport.lblErrorLogClick(Sender: TObject);
|
|||||||
Begin
|
Begin
|
||||||
popErrFile.Popup;
|
popErrFile.Popup;
|
||||||
end;
|
end;
|
||||||
|
procedure TfrmAdifImport.OpenInTextEditor(OpenName:String);
|
||||||
procedure TfrmAdifImport.mnueditClick(Sender: TObject);
|
|
||||||
//open in text editor
|
//open in text editor
|
||||||
var
|
var
|
||||||
prg: string;
|
prg: string;
|
||||||
begin
|
begin
|
||||||
popErrFile.Close;
|
|
||||||
try
|
try
|
||||||
prg := cqrini.ReadString('ExtView', 'txt', '');
|
prg := cqrini.ReadString('ExtView', 'txt', '');
|
||||||
if prg<>'' then
|
if prg<>'' then
|
||||||
dmUtils.RunOnBackground(prg + ' ' + lblErrorLog.Caption)
|
dmUtils.RunOnBackground(prg + ' ' + name)
|
||||||
else ShowMessage('No external text viewer defined!'+#10+'See: prefrences/External viewers');
|
else ShowMessage('No external text viewer defined!'+#10+'See: prefrences/External viewers');
|
||||||
finally
|
finally
|
||||||
//done
|
//done
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmAdifImport.mnueditClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
popErrFile.Close;
|
||||||
|
OpenInTextEditor(lblErrorLog.Caption);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmAdifImport.mnuImportClick(Sender: TObject);
|
procedure TfrmAdifImport.mnuImportClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
tmp:Char;
|
tmp:Char;
|
||||||
@ -976,7 +982,12 @@ begin
|
|||||||
finally
|
finally
|
||||||
FormatSettings.TimeSeparator := tmp
|
FormatSettings.TimeSeparator := tmp
|
||||||
end;
|
end;
|
||||||
lblErrorLog.Visible:=false
|
lblErrorLog.Visible:=false;
|
||||||
|
//set debug rules for this form
|
||||||
|
// bit 1, %1, ---> -2 for routines in this form
|
||||||
|
LocalDbg := dmData.DebugLevel >= 1 ;
|
||||||
|
if dmData.DebugLevel < 0 then
|
||||||
|
LocalDbg := LocalDbg or ((abs(dmData.DebugLevel) and 2) = 2 );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmAdifImport.chkFilterDateRangeChange(Sender: TObject);
|
procedure TfrmAdifImport.chkFilterDateRangeChange(Sender: TObject);
|
||||||
@ -1018,7 +1029,7 @@ var
|
|||||||
i : Integer;
|
i : Integer;
|
||||||
begin
|
begin
|
||||||
for i:= 0 to Length(lines)-1 do
|
for i:= 0 to Length(lines)-1 do
|
||||||
if dmData.DebugLevel >=1 then WriteLn(lines[i]);
|
if LocalDbg then WriteLn(lines[i]);
|
||||||
|
|
||||||
if FileExists(dmData.UsrHomeDir + ERR_FILE) then
|
if FileExists(dmData.UsrHomeDir + ERR_FILE) then
|
||||||
begin
|
begin
|
||||||
|
@ -41,12 +41,15 @@ type
|
|||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure tmrImportTimer(Sender: TObject);
|
procedure tmrImportTimer(Sender: TObject);
|
||||||
private
|
private
|
||||||
running : Boolean;
|
running,
|
||||||
|
LocalDbg : Boolean;
|
||||||
FileSize : Int64;
|
FileSize : Int64;
|
||||||
procedure ImportDXCCTables;
|
procedure ImportDXCCTables;
|
||||||
procedure RegenerateDXCCStat;
|
procedure RegenerateDXCCStat;
|
||||||
procedure DownloadDXCCData;
|
procedure DownloadDXCCData;
|
||||||
procedure DownloadDOKData;
|
procedure DownloadDOKData;
|
||||||
|
procedure CommonImport(var PosEOR:word;var f:TextFile;var call,band,mode,submode,qsodate,time_on,qslr,
|
||||||
|
qslrdate,cqz,ituz,iota,grid,state,county:String);
|
||||||
procedure ImportLoTWAdif;
|
procedure ImportLoTWAdif;
|
||||||
procedure ImportQSLMgrs;
|
procedure ImportQSLMgrs;
|
||||||
procedure DownloadQSLData;
|
procedure DownloadQSLData;
|
||||||
@ -77,7 +80,7 @@ implementation
|
|||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
{ TfrmImportProgress }
|
{ TfrmImportProgress }
|
||||||
|
|
||||||
uses dData, dUtils, fImportTest, dDXCC, uMyini, dLogUpload, dMembership, dSatellite;
|
uses dData, dUtils, fImportTest, dDXCC, uMyini, dLogUpload, dMembership, dSatellite, fAdifImport;
|
||||||
|
|
||||||
procedure TfrmImportProgress.FormActivate(Sender: TObject);
|
procedure TfrmImportProgress.FormActivate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
@ -108,7 +111,12 @@ begin
|
|||||||
LoTWQSOList := TStringList.Create;
|
LoTWQSOList := TStringList.Create;
|
||||||
LoTWQSOList.Clear;
|
LoTWQSOList.Clear;
|
||||||
eQSLQSOList := TStringList.Create;
|
eQSLQSOList := TStringList.Create;
|
||||||
eQSLQSOList.Clear
|
eQSLQSOList.Clear;
|
||||||
|
//set debug rules for this form
|
||||||
|
// bit 1, %1, ---> -2 for routines in this form
|
||||||
|
LocalDbg := dmData.DebugLevel >= 1 ;
|
||||||
|
if dmData.DebugLevel < 0 then
|
||||||
|
LocalDbg := LocalDbg or ((abs(dmData.DebugLevel) and 2) = 2 );
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmImportProgress.FormDestroy(Sender: TObject);
|
procedure TfrmImportProgress.FormDestroy(Sender: TObject);
|
||||||
@ -176,7 +184,7 @@ begin
|
|||||||
QuotedStr(Result[4])+','+QuotedStr(Result[5])+','+
|
QuotedStr(Result[4])+','+QuotedStr(Result[5])+','+
|
||||||
QuotedStr(Result[6])+','+QuotedStr(Result[7])+','+
|
QuotedStr(Result[6])+','+QuotedStr(Result[7])+','+
|
||||||
IntToStr(ADIF)+',0)';
|
IntToStr(ADIF)+',0)';
|
||||||
if dmData.DebugLevel >=1 then Writeln(dmDXCC.qDXCCRef.SQL.Text);
|
if LocalDbg then Writeln(dmDXCC.qDXCCRef.SQL.Text);
|
||||||
dmDXCC.qDXCCRef.ExecSQL;
|
dmDXCC.qDXCCRef.ExecSQL;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -202,7 +210,7 @@ begin
|
|||||||
QuotedStr(Result[4])+','+QuotedStr(Result[5])+','+
|
QuotedStr(Result[4])+','+QuotedStr(Result[5])+','+
|
||||||
QuotedStr(Result[6])+','+QuotedStr(Result[7])+','+
|
QuotedStr(Result[6])+','+QuotedStr(Result[7])+','+
|
||||||
IntToStr(ADIF)+','+'1'+')';
|
IntToStr(ADIF)+','+'1'+')';
|
||||||
if dmData.DebugLevel >=1 then
|
if LocalDbg then
|
||||||
Writeln(dmDXCC.qDXCCRef.SQL.Text);
|
Writeln(dmDXCC.qDXCCRef.SQL.Text);
|
||||||
dmDXCC.qDXCCRef.ExecSQL;
|
dmDXCC.qDXCCRef.ExecSQL;
|
||||||
end;
|
end;
|
||||||
@ -319,7 +327,7 @@ begin
|
|||||||
QuotedStr(Result[1]) + ',' + QuotedStr(Result[2])
|
QuotedStr(Result[1]) + ',' + QuotedStr(Result[2])
|
||||||
+ ',' + QuotedStr(tmp) + ')';
|
+ ',' + QuotedStr(tmp) + ')';
|
||||||
end;
|
end;
|
||||||
if dmData.DebugLevel>=1 then
|
if LocalDbg then
|
||||||
Writeln(dmData.qIOTAList.SQL.Text);
|
Writeln(dmData.qIOTAList.SQL.Text);
|
||||||
|
|
||||||
if length(Result[1]) > 250 then ShowMessage(Result[0]);
|
if length(Result[1]) > 250 then ShowMessage(Result[0]);
|
||||||
@ -540,7 +548,56 @@ begin
|
|||||||
Application.ProcessMessages;
|
Application.ProcessMessages;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
procedure TfrmImportProgress.CommonImport(var PosEOR:word;var f:TextFile;var call,band,mode,submode,qsodate,time_on,qslr,
|
||||||
|
qslrdate,cqz,ituz,iota,grid,state,county:String);
|
||||||
|
var
|
||||||
|
a,
|
||||||
|
prik,
|
||||||
|
data,
|
||||||
|
Buf :string;
|
||||||
|
|
||||||
|
Begin
|
||||||
|
Buf:='';
|
||||||
|
while not ((PosEOR > 0) or eof(f)) do //combine one record. LoTW adif has one tag per line
|
||||||
|
Begin
|
||||||
|
Readln(f, a);
|
||||||
|
a := Trim(a);
|
||||||
|
PosEOR := Pos('<EOR>',UpperCase(a));
|
||||||
|
Buf := Buf+a;
|
||||||
|
end;
|
||||||
|
Buf:=buf+'<EOR>'; //in case we have broken record in broken file (hit eof before it is time)
|
||||||
|
if LocalDbg then Writeln('one record read: ',Buf);
|
||||||
|
mode := ''; //be sure there is no mode at this point
|
||||||
|
repeat
|
||||||
|
begin
|
||||||
|
if frmAdifImport.getNextAdifTag(Buf,prik,data) then
|
||||||
|
if LocalDbg then
|
||||||
|
Begin
|
||||||
|
write(prik,'->');
|
||||||
|
writeln(data);
|
||||||
|
end;
|
||||||
|
case uppercase(prik) of
|
||||||
|
'CALL' : call := uppercase(data);
|
||||||
|
'GRIDSQUARE' : if dmUtils.IsLocOK(data) then
|
||||||
|
grid := dmUtils.StdFormatLocator(data);
|
||||||
|
//if not mode set by submode then set mode
|
||||||
|
'MODE' : if mode='' then mode := uppercase(data);
|
||||||
|
//submode overrides MODE, if exist
|
||||||
|
'SUBMODE' : mode := uppercase(data);
|
||||||
|
'BAND' : band := uppercase(data);
|
||||||
|
'QSO_DATE' : qsodate := data;
|
||||||
|
'TIME_ON' : time_on := data;
|
||||||
|
'IOTA' : iota := data;
|
||||||
|
'STATE' : state := data;
|
||||||
|
'CQZ' : cqz := data;
|
||||||
|
'ITUZ' : ituz := data;
|
||||||
|
'CNTY' : county := data;
|
||||||
|
'QSL_RCVD' : qslr :=uppercase(data);
|
||||||
|
'QSLRDATE' : qslrdate:= data;
|
||||||
|
end; //case
|
||||||
|
end; //repeat
|
||||||
|
until pos('<EOR>',uppercase(Buf))=1;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmImportProgress.ImportLoTWAdif;
|
procedure TfrmImportProgress.ImportLoTWAdif;
|
||||||
var
|
var
|
||||||
@ -556,6 +613,8 @@ var
|
|||||||
call : String;
|
call : String;
|
||||||
band : String;
|
band : String;
|
||||||
mode : String;
|
mode : String;
|
||||||
|
//submode not needed with lotw
|
||||||
|
submode : String;
|
||||||
qsodate : String;
|
qsodate : String;
|
||||||
time_on : String;
|
time_on : String;
|
||||||
qslr : String;
|
qslr : String;
|
||||||
@ -566,19 +625,6 @@ var
|
|||||||
grid : String;
|
grid : String;
|
||||||
state : String;
|
state : String;
|
||||||
county : String;
|
county : String;
|
||||||
PosCall : Word;
|
|
||||||
PosBand : Word;
|
|
||||||
PosMode : Word;
|
|
||||||
PosQsoDate : Word;
|
|
||||||
PosTime_on : Word;
|
|
||||||
PosQslr : Word;
|
|
||||||
PosQslrDate : Word;
|
|
||||||
PosCqz : Word;
|
|
||||||
PosItuz : Word;
|
|
||||||
PosIota : Word;
|
|
||||||
PosGrid : Word;
|
|
||||||
PosState : Word;
|
|
||||||
PosCounty : Word;
|
|
||||||
|
|
||||||
qso_in_log : Boolean = False;
|
qso_in_log : Boolean = False;
|
||||||
ErrorCount : Word = 0;
|
ErrorCount : Word = 0;
|
||||||
@ -621,6 +667,7 @@ begin
|
|||||||
call := '';
|
call := '';
|
||||||
band := '';
|
band := '';
|
||||||
mode := '';
|
mode := '';
|
||||||
|
submode := '';
|
||||||
qsodate := '';
|
qsodate := '';
|
||||||
time_on := '';
|
time_on := '';
|
||||||
qslr := '';
|
qslr := '';
|
||||||
@ -632,205 +679,18 @@ begin
|
|||||||
state := '';
|
state := '';
|
||||||
county := '';
|
county := '';
|
||||||
PosEOR := 0;
|
PosEOR := 0;
|
||||||
while not ((PosEOR > 0) or eof(f)) do
|
while not ((PosEOR > 0) or eof(f)) do //read all records
|
||||||
begin
|
begin
|
||||||
qso_in_log := False;
|
qso_in_log := False;
|
||||||
Readln(f, a);
|
CommonImport(PosEOR,f,call,band,mode,submode,qsodate,time_on,qslr,
|
||||||
a := Trim(a);
|
qslrdate,cqz,ituz,iota,grid,state,county);
|
||||||
orig := a;
|
|
||||||
a := UpperCase(a);
|
|
||||||
|
|
||||||
PosCall := Pos('<CALL:',a);
|
|
||||||
PosBand := Pos('<BAND:',a);
|
|
||||||
PosMode := Pos('<MODE:',a);
|
|
||||||
PosQsoDate := Pos('<QSO_DATE:',a);
|
|
||||||
PosTime_on := Pos('<TIME_ON:',a);
|
|
||||||
PosQslr := Pos('<QSL_RCVD:',a);
|
|
||||||
PosQslrDate := Pos('<QSLRDATE:',a);
|
|
||||||
PosCqz := Pos('<CQZ:',a);
|
|
||||||
PosItuz := Pos('<ITUZ:',a);
|
|
||||||
PosIota := Pos('<IOTA:',a);
|
|
||||||
PosGrid := Pos('<GRIDSQUARE:',a);
|
|
||||||
PosState := Pos('<STATE:',a);
|
|
||||||
PosCounty := Pos('<CNTY:',a);
|
|
||||||
PosEOR := Pos('<EOR>',a);
|
|
||||||
|
|
||||||
if PosCall > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosCall := PosCall + 6;
|
|
||||||
while not (a[PosCall] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosCall];
|
|
||||||
inc(PosCall)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
call := copy(orig,PosCall+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosBand > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosBand := PosBand + 6;
|
|
||||||
while not (a[PosBand] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosBand];
|
|
||||||
inc(PosBand)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
band := copy(orig,PosBand+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosMode > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosMode := PosMode + 6;
|
|
||||||
while not (a[PosMode] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosMode];
|
|
||||||
inc(PosMode)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
mode := copy(orig,PosMode+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosQsoDate > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosQsoDate := PosQsoDate + 10;
|
|
||||||
while not (a[PosQsoDate] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosQsoDate];
|
|
||||||
inc(PosQsoDate)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
qsodate := copy(orig,PosQsoDate+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosTime_on > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosTime_on := PosTime_on + 9;
|
|
||||||
while not (a[PosTime_on] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosTime_on];
|
|
||||||
inc(PosTime_on)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
time_on := copy(orig,PosTime_on+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
if PosQslr > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosQslr := PosQslr + 10;
|
|
||||||
while not (a[PosQslr] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosQslr];
|
|
||||||
inc(PosQslr)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
qslr := copy(orig,PosQslr+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosQslrDate > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosQslrDate := PosQslrDate + 10;
|
|
||||||
while not (a[PosQslrDate] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosQslrDate];
|
|
||||||
inc(PosQslrDate)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
qslrdate := copy(orig,PosQslrDate+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosCqz > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosCqz := PosCqz + 5;
|
|
||||||
while not (a[PosCqz] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosCqz];
|
|
||||||
inc(PosCqz)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
cqz := copy(orig,PosCqz+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosItuz > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosItuz := PosItuz + 6;
|
|
||||||
while not (a[PosItuz] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosItuz];
|
|
||||||
inc(PosItuz)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
ituz := copy(orig,PosItuz+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosIota > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosIota := PosIota + 6;
|
|
||||||
while not (a[PosIota] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosIota];
|
|
||||||
inc(PosIota)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
iota := copy(orig,PosIota+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosGrid > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosGrid := PosGrid + 12;
|
|
||||||
while not (a[PosGrid] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosGrid];
|
|
||||||
inc(PosGrid)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
grid := copy(orig,PosGrid+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosState > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosState := PosState + 7;
|
|
||||||
while not (a[PosState] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosState];
|
|
||||||
inc(PosState)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
state := copy(orig,PosState+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosCounty > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosCounty := PosCounty + 6;
|
|
||||||
while not (a[PosCounty] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosCounty];
|
|
||||||
inc(PosCounty)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
county := copy(orig,PosCounty+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosEOR > 0 then
|
if PosEOR > 0 then
|
||||||
begin
|
begin
|
||||||
//inc(qsln);
|
if LocalDbg then
|
||||||
if dmData.DebugLevel >= 1 then
|
|
||||||
begin
|
begin
|
||||||
// Writeln('Number: ',IntToStr(qsln));
|
Writeln('------------------------------------------------');
|
||||||
|
Writeln('Record Number: ',IntToStr(qsln));
|
||||||
Writeln('Call: ',call);
|
Writeln('Call: ',call);
|
||||||
Writeln('Band: ',band);
|
Writeln('Band: ',band);
|
||||||
Writeln('Mode: ',mode);
|
Writeln('Mode: ',mode);
|
||||||
@ -860,7 +720,7 @@ begin
|
|||||||
'and (band = ' + QuotedStr(band) + ')'+
|
'and (band = ' + QuotedStr(band) + ')'+
|
||||||
// 'and (mode = ' + QuotedStr(mode) + ') and (band = ' + QuotedStr(band) + ')'+
|
// 'and (mode = ' + QuotedStr(mode) + ') and (band = ' + QuotedStr(band) + ')'+
|
||||||
'and (callsign = ' + QuotedStr(call) + ')';
|
'and (callsign = ' + QuotedStr(call) + ')';
|
||||||
if dmData.DebugLevel >=1 then Writeln(dmData.Q.SQL.Text);
|
if LocalDbg then Writeln(dmData.Q.SQL.Text);
|
||||||
//if dmData.trQ.Active then dmData.trQ.Rollback;
|
//if dmData.trQ.Active then dmData.trQ.Rollback;
|
||||||
//dmData.trQ.StartTransaction;
|
//dmData.trQ.StartTransaction;
|
||||||
dmData.Q.Open();
|
dmData.Q.Open();
|
||||||
@ -887,7 +747,7 @@ begin
|
|||||||
else //as day is set at sql query and we can not go forward to tomorrow
|
else //as day is set at sql query and we can not go forward to tomorrow
|
||||||
t_lotw_max := t_lotw+5/1440;
|
t_lotw_max := t_lotw+5/1440;
|
||||||
|
|
||||||
if dmData.DebugLevel >=1 then Writeln(call,'|',TimeToStr(t_log),' | ',TimeToStr(t_lotw_min),'|',TimeToStr(t_lotw_max));
|
if LocalDbg then Writeln(call,'|',TimeToStr(t_log),' | ',TimeToStr(t_lotw_min),'|',TimeToStr(t_lotw_max));
|
||||||
|
|
||||||
if (t_log >=t_lotw_min) and (t_log<=t_lotw_max) then
|
if (t_log >=t_lotw_min) and (t_log<=t_lotw_max) then
|
||||||
begin
|
begin
|
||||||
@ -916,7 +776,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
dmData.Q1.SQL.Add(' where id_cqrlog_main = ' + dmData.Q.Fields[8].AsString);
|
dmData.Q1.SQL.Add(' where id_cqrlog_main = ' + dmData.Q.Fields[8].AsString);
|
||||||
inc(qsln);
|
inc(qsln);
|
||||||
if dmData.DebugLevel>=1 then Writeln(dmData.Q1.SQL.Text+ ' qsl number:'+ IntToStr(qsln));
|
if LocalDbg then Writeln(dmData.Q1.SQL.Text+ ' qsl number:'+ IntToStr(qsln));
|
||||||
dmData.Q1.ExecSQL
|
dmData.Q1.ExecSQL
|
||||||
end;
|
end;
|
||||||
qso_in_log := True;
|
qso_in_log := True;
|
||||||
@ -954,18 +814,17 @@ begin
|
|||||||
dmData.trQ1.Commit;
|
dmData.trQ1.Commit;
|
||||||
if ErrorCount > 0 then
|
if ErrorCount > 0 then
|
||||||
begin
|
begin
|
||||||
l.SaveToFile(dmData.HomeDir + 'lotw_error.txt');
|
l.SaveToFile(dmData.UsrHomeDir + 'lotw_error.txt');
|
||||||
if Application.MessageBox(PChar(IntToStr(ErrorCount)+' QSO(s) were not found in your log. '#13' QSO(s) are stored to '+dmData.HomeDir + 'lotw_error.txt'+
|
if Application.MessageBox(PChar(IntToStr(ErrorCount)+' QSO(s) were not found in your log. '#13' QSO(s) are stored to '+dmData.UsrHomeDir + 'lotw_error.txt'+
|
||||||
LineEnding+LineEnding+'Do you want to show the file?'),'Question ....',mb_YesNo+mb_IconQuestion)=idYes then
|
LineEnding+LineEnding+'Do you want to show the file?'),'Question ....',mb_YesNo+mb_IconQuestion)=idYes then
|
||||||
dmUtils.OpenInApp(dmData.HomeDir + 'lotw_error.txt')
|
frmAdifImport.OpenInTextEditor(dmData.UsrHomeDir + 'lotw_error.txt')
|
||||||
//ShowMessage(IntToStr(ErrorCount)+' QSO(s) were not found in your log. '#13' QSO(s) are stored to '+dmData.HomeDir + 'lotw_error.txt')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
if Application.MessageBox('Something is wrong because LoTW server returned invalid adif file header.'+LineEnding+
|
if Application.MessageBox('Something is wrong because LoTW server returned invalid adif file header.'+LineEnding+
|
||||||
'Your LoTW username/password could be wrong or LoTW server is down.'+LineEnding+LineEnding+'Do you want to show the file?',
|
'Your LoTW username/password could be wrong or LoTW server is down.'+LineEnding+LineEnding+'Do you want to show the file?',
|
||||||
'Error ...',mb_YesNo+mb_IconQuestion) = idYes then
|
'Error ...',mb_YesNo+mb_IconQuestion) = idYes then
|
||||||
dmUtils.OpenInApp(FileName)
|
frmAdifImport.OpenInTextEditor(FileName)
|
||||||
end
|
end
|
||||||
finally
|
finally
|
||||||
dmData.Q.Close();
|
dmData.Q.Close();
|
||||||
@ -1071,7 +930,7 @@ begin
|
|||||||
dmData.trQ.StartTransaction;
|
dmData.trQ.StartTransaction;
|
||||||
dmData.Q.SQL.Text := 'update cqrlog_main set qsl_via = ' + QuotedStr(qsl_via) +
|
dmData.Q.SQL.Text := 'update cqrlog_main set qsl_via = ' + QuotedStr(qsl_via) +
|
||||||
' where id_cqrlog_main = '+ IntToStr(dmData.qCQRLOG.FieldByName('id_cqrlog_main').AsInteger);
|
' where id_cqrlog_main = '+ IntToStr(dmData.qCQRLOG.FieldByName('id_cqrlog_main').AsInteger);
|
||||||
if dmData.DebugLevel>=1 then Writeln(dmData.Q.SQL.Text);
|
if LocalDbg then Writeln(dmData.Q.SQL.Text);
|
||||||
dmData.Q.ExecSQL;
|
dmData.Q.ExecSQL;
|
||||||
dmData.trQ.Commit
|
dmData.trQ.Commit
|
||||||
end;
|
end;
|
||||||
@ -1104,6 +963,15 @@ var
|
|||||||
qsodate : String;
|
qsodate : String;
|
||||||
time_on : String;
|
time_on : String;
|
||||||
qslr : String;
|
qslr : String;
|
||||||
|
qslrdate : String;
|
||||||
|
cqz : String;
|
||||||
|
ituz : String;
|
||||||
|
iota : String;
|
||||||
|
grid : String;
|
||||||
|
state : String;
|
||||||
|
county : String;
|
||||||
|
Buf : String;
|
||||||
|
|
||||||
PosCall : Word;
|
PosCall : Word;
|
||||||
PosBand : Word;
|
PosBand : Word;
|
||||||
PosMode : Word;
|
PosMode : Word;
|
||||||
@ -1155,127 +1023,29 @@ begin
|
|||||||
qsodate := '';
|
qsodate := '';
|
||||||
time_on := '';
|
time_on := '';
|
||||||
qslr := '';
|
qslr := '';
|
||||||
|
//these are not needed with eQSL
|
||||||
|
qslrdate := '';
|
||||||
|
cqz := '';
|
||||||
|
ituz := '';
|
||||||
|
iota := '';
|
||||||
|
grid := '';
|
||||||
|
state := '';
|
||||||
|
county := '';
|
||||||
|
|
||||||
PosEOR := 0;
|
PosEOR := 0;
|
||||||
|
|
||||||
|
|
||||||
while not ((PosEOR > 0) or eof(f)) do
|
while not ((PosEOR > 0) or eof(f)) do
|
||||||
begin
|
begin
|
||||||
qso_in_log := False;
|
qso_in_log := False;
|
||||||
Readln(f, a);
|
CommonImport(PosEOR,f,call,band,mode,submode,qsodate,time_on,qslr,
|
||||||
a := Trim(a);
|
qslrdate,cqz,ituz,iota,grid,state,county);
|
||||||
orig := a;
|
|
||||||
a := UpperCase(a);
|
|
||||||
|
|
||||||
PosCall := Pos('<CALL:',a);
|
|
||||||
PosBand := Pos('<BAND:',a);
|
|
||||||
PosMode := Pos('<MODE:',a);
|
|
||||||
PosSubmode := Pos('<SUBMODE:',a);
|
|
||||||
PosQsoDate := Pos('<QSO_DATE:8:D',a);
|
|
||||||
PosTime_on := Pos('<TIME_ON:',a);
|
|
||||||
PosQslr := Pos('<QSL_RCVD:',a);
|
|
||||||
PosEOR := Pos('<EOR>',a);
|
|
||||||
|
|
||||||
if PosCall > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosCall := PosCall + 6;
|
|
||||||
while not (a[PosCall] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosCall];
|
|
||||||
inc(PosCall)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
call := copy(orig,PosCall+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosBand > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosBand := PosBand + 6;
|
|
||||||
while not (a[PosBand] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosBand];
|
|
||||||
inc(PosBand)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
band := copy(orig,PosBand+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosMode > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosMode := PosMode + 6;
|
|
||||||
while not (a[PosMode] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosMode];
|
|
||||||
inc(PosMode)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
mode := copy(orig,PosMode+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosSubmode > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosSubmode := PosSubmode + 9;
|
|
||||||
while not (a[PosSubmode] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosSubmode];
|
|
||||||
inc(PosSubmode)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
submode := copy(orig,PosSubmode+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosQsoDate > 0 then
|
|
||||||
begin
|
|
||||||
qsodate :=copy(orig,PosQsoDate+14,8);
|
|
||||||
{
|
|
||||||
sSize := '';
|
|
||||||
PosQsoDate := PosQsoDate + 13;
|
|
||||||
while not (a[PosQsoDate] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosQsoDate];
|
|
||||||
inc(PosQsoDate)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
qsodate := copy(orig,PosQsoDate+1,Size)
|
|
||||||
}
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosTime_on > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosTime_on := PosTime_on + 9;
|
|
||||||
while not (a[PosTime_on] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosTime_on];
|
|
||||||
inc(PosTime_on)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
time_on := copy(orig,PosTime_on+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosQslr > 0 then
|
|
||||||
begin
|
|
||||||
sSize := '';
|
|
||||||
PosQslr := PosQslr + 10;
|
|
||||||
while not (a[PosQslr] = '>') do
|
|
||||||
begin
|
|
||||||
sSize := sSize + a[PosQslr];
|
|
||||||
inc(PosQslr)
|
|
||||||
end;
|
|
||||||
Size := StrToInt(sSize);
|
|
||||||
qslr := copy(orig,PosQslr+1,Size)
|
|
||||||
end;
|
|
||||||
|
|
||||||
if PosEOR > 0 then
|
if PosEOR > 0 then
|
||||||
begin
|
begin
|
||||||
band := UpperCase(band);
|
if LocalDbg then
|
||||||
mode := UpperCase(mode);
|
|
||||||
submode := UpperCase(submode);
|
|
||||||
qslr := UpperCase(qslr);
|
|
||||||
call := UpperCase(call);
|
|
||||||
if dmData.DebugLevel >= 1 then
|
|
||||||
begin
|
begin
|
||||||
|
Writeln('------------------------------------------------');
|
||||||
Writeln('Call: ',call);
|
Writeln('Call: ',call);
|
||||||
Writeln('Band: ',band);
|
Writeln('Band: ',band);
|
||||||
Writeln('Mode: ',mode);
|
Writeln('Mode: ',mode);
|
||||||
@ -1283,11 +1053,9 @@ begin
|
|||||||
Writeln('QSO_date: ',qsodate);
|
Writeln('QSO_date: ',qsodate);
|
||||||
Writeln('Time_on: ',time_on);
|
Writeln('Time_on: ',time_on);
|
||||||
Writeln('QSLR: ',qslr);
|
Writeln('QSLR: ',qslr);
|
||||||
Writeln('------------------------------------------------')
|
Writeln('------------------------------------------------');
|
||||||
end;
|
end;
|
||||||
qsodate := dmUtils.ADIFDateToDate(qsodate);
|
qsodate := dmUtils.ADIFDateToDate(qsodate);
|
||||||
mode := UpperCase(mode);
|
|
||||||
|
|
||||||
|
|
||||||
dmData.Q.Close;
|
dmData.Q.Close;
|
||||||
|
|
||||||
@ -1307,7 +1075,7 @@ begin
|
|||||||
'and (band = ' + QuotedStr(band) + ') '+
|
'and (band = ' + QuotedStr(band) + ') '+
|
||||||
'and (callsign = ' + QuotedStr(call) + ')'
|
'and (callsign = ' + QuotedStr(call) + ')'
|
||||||
end;
|
end;
|
||||||
if dmData.DebugLevel >=1 then Writeln(dmData.Q.SQL.Text);
|
if LocalDbg then Writeln(dmData.Q.SQL.Text);
|
||||||
//if dmData.trQ.Active then dmData.trQ.Rollback;
|
//if dmData.trQ.Active then dmData.trQ.Rollback;
|
||||||
//dmData.trQ.StartTransaction;
|
//dmData.trQ.StartTransaction;
|
||||||
dmData.Q.Open();
|
dmData.Q.Open();
|
||||||
@ -1334,7 +1102,7 @@ begin
|
|||||||
else //as day is set at sql query and we can not go forward to tomorrow
|
else //as day is set at sql query and we can not go forward to tomorrow
|
||||||
t_eQSL_max := t_eQSL+60/1440;
|
t_eQSL_max := t_eQSL+60/1440;
|
||||||
|
|
||||||
if dmData.DebugLevel >=1 then Writeln(call,'|',TimeToStr(t_log),' | ',TimeToStr(t_eQSL_min),'|',TimeToStr(t_eQSL_max));
|
if LocalDbg then Writeln(call,'|',TimeToStr(t_log),' | ',TimeToStr(t_eQSL_min),'|',TimeToStr(t_eQSL_max));
|
||||||
|
|
||||||
if (t_log >=t_eQSL_min) and (t_log<=t_eQSL_max) then
|
if (t_log >=t_eQSL_min) and (t_log<=t_eQSL_max) then
|
||||||
begin
|
begin
|
||||||
@ -1347,7 +1115,7 @@ begin
|
|||||||
dmData.Q1.SQL.Add('update cqrlog_main set eqsl_qsl_rcvd = ' + QuotedStr('E'));
|
dmData.Q1.SQL.Add('update cqrlog_main set eqsl_qsl_rcvd = ' + QuotedStr('E'));
|
||||||
dmData.Q1.SQL.Add(',eqsl_qslrdate = ' + QuotedStr(dmUtils.DateInRightFormat(now)));
|
dmData.Q1.SQL.Add(',eqsl_qslrdate = ' + QuotedStr(dmUtils.DateInRightFormat(now)));
|
||||||
dmData.Q1.SQL.Add(' where id_cqrlog_main = ' + dmData.Q.Fields[0].AsString);
|
dmData.Q1.SQL.Add(' where id_cqrlog_main = ' + dmData.Q.Fields[0].AsString);
|
||||||
if dmData.DebugLevel>=1 then Writeln(dmData.Q1.SQL.Text);
|
if LocalDbg then Writeln(dmData.Q1.SQL.Text);
|
||||||
dmData.Q1.ExecSQL
|
dmData.Q1.ExecSQL
|
||||||
end;
|
end;
|
||||||
qso_in_log := True;
|
qso_in_log := True;
|
||||||
@ -1380,7 +1148,9 @@ begin
|
|||||||
if ErrorCount > 0 then
|
if ErrorCount > 0 then
|
||||||
begin
|
begin
|
||||||
l.SaveToFile(dmData.UsrHomeDir + 'eQSL_error.txt');
|
l.SaveToFile(dmData.UsrHomeDir + 'eQSL_error.txt');
|
||||||
ShowMessage('Some QSO(s) were not found in your log. '#13' QSO(s) are stored to '+dmData.UsrHomeDir + 'eQSL_error.txt')
|
if Application.MessageBox(PChar(IntToStr(ErrorCount)+' QSO(s) were not found in your log. '#13' QSO(s) are stored to '+dmData.UsrHomeDir + 'eQSL_error.txt'+
|
||||||
|
LineEnding+LineEnding+'Do you want to show the file?'),'Question ....',mb_YesNo+mb_IconQuestion)=idYes then
|
||||||
|
frmAdifImport.OpenInTextEditor(dmData.UsrHomeDir + 'eQSL_error.txt')
|
||||||
end
|
end
|
||||||
finally
|
finally
|
||||||
l.Free;
|
l.Free;
|
||||||
@ -1400,7 +1170,7 @@ begin
|
|||||||
try try
|
try try
|
||||||
dmData.trQ.StartTransaction;
|
dmData.trQ.StartTransaction;
|
||||||
dmData.Q.SQL.Text := 'create table tempdupes like cqrlog_main';
|
dmData.Q.SQL.Text := 'create table tempdupes like cqrlog_main';
|
||||||
if dmData.DebugLevel>=1 then Writeln(dmData.Q.SQL.Text);
|
if LocalDbg then Writeln(dmData.Q.SQL.Text);
|
||||||
dmData.Q.ExecSQL;
|
dmData.Q.ExecSQL;
|
||||||
dmData.trQ.Commit;
|
dmData.trQ.Commit;
|
||||||
|
|
||||||
@ -1411,15 +1181,15 @@ begin
|
|||||||
dmData.trQ.StartTransaction;
|
dmData.trQ.StartTransaction;
|
||||||
dmData.Q.SQL.Text := 'insert into tempdupes ' +
|
dmData.Q.SQL.Text := 'insert into tempdupes ' +
|
||||||
' select * from cqrlog_main group by qsodate,time_on,callsign,mode,band';
|
' select * from cqrlog_main group by qsodate,time_on,callsign,mode,band';
|
||||||
if dmData.DebugLevel>=1 then Writeln(dmData.Q.SQL.Text);
|
if LocalDbg then Writeln(dmData.Q.SQL.Text);
|
||||||
dmData.Q.ExecSQL;
|
dmData.Q.ExecSQL;
|
||||||
|
|
||||||
dmData.Q.SQL.Text := 'delete from cqrlog_main';
|
dmData.Q.SQL.Text := 'delete from cqrlog_main';
|
||||||
if dmData.DebugLevel>=1 then Writeln(dmData.Q.SQL.Text);
|
if LocalDbg then Writeln(dmData.Q.SQL.Text);
|
||||||
dmData.Q.ExecSQL;
|
dmData.Q.ExecSQL;
|
||||||
|
|
||||||
dmData.Q.SQL.Text := 'insert into cqrlog_main select * from tempdupes';
|
dmData.Q.SQL.Text := 'insert into cqrlog_main select * from tempdupes';
|
||||||
if dmData.DebugLevel>=1 then Writeln(dmData.Q.SQL.Text);
|
if LocalDbg then Writeln(dmData.Q.SQL.Text);
|
||||||
dmData.Q.ExecSQL
|
dmData.Q.ExecSQL
|
||||||
except
|
except
|
||||||
on E : Exception do
|
on E : Exception do
|
||||||
|
@ -2179,7 +2179,8 @@ var
|
|||||||
buf2,
|
buf2,
|
||||||
prik,
|
prik,
|
||||||
data :string;
|
data :string;
|
||||||
chkDuplicates :boolean;
|
chkDuplicates,
|
||||||
|
submodeExist :boolean;
|
||||||
i :longint;
|
i :longint;
|
||||||
a,b,l :integer;
|
a,b,l :integer;
|
||||||
fixed :Boolean;
|
fixed :Boolean;
|
||||||
@ -2256,7 +2257,7 @@ begin
|
|||||||
//this is fake as call info(qslmgr) needs date. We use current date if call tag comes before qso_date tag
|
//this is fake as call info(qslmgr) needs date. We use current date if call tag comes before qso_date tag
|
||||||
//qso_date will then replace this
|
//qso_date will then replace this
|
||||||
edtDate.Text := FormatDateTime('YYYY-MM-DD',now());
|
edtDate.Text := FormatDateTime('YYYY-MM-DD',now());
|
||||||
|
submodeExist:=false;
|
||||||
repeat
|
repeat
|
||||||
begin
|
begin
|
||||||
if frmAdifImport.getNextAdifTag(Buf,prik,data) then
|
if frmAdifImport.getNextAdifTag(Buf,prik,data) then
|
||||||
@ -2278,9 +2279,14 @@ begin
|
|||||||
if pos(data,edtGrid.Text)=0 then //if qso loc does not fit to QRZ loc , or qrz loc is empty
|
if pos(data,edtGrid.Text)=0 then //if qso loc does not fit to QRZ loc , or qrz loc is empty
|
||||||
edtGrid.Text := data; //replace qrz loc, otherwise keep it
|
edtGrid.Text := data; //replace qrz loc, otherwise keep it
|
||||||
end;
|
end;
|
||||||
'MODE' : cmbMode.Text := uppercase(data);
|
'MODE' : if not submodeExist then
|
||||||
|
cmbMode.Text := uppercase(data);
|
||||||
//now this overrides MODE, if exists
|
//now this overrides MODE, if exists
|
||||||
'SUBMODE' : cmbMode.Text := uppercase(data);
|
'SUBMODE' : Begin
|
||||||
|
//we need lock in case submode found before mode tag
|
||||||
|
submodeExist:=true;
|
||||||
|
cmbMode.Text := uppercase(data);
|
||||||
|
end;
|
||||||
'FREQ' : cmbFreq.Text := data;
|
'FREQ' : cmbFreq.Text := data;
|
||||||
'FREQ_RX' : edtRXFreq.Text := data;
|
'FREQ_RX' : edtRXFreq.Text := data;
|
||||||
'RST_SENT' : edtHisRST.Text := data;
|
'RST_SENT' : edtHisRST.Text := data;
|
||||||
|
@ -4,14 +4,15 @@ unit uVersion;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
const
|
const
|
||||||
|
cVersionBase = '2.5.2 (001)';
|
||||||
|
|
||||||
{$IFDEF LCLGtk2}
|
{$IFDEF LCLGtk2}
|
||||||
cVERSION = '2.5.2 (001) Gtk2';
|
cVERSION = cVersionBase+' Gtk2';
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF LCLQt5}
|
{$IFDEF LCLQt5}
|
||||||
cVERSION = '2.5.2 (001) QT5';
|
cVERSION = cVersionBase+' QT5';
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
|
||||||
cMAJOR = 2;
|
cMAJOR = 2;
|
||||||
cMINOR = 5;
|
cMINOR = 5;
|
||||||
cRELEAS = 2;
|
cRELEAS = 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user