[Kalzium] Minor fixes, reorganize includes, some cleanups

Review Request #120254 - Created Sept. 18, 2014 and discarded

Information
Martin Walch
kalzium
master
Reviewers
kdeedu
  • src/calculator/titrationCalculator.cpp:

replace

if (!texto) {
QMessageBox::critical(this, "Error", "Unable to open " + file);
}
if (texto) {

with

if (!texto) {
QMessageBox::critical(this, "Error", "Unable to open " + file);
} else {

to emphasize that they are logically alternative

  • src/calculator/titrationCalculator.cpp:
    Fix "warning: 'cn' may be used uninitialized in this function".
    As far as I see, this has no proper initialization at all and should
    horribly fail. However, in all my tests it behaved as if it was properly
    initialized with 0.0. Maybe there is some compiler (gcc) magic at work.
    Nevermind. Just fix it.

  • libscience/spectrum.cpp:
    this line goes wrong

    double newInt = p->intensity * 1000 / maxInt;
    because all three of p->intensity, 1000, and maxInt are Integers. Fix it
    with floating point number 1000.0. (The method is not used anywhere in
    Kalzium, but it is part of the libscience library)

  • further cleanup of includes:

replace

#include <qclass.h>

with

#include <QtModule/QClass>

replace

#include <QtModule/QClass>

with

#include <QClass>

replace

#include <kclass.h>

with

#include <KClass>

replace

#include <QtModule>

with the classes of QtModule that are actually necessary.

use forward declarations and move includes into cpp files

remove duplicate or unused includes

(As a side note: single threaded build time reduced by roughly 5%)

  • Drop C bindings in favor of explicit C++ bindings
    (e.g. include cctype, not ctype.h and use std namespace)

  • Replace abs() and isfinite() with their corresponding Qt equivalents
    qAbs() and qIsFinite().

  • Replace M_PI with const double PI = 3.141... as M_PI is bad for
    portability.

  • compiling
  • running program

Issues

  • 1
  • 1
  • 0
  • 2
Description From Last Updated
These changes look a bit arbitrary, why did you decide to change them? Albert Astals Cid Albert Astals Cid
Albert Astals Cid
Martin Walch
Martin Walch
Albert Astals Cid
Albert Astals Cid
Martin Walch
Review request changed

Status: Discarded

Change Summary:

See Albert's last comment.

Loading...