2
* Copyright (C) 2015 Canonical, Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
21
#define TILE_SIZE 256.0
23
// Uncomment it if you want to see tiles boundaries
24
//#define DEBUG_SHOW_TILE_BORDER
26
// Uncomment for benchmarking tile rendering performance
27
//#define DEBUG_TILE_BENCHMARK
29
// Uncomment if you want more verbose application output
30
//#define DEBUG_VERBOSE
33
#include <QStandardPaths>
34
#include <QCoreApplication>
41
static const char* getLibreOfficePath() {
44
// LibreOffice installation path on Debian/Ubuntu
45
QString path = "/usr/lib/libreoffice/program";
47
if (QDir(path).exists()) {
51
// Check if LibreOffice has been provided through a .click package
53
QString libPaths = getenv("LD_LIBRARY_PATH");
55
Q_FOREACH(QString libPath, libPaths.split(":")) {
56
QDir clickDir(libPath);
58
if (clickDir.cd("libreoffice/program")) {
59
QString clickPath = libPath + "/libreoffice/program";
66
if (loPath.isEmpty()) {
67
qDebug() << "LibreOffice binaries not found.";
73
char *data = new char[loPath.toLatin1().size() + 1];
74
strcpy(data, loPath.toLatin1().data());
76
qDebug() << "LibreOffice binaries found at:" << loPath;
82
static const char* getLibreOfficeProfilePath() {
83
QString configLocation = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
84
QString appPkgName = QCoreApplication::organizationDomain();
86
QString profilePath = "file://" + configLocation + "/" + appPkgName + "/libreoffice/4";
88
qDebug() << "LibreOffice profile path:" << profilePath;
90
char *data = new char[profilePath.toLatin1().size() + 1];
91
strcpy(data, profilePath.toLatin1().data());