mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-12-01 22:37:26 +00:00
deb99d2cae
* avalonia part 1 * remove vulkan ui backend * move ui common files to ui common project * get name for oading screen from device * rebase. * review 1 * review 1.1 * review * cleanup * addressed review * use cancellation token * review * review * rebased * cancel library loading when closing window * remove star image, use fonticon instead * delete render control frame buffer when game ends. change position of fav star * addressed @Thog review * ensure the right ui is downloaded in updates * fix crash when showing not supported dialog during controller request * add prefix to artifact names * Auto-format Avalonia project * Fix input * Fix build, simplify app disposal * remove nv stutter thread * addressed review * add missing change * maintain window size if new size is zero length * add game, handheld, docked to local * reverse scale main window * Update de_DE.json * Update de_DE.json * Update de_DE.json * Update italian json * Update it_IT.json * let render timer poll with no wait * remove unused code * more unused code * enabled tiered compilation and trimming * check if window event is not closed before signaling * fix atmospher case * locale fix * locale fix * remove explicit tiered compilation declarations * Remove ) it_IT.json * Remove ) de_DE.json * Update it_IT.json * Update pt_BR locale with latest strings * Remove ')' * add more strings to locale * update locale * remove extra slash * remove extra slash * set firmware version to 0 if key's not found * fix * revert timer changes * lock on object instead * Update it_IT.json * remove unused method * add load screen text to locale * drop swap event * Update de_DE.json * Update de_DE.json * do null check when stopping emulator * Update de_DE.json * Create tr_TR.json * Add tr_TR * Add tr_TR + Turkish * Update it_IT.json * Update Ryujinx.Ava/Input/AvaloniaMappingHelper.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> * Apply suggestions from code review Co-authored-by: Ac_K <Acoustik666@gmail.com> * Apply suggestions from code review Co-authored-by: Ac_K <Acoustik666@gmail.com> * addressed review * Update Ryujinx.Ava/Ui/Backend/OpenGl/OpenGlRenderTarget.cs Co-authored-by: gdkchan <gab.dark.100@gmail.com> * use avalonia's inbuilt renderer on linux * removed whitespace * workaround for queue render crash with vsync off * drop custom backend * format files * fix not closing issue * remove warnings * rebase * update avalonia library * Reposition the Text and Button on About Page * Assign build version * Remove appveyor text Co-authored-by: gdk <gab.dark.100@gmail.com> Co-authored-by: Niwu34 <67392333+Niwu34@users.noreply.github.com> Co-authored-by: Antonio Brugnolo <36473846+AntoSkate@users.noreply.github.com> Co-authored-by: aegiff <99728970+aegiff@users.noreply.github.com> Co-authored-by: Ac_K <Acoustik666@gmail.com> Co-authored-by: MostlyWhat <78652091+MostlyWhat@users.noreply.github.com>
114 lines
4.2 KiB
C#
114 lines
4.2 KiB
C#
using Gtk;
|
|
using Ryujinx.Common.Logging;
|
|
using Ryujinx.Ui.Common.Configuration;
|
|
using System.Collections.Generic;
|
|
using System.Reflection;
|
|
|
|
namespace Ryujinx.Ui.Widgets
|
|
{
|
|
internal class GtkDialog : MessageDialog
|
|
{
|
|
private static bool _isChoiceDialogOpen;
|
|
|
|
private GtkDialog(string title, string mainText, string secondaryText, MessageType messageType = MessageType.Other, ButtonsType buttonsType = ButtonsType.Ok)
|
|
: base(null, DialogFlags.Modal, messageType, buttonsType, null)
|
|
{
|
|
Title = title;
|
|
Icon = new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png");
|
|
Text = mainText;
|
|
SecondaryText = secondaryText;
|
|
WindowPosition = WindowPosition.Center;
|
|
SecondaryUseMarkup = true;
|
|
|
|
Response += GtkDialog_Response;
|
|
|
|
SetSizeRequest(200, 20);
|
|
}
|
|
|
|
private void GtkDialog_Response(object sender, ResponseArgs args)
|
|
{
|
|
Dispose();
|
|
}
|
|
|
|
internal static void CreateInfoDialog(string mainText, string secondaryText)
|
|
{
|
|
new GtkDialog("Ryujinx - Info", mainText, secondaryText, MessageType.Info).Run();
|
|
}
|
|
|
|
internal static void CreateUpdaterInfoDialog(string mainText, string secondaryText)
|
|
{
|
|
new GtkDialog("Ryujinx - Updater", mainText, secondaryText, MessageType.Info).Run();
|
|
}
|
|
|
|
internal static MessageDialog CreateWaitingDialog(string mainText, string secondaryText)
|
|
{
|
|
return new GtkDialog("Ryujinx - Waiting", mainText, secondaryText, MessageType.Info, ButtonsType.None);
|
|
}
|
|
|
|
internal static void CreateWarningDialog(string mainText, string secondaryText)
|
|
{
|
|
new GtkDialog("Ryujinx - Warning", mainText, secondaryText, MessageType.Warning).Run();
|
|
}
|
|
|
|
internal static void CreateErrorDialog(string errorMessage)
|
|
{
|
|
Logger.Error?.Print(LogClass.Application, 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 CreateChoiceDialog(string title, string mainText, string secondaryText)
|
|
{
|
|
if (_isChoiceDialogOpen)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
_isChoiceDialogOpen = true;
|
|
|
|
ResponseType response = (ResponseType)new GtkDialog(title, mainText, secondaryText, MessageType.Question, ButtonsType.YesNo).Run();
|
|
|
|
_isChoiceDialogOpen = false;
|
|
|
|
return response == ResponseType.Yes;
|
|
}
|
|
|
|
internal static ResponseType CreateCustomDialog(string title, string mainText, string secondaryText, Dictionary<int, string> buttons, MessageType messageType = MessageType.Other)
|
|
{
|
|
GtkDialog gtkDialog = new GtkDialog(title, mainText, secondaryText, messageType, ButtonsType.None);
|
|
|
|
foreach (var button in buttons)
|
|
{
|
|
gtkDialog.AddButton(button.Value, button.Key);
|
|
}
|
|
|
|
return (ResponseType)gtkDialog.Run();
|
|
}
|
|
|
|
internal static string CreateInputDialog(Window parent, string title, string mainText, uint inputMax)
|
|
{
|
|
GtkInputDialog gtkDialog = new GtkInputDialog(parent, title, mainText, inputMax);
|
|
ResponseType response = (ResponseType)gtkDialog.Run();
|
|
string responseText = gtkDialog.InputEntry.Text.TrimEnd();
|
|
|
|
gtkDialog.Dispose();
|
|
|
|
if (response == ResponseType.Ok)
|
|
{
|
|
return responseText;
|
|
}
|
|
|
|
return "";
|
|
}
|
|
|
|
internal static bool CreateExitDialog()
|
|
{
|
|
return CreateChoiceDialog("Ryujinx - Exit", "Are you sure you want to close Ryujinx?", "All unsaved data will be lost!");
|
|
}
|
|
}
|
|
}
|