summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnu Mittal <anu22mittal@gmail.com>2015-03-04 12:03:20 (GMT)
committerAnu Mittal <anu22mittal@gmail.com>2015-03-04 12:03:20 (GMT)
commit94d37ad7fac627818009d6d8c807493a39882591 (patch)
treeba2954327b92a74d1e04eabf772e330607e03b34
parent5426d9030c9f3a2d9f66ca14492ca231e773dc19 (diff)
Dealing with KDialog and CMakeLists
-rw-r--r--CMakeLists.txt19
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/detailinfodlg.cpp18
-rw-r--r--src/detailinfodlg.h3
-rw-r--r--src/spectrumwidget.cpp2
-rw-r--r--src/tools/obconverter.cpp33
-rw-r--r--src/tools/obconverter.h4
7 files changed, 27 insertions, 54 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0723db8..68d9e48 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,21 +4,9 @@ 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 OpenGL)
+find_package(Qt5 REQUIRED COMPONENTS Widgets Script Core Gui Declarative OpenGL)
find_package(Qt5Svg REQUIRED)
-find_package(KF5 REQUIRED COMPONENTS CoreAddons Solid Config Archive KHtml I18n Parts UnitConversion WidgetsAddons NewStuff KDELibs4Support)
-find_package(KF5DocTools REQUIRED)
-find_package(KF5Plotting REQUIRED)
-find_package(Qt5Widgets REQUIRED)
-find_package(PkgConfig REQUIRED)
-find_package(KF5CoreAddons REQUIRED)
-find_package(KF5Config REQUIRED)
-find_package(KF5Solid REQUIRED)
-find_package(KF5ConfigWidgets REQUIRED)
-find_package(ECM REQUIRED)
-find_package(Qt5Core REQUIRED)
-find_package(Qt5Gui REQUIRED)
-find_package(PkgConfig REQUIRED)
+find_package(KF5 REQUIRED COMPONENTS Plotting CoreAddons Solid Config Archive KHtml I18n Parts UnitConversion WidgetsAddons NewStuff KDELibs4Support)
find_package(Gettext REQUIRED)
find_package(PythonInterp REQUIRED)
find_package(Avogadro REQUIRED)
@@ -30,8 +18,7 @@ include(KDECompilerSettings)
include(FeatureSummary)
include(ECMInstallIcons)
include(ECMMarkNonGuiExecutable)
-include_directories(${OPENBABEL2_INCLUDE_DIR} ${AVOGADRO_INCLUDE_DIR} ${OPENGL_INCLUDE_DIRS})
-
+include_directories(${OPENBABEL2_INCLUDE_DIR} ${AVOGADRO_INCLUDE_DIR} ${OPENGL_INCLUDE_DIRS} ${Qt5Declarative_INCLUDE_DIR})
set(CMAKE_MODULE_PATH ${kalzium_SOURCE_DIR}/cmake/modules )
# search packages used by KDE
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index de1e4c2..2ee0c95 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -136,7 +136,7 @@ kconfig_add_kcfg_files(kalzium_SRCS prefs.kcfgc )
add_executable(kalzium ${kalzium_SRCS})
-target_link_libraries(kalzium KF5::ConfigWidgets KF5::Plotting KF5::KHtml KF5::KDELibs4Support KF5::NewStuff KF5::UnitConversion Qt5::Script Qt5::Declarative science Qt5::Svg ${OPENBABEL2_LIBRARIES} ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS})
+target_link_libraries(kalzium KF5::Plotting KF5::KHtml KF5::KDELibs4Support KF5::NewStuff KF5::UnitConversion Qt5::Script Qt5::Declarative science Qt5::Svg ${OPENBABEL2_LIBRARIES} ${Qt5Declaration_LIBRARIES})
#QT_QTSCRIPT_LIBRARY
if (OPENBABEL2_FOUND)
target_link_libraries(kalzium ${OPENBABEL2_LIBRARIES})
diff --git a/src/detailinfodlg.cpp b/src/detailinfodlg.cpp
index e813ce2..02a378b 100644
--- a/src/detailinfodlg.cpp
+++ b/src/detailinfodlg.cpp
@@ -31,6 +31,8 @@
#include <krun.h>
#include <KGlobal>
#include <KIcon>
+#include <KPageDialog>
+#include <KMessage>
#include "psetables.h"
@@ -49,23 +51,13 @@ DetailedInfoDlg::DetailedInfoDlg(int el, QWidget *parent) : KPageDialog(parent),
{
setFaceType(List);
- /* QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Help| User1|User2
- | QDialogButtonBox::Close);
-
- connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(help()));
- connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
- QDialogButtonBox* dialogButtonBox = new QDialogButtonBox;
- QPushButton* button = dialogButtonBox->addButton( i18nc("Next element", "Next"),
- (layoutDirection() == Qt::LeftToRight) ? "arrow-right" : "arrow-left", i18n("Goes to the next element"));
-connect(this, SIGNAL(user1Clicked()), this, SLOT(slotUser1()));
- button = dialogButtonBox->addButton(i18nc("Previous element", "Previous"),(layoutDirection() == Qt::LeftToRight) ? "arrow-left" : "arrow-right", i18n("Goes to the previous element");
-connect(this, SIGNAL(user2Clicked()), this, SLOT(slotUser2()));*/
+
/*setButtons(Help | User1 | User2 | Close);
setDefaultButton(Close);
setButtonGuiItem(User1, KGuiItem(i18nc("Next element", "Next"),(layoutDirection() == Qt::LeftToRight) ? "arrow-right" : "arrow-left", i18n("Goes to the next element")));
setButtonGuiItem(User2, KGuiItem(i18nc("Previous element", "Previous"),(layoutDirection() == Qt::LeftToRight) ? "arrow-left" : "arrow-right", i18n("Goes to the previous element")));
resize(820, 580);
- */
+*/
m_baseHtml = KGlobal::dirs()->findResourceDir("appdata", "data/") + "data/htmlview/";
m_baseHtml2 = KGlobal::dirs()->findResourceDir("appdata", "data/") + "data/hazardsymbols/";
@@ -104,7 +96,7 @@ void DetailedInfoDlg::setElement(int el)
reloadContent();
- /*enableButton(User1, true);
+ /* enableButton(User1, true);
enableButton(User2, true);
if (m_elementNumber == 1) {
enableButton(User2, false);
diff --git a/src/detailinfodlg.h b/src/detailinfodlg.h
index 5de783d..b1e9d48 100644
--- a/src/detailinfodlg.h
+++ b/src/detailinfodlg.h
@@ -16,9 +16,10 @@
#ifndef DETAILINFODLG_H
#define DETAILINFODLG_H
-#include <kpagedialog.h>
#include <KUrl>
#include <QMap>
+#include <KDialog>
+#include <KPageDialog>
class DetailedGraphicalOverview;
class Element;
diff --git a/src/spectrumwidget.cpp b/src/spectrumwidget.cpp
index 63aaaf6..c9377ef 100644
--- a/src/spectrumwidget.cpp
+++ b/src/spectrumwidget.cpp
@@ -149,7 +149,7 @@ QColor SpectrumWidget::wavelengthToRGB(double wavelength)
double blue = 0.0, green = 0.0, red = 0.0, factor = 0.0;
// wavelengthTo RGB function works with nanometers.
- wavelength = KUnitConversion::Value(wavelength, KUnitConversion::UnitId(Prefs::spectrumWavelengthUnit()))
+ wavelength = KUnitConversion::Value(wavelength,KUnitConversion::UnitId(Prefs::spectrumWavelengthUnit()))
.convertTo(KUnitConversion::Nanometer).number();
int wavelength_ = (int)floor(wavelength);
diff --git a/src/tools/obconverter.cpp b/src/tools/obconverter.cpp
index 6bf8c3d..8e46249 100644
--- a/src/tools/obconverter.cpp
+++ b/src/tools/obconverter.cpp
@@ -28,7 +28,7 @@
#include <QtWidgets/QDialogButtonBox>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QPushButton>
-#include <QDialog>
+
// KDE includes
#include <KDebug>
@@ -37,33 +37,26 @@
#include <KFileDialog>
#include <KLocalizedString>
#include <KUrl>
-
+#include <KDialog>
+#include <kdialogbuttonbox.h>
using namespace std;
using namespace OpenBabel;
KOpenBabel::KOpenBabel(QWidget *parent)
- : QDialog(parent)
+ : KDialog(parent)
{
- 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 );
+ setCaption(i18n("OpenBabel Frontend"));
+ setButtons(Help | User1| Close);
+ setDefaultButton(User1);
+
OBConvObject = new OBConversion();
- QVBoxLayout* layout = new QVBoxLayout;
- layout->addWidget( dialogButtonBox );
- setLayout( layout );
+ ui.setupUi(mainWidget());
+
+ setButtonGuiItem(User1, KGuiItem(i18n("Convert"), "edit-copy", i18n("Convert selected files")));
+
setupWindow();
- //setHelp(QString(), "kalzium");
+ setHelp(QString(), "kalzium");
}
KOpenBabel::~KOpenBabel()
diff --git a/src/tools/obconverter.h b/src/tools/obconverter.h
index d187862..f8ee5a7 100644
--- a/src/tools/obconverter.h
+++ b/src/tools/obconverter.h
@@ -25,14 +25,14 @@
// OpenBabel includes
#include <openbabel/obconversion.h>
-#include <QDialog>
+#include <KDialog>
class QDialog;
/**
* @author Carsten Niehaus
* @author Jerome Pansanel
*/
-class KOpenBabel : public QDialog
+class KOpenBabel : public KDialog
{
Q_OBJECT