summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnu Mittal <anu22mittal@gmail.com>2015-03-01 15:51:42 (GMT)
committerAnu Mittal <anu22mittal@gmail.com>2015-03-01 15:51:42 (GMT)
commitc3a3248eb57d97af85bdb4ac262c26dc1d22e212 (patch)
tree76d21d58b051717f11ce98cb211224465d3dc160
parent113b84f8228516314d188388964b2e54e5fc4a32 (diff)
porting src- KUnitConverion error
-rw-r--r--CMakeLists.txt1
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/calculator/gasCalculator.cpp20
-rw-r--r--src/detailinfodlg.cpp40
-rw-r--r--src/detailinfodlg.h2
-rw-r--r--src/elementdataviewer.cpp4
-rw-r--r--src/gradientwidget_impl.cpp1
-rw-r--r--src/molcalcwidget.cpp1
-rw-r--r--src/orbitswidget.cpp1
-rw-r--r--src/tablesdialog.cpp6
10 files changed, 47 insertions, 31 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index daeda20..9d2c158 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,7 @@ 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)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ca4527b..de1e4c2 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::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::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})
#QT_QTSCRIPT_LIBRARY
if (OPENBABEL2_FOUND)
target_link_libraries(kalzium ${OPENBABEL2_LIBRARIES})
diff --git a/src/calculator/gasCalculator.cpp b/src/calculator/gasCalculator.cpp
index 2d7c75b..a68aab3 100644
--- a/src/calculator/gasCalculator.cpp
+++ b/src/calculator/gasCalculator.cpp
@@ -170,7 +170,7 @@ void gasCalculator::calculateVol()
double volume = m_moles * R * temp / pressure + (m_moles * b);
m_vol = Value(volume, KUnitConversion::Liter);
- // m_vol = m_vol.convertTo(getCurrentUnitId(KUnitConversion::UnitId(ui.volume_unit)));
+ m_vol = m_vol.convertTo(getCurrentUnitId(KUnitConversion::UnitId(ui.volume_unit)));
ui.volume->setValue(m_vol.number());
}
@@ -183,7 +183,7 @@ void gasCalculator::calculateTemp()
double temp = (pressure + (m_moles * m_moles * m_Vand_a / volume / volume))\
* (volume - m_moles * b) / m_moles / R;
m_temp = Value(temp, KUnitConversion::Kelvin);
- //m_temp = m_temp.convertTo(getCurrentUnitId(KUnitConversion::UnitId(ui.temp_unit)));
+ m_temp = m_temp.convertTo(getCurrentUnitId(KUnitConversion::UnitId(ui.temp_unit)));
ui.temp->setValue(m_temp.number());
}
@@ -209,32 +209,32 @@ void gasCalculator::calculateMass()
double mass = (pressure + m_moles * m_moles * m_Vand_a / volume / volume)\
* (volume - m_moles * b) * m_molarMass / R / temp;
m_mass = Value(mass, KUnitConversion::Gram);
- // m_mass = m_mass.convertTo(getCurrentUnitId(KUnitConversion::UnitId(ui.mass_unit)));
+ m_mass = m_mass.convertTo(getCurrentUnitId(KUnitConversion::UnitId(ui.mass_unit)));
ui.mass->setValue(m_mass.number());
}
void gasCalculator::volChanged()
{
- // m_vol = Value(ui.volume->value(), getCurrentUnitId(KUnitConversion::UnitId(ui.volume_unit)));
+ m_vol = Value(ui.volume->value(), getCurrentUnitId(KUnitConversion::UnitId(ui.volume_unit)));
calculate();
}
void gasCalculator::tempChanged()
{
- // m_temp = Value(ui.temp->value(), getCurrentUnitId(ui.temp_unit));
+ m_temp = Value(ui.temp->value(), getCurrentUnitId(KUnitConversion::UnitId(ui.temp_unit)));
calculate();
}
void gasCalculator::pressureChanged()
{
- //m_pressure = Value(ui.pressure->value(), getCurrentUnitId(ui.pressure_unit));
+ m_pressure = Value(ui.pressure->value(), getCurrentUnitId(KUnitConversion::UnitId(ui.pressure_unit)));
calculate();
}
void gasCalculator::massChanged()
{
- //m_mass = Value(ui.mass->value(), getCurrentUnitId(ui.mass_unit));
+ m_mass = Value(ui.mass->value(), getCurrentUnitId(KUnitConversion::UnitId(ui.mass_unit)));
m_moles = m_mass.convertTo(KUnitConversion::Gram).number() / m_molarMass;
ui.moles->setValue(m_moles);
calculate();
@@ -244,7 +244,7 @@ void gasCalculator::molesChanged(double value)
{
m_moles = value;
m_mass = Value(m_moles * m_molarMass, KUnitConversion::Gram);
- // m_mass = m_mass.convertTo(getCurrentUnitId(ui.mass_unit));
+ m_mass = m_mass.convertTo(getCurrentUnitId(KUnitConversion::UnitId(ui.mass_unit)));
ui.mass->setValue(m_mass.number());
calculate();
}
@@ -257,7 +257,7 @@ void gasCalculator::molarMassChanged(double value)
}
m_molarMass = value;
m_mass = Value(m_molarMass * m_moles, KUnitConversion::Gram);
- // m_mass = m_mass.convertTo(getCurrentUnitId(ui.mass_unit));
+ m_mass = m_mass.convertTo(getCurrentUnitId(KUnitConversion::UnitId(ui.mass_unit)));
ui.mass->setValue(m_mass.number());
calculate();
}
@@ -270,7 +270,7 @@ void gasCalculator::Vand_aChanged()
void gasCalculator::Vand_bChanged()
{
- // m_Vand_b = Value(ui.b->value(), getCurrentUnitId(ui.b_unit));
+ m_Vand_b = Value(ui.b->value(), getCurrentUnitId(KUnitConversion::UnitId(ui.b_unit)));
calculate();
}
diff --git a/src/detailinfodlg.cpp b/src/detailinfodlg.cpp
index 67e18e6..e813ce2 100644
--- a/src/detailinfodlg.cpp
+++ b/src/detailinfodlg.cpp
@@ -17,7 +17,7 @@
#include "isotope.h"
#include "kalziumdataobject.h"
-
+#include <kdialog.h>
#include <klocale.h>
#include <khtml_part.h>
#include <dom/html_base.h>
@@ -26,17 +26,18 @@
#include <kstandarddirs.h>
#include <kactioncollection.h>
#include <kpagewidgetmodel.h>
-#include <ktoolinvocation.h>
+#include <KConfig>
+#include <KConfigWidgets/khelpclient.h>
#include <krun.h>
+#include <KGlobal>
+#include <KIcon>
#include "psetables.h"
#include <QFile>
#include <QLabel>
#include <QImage>
-#include <QPushButton>
#include <QStackedWidget>
-
#include "element.h"
#include "orbitswidget.h"
#include "detailedgraphicaloverview.h"
@@ -47,13 +48,24 @@
DetailedInfoDlg::DetailedInfoDlg(int el, QWidget *parent) : KPageDialog(parent), m_tableTyp(0)
{
setFaceType(List);
- setButtons(Help | User1 | User2 | Close);
+
+ /* 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")));
+ 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/";
@@ -92,13 +104,13 @@ void DetailedInfoDlg::setElement(int el)
reloadContent();
- enableButton(User1, true);
- enableButton(User2, true);
+ /*enableButton(User1, true);
+ enableButton(User2, true);
if (m_elementNumber == 1) {
enableButton(User2, false);
} else if (m_elementNumber == KalziumDataObject::instance()->numberOfElements()) {
enableButton(User1, false);
- }
+ }*/
}
// void DetailedInfoDlg::setOverviewBackgroundColor(const QColor &bgColor)
@@ -501,7 +513,7 @@ void DetailedInfoDlg::reloadContent()
// const QString element_symbol = m_element->dataAsString(ChemicalDataObject::symbol);
// updating caption
- setCaption(i18nc("For example Carbon (6)", "%1 (%2)", element_name, m_elementNumber));
+ setWindowTitle(i18nc("For example Carbon (6)", "%1 (%2)", element_name, m_elementNumber));
// updating overview tab
// dTab->setElement(m_elementNumber);
@@ -607,7 +619,7 @@ void DetailedInfoDlg::slotHelp()
break;
}
#endif
- KToolInvocation::invokeHelp("infodialog_spectrum", QLatin1String("kalzium"));
+ KHelpClient::invokeHelp("infodialog_spectrum", QLatin1String("kalzium"));
}
void DetailedInfoDlg::slotUser1()
diff --git a/src/detailinfodlg.h b/src/detailinfodlg.h
index e81802b..5de783d 100644
--- a/src/detailinfodlg.h
+++ b/src/detailinfodlg.h
@@ -17,7 +17,7 @@
#define DETAILINFODLG_H
#include <kpagedialog.h>
-
+#include <KUrl>
#include <QMap>
class DetailedGraphicalOverview;
diff --git a/src/elementdataviewer.cpp b/src/elementdataviewer.cpp
index 43fb01f..91a5dc4 100644
--- a/src/elementdataviewer.cpp
+++ b/src/elementdataviewer.cpp
@@ -25,6 +25,8 @@
#include <ktoolinvocation.h>
#include <kunitconversion/converter.h>
#include "prefs.h"
+#include <KConfig>
+#include <KConfigWidgets/khelpclient.h>
//QT-Includes
#include <QKeyEvent>
@@ -104,7 +106,7 @@ ElementDataViewer::~ElementDataViewer()
void ElementDataViewer::slotHelp()
{
- KToolInvocation::invokeHelp("plot_data", "kalzium");
+ KHelpClient::invokeHelp("plot_data", "kalzium");
}
void ElementDataViewer::rangeChanged()
diff --git a/src/gradientwidget_impl.cpp b/src/gradientwidget_impl.cpp
index ca53a15..d329051 100644
--- a/src/gradientwidget_impl.cpp
+++ b/src/gradientwidget_impl.cpp
@@ -17,6 +17,7 @@
#include <kdebug.h>
#include <klocale.h>
+#include <KIcon>
#include <element.h>
#include <math.h>
diff --git a/src/molcalcwidget.cpp b/src/molcalcwidget.cpp
index 784928a..ffa7f5b 100644
--- a/src/molcalcwidget.cpp
+++ b/src/molcalcwidget.cpp
@@ -330,4 +330,3 @@ void MolcalcWidget::hideExtra()
ui.details->hide();
ui.tabWidget->removeTab(1);
}
-#include "molcalcwidget.moc"
diff --git a/src/orbitswidget.cpp b/src/orbitswidget.cpp
index d94ccf1..4f8cdb9 100644
--- a/src/orbitswidget.cpp
+++ b/src/orbitswidget.cpp
@@ -259,4 +259,3 @@ void OrbitsWidget::paintEvent(QPaintEvent*)
}
}
-#include "orbitswidget.moc"
diff --git a/src/tablesdialog.cpp b/src/tablesdialog.cpp
index e17003a..dbcc8a7 100644
--- a/src/tablesdialog.cpp
+++ b/src/tablesdialog.cpp
@@ -22,6 +22,7 @@
#include <kpagewidgetmodel.h>
#include <kstandardaction.h>
#include <ktoolinvocation.h>
+#include <kdialog.h>
#include <QApplication>
#include <QClipboard>
@@ -35,8 +36,9 @@
TablesDialog::TablesDialog(QWidget *parent) : KPageDialog(parent)
{
setFaceType(List);
- setButtons(Help | Close);
- setDefaultButton(Close);
+
+ //setButtons(Help | Close);
+ //setDefaultButton(Close);
createGreekSymbolTable();
createNumbersTable();