Opkman: Extended options dialog with file/folder filtering.

git-svn-id: trunk@53734 -
This commit is contained in:
balazs 2016-12-20 12:51:48 +00:00
parent 800945ee04
commit 05116af836
7 changed files with 552 additions and 146 deletions

View File

@ -270,6 +270,7 @@ object CreateRepositoryPackagefr: TCreateRepositoryPackagefr
Width = 53
Caption = 'lbSVNURL'
ParentColor = False
Visible = False
end
object edSVNURL: TEdit
Left = 168
@ -278,6 +279,7 @@ object CreateRepositoryPackagefr: TCreateRepositoryPackagefr
Width = 324
Anchors = [akTop, akLeft, akRight]
TabOrder = 2
Visible = False
end
object lbDisplayName: TLabel
Left = 9

View File

@ -41,8 +41,8 @@ const
cLocalRepositoryConfig = 'config';
cLocalRepositoryConfigFile = 'options.xml';
cLocalRepositoryUpdatesFile = 'updates.xml';
cRestrictedExtensionDef = '*.a,*.o,*.ppu,*.compiled,*.bak,*.or,*.rsj,*.~ ';
cRestrictedDirectoryDef = 'lib,backup';
cExcludedFilesDef = '*.a,*.o,*.ppu,*.compiled,*.bak,*.or,*.rsj,*.~ ';
cExcludedFoldersDef = 'lib,backup';
cHelpPage = 'http://wiki.freepascal.org/Online_Package_Manager';
{$ifdef win64}
cOpenSSLURL = 'http://packages.lazarus-ide.org/openssl-1.0.2j-x64_86-win64.zip';
@ -84,7 +84,7 @@ resourcestring
rsMainFrm_VSTText_RepositoryFileHash = 'Repository filehash';
rsMainFrm_VSTText_RepositoryFileDate = 'Available since';
rsMainFrm_VSTText_HomePageURL = 'Home page';
rsMainFrm_VSTText_DownloadURL = 'Update link';
rsMainFrm_VSTText_DownloadURL = 'Update link(external JSON)';
rsMainFrm_VSTText_SVNURL = 'SVN';
rsMainFrm_VSTText_Install0 = 'No';
rsMainFrm_VSTText_Install1 = 'Yes';
@ -261,6 +261,21 @@ resourcestring
rsOptions_cbCheckForUpdates_Item5 = 'Never';
rsOptions_lbLastUpdate_Caption = 'Last update: ';
rsOptions_LastUpdate_Never = 'Never';
rsOptions_lbFilterFiles_Caption = 'Excluded file extensions';
rsOptions_lbFilterDirs_Caption = 'Excluded folders';
rsOptions_bAdd_Caption = 'Add';
rsOptions_bEdit_Caption = 'Edit';
rsOptions_bDelete_Caption = 'Delete';
rsOpitons_lbExcludeFiles_Hint = 'This files will be excluded from repository packages(see: "Create repository package")';
rsOpitons_lbExcludeFolders_Hint = 'This folders will be excluded from repository packages(see: "Create repository package")';
rsOptions_InputBox_Caption = 'Add new exclusion';
rsOptions_InputBox_Text0 = 'Type the extension name:';
rsOptions_InputBox_Text1 = 'Type the folder name:';
rsOptions_InputBox_Info0 = 'Please select a file extension!';
rsOptions_InputBox_Info1 = 'Please select a folder!';
rsOptions_InputBox_Conf0 = 'Delete selected extension("%s")?';
rsOptions_InputBox_Conf1 = 'Delete selected folder("%s")?';
//packagelist form
rsPackageListFrm_Caption0 = 'Installed package list';
@ -285,7 +300,7 @@ resourcestring
rsCreateRepositoryPackageFrm_lbFPCCompatibility_Caption = 'FPC compatibility:';
rsCreateRepositoryPackageFrm_lbSupportedWidgetset_Caption = 'Supported widgetset:';
rsCreateRepositoryPackageFrm_lbHomePageURL_Caption = 'Home page:';
rsCreateRepositoryPackageFrm_lbDownloadURL_Caption = 'Download link:';
rsCreateRepositoryPackageFrm_lbDownloadURL_Caption = 'Update link(external JSON):';
rsCreateRepositoryPackageFrm_lbSVNURL_Caption = 'SVN';
rsCreateRepositoryPackageFrm_SDDTitleSrc = 'Select package directory';
rsCreateRepositoryPackageFrm_SDDTitleDst = 'Save repository package to...';

View File

@ -1,12 +1,12 @@
object CreateRepositoryPackagesFrm: TCreateRepositoryPackagesFrm
Left = 585
Left = 556
Height = 475
Top = 250
Width = 819
Top = 254
Width = 820
BorderIcons = [biSystemMenu]
Caption = 'CreateRepositoryPackagesFrm'
ClientHeight = 475
ClientWidth = 819
ClientWidth = 820
Color = clBtnFace
Constraints.MinHeight = 450
Constraints.MinWidth = 650
@ -17,83 +17,82 @@ object CreateRepositoryPackagesFrm: TCreateRepositoryPackagesFrm
LCLVersion = '1.7'
inline frCreateRep: TCreateRepositoryPackagefr
Height = 475
Width = 819
Width = 820
Align = alClient
ClientHeight = 475
ClientWidth = 819
ClientWidth = 820
inherited pnMessage: TPanel
Height = 369
Width = 557
Width = 558
end
inherited pnPackages: TPanel
Height = 369
end
inherited pnBrowse: TPanel
Width = 819
ClientWidth = 819
Width = 820
ClientWidth = 820
inherited Bevel1: TBevel
Width = 819
Width = 820
end
end
inherited pnData: TPanel
Height = 369
Width = 557
Width = 558
ClientHeight = 369
ClientWidth = 557
ClientWidth = 558
inherited pnPackageData: TPanel
Height = 177
Width = 557
Width = 558
ClientHeight = 173
ClientWidth = 553
ClientWidth = 554
inherited edSupportedWidgetset: TEdit
Width = 355
end
inherited edLazCompatibility: TEdit
Width = 356
end
inherited edLazCompatibility: TEdit
Width = 357
end
inherited edFPCCompatibility: TEdit
Width = 355
Width = 356
end
inherited lbOF1: TLabel
Left = 528
Left = 529
end
inherited lbOF3: TLabel
Left = 528
Left = 529
end
inherited lbOF4: TLabel
Left = 528
Left = 529
end
end
inherited spMain1: TSplitter
Width = 557
Width = 558
end
inherited pnCategory: TPanel
Width = 557
ClientHeight = 185
ClientWidth = 553
Width = 558
ClientWidth = 554
inherited lbOF2: TLabel
Left = 528
Left = 529
end
inherited edHomePageURL: TEdit
Width = 355
Width = 356
end
inherited edDownloadURL: TEdit
Width = 355
Width = 356
end
inherited edSVNURL: TEdit
Width = 355
Width = 356
end
inherited edDisplayName: TEdit
Width = 355
Width = 356
end
inherited pnCategories: TPanel
Width = 355
ClientWidth = 355
Width = 356
ClientWidth = 356
inherited spCategories: TSpeedButton
Left = 325
Left = 326
end
inherited edCategories: TEdit
Width = 325
Width = 326
end
end
end
@ -103,14 +102,13 @@ object CreateRepositoryPackagesFrm: TCreateRepositoryPackagesFrm
end
inherited pnButtons: TPanel
Top = 434
Width = 819
ClientHeight = 37
ClientWidth = 815
Width = 820
ClientWidth = 816
inherited bCreate: TButton
Left = 653
Left = 654
end
inherited bCancel: TButton
Left = 730
Left = 731
end
end
end

View File

@ -391,7 +391,10 @@ begin
tbCleanUp.Enabled := (AEnable) and (SerializablePackages.Count > 0);
tbCreate.Visible := Options.UserProfile = 1;
if tbCreate.Visible then
begin
tbCreate.Left := tbOptions.Left - 10;
tbCreate.Enabled := (AEnable);
end;
tbOptions.Enabled := (AEnable);
tbHelp.Enabled := (AEnable);
end;

View File

@ -56,8 +56,6 @@ type
FLastDownloadDir: String;
FLastPackageDirSrc: String;
FLastPackageDirDst: String;
FRestrictedExtensions: String;
FRestrictedDirectories: String;
// Default values for local repositories.
FLocalPackagesDefault: String;
FLocalArchiveDefault: String;
@ -67,6 +65,8 @@ type
FLocalRepositoryArchive: String;
FLocalRepositoryUpdate: String;
FUserProfile: Integer;
FExcludedFiles: String;
FExcludedFolders: String;
procedure SetRemoteRepository(const ARemoteRepository: String);
public
constructor Create(const AFileName: String);
@ -91,11 +91,11 @@ type
property ProxyPort: Word read FProxySettings.FPort write FProxySettings.FPort;
property ProxyUser: String read FProxySettings.FUser write FProxySettings.FUser;
property ProxyPassword: String read FProxySettings.FPassword write FProxySettings.FPassword;
property RestrictedExtension: String read FRestrictedExtensions write FRestrictedExtensions;
property RestrictedDirectories: String read FRestrictedDirectories write FRestrictedDirectories;
property LocalRepositoryPackages: String read FLocalRepositoryPackages write FLocalRepositoryPackages;
property LocalRepositoryArchive: String read FLocalRepositoryArchive write FLocalRepositoryArchive;
property LocalRepositoryUpdate: String read FLocalRepositoryUpdate write FLocalRepositoryUpdate;
property ExcludedFiles: String read FExcludedFiles write FExcludedFiles;
property ExcludedFolders: String read FExcludedFolders write FExcludedFolders;
end;
var
@ -125,10 +125,10 @@ begin
FLocalRepositoryArchive := FLocalArchiveDefault;
if FLocalRepositoryUpdate = '' then
FLocalRepositoryUpdate := FLocalUpdateDefault;
if FRestrictedExtensions = '' then
FRestrictedExtensions := cRestrictedExtensionDef;
if FRestrictedDirectories = '' then
FRestrictedDirectories := cRestrictedDirectoryDef;
if FExcludedFiles = '' then
FExcludedFiles := cExcludedFilesDef;
if FExcludedFolders = '' then
FExcludedFolders := cExcludedFoldersDef;
end
else
LoadDefault;
@ -169,6 +169,8 @@ begin
FLocalRepositoryUpdate := FXML.GetValue('Folders/LocalRepositoryUpdate/Value', '');
FUserProfile := FXML.GetValue('Profiles/UserProfile/Value', 0);
FExcludedFiles := FXML.GetValue('Profiles/ExcludedFiles/Value', '');
FExcludedFolders := FXML.GetValue('Profiles/ExcludedFolders/Value', '');
end;
procedure TOptions.Save;
@ -194,6 +196,8 @@ begin
FXML.SetDeleteValue('Folders/LocalRepositoryUpdate/Value', FLocalRepositoryUpdate, '');
FXML.SetDeleteValue('Profiles/UserProfile/Value', FUserProfile, 0);
FXML.SetDeleteValue('Profiles/ExcludedFiles/Value', FExcludedFiles, '');
FXML.SetDeleteValue('Profiles/ExcludedFolders/Value', FExcludedFolders, '');
FXML.Flush;
FChanged := False;
@ -216,10 +220,10 @@ begin
FLocalRepositoryPackages := FLocalPackagesDefault;
FLocalRepositoryArchive := FLocalArchiveDefault;
FLocalRepositoryUpdate := FLocalUpdateDefault;
FRestrictedExtensions := cRestrictedExtensionDef;
FRestrictedDirectories := cRestrictedDirectoryDef;
FUserProfile := 0;
FExcludedFiles := cExcludedFilesDef;
FExcludedFolders := cExcludedFoldersDef;
Save;
end;

View File

@ -1,12 +1,12 @@
object OptionsFrm: TOptionsFrm
Left = 624
Height = 300
Top = 287
Width = 475
Left = 434
Height = 364
Top = 250
Width = 525
BorderIcons = [biSystemMenu]
Caption = 'Options'
ClientHeight = 300
ClientWidth = 475
ClientHeight = 364
ClientWidth = 525
Color = clBtnFace
Constraints.MinHeight = 300
Constraints.MinWidth = 475
@ -16,15 +16,15 @@ object OptionsFrm: TOptionsFrm
object pnBottom: TPanel
Left = 0
Height = 39
Top = 261
Width = 475
Top = 325
Width = 525
Align = alBottom
BevelOuter = bvNone
ClientHeight = 39
ClientWidth = 475
ClientWidth = 525
TabOrder = 0
object bOk: TButton
Left = 282
Left = 332
Height = 25
Top = 8
Width = 88
@ -34,7 +34,7 @@ object OptionsFrm: TOptionsFrm
TabOrder = 0
end
object bCancel: TButton
Left = 375
Left = 425
Height = 25
Top = 8
Width = 88
@ -55,26 +55,26 @@ object OptionsFrm: TOptionsFrm
end
object pgOptions: TPageControl
Left = 0
Height = 261
Height = 325
Top = 0
Width = 475
ActivePage = tsGeneral
Width = 525
ActivePage = tsProfiles
Align = alClient
TabIndex = 0
TabIndex = 3
TabOrder = 1
object tsGeneral: TTabSheet
Caption = 'General'
ClientHeight = 233
ClientWidth = 467
ClientHeight = 297
ClientWidth = 517
object pnGeneral: TPanel
Left = 0
Height = 233
Height = 297
Top = 0
Width = 467
Width = 517
Align = alClient
BevelOuter = bvNone
ClientHeight = 233
ClientWidth = 467
ClientHeight = 297
ClientWidth = 517
Color = clBtnFace
ParentColor = False
TabOrder = 0
@ -90,7 +90,7 @@ object OptionsFrm: TOptionsFrm
Left = 15
Height = 23
Top = 32
Width = 433
Width = 483
Anchors = [akTop, akLeft, akRight]
OnKeyPress = edRemoteRepositoryKeyPress
TabOrder = 0
@ -99,7 +99,7 @@ object OptionsFrm: TOptionsFrm
object cbForceDownloadExtract: TCheckBox
Left = 15
Height = 19
Top = 73
Top = 70
Width = 235
Caption = ' Force download and extract of packages'
ParentShowHint = False
@ -109,7 +109,7 @@ object OptionsFrm: TOptionsFrm
object cbDeleteZipAfterInstall: TCheckBox
Left = 15
Height = 19
Top = 104
Top = 103
Width = 294
Caption = 'Delete downloaded zip files after installation/update'
ParentShowHint = False
@ -119,16 +119,16 @@ object OptionsFrm: TOptionsFrm
object lbUpdates: TLabel
Left = 15
Height = 15
Top = 144
Top = 151
Width = 146
Caption = 'Check for package updates:'
ParentColor = False
end
object cbCheckForUpdates: TComboBox
Left = 15
Left = 16
Height = 23
Top = 162
Width = 177
Top = 168
Width = 209
ItemHeight = 15
ItemIndex = 0
Items.Strings = (
@ -144,9 +144,9 @@ object OptionsFrm: TOptionsFrm
Text = 'Every few minutes'
end
object lbLastUpdate: TLabel
Left = 204
Left = 240
Height = 15
Top = 165
Top = 171
Width = 64
Caption = 'Last update:'
ParentColor = False
@ -155,17 +155,17 @@ object OptionsFrm: TOptionsFrm
end
object tsProxy: TTabSheet
Caption = 'Proxy'
ClientHeight = 233
ClientWidth = 492
ClientHeight = 297
ClientWidth = 517
object pnProxy: TPanel
Left = 0
Height = 233
Height = 297
Top = 0
Width = 492
Width = 517
Align = alClient
BevelOuter = bvNone
ClientHeight = 233
ClientWidth = 492
ClientHeight = 297
ClientWidth = 517
Color = clBtnFace
ParentColor = False
TabOrder = 0
@ -180,17 +180,17 @@ object OptionsFrm: TOptionsFrm
end
object gbProxySettings: TGroupBox
Left = 15
Height = 130
Height = 176
Top = 48
Width = 411
Caption = 'Proxy Settings'
ClientHeight = 110
ClientHeight = 156
ClientWidth = 407
TabOrder = 1
object edProxyServer: TEdit
Left = 8
Height = 23
Top = 18
Top = 22
Width = 296
OnKeyPress = edRemoteRepositoryKeyPress
TabOrder = 0
@ -199,7 +199,7 @@ object OptionsFrm: TOptionsFrm
object lbServer: TLabel
Left = 8
Height = 15
Top = 0
Top = 3
Width = 32
Caption = 'Server'
ParentColor = False
@ -207,7 +207,7 @@ object OptionsFrm: TOptionsFrm
object lbUserName: TLabel
Left = 8
Height = 15
Top = 52
Top = 66
Width = 53
Caption = 'Username'
ParentColor = False
@ -215,7 +215,7 @@ object OptionsFrm: TOptionsFrm
object edProxyUser: TEdit
Left = 8
Height = 23
Top = 70
Top = 87
Width = 186
OnKeyPress = edRemoteRepositoryKeyPress
TabOrder = 1
@ -224,7 +224,7 @@ object OptionsFrm: TOptionsFrm
object lbPort: TLabel
Left = 318
Height = 15
Top = 0
Top = 3
Width = 22
Caption = 'Port'
ParentColor = False
@ -232,7 +232,7 @@ object OptionsFrm: TOptionsFrm
object lbPassword: TLabel
Left = 208
Height = 15
Top = 52
Top = 66
Width = 50
Caption = 'Password'
ParentColor = False
@ -240,7 +240,7 @@ object OptionsFrm: TOptionsFrm
object edProxyPassword: TEdit
Left = 208
Height = 23
Top = 69
Top = 87
Width = 186
EchoMode = emPassword
OnKeyPress = edRemoteRepositoryKeyPress
@ -251,8 +251,9 @@ object OptionsFrm: TOptionsFrm
object seProxyPort: TSpinEdit
Left = 318
Height = 23
Top = 18
Top = 22
Width = 76
Anchors = [akTop, akLeft, akRight, akBottom]
AutoSize = False
MaxValue = 65535
TabOrder = 3
@ -262,24 +263,24 @@ object OptionsFrm: TOptionsFrm
end
object tsFolders: TTabSheet
Caption = 'Folders'
ClientHeight = 233
ClientWidth = 492
ClientHeight = 297
ClientWidth = 517
object pnFolders: TPanel
Left = 0
Height = 233
Height = 297
Top = 0
Width = 492
Width = 517
Align = alClient
BevelOuter = bvNone
ClientHeight = 233
ClientWidth = 492
ClientHeight = 297
ClientWidth = 517
Color = clBtnFace
ParentColor = False
TabOrder = 0
object lbLocalRepositoryPackages: TLabel
Left = 15
Height = 15
Top = 14
Top = 13
Width = 84
Caption = 'Local repository'
ParentColor = False
@ -288,7 +289,7 @@ object OptionsFrm: TOptionsFrm
object lbLocalRepositoryArchive: TLabel
Left = 15
Height = 15
Top = 73
Top = 77
Width = 125
Caption = 'Local repository archive'
ParentColor = False
@ -297,7 +298,7 @@ object OptionsFrm: TOptionsFrm
object lbLocalRepositoryUpdate: TLabel
Left = 15
Height = 15
Top = 129
Top = 140
Width = 124
Caption = 'Local repository update'
ParentColor = False
@ -307,7 +308,7 @@ object OptionsFrm: TOptionsFrm
Left = 14
Height = 23
Top = 32
Width = 458
Width = 483
Directory = 'edLocalRepositoryPackages'
ShowHidden = False
ButtonWidth = 23
@ -323,8 +324,8 @@ object OptionsFrm: TOptionsFrm
Tag = 1
Left = 14
Height = 23
Top = 91
Width = 458
Top = 96
Width = 483
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -338,8 +339,8 @@ object OptionsFrm: TOptionsFrm
Tag = 2
Left = 14
Height = 23
Top = 147
Width = 458
Top = 159
Width = 483
ShowHidden = False
ButtonWidth = 23
NumGlyphs = 1
@ -353,50 +354,245 @@ object OptionsFrm: TOptionsFrm
end
object tsProfiles: TTabSheet
Caption = 'Profiles'
ClientHeight = 233
ClientWidth = 492
ClientHeight = 297
ClientWidth = 517
object pnProfiles: TPanel
Left = 0
Height = 233
Height = 297
Top = 0
Width = 492
Width = 517
Align = alClient
BevelOuter = bvNone
ClientHeight = 233
ClientWidth = 492
ClientHeight = 297
ClientWidth = 517
Color = clBtnFace
ParentColor = False
TabOrder = 0
object lbSelectProfile: TLabel
Left = 15
Height = 15
Top = 15
Width = 68
Caption = 'Select profile'
ParentColor = False
end
object cbSelectProfile: TComboBox
Left = 15
Height = 23
Top = 33
Width = 192
ItemHeight = 15
ItemIndex = 0
Items.Strings = (
'Regular user'
'Package maintainer'
)
ParentShowHint = False
ShowHint = True
Style = csDropDownList
object pnProfilesTop: TPanel
Left = 0
Height = 48
Top = 0
Width = 517
Align = alTop
BevelOuter = bvNone
ClientHeight = 48
ClientWidth = 517
TabOrder = 0
Text = 'Regular user'
OnResize = pnProfilesTopResize
object lbSelectProfile: TLabel
Left = 15
Height = 15
Top = 15
Width = 68
Caption = 'Select profile'
ParentColor = False
end
object cbSelectProfile: TComboBox
Left = 92
Height = 23
Top = 11
Width = 192
ItemHeight = 15
ItemIndex = 0
Items.Strings = (
'Regular user'
'Package maintainer'
)
OnChange = cbSelectProfileChange
ParentShowHint = False
ShowHint = True
Style = csDropDownList
TabOrder = 0
Text = 'Regular user'
end
end
object pnProfilesMain: TPanel
Left = 0
Height = 249
Top = 48
Width = 517
Align = alClient
BevelOuter = bvNone
ClientHeight = 249
ClientWidth = 517
TabOrder = 1
OnResize = pnProfilesMainResize
object pnProfilesLeft: TPanel
Left = 0
Height = 249
Top = 0
Width = 266
Align = alLeft
BevelOuter = bvNone
ClientHeight = 249
ClientWidth = 266
TabOrder = 0
object pnProfilesLeftButtons: TPanel
Left = 196
Height = 227
Top = 22
Width = 70
Align = alRight
BevelOuter = bvNone
ClientHeight = 227
ClientWidth = 70
TabOrder = 0
object bFilesAdd: TButton
Left = 1
Height = 25
Top = -1
Width = 68
Caption = 'Add'
OnClick = bFilesAddClick
TabOrder = 0
end
object bFilesDelete: TButton
Left = 1
Height = 25
Top = 57
Width = 68
Caption = 'Delete'
OnClick = bFilesDeleteClick
TabOrder = 2
end
object bFilesEdit: TButton
Left = 1
Height = 25
Top = 28
Width = 68
Caption = 'Edit'
OnClick = bFilesEditClick
TabOrder = 1
end
end
object pnProfilesCaptionLeft: TPanel
Left = 0
Height = 22
Top = 0
Width = 266
Align = alTop
BevelOuter = bvNone
ClientHeight = 22
ClientWidth = 266
TabOrder = 1
object lbFilterFiles: TLabel
Left = 15
Height = 15
Top = 4
Width = 117
Caption = 'Exclude file extensions'
ParentColor = False
end
end
object lbExcludeFiles: TListBox
Left = 15
Height = 212
Top = 22
Width = 181
Align = alClient
BorderSpacing.Left = 15
BorderSpacing.Bottom = 15
Color = clBtnFace
ItemHeight = 0
ParentShowHint = False
ScrollWidth = 161
ShowHint = True
TabOrder = 2
end
end
object pnProfilesRight: TPanel
Left = 266
Height = 249
Top = 0
Width = 236
Align = alClient
BorderSpacing.Right = 15
BevelOuter = bvNone
ClientHeight = 249
ClientWidth = 236
TabOrder = 1
object pnProfilesRightButtons: TPanel
Left = 166
Height = 227
Top = 22
Width = 70
Align = alRight
BevelOuter = bvNone
ClientHeight = 227
ClientWidth = 70
TabOrder = 0
object bFoldersAdd: TButton
Tag = 1
Left = 1
Height = 25
Top = -1
Width = 68
Caption = 'Add'
OnClick = bFilesAddClick
TabOrder = 0
end
object bFoldersDelete: TButton
Tag = 1
Left = 1
Height = 25
Top = 57
Width = 68
Caption = 'Delete'
OnClick = bFilesDeleteClick
TabOrder = 2
end
object bFoldersEdit: TButton
Tag = 1
Left = 1
Height = 25
Top = 28
Width = 68
Caption = 'Edit'
OnClick = bFilesEditClick
TabOrder = 1
end
end
object pnProfilesCaptionLeft1: TPanel
Left = 0
Height = 22
Top = 0
Width = 236
Align = alTop
BevelOuter = bvNone
ClientHeight = 22
ClientWidth = 236
TabOrder = 1
object lbFilterDirs: TLabel
Left = 5
Height = 15
Top = 4
Width = 79
Caption = 'Exclude folders'
ParentColor = False
end
end
object lbExcludeFolders: TListBox
Left = 5
Height = 212
Top = 22
Width = 161
Align = alClient
BorderSpacing.Left = 5
BorderSpacing.Bottom = 15
Color = clBtnFace
ItemHeight = 0
ParentShowHint = False
ScrollWidth = 154
ShowHint = True
TabOrder = 2
end
end
end
end
end
end
object SDD: TSelectDirectoryDialog
left = 272
left = 448
top = 32
end
end

View File

@ -39,13 +39,19 @@ type
TOptionsFrm = class(TForm)
bCancel: TButton;
bFoldersAdd: TButton;
bFilesEdit: TButton;
bFilesDelete: TButton;
bFoldersDelete: TButton;
bFoldersEdit: TButton;
bOk: TButton;
bRestore: TButton;
bFilesAdd: TButton;
cbProxy: TCheckBox;
cbForceDownloadExtract: TCheckBox;
cbDeleteZipAfterInstall: TCheckBox;
cbSelectProfile: TComboBox;
cbCheckForUpdates: TComboBox;
cbSelectProfile: TComboBox;
edLocalRepositoryUpdate: TDirectoryEdit;
edLocalRepositoryPackages: TDirectoryEdit;
edLocalRepositoryArchive: TDirectoryEdit;
@ -54,34 +60,53 @@ type
edProxyUser: TEdit;
edRemoteRepository: TEdit;
gbProxySettings: TGroupBox;
lbFilterFiles: TLabel;
lbFilterDirs: TLabel;
lbLastUpdate: TLabel;
lbSelectProfile: TLabel;
lbUpdates: TLabel;
lbLocalRepositoryArchive: TLabel;
lbLocalRepositoryUpdate: TLabel;
lbRemoteRepository: TLabel;
lbSelectProfile: TLabel;
lbServer: TLabel;
lbLocalRepositoryPackages: TLabel;
lbUserName: TLabel;
lbPort: TLabel;
lbPassword: TLabel;
lbExcludeFiles: TListBox;
lbExcludeFolders: TListBox;
pnProfilesCaptionLeft: TPanel;
pnProfilesCaptionLeft1: TPanel;
pnProfilesLeftButtons: TPanel;
pnProfilesRightButtons: TPanel;
pnProfilesRight: TPanel;
pnProfilesTop: TPanel;
pnProfiles: TPanel;
pnFolders: TPanel;
pnProxy: TPanel;
pnGeneral: TPanel;
pgOptions: TPageControl;
pnBottom: TPanel;
pnProfilesMain: TPanel;
pnProfilesLeft: TPanel;
SDD: TSelectDirectoryDialog;
seProxyPort: TSpinEdit;
tsFolders: TTabSheet;
tsProfiles: TTabSheet;
tsGeneral: TTabSheet;
tsProxy: TTabSheet;
procedure bFilesAddClick(Sender: TObject);
procedure bFilesDeleteClick(Sender: TObject);
procedure bFilesEditClick(Sender: TObject);
procedure bOkClick(Sender: TObject);
procedure bRestoreClick(Sender: TObject);
procedure cbProxyChange(Sender: TObject);
procedure cbSelectProfileChange(Sender: TObject);
procedure edRemoteRepositoryKeyPress(Sender: TObject; var Key: char);
procedure pnProfilesMainResize(Sender: TObject);
procedure pnProfilesTopResize(Sender: TObject);
private
function GetSelectedText(AListBox: TListBox; var AIndex: Integer): String;
public
procedure SetupControls;
end;
@ -96,6 +121,8 @@ uses opkman_options, opkman_common, opkman_const;
{ TOptionsFrm }
procedure TOptionsFrm.bOkClick(Sender: TObject);
var
I: Integer;
begin
if Trim(edRemoteRepository.Text) = '' then
begin
@ -141,20 +168,145 @@ begin
Options.RemoteRepository := edRemoteRepository.Text;
Options.ForceDownloadAndExtract := cbForceDownloadExtract.Checked;
Options.DeleteZipAfterInstall := cbDeleteZipAfterInstall.Checked;
Options.UserProfile := cbSelectProfile.ItemIndex;
Options.CheckForUpdates := cbCheckForUpdates.ItemIndex;
Options.ProxyEnabled := cbProxy.Checked;
Options.ProxyServer := edProxyServer.Text;
Options.ProxyPort := seProxyPort.Value;
Options.ProxyUser := edProxyUser.Text;
Options.ProxyPassword := edProxyPassword.Text;
Options.LocalRepositoryPackages := AppendPathDelim(edLocalRepositoryPackages.Text);
Options.LocalRepositoryArchive := AppendPathDelim(edLocalRepositoryArchive.Text);
Options.LocalRepositoryUpdate := AppendPathDelim(edLocalRepositoryUpdate.Text);
Options.UserProfile := cbSelectProfile.ItemIndex;
for I := 0 to lbExcludeFiles.Items.Count - 1 do
begin
if I = 0 then
Options.ExcludedFiles := lbExcludeFiles.Items[I]
else
Options.ExcludedFiles := Options.ExcludedFiles + ',' + lbExcludeFiles.Items[I];
end;
for I := 0 to lbExcludeFolders.Items.Count - 1 do
begin
if I = 0 then
Options.ExcludedFolders := lbExcludeFolders.Items[I]
else
Options.ExcludedFolders := Options.ExcludedFolders + ',' + lbExcludeFolders.Items[I];
end;
Options.Save;
ModalResult := mrOk;
end;
function TOptionsFrm.GetSelectedText(AListBox: TListBox; var AIndex: Integer): String;
var
I: Integer;
begin
Result := '';
for I := 0 to AListBox.Count - 1 do
begin
if AListBox.Selected[I] then
begin
Result := AListBox.Items.Strings[I];
AIndex := I;
Break;
end;
end;
end;
procedure TOptionsFrm.bFilesAddClick(Sender: TObject);
var
Value: String;
Index: Integer;
ListBox: TListBox;
begin
case (Sender as TButton).Tag of
0: begin
ListBox := lbExcludeFiles;
Value := InputBox(rsOptions_InputBox_Caption, rsOptions_InputBox_Text0, '*.');
end;
1: begin
ListBox := lbExcludeFolders;
Value := InputBox(rsOptions_InputBox_Caption, rsOptions_InputBox_Text1, '');
end;
end;
if Value <> '' then
begin
Index := ListBox.Items.Add(Value);
ListBox.Selected[Index] := True;
end;
end;
procedure TOptionsFrm.bFilesEditClick(Sender: TObject);
var
Value: String;
Index: Integer;
MsgInfo: String;
MsgTxt: String;
ListBox: TListBox;
begin
case (Sender as TButton).Tag of
0: begin
MsgInfo := rsOptions_InputBox_Info0;
MsgTxt := rsOptions_InputBox_Text0;
Listbox := lbExcludeFiles;
end;
1: begin
MsgInfo := rsOptions_InputBox_Info1;
MsgTxt := rsOptions_InputBox_Text1;
ListBox := lbExcludeFolders;
end;
end;
if ListBox.SelCount = 0 then
begin
MessageDlgEx(MsgInfo, mtInformation, [mbOk], Self);
ListBox.SetFocus;
Exit;
end;
Index := -1;
Value := InputBox(rsOptions_InputBox_Caption, MsgTxt, GetSelectedText(ListBox, Index));
if (Value <> '') and (Index <> -1) then
ListBox.Items[Index] := Value;
end;
procedure TOptionsFrm.bFilesDeleteClick(Sender: TObject);
var
MsgConf: String;
MsgInfo: String;
ListBox: TListBox;
Value: String;
Index: Integer;
begin
case (Sender as TButton).Tag of
0: begin
MsgInfo := rsOptions_InputBox_Info0;
MsgConf := rsOptions_InputBox_Conf0;
ListBox := lbExcludeFiles;
end;
1: begin
MsgInfo := rsOptions_InputBox_Info1;
MsgConf := rsOptions_InputBox_Conf1;
ListBox := lbExcludeFolders;
end;
end;
if ListBox.SelCount = 0 then
begin
MessageDlgEx(MsgInfo, mtInformation, [mbOk], Self);
ListBox.SetFocus;
Exit;
end;
Index := -1;
Value := GetSelectedText(ListBox, Index);
if (Value <> '') and (Index <> -1) then
begin
if MessageDlgEx(Format(MsgConf, [Value]), mtConfirmation, [mbYes, mbNo], Self) = mrYes then
ListBox.Items.Delete(Index);
end;
end;
procedure TOptionsFrm.bRestoreClick(Sender: TObject);
begin
if MessageDlgEx(rsOptions_RestoreDefaults_Conf, mtInformation, [mbYes, mbNo], Self) = mrYes then
@ -170,6 +322,11 @@ begin
gbProxySettings.Enabled:= cbProxy.Checked;
end;
procedure TOptionsFrm.cbSelectProfileChange(Sender: TObject);
begin
pnProfilesMain.Visible := cbSelectProfile.ItemIndex = 1;
end;
procedure TOptionsFrm.edRemoteRepositoryKeyPress(Sender: TObject; var Key: char);
begin
if Key = #13 then
@ -178,6 +335,7 @@ end;
procedure TOptionsFrm.SetupControls;
begin
Self.DoubleBuffered := True;
Caption := rsOptions_FrmCaption;
pgOptions.ActivePageIndex := 0;
tsGeneral.Caption := rsOptions_tsGeneral_Caption;
@ -229,11 +387,41 @@ begin
tsProfiles.Caption := rsOptions_tsProfiles_Caption;
lbSelectProfile.Caption := rsOptions_lbSelectProfile_Caption;
pnProfilesMain.DoubleBuffered := True;
pnProfilesLeft.DoubleBuffered := True;
pnProfilesTop.DoubleBuffered := True;
cbSelectProfile.Clear;
cbSelectProfile.Items.Add(rsOptions_cbSelectProfile_Item0);
cbSelectProfile.Items.Add(rsOptions_cbSelectProfile_Item1);
cbSelectProfile.ItemIndex := Options.UserProfile;
cbSelectProfile.Hint := rsOptions_cbSelectProfile_Hint;
lbFilterFiles.Caption := rsOptions_lbFilterFiles_Caption;
lbFilterDirs.Caption := rsOptions_lbFilterDirs_Caption;
bFilesAdd.Caption := rsOptions_bAdd_Caption;
bFilesEdit.Caption := rsOptions_bEdit_Caption;
bFilesDelete.Caption := rsOptions_bDelete_Caption;
bFoldersAdd.Caption := rsOptions_bAdd_Caption;
bFoldersEdit.Caption := rsOptions_bEdit_Caption;
bFoldersDelete.Caption := rsOptions_bDelete_Caption;
lbExcludeFiles.Hint := rsOpitons_lbExcludeFiles_Hint;
lbExcludeFiles.Items.Delimiter := ',';
lbExcludeFiles.Items.StrictDelimiter := True;
lbExcludeFiles.Items.DelimitedText := Options.ExcludedFiles;
lbExcludeFolders.Hint := rsOpitons_lbExcludeFolders_Hint;
lbExcludeFolders.Items.Delimiter := ',';
lbExcludeFolders.Items.StrictDelimiter := True;
lbExcludeFolders.Items.DelimitedText := Options.ExcludedFolders;
pnProfilesMain.Visible := Options.UserProfile = 1;
end;
procedure TOptionsFrm.pnProfilesMainResize(Sender: TObject);
begin
pnProfilesLeft.Width := pnProfilesMain.Width div 2;
end;
procedure TOptionsFrm.pnProfilesTopResize(Sender: TObject);
begin
cbSelectProfile.Left := lbSelectProfile.Left + lbSelectProfile.Width + 10;
end;
end.