~mzanetti/unity8/panel-button-fixes

« back to all changes in this revision

Viewing changes to include/paths.h.in

  • Committer: CI Train Bot
  • Author(s): Albert Astals Cid, Michał Sawicz
  • Date: 2015-09-22 12:57:02 UTC
  • mfrom: (1752.8.47 origin/autopkgtests)
  • Revision ID: ci-train-bot@canonical.com-20150922125702-wboqbqanpto9l9s2
Add DEP-8 test for all our UI and unit tests

Some refactoring was needed:
- added a basic Ubuntu.Web mock
- made plugin path an environment, not a compiled-in bit
- moved Unity.Application resources into .qrc

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    return installed;
34
34
}
35
35
 
 
36
inline QString buildDirectory() {
 
37
    if (!qEnvironmentVariableIsEmpty("UNITY_BINARY_DIR")) return qgetenv("UNITY_BINARY_DIR");
 
38
    return QString("@CMAKE_BINARY_DIR@");
 
39
}
 
40
 
 
41
inline QString sourceDirectory() {
 
42
    if (!qEnvironmentVariableIsEmpty("UNITY_SOURCE_DIR")) return qgetenv("UNITY_SOURCE_DIR");
 
43
    return QString("@CMAKE_SOURCE_DIR@");
 
44
}
 
45
 
36
46
inline QString translationDirectory() {
37
47
    if (isRunningInstalled()) {
38
48
        return QString("@CMAKE_INSTALL_PREFIX@/share/locale");
39
49
    } else {
40
 
        return QString("@CMAKE_BINARY_DIR@/po/locale");
 
50
        return QString(buildDirectory() + "/po/locale");
41
51
    }
42
52
}
43
53
 
45
55
    if (isRunningInstalled()) {
46
56
        return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
47
57
    } else {
48
 
        return QString("@CMAKE_SOURCE_DIR@/qml/");
 
58
        return QString(sourceDirectory() + "/qml");
49
59
    }
50
60
}
51
61
 
52
62
inline QStringList overrideImportPaths() {
53
63
    QStringList paths;
54
64
    if (!isRunningInstalled()) {
55
 
        paths << QString("@CMAKE_BINARY_DIR@/plugins");
 
65
        paths << QString(buildDirectory() + "/plugins");
56
66
    }
57
67
    return paths;
58
68
}
62
72
    if (isRunningInstalled()) {
63
73
        paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/nonmirplugins");
64
74
    } else {
65
 
        paths << QString("@CMAKE_BINARY_DIR@/nonmirplugins");
 
75
        paths << QString(buildDirectory() + "/nonmirplugins");
66
76
    }
67
77
    return paths;
68
78
}
77
87
    } else {
78
88
        paths << QString("@USS_PRIVATE_PLUGINDIR@");
79
89
        paths << QString("@SHELL_PLUGINDIR@");
80
 
        paths << QString("@CMAKE_BINARY_DIR@/tests/mocks");
 
90
        paths << QString(buildDirectory() + "/tests/mocks");
81
91
    }
82
92
    return paths;
83
93
}
86
96
    if (isRunningInstalled()) {
87
97
        return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_INSTALL_QML@/mocks");
88
98
    } else {
89
 
        return QString("@CMAKE_BINARY_DIR@/tests/mocks");
 
99
        return QString(buildDirectory() + "/tests/mocks");
90
100
    }
91
101
}
92
102
 
99
109
    return dirs;
100
110
}
101
111
 
102
 
inline QString sourceDirectory() {
103
 
    return QString("@CMAKE_SOURCE_DIR@/");
104
 
}
105
 
 
106
112
inline void prependImportPaths(QQmlEngine *engine, const QStringList &paths)
107
113
{
108
114
    QStringList importPathList = engine->importPathList();