Skip to content

Commit

Permalink
Windows GUI: Add DisplayCaptions option
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Gervais <gervais.maxime@gmail.com>
  • Loading branch information
g-maxime committed Jun 26, 2024
1 parent 9050096 commit 8377340
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Source/GUI/VCL/GUI_Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,9 @@ void __fastcall TMainF::Refresh(TTabSheet *Page)
if (!Prefs->Config(__T("EnableFfmpeg")).empty())
I->Option_Static(__T("Enable_Ffmpeg"), Prefs->Config(__T("EnableFfmpeg")));

if (!Prefs->Config(__T("DisplayCaptions")).empty())
I->Option_Static(__T("File_DisplayCaptions"), Prefs->Config(__T("DisplayCaptions")));

//Easy
if (Page==Page_Easy)
{
Expand Down
24 changes: 24 additions & 0 deletions Source/GUI/VCL/GUI_Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,17 @@ void __fastcall TPreferencesF::Advanced_EnableFfmpegClick(TObject *Sender)
}
}

//---------------------------------------------------------------------------
void __fastcall TPreferencesF::Advanced_DisplayCaptions_SelChange(TObject *Sender)
{
if (Advanced_DisplayCaptions_Sel->ItemIndex==0)
Prefs->Config(__T("DisplayCaptions"))=__T("Content");
else if (Advanced_DisplayCaptions_Sel->ItemIndex==1)
Prefs->Config(__T("DisplayCaptions"))=__T("Command");
else if (Advanced_DisplayCaptions_Sel->ItemIndex==2)
Prefs->Config(__T("DisplayCaptions"))=__T("Stream");
}

//---------------------------------------------------------------------------
void __fastcall TPreferencesF::Language_NewClick(TObject *Sender)
{
Expand Down Expand Up @@ -621,6 +632,14 @@ void __fastcall TPreferencesF::Setup_AdvancedShow(TObject *Sender)
Advanced_InformVersion->Checked=Prefs->Config(__T("InformVersion")).To_int32s();
Advanced_InformTimestamp->Checked=Prefs->Config(__T("InformTimestamp")).To_int32s();
Advanced_EnableFfmpeg->Checked=Prefs->Config(__T("EnableFfmpeg")).To_int32s();

//Display captions
if (Prefs->Config(__T("DisplayCaptions"))==__T("Content"))
Advanced_DisplayCaptions_Sel->ItemIndex=0;
else if (Prefs->Config(__T("DisplayCaptions"))==__T("Stream"))
Advanced_DisplayCaptions_Sel->ItemIndex=2;
else // Command (default)
Advanced_DisplayCaptions_Sel->ItemIndex=1;
}

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -736,6 +755,11 @@ void __fastcall TPreferencesF::GUI_Configure()
Advanced_InformVersion->Caption=Prefs->Translate(__T("Add version to text output")).c_str();
Advanced_InformTimestamp->Caption=Prefs->Translate(__T("Add creation date to text output")).c_str();
Advanced_EnableFfmpeg->Caption=Prefs->Translate(__T("Enable FFmpeg plugin")).c_str();
Advanced_DisplayCaptions_Caption->Caption=Prefs->Translate(__T("Handling of 608/708 streams:")).c_str();
//Advanced_DisplayCaptions_Sel->Items->Clear();
//Advanced_DisplayCaptions_Sel->Items->Add(Prefs->Translate(__T("When content is detected")).c_str());
//Advanced_DisplayCaptions_Sel->Items->Add(Prefs->Translate(__T("When content or a command is detected")).c_str());
//Advanced_DisplayCaptions_Sel->Items->Add(Prefs->Translate(__T("Even when no content or command is detected")).c_str());
//-Language
Language_Caption->Caption=Prefs->Translate(__T("Choose language")).c_str();
Language_Edit->Caption=(Prefs->Translate(__T("Edit"))+__T("...")).c_str();
Expand Down
21 changes: 21 additions & 0 deletions Source/GUI/VCL/GUI_Preferences.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,27 @@ object PreferencesF: TPreferencesF
TabOrder = 4
OnClick = Advanced_EnableFfmpegClick
end
object LanguAdvanced_DisplayCaptions_Caption: TLabel
Left = 0
Top = 131
Width = 200
Height = 14
Caption = 'Handling of 608/708 streams:'
end
object Advanced_DisplayCaptions_Sel: TComboBox
Left = 201
Top = 127
Width = 300
Height = 22
Style = csDropDownList
DropDownCount = 10
TabOrder = 1
OnChange = Advanced_DisplayCaptions_SelChange
Items.Strings = (
'When content is detected'
'When content or a command is detected'
'Even when no content or command is detected')
end
end
object Customize_Language: TTabSheet
Caption = 'Language'
Expand Down
3 changes: 3 additions & 0 deletions Source/GUI/VCL/GUI_Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class TPreferencesF : public TForm
TCheckBox *Advanced_InformVersion;
TCheckBox *Advanced_InformTimestamp;
TCheckBox *Advanced_EnableFfmpeg;
TLabel *Advanced_DisplayCaptions_Caption;
TComboBox *Advanced_DisplayCaptions_Sel;
TTabSheet *Customize_Language;
TLabel *Language_Caption;
TButton *Language_New;
Expand Down Expand Up @@ -93,6 +95,7 @@ class TPreferencesF : public TForm
void __fastcall Advanced_InformVersionClick(TObject *Sender);
void __fastcall Advanced_InformTimestampClick(TObject *Sender);
void __fastcall Advanced_EnableFfmpegClick(TObject *Sender);
void __fastcall Advanced_DisplayCaptions_SelChange(TObject *Sender);
void __fastcall Graph_Adm_ShowTrackUIDsClick(TObject *Sender);
void __fastcall Graph_Adm_ShowChannelFormatsClick(TObject *Sender);
void __fastcall Setup_GeneralShow(TObject *Sender);
Expand Down

0 comments on commit 8377340

Please sign in to comment.