aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorLibravatar keshavbhatt <keshavnrj@gmail.com>2021-04-05 02:11:25 +0530
committerLibravatar keshavbhatt <keshavnrj@gmail.com>2021-04-05 02:11:25 +0530
commit9ea334d08f42f3c362e86499dc3c0ed658bb428c (patch)
tree85eb15c519bcff8a5e3c4f8406f068b7c412b789 /src/utils.h
parente79b447b31ad9ab1ed42fd232f8789fad38d780b (diff)
downloadwhatsie-9ea334d08f42f3c362e86499dc3c0ed658bb428c.tar.gz
whatsie-9ea334d08f42f3c362e86499dc3c0ed658bb428c.zip
src init
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
new file mode 100644
index 0000000..9d2520f
--- /dev/null
+++ b/src/utils.h
@@ -0,0 +1,85 @@
+#ifndef UTILS_H
+#define UTILS_H
+
+#include <QObject>
+#include <QDebug>
+#include <QFileInfo>
+#include <QStandardPaths>
+#include <QDir>
+#include <QTextDocument>
+#include <QUuid>
+
+class utils : public QObject
+{
+ Q_OBJECT
+
+public:
+ 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);
+
+ static QString EncodeXML ( const QString& encodeMe ){
+
+ QString temp;
+ int length = encodeMe.size();
+ for (int index = 0; index < length; index++)
+ {
+ QChar character(encodeMe.at(index));
+
+ switch (character.unicode())
+ {
+ case '&':
+ temp += "&amp;"; break;
+
+ case '\'':
+ temp += "&apos;"; break;
+
+ case '"':
+ temp += "&quot;"; break;
+
+ case '<':
+ temp += "&lt;"; break;
+
+ case '>':
+ temp += "&gt;"; break;
+
+ default:
+ temp += character;
+ break;
+ }
+ }
+
+ return temp;
+ }
+
+ static QString DecodeXML ( const QString& decodeMe ) {
+
+ QString temp(decodeMe);
+
+ temp.replace("&amp;", "&");
+ temp.replace("&apos;", "'");
+ temp.replace("&quot;", "\"");
+ temp.replace("&lt;", "<");
+ temp.replace("&gt;", ">");
+
+ return temp;
+ }
+
+ static QString htmlToPlainText(QString str);
+
+private slots:
+ //use refreshCacheSize
+ static quint64 dir_size(const QString &directory);
+
+
+
+};
+
+#endif // UTILS_H