Commit a38967b2 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr
Browse files

Initialize all members

Avoid mixing of different methods of member initialization and fix many
cases of uninitialized pointers and integers.
parent c7641af7
......@@ -19,8 +19,8 @@ extern ConfidenceColors globalColors;
class BarWidget : public QWidget
{
public:
explicit BarWidget(QWidget *parent = 0);
explicit BarWidget(WordCount *dueWords, QWidget *parent = 0);
explicit BarWidget(QWidget *parent = nullptr);
explicit BarWidget(WordCount *dueWords, QWidget *parent = nullptr);
void setDue(WordCount &wc);
......
......@@ -12,7 +12,7 @@
class GradeReferenceWidget : public QWidget
{
public:
explicit GradeReferenceWidget(QWidget *parent = 0);
explicit GradeReferenceWidget(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent *) override;
......
......@@ -53,9 +53,8 @@ QString FromToEntryPage::gradeToString(int i)
FromToEntryPage::FromToEntryPage(KEduVocDocument *doc, int fromIdentifier, int toIdentifier, QWidget *parent)
: QWidget(parent)
, m_doc(doc)
{
m_doc = doc;
m_translationFrom = fromIdentifier;
m_translationTo = toIdentifier;
......
......@@ -21,7 +21,7 @@ class FromToEntryPage : public QWidget, public Ui::FromToEntryPageForm
Q_OBJECT
public:
explicit FromToEntryPage(KEduVocDocument *doc, int fromIdentifier, int toIdentifier, QWidget *parent = 0);
explicit FromToEntryPage(KEduVocDocument *doc, int fromIdentifier, int toIdentifier, QWidget *parent = nullptr);
public slots:
void setData(const QList<int> &entries);
......@@ -46,7 +46,7 @@ private:
/// get a text representation of a grade
static QString gradeStr(int i);
KEduVocDocument *m_doc;
KEduVocDocument *m_doc{nullptr};
int m_translationFrom;
int m_translationTo;
QList<int> m_entries;
......
......@@ -13,13 +13,12 @@ using namespace Editor;
BrowserWidget::BrowserWidget(QWidget *parent)
: QWidget(parent)
, m_htmlPart{new QWebEngineView(widget)}
{
setupUi(this);
m_currentTranslation = -1;
m_entry = 0;
m_currentProvider = 0; ///@todo kconfig?
m_htmlPart = new QWebEngineView(widget);
QHBoxLayout *layout = new QHBoxLayout(widget);
widget->setLayout(layout);
layout->addWidget(m_htmlPart);
......
......@@ -23,7 +23,7 @@ class BrowserWidget : public QWidget, public Ui::BrowserWidget
{
Q_OBJECT
public:
explicit BrowserWidget(QWidget *parent = 0);
explicit BrowserWidget(QWidget *parent = nullptr);
public slots:
/**
......@@ -47,9 +47,9 @@ private:
/// Column in the document - corresponds to the language (-KV_COL_TRANS)
int m_currentTranslation;
/// Selection in the doc - if more than one row is selected behavior is different
KEduVocExpression *m_entry;
KEduVocExpression *m_entry{nullptr};
QWebEngineView *m_htmlPart;
QWebEngineView *m_htmlPart{nullptr};
QList<DictionaryProvider> m_providers;
int m_currentProvider;
};
......
......@@ -19,8 +19,6 @@ ComparisonWidget::ComparisonWidget(QWidget *parent)
{
setupUi(this);
m_doc = 0;
connect(makeAdjectiveButton, &QPushButton::clicked, this, &ComparisonWidget::slotMakeAdjectiveButton);
connect(makeAdverbButton, &QPushButton::clicked, this, &ComparisonWidget::slotMakeAdverbButton);
......
......@@ -22,7 +22,7 @@ class ComparisonWidget : public QWidget, public Ui::comparisonWidget
Q_OBJECT
public:
explicit ComparisonWidget(QWidget *parent = 0);
explicit ComparisonWidget(QWidget *parent = nullptr);
public slots:
/**
......@@ -45,8 +45,8 @@ private slots:
void slotSuperlativeChanged();
private:
KEduVocTranslation *m_translation;
KEduVocDocument *m_doc;
KEduVocTranslation *m_translation{nullptr};
KEduVocDocument *m_doc{nullptr};
};
}
......
......@@ -15,10 +15,6 @@ using namespace Editor;
ConjugationWidget::ConjugationWidget(QWidget *parent)
: QWidget(parent)
{
m_doc = 0;
m_entry = 0;
m_identifier = -1;
setupUi(this);
connect(nextTenseButton, &QPushButton::clicked, this, &ConjugationWidget::slotNextTense);
......
......@@ -46,9 +46,9 @@ private:
void updateEntries();
QString m_lastTenseSelection;
int m_identifier;
KEduVocExpression *m_entry;
KEduVocDocument *m_doc;
int m_identifier{-1};
KEduVocExpression *m_entry{nullptr};
KEduVocDocument *m_doc{nullptr};
/**
* All line edits and labels, index corresponding to KEduVocWordFlag::indexOf
......
......@@ -18,10 +18,6 @@ using namespace Editor;
DeclensionWidget::DeclensionWidget(QWidget *parent)
: QWidget(parent)
{
m_doc = 0;
m_entry = 0;
m_identifier = -1;
setupUi(this);
numberSelection->setItemData(0, KEduVocWordFlag::Singular);
......
......@@ -20,7 +20,7 @@ class DeclensionWidget : public QWidget, public Ui::DeclensionWidget
Q_OBJECT
public:
explicit DeclensionWidget(QWidget *parent = 0);
explicit DeclensionWidget(QWidget *parent = nullptr);
public slots:
void setDocument(KEduVocDocument *doc);
......@@ -43,9 +43,9 @@ private:
int currentAdditionalWordFlag();
void setupLineEdits();
int m_identifier;
KEduVocExpression *m_entry;
KEduVocDocument *m_doc;
int m_identifier{-1};
KEduVocExpression *m_entry{nullptr};
KEduVocDocument *m_doc{nullptr};
/**
* All line edits and labels, index corresponding to KEduVocWordFlag::indexOf
......
......@@ -102,34 +102,34 @@ signals:
void signalSetData(const QList<int> &entries, int currentTranslation);
private:
ParleyMainWindow *m_mainWindow;
ParleyMainWindow *m_mainWindow{nullptr};
QAction *m_vocabShowSearchBarAction;
QAction *m_vocabShowSearchBarAction{nullptr};
VocabularyModel *m_vocabularyModel;
VocabularyView *m_vocabularyView;
VocabularyFilter *m_vocabularyFilter;
VocabularyModel *m_vocabularyModel{nullptr};
VocabularyView *m_vocabularyView{nullptr};
VocabularyFilter *m_vocabularyFilter{nullptr};
QLineEdit *m_searchLine;
QWidget *m_searchWidget;
QAction *m_spellCheckMenu;
QLineEdit *m_searchLine{nullptr};
QWidget *m_searchWidget{nullptr};
QAction *m_spellCheckMenu{nullptr};
/** Show a single conjugation and let the user edit it */
InflectionWidget *m_inflectionWidget;
SummaryWordWidget *m_summaryWordWidget;
ComparisonWidget *m_comparisonWidget;
LatexWidget *m_latexWidget;
SynonymWidget *m_synonymWidget;
SynonymWidget *m_antonymWidget;
SynonymWidget *m_falseFriendWidget;
AudioWidget *m_audioWidget;
InflectionWidget *m_inflectionWidget{nullptr};
SummaryWordWidget *m_summaryWordWidget{nullptr};
ComparisonWidget *m_comparisonWidget{nullptr};
LatexWidget *m_latexWidget{nullptr};
SynonymWidget *m_synonymWidget{nullptr};
SynonymWidget *m_antonymWidget{nullptr};
SynonymWidget *m_falseFriendWidget{nullptr};
AudioWidget *m_audioWidget{nullptr};
/// dock widgets to display lessons, word types, ...
LessonView *m_lessonView;
LessonModel *m_lessonModel;
LessonView *m_lessonView{nullptr};
LessonModel *m_lessonModel{nullptr};
WordClassModel *m_wordTypeModel;
WordTypeView *m_wordTypeView;
WordClassModel *m_wordTypeModel{nullptr};
WordTypeView *m_wordTypeView{nullptr};
QList<QDockWidget *> m_dockWidgets;
QList<bool> m_dockWidgetVisibility;
......
......@@ -17,7 +17,6 @@ ImageChooserWidget::ImageChooserWidget(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
m_currentTranslation = -1;
connect(imageUrlRequester, &KUrlRequester::textChanged, this, &ImageChooserWidget::slotImageChanged);
......
......@@ -16,7 +16,7 @@ class ImageChooserWidget : public QWidget, public Ui::ImageChooserWidget
{
Q_OBJECT
public:
explicit ImageChooserWidget(QWidget *parent = 0);
explicit ImageChooserWidget(QWidget *parent = nullptr);
public slots:
/**
......@@ -41,9 +41,9 @@ protected:
private:
/// Column in the document - corresponds to the language (-KV_COL_TRANS)
int m_currentTranslation;
int m_currentTranslation{-1};
/// Selection in the doc - if more than one row is selected behavior is different
KEduVocExpression *m_entry;
KEduVocExpression *m_entry{nullptr};
};
}
#endif
......@@ -26,7 +26,7 @@ class InflectionWidget : public QStackedWidget
Q_OBJECT
public:
explicit InflectionWidget(QWidget *parent = 0);
explicit InflectionWidget(QWidget *parent = nullptr);
public slots:
void setDocument(const std::shared_ptr<KEduVocDocument> &doc);
......@@ -36,13 +36,13 @@ private slots:
void setWordType();
private:
QWidget *m_wordTypeWidget;
DeclensionWidget *m_declensionWidget;
ConjugationWidget *m_conjugationWidget;
QWidget *m_wordTypeWidget{nullptr};
DeclensionWidget *m_declensionWidget{nullptr};
ConjugationWidget *m_conjugationWidget{nullptr};
std::shared_ptr<KEduVocDocument> m_doc;
KEduVocExpression *m_entry;
int m_translation;
std::shared_ptr<KEduVocDocument> m_doc{nullptr};
KEduVocExpression *m_entry{nullptr};
int m_translation{-1};
};
}
......
......@@ -15,12 +15,9 @@ using namespace Editor;
LatexWidget::LatexWidget(VocabularyFilter *model, KEduVocDocument *doc, QWidget *parent)
: QWidget(parent)
, m_translation(0)
, m_renderer(0)
, m_model{model}
, m_doc{doc}
{
m_doc = doc;
m_model = model;
setupUi(this);
lineEdit->setPlaceholderText(i18n("Enter LaTeX code here."));
m_mapper = new QDataWidgetMapper(this);
......@@ -91,7 +88,6 @@ void LatexWidget::updateLatex()
LatexDelegate::LatexDelegate(QObject *parent)
: QItemDelegate(parent)
, m_checkBox(0)
{
}
......
......@@ -30,7 +30,7 @@ class LatexWidget : public QWidget, public Ui::LatexWidget
Q_OBJECT
public:
LatexWidget(VocabularyFilter *model, KEduVocDocument *doc, QWidget *parent = 0);
LatexWidget(VocabularyFilter *model, KEduVocDocument *doc, QWidget *parent = nullptr);
~LatexWidget() override;
public slots:
......@@ -54,19 +54,19 @@ public slots:
void updateLatex();
private:
VocabularyFilter *m_model;
KEduVocDocument *m_doc;
QDataWidgetMapper *m_mapper;
KEduVocTranslation *m_translation;
VocabularyFilter *m_model{nullptr};
KEduVocDocument *m_doc{nullptr};
QDataWidgetMapper *m_mapper{nullptr};
KEduVocTranslation *m_translation{nullptr};
QLabel m_hiddenLabel;
Practice::LatexRenderer *m_renderer;
Practice::LatexRenderer *m_renderer{nullptr};
};
class LatexDelegate : public QItemDelegate
{
Q_OBJECT
public:
explicit LatexDelegate(QObject *parent = 0);
explicit LatexDelegate(QObject *parent = nullptr);
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
......@@ -76,7 +76,7 @@ public:
}
private:
QCheckBox *m_checkBox;
QCheckBox *m_checkBox{nullptr};
};
}
......
......@@ -88,8 +88,8 @@ private:
Q_UNUSED(model)
}
LessonModel *m_model;
EditorWindow *m_editorWindow;
LessonModel *m_model{nullptr};
EditorWindow *m_editorWindow{nullptr};
};
}
......
......@@ -20,7 +20,6 @@ using namespace Editor;
MultipleChoiceWidget::MultipleChoiceWidget(QWidget *parent)
: QWidget(parent)
, m_translation(Q_NULLPTR)
, m_choicesModel(new QStringListModel(this))
{
setupUi(this);
......
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