<!--
// /***************************************************************************
// Aaru Data Preservation Suite
// ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
//
// Filename       : ImageConvert.xaml
// Author(s)      : Natalia Portillo <claunia@claunia.com>
//
// Component      : GUI windows.
//
// ‐‐[ Description ] ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
//
//     Image conversion window.
//
// ‐‐[ License ] ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
//
//     This program is free software: you can redistribute it and/or modify
//     it under the terms of the GNU General public License as
//     published by the Free Software Foundation, either version 3 of the
//     License, or (at your option) any later version.
//
//     This program is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General public License for more details.
//
//     You should have received a copy of the GNU General public License
//     along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
// ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
// Copyright © 2011-2026 Natalia Portillo
// ****************************************************************************/
-->
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:windows="clr-namespace:Aaru.Gui.ViewModels.Windows"
        xmlns:localization="clr-namespace:Aaru.Localization;assembly=Aaru.Localization"
        xmlns:controls="clr-namespace:Aaru.Gui.Controls"
        mc:Ignorable="d"
        d:DesignWidth="800"
        d:DesignHeight="450"
        Width="1000"
        Height="832"
        x:Class="Aaru.Gui.Views.Windows.ImageConvert"
        Icon="/Assets/aaru.png"
        x:DataType="windows:ImageConvertViewModel"
        Title="{x:Static localization:UI.Title_Convert_image}">
    <Design.DataContext>
        <windows:ImageConvertViewModel />
    </Design.DataContext>
    <Grid Margin="12"
          RowSpacing="8"
          RowDefinitions="Auto,Auto,Auto,*,Auto,Auto">
        <Grid Grid.Row="0"
              ColumnDefinitions="Auto,*"
              ColumnSpacing="8">
            <TextBlock Grid.Column="0"
                       FontWeight="Bold"
                       Text="{x:Static localization:UI.Source_image}" />
            <TextBlock Grid.Column="1"
                       Text="{Binding SourceText, Mode=OneWay}" />
        </Grid>
        <Grid Grid.Row="1"
              ColumnDefinitions="Auto,*"
              ColumnSpacing="8"
              HorizontalAlignment="Stretch">
            <TextBlock Grid.Column="0"
                       FontWeight="Bold"
                       Text="{x:Static localization:UI.Output_format}"
                       VerticalAlignment="Center" />
            <ComboBox Grid.Column="1"
                      ItemsSource="{Binding PluginsList, Mode=OneWay}"
                      SelectedItem="{Binding SelectedPlugin, Mode=TwoWay}"
                      IsEnabled="{Binding !FormatReadOnly, Mode=OneWay}"
                      HorizontalAlignment="Stretch">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name, Mode=OneWay}" />
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </Grid>
        <Grid Grid.Row="2"
              ColumnDefinitions="Auto,*"
              ColumnSpacing="8">
            <Button Grid.Column="0"
                    Command="{Binding DestinationCommand, Mode=OneWay}"
                    IsEnabled="{Binding DestinationEnabled, Mode=OneWay}"
                    IsVisible="{Binding DestinationVisible, Mode=OneWay}">
                <TextBlock Text="{x:Static localization:UI.ButtonLabel_Choose}" />
            </Button>
            <TextBox Grid.Column="1"
                     Text="{Binding DestinationText, Mode=OneWay}"
                     HorizontalAlignment="Stretch"
                     VerticalAlignment="Stretch"
                     Watermark="Destination image file path"
                     IsReadOnly="True" />
        </Grid>
        <ScrollViewer Grid.Row="3"
                      HorizontalScrollBarVisibility="Disabled"
                      VerticalScrollBarVisibility="Auto"
                      IsVisible="{Binding OptionsVisible, Mode=OneWay}">
            <Grid RowDefinitions="Auto,Auto,Auto,*"
                  RowSpacing="8">
                <StackPanel Grid.Row="0"
                            Orientation="Horizontal"
                            Spacing="8">
                    <NumericUpDown Increment="1"
                                   Minimum="1"
                                   Maximum="16384"
                                   Value="{Binding SectorsValue, Mode=TwoWay}"
                                   Width="120" />
                    <TextBlock Text="{x:Static localization:UI.How_many_sectors_to_convert_at_once}"
                               VerticalAlignment="Center" />
                </StackPanel>
                <CheckBox Grid.Row="1"
                          IsChecked="{Binding ForceChecked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Continue_conversion_even_if_data_lost}" />
                </CheckBox>
                <Grid Grid.Row="2"
                      ColumnDefinitions="Auto,*,Auto"
                      ColumnSpacing="8">
                    <TextBlock Grid.Column="0"
                               Text="{x:Static localization:UI.Who_person_created_the_image}"
                               VerticalAlignment="Center" />
                    <TextBox Grid.Column="1"
                             Text="{Binding CreatorText, Mode=OneWay}"
                             HorizontalAlignment="Stretch" />
                    <Button Grid.Column="2"
                            Command="{Binding CreatorCommand, Mode=OneWay}"
                            HorizontalAlignment="Right"
                            IsVisible="{Binding CreatorVisible, Mode=OneWay}">
                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                    </Button>
                </Grid>
                <Grid Grid.Row="3"
                      RowDefinitions="Auto,*,Auto,Auto,Auto,Auto"
                      RowSpacing="8">
                    <TextBlock Grid.Row="0"
                               FontWeight="Bold"
                               Text="{x:Static localization:UI.Title_Metadata}" />
                    <TabControl Grid.Row="1">
                        <TabItem>
                            <TabItem.Header>
                                <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Media}" />
                            </TabItem.Header>
                            <StackPanel Orientation="Vertical"
                                        Spacing="8"
                                        Margin="8"
                                        MinHeight="330">
                                <Grid ColumnDefinitions="Auto,*,Auto"
                                      ColumnSpacing="8">
                                    <controls:SpectreTextBlock Grid.Column="0"
                                                               Text="{x:Static localization:UI.Title_Title}"
                                                               VerticalAlignment="Center" />
                                    <TextBox Grid.Column="1"
                                             Text="{Binding MediaTitleText, Mode=OneWay}" />
                                    <Button Grid.Column="2"
                                            Command="{Binding MediaTitleCommand, Mode=OneWay}"
                                            IsVisible="{Binding MediaTitleVisible, Mode=OneWay}">
                                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                    </Button>
                                </Grid>
                                <Grid ColumnDefinitions="Auto,*,Auto"
                                      ColumnSpacing="8">
                                    <controls:SpectreTextBlock Grid.Column="0"
                                                               Text="{x:Static localization:UI.Title_Manufacturer}"
                                                               VerticalAlignment="Center" />
                                    <TextBox Grid.Column="1"
                                             Text="{Binding MediaManufacturerText, Mode=OneWay}" />
                                    <Button Grid.Column="2"
                                            Command="{Binding MediaManufacturerCommand, Mode=OneWay}"
                                            IsVisible="{Binding MediaManufacturerVisible, Mode=OneWay}">
                                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                    </Button>
                                </Grid>
                                <Grid ColumnDefinitions="Auto,*,Auto"
                                      ColumnSpacing="8">
                                    <controls:SpectreTextBlock Grid.Column="0"
                                                               Text="{x:Static localization:UI.Title_Model}"
                                                               VerticalAlignment="Center" />
                                    <TextBox Grid.Column="1"
                                             Text="{Binding MediaModelText, Mode=OneWay}" />
                                    <Button Grid.Column="2"
                                            Command="{Binding MediaModelCommand, Mode=OneWay}"
                                            IsVisible="{Binding MediaModelVisible, Mode=OneWay}">
                                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                    </Button>
                                </Grid>
                                <Grid ColumnDefinitions="Auto,*,Auto"
                                      ColumnSpacing="8">
                                    <controls:SpectreTextBlock Grid.Column="0"
                                                               Text="{x:Static localization:UI.Title_Serial_number}"
                                                               VerticalAlignment="Center" />
                                    <TextBox Grid.Column="1"
                                             Text="{Binding MediaSerialNumberText, Mode=OneWay}" />
                                    <Button Grid.Column="2"
                                            Command="{Binding MediaSerialNumberCommand, Mode=OneWay}"
                                            IsVisible="{Binding MediaSerialNumberVisible, Mode=OneWay}">
                                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                    </Button>
                                </Grid>
                                <Grid ColumnDefinitions="Auto,*,Auto"
                                      ColumnSpacing="8">
                                    <controls:SpectreTextBlock Grid.Column="0"
                                                               Text="{x:Static localization:UI.Title_Barcode}"
                                                               VerticalAlignment="Center" />
                                    <TextBox Grid.Column="1"
                                             Text="{Binding MediaBarcodeText, Mode=OneWay}" />
                                    <Button Grid.Column="2"
                                            Command="{Binding MediaBarcodeCommand, Mode=OneWay}"
                                            IsVisible="{Binding MediaBarcodeVisible, Mode=OneWay}">
                                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                    </Button>
                                </Grid>
                                <Grid ColumnDefinitions="Auto,*,Auto"
                                      ColumnSpacing="8">
                                    <controls:SpectreTextBlock Grid.Column="0"
                                                               Text="{x:Static localization:UI.Title_Part_number}"
                                                               VerticalAlignment="Center" />
                                    <TextBox Grid.Column="1"
                                             Text="{Binding MediaPartNumberText, Mode=OneWay}" />
                                    <Button Grid.Column="2"
                                            Command="{Binding MediaPartNumberCommand, Mode=OneWay}"
                                            IsVisible="{Binding MediaPartNumberVisible, Mode=OneWay}">
                                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                    </Button>
                                </Grid>
                                <StackPanel Orientation="Horizontal"
                                            Spacing="8">
                                    <controls:SpectreTextBlock
                                        Text="{x:Static localization:UI.Title_Number_in_sequence}"
                                        VerticalAlignment="Center" />
                                    <NumericUpDown Width="120"
                                                   Increment="1"
                                                   Value="{Binding MediaSequenceValue, Mode=TwoWay}"
                                                   Minimum="0" />
                                    <Button Command="{Binding MediaSequenceCommand, Mode=OneWay}"
                                            IsVisible="{Binding MediaSequenceVisible, Mode=OneWay}">
                                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                    </Button>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal"
                                            Spacing="8">
                                    <controls:SpectreTextBlock
                                        Text="{x:Static localization:UI.Title_Last_media_of_the_sequence}"
                                        VerticalAlignment="Center" />
                                    <NumericUpDown Width="120"
                                                   Increment="1"
                                                   Value="{Binding LastMediaSequenceValue, Mode=TwoWay                                               }"
                                                   Minimum="0" />
                                    <Button Command="{Binding LastMediaSequenceCommand, Mode=OneWay}"
                                            IsVisible="{Binding LastMediaSequenceVisible, Mode=OneWay}">
                                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                    </Button>
                                </StackPanel>
                            </StackPanel>
                        </TabItem>
                        <TabItem>
                            <TabItem.Header>
                                <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Drive}" />
                            </TabItem.Header>
                            <StackPanel Orientation="Vertical"
                                        Spacing="8"
                                        Margin="8"
                                        MinHeight="330">
                                <Grid ColumnDefinitions="Auto,*,Auto"
                                      ColumnSpacing="8">
                                    <controls:SpectreTextBlock Grid.Column="0"
                                                               Text="{x:Static localization:UI.Title_Manufacturer}"
                                                               VerticalAlignment="Center" />
                                    <TextBox Grid.Column="1"
                                             Text="{Binding DriveManufacturerText, Mode=OneWay}" />
                                    <Button Grid.Column="2"
                                            Command="{Binding DriveManufacturerCommand, Mode=OneWay}"
                                            IsVisible="{Binding DriveManufacturerVisible, Mode=OneWay}">
                                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                    </Button>
                                </Grid>
                                <Grid ColumnDefinitions="Auto,*,Auto"
                                      ColumnSpacing="8">
                                    <controls:SpectreTextBlock Grid.Column="0"
                                                               Text="{x:Static localization:UI.Title_Model}"
                                                               VerticalAlignment="Center" />
                                    <TextBox Grid.Column="1"
                                             Text="{Binding DriveModelText, Mode=OneWay}" />
                                    <Button Grid.Column="2"
                                            Command="{Binding DriveModelCommand, Mode=OneWay}"
                                            IsVisible="{Binding DriveModelVisible, Mode=OneWay}">
                                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                    </Button>
                                </Grid>
                                <Grid ColumnDefinitions="Auto,*,Auto"
                                      ColumnSpacing="8">
                                    <controls:SpectreTextBlock Grid.Column="0"
                                                               Text="{x:Static localization:UI.Title_Serial_number}"
                                                               VerticalAlignment="Center" />
                                    <TextBox Grid.Column="1"
                                             Text="{Binding DriveSerialNumberText, Mode=OneWay}" />
                                    <Button Grid.Column="2"
                                            Command="{Binding DriveSerialNumberCommand, Mode=OneWay}"
                                            IsVisible="{Binding DriveSerialNumberVisible, Mode=OneWay}">
                                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                    </Button>
                                </Grid>
                                <Grid ColumnDefinitions="Auto,*,Auto"
                                      ColumnSpacing="8">
                                    <controls:SpectreTextBlock Grid.Column="0"
                                                               Text="{x:Static localization:UI.Title_Firmware_revision}"
                                                               VerticalAlignment="Center" />
                                    <TextBox Grid.Column="1"
                                             Text="{Binding DriveFirmwareRevisionText, Mode=OneWay}" />
                                    <Button Grid.Column="2"
                                            Command="{Binding DriveFirmwareRevisionCommand, Mode=OneWay}"
                                            IsVisible="{Binding DriveFirmwareRevisionVisible, Mode=OneWay}">
                                        <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                    </Button>
                                </Grid>
                            </StackPanel>
                        </TabItem>
                        <TabItem>
                            <TabItem.Header>
                                <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Comments}" />
                            </TabItem.Header>
                            <StackPanel Orientation="Vertical"
                                        Spacing="8"
                                        Margin="8"
                                        MinHeight="330">
                                <TextBox Text="{Binding CommentsText, Mode=OneWay}"
                                         MinHeight="300" />
                                <Button Command="{Binding CommentsCommand, Mode=OneWay}"
                                        IsVisible="{Binding CommentsVisible, Mode=OneWay}">
                                    <TextBlock Text="{x:Static localization:UI.ButtonLabel_Get_from_source_image}" />
                                </Button>
                            </StackPanel>
                        </TabItem>
                    </TabControl>
                    <TextBlock Grid.Row="2"
                               FontWeight="Bold"
                               Text="{x:Static localization:UI.Title_Existing_Aaru_Metadata_sidecar}" />
                    <Grid Grid.Row="3"
                          ColumnDefinitions="*,Auto,Auto"
                          ColumnSpacing="8">
                        <TextBox Grid.Column="0"
                                 Text="{Binding MetadataJsonText, Mode=OneWay}"
                                 IsReadOnly="True" />
                        <Button Grid.Column="1"
                                Command="{Binding AaruMetadataFromImageCommand, Mode=OneWay}"
                                IsVisible="{Binding AaruMetadataFromImageVisible, Mode=OneWay}">
                            <TextBlock Text="{x:Static localization:UI.Title_From_image}" />
                        </Button>
                        <Button Grid.Column="2"
                                Command="{Binding AaruMetadataCommand, Mode=OneWay}">
                            <TextBlock Text="{x:Static localization:UI.ButtonLabel_Choose}" />
                        </Button>
                    </Grid>
                    <TextBlock Grid.Row="4"
                               FontWeight="Bold"
                               Text="{x:Static localization:UI.Title_Existing_resume_file}" />
                    <Grid Grid.Row="5"
                          ColumnDefinitions="*,Auto,Auto"
                          ColumnSpacing="8">
                        <TextBox Grid.Column="0"
                                 Text="{Binding ResumeFileText, Mode=OneWay}"
                                 IsReadOnly="True" />
                        <Button Grid.Column="1"
                                Command="{Binding ResumeFileFromImageCommand, Mode=OneWay}"
                                IsVisible="{Binding ResumeFileFromImageVisible, Mode=OneWay}">
                            <TextBlock Text="{x:Static localization:UI.Title_From_image}" />
                        </Button>
                        <Button Grid.Column="2"
                                Command="{Binding ResumeFileCommand, Mode=OneWay}">
                            <TextBlock Text="{x:Static localization:UI.ButtonLabel_Choose}" />
                        </Button>
                    </Grid>
                </Grid>
            </Grid>
        </ScrollViewer>
        <Grid Grid.Row="4"
              RowDefinitions="Auto,Auto"
              RowSpacing="8"
              IsVisible="{Binding ProgressVisible, Mode=OneWay}">
            <Grid Grid.Row="0"
                  RowDefinitions="Auto,Auto"
                  RowSpacing="8"
                  IsVisible="{Binding Progress1Visible, Mode=OneWay}">
                <controls:SpectreTextBlock Grid.Row="0"
                                           Text="{Binding ProgressText, Mode=OneWay}" />
                <ProgressBar Grid.Row="1"
                             Maximum="{Binding ProgressMaxValue, Mode=OneWay}"
                             Value="{Binding ProgressValue, Mode=OneWay}" />
            </Grid>
            <Grid Grid.Row="1"
                  RowDefinitions="Auto,Auto"
                  RowSpacing="8"
                  IsVisible="{Binding Progress2Visible, Mode=OneWay}">
                <controls:SpectreTextBlock Grid.Row="0"
                                           Text="{Binding Progress2Text, Mode=OneWay}" />
                <ProgressBar Grid.Row="1"
                             Maximum="{Binding Progress2MaxValue, Mode=OneWay}"
                             Value="{Binding Progress2Value, Mode=OneWay}" />
            </Grid>
        </Grid>
        <StackPanel Grid.Row="5"
                    Spacing="8"
                    Orientation="Horizontal"
                    VerticalAlignment="Bottom"
                    HorizontalAlignment="Right">
            <Button Command="{Binding StartCommand, Mode=OneWay}"
                    IsVisible="{Binding StartVisible, Mode=OneWay}">
                <TextBlock Text="{x:Static localization:UI.ButtonLabel_Start}" />
            </Button>
            <Button Command="{Binding CloseCommand, Mode=OneWay}"
                    IsVisible="{Binding CloseVisible, Mode=OneWay}">
                <TextBlock Text="{x:Static localization:UI.ButtonLabel_Close}" />
            </Button>
            <Button Command="{Binding StopCommand, Mode=OneWay}"
                    IsVisible="{Binding StopVisible, Mode=OneWay}"
                    IsEnabled="{Binding StopEnabled, Mode=OneWay}">
                <TextBlock Text="{x:Static localization:UI.ButtonLabel_Stop}" />
            </Button>
        </StackPanel>
    </Grid>
</Window>