Skip to content

Commit

Permalink
GUI: Add constructor instead of duplicating initialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Schickel committed Jan 24, 2016
1 parent 1447658 commit c72d95c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
17 changes: 0 additions & 17 deletions gui/predictivedialog.cpp
Expand Up @@ -105,30 +105,16 @@ PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {

_predictiveDict.nameDict = "predictive_dictionary";
_predictiveDict.defaultFilename = "pred.dic";
_predictiveDict.dictActLine = NULL;

_userDict.nameDict = "user_dictionary";
_userDict.defaultFilename = "user.dic";
_userDict.dictActLine = NULL;

_unitedDict.nameDict = "";
_unitedDict.defaultFilename = "";

_predictiveDict.dictLine = NULL;
_predictiveDict.dictText = NULL;
_predictiveDict.dictLineCount = 0;

if (!_predictiveDict.dictText) {
loadAllDictionary(_predictiveDict);
if (!_predictiveDict.dictText)
debug(5, "Predictive Dialog: pred.dic not loaded");
}

_userDict.dictLine = NULL;
_userDict.dictText = NULL;
_userDict.dictTextSize = 0;
_userDict.dictLineCount = 0;

if (!_userDict.dictText) {
loadAllDictionary(_userDict);
if (!_userDict.dictText)
Expand All @@ -137,9 +123,6 @@ PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {

mergeDicts();

_unitedDict.dictActLine = NULL;
_unitedDict.dictText = NULL;

memset(_repeatcount, 0, sizeof(_repeatcount));

_prefix.clear();
Expand Down
2 changes: 2 additions & 0 deletions gui/predictivedialog.h
Expand Up @@ -78,6 +78,8 @@ class PredictiveDialog : public GUI::Dialog {
const char *getResult() const { return _predictiveResult; }
private:
struct Dict {
Dict() : dictLine(nullptr), dictText(nullptr), dictActLine(nullptr),
dictLineCount(0), dictTextSize(0) {}
char **dictLine;
char *dictText;
char *dictActLine; // using only for united dict...
Expand Down

0 comments on commit c72d95c

Please sign in to comment.