Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 1444: Custom sound for "Beep when work finishes"
https://winscp.net/tracker/1444

Source commit: 89dd34d8fbd15cbfcdf0e9ded47e15260ed5500c
  • Loading branch information
martinprikryl committed Jan 27, 2018
1 parent 4723f96 commit 7dd3e3b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion source/forms/CustomScpExplorer.cpp
Expand Up @@ -1376,7 +1376,17 @@ void __fastcall TCustomScpExplorerForm::OperationComplete(
if (GUIConfiguration->BeepOnFinish &&
(Now() - StartTime > GUIConfiguration->BeepOnFinishAfter))
{
MessageBeep(MB_OK);
UnicodeString BeepSound = GUIConfiguration->BeepSound;
DWORD Sound;
if (!ExtractFileExt(BeepSound).IsEmpty())
{
Sound = SND_FILENAME;
}
else
{
Sound = SND_ALIAS;
}
PlaySound(BeepSound.c_str(), NULL, Sound | SND_ASYNC);
}
}
//---------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions source/windows/GUIConfiguration.cpp
Expand Up @@ -568,6 +568,7 @@ void __fastcall TGUIConfiguration::Default()
FPuttySession = L"WinSCP temporary session";
FBeepOnFinish = false;
FBeepOnFinishAfter = TDateTime(0, 0, 30, 0);
FBeepSound = L"SystemDefault";
FCopyParamCurrent = L"";
FKeepUpToDateChangeDelay = 500;
FChecksumAlg = L"sha1";
Expand Down Expand Up @@ -643,6 +644,7 @@ void __fastcall TGUIConfiguration::UpdateStaticUsage()
KEY(DateTime, IgnoreCancelBeforeFinish); \
KEY(Bool, BeepOnFinish); \
KEY(DateTime, BeepOnFinishAfter); \
KEY(String, BeepSound); \
KEY(Integer, KeepUpToDateChangeDelay); \
KEY(String, ChecksumAlg); \
KEY(Integer, SessionReopenAutoIdle); \
Expand Down
2 changes: 2 additions & 0 deletions source/windows/GUIConfiguration.h
Expand Up @@ -169,6 +169,7 @@ class TGUIConfiguration : public TConfiguration
TGUICopyParamType FDefaultCopyParam;
bool FBeepOnFinish;
TDateTime FBeepOnFinishAfter;
UnicodeString FBeepSound;
UnicodeString FDefaultPuttyPathOnly;
UnicodeString FDefaultPuttyPath;
TCopyParamList * FCopyParamList;
Expand Down Expand Up @@ -256,6 +257,7 @@ class TGUIConfiguration : public TConfiguration
__property TGUICopyParamType DefaultCopyParam = { read = FDefaultCopyParam, write = SetDefaultCopyParam };
__property bool BeepOnFinish = { read = FBeepOnFinish, write = FBeepOnFinish };
__property TDateTime BeepOnFinishAfter = { read = FBeepOnFinishAfter, write = FBeepOnFinishAfter };
__property UnicodeString BeepSound = { read = FBeepSound, write = FBeepSound };
__property const TCopyParamList * CopyParamList = { read = GetCopyParamList, write = SetCopyParamList };
__property UnicodeString CopyParamCurrent = { read = FCopyParamCurrent, write = SetCopyParamCurrent };
__property int CopyParamIndex = { read = GetCopyParamIndex, write = SetCopyParamIndex };
Expand Down

0 comments on commit 7dd3e3b

Please sign in to comment.