Changeset View
Changeset View
Standalone View
Standalone View
src/tools/moleculeview.cpp
Show All 23 Lines | |||||
24 | #include <QFileInfo> | 24 | #include <QFileInfo> | ||
25 | #include <QGLFormat> | 25 | #include <QGLFormat> | ||
26 | #include <QDebug> | 26 | #include <QDebug> | ||
27 | #include <KFileDialog> | 27 | #include <KFileDialog> | ||
28 | #include <KJob> | 28 | #include <KJob> | ||
29 | #include <KMessageBox> | 29 | #include <KMessageBox> | ||
30 | #include <KLocalizedString> | 30 | #include <KLocalizedString> | ||
31 | #include <QUrl> | 31 | #include <QUrl> | ||
32 | #include <knewstuff3/downloaddialog.h> | | |||
33 | #include <kio/job.h> | 32 | #include <kio/job.h> | ||
34 | 33 | | |||
35 | #include "iowrapper.h" | 34 | #include "iowrapper.h" | ||
36 | 35 | | |||
37 | #include <openbabel/mol.h> | 36 | #include <openbabel/mol.h> | ||
38 | #include <openbabel/obiter.h> | 37 | #include <openbabel/obiter.h> | ||
39 | // This is needed to ensure that the forcefields are set up right with GCC vis | 38 | // This is needed to ensure that the forcefields are set up right with GCC vis | ||
40 | #ifdef __KDE_HAVE_GCC_VISIBILITY | 39 | #ifdef __KDE_HAVE_GCC_VISIBILITY | ||
Show All 11 Lines | 48 | MoleculeDialog::MoleculeDialog(QWidget * parent) | |||
52 | , m_periodicTable(nullptr) | 51 | , m_periodicTable(nullptr) | ||
53 | { | 52 | { | ||
54 | // use multi-sample (anti-aliased) OpenGL if available | 53 | // use multi-sample (anti-aliased) OpenGL if available | ||
55 | QGLFormat defFormat = QGLFormat::defaultFormat(); | 54 | QGLFormat defFormat = QGLFormat::defaultFormat(); | ||
56 | defFormat.setSampleBuffers(true); | 55 | defFormat.setSampleBuffers(true); | ||
57 | QGLFormat::setDefaultFormat(defFormat); | 56 | QGLFormat::setDefaultFormat(defFormat); | ||
58 | 57 | | |||
59 | setCaption(i18n("Molecular Editor")); | 58 | setCaption(i18n("Molecular Editor")); | ||
60 | setButtons(User3 | User2 | User1 | Close); | 59 | setButtons(User3 | /*User2 | */User1 | Close); | ||
61 | 60 | | |||
62 | setDefaultButton(User1); | 61 | setDefaultButton(User1); | ||
63 | 62 | | |||
64 | setButtonGuiItem(User1, KGuiItem(i18n("Load Molecule"), "document-open", i18n("Loading a molecule"))); | 63 | setButtonGuiItem(User1, KGuiItem(i18n("Load Molecule"), "document-open", i18n("Loading a molecule"))); | ||
65 | 64 | | |||
66 | setButtonGuiItem(User2, KGuiItem(i18n("Download New Molecules"), "get-hot-new-stuff", i18n("Download new molecule files"))); | 65 | // setButtonGuiItem(User2, KGuiItem(i18n("Download New Molecules"), "get-hot-new-stuff", i18n("Download new molecule files"))); | ||
67 | 66 | | |||
68 | setButtonGuiItem(User3, KGuiItem(i18n("Save Molecule"), "document-save", i18n("Saving a molecule"))); | 67 | setButtonGuiItem(User3, KGuiItem(i18n("Save Molecule"), "document-save", i18n("Saving a molecule"))); | ||
69 | 68 | | |||
70 | ui.setupUi(mainWidget()); | 69 | ui.setupUi(mainWidget()); | ||
71 | 70 | | |||
72 | // Attempt to set up the UFF forcefield | 71 | // Attempt to set up the UFF forcefield | ||
73 | // m_forceField = OBForceField::FindForceField("UFF"); | 72 | // m_forceField = OBForceField::FindForceField("UFF"); | ||
74 | // if (!m_forceField) { | 73 | // if (!m_forceField) { | ||
Show All 15 Lines | 88 | // this, &MoleculeDialog::slotGeometryOptimize); | |||
90 | connect(ui.clearDrawingButton, &QPushButton::clicked, | 89 | connect(ui.clearDrawingButton, &QPushButton::clicked, | ||
91 | this, &MoleculeDialog::clearAllElementsInEditor); | 90 | this, &MoleculeDialog::clearAllElementsInEditor); | ||
92 | 91 | | |||
93 | connect(ui.glWidget->molecule(), &Avogadro::QtGui::Molecule::changed, | 92 | connect(ui.glWidget->molecule(), &Avogadro::QtGui::Molecule::changed, | ||
94 | this, &MoleculeDialog::slotUpdateStatistics); | 93 | this, &MoleculeDialog::slotUpdateStatistics); | ||
95 | 94 | | |||
96 | connect(this, &KDialog::user1Clicked, | 95 | connect(this, &KDialog::user1Clicked, | ||
97 | this, &MoleculeDialog::slotLoadMolecule); | 96 | this, &MoleculeDialog::slotLoadMolecule); | ||
98 | connect(this, &KDialog::user2Clicked, | 97 | // connect(this, &KDialog::user2Clicked, | ||
99 | this, &MoleculeDialog::slotDownloadNewStuff); | 98 | // this, &MoleculeDialog::slotDownloadNewStuff); | ||
100 | connect(this, &KDialog::user3Clicked, | 99 | connect(this, &KDialog::user3Clicked, | ||
101 | this, &MoleculeDialog::slotSaveMolecule); | 100 | this, &MoleculeDialog::slotSaveMolecule); | ||
102 | 101 | | |||
103 | // Check that we have managed to load up some tools and engines | 102 | // Check that we have managed to load up some tools and engines | ||
104 | int nTools = ui.glWidget->tools().size(); | 103 | int nTools = ui.glWidget->tools().size(); | ||
105 | if (!nTools) { | 104 | if (!nTools) { | ||
106 | QString error = i18n("No tools loaded - it is likely that the Avogadro plugins could not be located."); | 105 | QString error = i18n("No tools loaded - it is likely that the Avogadro plugins could not be located."); | ||
107 | KMessageBox::error(this, error, i18n("Kalzium")); | 106 | KMessageBox::error(this, error, i18n("Kalzium")); | ||
▲ Show 20 Lines • Show All 212 Lines • Show Last 20 Lines |