1
by Michał Sawicz
Inital unity8 commit. |
1 |
/*
|
2 |
* Copyright (C) 2012 Canonical, Ltd.
|
|
3 |
*
|
|
4 |
* Authors:
|
|
5 |
* Ugo Riboni <ugo.riboni@canonical.com>
|
|
6 |
*
|
|
7 |
* This program is free software; you can redistribute it and/or modify
|
|
8 |
* it under the terms of the GNU General Public License as published by
|
|
9 |
* the Free Software Foundation; version 3.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18 |
*/
|
|
19 |
||
2.5.15
by Nick Dedekind
more shuffling around. fixed tests |
20 |
#ifndef PATHS_H
|
21 |
#define PATHS_H
|
|
22 |
||
1
by Michał Sawicz
Inital unity8 commit. |
23 |
// Qt
|
24 |
#include <QtCore/QCoreApplication> |
|
25 |
#include <QtCore/QDir> |
|
2.5.6
by Nick Dedekind
export .indicators files from unity |
26 |
#include <QStandardPaths> |
1
by Michał Sawicz
Inital unity8 commit. |
27 |
|
28 |
inline bool isRunningInstalled() { |
|
29 |
static bool installed = (QCoreApplication::applicationDirPath() == |
|
30 |
QDir(("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@")).canonicalPath()); |
|
31 |
return installed; |
|
32 |
}
|
|
33 |
||
34 |
inline QString translationDirectory() { |
|
35 |
if (isRunningInstalled()) { |
|
36 |
return QString("@CMAKE_INSTALL_PREFIX@/share/locale"); |
|
37 |
} else { |
|
38 |
return QString("@CMAKE_BINARY_DIR@/po/locale"); |
|
39 |
}
|
|
40 |
}
|
|
41 |
||
42 |
inline QString shellAppDirectory() { |
|
43 |
if (isRunningInstalled()) { |
|
44 |
return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/"); |
|
45 |
} else { |
|
46 |
return QString("@CMAKE_SOURCE_DIR@/"); |
|
47 |
}
|
|
48 |
}
|
|
49 |
||
23.42.1
by Michał Sawicz
clean up import paths |
50 |
inline QStringList overrideImportPaths() { |
2.5.24
by Nick Dedekind
moved IndicatorsClient to modules. Fixed debian/control&install for indicators-client |
51 |
QStringList paths; |
23.39.29
by Michał Sawicz
When installed, we should only use fallbacks, not override anything system-wide. |
52 |
if (!isRunningInstalled()) { |
2.5.24
by Nick Dedekind
moved IndicatorsClient to modules. Fixed debian/control&install for indicators-client |
53 |
paths << QString("@CMAKE_BINARY_DIR@/plugins"); |
1
by Michał Sawicz
Inital unity8 commit. |
54 |
}
|
2.5.24
by Nick Dedekind
moved IndicatorsClient to modules. Fixed debian/control&install for indicators-client |
55 |
return paths; |
1
by Michał Sawicz
Inital unity8 commit. |
56 |
}
|
57 |
||
23.42.1
by Michał Sawicz
clean up import paths |
58 |
inline QStringList fallbackImportPaths() { |
59 |
QStringList paths; |
|
1
by Michał Sawicz
Inital unity8 commit. |
60 |
if (isRunningInstalled()) { |
23.39.29
by Michał Sawicz
When installed, we should only use fallbacks, not override anything system-wide. |
61 |
paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_PRIVATE_LIBDIR@/qml"); |
23.42.1
by Michał Sawicz
clean up import paths |
62 |
paths << QString("@CMAKE_INSTALL_PREFIX@/@SHELL_PRIVATE_LIBDIR@/qml/mocks"); |
1
by Michał Sawicz
Inital unity8 commit. |
63 |
} else { |
23.42.1
by Michał Sawicz
clean up import paths |
64 |
paths << QString("@CMAKE_BINARY_DIR@/tests/mocks"); |
1
by Michał Sawicz
Inital unity8 commit. |
65 |
}
|
23.42.1
by Michał Sawicz
clean up import paths |
66 |
return paths; |
1
by Michał Sawicz
Inital unity8 commit. |
67 |
}
|
68 |
||
2.5.6
by Nick Dedekind
export .indicators files from unity |
69 |
inline QStringList shellDataDirs() { |
70 |
QStringList dirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); |
|
2.5.47
by Nick Dedekind
moved indicator cpp source to src folder. |
71 |
if (!isRunningInstalled()) { |
72 |
if (getenv("UNITY_TEST_ENV")==NULL) { |
|
73 |
dirs.prepend("@CMAKE_BINARY_DIR@/share"); |
|
74 |
}
|
|
75 |
}
|
|
76 |
else { |
|
2.5.55
by Nick Dedekind
review comments |
77 |
// append so by default we use xdg files.
|
78 |
dirs.append(shellAppDirectory()); |
|
2.5.6
by Nick Dedekind
export .indicators files from unity |
79 |
}
|
80 |
return dirs; |
|
81 |
}
|
|
82 |
||
1
by Michał Sawicz
Inital unity8 commit. |
83 |
inline QString sourceDirectory() { |
84 |
return QString("@CMAKE_SOURCE_DIR@/"); |
|
85 |
}
|
|
2.5.15
by Nick Dedekind
more shuffling around. fixed tests |
86 |
|
87 |
#endif
|