-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml
More file actions
253 lines (232 loc) · 11.4 KB
/
MainWindow.xaml
File metadata and controls
253 lines (232 loc) · 11.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<Window
x:Class="DeepLocal.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="DeepLocal — Offline Translator"
Width="1200" Height="720"
Icon="Assets/DeepLocal_UserIcon_Framed.ico"
WindowStartupLocation="Manual"
Background="#F6F8FC">
<!-- ===== Tema: topbar scura, canvas chiaro, container blu ===== -->
<Window.Resources>
<!-- Top bar / status bar -->
<SolidColorBrush x:Key="TopBar" Color="#0E1727"/>
<SolidColorBrush x:Key="StatusBg" Color="#0E1727"/>
<SolidColorBrush x:Key="Muted" Color="#B7C3D4"/>
<!-- Container (blu scuro) -->
<SolidColorBrush x:Key="CardBg" Color="#0F172A"/>
<SolidColorBrush x:Key="CardBorder" Color="#1F2A44"/>
<!-- Strip titolo container -->
<SolidColorBrush x:Key="Strip" Color="#121D33"/>
<!-- Bottoni tondi -->
<SolidColorBrush x:Key="RoundBase" Color="#121A2A"/>
<SolidColorBrush x:Key="RoundBorder" Color="#2A374D"/>
<SolidColorBrush x:Key="RoundBorderGreen" Color="#2FC98A"/>
<!-- Card -->
<Style x:Key="Card" TargetType="Border">
<Setter Property="CornerRadius" Value="16"/>
<Setter Property="Background" Value="{StaticResource CardBg}"/>
<Setter Property="BorderBrush" Value="{StaticResource CardBorder}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="Margin" Value="10"/>
</Style>
<!-- TextBox dentro i container -->
<Style TargetType="TextBox">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="16"/>
<Setter Property="FontFamily" Value="Consolas"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="AcceptsReturn" Value="True"/>
<Setter Property="TextWrapping" Value="Wrap"/>
<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
<Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
<Setter Property="Margin" Value="12"/>
<Setter Property="MinHeight" Value="300"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="CaretBrush" Value="{StaticResource RoundBorderGreen}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<ScrollViewer x:Name="PART_ContentHost" Padding="{TemplateBinding Padding}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Bottoni tondi al centro -->
<Style x:Key="RoundBtnBase" TargetType="Button">
<Setter Property="Width" Value="52"/>
<Setter Property="Height" Value="52"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="{StaticResource RoundBase}"/>
<Setter Property="BorderBrush" Value="{StaticResource RoundBorder}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border CornerRadius="26"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="#3A506B"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.6"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="RoundBtn" BasedOn="{StaticResource RoundBtnBase}" TargetType="Button"/>
<Style x:Key="RoundBtnGreen" BasedOn="{StaticResource RoundBtnBase}" TargetType="Button">
<Setter Property="Background" Value="#163B31"/>
<Setter Property="Foreground" Value="{StaticResource RoundBorderGreen}"/>
<Setter Property="BorderBrush" Value="{StaticResource RoundBorderGreen}"/>
</Style>
<Style x:Key="RoundBtnSmall" BasedOn="{StaticResource RoundBtnBase}" TargetType="Button">
<Setter Property="Width" Value="38"/>
<Setter Property="Height" Value="38"/>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- ===== Top bar ===== -->
<Border Grid.Row="0" Background="{StaticResource TopBar}" Padding="12,8">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center" Margin="18,0,0,0">
<TextBlock Text="DeepLocal 🌎" Foreground="White" FontSize="22" FontWeight="Bold"/>
<TextBlock Text="Translator" Foreground="{StaticResource Muted}" FontSize="14" Margin="8,6,0,0"/>
</StackPanel>
<Border Grid.Column="1" Background="#101826" CornerRadius="10" Padding="8" Margin="16,0"
VerticalAlignment="Center">
<DockPanel LastChildFill="True">
<TextBlock Text="🧠" FontSize="16" Foreground="White" Margin="0,0,8,0"
VerticalAlignment="Center" DockPanel.Dock="Left"/>
<ComboBox x:Name="ModelCombo" Width="260" SelectedIndex="0"
SelectionChanged="ModelCombo_SelectionChanged" DockPanel.Dock="Right">
<ComboBoxItem Tag="gemma3:12b">gemma3:12b (Default)</ComboBoxItem>
<ComboBoxItem Tag="mistral:latest">mistral:latest</ComboBoxItem>
<ComboBoxItem Tag="aya-expanse:8b">aya-expanse:8b</ComboBoxItem>
<ComboBoxItem Tag="gpt-oss:20b">gpt-oss:20b</ComboBoxItem>
<ComboBoxItem Tag="gpt-oss:120b-cloud">gpt-oss:120b-cloud</ComboBoxItem>
</ComboBox>
</DockPanel>
</Border>
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
<Button x:Name="ClipboardBtn" Click="ClipboardBtn_Click" Padding="14,6">
Translate from clipboard (Alt+T)
</Button>
<!-- NUOVO: icona info che apre il GitHub -->
<Button x:Name="InfoBtn"
Style="{StaticResource RoundBtnSmall}"
Margin="8,0,0,0"
ToolTip="Open GitHub (@MetaDarko)"
Click="InfoBtn_Click">ℹ️</Button>
</StackPanel>
</Grid>
</Border>
<!-- ===== Area contenuti ===== -->
<Grid Grid.Row="1" Margin="24,26,24,14">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="480"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" MinWidth="480"/>
</Grid.ColumnDefinitions>
<!-- SORGENTE -->
<Border Grid.Column="0" Style="{StaticResource Card}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="46"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="{StaticResource Strip}" CornerRadius="16,16,0,0" Padding="12,6">
<DockPanel LastChildFill="False">
<TextBlock Text="Source text" Foreground="{StaticResource Muted}"
DockPanel.Dock="Left" VerticalAlignment="Center"/>
<ComboBox x:Name="SourceLang" Width="190" Margin="10,0,0,0"
SelectedIndex="0" DockPanel.Dock="Right" VerticalAlignment="Center"
SelectionChanged="SourceLang_SelectionChanged">
<ComboBoxItem>Auto</ComboBoxItem>
<ComboBoxItem>Italian</ComboBoxItem>
<ComboBoxItem>English</ComboBoxItem>
<ComboBoxItem>Spanish</ComboBoxItem>
<ComboBoxItem>French</ComboBoxItem>
<ComboBoxItem>German</ComboBoxItem>
<ComboBoxItem>Russian</ComboBoxItem>
<ComboBoxItem>Hebrew</ComboBoxItem>
<ComboBoxItem>Japanese</ComboBoxItem>
<ComboBoxItem>Chinese</ComboBoxItem>
</ComboBox>
</DockPanel>
</Border>
<TextBox Grid.Row="1" x:Name="SourceBox"/>
</Grid>
</Border>
<!-- PULSANTI CENTRALI -->
<StackPanel Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="12,0">
<Button Content="⇆" Style="{StaticResource RoundBtn}" Click="Swap_Click" ToolTip="Swap languages"/>
<Button x:Name="TranslateBtn" Style="{StaticResource RoundBtnGreen}" Margin="0,14,0,14"
Click="TranslateBtn_Click" ToolTip="Translate">▶️</Button>
<Button x:Name="ClearBtn" Style="{StaticResource RoundBtn}" Click="ClearAll_Click" ToolTip="Clear both panes">❌</Button>
</StackPanel>
<!-- TRADUZIONE -->
<Border Grid.Column="2" Style="{StaticResource Card}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="46"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="{StaticResource Strip}" CornerRadius="16,16,0,0" Padding="12,6">
<DockPanel LastChildFill="False">
<TextBlock Text="Translation" Foreground="{StaticResource Muted}"
DockPanel.Dock="Left" VerticalAlignment="Center"/>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right" VerticalAlignment="Center">
<ComboBox x:Name="TargetLang" Width="190" SelectedIndex="1"
SelectionChanged="TargetLang_SelectionChanged" VerticalAlignment="Center">
<ComboBoxItem>Italian</ComboBoxItem>
<ComboBoxItem>English</ComboBoxItem>
<ComboBoxItem>Spanish</ComboBoxItem>
<ComboBoxItem>French</ComboBoxItem>
<ComboBoxItem>German</ComboBoxItem>
<ComboBoxItem>Russian</ComboBoxItem>
<ComboBoxItem>Hebrew</ComboBoxItem>
<ComboBoxItem>Japanese</ComboBoxItem>
<ComboBoxItem>Chinese</ComboBoxItem>
</ComboBox>
<Button Content="📋" Style="{StaticResource RoundBtnSmall}" Margin="8,0,0,0"
ToolTip="Copy translation" Click="CopyTranslated_Click"/>
</StackPanel>
</DockPanel>
</Border>
<TextBox Grid.Row="1" x:Name="TargetBox" IsReadOnly="True"/>
</Grid>
</Border>
</Grid>
<!-- ===== Status bar ===== -->
<StatusBar Grid.Row="2" Background="{StaticResource StatusBg}" Foreground="White">
<StatusBarItem><TextBlock x:Name="StatusText" Text="Ready."/></StatusBarItem>
<Separator/>
<StatusBarItem><TextBlock x:Name="StatusModel" Text="Model: gemma3:12b | Ollama: http://127.0.0.1:11434"/></StatusBarItem>
</StatusBar>
</Grid>
</Window>