ADD: Show shortcut on the Add to queue button.

This commit is contained in:
cobines 2012-03-06 12:26:20 +00:00
commit 16020a35f8
2 changed files with 20 additions and 2 deletions

View file

@ -90,7 +90,7 @@ implementation
{$R *.lfm}
uses
fMain, LCLType, uGlobs, uLng;
fMain, LCLType, uGlobs, uLng, uHotkeyManager;
const
HotkeysCategory = 'Copy/Move Dialog';
@ -316,6 +316,9 @@ begin
end;
procedure TfrmCopyDlg.FormCreate(Sender: TObject);
var
HMForm: THMForm;
Hotkey: THotkey;
begin
pnlSelector.Visible := gShowCopyTabSelectPanel;
@ -342,7 +345,11 @@ begin
btnOK.Caption := rsOperStartStateAutoStart;
FOperationStartingState := ossAutoStart;
HotMan.Register(Self, HotkeysCategory);
HMForm := HotMan.Register(Self, HotkeysCategory);
Hotkey := HMForm.Hotkeys.FindByCommand('cm_AddToQueue');
if Assigned(Hotkey) then
btnAddToQueue.Caption := btnAddToQueue.Caption + ' (' + Hotkey.Shortcut + ')';
end;
procedure TfrmCopyDlg.FormDestroy(Sender: TObject);

View file

@ -88,6 +88,7 @@ type
procedure Delete(Shortcut: String); reintroduce;
procedure Remove(var hotkey: THotkey); reintroduce;
function Find(Shortcut: String): THotkey; overload;
function FindByCommand(Command: String): THotkey;
function FindByContents(Hotkey: THotkey): THotkey;
property OnChange: THotkeyEvent read FOnChange write FOnChange;
end;
@ -315,6 +316,16 @@ begin
Result := nil;
end;
function THotkeys.FindByCommand(Command: String): THotkey;
var
i: Integer;
begin
for i := 0 to Count - 1 do
if Items[i].Command = Command then
Exit(Items[i]);
Result := nil;
end;
function THotkeys.FindByContents(Hotkey: THotkey): THotkey;
var
i: Integer;