Changeset 394 for ModularSystem
- Timestamp:
- Jul 31, 2012, 8:53:58 AM (12 years ago)
- Location:
- ModularSystem
- Files:
-
- 7 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
ModularSystem
-
Property svn:ignore
set to
lib
-
Property svn:ignore
set to
-
ModularSystem/Demo
- Property svn:ignore
-
old new 2 2 project1.exe 3 3 project1 4 Demo.exe 5 Demo.lps
-
- Property svn:ignore
-
ModularSystem/Demo/UMainForm.lfm
r316 r394 1 1 object MainForm: TMainForm 2 Left = 4632 Left = 283 3 3 Height = 316 4 4 Top = 182 5 Width = 3985 Width = 649 6 6 Caption = 'Module test' 7 7 ClientHeight = 316 8 ClientWidth = 3988 ClientWidth = 649 9 9 OnCreate = FormCreate 10 10 OnDestroy = FormDestroy 11 11 OnShow = FormShow 12 LCLVersion = ' 0.9.31'12 LCLVersion = '1.1' 13 13 object ListViewModules: TListView 14 14 Left = 8 15 15 Height = 265 16 16 Top = 8 17 Width = 38117 Width = 632 18 18 Anchors = [akTop, akLeft, akRight, akBottom] 19 19 Columns = < 20 20 item 21 21 Caption = 'Name' 22 Width = 70 23 end 24 item 25 Caption = 'System name' 22 26 Width = 70 23 27 end … … 30 34 end 31 35 item 36 Caption = 'License' 37 Width = 70 38 end 39 item 32 40 Caption = 'Dependencies' 33 41 Width = 162 42 end 43 item 44 Caption = 'Description' 45 Width = 200 34 46 end> 35 47 OwnerData = True -
ModularSystem/Demo/UMainForm.pas
r316 r394 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 StdCtrls, Menus, ActnList, UModularSystem , UModuleUser, UModuleBase;9 StdCtrls, Menus, ActnList, UModularSystem; 10 10 11 11 type … … 37 37 Selected: Boolean); 38 38 private 39 { private declarations }39 procedure RegisterModules; 40 40 public 41 41 ModuleManager: TModuleManager; … … 49 49 MainForm: TMainForm; 50 50 51 51 52 implementation 52 53 53 54 {$R *.lfm} 55 56 uses 57 UModuleUser, UModuleBase, UModuleACL; 58 54 59 55 60 { TMainForm } … … 59 64 if (Item.Index >= 0) and (Item.Index < ModuleManager.Modules.Count) then 60 65 with TModule(ModuleManager.Modules[Item.Index]) do begin 61 Item.Caption := Name;66 Item.Caption := Title; 62 67 Item.Data := ModuleManager.Modules[Item.Index]; 68 Item.SubItems.Add(Name); 63 69 Item.SubItems.Add(Version); 64 70 Item.SubItems.Add(InstalledText[Installed]); 65 Item.SubItems.Add(Dependencies.Text); 71 Item.SubItems.Add(License); 72 Item.SubItems.Add(StringReplace(Dependencies.Text, LineEnding, ', ', [rfReplaceAll])); 73 Item.SubItems.Add(StringReplace(Description.Text, LineEnding, ', ', [rfReplaceAll])); 66 74 end; 67 75 end; … … 78 86 end; 79 87 88 procedure TMainForm.RegisterModules; 89 begin 90 ModuleManager.RegisterModule(TModuleUser.Create); 91 ModuleManager.RegisterModule(TModuleBase.Create); 92 ModuleManager.RegisterModule(TModuleACL.Create); 93 end; 94 80 95 procedure TMainForm.RefreshList; 81 96 begin … … 87 102 88 103 procedure TMainForm.FormCreate(Sender: TObject); 89 var90 UserModule: TModuleUser;91 BaseModule: TModuleBase;92 104 begin 93 UserModule := TModuleUser.Create;94 BaseModule := TModuleBase.Create;95 96 105 ModuleManager := TModuleManager.Create; 97 ModuleManager.RegisterModule(UserModule); 98 ModuleManager.RegisterModule(BaseModule); 106 RegisterModules; 99 107 end; 100 108 … … 109 117 if ModuleList.Count > 0 then begin 110 118 if MessageDlg('These modules will be installed in addition to ' + 111 TModule(ListViewModules.Selected.Data).Name + ': ' + ModuleList.Text, 119 TModule(ListViewModules.Selected.Data).Name + ': ' + 120 StringReplace(ModuleList.Text, LineEnding, ', ', [rfReplaceAll]), 112 121 mtConfirmation, [mbYes, mbNo], 0) = mrYes then 113 122 TModule(ListViewModules.Selected.Data).Install; … … 130 139 if ModuleList.Count > 0 then begin 131 140 if MessageDlg('These modules will be uninstalled in addition to ' + 132 TModule(ListViewModules.Selected.Data).Name + ': ' + ModuleList.Text, 141 TModule(ListViewModules.Selected.Data).Name + ': ' + 142 StringReplace(ModuleList.Text, LineEnding, ', ', [rfReplaceAll]), 133 143 mtConfirmation, [mbYes, mbNo], 0) = mrYes then 134 144 TModule(ListViewModules.Selected.Data).Uninstall; -
ModularSystem/Demo/UModuleBase.pas
r314 r394 23 23 inherited; 24 24 Name := 'Base'; 25 Title := 'Base'; 25 26 Version := '1.0'; 27 License := 'GNU/LGPLv3'; 26 28 end; 27 29 -
ModularSystem/Demo/UModuleUser.pas
r314 r394 25 25 inherited; 26 26 Name := 'User'; 27 Title := 'User'; 27 28 Version := '1.0'; 29 License := 'GNU/LGPLv3'; 28 30 Dependencies.Add('Base'); 29 31 end; -
ModularSystem/Demo/project1.lpi
r316 r394 31 31 </local> 32 32 </RunParams> 33 <RequiredPackages Count=" 1">33 <RequiredPackages Count="2"> 34 34 <Item1> 35 <PackageName Value="ModularSystem"/> 36 </Item1> 37 <Item2> 35 38 <PackageName Value="LCL"/> 36 </Item 1>39 </Item2> 37 40 </RequiredPackages> 38 41 <Units Count="5"> … … 46 49 <IsPartOfProject Value="True"/> 47 50 <ComponentName Value="MainForm"/> 51 <HasResources Value="True"/> 48 52 <ResourceBaseClass Value="Form"/> 49 53 <UnitName Value="UMainForm"/> … … 60 64 </Unit3> 61 65 <Unit4> 62 <Filename Value=" ..\UModularSystem.pas"/>66 <Filename Value="UModuleACL.pas"/> 63 67 <IsPartOfProject Value="True"/> 64 <UnitName Value="UModul arSystem"/>68 <UnitName Value="UModuleACL"/> 65 69 </Unit4> 66 70 </Units> … … 74 78 <SearchPaths> 75 79 <IncludeFiles Value="$(ProjOutDir)"/> 76 <OtherUnitFiles Value=".."/>77 80 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> 78 81 </SearchPaths> -
ModularSystem/Demo/project1.lpr
r314 r394 8 8 {$ENDIF}{$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 Forms, UMainForm, UModuleUser, UModuleBase, UModularSystem 11 { you can add units after this }; 10 Forms, UMainForm, UModuleUser, UModuleBase, UModuleACL; 12 11 13 12 {$R *.res} -
ModularSystem/Demo/project1.lps
r316 r394 5 5 <Version Value="9"/> 6 6 <BuildModes Active="Default"/> 7 <Units Count="1 0">7 <Units Count="12"> 8 8 <Unit0> 9 9 <Filename Value="project1.lpr"/> … … 16 16 <IsPartOfProject Value="True"/> 17 17 <ComponentName Value="MainForm"/> 18 <HasResources Value="True"/> 18 19 <ResourceBaseClass Value="Form"/> 19 20 <UnitName Value="UMainForm"/> 20 <IsVisibleTab Value="True"/>21 21 <EditorIndex Value="0"/> 22 22 <WindowIndex Value="0"/> 23 <TopLine Value="5 9"/>24 <CursorPos X=" 40" Y="69"/>23 <TopLine Value="53"/> 24 <CursorPos X="23" Y="68"/> 25 25 <UsageCount Value="29"/> 26 26 <Loaded Value="True"/> … … 31 31 <IsPartOfProject Value="True"/> 32 32 <UnitName Value="UModuleUser"/> 33 <EditorIndex Value=" 4"/>34 <WindowIndex Value="0"/> 35 <TopLine Value=" 11"/>36 <CursorPos X=" 27" Y="28"/>33 <EditorIndex Value="5"/> 34 <WindowIndex Value="0"/> 35 <TopLine Value="2"/> 36 <CursorPos X="3" Y="14"/> 37 37 <UsageCount Value="29"/> 38 38 <Loaded Value="True"/> … … 42 42 <IsPartOfProject Value="True"/> 43 43 <UnitName Value="UModuleBase"/> 44 <EditorIndex Value=" 3"/>45 <WindowIndex Value="0"/> 46 <TopLine Value="1 "/>47 <CursorPos X=" 36" Y="8"/>44 <EditorIndex Value="4"/> 45 <WindowIndex Value="0"/> 46 <TopLine Value="10"/> 47 <CursorPos X="1" Y="27"/> 48 48 <UsageCount Value="27"/> 49 49 <Loaded Value="True"/> … … 51 51 <Unit4> 52 52 <Filename Value="..\UModularSystem.pas"/> 53 <IsPartOfProject Value="True"/>54 53 <UnitName Value="UModularSystem"/> 55 <EditorIndex Value="2"/> 56 <WindowIndex Value="0"/> 57 <TopLine Value="142"/> 58 <CursorPos X="68" Y="154"/> 54 <IsVisibleTab Value="True"/> 55 <EditorIndex Value="3"/> 56 <WindowIndex Value="0"/> 57 <TopLine Value="15"/> 58 <CursorPos X="16" Y="29"/> 59 59 <UsageCount Value="25"/> 60 60 <Loaded Value="True"/> … … 91 91 </Unit8> 92 92 <Unit9> 93 <Filename Value="..\..\..\..\other\lazarus\lcl\include\customlistview.inc"/> 94 <EditorIndex Value="1"/> 93 <Filename Value="H:\other\lazarus\lcl\include\customlistview.inc"/> 95 94 <WindowIndex Value="0"/> 96 95 <TopLine Value="434"/> 97 96 <CursorPos X="24" Y="448"/> 98 97 <UsageCount Value="10"/> 99 <Loaded Value="True"/>100 98 </Unit9> 99 <Unit10> 100 <Filename Value="H:\Lazarus\1.1_2.6.0\fpc\2.6.0\source\rtl\objpas\sysutils\sysstrh.inc"/> 101 <EditorIndex Value="2"/> 102 <WindowIndex Value="0"/> 103 <TopLine Value="212"/> 104 <CursorPos X="10" Y="224"/> 105 <UsageCount Value="10"/> 106 <Loaded Value="True"/> 107 </Unit10> 108 <Unit11> 109 <Filename Value="UModuleACL.pas"/> 110 <IsPartOfProject Value="True"/> 111 <UnitName Value="UModuleACL"/> 112 <EditorIndex Value="1"/> 113 <WindowIndex Value="0"/> 114 <TopLine Value="10"/> 115 <CursorPos X="23" Y="27"/> 116 <UsageCount Value="20"/> 117 <Loaded Value="True"/> 118 </Unit11> 101 119 </Units> 102 120 <General> 103 121 <ActiveWindowIndexAtStart Value="0"/> 104 122 </General> 105 <JumpHistory Count="2 1" HistoryIndex="20">123 <JumpHistory Count="28" HistoryIndex="27"> 106 124 <Position1> 107 125 <Filename Value="UMainForm.pas"/> … … 181 199 </Position19> 182 200 <Position20> 183 <Filename Value=" ..\..\..\..\other\lazarus\lcl\include\customlistview.inc"/>184 <Caret Line=" 448" Column="24" TopLine="434"/>201 <Filename Value="UMainForm.pas"/> 202 <Caret Line="67" Column="23" TopLine="59"/> 185 203 </Position20> 186 204 <Position21> 187 205 <Filename Value="UMainForm.pas"/> 188 <Caret Line="6 7" Column="23" TopLine="59"/>206 <Caret Line="65" Column="87" TopLine="57"/> 189 207 </Position21> 208 <Position22> 209 <Filename Value="UModuleACL.pas"/> 210 <Caret Line="14" Column="29" TopLine="1"/> 211 </Position22> 212 <Position23> 213 <Filename Value="UModuleUser.pas"/> 214 <Caret Line="28" Column="3" TopLine="13"/> 215 </Position23> 216 <Position24> 217 <Filename Value="UModuleACL.pas"/> 218 <Caret Line="26" Column="16" TopLine="10"/> 219 </Position24> 220 <Position25> 221 <Filename Value="UMainForm.pas"/> 222 <Caret Line="68" Column="23" TopLine="53"/> 223 </Position25> 224 <Position26> 225 <Filename Value="UModuleUser.pas"/> 226 <Caret Line="30" Column="1" TopLine="13"/> 227 </Position26> 228 <Position27> 229 <Filename Value="UModuleUser.pas"/> 230 <Caret Line="27" Column="9" TopLine="15"/> 231 </Position27> 232 <Position28> 233 <Filename Value="UModuleUser.pas"/> 234 <Caret Line="14" Column="3" TopLine="2"/> 235 </Position28> 190 236 </JumpHistory> 191 237 </ProjectSession> 238 <EditorMacros Count="0"/> 192 239 </CONFIG> -
ModularSystem/UModularSystem.pas
r315 r394 20 20 Version: string; 21 21 Name: string; 22 Title: string; 22 23 Dependencies: TStringList; 23 24 Author: string; 24 Description: string; 25 Description: TStringList; 26 License: string; 25 27 procedure Install; virtual; 26 28 procedure Uninstall; virtual; … … 97 99 Module := FindModuleByName(Dependencies[I]); 98 100 if Assigned(Module) then begin 99 if not Module.Installed and (ModuleList.IndexOf(Module.Name) = -1) then 101 if not Module.Installed and (ModuleList.IndexOf(Module.Name) = -1) then begin 100 102 ModuleList.Add(Module.Name); 103 EnumModulesInstall(Module.Dependencies, ModuleList); 104 end; 101 105 end else raise Exception.CreateFmt(SModuleNotFound, [Module.Name]); 102 106 end; … … 111 115 with TModule(Modules[I]) do begin 112 116 if (Dependencies.IndexOf(ModuleName) <> -1) and Installed and 113 (ModuleList.IndexOf(Name) = -1) then 117 (ModuleList.IndexOf(Name) = -1) then begin 114 118 ModuleList.Add(Name); 119 Self.EnumModulesUninstall(Name, ModuleList); 120 end; 115 121 end; 116 122 end; … … 169 175 begin 170 176 Dependencies := TStringList.Create; 177 Description := TStringList.Create; 171 178 end; 172 179 173 180 destructor TModule.Destroy; 174 181 begin 182 Description.Free; 175 183 Dependencies.Free; 176 184 inherited Destroy;
Note:
See TracChangeset
for help on using the changeset viewer.