~fboucault/unity-2d/declarative_view_global_pos

99 by Aurelien Gateau
No more hardcoded /usr
1
#define INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
360.1.9 by Florian Boucault
Fixed up left over unityqt references (forgot to use s//n)
2
#define UNITY_2D_DIR "${UNITY_2D_DIR}"
284.1.10 by Florian Boucault
Respect camelCasing for variables.
3
#define UNITY_DIR "${UNITY_DIR}"
284.1.1 by Florian Boucault
Deprecated THEME_DIR.
4
5
#include <QCoreApplication>
6
284.1.7 by Florian Boucault
QCoreApplication::applicationDirPath() needs to be called after QApplication
7
inline bool isRunningInstalled() {
284.1.10 by Florian Boucault
Respect camelCasing for variables.
8
    static bool cachedResult = QCoreApplication::applicationDirPath() == INSTALL_PREFIX "/bin";
9
    return cachedResult;
284.1.7 by Florian Boucault
QCoreApplication::applicationDirPath() needs to be called after QApplication
10
}
284.1.1 by Florian Boucault
Deprecated THEME_DIR.
11
360.1.2 by Florian Boucault
Renamed unityQt into unity2d
12
inline QString unity2dDirectory() {
284.1.7 by Florian Boucault
QCoreApplication::applicationDirPath() needs to be called after QApplication
13
    if (isRunningInstalled()) {
360.1.1 by Florian Boucault
Renamed UNITY_QT_ into UNITY_2D_
14
        return QString(INSTALL_PREFIX "/" UNITY_2D_DIR);
284.1.10 by Florian Boucault
Respect camelCasing for variables.
15
    } else {
284.1.1 by Florian Boucault
Deprecated THEME_DIR.
16
        return QString(QCoreApplication::applicationDirPath()+"/../../");
17
    }
18
}
19
360.1.2 by Florian Boucault
Renamed unityQt into unity2d
20
inline QString unity2dImportPath() {
284.1.7 by Florian Boucault
QCoreApplication::applicationDirPath() needs to be called after QApplication
21
    if (isRunningInstalled()) {
284.1.1 by Florian Boucault
Deprecated THEME_DIR.
22
        return QString(INSTALL_PREFIX "/lib/qt4/imports");
284.1.10 by Florian Boucault
Respect camelCasing for variables.
23
    } else {
284.1.1 by Florian Boucault
Deprecated THEME_DIR.
24
        return QString(QCoreApplication::applicationDirPath()+"/../");
25
    }
26
}