mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[GUI] Add Device List functionality and remote connection support
This commit is contained in:
@@ -39,13 +39,13 @@ using Sentry;
|
||||
namespace Aaru.Devices.Linux;
|
||||
|
||||
[SupportedOSPlatform("linux")]
|
||||
static class ListDevices
|
||||
public static class ListDevices
|
||||
{
|
||||
const string PATH_SYS_DEVBLOCK = "/sys/block/";
|
||||
|
||||
/// <summary>Gets a list of all known storage devices on Linux</summary>
|
||||
/// <returns>List of devices</returns>
|
||||
internal static DeviceInfo[] GetList()
|
||||
public static DeviceInfo[] GetList()
|
||||
{
|
||||
string[] sysdevs = Directory.GetFileSystemEntries(PATH_SYS_DEVBLOCK, "*", SearchOption.TopDirectoryOnly);
|
||||
|
||||
@@ -66,7 +66,7 @@ static class ListDevices
|
||||
hasUdev = false;
|
||||
}
|
||||
|
||||
for(int i = 0; i < sysdevs.Length; i++)
|
||||
for(var i = 0; i < sysdevs.Length; i++)
|
||||
{
|
||||
devices[i] = new DeviceInfo
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ using Marshal = System.Runtime.InteropServices.Marshal;
|
||||
namespace Aaru.Devices.Windows;
|
||||
|
||||
[SupportedOSPlatform("windows")]
|
||||
static class ListDevices
|
||||
public static class ListDevices
|
||||
{
|
||||
/// <summary>Converts a hex dump string to the ASCII string it represents</summary>
|
||||
/// <param name="hex">Hex dump</param>
|
||||
@@ -63,7 +63,7 @@ static class ListDevices
|
||||
/// <summary>Gets a list of all known storage devices on Windows</summary>
|
||||
/// <returns>List of devices</returns>
|
||||
[SuppressMessage("ReSharper", "RedundantCatchClause")]
|
||||
internal static DeviceInfo[] GetList()
|
||||
public static DeviceInfo[] GetList()
|
||||
{
|
||||
var deviceIDs = new List<string>();
|
||||
|
||||
|
||||
@@ -315,7 +315,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Assets"/>
|
||||
<Folder Include="Models\"/>
|
||||
<Compile Update="**\*.xaml.cs">
|
||||
<DependentUpon>%(Filename)</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
52
Aaru.Gui/Models/DeviceModel.cs
Normal file
52
Aaru.Gui/Models/DeviceModel.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
// /***************************************************************************
|
||||
// Aaru Data Preservation Suite
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : DeviceModel.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : GUI data models.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// Contains information about a device.
|
||||
//
|
||||
// --[ 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-2025 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Gui.Models;
|
||||
|
||||
public class DeviceModel
|
||||
{
|
||||
/// <summary>Device path</summary>
|
||||
public string Path { get; set; }
|
||||
/// <summary>Device vendor or manufacturer</summary>
|
||||
public string Vendor { get; set; }
|
||||
/// <summary>Device model or product name</summary>
|
||||
public string Model { get; set; }
|
||||
/// <summary>Device serial number</summary>
|
||||
public string Serial { get; set; }
|
||||
/// <summary>Bus the device is attached to</summary>
|
||||
public string Bus { get; set; }
|
||||
/// <summary>
|
||||
/// Set to <c>true</c> if Aaru can send commands to the device in the current machine or remote, <c>false</c>
|
||||
/// otherwise
|
||||
/// </summary>
|
||||
public bool Supported { get; set; }
|
||||
}
|
||||
216
Aaru.Gui/ViewModels/Windows/DeviceListViewModel.cs
Normal file
216
Aaru.Gui/ViewModels/Windows/DeviceListViewModel.cs
Normal file
@@ -0,0 +1,216 @@
|
||||
// /***************************************************************************
|
||||
// Aaru Data Preservation Suite
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : DeviceListViewModel.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : GUI view models.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// View model for device list.
|
||||
//
|
||||
// --[ 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-2025 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
using Aaru.Devices;
|
||||
using Aaru.Devices.Remote;
|
||||
using Aaru.Devices.Windows;
|
||||
using Aaru.Gui.Models;
|
||||
using Aaru.Gui.Views.Windows;
|
||||
using Aaru.Localization;
|
||||
using Aaru.Logging;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using JetBrains.Annotations;
|
||||
using MsBox.Avalonia;
|
||||
using MsBox.Avalonia.Base;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using Sentry;
|
||||
using Spectre.Console;
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Windows;
|
||||
|
||||
public partial class DeviceListViewModel : ViewModelBase
|
||||
{
|
||||
readonly DeviceList _window;
|
||||
[ObservableProperty]
|
||||
ObservableCollection<DeviceModel> _devices;
|
||||
[ObservableProperty]
|
||||
string _remotePath;
|
||||
|
||||
public DeviceListViewModel(DeviceList window) => _window = window;
|
||||
|
||||
public DeviceListViewModel(DeviceList window, [NotNull] string remotePath)
|
||||
{
|
||||
_window = window;
|
||||
RemotePath = remotePath;
|
||||
}
|
||||
|
||||
public void LoadData()
|
||||
{
|
||||
#pragma warning disable MVVMTK0034
|
||||
if(_remotePath != null)
|
||||
#pragma warning restore MVVMTK0034
|
||||
{
|
||||
LoadRemote();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
DeviceInfo[] devices = null;
|
||||
|
||||
if(OperatingSystem.IsWindows()) devices = ListDevices.GetList();
|
||||
|
||||
if(OperatingSystem.IsLinux()) devices = ListDevices.GetList();
|
||||
|
||||
if((OperatingSystem.IsWindows() || OperatingSystem.IsLinux()) && devices != null)
|
||||
{
|
||||
Devices = [];
|
||||
|
||||
foreach(DeviceInfo device in devices)
|
||||
{
|
||||
Devices.Add(new DeviceModel
|
||||
{
|
||||
Bus = device.Bus,
|
||||
Model = device.Model,
|
||||
Path = device.Path,
|
||||
Serial = device.Serial,
|
||||
Supported = device.Supported,
|
||||
Vendor = device.Vendor
|
||||
});
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
AaruLogging.Error(UI.Devices_are_not_supported_on_this_platform);
|
||||
|
||||
IMsBox<ButtonResult> msbox = MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
|
||||
UI
|
||||
.Devices_are_not_supported_on_this_platform,
|
||||
ButtonEnum.Ok,
|
||||
Icon.Error);
|
||||
|
||||
_ = msbox.ShowWindowDialogAsync(_window);
|
||||
}
|
||||
|
||||
public void LoadRemote()
|
||||
{
|
||||
try
|
||||
{
|
||||
var aaruUri = new Uri(RemotePath);
|
||||
|
||||
if(aaruUri.Scheme != "aaru" && aaruUri.Scheme != "dic")
|
||||
{
|
||||
AaruLogging.Error(UI.Invalid_remote_protocol);
|
||||
|
||||
IMsBox<ButtonResult> msbox = MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
|
||||
UI.Invalid_remote_protocol,
|
||||
ButtonEnum.Ok,
|
||||
Icon.Error);
|
||||
|
||||
_ = msbox.ShowWindowDialogAsync(_window);
|
||||
}
|
||||
|
||||
using var remote = new Remote(aaruUri);
|
||||
|
||||
DeviceInfo[] devices = remote.ListDevices();
|
||||
|
||||
Devices = [];
|
||||
|
||||
foreach(DeviceInfo device in devices)
|
||||
{
|
||||
Devices.Add(new DeviceModel
|
||||
{
|
||||
Bus = device.Bus,
|
||||
Model = device.Model,
|
||||
Path = device.Path,
|
||||
Serial = device.Serial,
|
||||
Supported = device.Supported,
|
||||
Vendor = device.Vendor
|
||||
});
|
||||
}
|
||||
}
|
||||
catch(SocketException ex)
|
||||
{
|
||||
if(ex.SocketErrorCode == SocketError.HostNotFound)
|
||||
{
|
||||
IMsBox<ButtonResult> msbox = MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
|
||||
UI.Host_not_found,
|
||||
ButtonEnum.Ok,
|
||||
Icon.Error);
|
||||
|
||||
_ = msbox.ShowWindowDialogAsync(_window);
|
||||
}
|
||||
else
|
||||
{
|
||||
SentrySdk.CaptureException(ex);
|
||||
|
||||
AaruLogging.Exception(ex, UI.Error_connecting_to_host);
|
||||
AaruLogging.Error(UI.Error_connecting_to_host);
|
||||
|
||||
IMsBox<ButtonResult> msbox = MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
|
||||
Markup.Remove(UI.Error_connecting_to_host),
|
||||
ButtonEnum.Ok,
|
||||
Icon.Error);
|
||||
|
||||
_ = msbox.ShowWindowDialogAsync(_window);
|
||||
}
|
||||
}
|
||||
|
||||
// ReSharper disable once UncatchableException
|
||||
catch(ArgumentException)
|
||||
{
|
||||
IMsBox<ButtonResult> msbox = MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
|
||||
UI.Server_sent_invalid_data,
|
||||
ButtonEnum.Ok,
|
||||
Icon.Error);
|
||||
|
||||
_ = msbox.ShowWindowDialogAsync(_window);
|
||||
}
|
||||
catch(IOException)
|
||||
{
|
||||
IMsBox<ButtonResult> msbox = MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
|
||||
UI.Unknown_network_error,
|
||||
ButtonEnum.Ok,
|
||||
Icon.Error);
|
||||
|
||||
_ = msbox.ShowWindowDialogAsync(_window);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
SentrySdk.CaptureException(ex);
|
||||
|
||||
AaruLogging.Exception(ex, UI.Error_connecting_to_host);
|
||||
AaruLogging.Error(UI.Error_connecting_to_host);
|
||||
|
||||
IMsBox<ButtonResult> msbox = MessageBoxManager.GetMessageBoxStandard(UI.Title_Error,
|
||||
Markup.Remove(UI.Error_connecting_to_host),
|
||||
ButtonEnum.Ok,
|
||||
Icon.Error);
|
||||
|
||||
_ = msbox.ShowWindowDialogAsync(_window);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,9 @@ using CommunityToolkit.Mvvm.Input;
|
||||
using JetBrains.Annotations;
|
||||
using MsBox.Avalonia;
|
||||
using MsBox.Avalonia.Base;
|
||||
using MsBox.Avalonia.Dto;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using MsBox.Avalonia.Models;
|
||||
using Spectre.Console;
|
||||
using Console = Aaru.Gui.Views.Dialogs.Console;
|
||||
using FileSystem = Aaru.CommonTypes.AaruMetadata.FileSystem;
|
||||
@@ -115,6 +117,8 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
DecodeImageMediaTagsCommand = new RelayCommand(DecodeImageMediaTags);
|
||||
OpenMhddLogCommand = new AsyncRelayCommand(OpenMhddLogAsync);
|
||||
OpenIbgLogCommand = new AsyncRelayCommand(OpenIbgLogAsync);
|
||||
ConnectToRemoteCommand = new AsyncRelayCommand(ConnectToRemoteAsync);
|
||||
OpenDeviceCommand = new RelayCommand(OpenDevice);
|
||||
|
||||
_genericHddIcon =
|
||||
new Bitmap(AssetLoader.Open(new Uri("avares://Aaru.Gui/Assets/Icons/oxygen/32x32/drive-harddisk.png")));
|
||||
@@ -133,7 +137,6 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
case PlatformID.Win32NT:
|
||||
case PlatformID.Linux:
|
||||
case PlatformID.FreeBSD:
|
||||
DevicesSupported = true;
|
||||
|
||||
break;
|
||||
@@ -168,6 +171,8 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
public ICommand DecodeImageMediaTagsCommand { get; }
|
||||
public ICommand OpenMhddLogCommand { get; }
|
||||
public ICommand OpenIbgLogCommand { get; }
|
||||
public ICommand ConnectToRemoteCommand { get; }
|
||||
public ICommand OpenDeviceCommand { get; }
|
||||
|
||||
public bool NativeMenuSupported
|
||||
{
|
||||
@@ -225,6 +230,56 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
void OpenDevice()
|
||||
{
|
||||
var deviceListWindow = new DeviceList();
|
||||
|
||||
deviceListWindow.DataContext = new DeviceListViewModel(deviceListWindow);
|
||||
|
||||
deviceListWindow.Show();
|
||||
}
|
||||
|
||||
async Task ConnectToRemoteAsync()
|
||||
{
|
||||
IMsBox<string> msbox = MessageBoxManager.GetMessageBoxCustom(new MessageBoxCustomParams
|
||||
{
|
||||
ContentTitle = UI.Connect_to_AaruRemote,
|
||||
ButtonDefinitions =
|
||||
[
|
||||
new ButtonDefinition
|
||||
{
|
||||
Name = UI.ButtonLabel_Connect,
|
||||
IsDefault = true
|
||||
},
|
||||
new ButtonDefinition
|
||||
{
|
||||
Name = UI.ButtonLabel_Cancel,
|
||||
IsCancel = true
|
||||
}
|
||||
],
|
||||
CanResize = false,
|
||||
CloseOnClickAway = false,
|
||||
InputParams = new InputParams
|
||||
{
|
||||
Label = UI.Address_IP_or_hostname,
|
||||
DefaultValue = "",
|
||||
Multiline = false
|
||||
},
|
||||
ContentMessage = UI.Introduce_AaruRemote_server_address,
|
||||
MinWidth = 400
|
||||
});
|
||||
|
||||
string result = await msbox.ShowWindowDialogAsync(_view);
|
||||
|
||||
if(result != UI.ButtonLabel_Connect) return;
|
||||
|
||||
var deviceListWindow = new DeviceList();
|
||||
|
||||
deviceListWindow.DataContext = new DeviceListViewModel(deviceListWindow, msbox.InputValue);
|
||||
|
||||
deviceListWindow.Show();
|
||||
}
|
||||
|
||||
async Task OpenMhddLogAsync()
|
||||
{
|
||||
IReadOnlyList<IStorageFile> result = await _view.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||
@@ -619,7 +674,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
await dialog.ShowDialog(_view);
|
||||
}
|
||||
|
||||
Task SettingsAsync()
|
||||
internal Task SettingsAsync()
|
||||
{
|
||||
var dialog = new SettingsDialog();
|
||||
dialog.DataContext = new SettingsViewModel(dialog, false);
|
||||
@@ -627,7 +682,8 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||
return dialog.ShowDialog(_view);
|
||||
}
|
||||
|
||||
void Exit() => (Application.Current?.ApplicationLifetime as ClassicDesktopStyleApplicationLifetime)?.Shutdown();
|
||||
internal void Exit() =>
|
||||
(Application.Current?.ApplicationLifetime as ClassicDesktopStyleApplicationLifetime)?.Shutdown();
|
||||
|
||||
void Console()
|
||||
{
|
||||
|
||||
113
Aaru.Gui/Views/Windows/DeviceList.axaml
Normal file
113
Aaru.Gui/Views/Windows/DeviceList.axaml
Normal file
@@ -0,0 +1,113 @@
|
||||
<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:controls="clr-namespace:Aaru.Gui.Controls"
|
||||
xmlns:localization="clr-namespace:Aaru.Localization;assembly=Aaru.Localization"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="800"
|
||||
d:DesignHeight="450"
|
||||
x:Class="Aaru.Gui.Views.Windows.DeviceList"
|
||||
x:DataType="windows:DeviceListViewModel"
|
||||
Title="{x:Static localization:UI.Title_Device_list}">
|
||||
<Design.DataContext>
|
||||
<windows:DeviceListViewModel />
|
||||
</Design.DataContext>
|
||||
<Grid RowDefinitions="Auto,*"
|
||||
RowSpacing="8"
|
||||
Margin="12">
|
||||
<Grid Grid.Row="0"
|
||||
ColumnDefinitions="Auto, *"
|
||||
ColumnSpacing="8"
|
||||
IsVisible="{Binding RemotePath, Converter={x:Static StringConverters.IsNotNullOrEmpty}, Mode=OneWay}">
|
||||
<controls:SpectreTextBlock Grid.Column="0"
|
||||
Text="{x:Static localization:UI.Title_AaruRemote_server}" />
|
||||
<TextBlock Grid.Column="1"
|
||||
Foreground="Green"
|
||||
Text="{Binding RemotePath, Mode=OneWay}" />
|
||||
</Grid>
|
||||
<DataGrid Grid.Row="1"
|
||||
ItemsSource="{Binding Devices, Mode=OneWay}"
|
||||
Margin="8"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
HorizontalScrollBarVisibility="Visible">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Width="Auto">
|
||||
<DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Path}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="Auto">
|
||||
<DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Vendor}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Vendor, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="Auto">
|
||||
<DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Model}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Model, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="Auto">
|
||||
<DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Serial_number}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Serial, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="Auto">
|
||||
<DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Bus}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Bus, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn Width="Auto">
|
||||
<DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<controls:SpectreTextBlock Text="{x:Static localization:UI.Title_Supported}" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.HeaderTemplate>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding Supported, Mode=OneWay}"
|
||||
IsEnabled="False" />
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</Grid>
|
||||
</Window>
|
||||
57
Aaru.Gui/Views/Windows/DeviceList.axaml.cs
Normal file
57
Aaru.Gui/Views/Windows/DeviceList.axaml.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
// /***************************************************************************
|
||||
// Aaru Data Preservation Suite
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
// Filename : DeviceList.axaml.cs
|
||||
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||
//
|
||||
// Component : GUI views.
|
||||
//
|
||||
// --[ Description ] ----------------------------------------------------------
|
||||
//
|
||||
// View for device list.
|
||||
//
|
||||
// --[ 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-2025 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using Aaru.Gui.ViewModels.Windows;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Aaru.Gui.Views.Windows;
|
||||
|
||||
public partial class DeviceList : Window
|
||||
{
|
||||
public DeviceList()
|
||||
{
|
||||
InitializeComponent();
|
||||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnDataContextChanged(EventArgs e)
|
||||
{
|
||||
base.OnDataContextChanged(e);
|
||||
|
||||
if(DataContext is DeviceListViewModel vm) vm?.LoadData();
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,11 @@
|
||||
Command="{Binding OpenMhddLogCommand, Mode=OneWay}" />
|
||||
<MenuItem Header="{x:Static localization:UI.Menu_Open_IMGBurn_log}"
|
||||
Command="{Binding OpenIbgLogCommand, Mode=OneWay}" />
|
||||
<MenuItem Header="{x:Static localization:UI.Menu_Connect_to_AaruRemote}"
|
||||
Command="{Binding ConnectToRemoteCommand, Mode=OneWay}" />
|
||||
<MenuItem Header="Open device..."
|
||||
Command="{Binding OpenDeviceCommand, Mode=OneWay}"
|
||||
IsVisible="{Binding DevicesSupported, Mode=OneWay}" />
|
||||
<Separator />
|
||||
<MenuItem Header="{x:Static localization:UI.Menu_Settings}"
|
||||
IsVisible="{Binding !NativeMenuSupported, Mode=OneWay}"
|
||||
@@ -32,10 +37,6 @@
|
||||
IsVisible="{Binding !NativeMenuSupported, Mode=OneWay}"
|
||||
Command="{Binding ExitCommand, Mode=OneWay}" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="{x:Static localization:UI.Menu_Devices}"
|
||||
IsVisible="{Binding DevicesSupported, Mode=OneWay}">
|
||||
<MenuItem Header="TODO" />
|
||||
</MenuItem>
|
||||
<MenuItem Header="Image"
|
||||
IsEnabled="{Binding ImageLoaded, Mode=OneWay}">
|
||||
<MenuItem Command="{Binding CalculateEntropyCommand, Mode=OneWay}"
|
||||
|
||||
96
Aaru.Localization/UI.Designer.cs
generated
96
Aaru.Localization/UI.Designer.cs
generated
@@ -5530,12 +5530,6 @@ namespace Aaru.Localization {
|
||||
}
|
||||
}
|
||||
|
||||
public static string Menu_Devices {
|
||||
get {
|
||||
return ResourceManager.GetString("Menu_Devices", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Menu_Refresh {
|
||||
get {
|
||||
return ResourceManager.GetString("Menu_Refresh", resourceCulture);
|
||||
@@ -6441,5 +6435,95 @@ namespace Aaru.Localization {
|
||||
return ResourceManager.GetString("Menu_Open_IMGBurn_log", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Connect_to_AaruRemote {
|
||||
get {
|
||||
return ResourceManager.GetString("Connect_to_AaruRemote", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string ButtonLabel_Connect {
|
||||
get {
|
||||
return ResourceManager.GetString("ButtonLabel_Connect", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Address_IP_or_hostname {
|
||||
get {
|
||||
return ResourceManager.GetString("Address_IP_or_hostname", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Introduce_AaruRemote_server_address {
|
||||
get {
|
||||
return ResourceManager.GetString("Introduce_AaruRemote_server_address", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Menu_Connect_to_AaruRemote {
|
||||
get {
|
||||
return ResourceManager.GetString("Menu_Connect_to_AaruRemote", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Menu_Open_device {
|
||||
get {
|
||||
return ResourceManager.GetString("Menu_Open_device", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Title_Device_list {
|
||||
get {
|
||||
return ResourceManager.GetString("Title_Device_list", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Title_AaruRemote_server {
|
||||
get {
|
||||
return ResourceManager.GetString("Title_AaruRemote_server", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Title_Path {
|
||||
get {
|
||||
return ResourceManager.GetString("Title_Path", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Title_Supported {
|
||||
get {
|
||||
return ResourceManager.GetString("Title_Supported", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Devices_are_not_supported_on_this_platform {
|
||||
get {
|
||||
return ResourceManager.GetString("Devices_are_not_supported_on_this_platform", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Invalid_remote_protocol {
|
||||
get {
|
||||
return ResourceManager.GetString("Invalid_remote_protocol", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Host_not_found {
|
||||
get {
|
||||
return ResourceManager.GetString("Host_not_found", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Server_sent_invalid_data {
|
||||
get {
|
||||
return ResourceManager.GetString("Server_sent_invalid_data", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
public static string Unknown_network_error {
|
||||
get {
|
||||
return ResourceManager.GetString("Unknown_network_error", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1582,9 +1582,6 @@
|
||||
</data>
|
||||
<data name="Menu_Console" xml:space="preserve">
|
||||
<value>_Consola</value>
|
||||
</data>
|
||||
<data name="Menu_Devices" xml:space="preserve">
|
||||
<value>_Dispositivos</value>
|
||||
</data>
|
||||
<data name="Menu_Encodings" xml:space="preserve">
|
||||
<value>_Codificaciones</value>
|
||||
@@ -3221,4 +3218,49 @@ Probadores:
|
||||
<data name="Menu_Open_IMGBurn_log" xml:space="preserve">
|
||||
<value>Abrir registro _IMGBurn</value>
|
||||
</data>
|
||||
<data name="Connect_to_AaruRemote" xml:space="preserve">
|
||||
<value>Conectar a AaruRemote</value>
|
||||
</data>
|
||||
<data name="ButtonLabel_Connect" xml:space="preserve">
|
||||
<value>Conectar</value>
|
||||
</data>
|
||||
<data name="Address_IP_or_hostname" xml:space="preserve">
|
||||
<value>Dirección (IP o servidor):</value>
|
||||
</data>
|
||||
<data name="Introduce_AaruRemote_server_address" xml:space="preserve">
|
||||
<value>Introduzca la dirección del servidor AaruRemote.</value>
|
||||
</data>
|
||||
<data name="Menu_Connect_to_AaruRemote" xml:space="preserve">
|
||||
<value>Conectar a Aaru_Remote</value>
|
||||
</data>
|
||||
<data name="Menu_Open_device" xml:space="preserve">
|
||||
<value>Abrir _dispositivo...</value>
|
||||
</data>
|
||||
<data name="Title_Device_list" xml:space="preserve">
|
||||
<value>Lista de dispositivos</value>
|
||||
</data>
|
||||
<data name="Title_AaruRemote_server" xml:space="preserve">
|
||||
<value>[bold][slateblue1]Servidor AaruRemote[/][/]</value>
|
||||
</data>
|
||||
<data name="Title_Path" xml:space="preserve">
|
||||
<value>[bold][slateblue1]Ruta[/][/]</value>
|
||||
</data>
|
||||
<data name="Title_Supported" xml:space="preserve">
|
||||
<value>[bold][slateblue1]Soportado[/][/]</value>
|
||||
</data>
|
||||
<data name="Devices_are_not_supported_on_this_platform" xml:space="preserve">
|
||||
<value>Los dispositivos no están soportados en esta plataforma.</value>
|
||||
</data>
|
||||
<data name="Invalid_remote_protocol" xml:space="preserve">
|
||||
<value>Protocolo remoto inválido.</value>
|
||||
</data>
|
||||
<data name="Host_not_found" xml:space="preserve">
|
||||
<value>Servidor no encontrado.</value>
|
||||
</data>
|
||||
<data name="Server_sent_invalid_data" xml:space="preserve">
|
||||
<value>El servidor envió datos inválidos.</value>
|
||||
</data>
|
||||
<data name="Unknown_network_error" xml:space="preserve">
|
||||
<value>Error de red desconocido.</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -2828,10 +2828,6 @@ Do you want to continue?</value>
|
||||
<data name="Menu_Exit" xml:space="preserve">
|
||||
<value>E_xit</value>
|
||||
<comment>'_' is the character that will be used for the keyboard accelerator</comment>
|
||||
</data>
|
||||
<data name="Menu_Devices" xml:space="preserve">
|
||||
<value>_Devices</value>
|
||||
<comment>'_' is the character that will be used for the keyboard accelerator</comment>
|
||||
</data>
|
||||
<data name="Menu_Refresh" xml:space="preserve">
|
||||
<value>_Refresh</value>
|
||||
@@ -3297,4 +3293,49 @@ Do you want to continue?</value>
|
||||
<data name="Menu_Open_IMGBurn_log" xml:space="preserve">
|
||||
<value>Open _IMGBurn log</value>
|
||||
</data>
|
||||
<data name="Connect_to_AaruRemote" xml:space="preserve">
|
||||
<value>Connect to AaruRemote</value>
|
||||
</data>
|
||||
<data name="ButtonLabel_Connect" xml:space="preserve">
|
||||
<value>Connect</value>
|
||||
</data>
|
||||
<data name="Address_IP_or_hostname" xml:space="preserve">
|
||||
<value>Address (IP or hostname):</value>
|
||||
</data>
|
||||
<data name="Introduce_AaruRemote_server_address" xml:space="preserve">
|
||||
<value>Introduce AaruRemote server address.</value>
|
||||
</data>
|
||||
<data name="Menu_Connect_to_AaruRemote" xml:space="preserve">
|
||||
<value>Connect to AaruRemote</value>
|
||||
</data>
|
||||
<data name="Menu_Open_device" xml:space="preserve">
|
||||
<value>Open _device...</value>
|
||||
</data>
|
||||
<data name="Title_Device_list" xml:space="preserve">
|
||||
<value>Device list</value>
|
||||
</data>
|
||||
<data name="Title_AaruRemote_server" xml:space="preserve">
|
||||
<value>[bold][slateblue1]AaruRemote server[/][/]</value>
|
||||
</data>
|
||||
<data name="Title_Path" xml:space="preserve">
|
||||
<value>[bold][slateblue1]Path[/][/]</value>
|
||||
</data>
|
||||
<data name="Title_Supported" xml:space="preserve">
|
||||
<value>[bold][slateblue1]Supported[/][/]</value>
|
||||
</data>
|
||||
<data name="Devices_are_not_supported_on_this_platform" xml:space="preserve">
|
||||
<value>Devices are not supported on this platform.</value>
|
||||
</data>
|
||||
<data name="Invalid_remote_protocol" xml:space="preserve">
|
||||
<value>Invalid remote protocol.</value>
|
||||
</data>
|
||||
<data name="Host_not_found" xml:space="preserve">
|
||||
<value>Host not found.</value>
|
||||
</data>
|
||||
<data name="Server_sent_invalid_data" xml:space="preserve">
|
||||
<value>Server sent invalid data.</value>
|
||||
</data>
|
||||
<data name="Unknown_network_error" xml:space="preserve">
|
||||
<value>Unknown network error.</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user