diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-03-05 08:57:02 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-10 09:25:57 -0700 |
commit | 160d2ab07155d895991a5198c574fcf26c2e908f (patch) | |
tree | 26dedcc04b7cfe5f6a557d5a7b2113dd7d697be2 /core/qthelper.cpp | |
parent | 626a149b7c6793dea6db1af23068b90205b65e2a (diff) | |
download | subsurface-160d2ab07155d895991a5198c574fcf26c2e908f.tar.gz |
core: make command texts available for C code
Create a C string (which the caller needs to free) with the executed commands
in this session.
The detour via the callback allows us to not make the corelib depend on the
commands, which is nice for tests, export-html, and smtk2ssrf.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/qthelper.cpp')
-rw-r--r-- | core/qthelper.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp index b00201297..05612a4ce 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -46,7 +46,7 @@ static QLocale loc; static inline QString degreeSigns() { - return QStringLiteral("dD\u00b0"); + return QStringLiteral("dD\u00b0"); } QString weight_string(int weight_in_grams) @@ -1644,3 +1644,14 @@ char *copy_qstring(const QString &s) { return strdup(qPrintable(s)); } + +// function to call to get changes for a git commit +QString (*changesCallback)() = nullptr; + +extern "C" char *get_changes_made() +{ + if (changesCallback != nullptr) + return copy_qstring(changesCallback()); + else + return nullptr; +} |