Move "reuse assets" option in GUI from settings to export dialog

pull/1003/head
Tyrrrz 2 years ago
parent 20a952aec5
commit 6620c6299c

@ -19,8 +19,6 @@ public partial class SettingsService : SettingsManager
public int ParallelLimit { get; set; } = 1;
public bool ShouldReuseAssets { get; set; }
public Version? LastAppVersion { get; set; }
public string? LastToken { get; set; }
@ -35,6 +33,8 @@ public partial class SettingsService : SettingsManager
public bool LastShouldDownloadAssets { get; set; }
public bool LastShouldReuseAssets { get; set; }
public SettingsService()
{
Configuration.StorageSpace = StorageSpace.Instance;

@ -193,7 +193,7 @@ public class DashboardViewModel : PropertyChangedBase
dialog.MessageFilter,
dialog.ShouldFormatMarkdown,
dialog.ShouldDownloadAssets,
_settingsService.ShouldReuseAssets,
dialog.ShouldReuseAssets,
_settingsService.DateFormat
);

@ -63,6 +63,8 @@ public class ExportSetupViewModel : DialogScreen
public bool ShouldDownloadAssets { get; set; }
public bool ShouldReuseAssets { get; set; }
public bool IsAdvancedSectionDisplayed { get; set; }
public ExportSetupViewModel(DialogManager dialogManager, SettingsService settingsService)
@ -76,6 +78,7 @@ public class ExportSetupViewModel : DialogScreen
MessageFilterValue = _settingsService.LastMessageFilterValue;
ShouldFormatMarkdown = _settingsService.LastShouldFormatMarkdown;
ShouldDownloadAssets = _settingsService.LastShouldDownloadAssets;
ShouldReuseAssets = _settingsService.LastShouldReuseAssets;
// Show the "advanced options" section by default if any
// of the advanced options are set to non-default values.
@ -134,6 +137,7 @@ public class ExportSetupViewModel : DialogScreen
_settingsService.LastMessageFilterValue = MessageFilterValue;
_settingsService.LastShouldFormatMarkdown = ShouldFormatMarkdown;
_settingsService.LastShouldDownloadAssets = ShouldDownloadAssets;
_settingsService.LastShouldReuseAssets = ShouldReuseAssets;
Close(true);
}

@ -38,12 +38,6 @@ public class SettingsViewModel : DialogScreen
set => _settingsService.ParallelLimit = Math.Clamp(value, 1, 10);
}
public bool ShouldReuseAssets
{
get => _settingsService.ShouldReuseAssets;
set => _settingsService.ShouldReuseAssets = value;
}
public SettingsViewModel(SettingsService settingsService) =>
_settingsService = settingsService;
}

@ -267,6 +267,24 @@
VerticalAlignment="Center"
IsChecked="{Binding ShouldDownloadAssets}" />
</Grid>
<!-- Reuse assets -->
<Grid Margin="16,8" ToolTip="Reuse previously downloaded assets to avoid redundant requests">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
VerticalAlignment="Center"
Text="Reuse assets" />
<ToggleButton
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
IsChecked="{Binding ShouldReuseAssets}" />
</Grid>
</StackPanel>
</StackPanel>
</ScrollViewer>

@ -82,22 +82,6 @@
IsChecked="{Binding IsTokenPersisted}" />
</DockPanel>
<!-- Reuse assets -->
<DockPanel
Margin="16,8"
Background="Transparent"
LastChildFill="False"
ToolTip="Reuse previously downloaded assets to avoid redundant requests">
<TextBlock
VerticalAlignment="Center"
DockPanel.Dock="Left"
Text="Reuse downloaded assets" />
<ToggleButton
VerticalAlignment="Center"
DockPanel.Dock="Right"
IsChecked="{Binding ShouldReuseAssets}" />
</DockPanel>
<!-- Date format -->
<DockPanel
Margin="16,8"

Loading…
Cancel
Save