70.2.1
by Gerry Boland
Add basic application launching ability via C++ |
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 |
||
20 |
// Qt
|
|
21 |
#include <QtCore/QCoreApplication> |
|
22 |
#include <QtCore/QDir> |
|
23 |
||
24 |
inline bool isRunningInstalled() { |
|
25 |
static bool installed = (QCoreApplication::applicationDirPath() == |
|
26 |
QDir(("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@")).canonicalPath()); |
|
27 |
return installed; |
|
28 |
}
|
|
29 |
||
30 |
inline QString shellAppDirectory() { |
|
31 |
if (isRunningInstalled()) { |
|
75.1.1
by Kaleo
Set base url of QQuickView. Needed for UI Toolkit to know where to find the program's resources. |
32 |
return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/"); |
70.2.1
by Gerry Boland
Add basic application launching ability via C++ |
33 |
} else { |
75.1.1
by Kaleo
Set base url of QQuickView. Needed for UI Toolkit to know where to find the program's resources. |
34 |
return QString("@CMAKE_SOURCE_DIR@/"); |
70.2.1
by Gerry Boland
Add basic application launching ability via C++ |
35 |
}
|
36 |
}
|
|
37 |
||
75.3.24
by Gerry Boland
Fix plugin path and install qmldir file so can run from build directory |
38 |
inline QString shellImportPath() { |
39 |
if (isRunningInstalled()) { |
|
40 |
return QString("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/plugins"); |
|
41 |
} else { |
|
42 |
return QString("@CMAKE_BINARY_DIR@/plugins/"); |
|
43 |
}
|
|
44 |
}
|
|
45 |