Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Qt-based config editor #3982

Merged
merged 36 commits into from
Aug 30, 2024
Merged

Add Qt-based config editor #3982

merged 36 commits into from
Aug 30, 2024

Conversation

neobrain
Copy link
Member

@neobrain neobrain commented Aug 20, 2024

Background

(Screenshots below)

Dear ImGui can be a great tool for quick prototyping and overlay GUIs. Conversely, it's also an unsuitable option for creating GUIs of moderate complexity without sacrificing usability and accessibility. This is acknowledged by the author of Dear ImGui himself, and will likely never change:

I do know that Dear ImGui unfortunately does not align with requirements of accessible software. It was designed as a technical/debug tooling software to be used as an overlay over 3d/graphics applications which themselves tends to have little to no accessibility features. It's not really my fault that people have started using it for desktop-ey applications. If you do use it for a tool please be mindful the tool won't be accessible to most screen readers

Historically Dear ImGui may have been a suitable tool for FEX when there was still a built-in debugger. Nowdays we only use it for FEXConfig, for which it provides no benefit over other desktop toolkits, while having all of the downsides of an immediate-mode framework.

This PR adds a rewrite of FEXConfig based on Qt, a widely available framework with decades of development progress. During the rewrite, I've also cleaned up and restructured some of the settings to make things easier to configure overall. The new application ships as its own binary, called FEXQonfig must be enabled by setting USE_FEXCONFIG_TOOLKIT=qt via CMake.

Improvements over current FEXConfig

  • Look and Feel matching the system:
    • Font rendering: Anti-aliasing, font type, size, ...
    • Keyboard navigation (tabs, file menu, ...)
    • Styling (color theme, native controls, ...)
  • Architectural support for accessibility (screen reader, keyboard navigation, ...)
  • Native filesystem browser (file picker available in more places than before)
    • All path settings can be configured with this dialog now
  • More robust widgets:
    • E.g. dialogs are somehow really glitchy with Dear ImGui (might be a bug in how FEX uses them?)
  • Can be built without a custom ImGui fork, opening up the way for dropping another External
  • AppConfig support made more straightforward
    • Not sure if anyone uses this, since current FEXConfig behaves very quirky
    • Qt provides "tri-state" checkboxes that clearly highlight which settings aren't set in an AppConfig
    • It's easier to delete individual settings in the "Advanced" tab now
    • Overall, this makes it much easier to create minimal config files in a GUI
  • Code-wise, a declarative framework offers better separation of concerns by isolating the UI code from the config management logic
  • In principle we can add Übersetzungen des traductions translations!

Current state

FEXQonfig is roughly on feature-parity with FEXConfig while already offering a much more polished UX. Some things (documented via TODOs) still need to be implemented, and I haven't done much testing yet, so backing up Config.json is advised. For now, I figured I'd throw it out there to see whether it's worth finishing.

To test the Qt6 build on Ubuntu, I had to install the following packages:

qt6-declarative-dev
qt6-wayland
qml6-module-qtquick-dialogs
qml6-module-qtquick-templates
qml6-module-qtquick-window
qml6-module-qt-labs-folderlistmodel

Screenshots

Paths selectable via file dialog; special logging targets are selectable from a combobox;
2024_08_20_fexqonfic1

TSO options are restructured:
2024_08_20_fexqonfic2

2024_08_20_fexqonfic3

The settings list is now type-aware and provides checkboxes/spinboxes where appropriate:
2024_08_20_fexqonfic4

Tri-state buttons are used to highlight settings deleted from a config. Other controls (like comboboxes) are deselected or disabled:
2024_08_20_fexqonfic5

@Conan-Kudo
Copy link

Thank you so much for this! 🥇

Comment on lines 7 to 13
find_package(Qt5 COMPONENTS Qml Quick Widgets)
if (Qt5_FOUND)
add_subdirectory(FEXQonfig/)
endif()

Choose a reason for hiding this comment

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

Can we please use Qt 6 instead here? Qt 5 OSS is effectively EOL.

Copy link
Member Author

@neobrain neobrain Aug 20, 2024

Choose a reason for hiding this comment

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

Sadly Kubuntu 24.04 LTS ships Qt 5 by default and figuring out what Qt 6 packages must be installed to compile FEXQonfig (and to not make it use the fallback theme!) seems to be nontrivial.

Supporting both simultaneously (and preferring Qt 6 over 5) should hopefully be possible without too much extra work though. The main breaking changes are in the Dialog APIs, which we should be able to handle via abstraction however.

Copy link
Member Author

Choose a reason for hiding this comment

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

I created a compatibility module to deal with the dialogs (surprisingly tricky to make Qt conditionally import the right one). Both Qt 5 and Qt 6 are supported now!

My testing with Qt 6 was limited due to what Ubuntu currently packages, so feel free to give it a spin if you want :)

id: openFileDialog
title: qsTr("Open FEX configuration")
nameFilters: [ "Config files(*.json)", "All files(*)" ]
// TODO: Set default folder to ~/.fex-emu?
Copy link

Choose a reason for hiding this comment

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

Or even better, ~/.config/fex-emu/

Copy link
Member Author

Choose a reason for hiding this comment

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

You're not wrong. I'm not actually sure why we aren't yet using XDG_CONFIG_HOME for the config.

Copy link
Collaborator

Choose a reason for hiding this comment

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

^ currently FEX uses it if it's explicitly set, but defaults to ~/.fex-emu

}
}

// Advanced settings
Copy link

Choose a reason for hiding this comment

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

It would also be nice to add a small help/description for them I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, though for now I'm just aiming to rebuild functionality that already exists (plus some things that were easy to add).

We already have descriptions written down in the Config.json file, but they're not readily available in C++ code yet, so this would need more work.

@@ -3,6 +3,14 @@ add_subdirectory(CommonTools)
if (NOT MINGW_BUILD)
if (BUILD_FEXCONFIG)
add_subdirectory(FEXConfig/)

Choose a reason for hiding this comment

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

Can we have a conditional so that we can only build this variant and not the other?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds reasonable. BUILD_FEXCONFIG is now called USE_FEXCONFIG_TOOLKIT and can be set to either ""/"qt"/"imgui". Since it's an exclusive choice, FEXQonfig has been renamed to FEXConfig.

@neobrain neobrain marked this pull request as ready for review August 27, 2024 16:11
@neobrain
Copy link
Member Author

This is on feature-parity with the existing FEXConfig now.

We could make it the default already but the CI runners don't have Qt libraries installed (qtdeclarative5-dev).

@Sonicadvance1
Copy link
Member

Image_2024-08-27_22-49-33
The rootfs list should scroll, since it consumes the whole window otherwise and it's hard to tell that there is more available in the window.

@neobrain
Copy link
Member Author

The rootfs list should scroll, since it consumes the whole window otherwise and it's hard to tell that there is more available in the window.

Ah yes, I limited the list's maximum height to around 4-6 items now (depending on the system theme). After that, it will display a scroll bar while leaving the two buttons visible.

@Sonicadvance1
Copy link
Member

Image_2024-08-28_01-02-35
Quite a bit better now

@@ -7,7 +7,7 @@ CHECK_INCLUDE_FILES ("gdb/jit-reader.h" HAVE_GDB_JIT_READER_H)
option(BUILD_TESTS "Build unit tests to ensure sanity" TRUE)
option(BUILD_FEX_LINUX_TESTS "Build FEXLinuxTests, requires x86 compiler" FALSE)
option(BUILD_THUNKS "Build thunks" FALSE)
option(BUILD_FEXCONFIG "Build FEXConfig, requires SDL2 and X11" TRUE)
set(USE_FEXCONFIG_TOOLKIT "imgui" CACHE STRING "If set, build FEXConfig (qt or imgui)")

Choose a reason for hiding this comment

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

Do we want to make qt the default before merging it?

Copy link
Member

Choose a reason for hiding this comment

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

We'll need to update our CI machines before it can be switched to default. Setting the cmake option until then should be fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also probably doesn't hurt to ship this as opt-in for one release, just in case edge case bugs come up :)

@neobrain neobrain merged commit 3020a0d into FEX-Emu:main Aug 30, 2024
12 checks passed
@neobrain neobrain deleted the feature_fexqonfic branch August 30, 2024 08:43
@neobrain
Copy link
Member Author

Gave this a final spin with a proper Qt 6 + Plasma 6 installation on openSUSE, working all fine. Let's do this!

Screenshot_20240829_115411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants