R/Ryujinx/Ui/Widgets/GtkDialog.cs

85 lines
3 KiB
C#
Raw Normal View History

Add features to GUI (#757) * controller image changes depending on the selected controller type the new controller image assets are temporary until i get new ones * Game list scans subdirs for games * Key file existence check * Only shows Program NCAs in Application list * Change shown GUI columns without restarting * Sort by column if you click on the column header Columns are sorted as text so there are inaccuracies on some columns * Fix sort on Time Played, Last Played and File Size columns * Add ability to designate favourite games #1 TODO: - Make fav games persistent - Fix invisible check marks due to theme * Add ability to designate favourite games #2 Also removed default theme * Added a Windows specific build condition and a Linux bug fix * bugfix * Load metadata from JSONs * Temp bug fix for MacOS * lil clean up * requested changes * Misc fixes * edited schema and config * Show the TitleID of games on the title bar * gui column config option have names * Async loading of game list * bugfix and cleanup * thog's requested changes * requested changes and cleanup still need to fix the gtk seizure * Fix issue where an ExeFS as a NSP didn't show up in the application list * Minor fixes * catch glib unhandled exceptions * Make sure to do UI manipulation in the main thread * Print path of invalid files * Ac_k's requested changes * Return of the dark theme * move AboutInfo struct to another file * sort usings * changes - gdkchan's requested changes that have been marked resolved - made some structs internal as they aren't used outside of the GUI - renamed Ryujinx.UI to Ryujinx.Ui to fit naming convention and folder structure - fixed bug where controller type dropdown box is stretched
2019-11-29 04:32:51 +00:00
using Gtk;
2021-01-18 20:33:58 +00:00
using System.Reflection;
using Ryujinx.Common.Logging;
Add features to GUI (#757) * controller image changes depending on the selected controller type the new controller image assets are temporary until i get new ones * Game list scans subdirs for games * Key file existence check * Only shows Program NCAs in Application list * Change shown GUI columns without restarting * Sort by column if you click on the column header Columns are sorted as text so there are inaccuracies on some columns * Fix sort on Time Played, Last Played and File Size columns * Add ability to designate favourite games #1 TODO: - Make fav games persistent - Fix invisible check marks due to theme * Add ability to designate favourite games #2 Also removed default theme * Added a Windows specific build condition and a Linux bug fix * bugfix * Load metadata from JSONs * Temp bug fix for MacOS * lil clean up * requested changes * Misc fixes * edited schema and config * Show the TitleID of games on the title bar * gui column config option have names * Async loading of game list * bugfix and cleanup * thog's requested changes * requested changes and cleanup still need to fix the gtk seizure * Fix issue where an ExeFS as a NSP didn't show up in the application list * Minor fixes * catch glib unhandled exceptions * Make sure to do UI manipulation in the main thread * Print path of invalid files * Ac_k's requested changes * Return of the dark theme * move AboutInfo struct to another file * sort usings * changes - gdkchan's requested changes that have been marked resolved - made some structs internal as they aren't used outside of the GUI - renamed Ryujinx.UI to Ryujinx.Ui to fit naming convention and folder structure - fixed bug where controller type dropdown box is stretched
2019-11-29 04:32:51 +00:00
namespace Ryujinx.Ui.Widgets
Add features to GUI (#757) * controller image changes depending on the selected controller type the new controller image assets are temporary until i get new ones * Game list scans subdirs for games * Key file existence check * Only shows Program NCAs in Application list * Change shown GUI columns without restarting * Sort by column if you click on the column header Columns are sorted as text so there are inaccuracies on some columns * Fix sort on Time Played, Last Played and File Size columns * Add ability to designate favourite games #1 TODO: - Make fav games persistent - Fix invisible check marks due to theme * Add ability to designate favourite games #2 Also removed default theme * Added a Windows specific build condition and a Linux bug fix * bugfix * Load metadata from JSONs * Temp bug fix for MacOS * lil clean up * requested changes * Misc fixes * edited schema and config * Show the TitleID of games on the title bar * gui column config option have names * Async loading of game list * bugfix and cleanup * thog's requested changes * requested changes and cleanup still need to fix the gtk seizure * Fix issue where an ExeFS as a NSP didn't show up in the application list * Minor fixes * catch glib unhandled exceptions * Make sure to do UI manipulation in the main thread * Print path of invalid files * Ac_k's requested changes * Return of the dark theme * move AboutInfo struct to another file * sort usings * changes - gdkchan's requested changes that have been marked resolved - made some structs internal as they aren't used outside of the GUI - renamed Ryujinx.UI to Ryujinx.Ui to fit naming convention and folder structure - fixed bug where controller type dropdown box is stretched
2019-11-29 04:32:51 +00:00
{
internal class GtkDialog : MessageDialog
Add features to GUI (#757) * controller image changes depending on the selected controller type the new controller image assets are temporary until i get new ones * Game list scans subdirs for games * Key file existence check * Only shows Program NCAs in Application list * Change shown GUI columns without restarting * Sort by column if you click on the column header Columns are sorted as text so there are inaccuracies on some columns * Fix sort on Time Played, Last Played and File Size columns * Add ability to designate favourite games #1 TODO: - Make fav games persistent - Fix invisible check marks due to theme * Add ability to designate favourite games #2 Also removed default theme * Added a Windows specific build condition and a Linux bug fix * bugfix * Load metadata from JSONs * Temp bug fix for MacOS * lil clean up * requested changes * Misc fixes * edited schema and config * Show the TitleID of games on the title bar * gui column config option have names * Async loading of game list * bugfix and cleanup * thog's requested changes * requested changes and cleanup still need to fix the gtk seizure * Fix issue where an ExeFS as a NSP didn't show up in the application list * Minor fixes * catch glib unhandled exceptions * Make sure to do UI manipulation in the main thread * Print path of invalid files * Ac_k's requested changes * Return of the dark theme * move AboutInfo struct to another file * sort usings * changes - gdkchan's requested changes that have been marked resolved - made some structs internal as they aren't used outside of the GUI - renamed Ryujinx.UI to Ryujinx.Ui to fit naming convention and folder structure - fixed bug where controller type dropdown box is stretched
2019-11-29 04:32:51 +00:00
{
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)
Add features to GUI (#757) * controller image changes depending on the selected controller type the new controller image assets are temporary until i get new ones * Game list scans subdirs for games * Key file existence check * Only shows Program NCAs in Application list * Change shown GUI columns without restarting * Sort by column if you click on the column header Columns are sorted as text so there are inaccuracies on some columns * Fix sort on Time Played, Last Played and File Size columns * Add ability to designate favourite games #1 TODO: - Make fav games persistent - Fix invisible check marks due to theme * Add ability to designate favourite games #2 Also removed default theme * Added a Windows specific build condition and a Linux bug fix * bugfix * Load metadata from JSONs * Temp bug fix for MacOS * lil clean up * requested changes * Misc fixes * edited schema and config * Show the TitleID of games on the title bar * gui column config option have names * Async loading of game list * bugfix and cleanup * thog's requested changes * requested changes and cleanup still need to fix the gtk seizure * Fix issue where an ExeFS as a NSP didn't show up in the application list * Minor fixes * catch glib unhandled exceptions * Make sure to do UI manipulation in the main thread * Print path of invalid files * Ac_k's requested changes * Return of the dark theme * move AboutInfo struct to another file * sort usings * changes - gdkchan's requested changes that have been marked resolved - made some structs internal as they aren't used outside of the GUI - renamed Ryujinx.UI to Ryujinx.Ui to fit naming convention and folder structure - fixed bug where controller type dropdown box is stretched
2019-11-29 04:32:51 +00:00
{
Title = title;
2021-01-18 20:33:58 +00:00
Icon = new Gdk.Pixbuf(Assembly.GetExecutingAssembly(), "Ryujinx.Ui.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();
Add features to GUI (#757) * controller image changes depending on the selected controller type the new controller image assets are temporary until i get new ones * Game list scans subdirs for games * Key file existence check * Only shows Program NCAs in Application list * Change shown GUI columns without restarting * Sort by column if you click on the column header Columns are sorted as text so there are inaccuracies on some columns * Fix sort on Time Played, Last Played and File Size columns * Add ability to designate favourite games #1 TODO: - Make fav games persistent - Fix invisible check marks due to theme * Add ability to designate favourite games #2 Also removed default theme * Added a Windows specific build condition and a Linux bug fix * bugfix * Load metadata from JSONs * Temp bug fix for MacOS * lil clean up * requested changes * Misc fixes * edited schema and config * Show the TitleID of games on the title bar * gui column config option have names * Async loading of game list * bugfix and cleanup * thog's requested changes * requested changes and cleanup still need to fix the gtk seizure * Fix issue where an ExeFS as a NSP didn't show up in the application list * Minor fixes * catch glib unhandled exceptions * Make sure to do UI manipulation in the main thread * Print path of invalid files * Ac_k's requested changes * Return of the dark theme * move AboutInfo struct to another file * sort usings * changes - gdkchan's requested changes that have been marked resolved - made some structs internal as they aren't used outside of the GUI - renamed Ryujinx.UI to Ryujinx.Ui to fit naming convention and folder structure - fixed bug where controller type dropdown box is stretched
2019-11-29 04:32:51 +00:00
}
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 bool CreateExitDialog()
{
return CreateChoiceDialog("Ryujinx - Exit", "Are you sure you want to close Ryujinx?", "All unsaved data will be lost!");
}
Add features to GUI (#757) * controller image changes depending on the selected controller type the new controller image assets are temporary until i get new ones * Game list scans subdirs for games * Key file existence check * Only shows Program NCAs in Application list * Change shown GUI columns without restarting * Sort by column if you click on the column header Columns are sorted as text so there are inaccuracies on some columns * Fix sort on Time Played, Last Played and File Size columns * Add ability to designate favourite games #1 TODO: - Make fav games persistent - Fix invisible check marks due to theme * Add ability to designate favourite games #2 Also removed default theme * Added a Windows specific build condition and a Linux bug fix * bugfix * Load metadata from JSONs * Temp bug fix for MacOS * lil clean up * requested changes * Misc fixes * edited schema and config * Show the TitleID of games on the title bar * gui column config option have names * Async loading of game list * bugfix and cleanup * thog's requested changes * requested changes and cleanup still need to fix the gtk seizure * Fix issue where an ExeFS as a NSP didn't show up in the application list * Minor fixes * catch glib unhandled exceptions * Make sure to do UI manipulation in the main thread * Print path of invalid files * Ac_k's requested changes * Return of the dark theme * move AboutInfo struct to another file * sort usings * changes - gdkchan's requested changes that have been marked resolved - made some structs internal as they aren't used outside of the GUI - renamed Ryujinx.UI to Ryujinx.Ui to fit naming convention and folder structure - fixed bug where controller type dropdown box is stretched
2019-11-29 04:32:51 +00:00
}
}