diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/WhatsApp.pro | 12 | ||||
-rw-r--r-- | src/def.h | 16 | ||||
-rw-r--r-- | src/main.cpp | 1 | ||||
-rw-r--r-- | src/utils.cpp | 1 | ||||
-rw-r--r-- | src/utils.h | 62 |
5 files changed, 52 insertions, 40 deletions
diff --git a/src/WhatsApp.pro b/src/WhatsApp.pro index 8081769..1504a6f 100644 --- a/src/WhatsApp.pro +++ b/src/WhatsApp.pro @@ -39,13 +39,10 @@ DEFINES += QT_DEPRECATED_WARNINGS CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT # Define git info -exists(${QMAKE_FILE_PATH}/../.git) { - GIT_HASH="\\\"$$system(git -C \""$$_PRO_FILE_PWD_"\" rev-parse --short HEAD)\\\"" - GIT_BRANCH="\\\"$$system(git -C \""$$_PRO_FILE_PWD_"\" rev-parse --abbrev-ref HEAD)\\\"" - BUILD_TIMESTAMP="\\\"$$system(date -u +\""%Y-%m-%dT%H:%M:%SUTC\"")\\\"" - DEFINES += GIT_HASH=$$GIT_HASH GIT_BRANCH=$$GIT_BRANCH BUILD_TIMESTAMP=$$BUILD_TIMESTAMP -} - +GIT_HASH="\\\"$$system(git -C \""$$_PRO_FILE_PWD_"\" rev-parse --short HEAD)\\\"" +GIT_BRANCH="\\\"$$system(git -C \""$$_PRO_FILE_PWD_"\" rev-parse --abbrev-ref HEAD)\\\"" +BUILD_TIMESTAMP="\\\"$$system(date -u +\""%Y-%m-%dT%H:%M:%SUTC\"")\\\"" +DEFINES += GIT_HASH=$$GIT_HASH GIT_BRANCH=$$GIT_BRANCH BUILD_TIMESTAMP=$$BUILD_TIMESTAMP # Set program version VERSION = 4.4 @@ -84,6 +81,7 @@ HEADERS += \ autolockeventfilter.h \ automatictheme.h \ common.h \ + def.h \ dictionaries.h \ downloadmanagerwidget.h \ downloadwidget.h \ diff --git a/src/def.h b/src/def.h new file mode 100644 index 0000000..4a17160 --- /dev/null +++ b/src/def.h @@ -0,0 +1,16 @@ +#ifndef DEF_H +#define DEF_H + +#ifndef GIT_HASH + #define GIT_HASH "unknown" +#endif + +#ifndef GIT_BRANCH + #define GIT_BRANCH "unknown" +#endif + +#ifndef BUILD_TIMESTAMP + #define BUILD_TIMESTAMP __TIMESTAMP__ +#endif + +#endif // DEF_H diff --git a/src/main.cpp b/src/main.cpp index db07711..88731a6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,6 +7,7 @@ #include <QtWidgets> #include "common.h" +#include "def.h" #include "mainwindow.h" #include <singleapplication.h> diff --git a/src/utils.cpp b/src/utils.cpp index f8e5dda..7994946 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -1,4 +1,5 @@ #include "utils.h" +#include "def.h" #include <time.h> utils::utils(QObject *parent) : QObject(parent) { setParent(parent); } diff --git a/src/utils.h b/src/utils.h index 3eb697f..10629e9 100644 --- a/src/utils.h +++ b/src/utils.h @@ -1,52 +1,48 @@ #ifndef UTILS_H #define UTILS_H -#include <QObject> -#include <QDebug> -#include <QFileInfo> -#include <QStandardPaths> -#include <QDir> -#include <QTextDocument> -#include <QUuid> #include <QApplication> #include <QDateTime> +#include <QDebug> #include <QDesktopServices> +#include <QDir> +#include <QFileInfo> #include <QMessageBox> +#include <QObject> +#include <QProcess> #include <QProcessEnvironment> #include <QRandomGenerator> #include <QRegularExpression> -#include <QProcess> +#include <QStandardPaths> +#include <QTextDocument> +#include <QUuid> -class utils : public QObject -{ - Q_OBJECT +class utils : public QObject { + Q_OBJECT public: - utils(QObject* parent=0); - virtual ~utils(); + utils(QObject *parent = 0); + virtual ~utils(); public slots: - static QString refreshCacheSize(const QString cache_dir); - static bool delete_cache(const QString cache_dir); - static QString toCamelCase(const QString &s); - static QString generateRandomId(int length); - static QString genRand(int length); - static QString convertSectoDay(qint64 secs); - static QString returnPath(QString pathname, QString standardLocation); - static QString EncodeXML ( const QString& encodeMe ); - static QString DecodeXML ( const QString& decodeMe ); - static QString htmlToPlainText(QString str); - static QString GetEnvironmentVar(const QString &variable_name); - static float RoundToOneDecimal(float number); - void DisplayExceptionErrorDialog(const QString &error_info); - static QString appDebugInfo(); - static void desktopOpenUrl(const QString str); + static QString refreshCacheSize(const QString cache_dir); + static bool delete_cache(const QString cache_dir); + static QString toCamelCase(const QString &s); + static QString generateRandomId(int length); + static QString genRand(int length); + static QString convertSectoDay(qint64 secs); + static QString returnPath(QString pathname, QString standardLocation); + static QString EncodeXML(const QString &encodeMe); + static QString DecodeXML(const QString &decodeMe); + static QString htmlToPlainText(QString str); + static QString GetEnvironmentVar(const QString &variable_name); + static float RoundToOneDecimal(float number); + void DisplayExceptionErrorDialog(const QString &error_info); + static QString appDebugInfo(); + static void desktopOpenUrl(const QString str); private slots: - //use refreshCacheSize - static quint64 dir_size(const QString &directory); - - - + // use refreshCacheSize + static quint64 dir_size(const QString &directory); }; #endif // UTILS_H |