Improvements to input and input configuration in the GUI. (#849)
* Improvements to input and input configuration in the GUI * Requested changes * nits * more nits
This commit is contained in:
parent
5f3558fd51
commit
538fba826b
50 changed files with 5883 additions and 2511 deletions
|
@ -3,33 +3,46 @@ using System.Reflection;
|
|||
|
||||
namespace Ryujinx.Ui
|
||||
{
|
||||
internal class GtkDialog
|
||||
internal class GtkDialog : MessageDialog
|
||||
{
|
||||
internal static bool _isExitDialogOpen = false;
|
||||
|
||||
internal static void CreateDialog(string title, string text, string secondaryText)
|
||||
private GtkDialog(string title, string mainText, string secondaryText,
|
||||
MessageType messageType = MessageType.Other, ButtonsType buttonsType = ButtonsType.Ok) : base(null, DialogFlags.Modal, messageType, buttonsType, null)
|
||||
{
|
||||
MessageDialog errorDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, null)
|
||||
{
|
||||
Title = title,
|
||||
Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png"),
|
||||
Text = text,
|
||||
SecondaryText = secondaryText,
|
||||
WindowPosition = WindowPosition.Center
|
||||
};
|
||||
errorDialog.SetSizeRequest(100, 20);
|
||||
errorDialog.Run();
|
||||
errorDialog.Dispose();
|
||||
Title = title;
|
||||
Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png");
|
||||
Text = mainText;
|
||||
SecondaryText = secondaryText;
|
||||
WindowPosition = WindowPosition.Center;
|
||||
Response += GtkDialog_Response;
|
||||
|
||||
SetSizeRequest(100, 20);
|
||||
}
|
||||
|
||||
internal static void CreateWarningDialog(string text, string secondaryText)
|
||||
private void GtkDialog_Response(object sender, ResponseArgs args)
|
||||
{
|
||||
CreateDialog("Ryujinx - Warning", text, secondaryText);
|
||||
Dispose();
|
||||
}
|
||||
|
||||
internal static void CreateInfoDialog(string title, string mainText, string secondaryText)
|
||||
{
|
||||
new GtkDialog(title, mainText, secondaryText, MessageType.Info).Run();
|
||||
}
|
||||
|
||||
internal static void CreateWarningDialog(string mainText, string secondaryText)
|
||||
{
|
||||
new GtkDialog("Ryujinx - Warning", mainText, secondaryText, MessageType.Warning).Run();
|
||||
}
|
||||
|
||||
internal static void CreateErrorDialog(string errorMessage)
|
||||
{
|
||||
CreateDialog("Ryujinx - Error", "Ryujinx has encountered an error", errorMessage);
|
||||
new GtkDialog("Ryujinx - Error", "Ryujinx has encountered an error", errorMessage, MessageType.Error).Run();
|
||||
}
|
||||
|
||||
internal static MessageDialog CreateConfirmationDialog(string mainText, string secondaryText = "")
|
||||
{
|
||||
return new GtkDialog("Ryujinx - Confirmation", mainText, secondaryText, MessageType.Question, ButtonsType.YesNo);
|
||||
}
|
||||
|
||||
internal static bool CreateExitDialog()
|
||||
|
@ -40,27 +53,11 @@ namespace Ryujinx.Ui
|
|||
}
|
||||
|
||||
_isExitDialogOpen = true;
|
||||
|
||||
MessageDialog messageDialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Question, ButtonsType.OkCancel, null)
|
||||
{
|
||||
Title = "Ryujinx - Exit",
|
||||
Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.assets.Icon.png"),
|
||||
Text = "Are you sure you want to stop emulation?",
|
||||
SecondaryText = "All unsaved data will be lost",
|
||||
WindowPosition = WindowPosition.Center
|
||||
};
|
||||
|
||||
messageDialog.SetSizeRequest(100, 20);
|
||||
ResponseType res = (ResponseType)messageDialog.Run();
|
||||
messageDialog.Dispose();
|
||||
ResponseType res = (ResponseType)new GtkDialog("Ryujinx - Exit", "Are you sure you want to stop emulation?",
|
||||
"All unsaved data will be lost", MessageType.Question, ButtonsType.YesNo).Run();
|
||||
_isExitDialogOpen = false;
|
||||
|
||||
if (res == ResponseType.Ok)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return res == ResponseType.Yes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue