Skip to content

Commit

Permalink
Add option to show the old title bar (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWarnut authored Oct 30, 2024
1 parent 9c94db1 commit 5845787
Show file tree
Hide file tree
Showing 26 changed files with 55 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ConfigurationFileFormat
/// <summary>
/// The current version of the file format
/// </summary>
public const int CurrentVersion = 55;
public const int CurrentVersion = 56;

/// <summary>
/// Version of the configuration file format
Expand Down Expand Up @@ -173,6 +173,11 @@ public class ConfigurationFileFormat
/// </summary>
public bool RememberWindowState { get; set; }

/// <summary>
/// Enables or disables the redesigned title bar
/// </summary>
public bool ShowTitleBar { get; set; }

/// <summary>
/// Enables hardware-accelerated rendering for Avalonia
/// </summary>
Expand Down
18 changes: 18 additions & 0 deletions src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,11 @@ public MultiplayerSection()
/// </summary>
public ReactiveObject<bool> RememberWindowState { get; private set; }

/// <summary>
/// Enables or disables the redesigned title bar
/// </summary>
public ReactiveObject<bool> ShowTitleBar { get; private set; }

/// <summary>
/// Enables hardware-accelerated rendering for Avalonia
/// </summary>
Expand All @@ -675,6 +680,7 @@ private ConfigurationState()
ShowConfirmExit = new ReactiveObject<bool>();
IgnoreApplet = new ReactiveObject<bool>();
RememberWindowState = new ReactiveObject<bool>();
ShowTitleBar = new ReactiveObject<bool>();
EnableHardwareAcceleration = new ReactiveObject<bool>();
HideCursor = new ReactiveObject<HideCursorMode>();
}
Expand Down Expand Up @@ -714,6 +720,7 @@ public ConfigurationFileFormat ToFileFormat()
ShowConfirmExit = ShowConfirmExit,
IgnoreApplet = IgnoreApplet,
RememberWindowState = RememberWindowState,
ShowTitleBar = ShowTitleBar,
EnableHardwareAcceleration = EnableHardwareAcceleration,
HideCursor = HideCursor,
EnableVsync = Graphics.EnableVsync,
Expand Down Expand Up @@ -826,6 +833,7 @@ public void LoadDefault()
ShowConfirmExit.Value = true;
IgnoreApplet.Value = false;
RememberWindowState.Value = true;
ShowTitleBar.Value = !OperatingSystem.IsWindows();
EnableHardwareAcceleration.Value = true;
HideCursor.Value = HideCursorMode.OnIdle;
Graphics.EnableVsync.Value = true;
Expand Down Expand Up @@ -1540,6 +1548,15 @@ public void Load(ConfigurationFileFormat configurationFileFormat, string configu
configurationFileUpdated = true;
}

if (configurationFileFormat.Version < 56)
{
Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 56.");

configurationFileFormat.ShowTitleBar = !OperatingSystem.IsWindows();

configurationFileUpdated = true;
}

Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
Graphics.ResScale.Value = configurationFileFormat.ResScale;
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
Expand Down Expand Up @@ -1572,6 +1589,7 @@ public void Load(ConfigurationFileFormat configurationFileFormat, string configu
ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit;
IgnoreApplet.Value = configurationFileFormat.IgnoreApplet;
RememberWindowState.Value = configurationFileFormat.RememberWindowState;
ShowTitleBar.Value = configurationFileFormat.ShowTitleBar;
EnableHardwareAcceleration.Value = configurationFileFormat.EnableHardwareAcceleration;
HideCursor.Value = configurationFileFormat.HideCursor;
Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/ar_SA.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "التحقق من وجود تحديثات عند التشغيل",
"SettingsTabGeneralShowConfirmExitDialog": "إظهار مربع حوار \"تأكيد الخروج\"",
"SettingsTabGeneralRememberWindowState": "تذكر حجم/موضع النافذة",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "إخفاء المؤشر:",
"SettingsTabGeneralHideCursorNever": "مطلقا",
"SettingsTabGeneralHideCursorOnIdle": "عند الخمول",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "Beim Start nach Updates suchen",
"SettingsTabGeneralShowConfirmExitDialog": "Zeige den \"Beenden bestätigen\"-Dialog",
"SettingsTabGeneralRememberWindowState": "Fenstergröße/-position merken",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "Mauszeiger ausblenden",
"SettingsTabGeneralHideCursorNever": "Niemals",
"SettingsTabGeneralHideCursorOnIdle": "Mauszeiger bei Inaktivität ausblenden",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/el_GR.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "Έλεγχος για Ενημερώσεις στην Εκκίνηση",
"SettingsTabGeneralShowConfirmExitDialog": "Εμφάνιση διαλόγου \"Επιβεβαίωση Εξόδου\".",
"SettingsTabGeneralRememberWindowState": "Remember Window Size/Position",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "Απόκρυψη Κέρσορα:",
"SettingsTabGeneralHideCursorNever": "Ποτέ",
"SettingsTabGeneralHideCursorOnIdle": "Απόκρυψη Δρομέα στην Αδράνεια",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "Check for Updates on Launch",
"SettingsTabGeneralShowConfirmExitDialog": "Show \"Confirm Exit\" Dialog",
"SettingsTabGeneralRememberWindowState": "Remember Window Size/Position",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "Hide Cursor:",
"SettingsTabGeneralHideCursorNever": "Never",
"SettingsTabGeneralHideCursorOnIdle": "On Idle",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/es_ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "Buscar actualizaciones al iniciar",
"SettingsTabGeneralShowConfirmExitDialog": "Mostrar diálogo de confirmación al cerrar",
"SettingsTabGeneralRememberWindowState": "Remember Window Size/Position",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "Esconder el cursor:",
"SettingsTabGeneralHideCursorNever": "Nunca",
"SettingsTabGeneralHideCursorOnIdle": "Ocultar cursor cuando esté inactivo",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "Vérifier les mises à jour au démarrage",
"SettingsTabGeneralShowConfirmExitDialog": "Afficher le message de \"Confirmation de sortie\"",
"SettingsTabGeneralRememberWindowState": "Mémoriser la taille/position de la fenêtre",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "Masquer le Curseur :",
"SettingsTabGeneralHideCursorNever": "Jamais",
"SettingsTabGeneralHideCursorOnIdle": "Masquer le curseur si inactif",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/he_IL.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "בדוק אם קיימים עדכונים בהפעלה",
"SettingsTabGeneralShowConfirmExitDialog": "הראה דיאלוג \"אשר יציאה\"",
"SettingsTabGeneralRememberWindowState": "Remember Window Size/Position",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "הסתר את הסמן",
"SettingsTabGeneralHideCursorNever": "אף פעם",
"SettingsTabGeneralHideCursorOnIdle": "במצב סרק",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/it_IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "Controlla aggiornamenti all'avvio",
"SettingsTabGeneralShowConfirmExitDialog": "Mostra dialogo \"Conferma Uscita\"",
"SettingsTabGeneralRememberWindowState": "Remember Window Size/Position",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "Nascondi il cursore:",
"SettingsTabGeneralHideCursorNever": "Mai",
"SettingsTabGeneralHideCursorOnIdle": "Quando è inattivo",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/ja_JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "起動時にアップデートを確認する",
"SettingsTabGeneralShowConfirmExitDialog": "\"終了を確認\" ダイアログを表示する",
"SettingsTabGeneralRememberWindowState": "Remember Window Size/Position",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "マウスカーソルを非表示",
"SettingsTabGeneralHideCursorNever": "決して",
"SettingsTabGeneralHideCursorOnIdle": "アイドル時",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/ko_KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "시작 시, 업데이트 확인",
"SettingsTabGeneralShowConfirmExitDialog": "\"종료 확인\" 대화 상자 표시",
"SettingsTabGeneralRememberWindowState": "창 크기/위치 기억",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "마우스 커서 숨기기",
"SettingsTabGeneralHideCursorNever": "절대 안 함",
"SettingsTabGeneralHideCursorOnIdle": "유휴 상태",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/pl_PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "Sprawdzaj aktualizacje przy uruchomieniu",
"SettingsTabGeneralShowConfirmExitDialog": "Pokazuj okno dialogowe \"Potwierdź wyjście\"",
"SettingsTabGeneralRememberWindowState": "Remember Window Size/Position",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "Ukryj kursor:",
"SettingsTabGeneralHideCursorNever": "Nigdy",
"SettingsTabGeneralHideCursorOnIdle": "Gdy bezczynny",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "Verificar se há atualizações ao iniciar",
"SettingsTabGeneralShowConfirmExitDialog": "Exibir diálogo de confirmação ao sair",
"SettingsTabGeneralRememberWindowState": "Lembrar tamanho/posição da Janela",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "Esconder o cursor do mouse:",
"SettingsTabGeneralHideCursorNever": "Nunca",
"SettingsTabGeneralHideCursorOnIdle": "Esconder o cursor quando ocioso",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/ru_RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "Проверять наличие обновлений при запуске",
"SettingsTabGeneralShowConfirmExitDialog": "Подтверждать выход из приложения",
"SettingsTabGeneralRememberWindowState": "Запомнить размер/положение окна",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "Скрывать курсор",
"SettingsTabGeneralHideCursorNever": "Никогда",
"SettingsTabGeneralHideCursorOnIdle": "В простое",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/th_TH.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "ตรวจหาการอัปเดตเมื่อเปิดโปรแกรม",
"SettingsTabGeneralShowConfirmExitDialog": "แสดง \"ปุ่มยืนยันการออก\" เมื่อออกเกม",
"SettingsTabGeneralRememberWindowState": "จดจำ ขนาดหน้าต่างแอพพลิเคชั่น/คำแหน่ง",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "ซ่อน เคอร์เซอร์:",
"SettingsTabGeneralHideCursorNever": "ไม่ต้อง",
"SettingsTabGeneralHideCursorOnIdle": "เมื่อไม่ได้ใช้งาน",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/tr_TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "Her Açılışta Güncellemeleri Denetle",
"SettingsTabGeneralShowConfirmExitDialog": "\"Çıkışı Onayla\" Diyaloğunu Göster",
"SettingsTabGeneralRememberWindowState": "Remember Window Size/Position",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "İşaretçiyi Gizle:",
"SettingsTabGeneralHideCursorNever": "Hiçbir Zaman",
"SettingsTabGeneralHideCursorOnIdle": "Hareketsiz Durumda",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/uk_UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "Перевіряти наявність оновлень під час запуску",
"SettingsTabGeneralShowConfirmExitDialog": "Показати діалогове вікно «Підтвердити вихід».",
"SettingsTabGeneralRememberWindowState": "Remember Window Size/Position",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "Сховати вказівник:",
"SettingsTabGeneralHideCursorNever": "Ніколи",
"SettingsTabGeneralHideCursorOnIdle": "Сховати у режимі очікування",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "启动时检查更新",
"SettingsTabGeneralShowConfirmExitDialog": "退出游戏时需要确认",
"SettingsTabGeneralRememberWindowState": "记住窗口大小和位置",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "隐藏鼠标指针:",
"SettingsTabGeneralHideCursorNever": "从不隐藏",
"SettingsTabGeneralHideCursorOnIdle": "自动隐藏",
Expand Down
1 change: 1 addition & 0 deletions src/Ryujinx/Assets/Locales/zh_TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"SettingsTabGeneralCheckUpdatesOnLaunch": "啟動時檢查更新",
"SettingsTabGeneralShowConfirmExitDialog": "顯示「確認結束」對話方塊",
"SettingsTabGeneralRememberWindowState": "記住視窗大小/位置",
"SettingsTabGeneralShowTitleBar": "Show Title Bar (Requires restart)",
"SettingsTabGeneralHideCursor": "隱藏滑鼠游標:",
"SettingsTabGeneralHideCursorNever": "從不",
"SettingsTabGeneralHideCursorOnIdle": "閒置時",
Expand Down
3 changes: 3 additions & 0 deletions src/Ryujinx/UI/ViewModels/SettingsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public bool AutoloadDirectoryChanged
public bool ShowConfirmExit { get; set; }
public bool IgnoreApplet { get; set; }
public bool RememberWindowState { get; set; }
public bool ShowTitleBar { get; set; }
public int HideCursor { get; set; }
public bool EnableDockedMode { get; set; }
public bool EnableKeyboard { get; set; }
Expand Down Expand Up @@ -410,6 +411,7 @@ public void LoadCurrentConfiguration()
ShowConfirmExit = config.ShowConfirmExit;
IgnoreApplet = config.IgnoreApplet;
RememberWindowState = config.RememberWindowState;
ShowTitleBar = config.ShowTitleBar;
HideCursor = (int)config.HideCursor.Value;

GameDirectories.Clear();
Expand Down Expand Up @@ -507,6 +509,7 @@ public void SaveSettings()
config.ShowConfirmExit.Value = ShowConfirmExit;
config.IgnoreApplet.Value = IgnoreApplet;
config.RememberWindowState.Value = RememberWindowState;
config.ShowTitleBar.Value = ShowTitleBar;
config.HideCursor.Value = (HideCursorMode)HideCursor;

if (_gameDirectoryChanged)
Expand Down
2 changes: 1 addition & 1 deletion src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<viewModels:MainWindowViewModel />
</Design.DataContext>
<DockPanel HorizontalAlignment="Stretch">
<Border Padding="7, 0, 0, 0" VerticalAlignment="Center" HorizontalAlignment="Center">
<Border Name="RyuLogo" Padding="7, 0, 0, 0" VerticalAlignment="Center" HorizontalAlignment="Center">
<Image
ToolTip.Tip="{Binding Title}"
Height="25"
Expand Down
2 changes: 2 additions & 0 deletions src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public MainMenuBarView()
{
InitializeComponent();

RyuLogo.IsVisible = !ConfigurationState.Instance.ShowTitleBar;

ToggleFileTypesMenuItem.ItemsSource = GenerateToggleFileTypeItems();
ChangeLanguageMenuItem.ItemsSource = GenerateLanguageMenuItems();
}
Expand Down
3 changes: 3 additions & 0 deletions src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<CheckBox IsChecked="{Binding RememberWindowState}">
<TextBlock Text="{locale:Locale SettingsTabGeneralRememberWindowState}" />
</CheckBox>
<CheckBox IsChecked="{Binding ShowTitleBar}" Name="ShowTitleBarBox">
<TextBlock Text="{locale:Locale SettingsTabGeneralShowTitleBar}" />
</CheckBox>
<StackPanel Margin="0, 15, 0, 0" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center"
Text="{locale:Locale SettingsTabGeneralHideCursor}"
Expand Down
3 changes: 2 additions & 1 deletion src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
using Avalonia.VisualTree;
using Ryujinx.Ava.Common.Locale;
using Ryujinx.Ava.UI.ViewModels;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand All @@ -17,6 +17,7 @@ public partial class SettingsUiView : UserControl
public SettingsUiView()
{
InitializeComponent();
ShowTitleBarBox.IsVisible = OperatingSystem.IsWindows();
}

private async void AddGameDirButton_OnClick(object sender, RoutedEventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions src/Ryujinx/UI/Windows/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public MainWindow()

ViewModel.Title = App.FormatTitle();

TitleBar.ExtendsContentIntoTitleBar = true;
TitleBar.TitleBarHitTestType = TitleBarHitTestType.Complex;
TitleBar.ExtendsContentIntoTitleBar = !ConfigurationState.Instance.ShowTitleBar;
TitleBar.TitleBarHitTestType = (ConfigurationState.Instance.ShowTitleBar) ? TitleBarHitTestType.Simple : TitleBarHitTestType.Complex;

// NOTE: Height of MenuBar and StatusBar is not usable here, since it would still be 0 at this point.
StatusBarHeight = StatusBarView.StatusBar.MinHeight;
Expand Down

2 comments on commit 5845787

@DZXTRICKS
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow honestly I'm surprised how much need to be changed just to add a single "simple" functionality.

@GreemDev
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow honestly I'm surprised how much need to be changed just to add a single "simple" functionality.

Yeah, the config system is a bit repetitive.

Please sign in to comment.