And adapt a new CMakeLists.txt file for it. On the way I've also
found out that we where double-compilling a few files. I've also
set the subsurface-core as a include_path but that was just to
reduce the noise on this commit, since I plan to remove it from
the include path to make it obligatory to specify something like
include "subsurface-core/dive.h"
for the header files. Since the app is growing quite a bit we ended
up having a few different files with almost same name that did
similar things, I want to kill that (for instance Dive.h, dive.h,
PrintDive.h and such).
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I know everyone will hate it.
Go ahead. Complain. Call me names.
At least now things are consistent and reproducible.
If you want changes, have your complaint come with a patch to
scripts/whitespace.pl so that we can automate it.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Interpreting UTF8 encoded strings using tr() instead of trUtf8()
and encoding the string back to utf8 again leads to serious encoding
errors.
Fixes#230
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
if trGettext() gets called with a *text that resides
in the stack, the QHash will return incorrect values after
the second call of trGettext() with that *text.
Example (assuming nothing has been translated):
void func(const char *text) {
char *translated = trGettext(text);
doSomethingWith(translated);
}
func("foo"); (1)
func("bar"); (2)
(1) *translated is "foo"
(2) *translated should be "bar" but is "foo" because
the key (const char*) points to the value "foo"
which has been set in the previous call (1).
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
Just to make sure there's no confusion - we are NOT calling gettext. We
are calling tr from a gettext like interface.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead use a hash to cache the translations (and allow for the ability to
clear the hash so we can even switch translations at runtime...).
Now Qt will keep track of the memory and release it for us when we are
done with it.
This avoids the memory leak introduced in commit 4ecb35bf5ff2 ("Make a
copy of the translated text").
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>