Allow bundling translations as resources by setting `BUILTIN_TRANSLATIONS`.
This is useful to create self-contained executables.
The code for this is already in qtutilities so we basically just need to
look within the resource root `:/` for translations as well and tweak the
build script a little.
With this change it is still possible to load translations separately from
the usual locations as it is only effective if `BUILTIN_TRANSLATIONS` is
set to a truthy value.
This way the executable not only gets an icon but also an application name,
a description, an author and the version as meta-data - without any
additional CMake code in pianobooster itself.
Using `CMAKE_INSTALL_DATAROOTDIR` was not the best idea because it might be
empty. Let's just use hard-code `share/games` for now in accordance with
existing code.
* Simplify code and improve style
* Use QRegularExpression instead of deprecated QRegExp
* Use QStringLiteral and QLatin1String where appropriate
* Avoid compiling the regex in every loop iteration
* Avoid hard-coding prefix at build time; always use a relative path so the
build can always be relocated and not AppImage-specific code is needed
* Avoid special handling for MacOS every time the data directory is used;
handle the case of MacOS in the utility function itself
It is likely best to apply these settings before instantiating the main
window. So this change moves out the instantiation of settings objects to
the main function.
Classes inheriting from `QObject` must use the `Q_OBJECT` macro. This was
not the case and thus causing warnings. Since the `QObject` base class was
not utilized here anyways except for `tr()` I simply removed the that
inheritance.
* Simplify code
* Set meta-data for Qt application via helpers from c++utilities and
qtutilities
* Set sensible default settings for Qt via helper from qtutilities for more
modern behavior regarding High DPI scaling and theming, e.g. for better
dark mode support under Windows 11
* Prepare use of qtutilities for improving UI
* Remove code for enabling warnings that has been copied from c++utilities
* Remove code for various details now handled in qtutilities helpers
* Simplify configuration of executable
* Simplify finding Qt modules
* Allow selecting between built-in themes via "View" menu
* Add basic mechanism to apply color changes at runtime
* Add a basic light theme (needs still tweaking)
* Link against FluidSynth at all (not sure how the Windows build has with
FluidSynth enabled has ever been working without actually linking to the
FluidSynth's library)
* The imported target of FluidSynth does not automatically make the targets
it depends on available. So we need to find the according packages
manually.
Using `using namespace std;` is a bad practice, especially in header files
as it can lead to name collisions. In this case `std::byte` (from C++ 17)
collided with `typedef unsigned char byte` (from the Windows header
`rpcndr.h`) leading to many build errors.
Apparently FTGL's CMake find module does not pull in the include path for
FreeType 2 headers automatically. So we need to do that manually on our
own. This code is relying on pkg-config for finding the include path. As
pkg-config has been intentionally avoided for Windows builds I only enabled
this for mingw-w64 builds so far (where pkg-config is usually available).