]> Git trees. - libqmvoc.git/commitdiff
* Ok, I still see no real way to test my KPart-code but this might
authorCarsten Niehaus <cniehaus@gmx.de>
Sun, 26 Nov 2006 12:35:19 +0000 (12:35 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Sun, 26 Nov 2006 12:35:19 +0000 (12:35 +0000)
  work. I will move it to libkdeedu as Kalzium is not using this
  code anyway. There, I will code a small mini-demo application
  to test the KPart-stuff.

  So eventually Konq will be able to display molecules in 3D by
  using Kalziums 3D code (which is 99.999% done by Benoit Jacob)

svn path=/trunk/KDE/kdeedu/kalzium/src/kalziumglpart.cpp; revision=607947

kalzium/kalziumgl_part.desktop
kalzium/kalziumglpart.cpp
kalzium/kalziumglpart.h

index 95222f457db3ec8fefb84279ef40fd4df388a260..c2dda429de9eabea84e29f1c4f4d380f0dfb580f 100644 (file)
@@ -2,9 +2,8 @@
 Encoding=UTF-8
 Icon=kalzium
 MimeType=application/x-ogg;audio/basic;
-Name=KalziumGL
+Name=KalziumGLPart
 Comment=An OpenGL-based 3D-renderer for molecules
 ServiceTypes=KParts/ReadOnlyPart
 Type=Service
 X-KDE-Library=libkalziumglpart
-InitialPreference=9
index 271ffdb34ba866114ccacae5c953ed6488341ba0..009eed1e27f5850cf1a6de34736e684f1821ba67 100644 (file)
@@ -1,8 +1,23 @@
+/***************************************************************************
+    copyright            : (C) 2006 by Carsten Niehaus
+    email                : cniehaus@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
 #include <kparts/genericfactory.h>
 
 #include <QStringList>
 
 #include "kalziumglpart.h"
+#include "openbabel2wrapper.h"
+#include "kalziumglwidget.h"
 
 typedef KParts::GenericFactory<KalziumGLPart> KalziumGLPartFactory;
 
@@ -11,6 +26,9 @@ K_EXPORT_COMPONENT_FACTORY (libkalziumglpart, KalziumGLPartFactory)
 KalziumGLPart::KalziumGLPart(QWidget* parentWidget, QObject* parent, const QStringList& args)
 {
     kDebug() << "KalziumGLPart::KalziumGLPart()" << endl;
+
+    m_widget = new KalziumGLWidget();
+    m_widget->setObjectName("KalziumGLWidget-KPart");
 }
 
 KalziumGLPart::~KalziumGLPart()
@@ -30,13 +48,13 @@ KAboutData *KalziumGLPart::createAboutData()
     return aboutData;
 }
 
-bool KalziumGLPart::openUrl(const KUrl& url)
-{
-    kDebug() << "KalziumGLPart::openURL()" << endl;
-}
-
 bool KalziumGLPart::openFile()
 {
+       OpenBabel::OBMol* mol = OpenBabel2Wrapper::readMolecule( m_url.path() );
+       mol->Center();
+
+  m_widget->slotSetMolecule( mol );
+  m_widget->update();
 }
 
 #include "kalziumglpart.moc" 
index 5b734cb3c3e116f8aef0ed205c437dd06feea574..246da6f8aa996bd881460ba11cece0c7af273f8e 100644 (file)
@@ -1,9 +1,24 @@
+/***************************************************************************
+    copyright            : (C) 2006 by Carsten Niehaus
+    email                : cniehaus@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
 #ifndef KALZIUMGLPART_H
 #define KALZIUMGLPART_H
 
 #include <kparts/factory.h>
 #include <kparts/genericfactory.h>
 
+#include "kalziumglwidget.h"
+
 class KalziumGLPart : public KParts::ReadOnlyPart
 {
     Q_OBJECT
@@ -13,11 +28,10 @@ class KalziumGLPart : public KParts::ReadOnlyPart
 
         static KAboutData* createAboutData();
 
-    public slots:
-        bool openUrl(const KUrl& url);
-
     protected:
         bool openFile();
+        
+        KalziumGLWidget * m_widget;
 };
 
 #endif // KALZIUMGLPART_H