diff options
-rw-r--r-- | commands/command_base.cpp | 4 | ||||
-rw-r--r-- | core/qthelper.cpp | 13 | ||||
-rw-r--r-- | core/qthelper.h | 4 |
3 files changed, 19 insertions, 2 deletions
diff --git a/commands/command_base.cpp b/commands/command_base.cpp index 1f924378b..d13daf269 100644 --- a/commands/command_base.cpp +++ b/commands/command_base.cpp @@ -8,10 +8,14 @@ namespace Command { static QUndoStack undoStack; +// forward declaration +QString changesMade(); + // General commands void init() { QObject::connect(&undoStack, &QUndoStack::cleanChanged, &updateWindowTitle); + changesCallback = &changesMade; } void clear() 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; +} diff --git a/core/qthelper.h b/core/qthelper.h index 4c3a6aa19..c91712716 100644 --- a/core/qthelper.h +++ b/core/qthelper.h @@ -83,6 +83,8 @@ QVector<QPair<QString, int>> selectedDivesGasUsed(); QString getUserAgent(); QString printGPSCoords(const location_t *loc); +extern QString (*changesCallback)(); + #if defined __APPLE__ #define TITLE_OR_TEXT(_t, _m) "", _t + "\n" + _m #else @@ -150,7 +152,7 @@ depth_t string_to_depth(const char *str); pressure_t string_to_pressure(const char *str); volume_t string_to_volume(const char *str, pressure_t workp); fraction_t string_to_fraction(const char *str); - +char *get_changes_made(); #ifdef __cplusplus } #endif |