aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLibravatar Keshav Bhatt <keshavnrj@gmail.com>2022-06-24 17:57:54 +0530
committerLibravatar Keshav Bhatt <keshavnrj@gmail.com>2022-06-24 17:57:54 +0530
commit14f190c03bba24aafb22f85134fb85d9b3ddf4ab (patch)
treedb725d946fb4973d413bf4d971a896965d58dc79 /src
parent91d0cf1138ca52d4208aad49a753122b231d8a01 (diff)
downloadwhatsie-14f190c03bba24aafb22f85134fb85d9b3ddf4ab.tar.gz
whatsie-14f190c03bba24aafb22f85134fb85d9b3ddf4ab.zip
chore: define fallback values for macros
Diffstat (limited to 'src')
-rw-r--r--src/WhatsApp.pro12
-rw-r--r--src/def.h16
-rw-r--r--src/main.cpp1
-rw-r--r--src/utils.cpp1
-rw-r--r--src/utils.h62
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