Add option to save game covers losslessly
This commit is contained in:
@@ -6,7 +6,7 @@ template PreferencesWindow : Adw.PreferencesWindow {
|
||||
default-height: 500;
|
||||
|
||||
Adw.PreferencesPage page {
|
||||
Adw.PreferencesGroup {
|
||||
Adw.PreferencesGroup general_group {
|
||||
title: _("General");
|
||||
|
||||
Adw.ActionRow {
|
||||
@@ -16,6 +16,14 @@ template PreferencesWindow : Adw.PreferencesWindow {
|
||||
valign: center;
|
||||
}
|
||||
}
|
||||
Adw.ActionRow {
|
||||
title: _("High Quality Images");
|
||||
subtitle: _("Save game covers losslessly at the cost of storage");
|
||||
|
||||
Switch high_quality_images_switch {
|
||||
valign: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Adw.PreferencesGroup steam_group {
|
||||
@@ -72,7 +80,7 @@ template PreferencesWindow : Adw.PreferencesWindow {
|
||||
Adw.ActionRow {
|
||||
title: _("Import Epic Games");
|
||||
|
||||
Switch import_epic_games_switch {
|
||||
Switch heroic_epic_switch {
|
||||
valign: center;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +88,7 @@ template PreferencesWindow : Adw.PreferencesWindow {
|
||||
Adw.ActionRow {
|
||||
title: _("Import GOG Games");
|
||||
|
||||
Switch import_gog_games_switch {
|
||||
Switch heroic_gog_switch {
|
||||
valign: center;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +96,7 @@ template PreferencesWindow : Adw.PreferencesWindow {
|
||||
Adw.ActionRow {
|
||||
title: _("Import Sideloaded Games");
|
||||
|
||||
Switch import_sideload_games_switch {
|
||||
Switch heroic_sideloaded_switch {
|
||||
valign: center;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
</key>
|
||||
<key name="bottles-location" type="s">
|
||||
<default>"~/.var/app/com.usebottles.bottles/data/bottles/"</default>
|
||||
</key>
|
||||
<key name="high-quality-images" type="b">
|
||||
<default>false</default>
|
||||
</key>
|
||||
</schema>
|
||||
<schema id="hu.kramo.Cartridge.State" path="/hu/kramo/Cartridges/State/">
|
||||
|
||||
@@ -27,20 +27,24 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
||||
__gtype_name__ = "PreferencesWindow"
|
||||
|
||||
page = Gtk.Template.Child()
|
||||
bottles_group = Gtk.Template.Child()
|
||||
|
||||
exit_after_launch_switch = Gtk.Template.Child()
|
||||
import_epic_games_switch = Gtk.Template.Child()
|
||||
import_gog_games_switch = Gtk.Template.Child()
|
||||
import_sideload_games_switch = Gtk.Template.Child()
|
||||
|
||||
steam_file_chooser_button = Gtk.Template.Child()
|
||||
steam_extra_file_chooser_button = Gtk.Template.Child()
|
||||
steam_clear_button = Gtk.Template.Child()
|
||||
steam_clear_button_revealer = Gtk.Template.Child()
|
||||
steam_clear_button = Gtk.Template.Child()
|
||||
|
||||
heroic_file_chooser_button = Gtk.Template.Child()
|
||||
heroic_epic_switch = Gtk.Template.Child()
|
||||
heroic_gog_switch = Gtk.Template.Child()
|
||||
heroic_sideloaded_switch = Gtk.Template.Child()
|
||||
|
||||
bottles_group = Gtk.Template.Child()
|
||||
bottles_file_chooser_button = Gtk.Template.Child()
|
||||
|
||||
high_quality_images_switch = Gtk.Template.Child()
|
||||
|
||||
def __init__(self, parent_widget, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
@@ -54,19 +58,25 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
||||
)
|
||||
schema.bind(
|
||||
"heroic-import-epic",
|
||||
self.import_epic_games_switch,
|
||||
self.heroic_epic_switch,
|
||||
"active",
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
schema.bind(
|
||||
"heroic-import-gog",
|
||||
self.import_gog_games_switch,
|
||||
self.heroic_gog_switch,
|
||||
"active",
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
schema.bind(
|
||||
"heroic-import-sideload",
|
||||
self.import_sideload_games_switch,
|
||||
self.heroic_sideloaded_switch,
|
||||
"active",
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
schema.bind(
|
||||
"high-quality-images",
|
||||
self.high_quality_images_switch,
|
||||
"active",
|
||||
Gio.SettingsBindFlags.DEFAULT,
|
||||
)
|
||||
|
||||
@@ -48,6 +48,6 @@ def save_cover(game, parent_widget, file_path, pixbuf=None, game_id=None):
|
||||
open_file.replace(None, False, Gio.FileCreateFlags.NONE),
|
||||
"tiff",
|
||||
["compression"],
|
||||
["7"],
|
||||
["8"] if parent_widget.schema.get_boolean("high-quality-images") else ["7"],
|
||||
callback=cover_callback,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user