Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 92f30db0 authored by Laurent Montel's avatar Laurent Montel 😁

Add missing override + use nullptr + remove warnings

parent 5d6c1e7a
......@@ -28,7 +28,7 @@ class BitButton : public QAbstractButton {
Q_OBJECT
public:
explicit BitButton(QWidget *parent = 0);
explicit BitButton(QWidget *parent = nullptr);
bool isOn() const;
void setOn(bool value);
......
......@@ -68,8 +68,8 @@ KCalculator::KCalculator(QWidget *parent) :
shift_mode_(false),
hyp_mode_(false),
memory_num_(0.0),
constants_menu_(0),
constants_(0),
constants_menu_(nullptr),
constants_(nullptr),
core() {
// central widget to contain all the elements
......@@ -719,7 +719,7 @@ void KCalculator::slotConstantToDisplay(const science_constant &const_chosen) {
QString val = const_chosen.value;
val.replace(QLatin1Char('.'), KNumber::decimalSeparator());
calc_display->setAmount(KNumber(val));
updateDisplay(0);
updateDisplay({});
}
//------------------------------------------------------------------------------
......@@ -899,7 +899,7 @@ void KCalculator::slotMemRecallclicked() {
calc_display->sendEvent(KCalcDisplay::EventReset);
calc_display->setAmount(memory_num_);
updateDisplay(0);
updateDisplay({});
}
//------------------------------------------------------------------------------
......@@ -1069,7 +1069,7 @@ void KCalculator::slotReciclicked() {
KNumber tmp_num = calc_display->getAmount();
calc_display->sendEvent(KCalcDisplay::EventReset);
calc_display->setAmount(tmp_num);
updateDisplay(0);
updateDisplay({});
}
//------------------------------------------------------------------------------
......@@ -1213,7 +1213,7 @@ void KCalculator::slotPowerclicked() {
KNumber tmp_num = calc_display->getAmount();
calc_display->sendEvent(KCalcDisplay::EventReset);
calc_display->setAmount(tmp_num);
updateDisplay(0);
updateDisplay({});
}
//------------------------------------------------------------------------------
......@@ -1529,7 +1529,7 @@ void KCalculator::slotStatClearDataclicked() {
statusBar()->showMessage(i18n("Stat mem cleared"), 3000);
} else {
pbShift->setChecked(false);
updateDisplay(0);
updateDisplay({});
}
}
......@@ -1563,7 +1563,7 @@ void KCalculator::slotConstclicked(int button) {
calc_display->setAmount(calc_display->getAmount());
}
updateDisplay(0);
updateDisplay({});
}
}
......@@ -1583,21 +1583,21 @@ void KCalculator::showSettings() {
KConfigDialog *const dialog = new KConfigDialog(this, QLatin1String("settings"), KCalcSettings::self());
// general settings
General *const general = new General(0);
General *const general = new General(nullptr);
general->kcfg_Precision->setMaximum(maxprecision);
dialog->addPage(general, i18n("General"), QLatin1String("accessories-calculator"), i18n("General Settings"));
// font settings
Fonts *const fonts = new Fonts(0);
Fonts *const fonts = new Fonts(nullptr);
dialog->addPage(fonts, i18n("Font"), QLatin1String("preferences-desktop-font"), i18n("Select Display Font"));
// color settings
Colors *const color = new Colors(0);
Colors *const color = new Colors(nullptr);
dialog->addPage(color, i18n("Colors"), QLatin1String("format-fill-color"), i18n("Button & Display Colors"));
// constant settings
if (!constants_) {
constants_ = new Constants(0);
constants_ = new Constants(nullptr);
}
KCalcConstMenu *tmp_menu;
......@@ -1720,7 +1720,7 @@ void KCalculator::slotSetSimpleMode() {
// delete the constant menu since it doesn't fit
delete constants_menu_;
constants_menu_ = 0;
constants_menu_ = nullptr;
KCalcSettings::setCalculatorMode(KCalcSettings::EnumCalculatorMode::simple);
// must be done after setting the calculator mode because the
......@@ -2012,7 +2012,7 @@ void KCalculator::changeButtonNames() {
void KCalculator::slotBitsetChanged(quint64 value) {
calc_display->setAmount(KNumber(value));
updateDisplay(0);
updateDisplay({});
}
//------------------------------------------------------------------------------
......@@ -2036,7 +2036,7 @@ void KCalculator::updateSettings() {
setPrecision();
// Show the result in the app's caption in taskbar (wishlist - bug #52858)
disconnect(calc_display, SIGNAL(changedText(QString)), this, 0);
disconnect(calc_display, SIGNAL(changedText(QString)), this, nullptr);
if (KCalcSettings::captionResult()) {
connect(calc_display, &KCalcDisplay::changedText, this, &KCalculator::setWindowTitle);
......@@ -2171,7 +2171,7 @@ bool KCalculator::event(QEvent *e) {
void KCalculator::setPrecision() {
KNumber::setDefaultFloatPrecision(KCalcSettings::precision());
updateDisplay(0);
updateDisplay({});
}
//------------------------------------------------------------------------------
......
......@@ -62,6 +62,7 @@ class KCalcStatusBar;
class General: public QWidget, public Ui::General
{
Q_OBJECT
public:
explicit General(QWidget *parent) : QWidget(parent) {
setupUi(this);
......@@ -70,6 +71,7 @@ public:
class Fonts: public QWidget, public Ui::Fonts
{
Q_OBJECT
public:
explicit Fonts(QWidget *parent) : QWidget(parent) {
setupUi(this);
......@@ -78,6 +80,7 @@ public:
class Constants : public QWidget, public Ui::Constants
{
Q_OBJECT
public:
explicit Constants(QWidget *parent) : QWidget(parent) {
setupUi(this);
......@@ -86,6 +89,7 @@ public:
class Colors : public QWidget, public Ui::Colors
{
Q_OBJECT
public:
explicit Colors(QWidget *parent) : QWidget(parent) {
setupUi(this);
......@@ -98,7 +102,7 @@ class KCalculator : public KXmlGuiWindow, private Ui::KCalculator
Q_OBJECT
public:
explicit KCalculator(QWidget *parent = 0);
explicit KCalculator(QWidget *parent = nullptr);
~KCalculator();
Q_SIGNALS:
......
......@@ -30,7 +30,7 @@ class KCalcBitset : public QFrame {
Q_OBJECT
public:
explicit KCalcBitset(QWidget *parent = 0);
explicit KCalcBitset(QWidget *parent = nullptr);
quint64 getValue() const;
public Q_SLOTS:
......
......@@ -191,7 +191,7 @@ QSize KCalcButton::sizeHint() const {
//------------------------------------------------------------------------------
void KCalcButton::calcSizeHint() {
int margin = style()->pixelMetric(QStyle::PM_ButtonMargin, 0, this);
int margin = style()->pixelMetric(QStyle::PM_ButtonMargin, nullptr, this);
// want narrow margin than normal
margin = qMax(margin / 2, 3);
......
......@@ -45,8 +45,8 @@ class KCalcConstMenu : public QMenu {
Q_OBJECT
public:
explicit KCalcConstMenu(QWidget * parent = 0);
explicit KCalcConstMenu(const QString &title, QWidget * parent = 0);
explicit KCalcConstMenu(QWidget * parent = nullptr);
explicit KCalcConstMenu(const QString &title, QWidget * parent = nullptr);
public:
static void init_consts();
......
......@@ -28,7 +28,7 @@ class KCalcStatusBar : public QStatusBar
Q_OBJECT
public:
KCalcStatusBar(QWidget *parent = 0);
explicit KCalcStatusBar(QWidget *parent = nullptr);
~KCalcStatusBar();
public:
......
......@@ -60,8 +60,8 @@ class KCalcDisplay : public QFrame {
Q_OBJECT
public:
explicit KCalcDisplay(QWidget *parent = 0);
~KCalcDisplay();
explicit KCalcDisplay(QWidget *parent = nullptr);
~KCalcDisplay() override;
enum Event {
EventReset, // resets display
......
......@@ -273,7 +273,7 @@ KNumber::KNumber() : value_(new detail::knumber_integer(0)) {
//------------------------------------------------------------------------------
// Name: KNumber
//------------------------------------------------------------------------------
KNumber::KNumber(const QString &s) : value_(0) {
KNumber::KNumber(const QString &s) : value_(nullptr) {
const QRegExp special_regex(QLatin1String("^(inf|-inf|nan)$"));
const QRegExp integer_regex(QLatin1String("^[+-]?\\d+$"));
......@@ -381,7 +381,7 @@ KNumber::KNumber(double value) : value_(new detail::knumber_float(value)) {
//------------------------------------------------------------------------------
// Name: KNumber
//------------------------------------------------------------------------------
KNumber::KNumber(const KNumber &other) : value_(0) {
KNumber::KNumber(const KNumber &other) : value_(nullptr) {
if(&other != this) {
value_ = other.value_->clone();
}
......
......@@ -39,7 +39,7 @@ class knumber_float;
class knumber_base {
public:
virtual ~knumber_base() { }
virtual ~knumber_base() = default;
public:
virtual knumber_base *clone() = 0;
......
......@@ -42,7 +42,7 @@ public:
explicit knumber_error(const QString &s);
explicit knumber_error(Error e);
knumber_error();
virtual ~knumber_error();
~knumber_error() override;
public:
QString toString(int precision) const override;
......
......@@ -45,7 +45,7 @@ public:
#endif
explicit knumber_float(mpf_t mpf);
virtual ~knumber_float();
~knumber_float() override;
private:
// conversion constructors
......
......@@ -156,7 +156,7 @@ knumber_base *knumber_fraction::add(knumber_base *rhs) {
}
Q_ASSERT(0);
return 0;
return nullptr;
}
//------------------------------------------------------------------------------
......@@ -182,7 +182,7 @@ knumber_base *knumber_fraction::sub(knumber_base *rhs) {
}
Q_ASSERT(0);
return 0;
return nullptr;
}
//------------------------------------------------------------------------------
......@@ -220,7 +220,7 @@ knumber_base *knumber_fraction::mul(knumber_base *rhs) {
}
Q_ASSERT(0);
return 0;
return nullptr;
}
//------------------------------------------------------------------------------
......@@ -264,7 +264,7 @@ knumber_base *knumber_fraction::div(knumber_base *rhs) {
}
Q_ASSERT(0);
return 0;
return nullptr;
}
//------------------------------------------------------------------------------
......@@ -559,7 +559,7 @@ knumber_base *knumber_fraction::pow(knumber_base *rhs) {
}
Q_ASSERT(0);
return 0;
return nullptr;
}
//------------------------------------------------------------------------------
......@@ -753,7 +753,7 @@ QString knumber_fraction::toString(int precision) const {
mpz_neg(num, num);
}
const size_t size = gmp_snprintf(NULL, 0, "%Zd %Zd/%Zd", integer_part_1.mpz_, num, mpq_denref(mpq_)) + 1;
const size_t size = gmp_snprintf(nullptr, 0, "%Zd %Zd/%Zd", integer_part_1.mpz_, num, mpq_denref(mpq_)) + 1;
QScopedArrayPointer<char> buf(new char[size]);
gmp_snprintf(&buf[0], size, "%Zd %Zd/%Zd", integer_part_1.mpz_, num, mpq_denref(mpq_));
......@@ -766,7 +766,7 @@ QString knumber_fraction::toString(int precision) const {
mpz_init(num);
mpq_get_num(num, mpq_);
const size_t size = gmp_snprintf(NULL, 0, "%Zd/%Zd", num, mpq_denref(mpq_)) + 1;
const size_t size = gmp_snprintf(nullptr, 0, "%Zd/%Zd", num, mpq_denref(mpq_)) + 1;
QScopedArrayPointer<char> buf(new char[size]);
gmp_snprintf(&buf[0], size, "%Zd/%Zd", num, mpq_denref(mpq_));
......
......@@ -46,7 +46,7 @@ public:
knumber_fraction(qint64 num, quint64 den);
knumber_fraction(quint64 num, quint64 den);
explicit knumber_fraction(mpq_t mpq);
virtual ~knumber_fraction();
~knumber_fraction() override;
public:
knumber_base *clone() override;
......
......@@ -38,7 +38,7 @@ public:
explicit knumber_integer(quint32 value);
explicit knumber_integer(quint64 value);
explicit knumber_integer(mpz_t mpz);
virtual ~knumber_integer();
~knumber_integer() override;
public:
knumber_base *clone() override;
......
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