<!--
// /***************************************************************************
// RomRepoMgr - ROM repository manager
// ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
//
// Author(s)      : Natalia Portillo <claunia@claunia.com>
//
// ‐‐[ 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 © 2020-2024 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:vm="clr-namespace:RomRepoMgr.ViewModels;assembly=RomRepoMgr"
        xmlns:resources="clr-namespace:RomRepoMgr.Resources"
        mc:Ignorable="d"
        Width="540"
        Height="320"
        x:Class="RomRepoMgr.Views.SettingsDialog"
        Icon="/Assets/avalonia-logo.ico"
        CanResize="False"
        Title="{x:Static resources:Localization.SettingsTitle}">
    <Design.DataContext>
        <vm:SettingsViewModel />
    </Design.DataContext>
    <Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto"
          Margin="16"
          RowSpacing="8">
        <Grid Grid.Row="0"
              ColumnDefinitions="*,250,Auto"
              ColumnSpacing="8">
            <TextBlock Grid.Column="0"
                       HorizontalAlignment="Right"
                       VerticalAlignment="Center"
                       Text="{x:Static resources:Localization.DatabaseFileLabel}"
                       FontWeight="Bold" />
            <TextBox Grid.Column="1"
                     HorizontalAlignment="Stretch"
                     VerticalAlignment="Center"
                     Text="{Binding DatabasePath, Mode=TwoWay}"
                     IsReadOnly="True" />
            <Button Grid.Column="2"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    Command="{Binding DatabaseCommand, Mode=OneWay}">
                <TextBlock Text="{x:Static resources:Localization.ChooseLabel}" />
            </Button>
        </Grid>
        <Grid Grid.Row="1"
              ColumnDefinitions="*,250,Auto"
              ColumnSpacing="8">
            <TextBlock Grid.Column="0"
                       HorizontalAlignment="Right"
                       VerticalAlignment="Center"
                       Text="{x:Static resources:Localization.RepositoryFolderLabel}"
                       FontWeight="Bold" />
            <TextBox Grid.Column="1"
                     HorizontalAlignment="Stretch"
                     VerticalAlignment="Center"
                     Text="{Binding RepositoryPath, Mode=TwoWay}"
                     IsReadOnly="True" />
            <Button Grid.Column="2"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    Command="{Binding RepositoryCommand, Mode=OneWay}">
                <TextBlock Text="{x:Static resources:Localization.ChooseLabel}" />
            </Button>
        </Grid>
        <Grid Grid.Row="2"
              ColumnDefinitions="*,250,Auto"
              ColumnSpacing="8">
            <TextBlock Grid.Column="0"
                       HorizontalAlignment="Right"
                       VerticalAlignment="Center"
                       Text="{x:Static resources:Localization.TemporaryFolderLabel}"
                       FontWeight="Bold" />
            <TextBox Grid.Column="1"
                     HorizontalAlignment="Stretch"
                     VerticalAlignment="Center"
                     Text="{Binding TemporaryPath, Mode=TwoWay}"
                     IsReadOnly="True" />
            <Button Grid.Column="2"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    Command="{Binding TemporaryCommand, Mode=OneWay}">
                <TextBlock Text="{x:Static resources:Localization.ChooseLabel}" />
            </Button>
        </Grid>
        <CheckBox Grid.Row="3"
                  IsChecked="{Binding UseInternalDecompressor, Mode=TwoWay}">
            <CheckBox.Content>
                <TextBlock Text="{x:Static resources:Localization.UseInternalDecompressorLabel}" />
            </CheckBox.Content>
        </CheckBox>
        <Grid Grid.Row="4"
              ColumnDefinitions="*,250,Auto"
              ColumnSpacing="8"
              IsVisible="{Binding !UseInternalDecompressor}">
            <TextBlock Grid.Column="0"
                       HorizontalAlignment="Right"
                       VerticalAlignment="Center"
                       Text="{x:Static resources:Localization.UnArPathLabel}"
                       FontWeight="Bold" />
            <TextBox Grid.Column="1"
                     HorizontalAlignment="Stretch"
                     VerticalAlignment="Center"
                     Text="{Binding UnArPath, Mode=TwoWay}"
                     IsReadOnly="True" />
            <Button Grid.Column="2"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    Command="{Binding UnArCommand, Mode=OneWay}">
                <TextBlock Text="{x:Static resources:Localization.ChooseLabel}" />
            </Button>
        </Grid>
        <TextBlock Grid.Row="5"
                   HorizontalAlignment="Left"
                   VerticalAlignment="Center"
                   Text="{Binding UnArVersion, Mode=OneWay}"
                   FontWeight="Bold"
                   IsVisible="{Binding !UseInternalDecompressor}" />
        <Grid Grid.Row="6"
              ColumnDefinitions="Auto, *"
              ColumnSpacing="8">
            <TextBlock Grid.Column="0"
                       VerticalAlignment="Center"
                       Text="{x:Static resources:Localization.CompressionType}"
                       FontWeight="Bold" />
            <ComboBox Grid.Column="1"
                      HorizontalAlignment="Stretch"
                      VerticalAlignment="Center"
                      SelectedItem="{Binding Compression, Mode=TwoWay}"
                      ItemsSource="{Binding CompressionTypes, Mode=OneWay}" />
        </Grid>
        <StackPanel Grid.Row="7"
                    Spacing="8"
                    Orientation="Horizontal"
                    HorizontalAlignment="Right">
            <Button HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    Command="{Binding SaveCommand, Mode=OneWay}">
                <TextBlock Text="{x:Static resources:Localization.SaveLabel}" />
            </Button>
            <Button HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    Command="{Binding CloseCommand, Mode=OneWay}">
                <TextBlock Text="{x:Static resources:Localization.CloseLabel}" />
            </Button>
        </StackPanel>
    </Grid>
</Window>