unit Config;
interface
uses
Classes,
IniFiles;
resourcestring
GENERAL_SECTION = '
General';
SHORTCUT_KEY = '
ShortCut';
DEVICEINDEX_KEY = '
DeviceIndex';
ACTIVE_KEY = '
Active';
type
TSettings =
class(TMemIniFile)
private
function GetShortCut: TShortCut;
procedure SetShortCut(ShortCut: TShortCut);
function GetDeviceIndex: Integer;
procedure SetDeviceIndex(DeviceIndex: Integer);
function GetActive: Boolean;
procedure SetActive(Active: Boolean);
public
property ShortCut: TShortCut
read GetShortCut
write SetShortCut;
property DeviceIndex: Integer
read GetDeviceIndex
write SetDeviceIndex;
property Active: Boolean
read GetActive
write SetActive;
end;
implementation
uses
Menus;
function TSettings.GetShortCut: TShortCut;
begin
Result := TextToShortCut(ReadString(GENERAL_SECTION, SHORTCUT_KEY, '
'));
end;
procedure TSettings.SetShortCut(ShortCut: TShortCut);
begin
WriteString(GENERAL_SECTION, SHORTCUT_KEY, ShortCutToText(ShortCut));
end;
function TSettings.GetDeviceIndex: Integer;
begin
Result := ReadInteger(GENERAL_SECTION, DEVICEINDEX_KEY, -1);
end;
procedure TSettings.SetDeviceIndex(DeviceIndex: Integer);
begin
WriteInteger(GENERAL_SECTION, DEVICEINDEX_KEY, DeviceIndex);
end;
function TSettings.GetActive: Boolean;
begin
Result := ReadBool(GENERAL_SECTION, ACTIVE_KEY, false);
end;
procedure TSettings.SetActive(Active: Boolean);
begin
WriteBool(GENERAL_SECTION, ACTIVE_KEY, Active);
end;
end.