mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
General cleanup and refactor.
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
@@ -43,8 +45,6 @@ using Aaru.Gui.Views.Dialogs;
|
||||
using JetBrains.Annotations;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
public sealed class AboutViewModel : ViewModelBase
|
||||
{
|
||||
readonly About _view;
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -43,17 +45,16 @@ using JetBrains.Annotations;
|
||||
using MessageBox.Avalonia;
|
||||
using MessageBox.Avalonia.Enums;
|
||||
using ReactiveUI;
|
||||
using Console = Aaru.Gui.Views.Dialogs.Console;
|
||||
using PlatformID = Aaru.CommonTypes.Interop.PlatformID;
|
||||
using Version = Aaru.CommonTypes.Interop.Version;
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
public sealed class ConsoleViewModel : ViewModelBase
|
||||
{
|
||||
readonly Views.Dialogs.Console _view;
|
||||
bool _debugChecked;
|
||||
readonly Console _view;
|
||||
bool _debugChecked;
|
||||
|
||||
public ConsoleViewModel(Views.Dialogs.Console view)
|
||||
public ConsoleViewModel(Console view)
|
||||
{
|
||||
_view = view;
|
||||
SaveCommand = ReactiveCommand.Create(ExecuteSaveCommand);
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
@@ -41,8 +42,6 @@ using Aaru.Gui.Views.Dialogs;
|
||||
using JetBrains.Annotations;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
public sealed class EncodingsViewModel : ViewModelBase
|
||||
{
|
||||
readonly Encodings _view;
|
||||
@@ -55,7 +54,7 @@ public sealed class EncodingsViewModel : ViewModelBase
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
List<EncodingModel> encodings = Encoding.GetEncodings().Select(info => new EncodingModel
|
||||
var encodings = Encoding.GetEncodings().Select(info => new EncodingModel
|
||||
{
|
||||
Name = info.Name,
|
||||
DisplayName = info.GetEncoding().EncodingName
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
using System.IO;
|
||||
using System.Reactive;
|
||||
using System.Reflection;
|
||||
@@ -37,8 +39,6 @@ using Aaru.Gui.Views.Dialogs;
|
||||
using JetBrains.Annotations;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
public sealed class LicenseViewModel : ViewModelBase
|
||||
{
|
||||
readonly LicenseDialog _view;
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reactive;
|
||||
using System.Reflection;
|
||||
@@ -40,8 +42,6 @@ using Aaru.Gui.Views.Dialogs;
|
||||
using JetBrains.Annotations;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
public sealed class PluginsViewModel : ViewModelBase
|
||||
{
|
||||
readonly PluginsDialog _view;
|
||||
|
||||
@@ -30,14 +30,14 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
using System.Reactive;
|
||||
using Aaru.Gui.Views.Dialogs;
|
||||
using Aaru.Settings;
|
||||
using JetBrains.Annotations;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
public sealed class SettingsViewModel : ViewModelBase
|
||||
{
|
||||
readonly SettingsDialog _view;
|
||||
@@ -61,22 +61,22 @@ public sealed class SettingsViewModel : ViewModelBase
|
||||
{
|
||||
_view = view;
|
||||
GdprVisible = gdprChange;
|
||||
SaveReportsGloballyChecked = Settings.Settings.Current.SaveReportsGlobally;
|
||||
ShareReportsChecked = Settings.Settings.Current.ShareReports;
|
||||
SaveReportsGloballyChecked = Settings.Current.SaveReportsGlobally;
|
||||
ShareReportsChecked = Settings.Current.ShareReports;
|
||||
|
||||
if(Settings.Settings.Current.Stats != null)
|
||||
if(Settings.Current.Stats != null)
|
||||
{
|
||||
SaveStatsChecked = true;
|
||||
ShareStatsChecked = Settings.Settings.Current.Stats.ShareStats;
|
||||
CommandStatsChecked = Settings.Settings.Current.Stats.CommandStats;
|
||||
DeviceStatsChecked = Settings.Settings.Current.Stats.DeviceStats;
|
||||
FilesystemStatsChecked = Settings.Settings.Current.Stats.FilesystemStats;
|
||||
FilterStatsChecked = Settings.Settings.Current.Stats.FilterStats;
|
||||
MediaImageStatsChecked = Settings.Settings.Current.Stats.MediaImageStats;
|
||||
MediaScanStatsChecked = Settings.Settings.Current.Stats.MediaScanStats;
|
||||
PartitionStatsChecked = Settings.Settings.Current.Stats.PartitionStats;
|
||||
MediaStatsChecked = Settings.Settings.Current.Stats.MediaStats;
|
||||
VerifyStatsChecked = Settings.Settings.Current.Stats.VerifyStats;
|
||||
ShareStatsChecked = Settings.Current.Stats.ShareStats;
|
||||
CommandStatsChecked = Settings.Current.Stats.CommandStats;
|
||||
DeviceStatsChecked = Settings.Current.Stats.DeviceStats;
|
||||
FilesystemStatsChecked = Settings.Current.Stats.FilesystemStats;
|
||||
FilterStatsChecked = Settings.Current.Stats.FilterStats;
|
||||
MediaImageStatsChecked = Settings.Current.Stats.MediaImageStats;
|
||||
MediaScanStatsChecked = Settings.Current.Stats.MediaScanStats;
|
||||
PartitionStatsChecked = Settings.Current.Stats.PartitionStats;
|
||||
MediaStatsChecked = Settings.Current.Stats.MediaStats;
|
||||
VerifyStatsChecked = Settings.Current.Stats.VerifyStats;
|
||||
}
|
||||
else
|
||||
SaveStatsChecked = false;
|
||||
@@ -108,8 +108,7 @@ we must give you the following information about Aaru and ask if you want to opt
|
||||
in some information sharing.";
|
||||
|
||||
[NotNull]
|
||||
public string GdprText2 =>
|
||||
@"Disclaimer: Because Aaru is an open source software this information, and therefore,
|
||||
public string GdprText2 => @"Disclaimer: Because Aaru is an open source software this information, and therefore,
|
||||
compliance with GDPR only holds true if you obtained a certificated copy from its original
|
||||
authors. In case of doubt, close Aaru now and ask in our IRC support channel.";
|
||||
|
||||
@@ -266,11 +265,11 @@ pool with no way of using them to identify you.";
|
||||
|
||||
void ExecuteSaveCommand()
|
||||
{
|
||||
Settings.Settings.Current.SaveReportsGlobally = SaveReportsGloballyChecked;
|
||||
Settings.Settings.Current.ShareReports = ShareReportsChecked;
|
||||
Settings.Current.SaveReportsGlobally = SaveReportsGloballyChecked;
|
||||
Settings.Current.ShareReports = ShareReportsChecked;
|
||||
|
||||
if(SaveStatsChecked)
|
||||
Settings.Settings.Current.Stats = new StatsSettings
|
||||
Settings.Current.Stats = new StatsSettings
|
||||
{
|
||||
ShareStats = ShareStatsChecked,
|
||||
CommandStats = CommandStatsChecked,
|
||||
@@ -284,10 +283,10 @@ pool with no way of using them to identify you.";
|
||||
VerifyStats = VerifyStatsChecked
|
||||
};
|
||||
else
|
||||
Settings.Settings.Current.Stats = null;
|
||||
Settings.Current.Stats = null;
|
||||
|
||||
Settings.Settings.Current.GdprCompliance = DicSettings.GDPR_LEVEL;
|
||||
Settings.Settings.SaveSettings();
|
||||
Settings.Current.GdprCompliance = DicSettings.GDPR_LEVEL;
|
||||
Settings.SaveSettings();
|
||||
_view.Close();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
// Copyright © 2011-2022 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reactive;
|
||||
@@ -37,12 +39,11 @@ using Aaru.Database;
|
||||
using Aaru.Database.Models;
|
||||
using Aaru.Gui.Models;
|
||||
using Aaru.Gui.Views.Dialogs;
|
||||
using Aaru.Settings;
|
||||
using JetBrains.Annotations;
|
||||
using ReactiveUI;
|
||||
using NameCountModel = Aaru.Gui.Models.NameCountModel;
|
||||
|
||||
namespace Aaru.Gui.ViewModels.Dialogs;
|
||||
|
||||
public sealed class StatisticsViewModel : ViewModelBase
|
||||
{
|
||||
readonly StatisticsDialog _view;
|
||||
@@ -97,7 +98,7 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
Devices = new ObservableCollection<DeviceStatsModel>();
|
||||
Medias = new ObservableCollection<MediaStatsModel>();
|
||||
CloseCommand = ReactiveCommand.Create(ExecuteCloseCommand);
|
||||
using var ctx = AaruContext.Create(Settings.Settings.LocalDbPath);
|
||||
using var ctx = AaruContext.Create(Settings.LocalDbPath);
|
||||
|
||||
if(ctx.Commands.Any())
|
||||
{
|
||||
@@ -163,8 +164,8 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
|
||||
if(ctx.Commands.Any(c => c.Name == "convert-image"))
|
||||
{
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "convert-image" && c.Synchronized).
|
||||
Select(c => c.Count).FirstOrDefault();
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "convert-image" && c.Synchronized).Select(c => c.Count).
|
||||
FirstOrDefault();
|
||||
|
||||
count += (ulong)ctx.Commands.LongCount(c => c.Name == "convert-image" && !c.Synchronized);
|
||||
|
||||
@@ -196,8 +197,8 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
|
||||
if(ctx.Commands.Any(c => c.Name == "device-info"))
|
||||
{
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "device-info" && c.Synchronized).
|
||||
Select(c => c.Count).FirstOrDefault();
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "device-info" && c.Synchronized).Select(c => c.Count).
|
||||
FirstOrDefault();
|
||||
|
||||
count += (ulong)ctx.Commands.LongCount(c => c.Name == "device-info" && !c.Synchronized);
|
||||
|
||||
@@ -207,8 +208,8 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
|
||||
if(ctx.Commands.Any(c => c.Name == "device-report"))
|
||||
{
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "device-report" && c.Synchronized).
|
||||
Select(c => c.Count).FirstOrDefault();
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "device-report" && c.Synchronized).Select(c => c.Count).
|
||||
FirstOrDefault();
|
||||
|
||||
count += (ulong)ctx.Commands.LongCount(c => c.Name == "device-report" && !c.Synchronized);
|
||||
|
||||
@@ -218,8 +219,8 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
|
||||
if(ctx.Commands.Any(c => c.Name == "dump-media"))
|
||||
{
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "dump-media" && c.Synchronized).
|
||||
Select(c => c.Count).FirstOrDefault();
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "dump-media" && c.Synchronized).Select(c => c.Count).
|
||||
FirstOrDefault();
|
||||
|
||||
count += (ulong)ctx.Commands.LongCount(c => c.Name == "dump-media" && !c.Synchronized);
|
||||
|
||||
@@ -251,8 +252,8 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
|
||||
if(ctx.Commands.Any(c => c.Name == "image-info"))
|
||||
{
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "image-info" && c.Synchronized).
|
||||
Select(c => c.Count).FirstOrDefault();
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "image-info" && c.Synchronized).Select(c => c.Count).
|
||||
FirstOrDefault();
|
||||
|
||||
count += (ulong)ctx.Commands.LongCount(c => c.Name == "image-info" && !c.Synchronized);
|
||||
|
||||
@@ -262,8 +263,8 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
|
||||
if(ctx.Commands.Any(c => c.Name == "media-info"))
|
||||
{
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "media-info" && c.Synchronized).
|
||||
Select(c => c.Count).FirstOrDefault();
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "media-info" && c.Synchronized).Select(c => c.Count).
|
||||
FirstOrDefault();
|
||||
|
||||
count += (ulong)ctx.Commands.LongCount(c => c.Name == "media-info" && !c.Synchronized);
|
||||
|
||||
@@ -273,8 +274,8 @@ public sealed class StatisticsViewModel : ViewModelBase
|
||||
|
||||
if(ctx.Commands.Any(c => c.Name == "media-scan"))
|
||||
{
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "media-scan" && c.Synchronized).
|
||||
Select(c => c.Count).FirstOrDefault();
|
||||
ulong count = ctx.Commands.Where(c => c.Name == "media-scan" && c.Synchronized).Select(c => c.Count).
|
||||
FirstOrDefault();
|
||||
|
||||
count += (ulong)ctx.Commands.LongCount(c => c.Name == "media-scan" && !c.Synchronized);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user