diff options
| author | Konstantin <const@const.me> | 2023-01-20 20:23:35 +0100 |
|---|---|---|
| committer | Konstantin <const@const.me> | 2023-01-20 20:23:35 +0100 |
| commit | e7716954cb681c531132a342b4b486a28179f792 (patch) | |
| tree | 359f2140ca10f7a5132dea36aa5bbbf16bd21cdd /Examples/WhisperDesktop/TranscribeDlg.cpp | |
| parent | 9c30dd0f95a11cb24f97b7eabd8eebb7ebdd5134 (diff) | |
Minor, UX enhancements
Diffstat (limited to 'Examples/WhisperDesktop/TranscribeDlg.cpp')
| -rw-r--r-- | Examples/WhisperDesktop/TranscribeDlg.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/Examples/WhisperDesktop/TranscribeDlg.cpp b/Examples/WhisperDesktop/TranscribeDlg.cpp index bfdb6f1..0e05827 100644 --- a/Examples/WhisperDesktop/TranscribeDlg.cpp +++ b/Examples/WhisperDesktop/TranscribeDlg.cpp @@ -22,6 +22,7 @@ constexpr int progressMaxInteger = 1024 * 8; static const LPCTSTR regValInput = L"sourceMedia"; static const LPCTSTR regValOutFormat = L"resultFormat"; static const LPCTSTR regValOutPath = L"resultPath"; +static const LPCTSTR regValUseInputFolder = L"useInputFolder"; LRESULT TranscribeDlg::OnInitDialog( UINT nMessage, WPARAM wParam, LPARAM lParam, BOOL& bHandled ) { @@ -61,8 +62,10 @@ LRESULT TranscribeDlg::OnInitDialog( UINT nMessage, WPARAM wParam, LPARAM lParam sourceMediaPath.SetWindowText( appState.stringLoad( regValInput ) ); transcribeOutFormat.SetCurSel( (int)appState.dwordLoad( regValOutFormat, 0 ) ); transcribeOutputPath.SetWindowText( appState.stringLoad( regValOutPath ) ); + if( appState.boolLoad( regValUseInputFolder ) ) + useInputFolder.SetCheck( BST_CHECKED ); BOOL unused; - OnOutFormatChange( 0, 0, nullptr, unused ); + onOutFormatChange( 0, 0, nullptr, unused ); appState.lastScreenSave( SCREEN_TRANSCRIBE ); appState.setupIcon( this ); @@ -118,7 +121,8 @@ enum struct TranscribeDlg::eOutputFormat : uint8_t WebVTT = 3 }; -LRESULT TranscribeDlg::OnOutFormatChange( UINT, INT, HWND, BOOL& bHandled ) +// CBN_SELCHANGE notification for IDC_OUTPUT_FORMAT combobox +LRESULT TranscribeDlg::onOutFormatChange( UINT, INT, HWND, BOOL& bHandled ) { BOOL enabled = transcribeOutFormat.GetCurSel() != 0; useInputFolder.EnableWindow( enabled ); @@ -134,6 +138,17 @@ LRESULT TranscribeDlg::OnOutFormatChange( UINT, INT, HWND, BOOL& bHandled ) return 0; } +// EN_CHANGE notification for IDC_PATH_MEDIA edit box +LRESULT TranscribeDlg::onInputChange( UINT, INT, HWND, BOOL& ) +{ + if( !useInputFolder.IsWindowEnabled() ) + return 0; + if( !isChecked( useInputFolder ) ) + return 0; + setOutputPath(); + return 0; +} + void TranscribeDlg::onBrowseMedia() { LPCTSTR title = L"Input audio file to transcribe"; @@ -255,12 +270,19 @@ void TranscribeDlg::onTranscribe() transcribeError( L"Please select an output text file" ); return; } + if( PathFileExists( transcribeArgs.pathOutput ) ) + { + const int resp = MessageBox( L"The output file is already there.\nOverwrite the file?", L"Confirm Overwrite", MB_ICONQUESTION | MB_YESNO ); + if( resp != IDYES ) + return; + } appState.stringStore( regValOutPath, transcribeArgs.pathOutput ); } else cbConsole.ensureChecked(); appState.dwordStore( regValOutFormat, (uint32_t)(int)transcribeArgs.format ); + appState.boolStore( regValUseInputFolder, isChecked( useInputFolder ) ); languageSelector.saveSelection( appState ); cbTranslate.saveSelection( appState ); appState.stringStore( regValInput, transcribeArgs.pathMedia ); |
