summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-08 01:22:43 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-08 01:22:43 +0300
commit34a83475636164cf43551d9ec83ec30da5a7e7f2 (patch)
treec6b3e22f789422e06a96c2ca87dd94fc61eb1dd1 /src/gui
parentaf4fcff19a986990d58c50c62bc498690c8293b8 (diff)
downloadmv-34a83475636164cf43551d9ec83ec30da5a7e7f2.tar.gz
mv-34a83475636164cf43551d9ec83ec30da5a7e7f2.tar.bz2
mv-34a83475636164cf43551d9ec83ec30da5a7e7f2.tar.xz
mv-34a83475636164cf43551d9ec83ec30da5a7e7f2.zip
Replace size() to empty() where is possible
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/fonts/textchunklist_unittest.cc38
-rw-r--r--src/gui/popups/beingpopup.cpp1
-rw-r--r--src/gui/widgets/tabs/socialplayerstab.h4
-rw-r--r--src/gui/widgets/tabs/socialtabbase.h2
-rw-r--r--src/gui/windows/updaterwindow.cpp4
5 files changed, 24 insertions, 25 deletions
diff --git a/src/gui/fonts/textchunklist_unittest.cc b/src/gui/fonts/textchunklist_unittest.cc
index a06ec2785..1c0330dce 100644
--- a/src/gui/fonts/textchunklist_unittest.cc
+++ b/src/gui/fonts/textchunklist_unittest.cc
@@ -32,8 +32,8 @@ TEST_CASE("TextChunkList empty", "TextChunkList")
REQUIRE(0 == list.size);
REQUIRE(nullptr == list.start);
REQUIRE(nullptr == list.end);
- REQUIRE(0 == list.search.size());
- REQUIRE(0 == list.searchWidth.size());
+ REQUIRE(list.search.empty());
+ REQUIRE(list.searchWidth.empty());
}
TEST_CASE("TextChunkList add 1", "TextChunkList")
@@ -105,8 +105,8 @@ TEST_CASE("TextChunkList addRemoveBack 1", "TextChunkList")
REQUIRE(0 == list.size);
REQUIRE(nullptr == list.start);
REQUIRE(nullptr == list.end);
- REQUIRE(0 == list.search.size());
- REQUIRE(0 == list.searchWidth.size());
+ REQUIRE(list.search.empty());
+ REQUIRE(list.searchWidth.empty());
}
TEST_CASE("TextChunkList addRemoveBack 2", "TextChunkList")
@@ -154,8 +154,8 @@ TEST_CASE("TextChunkList addRemoveBack 3", "TextChunkList")
REQUIRE(nullptr == list.start);
REQUIRE(nullptr == list.end);
- REQUIRE(0 == list.search.size());
- REQUIRE(0 == list.searchWidth.size());
+ REQUIRE(list.search.empty());
+ REQUIRE(list.searchWidth.empty());
}
TEST_CASE("TextChunkList addRemoveBack 4", "TextChunkList")
@@ -185,7 +185,7 @@ TEST_CASE("TextChunkList addRemoveBack 4", "TextChunkList")
REQUIRE(chunk1 == (*list.search.find(TextChunkSmall(
chunk1->text, chunk1->color, chunk1->color2))).second);
- REQUIRE(0 == list.searchWidth.size());
+ REQUIRE(list.searchWidth.empty());
delete chunk1;
}
@@ -306,8 +306,8 @@ TEST_CASE("TextChunkList clear 1", "TextChunkList")
REQUIRE(nullptr == list.start);
REQUIRE(nullptr == list.end);
REQUIRE(chunksLeft == textChunkCnt);
- REQUIRE(0 == list.search.size());
- REQUIRE(0 == list.searchWidth.size());
+ REQUIRE(list.search.empty());
+ REQUIRE(list.searchWidth.empty());
}
TEST_CASE("TextChunkList clear 2", "TextChunkList")
@@ -331,8 +331,8 @@ TEST_CASE("TextChunkList clear 2", "TextChunkList")
REQUIRE(nullptr == list.start);
REQUIRE(nullptr == list.end);
REQUIRE(chunksLeft == textChunkCnt);
- REQUIRE(0 == list.search.size());
- REQUIRE(0 == list.searchWidth.size());
+ REQUIRE(list.search.empty());
+ REQUIRE(list.searchWidth.empty());
}
TEST_CASE("TextChunkList clear 3", "TextChunkList")
@@ -358,12 +358,12 @@ TEST_CASE("TextChunkList clear 3", "TextChunkList")
list.removeBack();
REQUIRE((chunksLeft + 2) == textChunkCnt);
REQUIRE(2 == list.search.size());
- REQUIRE(0 == list.searchWidth.size());
+ REQUIRE(list.searchWidth.empty());
list.clear();
REQUIRE(chunksLeft == textChunkCnt);
- REQUIRE(0 == list.search.size());
- REQUIRE(0 == list.searchWidth.size());
+ REQUIRE(list.search.empty());
+ REQUIRE(list.searchWidth.empty());
}
TEST_CASE("TextChunkList clear 4", "TextChunkList")
@@ -389,12 +389,12 @@ TEST_CASE("TextChunkList clear 4", "TextChunkList")
list.removeBack(2);
REQUIRE((chunksLeft + 1) == textChunkCnt);
REQUIRE(1 == list.search.size());
- REQUIRE(0 == list.searchWidth.size());
+ REQUIRE(list.searchWidth.empty());
list.clear();
REQUIRE(chunksLeft == textChunkCnt);
- REQUIRE(0 == list.search.size());
- REQUIRE(0 == list.searchWidth.size());
+ REQUIRE(list.search.empty());
+ REQUIRE(list.searchWidth.empty());
}
TEST_CASE("TextChunkList remove 1", "TextChunkList")
@@ -413,8 +413,8 @@ TEST_CASE("TextChunkList remove 1", "TextChunkList")
REQUIRE(nullptr == list.start);
REQUIRE(nullptr == list.end);
REQUIRE(chunksLeft == textChunkCnt);
- REQUIRE(0 == list.search.size());
- REQUIRE(0 == list.searchWidth.size());
+ REQUIRE(list.search.empty());
+ REQUIRE(list.searchWidth.empty());
}
TEST_CASE("TextChunkList remove 2", "TextChunkList")
diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp
index c18ac3871..1834fcbe9 100644
--- a/src/gui/popups/beingpopup.cpp
+++ b/src/gui/popups/beingpopup.cpp
@@ -309,7 +309,6 @@ void BeingPopup::show(const int x, const int y, Being *const b)
setContentSize(minWidth, height);
position(x, y);
- return;
}
#ifdef USE_PROFILER
diff --git a/src/gui/widgets/tabs/socialplayerstab.h b/src/gui/widgets/tabs/socialplayerstab.h
index 447e0791e..f4c3f2bbe 100644
--- a/src/gui/widgets/tabs/socialplayerstab.h
+++ b/src/gui/widgets/tabs/socialplayerstab.h
@@ -156,7 +156,7 @@ class SocialPlayersTab final : public SocialTab
const StringVectCIter i_end = names.end();
while (i != i_end)
{
- if (ava->getName() == (*i) && (*i) != "")
+ if (ava->getName() == (*i) && !(*i).empty())
{
finded = true;
break;
@@ -180,7 +180,7 @@ class SocialPlayersTab final : public SocialTab
while (i != i_end)
{
- if ((*i) != "")
+ if (!(*i).empty())
updateAvatar(*i);
++i;
}
diff --git a/src/gui/widgets/tabs/socialtabbase.h b/src/gui/widgets/tabs/socialtabbase.h
index 66f51367f..9cffcae89 100644
--- a/src/gui/widgets/tabs/socialtabbase.h
+++ b/src/gui/widgets/tabs/socialtabbase.h
@@ -45,7 +45,7 @@ ENUMS_RESOURCES_MAP_MAPITEMTYPE_H
{\
std::string name;\
int level = -1;\
- if (*i == "")\
+ if ((*i).empty())\
{\
name = _("(default)");\
level = 0;\
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 3c63fb2ed..10d9c9890 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -836,8 +836,8 @@ void UpdaterWindow::logic()
}
mProgressBar->setProgress(mDownloadProgress);
- if ((mUpdateFiles.size() != 0u)
- && CAST_SIZE(mUpdateIndex) <= mUpdateFiles.size())
+ if (!mUpdateFiles.empty() &&
+ CAST_SIZE(mUpdateIndex) <= mUpdateFiles.size())
{
mProgressBar->setText(strprintf("%u/%u", mUpdateIndex
+ mUpdateIndexOffset + 1, CAST_U32(