Added custom GUI theme support and changed the defualt theme to one I just wrote

This commit is contained in:
Xpl0itR 2019-06-06 18:55:53 +01:00
parent a0fe3401df
commit 8ca2f16686
No known key found for this signature in database
GPG key ID: 91798184109676AD
10 changed files with 254 additions and 5353 deletions

View file

@ -59,6 +59,12 @@
// Enable or disable ignoring missing services, this may cause instability
"ignore_missing_services": false,
// Enable or disable custom themes in the GUI.
"enable_custom_theme": false,
// Path to custom GUI theme.
"custom_theme_path": "",
// The primary controller's type
// Supported Values: Handheld, ProController, NpadPair, NpadLeft, NpadRight
"controller_type": "Handheld",

View file

@ -123,6 +123,16 @@ namespace Ryujinx
/// </summary>
public ControllerStatus ControllerType { get; private set; }
/// <summary>
/// Enable or disable custom themes in the GUI
/// </summary>
public bool EnableCustomTheme { get; private set; }
/// <summary>
/// Path to custom GUI theme
/// </summary>
public string CustomThemePath { get; private set; }
/// <summary>
/// Enable or disable keyboard support (Independent from controllers binding)
/// </summary>

View file

@ -11,20 +11,13 @@ namespace Ryujinx
{
Window CSWin = new Window(WindowType.Toplevel);
CSWin.Title = "Control Settings";
CSWin.Icon = new Gdk.Pixbuf("./ryujinxIcon.png");
CSWin.Resizable = false;
CSWin.WindowPosition = WindowPosition.Center;
CSWin.SetDefaultSize(854, 360);
VBox box = new VBox(false, 2);
//Load Icon
using (Stream iconstream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Ryujinx.ryujinxIcon.png"))
using (StreamReader reader = new StreamReader(iconstream))
{
Gdk.Pixbuf RyujinxIcon = new Gdk.Pixbuf(iconstream);
CSWin.Icon = RyujinxIcon;
}
//settings stuff will replace this block
Label myLabel = new Label { Text = "Control Settings" };
box.PackStart(myLabel, true, true, 3);

View file

@ -26,10 +26,14 @@ namespace Ryujinx
[GUI] CheckButton AggrToggle;
[GUI] CheckButton IgnoreToggle;
[GUI] ComboBoxText SystemLanguageSelect;
[GUI] CheckButton CustThemeToggle;
[GUI] Entry CustThemeDir;
[GUI] TextView GameDirsBox;
[GUI] Button SaveButton;
[GUI] Button CancelButton;
public static void ConfigureSettings(Configuration Instance) { SwitchConfig = Instance; }
public GeneralSettings(HLE.Switch _device) : this(new Builder("Ryujinx.GeneralSettings.glade"), _device) { }
private GeneralSettings(Builder builder, HLE.Switch _device) : base(builder.GetObject("GSWin").Handle)
@ -38,31 +42,34 @@ namespace Ryujinx
builder.Autoconnect(this);
SaveButton.Activated += Save_Activated;
CancelButton.Activated += Cancel_Activated;
SaveButton.Activated += SaveButton_Activated;
CancelButton.Activated += CancelButton_Activated;
CustThemeToggle.Clicked += CustThemeToggle_Activated;
if (SwitchConfig.LoggingEnableError == true) { ErrorLogToggle.Click(); }
if (SwitchConfig.LoggingEnableWarn == true) { WarningLogToggle.Click(); }
if (SwitchConfig.LoggingEnableInfo == true) { InfoLogToggle.Click(); }
if (SwitchConfig.LoggingEnableStub == true) { StubLogToggle.Click(); }
if (SwitchConfig.LoggingEnableDebug == true) { DebugLogToggle.Click(); }
if (SwitchConfig.EnableFileLog == true) { FileLogToggle.Click(); }
if (SwitchConfig.DockedMode == true) { DockedModeToggle.Click(); }
if (SwitchConfig.EnableDiscordIntergration == true) { DiscordToggle.Click(); }
if (SwitchConfig.EnableVsync == true) { VSyncToggle.Click(); }
if (SwitchConfig.EnableMulticoreScheduling == true) { MultiSchedToggle.Click(); }
if (SwitchConfig.EnableFsIntegrityChecks == true) { FSICToggle.Click(); }
if (SwitchConfig.EnableAggressiveCpuOpts == true) { AggrToggle.Click(); }
if (SwitchConfig.IgnoreMissingServices == true) { IgnoreToggle.Click(); }
if (SwitchConfig.LoggingEnableError) { ErrorLogToggle.Click(); }
if (SwitchConfig.LoggingEnableWarn) { WarningLogToggle.Click(); }
if (SwitchConfig.LoggingEnableInfo) { InfoLogToggle.Click(); }
if (SwitchConfig.LoggingEnableStub) { StubLogToggle.Click(); }
if (SwitchConfig.LoggingEnableDebug) { DebugLogToggle.Click(); }
if (SwitchConfig.EnableFileLog) { FileLogToggle.Click(); }
if (SwitchConfig.DockedMode) { DockedModeToggle.Click(); }
if (SwitchConfig.EnableDiscordIntergration) { DiscordToggle.Click(); }
if (SwitchConfig.EnableVsync) { VSyncToggle.Click(); }
if (SwitchConfig.EnableMulticoreScheduling) { MultiSchedToggle.Click(); }
if (SwitchConfig.EnableFsIntegrityChecks) { FSICToggle.Click(); }
if (SwitchConfig.EnableAggressiveCpuOpts) { AggrToggle.Click(); }
if (SwitchConfig.IgnoreMissingServices) { IgnoreToggle.Click(); }
if (SwitchConfig.EnableCustomTheme) { CustThemeToggle.Click(); }
SystemLanguageSelect.SetActiveId(SwitchConfig.SystemLanguage.ToString());
GameDirsBox.Buffer.Text = File.ReadAllText("./GameDirs.dat");
CustThemeDir.Buffer.Text = SwitchConfig.CustomThemePath;
if (CustThemeToggle.Active == false) { CustThemeDir.Sensitive = false; }
}
public static void ConfigureSettings(Configuration Instance) { SwitchConfig = Instance; }
//Events
private void Save_Activated(object obj, EventArgs args)
private void SaveButton_Activated(object obj, EventArgs args)
{
//Saving code is about to make this a BIG boi
@ -71,9 +78,14 @@ namespace Ryujinx
Destroy();
}
private void Cancel_Activated(object obj, EventArgs args)
private void CancelButton_Activated(object obj, EventArgs args)
{
Destroy();
}
private void CustThemeToggle_Activated(object obj, EventArgs args)
{
if (CustThemeToggle.Active == false) { CustThemeDir.Sensitive = false; } else { CustThemeDir.Sensitive = true; }
}
}
}

View file

@ -4,6 +4,7 @@
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="GSWin">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Ryujinx - General Settings (Read-Only)</property>
<property name="default_height">500</property>
<property name="icon">ryujinxIcon.png</property>
<child>
@ -23,7 +24,8 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Settings - Read Only</property>
<property name="margin_bottom">4</property>
<property name="label" translatable="yes">Emulation Settings</property>
</object>
<packing>
<property name="expand">False</property>
@ -269,6 +271,79 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">4</property>
<property name="label" translatable="yes">GUI Settings</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkCheckButton" id="CustThemeToggle">
<property name="label" translatable="yes">Use Custom Theme</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Custom Theme Dir:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="CustThemeDir">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
@ -278,6 +353,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_bottom">4</property>
<property name="label" translatable="yes">Game Directories</property>
</object>
<packing>
@ -304,48 +380,48 @@
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-discard</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="SaveButton">
<property name="label" translatable="yes">Save</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="CancelButton">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<property name="stock">gtk-discard</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="SaveButton">
<property name="label" translatable="yes">Save</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="CancelButton">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
@ -355,9 +431,9 @@
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">6</property>
</packing>
</child>
</object>

View file

@ -3,7 +3,6 @@ using GUI = Gtk.Builder.ObjectAttribute;
using Ryujinx.Common.Logging;
using System;
using System.IO;
using System.Reflection;
namespace Ryujinx
{
@ -16,9 +15,7 @@ namespace Ryujinx
internal ListStore TableStore { get; private set; }
//UI Controls
[GUI] Window MainWin;
[GUI] MenuItem NFC;
[GUI] MenuItem Debugger;
[GUI] TreeView GameTable;
public MainMenu(HLE.Switch _device, Application _gtkapp) : this(new Builder("Ryujinx.MainMenu.glade"), _device, _gtkapp) { }
@ -44,7 +41,6 @@ namespace Ryujinx
//disable some buttons
NFC.Sensitive = false;
Debugger.Sensitive = false;
//Games grid thing
GameTable.AppendColumn("Icon", new CellRendererPixbuf(), "pixbuf", 0);
@ -69,11 +65,21 @@ namespace Ryujinx
{
var settings = Settings.Default;
settings.XftRgba = "rgb";
settings.XftDpi = 96;
settings.XftHinting = 1;
settings.XftHintstyle = "hintfull";
CssProvider css_provider = new CssProvider();
css_provider.LoadFromPath("Theme.css");
if (GeneralSettings.SwitchConfig.EnableCustomTheme)
{
css_provider.LoadFromPath(GeneralSettings.SwitchConfig.CustomThemePath);
}
else
{
css_provider.LoadFromPath("Theme.css");
}
StyleContext.AddProviderForScreen(Gdk.Screen.Default, css_provider, 800);
}
@ -181,22 +187,17 @@ namespace Ryujinx
private void Exit_Pressed(object o, EventArgs args)
{
Destroy();
Application.Quit();
Environment.Exit(0);
}
private void Window_Close(object obj, DeleteEventArgs args)
{
Destroy();
Application.Quit();
args.RetVal = true;
Environment.Exit(0);
}
private void General_Settings_Pressed(object o, EventArgs args)
{
var resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
var GSWin = new GeneralSettings(device);
var GSWin = new GeneralSettings(device);
gtkapp.Register(GLib.Cancellable.Current);
gtkapp.AddWindow(GSWin);
GSWin.Show();
@ -220,23 +221,20 @@ namespace Ryujinx
fc.Destroy();
}
private void Debugger_Pressed(object o, EventArgs args)
{
//
}
private void About_Pressed(object o, EventArgs args)
{
AboutDialog about = new AboutDialog();
about.ProgramName = "Ryujinx";
about.Icon = new Gdk.Pixbuf("./ryujinxIcon");
about.Version = "Version x.x.x";
about.Authors = new string[] { "gdkchan", "Ac_K", "LDj3SNuD", "emmauss", "MerryMage", "MS-DOS1999", "Thog", "jD", "BaronKiko", "Dr.Hacknik", "Lordmau5", "(and Xpl0itR did a bit of work too :D)" };
about.Copyright = "Unlicense";
about.Comments = "Ryujinx is an emulator for the Nintendo Switch";
about.Website = "https://github.com/Ryujinx/Ryujinx";
about.Copyright = "Unlicense";
about.WindowPosition = WindowPosition.Center;
AboutDialog about = new AboutDialog
{
ProgramName = "Ryujinx",
Icon = new Gdk.Pixbuf("./ryujinxIcon.png"),
Version = "Version x.x.x",
Authors = new string[] { "gdkchan", "Ac_K", "LDj3SNuD", "emmauss", "MerryMage", "MS-DOS1999", "Thog", "jD", "BaronKiko", "Dr.Hacknik", "Lordmau5", "(and Xpl0itR did a bit of work too :D)" },
Copyright = "Unlicense",
Comments = "Ryujinx is an emulator for the Nintendo Switch",
Website = "https://github.com/Ryujinx/Ryujinx",
WindowPosition = WindowPosition.Center,
};
about.Run();
about.Destroy();
}

View file

@ -120,15 +120,6 @@
<signal name="activate" handler="NFC_Pressed" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="Debugger">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Debugger</property>
<property name="use_underline">True</property>
<signal name="activate" handler="Debugger_Pressed" swapped="no"/>
</object>
</child>
</object>
</child>
</object>

View file

@ -60,9 +60,8 @@ namespace Ryujinx
{
Gtk.Application.Init();
var resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
var gtkapp = new Gtk.Application("Ryujinx.Ryujinx", GLib.ApplicationFlags.None);
var win = new MainMenu(device, gtkapp);
var gtkapp = new Gtk.Application("Ryujinx.Ryujinx", GLib.ApplicationFlags.None);
var win = new MainMenu(device, gtkapp);
gtkapp.Register(GLib.Cancellable.Current);
gtkapp.AddWindow(win);

File diff suppressed because it is too large Load diff

View file

@ -494,6 +494,24 @@
false
]
},
"enable_custom_theme": {
"$id": "#/properties/enable_custom_theme",
"type": "boolean",
"title": "Enable custom themes in the GUI",
"description": "Enable or disable custom themes in the GUI",
"default": false,
"examples": [
true,
false
]
},
"custom_theme_path": {
"$id": "#/properties/custom_theme_path",
"type": "string",
"title": "Path to custom GUI theme",
"description": "Path to custom GUI theme",
"default": ""
},
"controller_type": {
"$id": "#/properties/controller_type",
"type": "string",