From 60a0663b44b59f83b930b8ac4571c194851e0f93 Mon Sep 17 00:00:00 2001 From: balazs Date: Sun, 15 Oct 2017 12:53:28 +0000 Subject: [PATCH] Opkman: Connection timeout now is user configurable, default 10 seconds. git-svn-id: trunk@56059 - --- .../onlinepackagemanager.lpk | 2 +- .../onlinepackagemanager/opkman_const.pas | 2 + .../onlinepackagemanager/opkman_mainfrm.pas | 2 +- .../onlinepackagemanager/opkman_options.pas | 5 + .../opkman_optionsfrm.lfm | 204 +++++++++++------- .../opkman_optionsfrm.pas | 10 +- 6 files changed, 139 insertions(+), 86 deletions(-) diff --git a/components/onlinepackagemanager/onlinepackagemanager.lpk b/components/onlinepackagemanager/onlinepackagemanager.lpk index f490065f67..9df5de25ef 100644 --- a/components/onlinepackagemanager/onlinepackagemanager.lpk +++ b/components/onlinepackagemanager/onlinepackagemanager.lpk @@ -19,7 +19,7 @@ - + diff --git a/components/onlinepackagemanager/opkman_const.pas b/components/onlinepackagemanager/opkman_const.pas index 4953a2b4b9..eb2ac70a20 100644 --- a/components/onlinepackagemanager/opkman_const.pas +++ b/components/onlinepackagemanager/opkman_const.pas @@ -254,6 +254,8 @@ resourcestring rsOptions_lbRemoteRepository_Caption = 'Remote repository'; rsOptions_cbForceDownloadExtract_Caption = 'Always force download and extract'; rsOptions_cbForceDownloadExtract_Hint = 'If this option is checked the packages are always re-downloaded/extracted before install'; + rsOptions_lbConTimeOut_Caption = 'Connection timeout(seconds):'; + rsOptions_lbConTimeOut_Hint = 'The number of seconds after OPM drops connection'; rsOptions_lbSelectProfile_Caption = 'Select profile'; rsOptions_cbSelectProfile_Item0 = 'Regular user'; rsOptions_cbSelectProfile_Item1 = 'Package maintainer'; diff --git a/components/onlinepackagemanager/opkman_mainfrm.pas b/components/onlinepackagemanager/opkman_mainfrm.pas index 684c8e54ec..3fc56f7b24 100644 --- a/components/onlinepackagemanager/opkman_mainfrm.pas +++ b/components/onlinepackagemanager/opkman_mainfrm.pas @@ -257,7 +257,7 @@ begin else Updates.PauseUpdate; SetupMessage(rsMainFrm_rsMessageDownload); - PackageDownloader.DownloadJSON(10000); + PackageDownloader.DownloadJSON(Options.ConTimeOut*1000); end; function TMainFrm.IsSomethingChecked(const AResolveDependencies: Boolean = True): Boolean; diff --git a/components/onlinepackagemanager/opkman_options.pas b/components/onlinepackagemanager/opkman_options.pas index cb22e789e4..6dafb58eeb 100644 --- a/components/onlinepackagemanager/opkman_options.pas +++ b/components/onlinepackagemanager/opkman_options.pas @@ -60,6 +60,7 @@ type FDeleteZipAfterInstall: Boolean; FCheckForUpdates: Integer; FLastUpdate: TDateTime; + FConTimeOut: Integer; FDaysToShowNewPackages: Integer; FShowRegularIcons: Boolean; FUseDefaultTheme: Boolean; @@ -95,6 +96,7 @@ type property DeleteZipAfterInstall: Boolean read FDeleteZipAfterInstall write FDeleteZipAfterInstall; property CheckForUpdates: Integer read FCheckForUpdates write FCheckForUpdates; property LastUpdate: TDateTime read FLastUpdate write FLastUpdate; + property ConTimeOut: Integer read FConTimeOut write FConTimeOut; property DaysToShowNewPackages: Integer read FDaysToShowNewPackages write FDaysToShowNewPackages; property ShowRegularIcons: Boolean read FShowRegularIcons write FShowRegularIcons; property UseDefaultTheme: Boolean read FUseDefaultTheme write FUseDefaultTheme; @@ -181,6 +183,7 @@ begin FLastPrivateRepository := FXML.GetValue('General/LastPrivateRepository/Value', ''); FCheckForUpdates := FXML.GetValue('General/CheckForUpdates/Value', 0); FLastUpdate := FXML.GetExtendedValue('General/LastUpdate/Value', 0.0); + FConTimeOut := FXML.GetValue('General/ConTimeOut/Value', 10); FDaysToShowNewPackages := FXML.GetValue('General/DaysToShowNewPackages/Value', 31); FShowRegularIcons := FXML.GetValue('General/ShowRegularIcons/Value', True); FUseDefaultTheme := FXML.GetValue('General/UseDefaultTheme/Value', True); @@ -213,6 +216,7 @@ begin FXML.SetDeleteValue('General/LastPrivateRepository/Value', FLastPrivateRepository, ''); FXML.SetDeleteValue('General/CheckForUpdates/Value', FCheckForUpdates, 0); FXML.SetDeleteExtendedValue('General/LastUpdate/Value', FLastUpdate, 0.0); + FXML.SetDeleteValue('General/ConTimeOut/Value', FConTimeOut, 10); FXML.SetDeleteValue('General/DaysToShowNewPackages/Value', FDaysToShowNewPackages, 31); FXML.SetDeleteValue('General/ShowRegularIcons/Value', FShowRegularIcons, True); FXML.SetDeleteValue('General/UseDefaultTheme/Value', FUseDefaultTheme, True); @@ -246,6 +250,7 @@ begin FDeleteZipAfterInstall := True; FCheckForUpdates := 0; FLastUpdate := 0.0; + FConTimeOut := 10; FDaysToShowNewPackages := 31; FShowRegularIcons := True; FUseDefaultTheme := True; diff --git a/components/onlinepackagemanager/opkman_optionsfrm.lfm b/components/onlinepackagemanager/opkman_optionsfrm.lfm index 9e8e5619de..cd00034931 100644 --- a/components/onlinepackagemanager/opkman_optionsfrm.lfm +++ b/components/onlinepackagemanager/opkman_optionsfrm.lfm @@ -1,34 +1,35 @@ object OptionsFrm: TOptionsFrm - Left = 719 - Height = 442 - Top = 228 - Width = 530 + Left = 428 + Height = 484 + Top = 141 + Width = 590 BorderIcons = [biSystemMenu] Caption = 'Options' - ClientHeight = 442 - ClientWidth = 530 + ClientHeight = 484 + ClientWidth = 590 Constraints.MinHeight = 300 Constraints.MinWidth = 475 KeyPreview = True OnKeyPress = FormKeyPress PopupMode = pmExplicit Position = poOwnerFormCenter + LCLVersion = '1.9.0.0' object pnBottom: TPanel Left = 0 Height = 31 - Top = 411 - Width = 530 + Top = 453 + Width = 590 Align = alBottom AutoSize = True BevelOuter = bvNone ClientHeight = 31 - ClientWidth = 530 + ClientWidth = 590 TabOrder = 1 object bOk: TButton AnchorSideRight.Control = bCancel AnchorSideBottom.Control = bRestore AnchorSideBottom.Side = asrBottom - Left = 358 + Left = 418 Height = 25 Top = 0 Width = 80 @@ -45,7 +46,7 @@ object OptionsFrm: TOptionsFrm AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = bRestore AnchorSideBottom.Side = asrBottom - Left = 444 + Left = 504 Height = 25 Top = 0 Width = 80 @@ -76,9 +77,9 @@ object OptionsFrm: TOptionsFrm end object pgOptions: TPageControl Left = 6 - Height = 399 + Height = 441 Top = 6 - Width = 518 + Width = 578 ActivePage = tsGeneral Align = alClient BorderSpacing.Around = 6 @@ -86,18 +87,17 @@ object OptionsFrm: TOptionsFrm TabOrder = 0 object tsGeneral: TTabSheet Caption = 'General' - ClientHeight = 371 - ClientWidth = 510 + ClientHeight = 413 + ClientWidth = 570 object pnGeneral: TPanel Left = 0 - Height = 370 + Height = 413 Top = 0 - Width = 510 + Width = 570 Align = alClient - BorderSpacing.Bottom = 1 BevelOuter = bvNone - ClientHeight = 370 - ClientWidth = 510 + ClientHeight = 413 + ClientWidth = 570 ParentColor = False TabOrder = 0 object lbRemoteRepository: TLabel @@ -140,10 +140,12 @@ object OptionsFrm: TOptionsFrm end object lbUpdates: TLabel AnchorSideLeft.Control = lbRemoteRepository + AnchorSideTop.Control = Bevel1 Left = 6 Height = 15 - Top = 141 + Top = 157 Width = 146 + BorderSpacing.Top = 5 Caption = 'Check for package updates:' ParentColor = False end @@ -153,7 +155,7 @@ object OptionsFrm: TOptionsFrm AnchorSideTop.Side = asrBottom Left = 6 Height = 23 - Top = 162 + Top = 178 Width = 209 BorderSpacing.Top = 6 ItemHeight = 15 @@ -177,7 +179,7 @@ object OptionsFrm: TOptionsFrm AnchorSideTop.Side = asrCenter Left = 230 Height = 15 - Top = 166 + Top = 182 Width = 64 BorderSpacing.Left = 15 Caption = 'Last update:' @@ -192,14 +194,14 @@ object OptionsFrm: TOptionsFrm Left = 6 Height = 23 Top = 27 - Width = 498 + Width = 558 Anchors = [akTop, akLeft, akRight] AutoSize = True BorderSpacing.Top = 4 BorderSpacing.Right = 6 BevelOuter = bvNone ClientHeight = 23 - ClientWidth = 498 + ClientWidth = 558 TabOrder = 0 object cbRemoteRepository: TComboBox AnchorSideLeft.Control = pnRepositories @@ -208,7 +210,7 @@ object OptionsFrm: TOptionsFrm Left = 0 Height = 23 Top = 0 - Width = 435 + Width = 495 Anchors = [akTop, akLeft, akRight] BorderSpacing.Right = 2 ItemHeight = 15 @@ -223,12 +225,11 @@ object OptionsFrm: TOptionsFrm AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = cbRemoteRepository AnchorSideBottom.Side = asrBottom - Left = 437 - Height = 22 + Left = 497 + Height = 23 Top = 0 Width = 61 Anchors = [akTop, akRight, akBottom] - BorderSpacing.Bottom = 1 Caption = '...' OnClick = bOpenClick TabOrder = 1 @@ -236,10 +237,13 @@ object OptionsFrm: TOptionsFrm end object lbDaysToShowNewPackages: TLabel AnchorSideLeft.Control = lbRemoteRepository + AnchorSideTop.Control = cbCheckForUpdates + AnchorSideTop.Side = asrBottom Left = 6 Height = 15 - Top = 213 + Top = 216 Width = 204 + BorderSpacing.Top = 15 Caption = 'Show newly added packages for(days):' ParentColor = False end @@ -250,7 +254,7 @@ object OptionsFrm: TOptionsFrm AnchorSideTop.Side = asrCenter Left = 216 Height = 23 - Top = 209 + Top = 212 Width = 76 BorderSpacing.Left = 6 MaxValue = 365 @@ -258,41 +262,81 @@ object OptionsFrm: TOptionsFrm Value = 31 end object cbRegularIcons: TCheckBox + AnchorSideTop.Control = lbDaysToShowNewPackages + AnchorSideTop.Side = asrBottom Left = 6 Height = 19 - Top = 237 + Top = 241 Width = 232 + BorderSpacing.Top = 10 Caption = 'Show regular icon for installed packages' TabOrder = 5 end object cbUseDefaultTheme: TCheckBox + AnchorSideTop.Control = Bevel2 + AnchorSideTop.Side = asrBottom Left = 6 Height = 19 - Top = 301 + Top = 291 Width = 116 + BorderSpacing.Top = 4 Caption = 'Use default theme' TabOrder = 6 end object Bevel1: TBevel + AnchorSideTop.Control = lbConTimeOut + AnchorSideTop.Side = asrBottom Left = 0 Height = 2 - Top = 134 - Width = 506 + Top = 152 + Width = 566 Anchors = [akTop, akLeft, akRight] + BorderSpacing.Top = 25 end object Bevel2: TBevel + AnchorSideTop.Control = cbRegularIcons + AnchorSideTop.Side = asrBottom Left = 4 Height = 2 - Top = 288 - Width = 506 + Top = 285 + Width = 566 Anchors = [akTop, akLeft, akRight] + BorderSpacing.Top = 25 + end + object lbConTimeOut: TLabel + AnchorSideLeft.Control = lbRemoteRepository + AnchorSideTop.Control = cbDeleteZipAfterInstall + AnchorSideTop.Side = asrBottom + Left = 6 + Height = 15 + Top = 112 + Width = 164 + BorderSpacing.Top = 16 + Caption = 'Connection timeout(seconds): ' + ParentColor = False + ParentShowHint = False + ShowHint = True + end + object spConTimeOut: TSpinEdit + AnchorSideLeft.Control = lbConTimeOut + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = lbConTimeOut + AnchorSideTop.Side = asrCenter + Left = 176 + Height = 23 + Top = 108 + Width = 55 + BorderSpacing.Left = 6 + MinValue = 1 + TabOrder = 7 + Value = 10 end end end object tsProxy: TTabSheet Caption = 'Proxy' - ClientHeight = 337 - ClientWidth = 505 + ClientHeight = 394 + ClientWidth = 572 object pnProxy: TPanel Left = 0 Height = 337 @@ -427,17 +471,17 @@ object OptionsFrm: TOptionsFrm end object tsFolders: TTabSheet Caption = 'Folders' - ClientHeight = 337 - ClientWidth = 505 + ClientHeight = 413 + ClientWidth = 570 object pnFolders: TPanel Left = 0 - Height = 337 + Height = 413 Top = 0 - Width = 505 + Width = 570 Align = alClient BevelOuter = bvNone - ClientHeight = 337 - ClientWidth = 505 + ClientHeight = 413 + ClientWidth = 570 ParentColor = False TabOrder = 0 object lbLocalRepositoryPackages: TLabel @@ -484,7 +528,7 @@ object OptionsFrm: TOptionsFrm Left = 8 Height = 23 Top = 35 - Width = 491 + Width = 556 Directory = 'edLocalRepositoryPackages' ShowHidden = False ButtonWidth = 50 @@ -508,7 +552,7 @@ object OptionsFrm: TOptionsFrm Left = 8 Height = 23 Top = 89 - Width = 491 + Width = 556 ShowHidden = False ButtonWidth = 50 NumGlyphs = 1 @@ -529,7 +573,7 @@ object OptionsFrm: TOptionsFrm Left = 8 Height = 23 Top = 143 - Width = 491 + Width = 556 ShowHidden = False ButtonWidth = 50 NumGlyphs = 1 @@ -544,28 +588,28 @@ object OptionsFrm: TOptionsFrm end object tsProfiles: TTabSheet Caption = 'Profiles' - ClientHeight = 337 - ClientWidth = 505 + ClientHeight = 413 + ClientWidth = 570 object pnProfiles: TPanel Left = 0 - Height = 337 + Height = 413 Top = 0 - Width = 505 + Width = 570 Align = alClient BevelOuter = bvNone - ClientHeight = 337 - ClientWidth = 505 + ClientHeight = 413 + ClientWidth = 570 ParentColor = False TabOrder = 0 object pnProfilesTop: TPanel Left = 0 Height = 48 Top = 0 - Width = 505 + Width = 570 Align = alTop BevelOuter = bvNone ClientHeight = 48 - ClientWidth = 505 + ClientWidth = 570 TabOrder = 0 OnResize = pnProfilesTopResize object lbSelectProfile: TLabel @@ -602,26 +646,26 @@ object OptionsFrm: TOptionsFrm end object pnProfilesMain: TPanel Left = 0 - Height = 289 + Height = 365 Top = 48 - Width = 505 + Width = 570 Align = alClient BevelOuter = bvNone - ClientHeight = 289 - ClientWidth = 505 + ClientHeight = 365 + ClientWidth = 570 TabOrder = 1 OnResize = pnProfilesMainResize object pnProfilesLeft: TPanel AnchorSideLeft.Control = pnProfilesMain AnchorSideTop.Control = pnProfilesMain Left = 0 - Height = 289 + Height = 365 Top = 0 - Width = 245 + Width = 282 Align = alLeft BevelOuter = bvNone - ClientHeight = 289 - ClientWidth = 245 + ClientHeight = 365 + ClientWidth = 282 TabOrder = 0 object lbExcludeFiles: TListBox AnchorSideLeft.Control = lbFilterFiles @@ -631,9 +675,9 @@ object OptionsFrm: TOptionsFrm AnchorSideBottom.Control = pnProfilesLeft AnchorSideBottom.Side = asrBottom Left = 6 - Height = 260 + Height = 336 Top = 23 - Width = 153 + Width = 190 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Top = 4 BorderSpacing.Right = 6 @@ -661,7 +705,7 @@ object OptionsFrm: TOptionsFrm AnchorSideTop.Control = lbExcludeFiles AnchorSideRight.Control = pnProfilesLeft AnchorSideRight.Side = asrBottom - Left = 165 + Left = 202 Height = 25 Top = 23 Width = 80 @@ -678,7 +722,7 @@ object OptionsFrm: TOptionsFrm AnchorSideTop.Side = asrBottom AnchorSideRight.Control = pnProfilesLeft AnchorSideRight.Side = asrBottom - Left = 165 + Left = 202 Height = 25 Top = 52 Width = 80 @@ -695,7 +739,7 @@ object OptionsFrm: TOptionsFrm AnchorSideTop.Side = asrBottom AnchorSideRight.Control = pnProfilesLeft AnchorSideRight.Side = asrBottom - Left = 165 + Left = 202 Height = 25 Top = 81 Width = 80 @@ -708,15 +752,15 @@ object OptionsFrm: TOptionsFrm end end object pnProfilesRight: TPanel - Left = 245 - Height = 289 + Left = 282 + Height = 365 Top = 0 - Width = 254 + Width = 282 Align = alClient BorderSpacing.Right = 6 BevelOuter = bvNone - ClientHeight = 289 - ClientWidth = 254 + ClientHeight = 365 + ClientWidth = 282 TabOrder = 1 object lbExcludeFolders: TListBox AnchorSideLeft.Control = lbFilterDirs @@ -726,16 +770,16 @@ object OptionsFrm: TOptionsFrm AnchorSideBottom.Control = pnProfilesRight AnchorSideBottom.Side = asrBottom Left = 6 - Height = 260 + Height = 336 Top = 23 - Width = 162 + Width = 190 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Top = 4 BorderSpacing.Right = 6 BorderSpacing.Bottom = 6 ItemHeight = 0 ParentShowHint = False - ScrollWidth = 164 + ScrollWidth = 160 ShowHint = True Sorted = True TabOrder = 0 @@ -757,7 +801,7 @@ object OptionsFrm: TOptionsFrm AnchorSideTop.Control = lbExcludeFolders AnchorSideRight.Control = pnProfilesRight AnchorSideRight.Side = asrBottom - Left = 174 + Left = 202 Height = 25 Top = 23 Width = 80 @@ -775,7 +819,7 @@ object OptionsFrm: TOptionsFrm AnchorSideTop.Side = asrBottom AnchorSideRight.Control = pnProfilesRight AnchorSideRight.Side = asrBottom - Left = 174 + Left = 202 Height = 25 Top = 52 Width = 80 @@ -793,7 +837,7 @@ object OptionsFrm: TOptionsFrm AnchorSideTop.Side = asrBottom AnchorSideRight.Control = pnProfilesRight AnchorSideRight.Side = asrBottom - Left = 174 + Left = 202 Height = 25 Top = 81 Width = 80 diff --git a/components/onlinepackagemanager/opkman_optionsfrm.pas b/components/onlinepackagemanager/opkman_optionsfrm.pas index 19ede17bda..41a679e385 100644 --- a/components/onlinepackagemanager/opkman_optionsfrm.pas +++ b/components/onlinepackagemanager/opkman_optionsfrm.pas @@ -70,6 +70,7 @@ type edProxyServer: TEdit; edProxyUser: TEdit; gbProxySettings: TGroupBox; + lbConTimeOut: TLabel; lbFilterDirs: TLabel; lbFilterFiles: TLabel; lbLastUpdate: TLabel; @@ -100,6 +101,7 @@ type SDD: TSelectDirectoryDialog; seProxyPort: TSpinEdit; spDaysToShowNewPackages: TSpinEdit; + spConTimeOut: TSpinEdit; tsFolders: TTabSheet; tsProfiles: TTabSheet; tsGeneral: TTabSheet; @@ -181,6 +183,7 @@ begin Options.RemoteRepository.Text := Options.RemoteRepositoryTmp.Text; Options.ActiveRepositoryIndex := cbRemoteRepository.ItemIndex; Options.ForceDownloadAndExtract := cbForceDownloadExtract.Checked; + Options.ConTimeOut := spConTimeOut.Value; Options.DeleteZipAfterInstall := cbDeleteZipAfterInstall.Checked; Options.CheckForUpdates := cbCheckForUpdates.ItemIndex; Options.DaysToShowNewPackages := spDaysToShowNewPackages.Value; @@ -419,6 +422,9 @@ begin cbDeleteZipAfterInstall.Checked := Options.DeleteZipAfterInstall; cbForceDownloadExtract.Caption := rsOptions_cbForceDownloadExtract_Caption; cbForceDownloadExtract.Hint := rsOptions_cbForceDownloadExtract_Hint; + lbConTimeOut.Caption := rsOptions_lbConTimeOut_Caption; + lbConTimeOut.Hint := rsOptions_lbConTimeOut_Hint; + spConTimeOut.Value := Options.ConTimeOut; cbDeleteZipAfterInstall.Caption := rsOptions_cbDelete_Caption; cbDeleteZipAfterInstall.Hint := rsOptions_cbDelete_Hint; lbUpdates.Caption := rsOptions_lbCheckForUpdates_Caption; @@ -440,10 +446,6 @@ begin cbRegularIcons.Caption := rsOptions_cbRegular_Caption; cbUseDefaultTheme.Checked := Options.UseDefaultTheme; cbUseDefaultTheme.Caption := rsOptions_cbUseDefaultTheme_Caption; - - //spDaysToShowNewPackages.Top := lbDaysToShowNewPackages.Top + 1 + (lbDaysToShowNewPackages.Height - spDaysToShowNewPackages.Height) div 2; - //spDaysToShowNewPackages.Left := lbDaysToShowNewPackages.Left + lbDaysToShowNewPackages.Canvas.GetTextWidth(lbDaysToShowNewPackages.Caption) + 10; - tsProxy.Caption := rsOptions_tsProxy_Caption; cbProxy.Caption := rsOptions_cbProxy_Caption; gbProxySettings.Caption := rsOptions_gbProxySettings_Caption;