summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnu Mittal <anu22mittal@gmail.com>2015-02-07 11:57:46 (GMT)
committerAnu Mittal <anu22mittal@gmail.com>2015-02-09 14:09:51 (GMT)
commit1004a6cdae28afc80aec46a29dc4f0b710463628 (patch)
tree3e00a9f7c669996ac7c7014bf1d6751baae9599f
parentf61c1315dfacc43d70abee7d625701b3ff1b72cd (diff)
ported compoundviewer
-rw-r--r--CMakeLists.txt61
-rw-r--r--compoundviewer/CMakeLists.txt23
-rw-r--r--compoundviewer/kalziumglpart.h2
-rw-r--r--compoundviewer/kalziumglwidget.cpp6
-rw-r--r--compoundviewer/libkdeedu_compoundviewer_export.h5
-rw-r--r--compoundviewer/openbabel2wrapper.cpp23
-rw-r--r--compoundviewer/openbabel2wrapper.h7
-rw-r--r--compoundviewer/widgets/CMakeLists.txt6
8 files changed, 80 insertions, 53 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f4ab27b..450ae76 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,37 +1,62 @@
project(kalzium)
+cmake_minimum_required(VERSION 2.8.12)
+
+find_package(ECM 0.0.11 REQUIRED NO_MODULE)
+set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${OPENBABEL2_INCLUDE_DIR} ${PROJECT_SOURCE_DIR}/cmake/modules)
+find_package(OpenBabel2 REQUIRED)
+find_package(Qt5 REQUIRED COMPONENTS Widgets)
+find_package(KF5 REQUIRED COMPONENTS CoreAddons Solid Config)
+find_package(KF5DocTools REQUIRED)
+find_package(Qt5Widgets REQUIRED)
+find_package(PkgConfig REQUIRED)
+find_package(KF5CoreAddons REQUIRED)
+find_package(KF5Config REQUIRED)
+find_package(KF5Solid REQUIRED)
+find_package(ECM REQUIRED)
+find_package(Qt5Core REQUIRED)
+find_package(Qt5Gui REQUIRED)
+find_package(PkgConfig REQUIRED)
+find_package(Qt4 REQUIRED)
+find_package(KF5Archive REQUIRED)
+find_package(KF5I18n NO_MODULE)
+find_package(KF5Parts NO_MODULE)
+find_package(Gettext REQUIRED)
+find_package(PythonInterp REQUIRED)
+find_package(Avogadro REQUIRED)
+find_package(Eigen3 REQUIRED)
+find_package(OpenGL REQUIRED)
+
+include(KDEInstallDirs)
+include(KDECompilerSettings)
+include(FeatureSummary)
+include(ECMInstallIcons)
+include(ECMMarkNonGuiExecutable)
+include_directories(${OPENBABEL2_INCLUDE_DIR} ${AVOGADRO_INCLUDE_DIR} ${OPENGL_INCLUDE_DIRS})
set(CMAKE_MODULE_PATH ${kalzium_SOURCE_DIR}/cmake/modules )
-# search packages used by KDE
-find_package(KDE4 4.6.80 REQUIRED)
+# search packages used by KDE
if(WIN32)
find_package(KDEWIN32 REQUIRED)
# detect oxygen icon dir at configure time based on KDEDIRS - there may be different package installation locations
- execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
- file(TO_CMAKE_PATH "${_dir}" __dir)
- find_path(KDE4_ICON_DIR oxygen PATHS
- ${__dir}
- )
- message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")
+ #execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path icon OUTPUT_VARIABLE _dir #ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+ #file(TO_CMAKE_PATH "${_dir}" __dir)
+ #find_path(KDE4_ICON_DIR oxygen PATHS
+ # ${__dir})
+ # message(STATUS "using oxygen application icons from ${KDE4_ICON_DIR}")
else(WIN32)
- set (KDE4_ICON_DIR ${CMAKE_INSTALL_PREFIX}/share/icons)
+ # set (KDE4_ICON_DIR ${CMAKE_INSTALL_PREFIX}/share/icons)
endif(WIN32)
-include(KDE4Defaults)
-include(MacroLibrary)
-include(MacroOptionalAddSubdirectory)
-include(MacroBoolTo01)
-
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
-include_directories (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} libscience)
+#include_directories (${QDBUS_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} libscience)
if(MSVC)
# for correctly linking openbabel:
# see http://www.mail-archive.com/openbabel-devel@lists.sourceforge.net/msg01975.html
add_definitions(-DUSING_DYNAMIC_LIBS)
endif(MSVC)
-kde4_no_enable_final(kalzium)
include(KalziumConfigureChecks.cmake)
@@ -54,7 +79,7 @@ add_subdirectory(plasmoid)
add_subdirectory(libscience)
add_subdirectory(qml)
-install(FILES kalzium.appdata.xml DESTINATION ${SHARE_INSTALL_PREFIX}/appdata/)
-macro_display_feature_log()
+install(FILES kalzium.appdata.xml DESTINATION ${SHARE_INSTALL_PREFIX}/appdata/)
+feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
diff --git a/compoundviewer/CMakeLists.txt b/compoundviewer/CMakeLists.txt
index 0971248..63c9139 100644
--- a/compoundviewer/CMakeLists.txt
+++ b/compoundviewer/CMakeLists.txt
@@ -1,25 +1,26 @@
include(${Avogadro_USE_FILE})
-include_directories(
- ${CMAKE_CURRENT_BINARY_DIR}/..
+include_directories( ${CMAKE_CURRENT_BINARY_DIR}/..
${EIGEN3_INCLUDE_DIR}
- ${OPENBABEL2_INCLUDE_DIR}
- )
+ ${OPENBABEL2_INCLUDE_DIR} ${OPENGL_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/compoundviewer)
-set( compoundviewer_SRCS
+set(compoundviewer_SRCS
openbabel2wrapper.cpp
kalziumglwidget.cpp
- )
+)
#add_subdirectory(widgets)
-kde4_add_library(compoundviewer SHARED ${compoundviewer_SRCS})
+add_library(compoundviewer SHARED ${compoundviewer_SRCS})
-target_link_libraries(compoundviewer
+target_link_libraries(compoundviewer avogadro
${OPENBABEL2_LIBRARIES}
- ${QT_QTOPENGL_LIBRARY}
- ${KDE4_KDEUI_LIBS}
- avogadro
+ KF5::I18n
+ KF5::WidgetsAddons
+ KF5::CoreAddons
+ Qt5::Core
+${OPENGL_LIBRARIES}
+
)
set_target_properties(compoundviewer PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
diff --git a/compoundviewer/kalziumglpart.h b/compoundviewer/kalziumglpart.h
index 0881df1..f4395cd 100644
--- a/compoundviewer/kalziumglpart.h
+++ b/compoundviewer/kalziumglpart.h
@@ -15,7 +15,7 @@
#ifndef KALZIUMGLPART_H
#define KALZIUMGLPART_H
-#include <kparts/part.h>
+#include <readonlypart.h>
class KalziumGLWidget;
diff --git a/compoundviewer/kalziumglwidget.cpp b/compoundviewer/kalziumglwidget.cpp
index 5e7f592..c1be5d7 100644
--- a/compoundviewer/kalziumglwidget.cpp
+++ b/compoundviewer/kalziumglwidget.cpp
@@ -20,7 +20,8 @@
#include <avogadro/pluginmanager.h>
#include <avogadro/toolgroup.h>
#include <avogadro/engine.h>
-
+#include <QtOpenGL/QGLWidget>
+#include <QWidget>
#include "openbabel2wrapper.h"
#include <config-kalzium.h>
@@ -166,5 +167,4 @@ void KalziumGLWidget::setQuality(int quality)
invalidateDLs();
GLWidget::update();
}
-
-#include "kalziumglwidget.moc"
+//#include "kalziumglwidget.moc"
diff --git a/compoundviewer/libkdeedu_compoundviewer_export.h b/compoundviewer/libkdeedu_compoundviewer_export.h
index d0a6704..da2a210 100644
--- a/compoundviewer/libkdeedu_compoundviewer_export.h
+++ b/compoundviewer/libkdeedu_compoundviewer_export.h
@@ -21,7 +21,8 @@
#define LIBKDEEDU_COMPOUNDVIEWER_EXPORT_H
/* needed for KDE_EXPORT and KDE_IMPORT macros */
-#include <kdemacros.h>
+#include <QtGlobal>
+
#ifndef COMPOUNDVIEWER_EXPORT
# if defined(MAKE_COMPOUNDVIEWER_LIB)
@@ -29,7 +30,7 @@
# define COMPOUNDVIEWER_EXPORT KDE_EXPORT
# else
/* We are using this library */
-# define COMPOUNDVIEWER_EXPORT KDE_IMPORT
+# define COMPOUNDVIEWER_EXPORT Q_DECL_IMPORT
# endif
#endif
diff --git a/compoundviewer/openbabel2wrapper.cpp b/compoundviewer/openbabel2wrapper.cpp
index 85406e1..1e0dd59 100644
--- a/compoundviewer/openbabel2wrapper.cpp
+++ b/compoundviewer/openbabel2wrapper.cpp
@@ -13,10 +13,12 @@
***************************************************************************/
#include "openbabel2wrapper.h"
+#include <QApplication>
+#include <QDebug>
+#include <QLocale>
+#include <QMessageBox>
+#include <KLocalizedString>
-#include <kdebug.h>
-#include <klocale.h>
-#include <KMessageBox>
#include <sstream>
#include <stdio.h>
@@ -29,7 +31,6 @@
#include <QRegExp>
#include <QFile>
-
Avogadro::Molecule* OpenBabel2Wrapper::readMolecule(const QString& filename)
{
OpenBabel::OBConversion Conv;
@@ -40,8 +41,7 @@ Avogadro::Molecule* OpenBabel2Wrapper::readMolecule(const QString& filename)
OpenBabel::OBMol *obmol = new OpenBabel::OBMol;
std::ifstream inFileStream(QFile::encodeName(filename));
if (!inFileStream) {
- KMessageBox::error(0,
- i18n("Problem while opening the file"),
+ QMessageBox::warning(0,i18n("Problem while opening the file"),
i18n("Cannot open the specified file."));
delete mol;
return 0;
@@ -50,8 +50,7 @@ Avogadro::Molecule* OpenBabel2Wrapper::readMolecule(const QString& filename)
//find out which format the file has...
inFormat = Conv.FormatFromExt(QFile::encodeName(filename));
if (!inFormat || !Conv.SetInFormat(inFormat)) {
- KMessageBox::error(0,
- i18n("Cannot read the file format. Check your OpenBabel installation."),
+ QMessageBox::warning(0,i18n("Cannot read the file format. Check your OpenBabel installation."),
i18n("Problem reading file format"));
delete mol;
return 0;
@@ -59,7 +58,7 @@ Avogadro::Molecule* OpenBabel2Wrapper::readMolecule(const QString& filename)
Conv.SetInAndOutFormats(inFormat,inFormat);
Conv.Read(obmol, &inFileStream);
- kDebug() << QString::fromLatin1(obmol->GetFormula().c_str()) << " (Weight: " << obmol->GetMolWt() << ", Title: "<< obmol->GetTitle() << ")";
+ qDebug() << QString::fromLatin1(obmol->GetFormula().c_str()) << " (Weight: " << obmol->GetMolWt() << ", Title: "<< obmol->GetTitle() << ")";
mol->setOBMol(obmol);
return mol;
}
@@ -71,13 +70,13 @@ bool OpenBabel2Wrapper::writeMolecule(const QString& filename, Avogadro::Molecul
std::ofstream outFileStream(QFile::encodeName(filename));
if (!outFileStream) {
- KMessageBox::error(0, i18n("Cannot save to the specified file."));
+ QMessageBox::warning(0,i18n("Sorry"),i18n("Cannot save to the specified file."));
return false;
}
outFormat = Conv.FormatFromExt(QFile::encodeName(filename));
if (!outFormat || !Conv.SetOutFormat(outFormat)) {
- KMessageBox::error(0, i18n("Unrecognized file format extension. Please append an extension to the file name, "
- "for example \".cml\"."));
+ QMessageBox::warning(0, i18n("Unrecognized file format extension. Please append an extension to the file name, "),
+ i18n("for example \".cml\"."));
delete mol;
return false;
}
diff --git a/compoundviewer/openbabel2wrapper.h b/compoundviewer/openbabel2wrapper.h
index f16818f..0883977 100644
--- a/compoundviewer/openbabel2wrapper.h
+++ b/compoundviewer/openbabel2wrapper.h
@@ -18,6 +18,7 @@
//includes for OpenBabel2
#include <openbabel/obconversion.h>
#include <openbabel/mol.h>
+#include <qglobal.h>
#include <avogadro/molecule.h>
#include <libkdeedu_compoundviewer_export.h>
@@ -34,11 +35,11 @@ public:
*/
static Avogadro::Molecule *readMolecule(const QString& filename);
- static bool writeMolecule(const QString& filename, Avogadro::Molecule *);
+ bool writeMolecule(const QString& filename, Avogadro::Molecule *);
- static QString getFormula(Avogadro::Molecule *molecule);
+ QString getFormula(Avogadro::Molecule *molecule);
- static QString getPrettyFormula(Avogadro::Molecule *molecule);
+ QString getPrettyFormula(Avogadro::Molecule *molecule);
};
#endif // OPENBABEL2WRAPPER_H
diff --git a/compoundviewer/widgets/CMakeLists.txt b/compoundviewer/widgets/CMakeLists.txt
index 32f200a..7658056 100644
--- a/compoundviewer/widgets/CMakeLists.txt
+++ b/compoundviewer/widgets/CMakeLists.txt
@@ -7,10 +7,10 @@ set(kalziumui_PART_SRCS
# nothing left here!
)
-kde4_add_widget_files(kalziumui_PART_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/kalziumui.widgets)
+add_widget_files(kalziumui_PART_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/kalziumui.widgets)
-kde4_add_plugin(kalziumuiwidgets ${kalziumui_PART_SRCS})
+add_library(kalziumuiwidgets MODULE ${kalziumui_PART_SRCS})
-target_link_libraries(kalziumuiwidgets ${OPENBABEL2_LIBRARIES} ${QT_QTDESIGNER_LIBRARY} ${KDE4_KDECORE_LIBS})
+target_link_libraries(kalziumuiwidgets ${OPENBABEL2_LIBRARIES} Qt5::Designer KF5::Core)
install(TARGETS kalziumuiwidgets DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/designer)