Commit 48a97084 authored by Anu Mittal's avatar Anu Mittal
Browse files

ported libscience, started porting src folder

parent 56ccc3f7
......@@ -4,8 +4,8 @@ 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 Script Declarative OpenGL)
find_package(KF5 REQUIRED COMPONENTS CoreAddons Solid Config Archive I18n Parts UnitConversion WidgetsAddons NewStuff KHtml KDELibs4Support)
find_package(Qt5 REQUIRED COMPONENTS Widgets Script OpenGL)
find_package(KF5 REQUIRED COMPONENTS CoreAddons Solid Config Archive I18n Parts UnitConversion WidgetsAddons NewStuff KDELibs4Support)
find_package(KF5DocTools REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(PkgConfig REQUIRED)
......
......@@ -19,7 +19,7 @@
#include "element.h"
#include <kdebug.h>
#include <QDebug>
#include <kunitconversion/converter.h>
......
......@@ -49,6 +49,9 @@ using namespace Avogadro;
MoleculeDialog::MoleculeDialog(QWidget * parent)
: KDialog(parent), m_periodicTable(0), m_addHydrogens(false)
{
KGlobalSettings globalSettings;
OpenBabel2Wrapper openBabel;
// use multi-sample (anti-aliased) OpenGL if available
QGLFormat defFormat = QGLFormat::defaultFormat();
defFormat.setSampleBuffers(true);
......@@ -240,7 +243,8 @@ void MoleculeDialog::slotSaveMolecule()
filename.append(".cml");
}
OpenBabel2Wrapper::writeMolecule(filename, ui.glWidget->molecule());
OpenBabel2Wrapper openBabel;
openBabel.writeMolecule(filename, ui.glWidget->molecule());
}
void MoleculeDialog::setViewEdit(int mode)
......@@ -271,7 +275,7 @@ void MoleculeDialog::slotUpdateStatistics()
ui.nameLabel->setText(mol->OBMol().GetTitle());
ui.weightLabel->setText(i18nc("This 'u' stands for the chemical unit (u for 'units'). Most likely this does not need to be translated at all!", "%1 u", mol->OBMol().GetMolWt()));
ui.formulaLabel->setText(OpenBabel2Wrapper::getPrettyFormula(mol));
ui.formulaLabel->setText(openBabel.getPrettyFormula(mol));
// ui.glWidget->update();
}
......@@ -281,9 +285,9 @@ void MoleculeDialog::slotDownloadNewStuff()
KNS3::DownloadDialog dialog(this);
dialog.exec();
KGlobalSettings globalSettings;
// list of changed entries
QString destinationDir = KGlobalSettings::documentPath();
QString destinationDir = globalSettings.documentPath();
QDir dir(destinationDir);
if (!dir.exists()) {
destinationDir = QDir::homePath();
......
......@@ -25,32 +25,45 @@
#include <QRegExp>
#include <QProcess>
#include <QLinkedList>
#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QPushButton>
#include <QDialog>
// KDE includes
#include <KDebug>
#include <KLocale>
#include <KMessageBox>
#include <KFileDialog>
#include <KLocalizedString>
#include <KUrl>
using namespace std;
using namespace OpenBabel;
KOpenBabel::KOpenBabel(QWidget *parent)
: KDialog(parent)
: QDialog(parent)
{
setCaption(i18n("OpenBabel Frontend"));
setButtons(Help | User1| Close);
setDefaultButton(User1);
setWindowTitle(i18n("OpenBabel Frontend"));
//setDefaultButton(User1);
QDialogButtonBox* dialogButtonBox = new QDialogButtonBox;
QPushButton* button = dialogButtonBox->addButton(
i18n("Convert"),
QDialogButtonBox::ApplyRole );
connect( button, &QAbstractButton::clicked, this,&KOpenBabel::slotConvert);
button = dialogButtonBox->addButton(
i18n("HELP"),
QDialogButtonBox::HelpRole );
button = dialogButtonBox->addButton(
i18n("CLOSE"),
QDialogButtonBox::RejectRole );
OBConvObject = new OBConversion();
ui.setupUi(mainWidget());
setButtonGuiItem(User1, KGuiItem(i18n("Convert"), "edit-copy", i18n("Convert selected files")));
QVBoxLayout* layout = new QVBoxLayout;
layout->addWidget( dialogButtonBox );
setLayout( layout );
setupWindow();
setHelp(QString(), "kalzium");
//setHelp(QString(), "kalzium");
}
KOpenBabel::~KOpenBabel()
......
......@@ -25,14 +25,14 @@
// OpenBabel includes
#include <openbabel/obconversion.h>
class KDialog;
#include <QDialog>
class QDialog;
/**
* @author Carsten Niehaus
* @author Jerome Pansanel
*/
class KOpenBabel : public KDialog
class KOpenBabel : public QDialog
{
Q_OBJECT
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment