In a recent post, I explained how to create a Kafka Consumer application with Spring Boot using Spring Cloud Stream with the Kafka Binder. In this installment, I explain how to build the other side of the Kafka connection: the producer.
The main concepts are the same. The most significant change is that instead of a Consumer<T>, you implement a Supplier<T>.
In my WorkTracker application, I store the language files in a folder called “l10n” at the project’s root. The first thing to do is instruct CMake to copy the *.qm files to the app bundle’s “Resource” folder. I have done that before for the app icon, and the process is similar for this kind of file.
// On Linux the translations can be found in /usr/share/worktracker/l10n.
auto l10nPath = "/../share/worktracker/l10n/";
#elif defined (Q_OS_WIN)
// On Windows the translations are in the l10n folder in the exe dir.
auto l10nPath = "/l10n/";
#elif defined (Q_OS_MAC)
// On OS X the data is somewhere in the bundle.
auto l10nPath = "/../Resources/l10n/";
auto appDir = QApplication::applicationDirPath() + l10nPath;
This method returns the absolute path to the “MacOS” folder inside of the bundle, the folder where the application’s binary is located. Appending /../Resources/l10n/ first navigates up to the “Content” folder (via /..), which is more or less the bundle’s “root” directory, and from there, goes to “Resources/l10n”. Finally, the language files are loaded like on Windows, and the translation works as expected.
I hope this was helpful because I could not find much information on this specific topic.
It may come to you as a shocker, but I have never played a point & click adventure game, like the well-known Monkey Island series, for example. It is something I know exists and is beloved, yet I never touched it, despite several releases of the franchise being of my time. Pentiment falls into the same game category, and the coverage I follow had high praise for that title.
So, when I got sick recently, I figured this would be a chill game to pass the time while trying to recover.
The Qt documentation contains all the necessary pieces to create a macOS app bundle. Some steps require CMake configuration, while others require manual labor, i.e., terminal commands. Ideally, you, the developer, want to automate the whole thing and not enter the commands every time you build a release.
You can do that with CMake, and this How-To will show you what to do. I am taking my WorkTracker application as an example since it isn’t just a little toy with an executable binary. It is a fully functional application I use daily at work (albeit on Windows) with icon resources, language files, and several Qt libraries and plugins.
Note: I will not elaborate on the language file topic, as it requires code changes to find the translations in the bundle file. This post focuses on automating the app-bundle creation and setting an application icon.