1 |
#ifndef UTIL_H |
2 |
#define UTIL_H |
3 |
|
4 |
#include <QtGlobal> // for debug macros |
5 |
#ifdef QT_DEBUG |
6 |
#include <QDebug> |
7 |
#endif |
8 |
#include <QString> |
9 |
#include <QMessageBox> |
10 |
#include <QFileDialog> |
11 |
#include <QListView> |
12 |
#include <QTreeView> |
13 |
#include <QDesktopServices> |
14 |
#include <QUrl> |
15 |
#include <QCoreApplication> |
16 |
#include <QDesktopWidget> |
17 |
#include <QSettings> |
18 |
#include <QXmlStreamReader> |
19 |
#include <memory> |
20 |
|
21 |
/** |
22 |
Utilities functions (global) |
23 |
**/ |
24 |
namespace Util{ |
25 |
QString normalizePath(QString path); |
26 |
QString cutName(QString path); |
27 |
QString cutNameWithoutBackSlash(QString path); |
28 |
QString insertQuotes(const QString &currString); |
29 |
QString normalizeAndQuote(QString path); |
30 |
QString fullTrim(QString str); |
31 |
QString normalizeDecimalSeparator(QString value); |
32 |
|
33 |
inline const char* qStrToCstr(const QString ¤tString){ |
34 |
return currentString.toUtf8().constData(); |
35 |
} |
36 |
|
37 |
inline const char* boolToCstr(bool currentBoolean){ |
38 |
return currentBoolean ? "true" : "false"; |
39 |
} |
40 |
|
41 |
QStringList multipleDirDialog(QString title); |
42 |
QStringList substring(QString myString,QString separator,Qt::CaseSensitivity cs = Qt::CaseSensitive); |
43 |
int indexOfBackward(QString myString, QString toSearch, int from = -1); |
44 |
bool showQuestionPopUp(QWidget * parent, QString message, QMessageBox::StandardButton standardButton=QMessageBox::NoButton); |
45 |
QMessageBox::StandardButton showQuestionPopUpWithCancel(QWidget * parent, QString message, QMessageBox::StandardButton standardButton=QMessageBox::NoButton); |
46 |
bool checkEmptySpaces(QStringList toCheck); |
47 |
bool checkIfIntegers(QStringList toCheck); |
48 |
bool checkIfDoubles(QStringList toCheck); |
49 |
bool isStringInteger(QString myString); |
50 |
bool isStringDouble(QString myString); |
51 |
bool copyDir(const QString &fromPath, QString toPath, const bool isRecursive = false); |
52 |
bool rmDir(const QString &dirPath); |
53 |
QRect getScreenResolution(); |
54 |
void showPopUp(const QString &message); |
55 |
void showRichPopUp(const QString &message); |
56 |
void showWarningPopUp(const QString &message); |
57 |
void showErrorPopUp(const QString &message); |
58 |
void showRichErrorPopUp(const QString &message); |
59 |
} |
60 |
#endif // UTIL_H |