GUI: Use nullptr instead of 0 or NULL where appropriate
This commit is contained in:
parent
c566d02992
commit
6e1abf064a
45 changed files with 402 additions and 404 deletions
|
@ -70,21 +70,21 @@ enum {
|
|||
PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {
|
||||
new StaticTextWidget(this, "Predictive.Headline", "Enter Text");
|
||||
|
||||
_button[kCancelAct] = new ButtonWidget(this, "Predictive.Cancel", _("Cancel") , 0, kCancelCmd);
|
||||
_button[kOkAct] = new ButtonWidget(this, "Predictive.OK", _("Ok") , 0, kOkCmd);
|
||||
_button[kButton1Act] = new ButtonWidget(this, "Predictive.Button1", "1 `-.&" , 0, kBut1Cmd);
|
||||
_button[kButton2Act] = new ButtonWidget(this, "Predictive.Button2", "2 abc" , 0, kBut2Cmd);
|
||||
_button[kButton3Act] = new ButtonWidget(this, "Predictive.Button3", "3 def" , 0, kBut3Cmd);
|
||||
_button[kButton4Act] = new ButtonWidget(this, "Predictive.Button4", "4 ghi" , 0, kBut4Cmd);
|
||||
_button[kButton5Act] = new ButtonWidget(this, "Predictive.Button5", "5 jkl" , 0, kBut5Cmd);
|
||||
_button[kButton6Act] = new ButtonWidget(this, "Predictive.Button6", "6 mno" , 0, kBut6Cmd);
|
||||
_button[kButton7Act] = new ButtonWidget(this, "Predictive.Button7", "7 pqrs" , 0, kBut7Cmd);
|
||||
_button[kButton8Act] = new ButtonWidget(this, "Predictive.Button8", "8 tuv" , 0, kBut8Cmd);
|
||||
_button[kButton9Act] = new ButtonWidget(this, "Predictive.Button9", "9 wxyz" , 0, kBut9Cmd);
|
||||
_button[kButton0Act] = new ButtonWidget(this, "Predictive.Button0", "0" , 0, kBut0Cmd);
|
||||
_button[kCancelAct] = new ButtonWidget(this, "Predictive.Cancel", _("Cancel") , nullptr, kCancelCmd);
|
||||
_button[kOkAct] = new ButtonWidget(this, "Predictive.OK", _("Ok") , nullptr, kOkCmd);
|
||||
_button[kButton1Act] = new ButtonWidget(this, "Predictive.Button1", "1 `-.&" , nullptr, kBut1Cmd);
|
||||
_button[kButton2Act] = new ButtonWidget(this, "Predictive.Button2", "2 abc" , nullptr, kBut2Cmd);
|
||||
_button[kButton3Act] = new ButtonWidget(this, "Predictive.Button3", "3 def" , nullptr, kBut3Cmd);
|
||||
_button[kButton4Act] = new ButtonWidget(this, "Predictive.Button4", "4 ghi" , nullptr, kBut4Cmd);
|
||||
_button[kButton5Act] = new ButtonWidget(this, "Predictive.Button5", "5 jkl" , nullptr, kBut5Cmd);
|
||||
_button[kButton6Act] = new ButtonWidget(this, "Predictive.Button6", "6 mno" , nullptr, kBut6Cmd);
|
||||
_button[kButton7Act] = new ButtonWidget(this, "Predictive.Button7", "7 pqrs" , nullptr, kBut7Cmd);
|
||||
_button[kButton8Act] = new ButtonWidget(this, "Predictive.Button8", "8 tuv" , nullptr, kBut8Cmd);
|
||||
_button[kButton9Act] = new ButtonWidget(this, "Predictive.Button9", "9 wxyz" , nullptr, kBut9Cmd);
|
||||
_button[kButton0Act] = new ButtonWidget(this, "Predictive.Button0", "0" , nullptr, kBut0Cmd);
|
||||
// I18N: You must leave "#" as is, only word 'next' is translatable
|
||||
_button[kNextAct] = new ButtonWidget(this, "Predictive.Next", _("# next") , 0, kNextCmd);
|
||||
_button[kAddAct] = new ButtonWidget(this, "Predictive.Add", _("add") , 0, kAddCmd);
|
||||
_button[kNextAct] = new ButtonWidget(this, "Predictive.Next", _("# next") , nullptr, kNextCmd);
|
||||
_button[kAddAct] = new ButtonWidget(this, "Predictive.Add", _("add") , nullptr, kAddCmd);
|
||||
_button[kAddAct]->setEnabled(false);
|
||||
|
||||
#ifndef DISABLE_FANCY_THEMES
|
||||
|
@ -94,10 +94,10 @@ PredictiveDialog::PredictiveDialog() : Dialog("Predictive") {
|
|||
((PicButtonWidget *)_button[kDelAct])->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageDelButton));
|
||||
} else
|
||||
#endif
|
||||
_button[kDelAct] = new ButtonWidget(this, "Predictive.Delete" , _("<") , 0, kDelCmd);
|
||||
_button[kDelAct] = new ButtonWidget(this, "Predictive.Delete" , _("<") , nullptr, kDelCmd);
|
||||
// I18N: Pre means 'Predictive', leave '*' as is
|
||||
_button[kModeAct] = new ButtonWidget(this, "Predictive.Pre", _("* Pre"), 0, kModeCmd);
|
||||
_editText = new EditTextWidget(this, "Predictive.Word", _search, 0, 0, 0);
|
||||
_button[kModeAct] = new ButtonWidget(this, "Predictive.Pre", _("* Pre"), nullptr, kModeCmd);
|
||||
_editText = new EditTextWidget(this, "Predictive.Word", _search, nullptr, 0, 0);
|
||||
|
||||
_userDictHasChanged = false;
|
||||
|
||||
|
@ -159,7 +159,7 @@ PredictiveDialog::~PredictiveDialog() {
|
|||
void PredictiveDialog::reflowLayout() {
|
||||
#ifndef DISABLE_FANCY_THEMES
|
||||
removeWidget(_button[kDelAct]);
|
||||
_button[kDelAct]->setNext(0);
|
||||
_button[kDelAct]->setNext(nullptr);
|
||||
delete _button[kDelAct];
|
||||
_button[kDelAct] = nullptr;
|
||||
|
||||
|
@ -168,7 +168,7 @@ void PredictiveDialog::reflowLayout() {
|
|||
((PicButtonWidget *)_button[kDelAct])->useThemeTransparency(true);
|
||||
((PicButtonWidget *)_button[kDelAct])->setGfx(g_gui.theme()->getImageSurface(ThemeEngine::kImageDelButton));
|
||||
} else {
|
||||
_button[kDelAct] = new ButtonWidget(this, "Predictive.Delete" , _("<") , 0, kDelCmd);
|
||||
_button[kDelAct] = new ButtonWidget(this, "Predictive.Delete" , _("<") , nullptr, kDelCmd);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -456,7 +456,7 @@ void PredictiveDialog::processButton(ButtonId button) {
|
|||
"next", "add",
|
||||
"<",
|
||||
"Cancel", "OK",
|
||||
"Pre", "(0) ", NULL
|
||||
"Pre", "(0) ", nullptr
|
||||
};
|
||||
|
||||
if (_mode == kModeAbc) {
|
||||
|
@ -544,7 +544,7 @@ void PredictiveDialog::processButton(ButtonId button) {
|
|||
tmp[kMaxLineLen - 1] = 0;
|
||||
char *tok = strtok(tmp, " ");
|
||||
for (uint8 i = 0; i <= _wordNumber; i++)
|
||||
tok = strtok(NULL, " ");
|
||||
tok = strtok(nullptr, " ");
|
||||
_currentWord = Common::String(tok, _currentCode.size());
|
||||
}
|
||||
} else if (_mode == kModeAbc) {
|
||||
|
@ -682,7 +682,7 @@ void PredictiveDialog::bringWordtoTop(char *str, int wordnum) {
|
|||
}
|
||||
|
||||
words.push_back(word);
|
||||
while ((word = strtok(NULL, " ")) != NULL)
|
||||
while ((word = strtok(nullptr, " ")) != nullptr)
|
||||
words.push_back(word);
|
||||
words.insert_at(1, words.remove_at(wordnum + 1));
|
||||
|
||||
|
@ -738,7 +738,7 @@ bool PredictiveDialog::matchWord() {
|
|||
int line = binarySearch(_unitedDict.dictLine, code, _unitedDict.dictLineCount);
|
||||
if (line < 0) {
|
||||
line = -(line + 1);
|
||||
_unitedDict.dictActLine = NULL;
|
||||
_unitedDict.dictActLine = nullptr;
|
||||
} else {
|
||||
_unitedDict.dictActLine = _unitedDict.dictLine[line];
|
||||
}
|
||||
|
@ -751,7 +751,7 @@ bool PredictiveDialog::matchWord() {
|
|||
tmp[kMaxLineLen - 1] = 0;
|
||||
char *tok;
|
||||
strtok(tmp, " ");
|
||||
tok = strtok(NULL, " ");
|
||||
tok = strtok(nullptr, " ");
|
||||
_currentWord = Common::String(tok, _currentCode.size());
|
||||
return true;
|
||||
} else {
|
||||
|
@ -781,7 +781,7 @@ bool PredictiveDialog::searchWord(const char *const where, const Common::String
|
|||
}
|
||||
|
||||
void PredictiveDialog::addWord(Dict &dict, const Common::String &word, const Common::String &code) {
|
||||
char *newLine = 0;
|
||||
char *newLine = nullptr;
|
||||
Common::String tmpCode = code + ' ';
|
||||
int line = binarySearch(dict.dictLine, tmpCode, dict.dictLineCount);
|
||||
if (line >= 0) {
|
||||
|
@ -937,7 +937,7 @@ void PredictiveDialog::loadDictionary(Common::SeekableReadStream *in, Dict &dict
|
|||
}
|
||||
|
||||
dict.dictLine = (char **)calloc(lines, sizeof(char *));
|
||||
if (dict.dictLine == NULL) {
|
||||
if (dict.dictLine == nullptr) {
|
||||
warning("Predictive Dialog: Cannot allocate memory for line index buffer");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue