Skip to content

Commit 22862e4

Browse files
committed
fix(settings): fix hyperlink style coloring
1 parent f3b6730 commit 22862e4

9 files changed

Lines changed: 38 additions & 14 deletions

LLPlayer/Controls/Settings/SettingsAbout.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@
7373
<GridViewColumn.CellTemplate>
7474
<DataTemplate>
7575
<TextBlock>
76-
<Hyperlink NavigateUri="{Binding Url}" helpers:HyperlinkHelper.OpenInBrowser="True">
77-
<TextBlock Foreground="{DynamicResource MaterialDesign.Brush.Secondary}" Text="{Binding Name}" />
76+
<Hyperlink Style="{StaticResource MyHyperLink}" NavigateUri="{Binding Url}" helpers:HyperlinkHelper.OpenInBrowser="True">
77+
<Run Text="{Binding Name}" />
7878
</Hyperlink>
7979
</TextBlock>
8080
</DataTemplate>

LLPlayer/Controls/Settings/SettingsSubtitlesASR.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
FontSize="14"
4646
FontWeight="Medium"
4747
Width="180">
48-
<Hyperlink Cursor="Help" NavigateUri="https://github.com/umlx5h/LLPlayer/wiki/Whisper-Engine" helpers:HyperlinkHelper.OpenInBrowser="True">
48+
<Hyperlink Style="{StaticResource MyHyperLink}" NavigateUri="https://github.com/umlx5h/LLPlayer/wiki/Whisper-Engine" helpers:HyperlinkHelper.OpenInBrowser="True">
4949
Whisper Engine
5050
</Hyperlink>
5151
</TextBlock>
@@ -462,7 +462,7 @@
462462

463463
<TextBlock Margin="5 10 5 0">
464464
Some runtimes require the installation of a toolkit or others beforehand. Please check
465-
<Hyperlink NavigateUri="https://github.com/sandrohanea/whisper.net?tab=readme-ov-file#runtimes-description" helpers:HyperlinkHelper.OpenInBrowser="True">
465+
<Hyperlink Style="{StaticResource MyHyperLink}" NavigateUri="https://github.com/sandrohanea/whisper.net?tab=readme-ov-file#runtimes-description" helpers:HyperlinkHelper.OpenInBrowser="True">
466466
this link
467467
</Hyperlink>
468468
for details.

LLPlayer/Controls/Settings/SettingsSubtitlesAction.xaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
FontSize="14"
4848
FontWeight="Medium"
4949
Width="180">
50-
<Hyperlink Cursor="Help" NavigateUri="{Binding FL.PlayerConfig.Subtitles.TranslateWordServiceType, Converter={StaticResource TranslateServiceTypeEnumToUrlConv}}" helpers:HyperlinkHelper.OpenInBrowser="True">
50+
<Hyperlink Style="{StaticResource MyHyperLink}" NavigateUri="{Binding FL.PlayerConfig.Subtitles.TranslateWordServiceType, Converter={StaticResource TranslateServiceTypeEnumToUrlConv}}" helpers:HyperlinkHelper.OpenInBrowser="True">
5151
Translation Engine
5252
</Hyperlink>
5353
</TextBlock>
@@ -311,28 +311,35 @@ Note that this does not work for bitmap subtitles. In that case, please use OCR
311311

312312
<TextBlock Margin="5 10 5 0">
313313
You can send subtitle text to your browser via the clipboard and work with browser extensions such as Yomitan and 10ten.
314-
See <Hyperlink NavigateUri="https://github.com/umlx5h/LLPlayer/wiki/Browser-Extensions-Integration" helpers:HyperlinkHelper.OpenInBrowser="True">this link</Hyperlink>
314+
See <Hyperlink Style="{StaticResource MyHyperLink}" NavigateUri="https://github.com/umlx5h/LLPlayer/wiki/Browser-Extensions-Integration" helpers:HyperlinkHelper.OpenInBrowser="True">this link</Hyperlink>
315315
for more information.
316316
</TextBlock>
317317
</StackPanel>
318318
</GroupBox>
319319

320-
<GroupBox Header="Word Special Actions">
320+
<GroupBox Header="Word Special Actions for Japanese" Visibility="{Binding IsTargetJapanese, Converter={StaticResource BooleanToVisibilityConv}}">
321321
<StackPanel>
322322
<DockPanel>
323323
<TextBlock
324-
Text="PDIC Executable Path (for Japanese users)"
324+
Text="PDIC Executable Path"
325325
Width="180" />
326326
<TextBox
327327
HorizontalContentAlignment="Left"
328328
Text="{Binding FL.Config.Subs.PDICPipeExecutablePath}" />
329329
</DockPanel>
330330

331+
<Button
332+
Content="Auto Set"
333+
HorizontalAlignment="Left"
334+
Command="{Binding CmdSetPdicPath}"
335+
Style="{StaticResource MaterialDesignRaisedSecondaryButton}"
336+
Margin="180 0 0 0" />
337+
331338
<TextBlock Margin="5 10 5 0">
332339
(For Japanese-speaking learners of English)
333340
<LineBreak />
334341
It can be linked to the PDIC dictionary tool.
335-
See <Hyperlink NavigateUri="https://github.com/umlx5h/LLPlayer/wiki/PDIC-Integration-(For-Japanese-users)" helpers:HyperlinkHelper.OpenInBrowser="True">this link</Hyperlink>
342+
See <Hyperlink Style="{StaticResource MyHyperLink}" NavigateUri="https://github.com/umlx5h/LLPlayer/wiki/PDIC-Integration-(For-Japanese-users)" helpers:HyperlinkHelper.OpenInBrowser="True">this link</Hyperlink>
336343
for more information.
337344
</TextBlock>
338345
</StackPanel>

LLPlayer/Controls/Settings/SettingsSubtitlesAction.xaml.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.ObjectModel;
2+
using System.IO;
23
using System.Windows;
34
using System.Windows.Controls;
45
using System.Windows.Input;
@@ -102,6 +103,21 @@ public TranslateServiceType SelectedTranslateWordServiceType
102103
});
103104

104105
// TODO: L: SaveCommand?
106+
107+
public bool IsTargetJapanese => FL.PlayerConfig.Subtitles.TranslateTargetLanguage == FlyleafLib.MediaPlayer.Translation.TargetLanguage.Japanese;
108+
109+
public DelegateCommand CmdSetPdicPath => field ??= new(() =>
110+
{
111+
string pdicPath = Path.Combine(
112+
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
113+
"PDIC-R Unicode for EIJIRO XI",
114+
"pdic-pipe.exe");
115+
116+
if (File.Exists(pdicPath))
117+
{
118+
FL.Config.Subs.PDICPipeExecutablePath = pdicPath;
119+
}
120+
});
105121
}
106122

107123
class DataGridRowOrderBehaviorMenuAction : DataGridRowOrderBehavior<IMenuAction>;

LLPlayer/Controls/Settings/SettingsSubtitlesOCR.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207

208208
<TextBlock Grid.Column="0" Grid.Row="2" Margin="5 10 5 0">
209209
You will need to install a language pack on your OS or install an OCR engine using
210-
<Hyperlink NavigateUri="https://learn.microsoft.com/en-us/windows/powertoys/text-extractor#supported-languages" helpers:HyperlinkHelper.OpenInBrowser="True">
210+
<Hyperlink Style="{StaticResource MyHyperLink}" NavigateUri="https://learn.microsoft.com/en-us/windows/powertoys/text-extractor#supported-languages" helpers:HyperlinkHelper.OpenInBrowser="True">
211211
this link
212212
</Hyperlink>
213213
as a reference.

LLPlayer/Controls/Settings/SettingsSubtitlesTrans.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@
306306
FontSize="14"
307307
FontWeight="Medium"
308308
Width="180">
309-
<Hyperlink Cursor="Help" NavigateUri="{Binding SelectedTranslateServiceType, Converter={StaticResource TranslateServiceTypeEnumToUrlConv}}" helpers:HyperlinkHelper.OpenInBrowser="True">
309+
<Hyperlink Style="{StaticResource MyHyperLink}" NavigateUri="{Binding SelectedTranslateServiceType, Converter={StaticResource TranslateServiceTypeEnumToUrlConv}}" helpers:HyperlinkHelper.OpenInBrowser="True">
310310
Translation Engine
311311
</Hyperlink>
312312
</TextBlock>

LLPlayer/Controls/Settings/Trans/OpenAIBaseTranslateControl.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
Margin="8 0 0 8"
106106
HorizontalAlignment="Left"
107107
Width="180">
108-
<Hyperlink Cursor="Help" NavigateUri="https://platform.openai.com/docs/api-reference/chat/create" helpers:HyperlinkHelper.OpenInBrowser="True">
108+
<Hyperlink Style="{StaticResource MyHyperLink}" NavigateUri="https://platform.openai.com/docs/api-reference/chat/create" helpers:HyperlinkHelper.OpenInBrowser="True">
109109
OpenAI Reference
110110
</Hyperlink>
111111
</TextBlock>

LLPlayer/Resources/MaterialDesignMy.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
<Setter Property="VerticalContentAlignment" Value="Center" />
1111
</Style>
1212

13-
<Style TargetType="Hyperlink">
13+
<Style TargetType="Hyperlink" x:Key="MyHyperLink" BasedOn="{StaticResource MaterialDesignHyperlink}">
1414
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Secondary}" />
1515
<Style.Triggers>
1616
<Trigger Property="IsMouseOver" Value="True">
17+
<Setter Property="Cursor" Value="Hand" />
1718
<Setter Property="Foreground" Value="{DynamicResource MaterialDesign.Brush.Secondary.Light}" />
1819
</Trigger>
1920
</Style.Triggers>

LLPlayer/Views/WhisperEngineDownloadDialog.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
<!-- Select engine -->
4040
<TextBlock Grid.Row="0" Margin="0 0 0 16" FontWeight="Bold">
41-
Download <Hyperlink NavigateUri="{Binding Source={x:Static vm:WhisperEngineDownloadDialogVM.EngineURL}}" helpers:HyperlinkHelper.OpenInBrowser="True">
41+
Download <Hyperlink Style="{StaticResource MyHyperLink}" NavigateUri="{Binding Source={x:Static vm:WhisperEngineDownloadDialogVM.EngineURL}}" helpers:HyperlinkHelper.OpenInBrowser="True">
4242
<TextBlock Text="{Binding Source={x:Static vm:WhisperEngineDownloadDialogVM.EngineFile}}" /></Hyperlink>
4343
<LineBreak />
4444
<Run FontWeight="Normal" Text="-> Whisper\Faster-Whisper-XXL\faster-whisper-xxl.exe"/>

0 commit comments

Comments
 (0)