diff --git a/Quick.Threads.pas b/Quick.Threads.pas index c7aad8c..d00c056 100644 --- a/Quick.Threads.pas +++ b/Quick.Threads.pas @@ -231,6 +231,9 @@ TAnonymousThread = class(TInterfacedObject,IAnonymousThread) function StartTodayAt(aHour, aMinute: Word; aSecond : Word = 0): IScheduledTask; function StartTomorrowAt(aHour, aMinute: Word; aSecond : Word = 0): IScheduledTask; function StartOnDayChange : IScheduledTask; + function StartNow : IScheduledTask; + function StartInMinutes(aMinutes : Word) : IScheduledTask; + function StartInSeconds(aSeconds : Word) : IScheduledTask; procedure RunOnce; procedure RepeatEvery(aInterval : Integer; aTimeMeasure : TTimeMeasure); overload; procedure RepeatEvery(aInterval : Integer; aTimeMeasure : TTimeMeasure; aEndTime : TDateTime); overload; @@ -319,6 +322,9 @@ TScheduledTask = class(TTask,IScheduledTask) function StartTodayAt(aHour, aMinute: Word; aSecond : Word = 0): IScheduledTask; function StartTomorrowAt(aHour, aMinute: Word; aSecond : Word = 0): IScheduledTask; function StartOnDayChange : IScheduledTask; + function StartNow : IScheduledTask; + function StartInMinutes(aMinutes : Word) : IScheduledTask; + function StartInSeconds(aSeconds : Word) : IScheduledTask; procedure RunOnce; procedure RepeatEvery(aInterval : Integer; aTimeMeasure : TTimeMeasure); overload; procedure RepeatEvery(aInterval : Integer; aTimeMeasure : TTimeMeasure; aEndTime : TDateTime); overload; @@ -1249,6 +1255,33 @@ function TScheduledTask.StartAt(aStartDate: TDateTime) : IScheduledTask; fNextExecution := aStartDate; end; +function TScheduledTask.StartInMinutes(aMinutes: Word): IScheduledTask; +begin + Result := Self; + ClearSchedule; + fScheduleMode := TScheduleMode.smRunOnce; + fStartDate := IncMinute(Now(),aMinutes); + fNextExecution := fStartDate; +end; + +function TScheduledTask.StartInSeconds(aSeconds: Word): IScheduledTask; +begin + Result := Self; + ClearSchedule; + fScheduleMode := TScheduleMode.smRunOnce; + fStartDate := IncSecond(Now(),aSeconds); + fNextExecution := fStartDate; +end; + +function TScheduledTask.StartNow: IScheduledTask; +begin + Result := Self; + ClearSchedule; + fScheduleMode := TScheduleMode.smRunOnce; + fStartDate := Now(); + fNextExecution := fStartDate; +end; + function TScheduledTask.StartOnDayChange: IScheduledTask; begin Result := Self; diff --git a/samples/delphi/QuickConfig/ConfigToFile/ConfigToFile.dpr b/samples/delphi/QuickConfig/ConfigToFile/ConfigToFile.dpr new file mode 100644 index 0000000..ff5b548 --- /dev/null +++ b/samples/delphi/QuickConfig/ConfigToFile/ConfigToFile.dpr @@ -0,0 +1,15 @@ +program ConfigToFile; + +uses + Vcl.Forms, + Main in 'Main.pas' {MainForm}; + +{$R *.res} + +begin + ReportMemoryLeaksOnShutdown := True; + Application.Initialize; + Application.MainFormOnTaskbar := True; + Application.CreateForm(TMainForm, MainForm); + Application.Run; +end. diff --git a/samples/delphi/QuickConfig/ConfigToFile/ConfigToFile.dproj b/samples/delphi/QuickConfig/ConfigToFile/ConfigToFile.dproj new file mode 100644 index 0000000..4380355 --- /dev/null +++ b/samples/delphi/QuickConfig/ConfigToFile/ConfigToFile.dproj @@ -0,0 +1,652 @@ + + + {CDEBAD41-A241-457F-96FD-E367D8E3B0AE} + 18.5 + VCL + ConfigToFile.dpr + True + Debug + Win64 + 3 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + false + false + false + false + false + RESTComponents;FireDACIBDriver;FireDACCommon;RESTBackendComponents;soapserver;CloudService;FireDACCommonDriver;inet;FireDAC;FireDACSqliteDriver;soaprtl;soapmidas;$(DCC_UsePackage) + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + $(BDS)\bin\delphi_PROJECTICON.ico + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + ConfigToFile + + + DBXSqliteDriver;UbuntuProgressPackage;DBXInterBaseDriver;vclactnband;vclFireDAC;tethering;svnui;JvGlobus;FireDACADSDriver;JvPluginSystem;JvMM;vacommpkgdXE11;tmsxlsdXE11;vcltouch;JvBands;vcldb;bindcompfmx;svn;Intraweb;JvJans;JvNet;inetdb;JvAppFrm;EssentialsDR;vcwdedXE11;vcwdXE11;FmxTeeUI;JvDotNetCtrls;AbbreviaVCLD;fmx;fmxdae;tmsdXE11;vclib;JvWizards;tmsexdXE11;dbexpress;IndyCore;vclx;JvPageComps;dsnap;JvDB;VCLRESTComponents;JclDeveloperTools;vclie;bindengine;DBXMySQLDriver;JvCmp;FireDACMySQLDriver;JvHMI;FireDACCommonODBC;LockBoxDR;bindcompdbx;IndyIPCommon;JvCustom;advchartdedxe11;vcl;IndyIPServer;GR32_D;JvXPCtrls;PngComponents;IndySystem;advchartdxe11;dsnapcon;FireDACMSAccDriver;fmxFireDAC;vclimg;vacommpkgdedXE11;TeeDB;Jcl;madBasic_;JvCore;JvCrypt;FireDACPgDriver;ibmonitor;FMXTee;SevenZippro;DbxCommonDriver;JvDlgs;JvRuntimeDesign;ibxpress;Tee;JvManagedThreads;xmlrtl;ibxbindings;fmxobj;vclwinx;JvTimeFramework;rtl;GR32_R;DbxClientDriver;QuickVCL;CustomIPTransport;vcldsnap;JvSystem;JvStdCtrls;DCEF_DX10;bindcomp;appanalytics;tmswizdXE11;CoolTrayIcon_D210_XE7;IndyIPClient;bindcompvcl;TeeUI;TMSFMXPackPkgDXE11;JvDocking;dbxcds;VclSmp;JvPascalInterpreter;adortl;JclVcl;Gauge3D;dsnapxml;dbrtl;inetdbxpress;IndyProtocols;JvControls;JvPrintPreview;Analog_XE7;JclContainers;fmxase;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + $(BDS)\bin\default_app.manifest + + + DBXSqliteDriver;DBXInterBaseDriver;vclactnband;vclFireDAC;tethering;FireDACADSDriver;vcltouch;vcldb;bindcompfmx;Intraweb;inetdb;EssentialsDR;vcwdXE11;FmxTeeUI;AbbreviaVCLD;fmx;fmxdae;tmsdXE11;vclib;tmsexdXE11;dbexpress;IndyCore;vclx;dsnap;VCLRESTComponents;vclie;bindengine;DBXMySQLDriver;FireDACMySQLDriver;FireDACCommonODBC;bindcompdbx;IndyIPCommon;vcl;IndyIPServer;IndySystem;advchartdxe11;dsnapcon;FireDACMSAccDriver;fmxFireDAC;vclimg;TeeDB;FireDACPgDriver;ibmonitor;FMXTee;DbxCommonDriver;ibxpress;Tee;xmlrtl;ibxbindings;fmxobj;vclwinx;rtl;DbxClientDriver;QuickVCL;CustomIPTransport;vcldsnap;DCEF_DX10;bindcomp;appanalytics;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;dsnapxml;dbrtl;inetdbxpress;IndyProtocols;fmxase;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + $(BDS)\bin\default_app.manifest + + + DEBUG;$(DCC_Define) + true + false + true + true + true + + + false + true + PerMonitor + + + true + PerMonitor + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + true + PerMonitor + + + true + PerMonitor + + + + MainSource + + +
MainForm
+ dfm +
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + Delphi.Personality.12 + Application + + + + ConfigToFile.dpr + + + + + + ConfigToFile.rsm + true + + + + + ConfigToFile.exe + true + + + + + ConfigToFile.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 1 + + + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + + + res\values + 1 + + + + + res\values-v21 + 1 + + + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + 1 + + + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + + + + + + + + + + True + True + + False + + 12 + + + + +
diff --git a/samples/delphi/QuickConfig/ConfigToFile/ConfigToFile.res b/samples/delphi/QuickConfig/ConfigToFile/ConfigToFile.res new file mode 100644 index 0000000..f96068a Binary files /dev/null and b/samples/delphi/QuickConfig/ConfigToFile/ConfigToFile.res differ diff --git a/samples/delphi/QuickConfig/ConfigToFile/Main.dfm b/samples/delphi/QuickConfig/ConfigToFile/Main.dfm new file mode 100644 index 0000000..9aaa3ae --- /dev/null +++ b/samples/delphi/QuickConfig/ConfigToFile/Main.dfm @@ -0,0 +1,52 @@ +object MainForm: TMainForm + AlignWithMargins = True + Left = 0 + Top = 0 + Caption = 'Quick Config Demo' + ClientHeight = 493 + ClientWidth = 720 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + OnClose = FormClose + OnCreate = FormCreate + DesignSize = ( + 720 + 493) + PixelsPerInch = 96 + TextHeight = 13 + object meInfo: TMemo + Left = 8 + Top = 8 + Width = 704 + Height = 441 + Anchors = [akLeft, akTop, akRight, akBottom] + ReadOnly = True + ScrollBars = ssBoth + TabOrder = 0 + end + object btnLoadFile: TButton + Left = 407 + Top = 464 + Width = 145 + Height = 25 + Anchors = [akRight, akBottom] + Caption = 'Load From File' + TabOrder = 1 + OnClick = btnLoadFileClick + end + object btnSaveFile: TButton + Left = 558 + Top = 464 + Width = 154 + Height = 25 + Anchors = [akRight, akBottom] + Caption = 'Save To File' + TabOrder = 2 + OnClick = btnSaveFileClick + end +end diff --git a/samples/delphi/QuickConfig/ConfigToFile/Main.pas b/samples/delphi/QuickConfig/ConfigToFile/Main.pas new file mode 100644 index 0000000..25449a7 --- /dev/null +++ b/samples/delphi/QuickConfig/ConfigToFile/Main.pas @@ -0,0 +1,208 @@ +unit Main; + +interface + +uses + Winapi.Windows, + Winapi.Messages, + System.SysUtils, + System.Variants, + System.Classes, + Vcl.Graphics, + Vcl.Controls, + Vcl.Forms, + Vcl.Dialogs, + Vcl.StdCtrls, + System.Generics.Collections, + Quick.Config.Json; + +type + + TMyPriority = (msLow, msMed, msHigh); + + TWinPos = record + public + PosX : Integer; + PosY : Integer; + end; + + TProcessType = record + Id : Integer; + Priority : TMyPriority; + Redundant : Boolean; + end; + + TWorker = class + private + fName : string; + fActive : Boolean; + published + property Name : string read fName write fName; + property Active : Boolean read fActive write fActive; + end; + + TMyConfig = class(TAppConfigJson) + private + fTitle : string; + fHidden : Boolean; + fSessionName: string; + fSizes : TArray; + fLastFilename : string; + fWindowPos : TWinPos; + fHistory : TArray; + fComplex : TProcessType; + fModifyDate : TDateTime; + fWorkList : TObjectList; + published + property Sizes : TArray read fSizes write fSizes; + property LastFilename : string read fLastFilename write fLastFilename; + property WindowPos : TWinPos read fWindowPos write fWindowPos; + property History : TArray read fHistory write fHistory; + property Complex : TProcessType read fComplex write fComplex; + property ModifyDate : TDateTime read fModifyDate write fModifyDate; + property Title : string read fTitle write fTitle; + property SessionName : string read fSessionName write fSessionName; + property WorkList : TObjectList read fWorkList write fWorkList; + public + constructor Create; + destructor Destroy; override; + procedure DefaultValues; override; + end; + + TMainForm = class(TForm) + meInfo: TMemo; + btnLoadFile: TButton; + btnSaveFile: TButton; + procedure FormCreate(Sender: TObject); + procedure btnSaveFileClick(Sender: TObject); + procedure btnLoadFileClick(Sender: TObject); + procedure SetConfig(cConfig: TMyConfig); + function TestConfig(cConfig1, cConfig2 : TMyConfig) : Boolean; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + end; + +var + MainForm: TMainForm; + ConfigTest : TMyConfig; + ConfigReg : TMyConfig; + +implementation + +{$R *.dfm} + +procedure TMainForm.btnLoadFileClick(Sender: TObject); +begin + meInfo.Lines.Add('Load ConfigReg'); + ConfigReg.Load; + meInfo.Lines.Add(ConfigReg.ToJSON); + if TestConfig(configtest,ConfigReg) then meInfo.Lines.Add('Test passed successfully!'); + end; + +procedure TMainForm.btnSaveFileClick(Sender: TObject); +begin + SetConfig(ConfigReg); + ConfigReg.Save; + meInfo.Lines.Add('Saved Config in Registry at ' + DateTimeToStr(ConfigReg.LastSaved)); +end; + +procedure TMainForm.SetConfig(cConfig : TMyConfig); +var + winpos : TWinpos; + protype : TProcessType; + i : Integer; + worker : TWorker; +begin + cConfig.LastFilename := 'library.txt'; + cConfig.Sizes := [23,11,554,12,34,29,77,30,48,59,773,221,98,3,22,983,122,231,433,12,31,987]; + winpos.PosX := 640; + winpos.PosX := 480; + cConfig.WindowPos := winpos; + protype.Priority := msHigh; + protype.Redundant := False; + cConfig.Complex := protype; + cConfig.Title := 'a fresh title'; + cConfig.SessionName := 'First Session'; + for I := 0 to 22 do + begin + worker := TWorker.Create; + worker.Name := 'Process ' + i.ToString; + worker.Active := Boolean(Random(1)); + cConfig.WorkList.Add(worker); + end; + for i := 0 to 15 do + begin + protype.Id := i; + protype.Priority := msLow; + protype.Redundant := True; + cConfig.History := cConfig.History + [protype]; + end; + cConfig.ModifyDate := Now(); +end; + +function TMainForm.TestConfig(cConfig1, cConfig2 : TMyConfig) : Boolean; +var + i : Integer; +begin + Result := False; + try + Assert(cConfig1.LastFilename = cConfig2.LastFilename); + for i := Low(cConfig1.Sizes) to High(cConfig1.Sizes) do + Assert(cConfig1.Sizes[i] = cConfig2.Sizes[i]); + Assert(cConfig1.WindowPos.PosX = cConfig2.WindowPos.PosX); + Assert(cConfig1.WindowPos.PosX = cConfig2.WindowPos.PosX); + Assert(cConfig1.Complex.Priority = cConfig2.Complex.Priority); + Assert(cConfig1.Complex.Redundant = cConfig2.Complex.Redundant); + Assert(cConfig1.Title = cConfig2.Title); + for i := 0 to cConfig1.WorkList.Count - 1 do + begin + Assert(cConfig1.WorkList[i].Name = cConfig2.WorkList[i].Name); + Assert(cConfig1.WorkList[i].Active = cConfig2.WorkList[i].Active); + end; + for i := 0 to High(cConfig1.History) do + begin + Assert(cConfig1.History[i].Priority = cConfig2.History[i].Priority); + Assert(cConfig1.History[i].Redundant = cConfig2.History[i].Redundant); + end; + Result := True; + except + ShowMessage('Configuration not has been saved previously or has a corruption problem'); + end; +end; + +procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction); +begin + if Assigned(ConfigReg) then ConfigReg.Free; + if Assigned(ConfigTest) then ConfigTest.Free; +end; + +procedure TMainForm.FormCreate(Sender: TObject); +begin + ConfigReg := TMyConfig.Create; + ConfigReg.Provider.Filename := '.\config.json'; + //create config test to compare later + ConfigTest := TMyConfig.Create; + SetConfig(ConfigTest); +end; + +{ TMyConfig } + +constructor TMyConfig.Create; +begin + inherited Create; + WorkList := TObjectList.Create(True); + DefaultValues; +end; + +procedure TMyConfig.DefaultValues; +begin + inherited; + fTitle := 'Default value'; +end; + +destructor TMyConfig.Destroy; +begin + if Assigned(WorkList) then WorkList.Free; + inherited; +end; + +end. diff --git a/samples/delphi/QuickConfig/ConfigToFile/Win64/Debug/config.json b/samples/delphi/QuickConfig/ConfigToFile/Win64/Debug/config.json new file mode 100644 index 0000000..bdcb862 --- /dev/null +++ b/samples/delphi/QuickConfig/ConfigToFile/Win64/Debug/config.json @@ -0,0 +1,1309 @@ +{ + "Sizes": [ + 23, + 11, + 554, + 12, + 34, + 29, + 77, + 30, + 48, + 59, + 773, + 221, + 98, + 3, + 22, + 983, + 122, + 231, + 433, + 12, + 31, + 987 + ], + "LastFilename": "library.txt", + "WindowPos": { + "PosX": 480, + "PosY": 0 + }, + "History": [ + { + "Id": 0, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 1, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 2, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 3, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 4, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 5, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 6, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 7, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 8, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 9, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 10, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 11, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 12, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 13, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 14, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 15, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 0, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 1, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 2, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 3, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 4, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 5, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 6, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 7, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 8, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 9, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 10, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 11, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 12, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 13, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 14, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 15, + "Priority": "msLow", + "Redundant": true + } + ], + "Complex": { + "Id": 19, + "Priority": "msHigh", + "Redundant": false + }, + "ModifyDate": "2019-01-17T13:40:39.650Z", + "Title": "a fresh title", + "SessionName": "First Session", + "WorkList": { + "List": [ + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + }, + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + }, + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + }, + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + }, + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + }, + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + }, + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + }, + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + }, + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + }, + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + }, + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + }, + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + } + ] + } +} diff --git a/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/Main.dfm b/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/Main.dfm new file mode 100644 index 0000000..4fa730a --- /dev/null +++ b/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/Main.dfm @@ -0,0 +1,72 @@ +object MainForm: TMainForm + AlignWithMargins = True + Left = 0 + Top = 0 + Caption = 'Quick Config Demo' + ClientHeight = 493 + ClientWidth = 720 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + OnClose = FormClose + OnCreate = FormCreate + DesignSize = ( + 720 + 493) + PixelsPerInch = 96 + TextHeight = 13 + object meInfo: TMemo + Left = 8 + Top = 8 + Width = 704 + Height = 419 + Anchors = [akLeft, akTop, akRight, akBottom] + ReadOnly = True + ScrollBars = ssBoth + TabOrder = 0 + end + object btnLoadJson: TButton + Left = 407 + Top = 433 + Width = 145 + Height = 25 + Anchors = [akRight, akBottom] + Caption = 'Load From Json' + TabOrder = 1 + OnClick = btnLoadJsonClick + end + object btnSaveJson: TButton + Left = 558 + Top = 433 + Width = 154 + Height = 25 + Anchors = [akRight, akBottom] + Caption = 'Save To Json' + TabOrder = 2 + OnClick = btnSaveJsonClick + end + object btnLoadRegistry: TButton + Left = 407 + Top = 464 + Width = 145 + Height = 25 + Anchors = [akRight, akBottom] + Caption = 'Load From Registry' + TabOrder = 3 + OnClick = btnLoadRegistryClick + end + object SaveRegistry: TButton + Left = 558 + Top = 464 + Width = 154 + Height = 25 + Anchors = [akRight, akBottom] + Caption = 'Save To Registry' + TabOrder = 4 + OnClick = SaveRegistryClick + end +end diff --git a/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/Main.pas b/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/Main.pas new file mode 100644 index 0000000..1ef5b2a --- /dev/null +++ b/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/Main.pas @@ -0,0 +1,296 @@ +unit Main; + +interface + +uses + Winapi.Windows, + Winapi.Messages, + System.SysUtils, + System.Variants, + System.Classes, + Vcl.Graphics, + Vcl.Controls, + Vcl.Forms, + Vcl.Dialogs, + Vcl.StdCtrls, + System.Generics.Collections, + Quick.Config.Base, + Quick.Config.Registry, + Quick.Config.Json; + +type + + TMyPriority = (msLow, msMed, msHigh); + + TWinPos = record + public + PosX : Integer; + PosY : Integer; + end; + + TProcessType = record + Id : Integer; + Priority : TMyPriority; + Redundant : Boolean; + end; + + TWorker = class + private + fName : string; + fActive : Boolean; + published + property Name : string read fName write fName; + property Active : Boolean read fActive write fActive; + end; + + TMyConfigFile = class(TAppConfigJson) + private + fTitle : string; + fHidden : Boolean; + fSessionName: string; + fSizes : TArray; + fLastFilename : string; + fWindowPos : TWinPos; + fHistory : TArray; + fComplex : TProcessType; + fModifyDate : TDateTime; + fWorkList : TObjectList; + published + property Sizes : TArray read fSizes write fSizes; + property LastFilename : string read fLastFilename write fLastFilename; + property WindowPos : TWinPos read fWindowPos write fWindowPos; + property History : TArray read fHistory write fHistory; + property Complex : TProcessType read fComplex write fComplex; + property ModifyDate : TDateTime read fModifyDate write fModifyDate; + property Title : string read fTitle write fTitle; + property SessionName : string read fSessionName write fSessionName; + property WorkList : TObjectList read fWorkList write fWorkList; + public + constructor Create; override; + destructor Destroy; override; + procedure DefaultValues; override; + end; + + TMyConfigReg = class(TAppConfigRegistry) + private + fTitle : string; + fHidden : Boolean; + fSessionName: string; + fSizes : TArray; + fLastFilename : string; + fWindowPos : TWinPos; + fHistory : TArray; + fComplex : TProcessType; + fModifyDate : TDateTime; + fWorkList : TObjectList; + published + property Sizes : TArray read fSizes write fSizes; + property LastFilename : string read fLastFilename write fLastFilename; + property WindowPos : TWinPos read fWindowPos write fWindowPos; + property History : TArray read fHistory write fHistory; + property Complex : TProcessType read fComplex write fComplex; + property ModifyDate : TDateTime read fModifyDate write fModifyDate; + property Title : string read fTitle write fTitle; + property SessionName : string read fSessionName write fSessionName; + property WorkList : TObjectList read fWorkList write fWorkList; + public + constructor Create; override; + destructor Destroy; override; + procedure DefaultValues; override; + end; + + TMainForm = class(TForm) + meInfo: TMemo; + btnLoadJson: TButton; + btnSaveJson: TButton; + btnLoadRegistry: TButton; + SaveRegistry: TButton; + procedure FormCreate(Sender: TObject); + procedure btnLoadJsonClick(Sender: TObject); + procedure btnSaveJsonClick(Sender: TObject); + procedure SaveRegistryClick(Sender: TObject); + procedure btnLoadRegistryClick(Sender: TObject); + procedure SetConfig(cConfig: TAppConfig); + function TestConfig(cConfig1 : TMyConfigFile; cConfig2 : TMyConfigReg) : Boolean; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + end; + +var + MainForm: TMainForm; + ConfigJson : TMyConfigFile; + ConfigReg : TMyConfigReg; + +implementation + +{$R *.dfm} + +procedure TMainForm.btnLoadJsonClick(Sender: TObject); +var + configtest : TMyConfigReg; +begin + meInfo.Lines.Add('Load ConfigJson'); + configtest := TMyConfigReg.Create; + try + SetConfig(configtest); + ConfigJson.Load; + meInfo.Lines.Add(ConfigJson.ToJSON); + if TestConfig(ConfigJson,configtest) then meInfo.Lines.Add('Test passed successfully!'); + finally + configtest.Free; + end; +end; + +procedure TMainForm.btnLoadRegistryClick(Sender: TObject); +var + configtest : TMyConfigFile; +begin + meInfo.Lines.Add('Load ConfigReg'); + configtest := TMyConfigFile.Create; + try + SetConfig(configtest); + ConfigReg.Load; + meInfo.Lines.Add(ConfigReg.ToJSON); + if TestConfig(configtest,ConfigReg) then meInfo.Lines.Add('Test passed successfully!'); + finally + configtest.Free; + end; +end; + +procedure TMainForm.btnSaveJsonClick(Sender: TObject); +begin + SetConfig(ConfigJson); + ConfigJson.Save; + meInfo.Lines.Add('Saved Config in Json at ' + DateTimeToStr(ConfigJson.LastSaved)); +end; + +procedure TMainForm.SaveRegistryClick(Sender: TObject); +begin + SetConfig(ConfigReg); + ConfigReg.Save; + meInfo.Lines.Add('Saved Config in Registry at ' + DateTimeToStr(ConfigReg.LastSaved)); +end; + +procedure TMainForm.SetConfig(cConfig : TAppConfig); +var + winpos : TWinpos; + protype : TProcessType; + i : Integer; + worker : TWorker; + test : TMyConfigFile; +begin + test := TMyConfigFile(cConfig); + test.LastFilename := 'library.txt'; + test.Sizes := [23,11,554,12,34,29,77,30,48,59,773,221,98,3,22,983,122,231,433,12,31,987]; + winpos.PosX := 640; + winpos.PosX := 480; + test.WindowPos := winpos; + protype.Priority := msHigh; + protype.Redundant := False; + test.Complex := protype; + test.Title := 'a fresh title'; + test.SessionName := 'First Session'; + for I := 0 to 22 do + begin + worker := TWorker.Create; + worker.Name := 'Process ' + i.ToString; + worker.Active := Boolean(Random(1)); + test.WorkList.Add(worker); + end; + for i := 0 to 15 do + begin + protype.Id := i; + protype.Priority := msLow; + protype.Redundant := True; + test.History := test.History + [protype]; + end; + test.ModifyDate := Now(); +end; + +function TMainForm.TestConfig(cConfig1 : TMyConfigFile; cConfig2 : TMyConfigReg) : Boolean; +var + i : Integer; +begin + Result := False; + try + Assert(cConfig1.LastFilename = cConfig2.LastFilename); + for i := Low(cConfig1.Sizes) to High(cConfig1.Sizes) do + Assert(cConfig1.Sizes[i] = cConfig2.Sizes[i]); + Assert(cConfig1.WindowPos.PosX = cConfig2.WindowPos.PosX); + Assert(cConfig1.WindowPos.PosX = cConfig2.WindowPos.PosX); + Assert(cConfig1.Complex.Priority = cConfig2.Complex.Priority); + Assert(cConfig1.Complex.Redundant = cConfig2.Complex.Redundant); + Assert(cConfig1.Title = cConfig2.Title); + for i := 0 to cConfig1.WorkList.Count - 1 do + begin + Assert(cConfig1.WorkList[i].Name = cConfig2.WorkList[i].Name); + Assert(cConfig1.WorkList[i].Active = cConfig2.WorkList[i].Active); + end; + for i := 0 to High(cConfig1.History) do + begin + Assert(cConfig1.History[i].Priority = cConfig2.History[i].Priority); + Assert(cConfig1.History[i].Redundant = cConfig2.History[i].Redundant); + end; + Result := True; + except + ShowMessage('Configuration not has been saved previously or has a corruption problem'); + end; +end; + +procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction); +begin + if Assigned(ConfigReg) then ConfigReg.Free; + if Assigned(ConfigJson) then ConfigJson.Free; +end; + +procedure TMainForm.FormCreate(Sender: TObject); +begin + ConfigJson := TMyConfigFile.Create; + ConfigJson.Provider.CreateIfNotExists := True; + ConfigJson.Provider.Filename := 'Config.json'; + ConfigReg := TMyConfigReg.Create; + ConfigReg.Provider.HRoot := HKEY_CURRENT_USER; + ConfigReg.Provider.MainKey := '_AppConfig'; +end; + +{ TMyConfig } + +constructor TMyConfigFile.Create; +begin + inherited; + WorkList := TObjectList.Create(True); + DefaultValues; +end; + +procedure TMyConfigFile.DefaultValues; +begin + fTitle := 'Default value'; +end; + +destructor TMyConfigFile.Destroy; +begin + if Assigned(WorkList) then WorkList.Free; + inherited; +end; + +{ TMyConfigReg } + +constructor TMyConfigReg.Create; +begin + inherited; + WorkList := TObjectList.Create(True); + DefaultValues; +end; + +procedure TMyConfigReg.DefaultValues; +begin + inherited; + fTitle := 'Default value'; +end; + +destructor TMyConfigReg.Destroy; +begin + if Assigned(WorkList) then WorkList.Free; + inherited; +end; + +end. diff --git a/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfigDemo.dpr b/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfigDemo.dpr new file mode 100644 index 0000000..b368864 --- /dev/null +++ b/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfigDemo.dpr @@ -0,0 +1,15 @@ +program QuickConfigDemo; + +uses + Vcl.Forms, + Main in 'Main.pas' {MainForm}; + +{$R *.res} + +begin + ReportMemoryLeaksOnShutdown := True; + Application.Initialize; + Application.MainFormOnTaskbar := True; + Application.CreateForm(TMainForm, MainForm); + Application.Run; +end. diff --git a/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfigDemo.dproj b/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfigDemo.dproj new file mode 100644 index 0000000..d1db73b --- /dev/null +++ b/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfigDemo.dproj @@ -0,0 +1,652 @@ + + + {CDEBAD41-A241-457F-96FD-E367D8E3B0AE} + 18.5 + VCL + QuickConfigDemo.dpr + True + Debug + Win64 + 3 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + false + false + false + false + false + RESTComponents;FireDACIBDriver;FireDACCommon;RESTBackendComponents;soapserver;CloudService;FireDACCommonDriver;inet;FireDAC;FireDACSqliteDriver;soaprtl;soapmidas;$(DCC_UsePackage) + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + $(BDS)\bin\delphi_PROJECTICON.ico + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + QuickConfigDemo + + + DBXSqliteDriver;UbuntuProgressPackage;DBXInterBaseDriver;vclactnband;vclFireDAC;tethering;svnui;JvGlobus;FireDACADSDriver;JvPluginSystem;JvMM;vacommpkgdXE11;tmsxlsdXE11;vcltouch;JvBands;vcldb;bindcompfmx;svn;Intraweb;JvJans;JvNet;inetdb;JvAppFrm;EssentialsDR;vcwdedXE11;vcwdXE11;FmxTeeUI;JvDotNetCtrls;AbbreviaVCLD;fmx;fmxdae;tmsdXE11;vclib;JvWizards;tmsexdXE11;dbexpress;IndyCore;vclx;JvPageComps;dsnap;JvDB;VCLRESTComponents;JclDeveloperTools;vclie;bindengine;DBXMySQLDriver;JvCmp;FireDACMySQLDriver;JvHMI;FireDACCommonODBC;LockBoxDR;bindcompdbx;IndyIPCommon;JvCustom;advchartdedxe11;vcl;IndyIPServer;GR32_D;JvXPCtrls;PngComponents;IndySystem;advchartdxe11;dsnapcon;FireDACMSAccDriver;fmxFireDAC;vclimg;vacommpkgdedXE11;TeeDB;Jcl;madBasic_;JvCore;JvCrypt;FireDACPgDriver;ibmonitor;FMXTee;SevenZippro;DbxCommonDriver;JvDlgs;JvRuntimeDesign;ibxpress;Tee;JvManagedThreads;xmlrtl;ibxbindings;fmxobj;vclwinx;JvTimeFramework;rtl;GR32_R;DbxClientDriver;QuickVCL;CustomIPTransport;vcldsnap;JvSystem;JvStdCtrls;DCEF_DX10;bindcomp;appanalytics;tmswizdXE11;CoolTrayIcon_D210_XE7;IndyIPClient;bindcompvcl;TeeUI;TMSFMXPackPkgDXE11;JvDocking;dbxcds;VclSmp;JvPascalInterpreter;adortl;JclVcl;Gauge3D;dsnapxml;dbrtl;inetdbxpress;IndyProtocols;JvControls;JvPrintPreview;Analog_XE7;JclContainers;fmxase;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + $(BDS)\bin\default_app.manifest + + + DBXSqliteDriver;DBXInterBaseDriver;vclactnband;vclFireDAC;tethering;FireDACADSDriver;vcltouch;vcldb;bindcompfmx;Intraweb;inetdb;EssentialsDR;vcwdXE11;FmxTeeUI;AbbreviaVCLD;fmx;fmxdae;tmsdXE11;vclib;tmsexdXE11;dbexpress;IndyCore;vclx;dsnap;VCLRESTComponents;vclie;bindengine;DBXMySQLDriver;FireDACMySQLDriver;FireDACCommonODBC;bindcompdbx;IndyIPCommon;vcl;IndyIPServer;IndySystem;advchartdxe11;dsnapcon;FireDACMSAccDriver;fmxFireDAC;vclimg;TeeDB;FireDACPgDriver;ibmonitor;FMXTee;DbxCommonDriver;ibxpress;Tee;xmlrtl;ibxbindings;fmxobj;vclwinx;rtl;DbxClientDriver;QuickVCL;CustomIPTransport;vcldsnap;DCEF_DX10;bindcomp;appanalytics;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;dsnapxml;dbrtl;inetdbxpress;IndyProtocols;fmxase;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + $(BDS)\bin\default_app.manifest + + + DEBUG;$(DCC_Define) + true + false + true + true + true + + + false + true + PerMonitor + + + true + PerMonitor + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + true + PerMonitor + + + true + PerMonitor + + + + MainSource + + +
MainForm
+ dfm +
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + Delphi.Personality.12 + Application + + + + QuickConfigDemo.dpr + + + + + + QuickConfigDemo.rsm + true + + + + + QuickConfigDemo.exe + true + + + + + QuickConfigDemo.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 1 + + + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + + + res\values + 1 + + + + + res\values-v21 + 1 + + + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + 1 + + + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + + + + + + + + + + True + True + + False + + 12 + + + + +
diff --git a/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfigDemo.res b/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfigDemo.res new file mode 100644 index 0000000..636c1dc Binary files /dev/null and b/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfigDemo.res differ diff --git a/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/Win64/Debug/Config.json b/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/Win64/Debug/Config.json new file mode 100644 index 0000000..0c04bb3 --- /dev/null +++ b/samples/delphi/QuickConfig/ConfigToFileAndRegistry_deprecated/Win64/Debug/Config.json @@ -0,0 +1,217 @@ +{ + "Sizes": [ + 23, + 11, + 554, + 12, + 34, + 29, + 77, + 30, + 48, + 59, + 773, + 221, + 98, + 3, + 22, + 983, + 122, + 231, + 433, + 12, + 31, + 987 + ], + "LastFilename": "library.txt", + "WindowPos": { + "PosX": 480, + "PosY": 0 + }, + "History": [ + { + "Id": 0, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 1, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 2, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 3, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 4, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 5, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 6, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 7, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 8, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 9, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 10, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 11, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 12, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 13, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 14, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 15, + "Priority": "msLow", + "Redundant": true + } + ], + "Complex": { + "Id": 19, + "Priority": "msHigh", + "Redundant": false + }, + "ModifyDate": "2019-01-16T13:20:56.205Z", + "Title": "a fresh title", + "SessionName": "First Session", + "WorkList": { + "List": [ + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + } + ] + } +} diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/AndroidManifest.xml b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/AndroidManifest.xml new file mode 100644 index 0000000..ff3d185 --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/AndroidManifest.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/AndroidManifest.xml b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/AndroidManifest.xml new file mode 100644 index 0000000..ff3d185 --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/AndroidManifest.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/classes/classes.dex b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/classes/classes.dex new file mode 100644 index 0000000..b7143bb Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/classes/classes.dex differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/library/lib/armeabi-v7a/gdbserver b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/library/lib/armeabi-v7a/gdbserver new file mode 100644 index 0000000..74614f7 Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/library/lib/armeabi-v7a/gdbserver differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-hdpi/ic_launcher.png b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 0000000..2850c82 Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-hdpi/ic_launcher.png differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-large/splash_image.png b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-large/splash_image.png new file mode 100644 index 0000000..babc829 Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-large/splash_image.png differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-ldpi/ic_launcher.png b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-ldpi/ic_launcher.png new file mode 100644 index 0000000..6f59421 Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-ldpi/ic_launcher.png differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-mdpi/ic_launcher.png b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 0000000..9a6d892 Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-mdpi/ic_launcher.png differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-normal/splash_image.png b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-normal/splash_image.png new file mode 100644 index 0000000..7266612 Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-normal/splash_image.png differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-small/splash_image.png b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-small/splash_image.png new file mode 100644 index 0000000..9a67bb3 Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-small/splash_image.png differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-xhdpi/ic_launcher.png b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 0000000..fefe62e Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-xhdpi/ic_launcher.png differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-xlarge/splash_image.png b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-xlarge/splash_image.png new file mode 100644 index 0000000..72bd191 Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-xlarge/splash_image.png differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-xxhdpi/ic_launcher.png b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..0abc131 Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable/splash_image_def.xml b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable/splash_image_def.xml new file mode 100644 index 0000000..90fc726 --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/drawable/splash_image_def.xml @@ -0,0 +1,9 @@ + + diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/values-v21/styles.xml b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/values-v21/styles.xml new file mode 100644 index 0000000..ccf48fe --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/values-v21/styles.xml @@ -0,0 +1,6 @@ + + + diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/values/styles.xml b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/values/styles.xml new file mode 100644 index 0000000..b46b069 --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/ConfigToFile/res/values/styles.xml @@ -0,0 +1,6 @@ + + + diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/classes.dex b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/classes.dex new file mode 100644 index 0000000..b7143bb Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/classes.dex differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/splash_image_def.xml b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/splash_image_def.xml new file mode 100644 index 0000000..90fc726 --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/splash_image_def.xml @@ -0,0 +1,9 @@ + + diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/styles-v21.xml b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/styles-v21.xml new file mode 100644 index 0000000..ccf48fe --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/styles-v21.xml @@ -0,0 +1,6 @@ + + + diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/styles.xml b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/styles.xml new file mode 100644 index 0000000..b46b069 --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/Android/Debug/styles.xml @@ -0,0 +1,6 @@ + + + diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/AndroidManifest.template.xml b/samples/firemonkey/QuickConfig/ConfigToFile/AndroidManifest.template.xml new file mode 100644 index 0000000..617ba38 --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/AndroidManifest.template.xml @@ -0,0 +1,43 @@ + + + + + + <%uses-permission%> + + + + <%provider%> + <%application-meta-data%> + <%services%> + + + + + + + + + + <%activity%> + <%receivers%> + + + diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/ConfigToFile.deployproj b/samples/firemonkey/QuickConfig/ConfigToFile/ConfigToFile.deployproj new file mode 100644 index 0000000..da0db89 --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/ConfigToFile.deployproj @@ -0,0 +1,232 @@ + + + + 12 + + + emulator-5554 + + + iPhone5 + + + + + + + ConfigToFile\ + ConfigToFile.exe + ProjectOutput + 0 + + + True + True + + + + + ConfigToFile.app\Contents\MacOS\ + libcgsqlite3.dylib + DependencyModule + 1 + + + True + + + ConfigToFile.app\Contents\MacOS\ + libcgunwind.1.0.dylib + DependencyModule + 1 + + + True + + + + + ConfigToFile\classes\ + classes.dex + AndroidClassesDexFile + 1 + + + True + + + ConfigToFile\res\drawable-ldpi\ + ic_launcher.png + Android_LauncherIcon36 + 1 + + + True + + + ConfigToFile\ + AndroidManifest.xml + ProjectAndroidManifest + 1 + + + True + + + ConfigToFile\library\lib\armeabi\ + libConfigToFile.so + AndroidLibnativeArmeabiFile + 1 + + + True + + + ConfigToFile\res\drawable-hdpi\ + ic_launcher.png + Android_LauncherIcon72 + 1 + + + True + + + ConfigToFile\res\drawable-xxhdpi\ + ic_launcher.png + Android_LauncherIcon144 + 1 + + + True + + + ConfigToFile\res\drawable-small\ + splash_image.png + Android_SplashImage426 + 1 + + + True + + + ConfigToFile\res\drawable-normal\ + splash_image.png + Android_SplashImage470 + 1 + + + True + + + ConfigToFile\res\drawable-large\ + splash_image.png + Android_SplashImage640 + 1 + + + True + + + ConfigToFile\res\drawable-xhdpi\ + ic_launcher.png + Android_LauncherIcon96 + 1 + + + True + + + ConfigToFile\res\drawable-xlarge\ + splash_image.png + Android_SplashImage960 + 1 + + + True + + + ConfigToFile\library\lib\armeabi-v7a\ + libConfigToFile.so + ProjectOutput + 1 + + + True + True + + + ConfigToFile\res\drawable-mdpi\ + ic_launcher.png + Android_LauncherIcon48 + 1 + + + True + + + ConfigToFile\library\lib\mips\ + libConfigToFile.so + AndroidLibnativeMipsFile + 1 + + + True + + + ConfigToFile\library\lib\armeabi-v7a\ + gdbserver + AndroidGDBServer + 1 + + + True + + + ConfigToFile\res\values-v21\ + styles.xml + AndroidSplashStylesV21 + 1 + + + True + + + ConfigToFile\res\drawable\ + splash_image_def.xml + AndroidSplashImageDef + 1 + + + True + + + ConfigToFile\res\values\ + styles.xml + AndroidSplashStyles + 1 + + + True + + + + + ConfigToFile.app\ + libcgunwind.1.0.dylib + DependencyModule + 1 + + + True + + + ConfigToFile.app\ + libpcre.dylib + DependencyModule + 1 + + + True + + + diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/ConfigToFile.dpr b/samples/firemonkey/QuickConfig/ConfigToFile/ConfigToFile.dpr new file mode 100644 index 0000000..90ab38b --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/ConfigToFile.dpr @@ -0,0 +1,14 @@ +program ConfigToFile; + +uses + System.StartUpCopy, + FMX.Forms, + Main in 'Main.pas' {MainForm}; + +{$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TMainForm, MainForm); + Application.Run; +end. diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/ConfigToFile.dproj b/samples/firemonkey/QuickConfig/ConfigToFile/ConfigToFile.dproj new file mode 100644 index 0000000..662931b --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/ConfigToFile.dproj @@ -0,0 +1,960 @@ + + + {D93EB58E-5F98-4C8B-9E16-A2DEF8DE9BF6} + 18.5 + FMX + ConfigToFile.dpr + True + Debug + Android + 1119 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + false + false + false + false + false + System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace) + true + true + true + true + true + true + true + true + $(BDS)\bin\delphi_PROJECTICON.ico + $(BDS)\bin\delphi_PROJECTICNS.icns + ConfigToFile + + + DBXSqliteDriver;RESTComponents;DBXInterBaseDriver;emsclientfiredac;DataSnapFireDAC;tethering;bindcompfmx;FmxTeeUI;FireDACIBDriver;fmx;FlatButtonSet;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;ibmonitor;FMXTee;soaprtl;DbxCommonDriver;ibxpress;xmlrtl;soapmidas;DataSnapNativeClient;ibxbindings;rtl;DbxClientDriver;FireDACDSDriver;CustomIPTransport;bindcomp;CoolTrayIcon_D210_XE7;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;$(DCC_UsePackage) + package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey= + Debug + true + $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png + $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png + $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png + $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png + $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png + $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png + $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png + $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png + $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png + android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services-ads-7.0.0.dex.jar;google-play-services-analytics-7.0.0.dex.jar;google-play-services-base-7.0.0.dex.jar;google-play-services-gcm-7.0.0.dex.jar;google-play-services-identity-7.0.0.dex.jar;google-play-services-maps-7.0.0.dex.jar;google-play-services-panorama-7.0.0.dex.jar;google-play-services-plus-7.0.0.dex.jar;google-play-services-wallet-7.0.0.dex.jar + + + DBXSqliteDriver;RESTComponents;DBXInterBaseDriver;emsclientfiredac;DataSnapFireDAC;tethering;bindcompfmx;FmxTeeUI;FireDACIBDriver;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;ibmonitor;FMXTee;soaprtl;DbxCommonDriver;ibxpress;xmlrtl;soapmidas;DataSnapNativeClient;ibxbindings;rtl;DbxClientDriver;FireDACDSDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;fmxase;$(DCC_UsePackage) + CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;NSLocationAlwaysAndWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=;NSContactsUsageDescription=The reason for accessing the contacts;NSPhotoLibraryUsageDescription=The reason for accessing the photo library;NSPhotoLibraryAddUsageDescription=The reason for adding to the photo library;NSCameraUsageDescription=The reason for accessing the camera;NSFaceIDUsageDescription=The reason for accessing the face id;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSSiriUsageDescription=The reason for accessing Siri + iPhoneAndiPad + true + Debug + $(MSBuildProjectName) + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_57x57.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_87x87.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_114x114.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_180x180.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_320x480.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x960.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x1136.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_750x1334.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1242x2208.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2208x1242.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1125x2436.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2436x1125.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_29x29.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_58x58.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_72x72.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_144x144.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1004.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x748.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2008.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1496.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_50x50.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_100x100.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_29x29.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_58x58.png + + + DBXSqliteDriver;RESTComponents;DBXInterBaseDriver;emsclientfiredac;DataSnapFireDAC;tethering;bindcompfmx;FmxTeeUI;FireDACIBDriver;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;ibmonitor;FMXTee;soaprtl;DbxCommonDriver;ibxpress;xmlrtl;soapmidas;DataSnapNativeClient;ibxbindings;rtl;DbxClientDriver;FireDACDSDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;fmxase;$(DCC_UsePackage) + CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;NSLocationAlwaysAndWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=;NSContactsUsageDescription=The reason for accessing the contacts;NSPhotoLibraryUsageDescription=The reason for accessing the photo library;NSPhotoLibraryAddUsageDescription=The reason for adding to the photo library;NSCameraUsageDescription=The reason for accessing the camera;NSFaceIDUsageDescription=The reason for accessing the face id;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSSiriUsageDescription=The reason for accessing Siri + iPhoneAndiPad + true + Debug + $(MSBuildProjectName) + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_57x57.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_87x87.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_114x114.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_180x180.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_320x480.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x960.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x1136.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_750x1334.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1242x2208.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2208x1242.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1125x2436.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2436x1125.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_29x29.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_58x58.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_72x72.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_144x144.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1004.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x748.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2008.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1496.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_50x50.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_100x100.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_29x29.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_58x58.png + + + DBXSqliteDriver;RESTComponents;DBXInterBaseDriver;emsclientfiredac;DataSnapFireDAC;tethering;bindcompfmx;FmxTeeUI;FireDACIBDriver;fmx;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;soapserver;bindengine;CloudService;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;ibmonitor;FMXTee;soaprtl;DbxCommonDriver;ibxpress;xmlrtl;soapmidas;DataSnapNativeClient;ibxbindings;rtl;DbxClientDriver;FireDACDSDriver;CustomIPTransport;bindcomp;IndyIPClient;dbxcds;dsnapxml;DataSnapProviderClient;dbrtl;IndyProtocols;fmxase;$(DCC_UsePackage) + CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;NSLocationAlwaysAndWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=;NSContactsUsageDescription=The reason for accessing the contacts;NSPhotoLibraryUsageDescription=The reason for accessing the photo library;NSPhotoLibraryAddUsageDescription=The reason for adding to the photo library;NSCameraUsageDescription=The reason for accessing the camera;NSFaceIDUsageDescription=The reason for accessing the face id;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSSiriUsageDescription=The reason for accessing Siri + iPhoneAndiPad + true + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_57x57.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_87x87.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_114x114.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_180x180.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_320x480.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x960.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_640x1136.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_750x1334.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1242x2208.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2208x1242.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_1125x2436.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2436x1125.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_29x29.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_58x58.png + $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_72x72.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_144x144.png + $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1004.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x748.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2008.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1496.png + $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_50x50.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_100x100.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_29x29.png + $(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_58x58.png + + + DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXInterBaseDriver;emsclientfiredac;DataSnapFireDAC;tethering;FireDACMSSQLDriver;bindcompfmx;DBXOracleDriver;inetdb;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;FireDACDBXDriver;dbexpress;IndyCore;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;soapserver;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;IndyIPServer;IndySystem;fmxFireDAC;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;ibxbindings;rtl;DbxClientDriver;FireDACDSDriver;DBXSybaseASADriver;CustomIPTransport;bindcomp;DBXInformixDriver;IndyIPClient;dbxcds;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage) + CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;NSLocationAlwaysAndWhenInUseUsageDescription=The reason for accessing the location information of the user;NSContactsUsageDescription=The reason for accessing the contacts + Debug + true + + + DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;UbuntuProgressPackage;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;svnui;tethering;JvGlobus;FireDACADSDriver;JvPluginSystem;tmswizdXE12;DBXMSSQLDriver;JvMM;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;JvBands;vcldb;bindcompfmx;svn;Intraweb;DBXOracleDriver;JvJans;JvNet;inetdb;JvAppFrm;FmxTeeUI;emsedge;JvDotNetCtrls;FireDACIBDriver;fmx;fmxdae;vclib;FlatButtonSet;JvWizards;FireDACDBXDriver;dbexpress;IndyCore;vclx;JvPageComps;dsnap;DataSnapCommon;emsclient;FireDACCommon;JvDB;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;JclDeveloperTools;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;JvCmp;JvHMI;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;GR32_D;JvCustom;vcl;IndyIPServer;DBXSybaseASEDriver;JvXPCtrls;PngComponents;IndySystem;FireDACDb2Driver;dsnapcon;tmsxlsdXE12;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;Jcl;JvCore;emshosting;JvCrypt;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;tmsdXE12;FireDACTDataDriver;DBXOdbcDriver;FMXTee;soaprtl;DbxCommonDriver;JvDlgs;JvRuntimeDesign;ibxpress;Tee;JvManagedThreads;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;emsserverresource;DbxClientDriver;FireDACDSDriver;DBXSybaseASADriver;GR32_R;CustomIPTransport;vcldsnap;JvTimeFramework;JvSystem;JvStdCtrls;tmsexdXE12;bindcomp;appanalytics;CoolTrayIcon_D210_XE7;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;JvDocking;dbxcds;VclSmp;KernowSoftwareFMX;adortl;FireDACODBCDriver;JvPascalInterpreter;TMSFMXPackPkgDXE12;JclVcl;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;JvControls;JvPrintPreview;Analog_XE7;JclContainers;fmxase;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + $(BDS)\bin\default_app.manifest + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + + + DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;Intraweb;DBXOracleDriver;inetdb;FmxTeeUI;emsedge;FireDACIBDriver;fmx;fmxdae;vclib;FlatButtonSet;FireDACDBXDriver;dbexpress;IndyCore;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;IndyIPCommon;vcl;IndyIPServer;DBXSybaseASEDriver;PngComponents;IndySystem;FireDACDb2Driver;dsnapcon;tmsxlsdXE12;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;emshosting;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;tmsdXE12;FireDACTDataDriver;DBXOdbcDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;emsserverresource;DbxClientDriver;FireDACDSDriver;DBXSybaseASADriver;GR32_R;CustomIPTransport;vcldsnap;tmsexdXE12;bindcomp;appanalytics;DBXInformixDriver;IndyIPClient;bindcompvcl;TeeUI;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;IndyProtocols;fmxase;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + $(BDS)\bin\default_app.manifest + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + + + DEBUG;$(DCC_Define) + true + false + true + true + true + + + false + true + PerMonitorV2 + + + true + PerMonitorV2 + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + true + PerMonitorV2 + + + true + PerMonitorV2 + + + + MainSource + + +
MainForm
+ fmx +
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + Delphi.Personality.12 + Application + + + + ConfigToFile.dpr + + + + + + classes.dex + true + + + + + ic_launcher.png + true + + + + + true + + + + + libConfigToFile.so + true + + + + + ic_launcher.png + true + + + + + true + + + + + true + + + + + true + + + + + ic_launcher.png + true + + + + + splash_image.png + true + + + + + splash_image.png + true + + + + + splash_image.png + true + + + + + true + + + + + ic_launcher.png + true + + + + + splash_image.png + true + + + + + libConfigToFile.so + true + + + + + true + + + + + ic_launcher.png + true + + + + + libConfigToFile.so + true + + + + + true + + + + + styles.xml + true + + + + + ConfigToFile.exe + true + + + + + true + + + + + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 1 + + + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + + + res\values + 1 + + + + + res\values-v21 + 1 + + + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + 1 + + + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + + + + + + + + + + True + True + True + True + True + True + True + + + 12 + + + + +
diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/ConfigToFile.res b/samples/firemonkey/QuickConfig/ConfigToFile/ConfigToFile.res new file mode 100644 index 0000000..36f26e2 Binary files /dev/null and b/samples/firemonkey/QuickConfig/ConfigToFile/ConfigToFile.res differ diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Main.fmx b/samples/firemonkey/QuickConfig/ConfigToFile/Main.fmx new file mode 100644 index 0000000..6d9706d --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/Main.fmx @@ -0,0 +1,48 @@ +object MainForm: TMainForm + Left = 0 + Top = 0 + Caption = 'MainForm' + ClientHeight = 480 + ClientWidth = 366 + FormFactor.Width = 320 + FormFactor.Height = 480 + FormFactor.Devices = [Desktop] + OnCreate = FormCreate + DesignerMasterStyle = 0 + object meInfo: TMemo + Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] + DataDetectorTypes = [] + Align = Client + Size.Width = 366.000000000000000000 + Size.Height = 408.000000000000000000 + Size.PlatformDefault = False + TabOrder = 0 + Viewport.Width = 362.000000000000000000 + Viewport.Height = 404.000000000000000000 + end + object Panel1: TPanel + Align = MostBottom + Position.Y = 408.000000000000000000 + Size.Width = 366.000000000000000000 + Size.Height = 72.000000000000000000 + Size.PlatformDefault = False + TabOrder = 1 + object btnLoadJson: TSpeedButton + Align = Left + Size.Width = 137.000000000000000000 + Size.Height = 72.000000000000000000 + Size.PlatformDefault = False + Text = 'Load from File' + OnClick = btnLoadJsonClick + end + object btnSaveJson: TSpeedButton + Align = Right + Position.X = 184.000000000000000000 + Size.Width = 182.000000000000000000 + Size.Height = 72.000000000000000000 + Size.PlatformDefault = False + Text = 'Save to File' + OnClick = btnSaveJsonClick + end + end +end diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Main.pas b/samples/firemonkey/QuickConfig/ConfigToFile/Main.pas new file mode 100644 index 0000000..a10f812 --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/Main.pas @@ -0,0 +1,207 @@ +unit Main; + +interface + +uses + System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, + FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, + System.Generics.Collections, System.IOUtils, + Quick.Config.Json, FMX.StdCtrls, FMX.Controls.Presentation, + FMX.ScrollBox, FMX.Memo; + +type + + TMyPriority = (msLow, msMed, msHigh); + + TWinPos = record + public + PosX : Integer; + PosY : Integer; + end; + + TProcessType = record + Id : Integer; + Priority : TMyPriority; + Redundant : Boolean; + end; + + TWorker = class + private + fName : string; + fActive : Boolean; + published + property Name : string read fName write fName; + property Active : Boolean read fActive write fActive; + end; + + TMyConfig = class(TAppConfigJson) + private + fTitle : string; + fHidden : Boolean; + fSessionName: string; + fSizes : TArray; + fLastFilename : string; + fWindowPos : TWinPos; + fHistory : TArray; + fComplex : TProcessType; + fModifyDate : TDateTime; + fWorkList : TObjectList; + published + property Sizes : TArray read fSizes write fSizes; + property LastFilename : string read fLastFilename write fLastFilename; + property WindowPos : TWinPos read fWindowPos write fWindowPos; + property History : TArray read fHistory write fHistory; + property Complex : TProcessType read fComplex write fComplex; + property ModifyDate : TDateTime read fModifyDate write fModifyDate; + property Title : string read fTitle write fTitle; + property SessionName : string read fSessionName write fSessionName; + property WorkList : TObjectList read fWorkList write fWorkList; + public + constructor Create; + destructor Destroy; override; + procedure DefaultValues; override; + end; + + TMainForm = class(TForm) + meInfo: TMemo; + Panel1: TPanel; + btnLoadJson: TSpeedButton; + btnSaveJson: TSpeedButton; + procedure FormCreate(Sender: TObject); + procedure SetConfig(cConfig: TMyConfig); + function TestConfig(cConfig1, cConfig2 : TMyConfig) : Boolean; + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure btnLoadJsonClick(Sender: TObject); + procedure btnSaveJsonClick(Sender: TObject); + end; + +var + MainForm: TMainForm; + ConfigTest : TMyConfig; + ConfigJson : TMyConfig; + +implementation + +{$R *.fmx} + + +procedure TMainForm.btnLoadJsonClick(Sender: TObject); +begin + meInfo.Lines.Add('Load ConfigReg'); + ConfigJson.Load; + meInfo.Lines.Add(ConfigJson.ToJSON); + if TestConfig(configtest,ConfigJson) then meInfo.Lines.Add('Test passed successfully!'); +end; + +procedure TMainForm.btnSaveJsonClick(Sender: TObject); +begin + SetConfig(ConfigJson); + ConfigJson.Save; + meInfo.Lines.Add('Saved Config in Registry at ' + DateTimeToStr(ConfigJson.LastSaved)); +end; + +procedure TMainForm.SetConfig(cConfig : TMyConfig); +var + winpos : TWinpos; + protype : TProcessType; + i : Integer; + worker : TWorker; +begin + cConfig.LastFilename := 'library.txt'; + cConfig.Sizes := [23,11,554,12,34,29,77,30,48,59,773,221,98,3,22,983,122,231,433,12,31,987]; + winpos.PosX := 640; + winpos.PosX := 480; + cConfig.WindowPos := winpos; + protype.Priority := msHigh; + protype.Redundant := False; + cConfig.Complex := protype; + cConfig.Title := 'a fresh title'; + cConfig.SessionName := 'First Session'; + for I := 0 to 22 do + begin + worker := TWorker.Create; + worker.Name := 'Process ' + i.ToString; + worker.Active := Boolean(Random(1)); + cConfig.WorkList.Add(worker); + end; + for i := 0 to 15 do + begin + protype.Id := i; + protype.Priority := msLow; + protype.Redundant := True; + cConfig.History := cConfig.History + [protype]; + end; + cConfig.ModifyDate := Now(); +end; + +function TMainForm.TestConfig(cConfig1, cConfig2 : TMyConfig) : Boolean; +var + i : Integer; +begin + Result := False; + try + Assert(cConfig1.LastFilename = cConfig2.LastFilename); + for i := Low(cConfig1.Sizes) to High(cConfig1.Sizes) do + Assert(cConfig1.Sizes[i] = cConfig2.Sizes[i]); + Assert(cConfig1.WindowPos.PosX = cConfig2.WindowPos.PosX); + Assert(cConfig1.WindowPos.PosX = cConfig2.WindowPos.PosX); + Assert(cConfig1.Complex.Priority = cConfig2.Complex.Priority); + Assert(cConfig1.Complex.Redundant = cConfig2.Complex.Redundant); + Assert(cConfig1.Title = cConfig2.Title); + for i := 0 to cConfig1.WorkList.Count - 1 do + begin + Assert(cConfig1.WorkList[i].Name = cConfig2.WorkList[i].Name); + Assert(cConfig1.WorkList[i].Active = cConfig2.WorkList[i].Active); + end; + for i := 0 to High(cConfig1.History) do + begin + Assert(cConfig1.History[i].Priority = cConfig2.History[i].Priority); + Assert(cConfig1.History[i].Redundant = cConfig2.History[i].Redundant); + end; + Result := True; + except + ShowMessage('Configuration not has been saved previously or has a corruption problem'); + end; +end; + +procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction); +begin + if Assigned(ConfigJson) then ConfigJson.Free; + if Assigned(ConfigTest) then ConfigTest.Free; +end; + +procedure TMainForm.FormCreate(Sender: TObject); +begin + ConfigJson := TMyConfig.Create; + {$IFDEF NEXTGEN} + ConfigJson.Provider.Filename := TPath.GetDocumentsPath + '/config.json'; + {$ELSE} + ConfigJson.Provider.Filename := '.\config.json'; + {$ENDIF} + //create config test to compare later + ConfigTest := TMyConfig.Create; + SetConfig(ConfigTest); +end; + +{ TMyConfig } + +constructor TMyConfig.Create; +begin + inherited Create; + WorkList := TObjectList.Create(True); + DefaultValues; +end; + +procedure TMyConfig.DefaultValues; +begin + inherited; + fTitle := 'Default value'; +end; + +destructor TMyConfig.Destroy; +begin + if Assigned(WorkList) then WorkList.Free; + inherited; +end; + +end. \ No newline at end of file diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Win32/Debug/config.json b/samples/firemonkey/QuickConfig/ConfigToFile/Win32/Debug/config.json new file mode 100644 index 0000000..d483ce9 --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/Win32/Debug/config.json @@ -0,0 +1,217 @@ +{ + "Sizes": [ + 23, + 11, + 554, + 12, + 34, + 29, + 77, + 30, + 48, + 59, + 773, + 221, + 98, + 3, + 22, + 983, + 122, + 231, + 433, + 12, + 31, + 987 + ], + "LastFilename": "library.txt", + "WindowPos": { + "PosX": 480, + "PosY": 9726500 + }, + "History": [ + { + "Id": 0, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 1, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 2, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 3, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 4, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 5, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 6, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 7, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 8, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 9, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 10, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 11, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 12, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 13, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 14, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 15, + "Priority": "msLow", + "Redundant": true + } + ], + "Complex": { + "Id": 1702832, + "Priority": "msHigh", + "Redundant": false + }, + "ModifyDate": "2019-01-17T14:03:28.808Z", + "Title": "a fresh title", + "SessionName": "First Session", + "WorkList": { + "List": [ + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + } + ] + } +} diff --git a/samples/firemonkey/QuickConfig/ConfigToFile/Win64/Debug/config.json b/samples/firemonkey/QuickConfig/ConfigToFile/Win64/Debug/config.json new file mode 100644 index 0000000..2a4f2fd --- /dev/null +++ b/samples/firemonkey/QuickConfig/ConfigToFile/Win64/Debug/config.json @@ -0,0 +1,217 @@ +{ + "Sizes": [ + 23, + 11, + 554, + 12, + 34, + 29, + 77, + 30, + 48, + 59, + 773, + 221, + 98, + 3, + 22, + 983, + 122, + 231, + 433, + 12, + 31, + 987 + ], + "LastFilename": "library.txt", + "WindowPos": { + "PosX": 480, + "PosY": 0 + }, + "History": [ + { + "Id": 0, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 1, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 2, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 3, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 4, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 5, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 6, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 7, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 8, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 9, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 10, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 11, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 12, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 13, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 14, + "Priority": "msLow", + "Redundant": true + }, + { + "Id": 15, + "Priority": "msLow", + "Redundant": true + } + ], + "Complex": { + "Id": 269729584, + "Priority": "msHigh", + "Redundant": false + }, + "ModifyDate": "2019-01-17T23:08:53.216Z", + "Title": "a fresh title", + "SessionName": "First Session", + "WorkList": { + "List": [ + { + "Name": "Process 0", + "Active": false + }, + { + "Name": "Process 1", + "Active": false + }, + { + "Name": "Process 2", + "Active": false + }, + { + "Name": "Process 3", + "Active": false + }, + { + "Name": "Process 4", + "Active": false + }, + { + "Name": "Process 5", + "Active": false + }, + { + "Name": "Process 6", + "Active": false + }, + { + "Name": "Process 7", + "Active": false + }, + { + "Name": "Process 8", + "Active": false + }, + { + "Name": "Process 9", + "Active": false + }, + { + "Name": "Process 10", + "Active": false + }, + { + "Name": "Process 11", + "Active": false + }, + { + "Name": "Process 12", + "Active": false + }, + { + "Name": "Process 13", + "Active": false + }, + { + "Name": "Process 14", + "Active": false + }, + { + "Name": "Process 15", + "Active": false + }, + { + "Name": "Process 16", + "Active": false + }, + { + "Name": "Process 17", + "Active": false + }, + { + "Name": "Process 18", + "Active": false + }, + { + "Name": "Process 19", + "Active": false + }, + { + "Name": "Process 20", + "Active": false + }, + { + "Name": "Process 21", + "Active": false + }, + { + "Name": "Process 22", + "Active": false + } + ] + } +} diff --git a/samples/fpc/QuickConfig/ConfigToFile/Config.json b/samples/fpc/QuickConfig/ConfigToFile/Config.json new file mode 100644 index 0000000..02e5441 --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFile/Config.json @@ -0,0 +1,21 @@ +{ + "Title" : "hola", + "SessionName" : "Session01", + "Sizes" : [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ], + "LastFilename" : "C:\\library.txt", + "History" : [ ], + "Complex" : { + "Id" : 1, + "Priority" : "msMed", + "Redundant" : true + }, + "ModifyDate" : "2019-01-17T23:27:53.802Z " +} diff --git a/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.ico b/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.ico new file mode 100644 index 0000000..0341321 Binary files /dev/null and b/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.ico differ diff --git a/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.json b/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.json new file mode 100644 index 0000000..911befc --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.json @@ -0,0 +1,21 @@ +{ + "Title" : "hola", + "SessionName" : "Session01", + "Sizes" : [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ], + "LastFilename" : "C:\\library.txt", + "History" : [ ], + "Complex" : { + "Id" : 1, + "Priority" : "msMed", + "Redundant" : true + }, + "ModifyDate" : "2019-01-17T13:51:56.269Z " +} diff --git a/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.lpi b/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.lpi new file mode 100644 index 0000000..a4d91e0 --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.lpi @@ -0,0 +1,80 @@ + + + + + + + + + + <Scaled Value="True"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <XPManifest> + <DpiAware Value="True"/> + </XPManifest> + <Icon Value="0"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="LCL"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="QuickConfig.pas"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="umain.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="uMain"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="QuickConfig"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <OtherUnitFiles Value="..\..\..\.."/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.lpr b/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.lpr new file mode 100644 index 0000000..05a69de --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.lpr @@ -0,0 +1,20 @@ +program QuickConfig; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms; + +{$R *.res} + +begin + RequireDerivedFormResource:=True; + Application.Scaled:=True; + Application.Initialize; + Application.Run; +end. + diff --git a/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.pas b/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.pas new file mode 100644 index 0000000..cc88255 --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.pas @@ -0,0 +1,14 @@ +program QuickConfig; + +uses + Forms, Interfaces, + uMain in 'uMain.pas' {MainForm}; + +{$R *.res} + +begin + Application.Scaled:=True; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.res b/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.res new file mode 100644 index 0000000..1adb040 Binary files /dev/null and b/samples/fpc/QuickConfig/ConfigToFile/QuickConfig.res differ diff --git a/samples/fpc/QuickConfig/ConfigToFile/lib/i386-win32/QuickConfig.or b/samples/fpc/QuickConfig/ConfigToFile/lib/i386-win32/QuickConfig.or new file mode 100644 index 0000000..b88e834 Binary files /dev/null and b/samples/fpc/QuickConfig/ConfigToFile/lib/i386-win32/QuickConfig.or differ diff --git a/samples/fpc/QuickConfig/ConfigToFile/lib/i386-win32/QuickConfig.res b/samples/fpc/QuickConfig/ConfigToFile/lib/i386-win32/QuickConfig.res new file mode 100644 index 0000000..1adb040 Binary files /dev/null and b/samples/fpc/QuickConfig/ConfigToFile/lib/i386-win32/QuickConfig.res differ diff --git a/samples/fpc/QuickConfig/ConfigToFile/lib/i386-win32/umain.lfm b/samples/fpc/QuickConfig/ConfigToFile/lib/i386-win32/umain.lfm new file mode 100644 index 0000000..94768f1 --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFile/lib/i386-win32/umain.lfm @@ -0,0 +1,39 @@ +object Form1: TForm1 + Left = 379 + Height = 457 + Top = 208 + Width = 592 + Caption = 'Form1' + ClientHeight = 457 + ClientWidth = 592 + OnClose = FormClose + OnCreate = FormCreate + LCLVersion = '1.9.0.0' + object btnSaveJson: TButton + Left = 448 + Height = 25 + Top = 424 + Width = 120 + Caption = 'Save to Json' + OnClick = btnSaveJsonClick + TabOrder = 0 + end + object btnLoadJson: TButton + Left = 312 + Height = 25 + Top = 424 + Width = 123 + Caption = 'Load From Json' + OnClick = btnLoadJsonClick + TabOrder = 1 + end + object meInfo: TMemo + Left = 19 + Height = 407 + Top = 9 + Width = 549 + ReadOnly = True + ScrollBars = ssAutoBoth + TabOrder = 2 + end +end diff --git a/samples/fpc/QuickConfig/ConfigToFile/umain.lfm b/samples/fpc/QuickConfig/ConfigToFile/umain.lfm new file mode 100644 index 0000000..94768f1 --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFile/umain.lfm @@ -0,0 +1,39 @@ +object Form1: TForm1 + Left = 379 + Height = 457 + Top = 208 + Width = 592 + Caption = 'Form1' + ClientHeight = 457 + ClientWidth = 592 + OnClose = FormClose + OnCreate = FormCreate + LCLVersion = '1.9.0.0' + object btnSaveJson: TButton + Left = 448 + Height = 25 + Top = 424 + Width = 120 + Caption = 'Save to Json' + OnClick = btnSaveJsonClick + TabOrder = 0 + end + object btnLoadJson: TButton + Left = 312 + Height = 25 + Top = 424 + Width = 123 + Caption = 'Load From Json' + OnClick = btnLoadJsonClick + TabOrder = 1 + end + object meInfo: TMemo + Left = 19 + Height = 407 + Top = 9 + Width = 549 + ReadOnly = True + ScrollBars = ssAutoBoth + TabOrder = 2 + end +end diff --git a/samples/fpc/QuickConfig/ConfigToFile/umain.pas b/samples/fpc/QuickConfig/ConfigToFile/umain.pas new file mode 100644 index 0000000..9224a85 --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFile/umain.pas @@ -0,0 +1,220 @@ +unit uMain; + +{$mode delphi}{$H+} + +interface + +uses + Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, + {$IFDEF FPC} + registry, + {$ENDIF} + Quick.Config.Json, + Generics.Collections; + +type + + TMyPriority = (msLow, msMed, msHigh); + + TWinPos = class + private + fPosX : Integer; + fPosY : Integer; + published + property PosX : Integer read fPosX write fPosX; + property PosY : Integer read fPosY write fPosY; + end; + + TProcessType = class + private + fId : Integer; + fPriority : TMyPriority; + fRedundant : Boolean; + published + property Id : Integer read fId write fId; + property Priority : TMyPriority read fPriority write fPriority; + property Redundant : Boolean read fRedundant write fRedundant; + end; + + TWorker = class + private + fName : string; + fActive : Boolean; + published + property Name : string read fName write fName; + property Active : Boolean read fActive write fActive; + end; + + TMyConfig2 = class(TAppConfigJson) + private + fhola : Integer; + published + property hola : Integer read fhola write fhola; + end; + + TArraySizes = array of Integer; + + TMyConfig = class(TAppConfigJson) + private + fTitle : string; + fHidden : Boolean; + fSessionName: string; + fSizes : TArraySizes; + fLastFilename : string; + fWindowPos : TWinPos; + fHistory : TArray<TProcessType>; + fComplex : TProcessType; + fModifyDate : TDateTime; + fWorkList : TObjectList<TWorker>; + public + constructor Create; + destructor Destroy; override; + procedure DefaultValues; override; + property Hidden : Boolean read fHidden write fHidden; + published + property Title : string read fTitle write fTitle; + property SessionName : string read fSessionName write fSessionName; + property Sizes : TArraySizes read fSizes write fSizes; + property LastFilename : string read fLastFilename write fLastFilename; + //property WindowPos : TWinPos read fWindowPos write fWindowPos; + property History : TArray<TProcessType> read fHistory write fHistory; + property Complex : TProcessType read fComplex write fComplex; + property ModifyDate : TDateTime read fModifyDate write fModifyDate; + //property WorkList : TObjectList<TWorker> read fWorkList write fWorkList; + end; + + { TForm1 } + + TForm1 = class(TForm) + btnSaveJson: TButton; + btnLoadJson: TButton; + meInfo: TMemo; + procedure btnLoadJsonClick(Sender: TObject); + procedure btnSaveJsonClick(Sender: TObject); + procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); + procedure FormCreate(Sender: TObject); + private + + public + procedure SetConfig(cConfig: TMyConfig); + function TestConfig(cConfig1, cConfig2 : TMyConfig) : Boolean; + + end; + +var + Form1: TForm1; + ConfigJson : TMyConfig; + ConfigTest : TMyConfig; + +implementation + +{$R *.lfm} + +uses + Quick.Json.Serializer; + +{ TForm1 } + +procedure TForm1.btnSaveJsonClick(Sender: TObject); +begin + SetConfig(ConfigJson); + ConfigJson.Save; + meInfo.Lines.Add(ConfigJson.ToJson); + meInfo.Lines.Add('Saved Config in Json at ' + DateTimeToStr(ConfigJson.LastSaved)); +end; + +procedure TForm1.btnLoadJsonClick(Sender: TObject); +begin + meInfo.Lines.Add('Load ConfigJson'); + ConfigJson := TMyConfig.Create; + ConfigJson.Load; + meInfo.Lines.Add(ConfigJson.ToJSON); + if TestConfig(ConfigTest,ConfigJson) then meInfo.Lines.Add('Test passed successfully!'); +end; + +function TForm1.TestConfig(cConfig1, cConfig2 : TMyConfig) : Boolean; +var + i : Integer; +begin + try + Assert(cConfig1.LastFilename = cConfig2.LastFilename); + for i := Low(cConfig1.Sizes) to High(cConfig1.Sizes) do + Assert(cConfig1.Sizes[i] = cConfig2.Sizes[i]); + //Assert(cConfig1.WindowPos.PosX = cConfig2.WindowPos.PosX); + //Assert(cConfig1.WindowPos.PosX = cConfig2.WindowPos.PosX); + Assert(cConfig1.Complex.Priority = cConfig2.Complex.Priority); + Assert(cConfig1.Complex.Redundant = cConfig2.Complex.Redundant); + Assert(cConfig1.Title = cConfig2.Title); + //for i := 0 to cConfig1.WorkList.Count - 1 do + //begin + // Assert(cConfig1.WorkList[i].Name = cConfig2.WorkList[i].Name); + // Assert(cConfig1.WorkList[i].Active = cConfig2.WorkList[i].Active); + //end; + for i := 0 to High(cConfig1.History) do + begin + Assert(cConfig1.History[i].Priority = cConfig2.History[i].Priority); + Assert(cConfig1.History[i].Redundant = cConfig2.History[i].Redundant); + end; + Result := True; + except + ShowMessage('Configuration not has been saved previously or has a corruption problem'); + end; +end; + + +procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction); +begin + if Assigned(ConfigTest) then ConfigTest.Free; + if Assigned(ConfigJson) then ConfigJson.Free; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + ConfigTest := TMyConfig.Create; + SetConfig(ConfigTest); + ConfigJson := TMyConfig.Create('.\Config.json'); + //ConfigJson.Provider.CreateIfNotExists := True; +end; + +procedure TForm1.SetConfig(cConfig: TMyConfig); +var + processtype : TProcessType; +begin + cConfig.Title := 'hola'; + cConfig.SessionName := 'Session01'; + cConfig.LastFileName := 'C:\library.txt'; + cConfig.Sizes := [1,2,3,4,5,6,7]; + cConfig.Complex := TProcessType.Create; + cConfig.Complex.Id := 1; + cConfig.Complex.Redundant := True; + cConfig.Complex.Priority := TMyPriority.msMed; + //processtype := TProcessType.Create; + //processtype.Id := 1; + //processtype.Priority := msLow; + //processtype.Redundant := True; + //cConfig.History := [processtype]; + cConfig.ModifyDate := Now(); +end; + +{ TMyConfig } + +constructor TMyConfig.Create; +begin + inherited; + //WorkList := TObjectList<TWorker>.Create(True); + DefaultValues; +end; + +procedure TMyConfig.DefaultValues; +begin + fTitle := 'Default value'; +end; + +destructor TMyConfig.Destroy; +begin + //if Assigned(WorkList) then WorkList.Free; + inherited; +end; + +end. + diff --git a/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/Config.json b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/Config.json new file mode 100644 index 0000000..58dc0de --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/Config.json @@ -0,0 +1,21 @@ +{ + "Title" : "hola", + "SessionName" : "Session01", + "Sizes" : [ + 1, + 2, + 3, + 4, + 5, + 6, + 7 + ], + "LastFilename" : "C:\\library.txt", + "History" : [ ], + "Complex" : { + "Id" : 1, + "Priority" : "msMed", + "Redundant" : true + }, + "ModifyDate" : "2018-12-11T22:25:29.250Z " +} diff --git a/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.ico b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.ico new file mode 100644 index 0000000..0341321 Binary files /dev/null and b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.ico differ diff --git a/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.lpi b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.lpi new file mode 100644 index 0000000..2094f03 --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.lpi @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="QuickConfig"/> + <Scaled Value="True"/> + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <XPManifest> + <DpiAware Value="True"/> + </XPManifest> + <Icon Value="0"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="QuickLib"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="QuickConfig.pas"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="Main.pas"/> + <IsPartOfProject Value="True"/> + <HasResources Value="True"/> + </Unit1> + <Unit2> + <Filename Value="umain.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="uMain"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="QuickConfig"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.lpr b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.lpr new file mode 100644 index 0000000..05a69de --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.lpr @@ -0,0 +1,20 @@ +program QuickConfig; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms; + +{$R *.res} + +begin + RequireDerivedFormResource:=True; + Application.Scaled:=True; + Application.Initialize; + Application.Run; +end. + diff --git a/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.pas b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.pas new file mode 100644 index 0000000..8381264 --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.pas @@ -0,0 +1,13 @@ +program QuickConfig; + +uses + Forms, Interfaces, + uMain in 'uMain.pas' {MainForm}; + +{$R *.res} + +begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.res b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.res new file mode 100644 index 0000000..1adb040 Binary files /dev/null and b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/QuickConfig.res differ diff --git a/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/lib/i386-win32/QuickConfig.or b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/lib/i386-win32/QuickConfig.or new file mode 100644 index 0000000..38d38c4 Binary files /dev/null and b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/lib/i386-win32/QuickConfig.or differ diff --git a/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/lib/i386-win32/QuickConfig.res b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/lib/i386-win32/QuickConfig.res new file mode 100644 index 0000000..1adb040 Binary files /dev/null and b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/lib/i386-win32/QuickConfig.res differ diff --git a/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/lib/i386-win32/umain.lfm b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/lib/i386-win32/umain.lfm new file mode 100644 index 0000000..6082be3 --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/lib/i386-win32/umain.lfm @@ -0,0 +1,57 @@ +object Form1: TForm1 + Left = 379 + Height = 457 + Top = 230 + Width = 592 + Caption = 'Form1' + ClientHeight = 457 + ClientWidth = 592 + OnClose = FormClose + OnCreate = FormCreate + LCLVersion = '1.9.0.0' + object btnSaveJson: TButton + Left = 448 + Height = 25 + Top = 384 + Width = 120 + Caption = 'Save to Json' + OnClick = btnSaveJsonClick + TabOrder = 0 + end + object btnLoadJson: TButton + Left = 312 + Height = 25 + Top = 384 + Width = 123 + Caption = 'Load From Json' + OnClick = btnLoadJsonClick + TabOrder = 1 + end + object meInfo: TMemo + Left = 19 + Height = 363 + Top = 9 + Width = 549 + ReadOnly = True + ScrollBars = ssAutoBoth + TabOrder = 2 + end + object btnSaveRegistry: TButton + Left = 448 + Height = 25 + Top = 416 + Width = 120 + Caption = 'Save to Registry' + OnClick = btnSaveRegistryClick + TabOrder = 3 + end + object btnLoadRegistry: TButton + Left = 312 + Height = 25 + Top = 416 + Width = 123 + Caption = 'Load From Registry' + OnClick = btnLoadRegistryClick + TabOrder = 4 + end +end diff --git a/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/umain.lfm b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/umain.lfm new file mode 100644 index 0000000..6082be3 --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/umain.lfm @@ -0,0 +1,57 @@ +object Form1: TForm1 + Left = 379 + Height = 457 + Top = 230 + Width = 592 + Caption = 'Form1' + ClientHeight = 457 + ClientWidth = 592 + OnClose = FormClose + OnCreate = FormCreate + LCLVersion = '1.9.0.0' + object btnSaveJson: TButton + Left = 448 + Height = 25 + Top = 384 + Width = 120 + Caption = 'Save to Json' + OnClick = btnSaveJsonClick + TabOrder = 0 + end + object btnLoadJson: TButton + Left = 312 + Height = 25 + Top = 384 + Width = 123 + Caption = 'Load From Json' + OnClick = btnLoadJsonClick + TabOrder = 1 + end + object meInfo: TMemo + Left = 19 + Height = 363 + Top = 9 + Width = 549 + ReadOnly = True + ScrollBars = ssAutoBoth + TabOrder = 2 + end + object btnSaveRegistry: TButton + Left = 448 + Height = 25 + Top = 416 + Width = 120 + Caption = 'Save to Registry' + OnClick = btnSaveRegistryClick + TabOrder = 3 + end + object btnLoadRegistry: TButton + Left = 312 + Height = 25 + Top = 416 + Width = 123 + Caption = 'Load From Registry' + OnClick = btnLoadRegistryClick + TabOrder = 4 + end +end diff --git a/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/umain.pas b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/umain.pas new file mode 100644 index 0000000..7c52cae --- /dev/null +++ b/samples/fpc/QuickConfig/ConfigToFileAndRegistry_deprecated/umain.pas @@ -0,0 +1,254 @@ +unit uMain; + +{$mode delphi}{$H+} + +interface + +uses + Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, + Quick.Config, + Quick.Config.Provider.Registry, + Generics.Collections, + {$IFDEF FPC} + registry, + {$ENDIF} + Quick.Config.Provider.Json; + +type + + TMyPriority = (msLow, msMed, msHigh); + + TWinPos = class + private + fPosX : Integer; + fPosY : Integer; + published + property PosX : Integer read fPosX write fPosX; + property PosY : Integer read fPosY write fPosY; + end; + + TProcessType = class + private + fId : Integer; + fPriority : TMyPriority; + fRedundant : Boolean; + published + property Id : Integer read fId write fId; + property Priority : TMyPriority read fPriority write fPriority; + property Redundant : Boolean read fRedundant write fRedundant; + end; + + TWorker = class + private + fName : string; + fActive : Boolean; + published + property Name : string read fName write fName; + property Active : Boolean read fActive write fActive; + end; + + TMyConfig2 = class(TAppConfig) + private + fhola : Integer; + published + property hola : Integer read fhola write fhola; + end; + + TArraySizes = array of Integer; + + TMyConfig = class(TAppConfig) + private + fTitle : string; + fHidden : Boolean; + fSessionName: string; + fSizes : TArraySizes; + fLastFilename : string; + fWindowPos : TWinPos; + fHistory : TArray<TProcessType>; + fComplex : TProcessType; + fModifyDate : TDateTime; + fWorkList : TObjectList<TWorker>; + public + constructor Create; override; + destructor Destroy; override; + procedure DefaultValues; override; + property Hidden : Boolean read fHidden write fHidden; + published + property Title : string read fTitle write fTitle; + property SessionName : string read fSessionName write fSessionName; + property Sizes : TArraySizes read fSizes write fSizes; + property LastFilename : string read fLastFilename write fLastFilename; + //property WindowPos : TWinPos read fWindowPos write fWindowPos; + property History : TArray<TProcessType> read fHistory write fHistory; + property Complex : TProcessType read fComplex write fComplex; + property ModifyDate : TDateTime read fModifyDate write fModifyDate; + //property WorkList : TObjectList<TWorker> read fWorkList write fWorkList; + end; + + { TForm1 } + + TForm1 = class(TForm) + btnLoadRegistry: TButton; + btnSaveJson: TButton; + btnLoadJson: TButton; + btnSaveRegistry: TButton; + meInfo: TMemo; + procedure btnLoadJsonClick(Sender: TObject); + procedure btnLoadRegistryClick(Sender: TObject); + procedure btnSaveJsonClick(Sender: TObject); + procedure btnSaveRegistryClick(Sender: TObject); + procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); + procedure FormCreate(Sender: TObject); + private + + public + procedure SetConfig(cConfig: TMyConfig); + function TestConfig(cConfig1, cConfig2 : TMyConfig) : Boolean; + + end; + +var + Form1: TForm1; + ConfigJson : TMyConfig; + ConfigReg : TMyConfig; + ConfigTest : TMyConfig; + AppConfigJson : TAppConfigJsonProvider<TMyConfig>; + AppConfigReg : TAppConfigRegistryProvider<TMyConfig>; + +implementation + +{$R *.lfm} + +uses + Quick.Json.Serializer; + +{ TForm1 } + +procedure TForm1.btnSaveJsonClick(Sender: TObject); +begin + SetConfig(ConfigJson); + AppConfigJson.Save(ConfigJson); + meInfo.Lines.Add(ConfigJson.ToJson); + meInfo.Lines.Add('Saved Config in Json at ' + DateTimeToStr(ConfigJson.LastSaved)); +end; + +procedure TForm1.btnSaveRegistryClick(Sender: TObject); +begin + SetConfig(ConfigJson); + AppConfigReg.Save(ConfigJson); + meInfo.Lines.Add(ConfigJson.ToJson); + meInfo.Lines.Add('Saved Config in Registry at ' + DateTimeToStr(ConfigJson.LastSaved)); +end; + +procedure TForm1.btnLoadJsonClick(Sender: TObject); +begin + meInfo.Lines.Add('Load ConfigJson'); + ConfigJson := TMyConfig.Create; + AppConfigJson.Load(ConfigJson); + meInfo.Lines.Add(ConfigJson.ToJSON); + if TestConfig(ConfigTest,ConfigJson) then meInfo.Lines.Add('Test passed successfully!'); +end; + +procedure TForm1.btnLoadRegistryClick(Sender: TObject); +begin + meInfo.Lines.Add('Load ConfigRegistry'); + ConfigJson := TMyConfig.Create; + AppConfigReg.Load(ConfigJson); + meInfo.Lines.Add(ConfigJson.ToJSON); + if TestConfig(ConfigTest,ConfigJson) then meInfo.Lines.Add('Test passed successfully!'); +end; + +function TForm1.TestConfig(cConfig1, cConfig2 : TMyConfig) : Boolean; +var + i : Integer; +begin + try + Assert(cConfig1.LastFilename = cConfig2.LastFilename); + for i := Low(cConfig1.Sizes) to High(cConfig1.Sizes) do + Assert(cConfig1.Sizes[i] = cConfig2.Sizes[i]); + //Assert(cConfig1.WindowPos.PosX = cConfig2.WindowPos.PosX); + //Assert(cConfig1.WindowPos.PosX = cConfig2.WindowPos.PosX); + Assert(cConfig1.Complex.Priority = cConfig2.Complex.Priority); + Assert(cConfig1.Complex.Redundant = cConfig2.Complex.Redundant); + Assert(cConfig1.Title = cConfig2.Title); + //for i := 0 to cConfig1.WorkList.Count - 1 do + //begin + // Assert(cConfig1.WorkList[i].Name = cConfig2.WorkList[i].Name); + // Assert(cConfig1.WorkList[i].Active = cConfig2.WorkList[i].Active); + //end; + for i := 0 to High(cConfig1.History) do + begin + Assert(cConfig1.History[i].Priority = cConfig2.History[i].Priority); + Assert(cConfig1.History[i].Redundant = cConfig2.History[i].Redundant); + end; + Result := True; + except + ShowMessage('Configuration not has been saved previously or has a corruption problem'); + end; +end; + + +procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction); +begin + if Assigned(AppConfigJson) then AppConfigJson.Free; + if Assigned(AppConfigReg) then AppConfigReg.Free; + if Assigned(ConfigTest) then ConfigTest.Free; + if Assigned(ConfigReg) then ConfigReg.Free; + if Assigned(ConfigJson) then ConfigJson.Free; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + ConfigTest := TMyConfig.Create; + SetConfig(ConfigTest); + AppConfigJson := TAppConfigJsonProvider<TMyConfig>.Create(ConfigJson); + AppConfigJson.CreateIfNotExists := True; + AppConfigJson.Filename := '.\Config.json'; + ConfigJson := TMyConfig.Create; + AppConfigReg := TAppConfigRegistryProvider<TMyConfig>.Create(ConfigReg); + AppConfigReg.HRoot := HKEY_CURRENT_USER; + AppConfigReg.MainKey := '_AppConfig'; +end; + +procedure TForm1.SetConfig(cConfig: TMyConfig); +var + processtype : TProcessType; +begin + cConfig.Title := 'hola'; + cConfig.SessionName := 'Session01'; + cConfig.LastFileName := 'C:\library.txt'; + cConfig.Sizes := [1,2,3,4,5,6,7]; + cConfig.Complex := TProcessType.Create; + cConfig.Complex.Id := 1; + cConfig.Complex.Redundant := True; + cConfig.Complex.Priority := TMyPriority.msMed; + //processtype := TProcessType.Create; + //processtype.Id := 1; + //processtype.Priority := msLow; + //processtype.Redundant := True; + //cConfig.History := [processtype]; + cConfig.ModifyDate := Now(); +end; + +{ TMyConfig } + +constructor TMyConfig.Create; +begin + inherited; + //WorkList := TObjectList<TWorker>.Create(True); + DefaultValues; +end; + +procedure TMyConfig.DefaultValues; +begin + fTitle := 'Default value'; +end; + +destructor TMyConfig.Destroy; +begin + //if Assigned(WorkList) then WorkList.Free; + inherited; +end; + +end. +