Move status information from the title bar to the new status bar
This commit is contained in:
parent
b1b6f294f2
commit
1c38ac8813
3 changed files with 82 additions and 29 deletions
|
@ -24,6 +24,8 @@ namespace Ryujinx.Ui
|
|||
|
||||
public ManualResetEvent WaitEvent { get; set; }
|
||||
|
||||
public static event EventHandler<(bool, string)> StatusUpdatedEvent;
|
||||
|
||||
public bool IsActive { get; set; }
|
||||
public bool IsStopped { get; set; }
|
||||
public bool IsFocused { get; set; }
|
||||
|
@ -32,12 +34,8 @@ namespace Ryujinx.Ui
|
|||
private double _mouseY;
|
||||
private bool _mousePressed;
|
||||
|
||||
private bool _titleEvent;
|
||||
|
||||
private bool _toggleFullscreen;
|
||||
|
||||
private string _newTitle;
|
||||
|
||||
private readonly long _ticksPerFrame;
|
||||
|
||||
private long _ticks = 0;
|
||||
|
@ -179,6 +177,14 @@ namespace Ryujinx.Ui
|
|||
Gtk.Application.Invoke(delegate
|
||||
{
|
||||
parent.Present();
|
||||
|
||||
string titleNameSection = string.IsNullOrWhiteSpace(_device.System.TitleName) ? string.Empty
|
||||
: " | " + _device.System.TitleName;
|
||||
|
||||
string titleIdSection = string.IsNullOrWhiteSpace(_device.System.TitleIdText) ? string.Empty
|
||||
: " | " + _device.System.TitleIdText.ToUpper();
|
||||
|
||||
parent.Title = $"Ryujinx {Program.Version}{titleNameSection}{titleIdSection}";
|
||||
});
|
||||
|
||||
Thread renderLoopThread = new Thread(Render)
|
||||
|
@ -321,17 +327,9 @@ namespace Ryujinx.Ui
|
|||
|
||||
double hostFps = _device.Statistics.GetSystemFrameRate();
|
||||
double gameFps = _device.Statistics.GetGameFrameRate();
|
||||
string status = $"| Host FPS: {hostFps:0.0} | Game FPS: {gameFps:0.0}";
|
||||
|
||||
string titleNameSection = string.IsNullOrWhiteSpace(_device.System.TitleName) ? string.Empty
|
||||
: " | " + _device.System.TitleName;
|
||||
|
||||
string titleIdSection = string.IsNullOrWhiteSpace(_device.System.TitleIdText) ? string.Empty
|
||||
: " | " + _device.System.TitleIdText.ToUpper();
|
||||
|
||||
_newTitle = $"Ryujinx {Program.Version}{titleNameSection}{titleIdSection} | Host FPS: {hostFps:0.0} | Game FPS: {gameFps:0.0} | " +
|
||||
$"Game Vsync: {(_device.EnableDeviceVsync ? "On" : "Off")}";
|
||||
|
||||
_titleEvent = true;
|
||||
StatusUpdatedEvent?.Invoke(this, (_device.EnableDeviceVsync, status));
|
||||
|
||||
_device.System.SignalVsync();
|
||||
|
||||
|
@ -351,16 +349,6 @@ namespace Ryujinx.Ui
|
|||
{
|
||||
while (IsActive)
|
||||
{
|
||||
if (_titleEvent)
|
||||
{
|
||||
_titleEvent = false;
|
||||
|
||||
Gtk.Application.Invoke(delegate
|
||||
{
|
||||
this.ParentWindow.Title = _newTitle;
|
||||
});
|
||||
}
|
||||
|
||||
UpdateFrame();
|
||||
|
||||
// Polling becomes expensive if it's not slept
|
||||
|
|
|
@ -51,6 +51,7 @@ namespace Ryujinx.Ui
|
|||
[GUI] MenuBar _menuBar;
|
||||
[GUI] Box _footerBox;
|
||||
[GUI] MenuItem _fullScreen;
|
||||
[GUI] Box _statusBar;
|
||||
[GUI] MenuItem _stopEmulation;
|
||||
[GUI] CheckMenuItem _favToggle;
|
||||
[GUI] MenuItem _firmwareInstallFile;
|
||||
|
@ -64,6 +65,7 @@ namespace Ryujinx.Ui
|
|||
[GUI] CheckMenuItem _lastPlayedToggle;
|
||||
[GUI] CheckMenuItem _fileExtToggle;
|
||||
[GUI] CheckMenuItem _fileSizeToggle;
|
||||
[GUI] Label _fpsStatus;
|
||||
[GUI] CheckMenuItem _pathToggle;
|
||||
[GUI] TreeView _gameTable;
|
||||
[GUI] ScrolledWindow _gameTableWindow;
|
||||
|
@ -72,6 +74,7 @@ namespace Ryujinx.Ui
|
|||
[GUI] Label _firmwareVersionLabel;
|
||||
[GUI] LevelBar _progressBar;
|
||||
[GUI] Box _viewBox;
|
||||
[GUI] Label _vSyncStatus;
|
||||
[GUI] Box _listStatusBox;
|
||||
|
||||
#pragma warning restore CS0649
|
||||
|
@ -87,6 +90,7 @@ namespace Ryujinx.Ui
|
|||
|
||||
ApplicationLibrary.ApplicationAdded += Application_Added;
|
||||
ApplicationLibrary.ApplicationCountUpdated += ApplicationCount_Updated;
|
||||
GLRenderer.StatusUpdatedEvent += Update_StatusBar;
|
||||
|
||||
_gameTable.ButtonReleaseEvent += Row_Clicked;
|
||||
|
||||
|
@ -451,12 +455,15 @@ namespace Ryujinx.Ui
|
|||
|
||||
private void RecreateFooterForMenu()
|
||||
{
|
||||
_footerBox.Add(_listStatusBox);
|
||||
_listStatusBox.Show();
|
||||
|
||||
_fpsStatus.Text = "";
|
||||
_vSyncStatus.Text = "";
|
||||
}
|
||||
|
||||
private void ClearFooterForGameRender()
|
||||
{
|
||||
_footerBox.Remove(_listStatusBox);
|
||||
_listStatusBox.Hide();
|
||||
}
|
||||
|
||||
public void ToggleExtraWidgets(bool show)
|
||||
|
@ -466,7 +473,8 @@ namespace Ryujinx.Ui
|
|||
if (show)
|
||||
{
|
||||
_menuBar.ShowAll();
|
||||
_footerBox.ShowAll();
|
||||
_footerBox.Show();
|
||||
_statusBar.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -590,6 +598,26 @@ namespace Ryujinx.Ui
|
|||
});
|
||||
}
|
||||
|
||||
private void Update_StatusBar(object sender, (bool vSync, string fps) status)
|
||||
{
|
||||
Application.Invoke(delegate
|
||||
{
|
||||
_vSyncStatus.Text = status.vSync ? "VSync On" : "VSync Off";
|
||||
_fpsStatus.Text = status.fps;
|
||||
|
||||
if (status.vSync)
|
||||
{
|
||||
_vSyncStatus.Attributes = new Pango.AttrList();
|
||||
_vSyncStatus.Attributes.Insert(new Pango.AttrForeground(0, ushort.MaxValue, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_vSyncStatus.Attributes = new Pango.AttrList();
|
||||
_vSyncStatus.Attributes.Insert(new Pango.AttrForeground(ushort.MaxValue, 0, 0));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void FavToggle_Toggled(object sender, ToggledArgs args)
|
||||
{
|
||||
_tableStore.GetIter(out TreeIter treeIter, new TreePath(args.Path));
|
||||
|
|
|
@ -399,10 +399,10 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="_footerBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="width_request">1280</property>
|
||||
<property name="height_request">19</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="_listStatusBox">
|
||||
<property name="visible">True</property>
|
||||
|
@ -460,6 +460,43 @@
|
|||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="_statusBar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="_vSyncStatus">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">10</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="_fpsStatus">
|
||||
<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_right">10</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue