summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnu Mittal <anu22mittal@gmail.com>2015-02-16 15:36:43 (GMT)
committerAnu Mittal <anu22mittal@gmail.com>2015-02-16 15:36:43 (GMT)
commit48a9708455d81619beaac2881e9e3451bbe6854c (patch)
tree86bde73350b328596207d8ac552fdd6af089c39f
parent56ccc3f70f550d71bd87ffbbf4e0e9d1f3c10ad8 (diff)
ported libscience, started porting src folder
-rw-r--r--CMakeLists.txt4
-rw-r--r--libscience/element.cpp2
-rw-r--r--src/tools/moleculeview.cpp12
-rw-r--r--src/tools/obconverter.cpp33
-rw-r--r--src/tools/obconverter.h6
5 files changed, 37 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1eca2f8..45c147e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
diff --git a/libscience/element.cpp b/libscience/element.cpp
index 8b8cd4e..59de11f 100644
--- a/libscience/element.cpp
+++ b/libscience/element.cpp
@@ -19,7 +19,7 @@
#include "element.h"
-#include <kdebug.h>
+#include <QDebug>
#include <kunitconversion/converter.h>
diff --git a/src/tools/moleculeview.cpp b/src/tools/moleculeview.cpp
index 2476f8b..611ff10 100644
--- a/src/tools/moleculeview.cpp
+++ b/src/tools/moleculeview.cpp
@@ -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();
diff --git a/src/tools/obconverter.cpp b/src/tools/obconverter.cpp
index 3be18ab..6bf8c3d 100644
--- a/src/tools/obconverter.cpp
+++ b/src/tools/obconverter.cpp
@@ -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()
diff --git a/src/tools/obconverter.h b/src/tools/obconverter.h
index f94c2c5..d187862 100644
--- a/src/tools/obconverter.h
+++ b/src/tools/obconverter.h
@@ -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