Skip to content

Commit

Permalink
Tweaks UI improvements
Browse files Browse the repository at this point in the history
Remove some of the less useful tweaks (#355)


Former-commit-id: 18d8f38
  • Loading branch information
tkashkin committed Aug 3, 2020
1 parent 0407941 commit c3872ef
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 72 deletions.
2 changes: 2 additions & 0 deletions data/share/tweaks/gpu_amd.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"name": "AMD: Radeon ACO Vulkan Compiler",
"description": "Enable ACO based Vulkan shader compiler for RADV instead of LLVM",
"url": "https://github.com/mesa3d/mesa",
"icon": "hardware-gpu-amd-symbolic",
"group": "GPU",
"requires": {
"kernel_modules": ["amdgpu"]
Expand All @@ -17,6 +18,7 @@
"name": "AMD: Threaded Optimizations",
"description": "Offload CPU computations to a worker thread",
"url": "https://github.com/mesa3d/mesa",
"icon": "hardware-gpu-amd-symbolic",
"group": "GPU",
"requires": {
"kernel_modules": ["amdgpu"]
Expand Down
28 changes: 2 additions & 26 deletions data/share/tweaks/gpu_nvidia.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"name": "NVIDIA: Threaded Optimizations",
"description": "Offload CPU computations to a worker thread",
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/410.104/README/openglenvvariables.html",
"icon": "hardware-gpu-nvidia-symbolic",
"group": "GPU",
"requires": {
"kernel_modules": ["nvidia"]
Expand All @@ -12,37 +13,12 @@
"__GL_THREADED_OPTIMIZATIONS": "1"
}
},
{
"id": "gpu_nvidia_sync_gsync",
"name": "NVIDIA: G-SYNC",
"description": "Controls G-SYNC, also called “variable refresh rate”",
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/410.104/README/openglenvvariables.html",
"group": "GPU",
"requires": {
"kernel_modules": ["nvidia"]
},
"env": {
"__GL_GSYNC_ALLOWED": "1"
}
},
{
"id": "gpu_nvidia_sync_vblank",
"name": "NVIDIA: vblank",
"description": "Limit frame rate to the refresh rate of the monitor",
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/410.104/README/openglenvvariables.html",
"group": "GPU",
"requires": {
"kernel_modules": ["nvidia"]
},
"env": {
"__GL_SYNC_TO_VBLANK": "1"
}
},
{
"id": "gpu_nvidia_osd",
"name": "NVIDIA: Graphics API Visual Indicator",
"description": "Control whether the graphics API visual indicator is rendered on top of OpenGL and Vulkan applications",
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/410.104/README/openglenvvariables.html",
"icon": "hardware-gpu-nvidia-symbolic",
"group": "Overlays",
"requires": {
"kernel_modules": ["nvidia"]
Expand Down
28 changes: 0 additions & 28 deletions data/share/tweaks/wine.json

This file was deleted.

3 changes: 3 additions & 0 deletions res/icons/icons.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@

<file alias="scalable/actions/gamehub-symbolic.svg">symbolic/gamehub.svg</file>

<file alias="scalable/actions/hardware-gpu-amd-symbolic.svg">symbolic/hardware/gpu-amd.svg</file>
<file alias="scalable/actions/hardware-gpu-nvidia-symbolic.svg">symbolic/hardware/gpu-nvidia.svg</file>

<file alias="scalable/actions/controller-button-a.svg">normal/controller/a.svg</file>
<file alias="scalable/actions/controller-button-b.svg">normal/controller/b.svg</file>
<file alias="scalable/actions/controller-button-x.svg">normal/controller/x.svg</file>
Expand Down
4 changes: 4 additions & 0 deletions res/icons/symbolic/hardware/gpu-amd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions res/icons/symbolic/hardware/gpu-nvidia.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/data/compat/Wine.vala
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ namespace GameHub.Data.Compat
protected virtual string[] prepare_env(Traits.SupportsCompatTools runnable, bool parse_opts=true)
{
var env = Environ.get();
env = Environ.set_variable(env, "WINEDLLOVERRIDES", "mshtml=d;winemenubuilder.exe=d");
env = Environ.set_variable(env, "WINEDLLOVERRIDES", "mscoree=d;mshtml=d;winemenubuilder.exe=d");

if(wine_binary != null && wine_binary.query_exists())
{
Expand Down
14 changes: 11 additions & 3 deletions src/data/tweaks/Tweak.vala
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ namespace GameHub.Data.Tweaks
public string? description { get; protected set; default = null; }
public string? group { get; protected set; default = null; }
public string? url { get; protected set; default = null; }
public string? icon_name { get; protected set; default = null; }

public ApplicabilityOptions? applicability_options { get; protected set; default = null; }
public Requirements? requirements { get; protected set; default = null; }
Expand All @@ -40,9 +41,9 @@ namespace GameHub.Data.Tweaks
public string? command { get; protected set; default = null; }
public File? file { get; protected set; default = null; }

public Tweak(string id, string? name, string? description, string? group, string? url, ApplicabilityOptions? applicability_options, Requirements? requirements, ArrayList<Option>? options, HashMap<string, string?>? env, string? command, File? file)
public Tweak(string id, string? name, string? description, string? group, string? url, string? icon_name, ApplicabilityOptions? applicability_options, Requirements? requirements, ArrayList<Option>? options, HashMap<string, string?>? env, string? command, File? file)
{
Object(id: id, name: name, description: description, group: group, url: url, applicability_options: applicability_options, requirements: requirements, options: options, env: env, command: command, file: file);
Object(id: id, name: name, description: description, group: group, url: url, icon_name: icon_name, applicability_options: applicability_options, requirements: requirements, options: options, env: env, command: command, file: file);
}

public Tweak.from_json_object(Json.Object obj, File? file, string? default_id=null)
Expand All @@ -52,6 +53,7 @@ namespace GameHub.Data.Tweaks
string? description = null;
string? group = null;
string? url = null;
string? icon_name = null;
ApplicabilityOptions? applicability_options = null;
Requirements? requirements = null;
ArrayList<Option>? options = null;
Expand All @@ -63,6 +65,7 @@ namespace GameHub.Data.Tweaks
if(obj.has_member("description")) description = obj.get_string_member("description");
if(obj.has_member("group")) group = obj.get_string_member("group");
if(obj.has_member("url")) url = obj.get_string_member("url");
if(obj.has_member("icon")) icon_name = obj.get_string_member("icon");

if(obj.has_member("applicable_to"))
{
Expand Down Expand Up @@ -107,7 +110,7 @@ namespace GameHub.Data.Tweaks
command = obj.get_string_member("command");
}

Object(id: id, name: name, description: description, group: group, url: url, applicability_options: applicability_options, requirements: requirements, options: options, env: env, command: command, file: file);
Object(id: id, name: name, description: description, group: group, url: url, icon_name: icon_name, applicability_options: applicability_options, requirements: requirements, options: options, env: env, command: command, file: file);
}

public static ArrayList<Tweak> load_from_file(File file)
Expand Down Expand Up @@ -207,6 +210,10 @@ namespace GameHub.Data.Tweaks
{
owned get
{
if(icon_name != null)
{
return icon_name;
}
var icon = "gh-settings-cogs-symbolic";
if(applicability_options != null)
{
Expand Down Expand Up @@ -314,6 +321,7 @@ namespace GameHub.Data.Tweaks
if(description != null) obj.set_string_member("description", description);
if(group != null) obj.set_string_member("group", group);
if(url != null) obj.set_string_member("url", url);
if(icon_name != null) obj.set_string_member("icon", icon_name);

if(applicability_options != null)
{
Expand Down
39 changes: 25 additions & 14 deletions src/ui/widgets/tweaks/TweakRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,6 @@ namespace GameHub.UI.Widgets.Tweaks
name.xalign = 0;
name.valign = Align.CENTER;

var description = new Label(tweak.description ?? _("No description"));
description.get_style_context().add_class(Gtk.STYLE_CLASS_DIM_LABEL);
description.get_style_context().add_class("description");
description.tooltip_text = tweak.description;
description.hexpand = true;
description.ellipsize = Pango.EllipsizeMode.END;
description.xalign = 0;
description.valign = Align.CENTER;

var install = new Button.with_label(_("Install"));
install.valign = Align.CENTER;
install.sensitive = false;
Expand All @@ -81,11 +72,27 @@ namespace GameHub.UI.Widgets.Tweaks
buttons_hbox.valign = Align.CENTER;

grid.attach(icon, 0, 0, 1, 2);
grid.attach(name, 1, 0);
grid.attach(description, 1, 1);
grid.attach(buttons_hbox, 2, 0, 1, 2);
grid.attach(enabled, 4, 0, 1, 2);

if(tweak.description != null)
{
var description = new Label(tweak.description);
description.get_style_context().add_class(Gtk.STYLE_CLASS_DIM_LABEL);
description.get_style_context().add_class("description");
description.tooltip_text = tweak.description;
description.hexpand = true;
description.ellipsize = Pango.EllipsizeMode.END;
description.xalign = 0;
description.valign = Align.CENTER;
grid.attach(name, 1, 0);
grid.attach(description, 1, 1);
}
else
{
grid.attach(name, 1, 0, 1, 2);
}

if(tweak.url != null)
{
var url = new Button.from_icon_name("web-symbolic", IconSize.BUTTON);
Expand Down Expand Up @@ -116,7 +123,6 @@ namespace GameHub.UI.Widgets.Tweaks
if(tweak.options != null && tweak.options.size > 0)
{
var options_popover = new TweakOptionsPopover(tweak);

options = new MenuButton();
options.tooltip_text = _("Options");
options.get_style_context().add_class(Gtk.STYLE_CLASS_FLAT);
Expand Down Expand Up @@ -162,8 +168,13 @@ namespace GameHub.UI.Widgets.Tweaks
enabled.sensitive = false;
enabled.active = false;
activatable = false;
icon.icon_name = "action-unavailable-symbolic";
icon.tooltip_markup = enabled.tooltip_markup = string.joinv("\n", reqs).strip();
name.sensitive = false;
tooltip_markup = string.joinv("\n", reqs).strip();
icon.opacity = 0.6;
if(icon.icon_name == "gh-settings-cogs-symbolic")
{
icon.icon_name = "action-unavailable-symbolic";
}
}
else
{
Expand Down

0 comments on commit c3872ef

Please sign in to comment.