add label to status bar to show current firmware version

This commit is contained in:
emmaus 2020-01-11 09:13:46 +00:00
parent 7823a46115
commit 475bf7d7e8
2 changed files with 78 additions and 8 deletions

View file

@ -59,6 +59,7 @@ namespace Ryujinx.Ui
[GUI] TreeView _gameTable;
[GUI] TreeSelection _gameTableSelection;
[GUI] Label _progressLabel;
[GUI] Label _firmwareVersionLabel;
[GUI] LevelBar _progressBar;
#pragma warning restore CS0649
#pragma warning restore IDE0044
@ -137,6 +138,8 @@ namespace Ryujinx.Ui
#pragma warning disable CS4014
UpdateGameTable();
#pragma warning restore CS4014
Task.Run(RefreshFirmwareLabel);
}
internal static void ApplyTheme()
@ -592,6 +595,18 @@ namespace Ryujinx.Ui
HandleInstallerDialog(directoryChooser);
}
private void RefreshFirmwareLabel()
{
var currentFirmware = _device.System.GetCurrentFirmwareVersion();
GLib.Idle.Add(new GLib.IdleHandler(() =>
{
_firmwareVersionLabel.Text = currentFirmware != null ? currentFirmware.VersionString : "0.0.0";
return false;
}));
}
private void HandleInstallerDialog(FileChooserDialog fileChooser)
{
if (fileChooser.Run() == (int)ResponseType.Accept)
@ -629,7 +644,7 @@ namespace Ryujinx.Ui
if (currentVersion != null)
{
dialogMessage += $"This will replace the current system version {currentVersion.VersionString}.";
dialogMessage += $"This will replace the current system version {currentVersion.VersionString}. ";
}
dialogMessage += "Do you want to continue?";
@ -694,7 +709,7 @@ namespace Ryujinx.Ui
dialog.Text = $"Install Firmware {firmwareVersion.VersionString} Failed.";
dialog.SecondaryText = $"An error occured while installing system version {firmwareVersion.VersionString}." +
"Please check logs for more info.";
" Please check logs for more info.";
Logger.PrintError(LogClass.Application, ex.Message);
@ -704,6 +719,10 @@ namespace Ryujinx.Ui
return false;
}));
}
finally
{
RefreshFirmwareLabel();
}
});
thread.Start();

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<!-- Generated with glade 3.21.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkApplicationWindow" id="_mainWin">
@ -8,9 +8,6 @@
<property name="window_position">center</property>
<property name="default_width">1280</property>
<property name="default_height">750</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="_box">
<property name="visible">True</property>
@ -408,7 +405,7 @@
<object class="GtkLabel" id="_progressLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_left">10</property>
<property name="margin_right">5</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
@ -426,7 +423,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">5</property>
<property name="margin_left">10</property>
<property name="margin_right">5</property>
</object>
<packing>
@ -435,6 +432,57 @@
<property name="position">2</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">3</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">System Version</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="_firmwareVersionLabel">
<property name="width_request">50</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">4</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -451,5 +499,8 @@
</child>
</object>
</child>
<child type="titlebar">
<placeholder/>
</child>
</object>
</interface>