From d67faf643b2e69c017c21e9d9aaa1fe2d3de6b0e Mon Sep 17 00:00:00 2001 From: Alexander Semke 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(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(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