summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-08 23:02:06 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-08 23:02:06 +0300
commit7e66a4606bb15d98197f71245fe191d03152ee5f (patch)
tree825022571cfb55d70f1ca3c142f79db3758fb72b /src/gui/windows
parenta61ac4664d55cddb18d2d861e76629bd07676129 (diff)
downloadmv-7e66a4606bb15d98197f71245fe191d03152ee5f.tar.gz
mv-7e66a4606bb15d98197f71245fe191d03152ee5f.tar.bz2
mv-7e66a4606bb15d98197f71245fe191d03152ee5f.tar.xz
mv-7e66a4606bb15d98197f71245fe191d03152ee5f.zip
Improve some empty string checks.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/chatwindow.cpp4
-rw-r--r--src/gui/windows/logindialog.cpp5
-rw-r--r--src/gui/windows/ministatuswindow.cpp2
-rw-r--r--src/gui/windows/npcdialog.cpp4
-rw-r--r--src/gui/windows/updaterwindow.cpp2
5 files changed, 10 insertions, 7 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 1551c10ae..5be54a6f9 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -801,7 +801,7 @@ void ChatWindow::keyPressed(KeyEvent &event)
mChatInput->getText().length()));
}
else if (actionId == InputAction::GUI_INSERT &&
- mChatInput->getText() != "")
+ !mChatInput->getText().empty())
{
// Add the current message to the history and clear the text
if (mHistory.empty() || mChatInput->getText() != mHistory.back())
@@ -1505,7 +1505,7 @@ std::string ChatWindow::autoCompleteHistory(const std::string &partName) const
f++;
line = line.substr(0, f);
- if (line != "")
+ if (!line.empty())
nameList.push_back(line);
++i;
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index c39486dda..34f84fee4 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -125,8 +125,11 @@ LoginDialog::LoginDialog(LoginData &data,
}
mUpdateHostText->adjustSize();
- if (mPassField->getText().empty() && LoginDialog::savedPassword != "")
+ if (mPassField->getText().empty() &&
+ !LoginDialog::savedPassword.empty())
+ {
mPassField->setText(LoginDialog::savedPassword);
+ }
mUpdateTypeDropDown->setActionEventId("updatetype");
mUpdateTypeDropDown->setSelected((mLoginData->updateType
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp
index fc2e9a82c..e0fe46bb3 100644
--- a/src/gui/windows/ministatuswindow.cpp
+++ b/src/gui/windows/ministatuswindow.cpp
@@ -507,7 +507,7 @@ void MiniStatusWindow::loadBars()
{
const std::string str = config.getValue(
"ministatus" + toString(f), "");
- if (str == "")
+ if (str.empty())
continue;
ProgressBar *const bar = mBarNames[str];
if (!bar)
diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp
index 27386af5b..452567b94 100644
--- a/src/gui/windows/npcdialog.cpp
+++ b/src/gui/windows/npcdialog.cpp
@@ -489,7 +489,7 @@ void NpcDialog::action(const ActionEvent &event)
const int sz = mComplexInventory->getSize();
if (sz == 0)
{
- str = "";
+ str.clear();
}
else
{
@@ -1385,7 +1385,7 @@ std::string NpcDialog::complexItemToStr(const ComplexItem *const item)
}
else
{
- str = "";
+ str.clear();
}
return str;
}
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index e6e97553a..09f529259 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -145,7 +145,7 @@ static std::vector<UpdateFile> loadTxtFile(const std::string &fileName)
thisFile.name = name;
thisFile.hash = hash;
thisFile.type = "data";
- thisFile.group = "";
+ thisFile.group.clear();
thisFile.required = true;
thisFile.desc.clear();