Commit 6fa45408 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use more debug categories

parent 14b42195
Pipeline #118885 passed with stage
in 1 minute
add_subdirectory(data)
add_subdirectory(tests)
set(science_LIB_SRCS
add_library(science SHARED)
ecm_qt_declare_logging_category(science HEADER kalzium_libscience_debug.h IDENTIFIER KALZIUM_LIBSCIENCE_LOG CATEGORY_NAME org.kde.kalzium.libscience DESCRIPTION "Kalzium (libscience)" EXPORT KALZIUM)
target_sources(science PRIVATE
element.cpp
spectrum.cpp
isotope.cpp
......@@ -14,7 +17,7 @@ set(science_LIB_SRCS
psetables.cpp
)
add_library(science SHARED ${science_LIB_SRCS})
target_link_libraries(science Qt5::Xml KF5::UnitConversion KF5::WidgetsAddons KF5::I18n)
set_target_properties(science PROPERTIES VERSION ${KALZIUMLIB_VERSION} SOVERSION ${KALZIUMLIB_SOVERSION} )
......
......@@ -6,7 +6,7 @@
#include "chemicaldataobject.h"
#include <QDebug>
#include "kalzium_libscience_debug.h"
#include <QLatin1String>
#include <KUnitConversion/Converter>
......
......@@ -6,7 +6,7 @@
#include "element.h"
#include <QDebug>
#include "kalzium_libscience_debug.h"
#include <KUnitConversion/Converter>
......
......@@ -8,7 +8,7 @@
#include "chemicaldataobject.h"
#include "element.h"
#include <QDebug>
#include "kalzium_libscience_debug.h"
#include <KLocalizedString>
#include <KUnitConversion/Converter>
......@@ -109,9 +109,9 @@ bool ElementSaxParser::startElement(const QString&, const QString &localName, co
} else if ((d->inElement && localName == QLatin1String("scalar")) || localName == QLatin1String("array")) {
for (int i = 0; i < attrs.length(); ++i) {
if (attrs.localName(i) == QLatin1String("units")) {
// qDebug() << "value of the unit: " << attrs.value(i);
// qCDebug(KALZIUM_LIBSCIENCE_LOG) << "value of the unit: " << attrs.value(i);
d->currentUnit = unit(attrs.value(i));
// qDebug() << "Took " << d->currentUnit;
// qCDebug(KALZIUM_LIBSCIENCE_LOG) << "Took " << d->currentUnit;
continue;
}
......
......@@ -8,7 +8,7 @@
#include "chemicaldataobject.h"
#include <QDebug>
#include "kalzium_libscience_debug.h"
Isotope::Isotope()
{
......
......@@ -8,7 +8,7 @@
#include "chemicaldataobject.h"
#include "isotope.h"
#include <QDebug>
#include "kalzium_libscience_debug.h"
#include <KUnitConversion/Converter>
......
......@@ -7,7 +7,7 @@
#include <ctype.h>
#include <QDebug>
#include "kalzium_libscience_debug.h"
#include <QFile>
#include <QStandardPaths>
......@@ -118,9 +118,9 @@ bool MoleculeParser::weight(const QString &_shortMoleculeString,
// Expand the molecule string
// Example : MeOH -> (CH3)OH
qDebug() << _shortMoleculeString << "is going to be expanded";
qCDebug(KALZIUM_LIBSCIENCE_LOG) << _shortMoleculeString << "is going to be expanded";
_moleculeString = expandFormula(_shortMoleculeString);
qDebug() << _moleculeString << "is the expanded string";
qCDebug(KALZIUM_LIBSCIENCE_LOG) << _moleculeString << "is the expanded string";
// Now set the expanded string
// Initialize the parsing process, and parse te molecule.
......@@ -158,7 +158,7 @@ bool MoleculeParser::parseSubmolecule(double *_resultMass,
*_resultMass = 0.0;
_resultMap->clear();
while (parseTerm(&subMass, &subMap)) {
//qDebug() << "Parsed a term, weight = " << subresult;
//qCDebug(KALZIUM_LIBSCIENCE_LOG) << "Parsed a term, weight = " << subresult;
// Add the mass and composition of the submolecule to the total.
*_resultMass += subMass;
......@@ -186,7 +186,7 @@ bool MoleculeParser::parseTerm(double *_resultMass,
_resultMap->clear();
if (nextToken() == ELEMENT_TOKEN) {
//qDebug() << "Parsed an element: " << m_elementVal->symbol();
//qCDebug(KALZIUM_LIBSCIENCE_LOG) << "Parsed an element: " << m_elementVal->symbol();
*_resultMass = m_elementVal->dataAsVariant( ChemicalDataObject::mass ).toDouble();
_resultMap->add(m_elementVal, 1);
......@@ -199,7 +199,7 @@ bool MoleculeParser::parseTerm(double *_resultMass,
// Must end in a ")".
if (nextToken() == ')') {
//qDebug() << "Parsed a submolecule. weight = " << *_result;
//qCDebug(KALZIUM_LIBSCIENCE_LOG) << "Parsed a submolecule. weight = " << *_result;
getNextToken();
} else {
return false;
......@@ -211,7 +211,7 @@ bool MoleculeParser::parseTerm(double *_resultMass,
// Optional number.
if (nextToken() == INT_TOKEN) {
//qDebug() << "Parsed a number: " << intVal();
//qCDebug(KALZIUM_LIBSCIENCE_LOG) << "Parsed a number: " << intVal();
*_resultMass *= intVal();
_resultMap->multiply(intVal());
......@@ -219,7 +219,7 @@ bool MoleculeParser::parseTerm(double *_resultMass,
getNextToken();
}
qDebug() << "Weight of term = " << *_resultMass;
qCDebug(KALZIUM_LIBSCIENCE_LOG) << "Weight of term = " << *_resultMass;
return true;
}
......@@ -233,7 +233,7 @@ int MoleculeParser::getNextToken()
QString name;
#if 0
qDebug() << "getNextToken(): Next character = "
qCDebug(KALZIUM_LIBSCIENCE_LOG) << "getNextToken(): Next character = "
<< nextChar() << endl;
#endif
......@@ -266,11 +266,11 @@ int MoleculeParser::getNextToken()
Element *MoleculeParser::lookupElement(const QString& _name)
{
qDebug() << "looking up " << _name;
qCDebug(KALZIUM_LIBSCIENCE_LOG) << "looking up " << _name;
foreach (Element* e, m_elementList) {
if (e->dataAsVariant(ChemicalDataObject::symbol) == _name) {
qDebug() << "Found element " << _name;
qCDebug(KALZIUM_LIBSCIENCE_LOG) << "Found element " << _name;
return e;
}
}
......@@ -278,7 +278,7 @@ Element *MoleculeParser::lookupElement(const QString& _name)
//if there is an error make m_error true.
m_error = true;
qDebug() << "no such element!: " << _name;
qCDebug(KALZIUM_LIBSCIENCE_LOG) << "no such element!: " << _name;
return nullptr;
}
......@@ -310,7 +310,7 @@ QString MoleculeParser::expandFormula( const QString& _shortString)
_fullString += temp;
} else if (!((expandedTerm = expandTerm(temp)).isEmpty())) {
// If an expansion was made, return the expansion
qDebug() << "expanded" << temp << "to" << expandedTerm;
qCDebug(KALZIUM_LIBSCIENCE_LOG) << "expanded" << temp << "to" << expandedTerm;
_fullString += '('+expandedTerm+')';
} else { // invalid term, append it. (Validation is done later anyway.)
_fullString += temp;
......@@ -347,7 +347,7 @@ QString MoleculeParser::expandFormula( const QString& _shortString)
} else { // invalid character, return it, validation is done again later
_fullString += *i;
++i;
qDebug() << *i << "invalid character!";
qCDebug(KALZIUM_LIBSCIENCE_LOG) << *i << "invalid character!";
}
}
......@@ -368,7 +368,7 @@ QString MoleculeParser::expandTerm (const QString& _group)
// Check file validity
if (!(!file.open(QIODevice::ReadOnly | QIODevice::Text))) {
qDebug() << fileName << " opened";
qCDebug(KALZIUM_LIBSCIENCE_LOG) << fileName << " opened";
QTextStream in(&file);
// Get all shortForms and fullForms in the file.
......@@ -386,7 +386,7 @@ QString MoleculeParser::expandTerm (const QString& _group)
}
}
} else {
qDebug() << fileName << " could not be opened!";
qCDebug(KALZIUM_LIBSCIENCE_LOG) << fileName << " could not be opened!";
}
// Find the system defined aliases
......@@ -396,7 +396,7 @@ QString MoleculeParser::expandTerm (const QString& _group)
// Check file validity
if (!(!file2.open(QIODevice::ReadOnly | QIODevice::Text))) {
qDebug() << fileName << " opened";
qCDebug(KALZIUM_LIBSCIENCE_LOG) << fileName << " opened";
QTextStream in(&file2);
// Get all shortForms and fullForms in the file.
......@@ -413,7 +413,7 @@ QString MoleculeParser::expandTerm (const QString& _group)
}
}
} else {
qDebug() << fileName << " could not be opened!";
qCDebug(KALZIUM_LIBSCIENCE_LOG) << fileName << " could not be opened!";
}
// Sample expansions, work even when file is not found, testing purposes
......
......@@ -7,7 +7,7 @@
#include <ctype.h>
#include <QDebug>
#include "kalzium_libscience_debug.h"
Parser::Parser()
......@@ -125,8 +125,8 @@ bool Parser::parseSimpleFloat(double *_result)
int Parser::getNextChar()
{
// qDebug() << "Parser::getNextChar(): char = " << m_nextChar;
// qDebug() << "m_str.size() " << m_str.size() << " with m_str: " << m_str << " and m_index: " << m_index;
// qCDebug(KALZIUM_LIBSCIENCE_LOG) << "Parser::getNextChar(): char = " << m_nextChar;
// qCDebug(KALZIUM_LIBSCIENCE_LOG) << "m_str.size() " << m_str.size() << " with m_str: " << m_str << " and m_index: " << m_index;
++m_index;
......
......@@ -8,7 +8,7 @@
#include "psetables.h"
#include <QDebug>
#include "kalzium_libscience_debug.h"
#include <KLocalizedString>
......
......@@ -7,7 +7,7 @@
#include "spectrum.h"
#include <QDebug>
#include "kalzium_libscience_debug.h"
#include <QFile>
#include <QList>
......@@ -97,7 +97,7 @@ bool SpectrumParser::endElement(const QString&, const QString& localName, const
} else if (localName == QLatin1String("peakList")) {
d->inSpectrumList_ = false;
} else if (localName == QLatin1String("peak")) {
//X qDebug() << "in 'peak'" << " with this data: " << d->currentPeak->intensity << " (intensity)" ;
//X qCDebug(KALZIUM_LIBSCIENCE_LOG) << "in 'peak'" << " with this data: " << d->currentPeak->intensity << " (intensity)" ;
d->currentSpectrum->addPeak(d->currentPeak);
d->currentPeak = nullptr;
d->inPeak_ = false;
......
......@@ -70,7 +70,7 @@ ki18n_wrap_ui(kalziumtools_SRCS
# calculator/massCalculator.ui
)
ecm_qt_declare_logging_category(kalziumtools_SRCS HEADER kalzium_debug.h IDENTIFIER KALZIUM_LOG CATEGORY_NAME org.kde.kalzium DESCRIPTION "Kalzium" EXPORT KALZIUML)
ecm_qt_declare_logging_category(kalziumtools_SRCS HEADER kalzium_debug.h IDENTIFIER KALZIUM_LOG CATEGORY_NAME org.kde.kalzium DESCRIPTION "Kalzium" EXPORT KALZIUM)
set(kalzium_SRCS
${kalziumtools_SRCS}
detailedgraphicaloverview.cpp
......
Markdown is supported
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