mirror of
https://github.com/ok2cqr/cqrlog.git
synced 2024-09-21 02:17:19 +00:00
Empty rig model will erase whole TRXnr section
This commit is contained in:
parent
a1662e2484
commit
1814733715
@ -3335,7 +3335,13 @@ Procedure TfrmPreferences.SaveTRX(RigNr:integer);
|
||||
var
|
||||
nr :string;
|
||||
Begin
|
||||
|
||||
nr:=IntToStr(RigNr);
|
||||
if cmbModelRig.Text='' then //empty model will erase whole TRX section
|
||||
Begin
|
||||
cqrini.SectionErase('TRX'+nr);
|
||||
exit;
|
||||
end;
|
||||
|
||||
cqrini.WriteString('TRX'+nr, 'device', edtRDevice.Text);
|
||||
cqrini.WriteString('TRX'+nr, 'model', dmUtils.GetRigIdFromComboBoxItem(cmbModelRig.Text));
|
||||
|
@ -26,6 +26,7 @@ type
|
||||
function ReadBool(const Section, Ident: string; Default: Boolean;ToLocal : Boolean=FALSE): Boolean;
|
||||
function ReadFloat(const Section, Ident: string; Default: Double): Double;
|
||||
function SectionExists(Section : String) : Boolean;
|
||||
function SectionErase(Section : String) : Boolean;
|
||||
function LocalOnly(Section : String) : Boolean;
|
||||
|
||||
procedure WriteString(const Section, Ident, Value: String;ToLocal : Boolean=FALSE);
|
||||
@ -222,6 +223,30 @@ begin
|
||||
LeaveCriticalsection(crit)
|
||||
end
|
||||
end;
|
||||
function TMyIni.SectionErase(Section : String) : Boolean;
|
||||
begin
|
||||
EnterCriticalsection(crit);
|
||||
try
|
||||
if SectionExists(Section) then
|
||||
begin
|
||||
if LocalOnly(Section) then
|
||||
Begin
|
||||
Result := true;
|
||||
lini.EraseSection(Section)
|
||||
end
|
||||
else
|
||||
begin
|
||||
Result := true;
|
||||
ini.EraseSection(Section)
|
||||
end;
|
||||
end
|
||||
else
|
||||
Result:=false;
|
||||
finally
|
||||
LeaveCriticalsection(crit)
|
||||
end
|
||||
|
||||
end;
|
||||
|
||||
function TMyIni.LocalOnly(Section : String) : Boolean;
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user