summaryrefslogtreecommitdiff
path: root/user/labplot/disable-liborigin.patch
blob: 9fd4e4ba7163f158a98536416197ecd3ebd6c4f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
From d67faf643b2e69c017c21e9d9aaa1fe2d3de6b0e Mon Sep 17 00:00:00 2001
From: Alexander Semke <alexander.semke@web.de>
Date: Wed, 12 Sep 2018 08:46:38 +0200
Subject: Fixed the build with -DENABLE_LIBORIGIN=OFF.

---
 INSTALL                                             |  1 +
 src/CMakeLists.txt                                  |  5 ++++-
 src/kdefrontend/MainWin.cpp                         | 18 +++++++++++++++++-
 src/kdefrontend/datasources/ImportProjectDialog.cpp |  8 ++++++++
 4 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/INSTALL b/INSTALL
index cc2bab9..05dd97b 100644
--- a/INSTALL
+++ b/INSTALL
@@ -41,5 +41,7 @@ To compile LabPlot without optional dependencies even if they are present on the
 -DENABLE_LIBCERF=OFF
 -DENABLE_CANTOR=OFF
+-DENABLE_MQTT=OFF
+-DENABLE_LIBORIGIN=OFF
 
 Note, by switching off these libraries the feature set of LabPlot will be reduced.
 
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ba5763d..892c3c3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -223,7 +223,6 @@ set(BACKEND_SOURCES
 	${BACKEND_DIR}/datasources/filters/ROOTFilter.cpp
 	${BACKEND_DIR}/datasources/projects/ProjectParser.cpp
 	${BACKEND_DIR}/datasources/projects/LabPlotProjectParser.cpp
-	${BACKEND_DIR}/datasources/projects/OriginProjectParser.cpp
 	${BACKEND_DIR}/gsl/ExpressionParser.cpp
 	${BACKEND_DIR}/matrix/Matrix.cpp
 	${BACKEND_DIR}/matrix/matrixcommands.cpp
@@ -271,6 +270,10 @@ set(BACKEND_SOURCES
 	${BACKEND_DIR}/datapicker/DatapickerCurve.cpp
 )
 
+IF (ENABLE_LIBORIGIN)
+	lsit(APPEND BACKEND_SOURCES ${BACKEND_DIR}/datasources/projects/OriginProjectParser.cpp)
+ENDIF ()
+
 set(NSL_SOURCES
 	${BACKEND_DIR}/nsl/nsl_conv.c
 	${BACKEND_DIR}/nsl/nsl_dft.c
diff --git a/src/kdefrontend/MainWin.cpp b/src/kdefrontend/MainWin.cpp
index 6f90d38..f7d6f8b 100644
--- a/src/kdefrontend/MainWin.cpp
+++ b/src/kdefrontend/MainWin.cpp
@@ -37,7 +37,9 @@
 #include "backend/matrix/Matrix.h"
 #include "backend/worksheet/Worksheet.h"
 #include "backend/datasources/LiveDataSource.h"
+#ifdef HAVE_LIBORIGIN
 #include "backend/datasources/projects/OriginProjectParser.h"
+#endif
 #ifdef HAVE_CANTOR_LIBS
 #include "backend/cantorWorksheet/CantorWorksheet.h"
 #endif
@@ -295,7 +297,11 @@ void MainWin::initGUI(const QString& fileName) {
 	connect(&m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(autoSaveProject()));
 
 	if (!fileName.isEmpty()) {
+#ifdef HAVE_LIBORIGIN
 		if (Project::isLabPlotProject(fileName) || OriginProjectParser::isOriginProject(fileName)) {
+#else
+		if (Project::isLabPlotProject(fileName)) {
+#endif
 			QTimer::singleShot(0, this, [=] () { openProject(fileName); });
 		} else {
 			newProject();
@@ -939,7 +945,11 @@ void MainWin::openProject() {
 	KConfigGroup conf(KSharedConfig::openConfig(), "MainWin");
 	const QString& dir = conf.readEntry("LastOpenDir", "");
 	const QString& path = QFileDialog::getOpenFileName(this,i18n("Open project"), dir,
+#ifdef HAVE_LIBORIGIN
 	                      i18n("LabPlot Projects (%1);;Origin Projects (%2)", Project::supportedExtensions(), OriginProjectParser::supportedExtensions()) );
+#else
+	                      i18n("LabPlot Projects (%1)", Project::supportedExtensions()) );
+#endif
 
 	if (path.isEmpty())// "Cancel" was clicked
 		return;
@@ -970,12 +980,14 @@ void MainWin::openProject(const QString& filename) {
 	bool rc = false;
 	if (Project::isLabPlotProject(filename))
 		rc = m_project->load(filename);
+#ifdef HAVE_LIBORIGIN
 	else if (OriginProjectParser::isOriginProject(filename)) {
 		OriginProjectParser parser;
 		parser.setProjectFileName(filename);
 		parser.importTo(m_project, QStringList()); //TODO: add return code
 		rc = true;
 	}
+#endif
 
 	if (!rc) {
 		closeProject();
@@ -1718,7 +1730,11 @@ void MainWin::dropEvent(QDropEvent* event) {
 		QUrl url = event->mimeData()->urls().at(0);
 		const QString& f = url.toLocalFile();
 
+#ifdef HAVE_LIBORIGIN
 		if (Project::isLabPlotProject(f) || OriginProjectParser::isOriginProject(f))
+#else
+		if (Project::isLabPlotProject(f))
+#endif
 				openProject(f);
 		else {
 			if (!m_project)
diff --git a/src/kdefrontend/datasources/ImportProjectDialog.cpp b/src/kdefrontend/datasources/ImportProjectDialog.cpp
index 85cbf34..5216127 100644
--- a/src/kdefrontend/datasources/ImportProjectDialog.cpp
+++ b/src/kdefrontend/datasources/ImportProjectDialog.cpp
@@ -111,8 +111,10 @@ ImportProjectDialog::ImportProjectDialog(MainWin* parent, ProjectType type) : QD
 		title = i18n("Import LabPlot Project");
 		break;
 	case (ProjectOrigin):
+#ifdef HAVE_LIBORIGIN
 		m_projectParser = new OriginProjectParser();
 		title = i18n("Import Origin Project");
+#endif
 		break;
 	}
 
@@ -234,8 +236,10 @@ void ImportProjectDialog::importTo(QStatusBar* statusBar) const {
 	timer.start();
 	connect(m_projectParser, SIGNAL(completed(int)), progressBar, SLOT(setValue(int)));
 
+#ifdef HAVE_LIBORIGIN
 	if (m_projectType == ProjectOrigin && ui.chbUnusedObjects->isVisible() && ui.chbUnusedObjects->isChecked())
 		reinterpret_cast<OriginProjectParser*>(m_projectParser)->setImportUnusedObjects(true);
+#endif
 
 	m_projectParser->importTo(targetFolder, selectedPathes);
 	statusBar->showMessage( i18n("Project data imported in %1 seconds.", (float)timer.elapsed()/1000) );
@@ -251,6 +255,7 @@ void ImportProjectDialog::refreshPreview() {
 	QString project = ui.leFileName->text();
 	m_projectParser->setProjectFileName(project);
 
+#ifdef HAVE_LIBORIGIN
 	if (m_projectType == ProjectOrigin) {
 		OriginProjectParser* originParser = reinterpret_cast<OriginProjectParser*>(m_projectParser);
 		if (originParser->hasUnusedObjects())
@@ -260,6 +265,7 @@ void ImportProjectDialog::refreshPreview() {
 
 		originParser->setImportUnusedObjects(ui.chbUnusedObjects->isVisible() && ui.chbUnusedObjects->isChecked());
 	}
+#endif
 
 	ui.tvPreview->setModel(m_projectParser->model());
 
@@ -349,9 +355,11 @@ void ImportProjectDialog::selectFile() {
 		supportedFormats = i18n("LabPlot Projects (%1)", Project::supportedExtensions());
 		break;
 	case (ProjectOrigin):
+#ifdef HAVE_LIBORIGIN
 		title = i18n("Open Origin Project");
 		lastDirConfEntryName = QLatin1String("LastImportOriginProjecttDir");
 		supportedFormats = i18n("Origin Projects (%1)", OriginProjectParser::supportedExtensions());
+#endif
 		break;
 	}
 
-- 
cgit v0.11.2