1 |
#ifndef UTIL_H |
2 |
#define UTIL_H |
3 |
|
4 |
#include <QString> |
5 |
#include <QMessageBox> |
6 |
#include <QFileDialog> |
7 |
#include <QListView> |
8 |
#include <QTreeView> |
9 |
#include <QDesktopServices> |
10 |
#include <QUrl> |
11 |
#include <QCoreApplication> |
12 |
#include <QDesktopWidget> |
13 |
|
14 |
namespace GlobalVars{ |
15 |
|
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 |
} |
43 |
|
44 |
/** |
45 |
Utilities functions (global) |
46 |
**/ |
47 |
namespace Util{ |
48 |
QString normalizePath(QString path); |
49 |
QString cutName(QString path); |
50 |
QString insertQuotes(QString path); |
51 |
QString normalizeAndQuote(QString path); |
52 |
QString fullTrim(QString str); |
53 |
QString normalizeDecimalSeparator(QString value); |
54 |
QString getOSIndependentAppPath(); |
55 |
QString getAppPath(); |
56 |
QString getOniSplitExeName(); |
57 |
QString getXmlToolsExeName(); |
58 |
#ifdef Q_OS_MAC |
59 |
QString getMonoExecutablePath(); |
60 |
#endif |
61 |
|
62 |
QStringList multipleDirDialog(QString title); |
63 |
QStringList substring(QString myString,QString separator,Qt::CaseSensitivity cs = Qt::CaseSensitive); |
64 |
int indexOfBackward(QString myString, QString toSearch, int from = -1); |
65 |
bool showQuestionPopUp(QWidget * parent, QString message, QMessageBox::StandardButton standardButton=QMessageBox::NoButton); |
66 |
bool checkEmptySpaces(QStringList toCheck); |
67 |
bool checkIfIntegers(QStringList toCheck); |
68 |
bool checkIfDoubles(QStringList toCheck); |
69 |
bool isStringInteger(QString myString); |
70 |
bool isStringDouble(QString myString); |
71 |
bool copyDir(QString from_dir, QString to_dir, bool replace_on_conflit); |
72 |
bool rmDir(const QString &dirPath); |
73 |
QRect getScreenResolution(); |
74 |
void showPopUp(QString message); |
75 |
void showRichPopUp(QString message); |
76 |
void showWarningPopUp(QString message); |
77 |
void showErrorPopUp(QString message); |
78 |
void showErrorLogPopUp(QString message); |
79 |
void showRichErrorPopUp(QString message); |
80 |
void openLogFile(); |
81 |
} |
82 |
#endif // UTIL_H |