<!--
// /***************************************************************************
// Aaru Data Preservation Suite
// ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
//
// Filename       : ImageChecksum.xaml
// Author(s)      : Natalia Portillo <claunia@claunia.com>
//
// Component      : GUI windows.
//
// ‐‐[ Description ] ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
//
//     Image checksum 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="800"
        Height="600"
        x:Class="Aaru.Gui.Views.Windows.ImageChecksum"
        Icon="/Assets/aaru.png"
        x:DataType="windows:ImageChecksumViewModel"
        Title="{x:Static localization:UI.Title_Checksum_image_contents}">
    <Design.DataContext>
        <windows:ImageChecksumViewModel />
    </Design.DataContext>
    <Window.Styles>
        <Style Selector="DataGridRow:nth-child(2n)">
            <Setter Property="Background">
                <SolidColorBrush Color="#15FFFFFF" />
            </Setter>
        </Style>
        <Style Selector="DataGridRow:nth-child(2n):pointerover">
            <Setter Property="Background"
                    Value="{DynamicResource SystemControlHighlightListLowBrush}" />
        </Style>
        <Style Selector="DataGridRow:nth-child(2n):selected">
            <Setter Property="Background"
                    Value="{DynamicResource SystemControlHighlightAccentBrush}" />
        </Style>
    </Window.Styles>
    <Grid RowDefinitions="Auto,*,Auto,Auto"
          RowSpacing="8"
          Margin="12">
        <ScrollViewer Grid.Row="0"
                      HorizontalScrollBarVisibility="Disabled"
                      VerticalScrollBarVisibility="Auto"
                      IsVisible="{Binding OptionsVisible, Mode=OneWay}">
            <StackPanel Orientation="Vertical"
                        Spacing="8">
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsVisible="{Binding ChecksumTracksVisible, Mode=OneWay}"
                          IsChecked="{Binding ChecksumMediaChecked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Checksums_the_whole_disc}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsVisible="{Binding ChecksumTracksVisible, Mode=OneWay}"
                          IsChecked="{Binding ChecksumTracksChecked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Checksums_each_track_separately}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsChecked="{Binding Adler32Checked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Calculates_Adler_32}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsChecked="{Binding Crc16Checked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Calculates_CRC16}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsChecked="{Binding Crc32Checked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Calculates_CRC32}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsChecked="{Binding Crc64Checked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Calculates_CRC64_ECMA}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsChecked="{Binding Fletcher16Checked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Calculates_Fletcher_16}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsChecked="{Binding Fletcher32Checked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Calculates_Fletcher_32}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsChecked="{Binding Md5Checked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Calculates_MD5}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsChecked="{Binding Sha1Checked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Calculates_SHA1}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsChecked="{Binding Sha256Checked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Calculates_SHA256}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsChecked="{Binding Sha384Checked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Calculates_SHA384}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsChecked="{Binding Sha512Checked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Calculates_SHA512}" />
                </CheckBox>
                <CheckBox IsEnabled="{Binding OptionsEnabled, Mode=OneWay}"
                          IsChecked="{Binding SpamsumChecked, Mode=TwoWay}">
                    <TextBlock Text="{x:Static localization:UI.Calculates_SpamSum_fuzzy_hash}" />
                </CheckBox>
            </StackPanel>
        </ScrollViewer>
        <Grid Grid.Row="1"
              RowDefinitions="*,*"
              RowSpacing="8"
              IsVisible="{Binding ResultsVisible, Mode=OneWay}">
            <Grid Grid.Row="0"
                  RowDefinitions="Auto,*"
                  RowSpacing="8"
                  IsVisible="{Binding TrackChecksumsVisible, Mode=OneWay}">
                <controls:SpectreTextBlock Grid.Row="0"
                                           Text="{x:Static localization:UI.Title_Track_checksums}" />
                <DataGrid Grid.Row="1"
                          ItemsSource="{Binding TrackChecksums, Mode=OneWay}">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Width="Auto">
                            <DataGridTemplateColumn.Header>
                                <controls:SpectreTextBlock Text="{x:Static localization:Core.Title_Track}" />
                            </DataGridTemplateColumn.Header>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Track, Mode=OneWay}" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Width="Auto">
                            <DataGridTemplateColumn.Header>
                                <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Algorithms}" />
                            </DataGridTemplateColumn.Header>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Algorithm, Mode=OneWay}" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Width="*">
                            <DataGridTemplateColumn.Header>
                                <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Hash}" />
                            </DataGridTemplateColumn.Header>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Hash, Mode=OneWay}" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </Grid>
            <Grid Grid.Row="1"
                  RowDefinitions="Auto,*"
                  RowSpacing="8"
                  IsVisible="{Binding MediaChecksumsVisible, Mode=OneWay}">
                <controls:SpectreTextBlock Grid.Row="0"
                                           Text="{x:Static localization:UI.Title_Media_checksums}" />
                <DataGrid Grid.Row="1"
                          ItemsSource="{Binding MediaChecksums, Mode=OneWay}">
                    <DataGrid.Columns>
                        <DataGridTemplateColumn Width="Auto">
                            <DataGridTemplateColumn.Header>
                                <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Algorithms}" />
                            </DataGridTemplateColumn.Header>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Algorithm, Mode=OneWay}" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTemplateColumn Width="*">
                            <DataGridTemplateColumn.Header>
                                <controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Hash}" />
                            </DataGridTemplateColumn.Header>
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Hash, Mode=OneWay}" />
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </Grid>
        </Grid>
        <Grid Grid.Row="2"
              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 ProgressMax, 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 Progress2Max, Mode=OneWay}"
                             Value="{Binding Progress2Value, Mode=OneWay}" />
            </Grid>
        </Grid>
        <StackPanel Grid.Row="3"
                    Orientation="Horizontal"
                    Spacing="8"
                    VerticalAlignment="Bottom"
                    HorizontalAlignment="Right">
            <Button Command="{Binding StartCommand, Mode=OneWay}"
                    IsEnabled="{Binding StartCommandEnabled, Mode=OneWay}"
                    IsVisible="{Binding StartCommandVisible, Mode=OneWay}">
                <TextBlock Text="{x:Static localization:UI.ButtonLabel_Start}" />
            </Button>
            <Button Command="{Binding CloseCommand, Mode=OneWay}"
                    IsEnabled="{Binding CloseCommandEnabled, Mode=OneWay}"
                    IsVisible="{Binding CloseCommandVisible, Mode=OneWay}">
                <TextBlock Text="{x:Static localization:UI.ButtonLabel_Close}" />
            </Button>
            <Button Command="{Binding StopCommand, Mode=OneWay}"
                    IsEnabled="{Binding StopCommandEnabled, Mode=OneWay}"
                    IsVisible="{Binding StopCommandVisible, Mode=OneWay}">
                <TextBlock Text="{x:Static localization:UI.ButtonLabel_Stop}" />
            </Button>
        </StackPanel>
    </Grid>
</Window>