ADD: Feature [0002306] Notification about the end of a long running operation (step 2)

This commit is contained in:
Alexander Koblov 2024-07-31 20:28:55 +03:00
commit fefa77a1b0
2 changed files with 16 additions and 6 deletions

View file

@ -38,7 +38,7 @@ procedure ShowOperationModal(OpManItem: TOperationsManagerItem);
implementation
uses
fFileOpDlg, uFileSourceOperationTypes, uGlobs, uPlaySound;
DateUtils, fFileOpDlg, uFileSourceOperationTypes, uGlobs, uPlaySound;
function GetOperationStateString(OperationState: TFileSourceOperationState): String;
begin
@ -57,12 +57,15 @@ procedure PlaySound(OpManItem: TOperationsManagerItem);
var
FileName: String;
begin
if OpManItem.Operation.ID in [fsoCopy, fsoCopyIn, fsoCopyOut] then
FileName:= gFileOperationsSounds[fsoCopy]
else begin
FileName:= gFileOperationsSounds[OpManItem.Operation.ID];
if (gFileOperationDuration <= 0) or (SecondsBetween(Now, OpManItem.Operation.StartTime) >= gFileOperationDuration) then
begin
if OpManItem.Operation.ID in [fsoCopy, fsoCopyIn, fsoCopyOut] then
FileName:= gFileOperationsSounds[fsoCopy]
else begin
FileName:= gFileOperationsSounds[OpManItem.Operation.ID];
end;
if (Length(FileName) > 0) then uPlaySound.PlaySound(FileName);
end;
if (Length(FileName) > 0) then uPlaySound.PlaySound(FileName);
end;
procedure ShowOperation(OpManItem: TOperationsManagerItem);

View file

@ -494,6 +494,7 @@ var
gFileOperationsProgressKind: TFileOperationsProgressKind;
gFileOperationsConfirmations: TFileOperationsConfirmations;
gFileOperationsSounds: array[TFileSourceOperationType] of String;
gFileOperationDuration: Integer;
{ Multi-Rename}
gMulRenShowMenuBarOnTop : boolean;
@ -1935,6 +1936,7 @@ begin
gAutoExtractOpenMask := EmptyStr;
gFileOperationsProgressKind := fopkSeparateWindow;
gFileOperationsConfirmations := [focCopy, focMove, focDelete, focDeleteToTrash];
gFileOperationDuration := 10;
{ Multi-Rename }
gMulRenShowMenuBarOnTop := True;
@ -2897,8 +2899,13 @@ begin
SubNode := Node.FindNode('Sounds');
if Assigned(SubNode) then
begin
gFileOperationDuration:= GetAttr(SubNode, 'Duration', gFileOperationDuration);
gFileOperationsSounds[fsoCopy]:= GetValue(SubNode, 'Copy', EmptyStr);
gFileOperationsSounds[fsoMove]:= GetValue(SubNode, 'Move', EmptyStr);
gFileOperationsSounds[fsoWipe]:= GetValue(SubNode, 'Wipe', EmptyStr);
gFileOperationsSounds[fsoDelete]:= GetValue(SubNode, 'Delete', EmptyStr);
gFileOperationsSounds[fsoSplit]:= GetValue(SubNode, 'Split', EmptyStr);
gFileOperationsSounds[fsoCombine]:= GetValue(SubNode, 'Combine', EmptyStr);
end;
// Operations options
SubNode := Node.FindNode('Options');