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> |
14 |
|
#include <QUrl> |
15 |
|
#include <QCoreApplication> |
16 |
|
#include <QDesktopWidget> |
17 |
< |
|
18 |
< |
namespace GlobalVars{ |
19 |
< |
|
16 |
< |
const QString AppVersion="0.9c"; |
17 |
< |
const QString OniSplitString="OniSplit.exe"; |
18 |
< |
const QString XmlToolsString="xmlTools.exe"; |
19 |
< |
|
20 |
< |
#ifdef Q_OS_WIN |
21 |
< |
const QString OniExe="Oni.exe"; |
22 |
< |
#else |
23 |
< |
const QString OniExe="Oni.app/Contents/MacOS/Oni"; |
24 |
< |
#endif |
25 |
< |
|
26 |
< |
const QString AppLogName="logVago.txt"; |
27 |
< |
const QString BuiltOniSplitVersion="0.9.96.0"; |
28 |
< |
const QString BuiltXmlToolsVersion="0.8d"; |
29 |
< |
const QString ModsDomain="mods.oni2.net"; |
30 |
< |
#ifdef Q_OS_WIN |
31 |
< |
const QString VagoNode = "247"; |
32 |
< |
#else |
33 |
< |
const QString VagoNode = "277"; |
34 |
< |
#endif |
35 |
< |
const QString VagoCheckUpdatesUrl="http://"+ModsDomain+"/?q=api/node/"+VagoNode+".json"; |
36 |
< |
const QString VagoWebUrl="http://"+ModsDomain+"/node/"+VagoNode; |
37 |
< |
const QString VagoTemporaryDir=QDir::tempPath()+"/VagoTemp"; |
38 |
< |
const QString HelpDir="help"; |
39 |
< |
const int DefaultWindowWidth=800; |
40 |
< |
const int DefaultWindowHeight=600; |
41 |
< |
const char OniSplitProcSeparator=';'; |
42 |
< |
} |
17 |
> |
#include <QSettings> |
18 |
> |
#include <QXmlStreamReader> |
19 |
> |
#include <memory> |
20 |
|
|
21 |
|
/** |
22 |
|
Utilities functions (global) |
24 |
|
namespace Util{ |
25 |
|
QString normalizePath(QString path); |
26 |
|
QString cutName(QString path); |
27 |
< |
QString insertQuotes(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 |
< |
QString getOSIndependentAppPath(); |
33 |
< |
QString getAppPath(); |
34 |
< |
QString getOniSplitExeName(); |
35 |
< |
QString getXmlToolsExeName(); |
36 |
< |
#ifdef Q_OS_MAC |
37 |
< |
QString getMonoExecutablePath(); |
38 |
< |
#endif |
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); |
47 |
|
bool checkIfDoubles(QStringList toCheck); |
48 |
|
bool isStringInteger(QString myString); |
49 |
|
bool isStringDouble(QString myString); |
50 |
< |
bool copyDir(QString from_dir, QString to_dir, bool replace_on_conflit); |
50 |
> |
bool copyDir(const QString &fromPath, QString toPath, const bool isRecursive = false); |
51 |
|
bool rmDir(const QString &dirPath); |
52 |
|
QRect getScreenResolution(); |
53 |
< |
void showPopUp(QString message); |
54 |
< |
void showRichPopUp(QString message); |
55 |
< |
void showWarningPopUp(QString message); |
56 |
< |
void showErrorPopUp(QString message); |
57 |
< |
void showErrorLogPopUp(QString message); |
79 |
< |
void showRichErrorPopUp(QString message); |
80 |
< |
void openLogFile(); |
53 |
> |
void showPopUp(const QString &message); |
54 |
> |
void showRichPopUp(const QString &message); |
55 |
> |
void showWarningPopUp(const QString &message); |
56 |
> |
void showErrorPopUp(const QString &message); |
57 |
> |
void showRichErrorPopUp(const QString &message); |
58 |
|
} |
59 |
|
#endif // UTIL_H |