UPD: Show used directories in configuration

This commit is contained in:
Alexander Koblov 2017-05-01 09:17:46 +00:00
commit 3182c219da
5 changed files with 83 additions and 73 deletions

View file

@ -1,19 +1,19 @@
inherited frmOptionsConfiguration: TfrmOptionsConfiguration
Height = 451
Height = 462
Width = 594
ChildSizing.LeftRightSpacing = 6
ChildSizing.TopBottomSpacing = 6
ClientHeight = 451
ClientHeight = 462
ClientWidth = 594
DesignLeft = 590
DesignTop = 171
DesignLeft = 537
DesignTop = 124
object gbLocConfigFiles: TGroupBox[0]
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 93
Height = 104
Top = 6
Width = 582
Anchors = [akTop, akLeft, akRight]
@ -24,14 +24,14 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
ChildSizing.VerticalSpacing = 5
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 73
ClientHeight = 83
ClientWidth = 578
TabOrder = 0
object rbProgramDir: TRadioButton
Left = 10
Height = 19
Height = 23
Top = 5
Width = 212
Width = 229
BorderSpacing.CellAlignHorizontal = ccaLeftTop
Caption = 'P&rogram directory (portable version)'
Checked = True
@ -40,18 +40,18 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
end
object rbUserHomeDir: TRadioButton
Left = 10
Height = 19
Top = 29
Width = 127
Height = 23
Top = 33
Width = 141
BorderSpacing.CellAlignHorizontal = ccaLeftTop
Caption = '&User home directory'
TabOrder = 1
end
object lblCmdLineConfigDir: TLabel
Left = 10
Height = 15
Top = 53
Width = 113
Height = 17
Top = 61
Width = 118
BorderSpacing.CellAlignHorizontal = ccaLeftTop
Caption = 'Set on command line'
ParentColor = False
@ -65,15 +65,15 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 133
Top = 141
Height = 149
Top = 152
Width = 582
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 6
Caption = 'Save on exit'
ChildSizing.TopBottomSpacing = 5
ClientHeight = 113
ClientHeight = 128
ClientWidth = 578
TabOrder = 3
object cbDirHistory: TCheckBox
@ -81,9 +81,9 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
AnchorSideTop.Control = chkSearchReplaceHistory
AnchorSideTop.Side = asrBottom
Left = 10
Height = 19
Top = 47
Width = 107
Height = 22
Top = 53
Width = 119
BorderSpacing.Top = 2
Caption = '&Directory history'
TabOrder = 2
@ -93,9 +93,9 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
AnchorSideTop.Control = cbDirHistory
AnchorSideTop.Side = asrBottom
Left = 10
Height = 19
Top = 68
Width = 138
Height = 22
Top = 77
Width = 148
BorderSpacing.Top = 2
Caption = 'Co&mmand line history'
TabOrder = 3
@ -105,9 +105,9 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
AnchorSideTop.Control = cbCmdLineHistory
AnchorSideTop.Side = asrBottom
Left = 10
Height = 19
Top = 89
Width = 108
Height = 22
Top = 101
Width = 119
BorderSpacing.Top = 2
Caption = '&File mask history'
TabOrder = 4
@ -116,9 +116,9 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
AnchorSideLeft.Control = gbSaveOnExit
AnchorSideTop.Control = gbSaveOnExit
Left = 10
Height = 19
Height = 22
Top = 5
Width = 119
Width = 129
BorderSpacing.Left = 10
Caption = 'Sa&ve configuration'
OnChange = chkSaveConfigurationChange
@ -129,9 +129,9 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
AnchorSideTop.Control = chkSaveConfiguration
AnchorSideTop.Side = asrBottom
Left = 10
Height = 19
Top = 26
Width = 140
Height = 22
Top = 29
Width = 154
BorderSpacing.Top = 2
Caption = 'Searc&h/Replace history'
TabOrder = 1
@ -143,7 +143,7 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
AnchorSideTop.Side = asrBottom
Left = 10
Height = 30
Top = 105
Top = 116
Width = 116
BorderSpacing.Left = 10
BorderSpacing.Top = 6
@ -158,7 +158,7 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
AnchorSideTop.Side = asrBottom
Left = 136
Height = 30
Top = 105
Top = 116
Width = 116
BorderSpacing.Left = 10
BorderSpacing.Top = 6
@ -174,8 +174,8 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 58
Top = 274
Height = 67
Top = 301
Width = 582
Anchors = [akTop, akLeft, akRight]
AutoFill = True
@ -188,7 +188,7 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 38
ClientHeight = 46
ClientWidth = 578
ItemIndex = 0
Items.Strings = (
@ -205,51 +205,57 @@ inherited frmOptionsConfiguration: TfrmOptionsConfiguration
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 72
Top = 332
Height = 85
Top = 368
Width = 582
Anchors = [akTop, akLeft, akRight]
AutoSize = True
Caption = 'Directories'
ChildSizing.LeftRightSpacing = 6
ChildSizing.HorizontalSpacing = 8
ChildSizing.VerticalSpacing = 6
ChildSizing.EnlargeHorizontal = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 52
ChildSizing.TopBottomSpacing = 6
ClientHeight = 64
ClientWidth = 578
TabOrder = 5
object lblAppCache: TLabel
object lblThumbCache: TLabel
AnchorSideTop.Control = edtThumbCache
AnchorSideTop.Side = asrCenter
Left = 6
Height = 23
Top = 0
Width = 173
Caption = 'Cache:'
Height = 17
Top = 9
Width = 105
Caption = 'Thumbnails cache:'
ParentColor = False
end
object edtAppCache: TEdit
object edtThumbCache: TEdit
AnchorSideRight.Side = asrBottom
Left = 187
Left = 197
Height = 23
Top = 0
Width = 385
Top = 6
Width = 375
Anchors = [akTop, akLeft, akRight]
ReadOnly = True
TabOrder = 0
end
object lblAppData: TLabel
object lblIconThemes: TLabel
AnchorSideTop.Control = edtIconThemes
AnchorSideTop.Side = asrCenter
Left = 6
Height = 23
Top = 29
Width = 173
Caption = 'Data:'
Height = 17
Top = 38
Width = 73
Caption = 'Icon themes:'
ParentColor = False
end
object edtAppData: TEdit
Left = 187
object edtIconThemes: TEdit
AnchorSideTop.Control = edtThumbCache
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 197
Height = 23
Top = 29
Width = 385
Top = 35
Width = 375
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
ReadOnly = True
TabOrder = 1
end

View file

@ -12,5 +12,5 @@ TFRMOPTIONSCONFIGURATION.BTNCONFIGEDIT.CAPTION=&Edit
TFRMOPTIONSCONFIGURATION.BTNCONFIGAPPLY.CAPTION=A&pply
TFRMOPTIONSCONFIGURATION.GBSORTORDERCONFIGURATIONOPTION.CAPTION=Sort order of configuration order in left tree
TFRMOPTIONSCONFIGURATION.GBDIRECTORIES.CAPTION=Directories
TFRMOPTIONSCONFIGURATION.LBLAPPCACHE.CAPTION=Cache:
TFRMOPTIONSCONFIGURATION.LBLAPPDATA.CAPTION=Data:
TFRMOPTIONSCONFIGURATION.LBLTHUMBCACHE.CAPTION=Thumbnails cache:
TFRMOPTIONSCONFIGURATION.LBLICONTHEMES.CAPTION=Icon themes:

View file

@ -41,13 +41,13 @@ type
cbFileMaskHistory: TCheckBox;
chkSaveConfiguration: TCheckBox;
chkSearchReplaceHistory: TCheckBox;
edtAppCache: TEdit;
edtAppData: TEdit;
edtThumbCache: TEdit;
edtIconThemes: TEdit;
gbLocConfigFiles: TGroupBox;
gbSaveOnExit: TGroupBox;
gbDirectories: TGroupBox;
lblAppData: TLabel;
lblAppCache: TLabel;
lblIconThemes: TLabel;
lblThumbCache: TLabel;
lblCmdLineConfigDir: TLabel;
gbSortOrderConfigurationOption: TRadioGroup;
rbProgramDir: TRadioButton;
@ -146,8 +146,12 @@ begin
else
rbUserHomeDir.Checked := True;
edtAppData.Text:= GetAppDataDir;
edtAppCache.Text:= GetAppCacheDir;
edtThumbCache.Text:= gpThumbCacheDir;
if not gUseConfigInProgramDir then begin
edtIconThemes.Text:= IncludeTrailingBackslash(GetAppDataDir) + 'pixmaps' + PathSep;
end;
edtIconThemes.Text:= edtIconThemes.Text + ExcludeTrailingPathDelimiter(gpPixmapPath);
chkSaveConfiguration.Checked:= gSaveConfiguration;
chkSearchReplaceHistory.Checked:= gSaveSearchReplaceHistory;
cbDirHistory.Checked := gSaveDirHistory;

View file

@ -1 +1 @@
unit uGlobsPaths; interface var gpExePath : String = ''; // executable directory gpCfgDir : String = ''; // directory from which configuration files are used gpGlobalCfgDir : String = ''; // config dir global for all user gpCmdLineCfgDir : String = ''; // config dir passed on the command line gpLngDir : String = ''; // path to language *.po files gpPixmapPath : String = ''; // path to pixmaps gpCacheDir : String = ''; // cache directory gpHighPath : String = ''; // editor highlighter directory //Global Configuration Filename const gcfExtensionAssociation : string = 'extassoc.xml'; procedure LoadPaths; procedure UpdateEnvironmentVariable; implementation uses SysUtils, LazFileUtils, uDebug, uOSUtils, DCOSUtils, DCStrUtils; function GetAppName : String; begin Result := 'doublecmd'; end; procedure UpdateEnvironmentVariable; begin mbSetEnvironmentVariable('COMMANDER_INI', gpCfgDir + 'doublecmd.xml'); end; procedure LoadPaths; begin OnGetApplicationName := @GetAppName; gpExePath := ExtractFilePath(TryReadAllLinks(ParamStrU(0))); DCDebug('Executable directory: ', gpExePath); gpGlobalCfgDir := gpExePath; if gpCmdLineCfgDir <> EmptyStr then begin if GetPathType(gpCmdLineCfgDir) <> ptAbsolute then gpCmdLineCfgDir := IncludeTrailingPathDelimiter(mbGetCurrentDir) + gpCmdLineCfgDir; gpCmdLineCfgDir := ExpandAbsolutePath(gpCmdLineCfgDir); gpCfgDir := gpCmdLineCfgDir; end else begin gpCfgDir := GetAppConfigDir; if gpCfgDir = EmptyStr then begin DCDebug('Warning: Cannot get user config directory.'); gpCfgDir := gpGlobalCfgDir; end; end; gpCfgDir := IncludeTrailingPathDelimiter(gpCfgDir); gpLngDir := gpExePath + 'language' + DirectorySeparator; gpPixmapPath := gpExePath + 'pixmaps' + DirectorySeparator; gpHighPath:= gpExePath + 'highlighters' + DirectorySeparator; gpCacheDir := GetAppCacheDir; // set up environment variables UpdateEnvironmentVariable; mbSetEnvironmentVariable('COMMANDER_DRIVE', ExtractRootDir(gpExePath)); mbSetEnvironmentVariable('COMMANDER_PATH', ExcludeTrailingBackslash(gpExePath)); end; end.
unit uGlobsPaths; interface var gpExePath : String = ''; // executable directory gpCfgDir : String = ''; // directory from which configuration files are used gpGlobalCfgDir : String = ''; // config dir global for all user gpCmdLineCfgDir : String = ''; // config dir passed on the command line gpLngDir : String = ''; // path to language *.po files gpPixmapPath : String = ''; // path to pixmaps gpHighPath : String = ''; // editor highlighter directory gpThumbCacheDir : String = ''; // thumbnails cache directory //Global Configuration Filename const gcfExtensionAssociation : string = 'extassoc.xml'; procedure LoadPaths; procedure UpdateEnvironmentVariable; implementation uses SysUtils, LazFileUtils, uDebug, uOSUtils, DCOSUtils, DCStrUtils; function GetAppName : String; begin Result := 'doublecmd'; end; procedure UpdateEnvironmentVariable; begin mbSetEnvironmentVariable('COMMANDER_INI', gpCfgDir + 'doublecmd.xml'); end; procedure LoadPaths; begin OnGetApplicationName := @GetAppName; gpExePath := ExtractFilePath(TryReadAllLinks(ParamStrU(0))); DCDebug('Executable directory: ', gpExePath); gpGlobalCfgDir := gpExePath; if gpCmdLineCfgDir <> EmptyStr then begin if GetPathType(gpCmdLineCfgDir) <> ptAbsolute then gpCmdLineCfgDir := IncludeTrailingPathDelimiter(mbGetCurrentDir) + gpCmdLineCfgDir; gpCmdLineCfgDir := ExpandAbsolutePath(gpCmdLineCfgDir); gpCfgDir := gpCmdLineCfgDir; end else begin gpCfgDir := GetAppConfigDir; if gpCfgDir = EmptyStr then begin DCDebug('Warning: Cannot get user config directory.'); gpCfgDir := gpGlobalCfgDir; end; end; gpCfgDir := IncludeTrailingPathDelimiter(gpCfgDir); gpLngDir := gpExePath + 'language' + DirectorySeparator; gpPixmapPath := gpExePath + 'pixmaps' + DirectorySeparator; gpHighPath:= gpExePath + 'highlighters' + DirectorySeparator; gpThumbCacheDir := GetAppCacheDir + PathDelim + 'thumbnails'; // set up environment variables UpdateEnvironmentVariable; mbSetEnvironmentVariable('COMMANDER_DRIVE', ExtractRootDir(gpExePath)); mbSetEnvironmentVariable('COMMANDER_PATH', ExcludeTrailingBackslash(gpExePath)); end; end.

View file

@ -187,7 +187,7 @@ end;
constructor TThumbnailManager.Create(BackColor: TColor);
begin
FBackColor:= BackColor;
FThumbPath:= gpCacheDir + PathDelim + 'thumbnails';
FThumbPath:= gpThumbCacheDir;
// If directory not exists then create it
if not mbDirectoryExists(FThumbPath) then mbForceDirectory(FThumbPath);
end;
@ -317,7 +317,7 @@ var
aFileName: String;
aFileList: TStringList;
begin
aFileList:= FindAllFiles(gpCacheDir + PathDelim + 'thumbnails');
aFileList:= FindAllFiles(gpThumbCacheDir);
for I:= 0 to Pred(aFileList.Count) do
begin
if not (ReadFileName(aFileList[I], aFileName) and mbFileExists(aFileName)) then