summaryrefslogtreecommitdiff
path: root/src/gui/widgets/tabs
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-07 16:18:13 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-07 16:18:13 +0300
commit9fe21fcd8883b37bdc30224822e6e42afb35b8f0 (patch)
tree798117abd4dc7e610997d59d530a96ddc1509f53 /src/gui/widgets/tabs
parent4429cb14e9e187edef27aba692a4266733f79c17 (diff)
downloadmanaplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.gz
manaplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.bz2
manaplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.xz
manaplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.zip
Replace most static_cast<Type> to shorter versions from defines.
Diffstat (limited to 'src/gui/widgets/tabs')
-rw-r--r--src/gui/widgets/tabs/chat/chattab.cpp4
-rw-r--r--src/gui/widgets/tabs/setup_colors.cpp20
-rw-r--r--src/gui/widgets/tabs/setup_joystick.cpp2
-rw-r--r--src/gui/widgets/tabs/setup_relations.cpp2
-rw-r--r--src/gui/widgets/tabs/setup_theme.cpp4
-rw-r--r--src/gui/widgets/tabs/setup_video.cpp18
-rw-r--r--src/gui/widgets/tabs/socialfriendstab.h4
-rw-r--r--src/gui/widgets/tabs/socialguildtab.h8
-rw-r--r--src/gui/widgets/tabs/socialguildtab2.h4
-rw-r--r--src/gui/widgets/tabs/socialnavigationtab.h6
-rw-r--r--src/gui/widgets/tabs/socialpartytab.h4
-rw-r--r--src/gui/widgets/tabs/socialplayerstab.h2
12 files changed, 39 insertions, 39 deletions
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp
index e3af82d2a..942ade320 100644
--- a/src/gui/widgets/tabs/chat/chattab.cpp
+++ b/src/gui/widgets/tabs/chat/chattab.cpp
@@ -264,9 +264,9 @@ void ChatTab::chatLog(std::string line,
// Format the time string properly
std::stringstream timeStr;
timeStr << "[" << ((((t / 60) / 60) % 24 < 10) ? "0" : "")
- << static_cast<int>(((t / 60) / 60) % 24)
+ << CAST_S32(((t / 60) / 60) % 24)
<< ":" << (((t / 60) % 60 < 10) ? "0" : "")
- << static_cast<int>((t / 60) % 60)
+ << CAST_S32((t / 60) % 60)
<< "] ";
line = std::string(lineColor).append(timeStr.str()).append(
tmp.nick).append(tmp.text);
diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp
index 22a07f23d..00ab33bcc 100644
--- a/src/gui/widgets/tabs/setup_colors.cpp
+++ b/src/gui/widgets/tabs/setup_colors.cpp
@@ -377,7 +377,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED)
setEntry(mGreenSlider, mGreenText, col->g);
setEntry(mBlueSlider, mBlueText, col->b);
- mGradTypeSlider->setValue(static_cast<int>(grad));
+ mGradTypeSlider->setValue(CAST_S32(grad));
updateGradType();
mGradTypeSlider->setEnabled(true);
}
@@ -406,7 +406,7 @@ void Setup_Colors::cancel()
const UserColorIdT type = static_cast<UserColorIdT>(
userPalette->getColorTypeAt(mSelected));
const Color *const col = &userPalette->getColor(type);
- mGradTypeSlider->setValue(static_cast<int>(
+ mGradTypeSlider->setValue(CAST_S32(
userPalette->getGradientType(type)));
const int delay = userPalette->getGradientDelay(type);
setEntry(mGradDelaySlider, mGradDelayText, delay);
@@ -456,23 +456,23 @@ void Setup_Colors::updateColor()
const UserColorIdT type = static_cast<UserColorIdT>(
userPalette->getColorTypeAt(mSelected));
const GradientTypeT grad = static_cast<GradientTypeT>(
- static_cast<int>(mGradTypeSlider->getValue()));
- const int delay = static_cast<int>(mGradDelaySlider->getValue());
+ CAST_S32(mGradTypeSlider->getValue()));
+ const int delay = CAST_S32(mGradDelaySlider->getValue());
userPalette->setGradient(type, grad);
userPalette->setGradientDelay(type, delay);
if (grad == GradientType::STATIC)
{
userPalette->setColor(type,
- static_cast<int>(mRedSlider->getValue()),
- static_cast<int>(mGreenSlider->getValue()),
- static_cast<int>(mBlueSlider->getValue()));
+ CAST_S32(mRedSlider->getValue()),
+ CAST_S32(mGreenSlider->getValue()),
+ CAST_S32(mBlueSlider->getValue()));
}
else if (grad == GradientType::PULSE)
{
userPalette->setTestColor(type, Color(
- static_cast<int>(mRedSlider->getValue()),
- static_cast<int>(mGreenSlider->getValue()),
- static_cast<int>(mBlueSlider->getValue())));
+ CAST_S32(mRedSlider->getValue()),
+ CAST_S32(mGreenSlider->getValue()),
+ CAST_S32(mBlueSlider->getValue())));
}
}
diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp
index 861a2d3ee..64282ac1e 100644
--- a/src/gui/widgets/tabs/setup_joystick.cpp
+++ b/src/gui/widgets/tabs/setup_joystick.cpp
@@ -80,7 +80,7 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) :
else
{
unsigned int sel = config.getIntValue("selectedJoystick");
- if (sel >= static_cast<unsigned int>(mNamesModel->size()))
+ if (sel >= CAST_U32(mNamesModel->size()))
sel = 0;
mNamesDropDown->setSelected(sel);
}
diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp
index 87a491116..844532278 100644
--- a/src/gui/widgets/tabs/setup_relations.cpp
+++ b/src/gui/widgets/tabs/setup_relations.cpp
@@ -160,7 +160,7 @@ void Setup_Relations::reset()
if ((*player_relations.getPlayerIgnoreStrategies())[i] ==
player_relations.getPlayerIgnoreStrategy())
{
- selection = static_cast<int>(i);
+ selection = CAST_S32(i);
break;
}
}
diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp
index 55f68548d..dced19225 100644
--- a/src/gui/widgets/tabs/setup_theme.cpp
+++ b/src/gui/widgets/tabs/setup_theme.cpp
@@ -393,9 +393,9 @@ void Setup_Theme::apply()
|| config.getValue("chinaFont", "fonts/wqy-microhei.ttf")
!= mChinaFont
|| config.getIntValue("fontSize")
- != static_cast<int>(mFontSizeDropDown->getSelected()) + 9
+ != CAST_S32(mFontSizeDropDown->getSelected()) + 9
|| config.getIntValue("npcfontSize")
- != static_cast<int>(mNpcFontSizeDropDown->getSelected()) + 9)
+ != CAST_S32(mNpcFontSizeDropDown->getSelected()) + 9)
{
config.setValue("font", "fonts/" + getFileName(mFont));
config.setValue("boldFont", "fonts/" + getFileName(mBoldFont));
diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp
index fad7f3ba2..591093bc8 100644
--- a/src/gui/widgets/tabs/setup_video.cpp
+++ b/src/gui/widgets/tabs/setup_video.cpp
@@ -263,13 +263,13 @@ void Setup_Video::apply()
const int sel = mOpenGLDropDown->getSelected();
RenderType mode = RENDER_SOFTWARE;
- if (sel >= 0 && static_cast<unsigned int>(sel) < sizeof(indexToRender))
+ if (sel >= 0 && CAST_U32(sel) < sizeof(indexToRender))
mode = indexToRender[mOpenGLDropDown->getSelected()];
// OpenGL change
if (mode != mOpenGLEnabled)
{
- config.setValue("opengl", static_cast<int>(mode));
+ config.setValue("opengl", CAST_S32(mode));
// OpenGL can currently only be changed by restarting, notify user.
CREATEWIDGET(OkDialog,
@@ -287,9 +287,9 @@ void Setup_Video::apply()
}
mFps = mFpsCheckBox->isSelected() ?
- static_cast<int>(mFpsSlider->getValue()) : 0;
+ CAST_S32(mFpsSlider->getValue()) : 0;
- mAltFps = static_cast<int>(mAltFpsSlider->getValue());
+ mAltFps = CAST_S32(mAltFpsSlider->getValue());
mFpsSlider->setEnabled(mFps > 0);
@@ -336,7 +336,7 @@ void Setup_Video::cancel()
config.setValue("screenheight", mainGraphics->mActualHeight);
config.setValue("customcursor", mCustomCursorEnabled);
- config.setValue("opengl", static_cast<int>(mOpenGLEnabled));
+ config.setValue("opengl", CAST_S32(mOpenGLEnabled));
config.setValue("enableresize", mEnableResize);
config.setValue("noframe", mNoFrame);
}
@@ -443,7 +443,7 @@ void Setup_Video::action(const ActionEvent &event)
}
else if (id == "fpslimitcheckbox" || id == "fpslimitslider")
{
- int tempFps = static_cast<int>(mFpsSlider->getValue());
+ int tempFps = CAST_S32(mFpsSlider->getValue());
if (id == "fpslimitcheckbox" && !mFpsSlider->isEnabled())
tempFps = 60;
else
@@ -458,8 +458,8 @@ void Setup_Video::action(const ActionEvent &event)
}
else if (id == "altfpslimitslider")
{
- int tempFps = static_cast<int>(mAltFpsSlider->getValue());
- tempFps = tempFps > 0 ? tempFps : static_cast<int>(
+ int tempFps = CAST_S32(mAltFpsSlider->getValue());
+ tempFps = tempFps > 0 ? tempFps : CAST_S32(
mAltFpsSlider->getScaleStart());
mAltFps = tempFps;
// TRANSLATORS: video settings label
@@ -486,7 +486,7 @@ void Setup_Video::action(const ActionEvent &event)
{
Configuration &conf = test->getConfig();
const int val = conf.getValueInt("opengl", -1);
- if (val >= 0 && static_cast<unsigned int>(val)
+ if (val >= 0 && CAST_U32(val)
< sizeof(renderToIndex) / sizeof(int))
{
mOpenGLDropDown->setSelected(renderToIndex[val]);
diff --git a/src/gui/widgets/tabs/socialfriendstab.h b/src/gui/widgets/tabs/socialfriendstab.h
index d4543a46b..b53138e10 100644
--- a/src/gui/widgets/tabs/socialfriendstab.h
+++ b/src/gui/widgets/tabs/socialfriendstab.h
@@ -112,8 +112,8 @@ class SocialFriendsTab final : public SocialTab
// TRANSLATORS: social window label
mCounterString = strprintf(_("Friends: %u/%u"),
- static_cast<uint32_t>(online),
- static_cast<uint32_t>(total));
+ CAST_U32(online),
+ CAST_U32(total));
updateCounter();
}
diff --git a/src/gui/widgets/tabs/socialguildtab.h b/src/gui/widgets/tabs/socialguildtab.h
index a76b3d58b..942ce9d59 100644
--- a/src/gui/widgets/tabs/socialguildtab.h
+++ b/src/gui/widgets/tabs/socialguildtab.h
@@ -140,8 +140,8 @@ class SocialGuildTab final : public SocialTab,
{
// TRANSLATORS: social window label
mCounterString = strprintf(_("Members: %u/%u"),
- static_cast<uint32_t>(online0),
- static_cast<uint32_t>(total0));
+ CAST_U32(online0),
+ CAST_U32(total0));
}
else
{
@@ -164,8 +164,8 @@ class SocialGuildTab final : public SocialTab,
// TRANSLATORS: social window label
mCounterString = strprintf(_("Players: %u/%u"),
- static_cast<uint32_t>(online),
- static_cast<uint32_t>(total));
+ CAST_U32(online),
+ CAST_U32(total));
}
updateCounter();
}
diff --git a/src/gui/widgets/tabs/socialguildtab2.h b/src/gui/widgets/tabs/socialguildtab2.h
index 67aa2ee08..c216c6d36 100644
--- a/src/gui/widgets/tabs/socialguildtab2.h
+++ b/src/gui/widgets/tabs/socialguildtab2.h
@@ -95,8 +95,8 @@ class SocialGuildTab2 final : public SocialTab,
// TRANSLATORS: social window label
mCounterString = strprintf(_("Players: %u/%u"),
- static_cast<uint32_t>(online),
- static_cast<uint32_t>(total));
+ CAST_U32(online),
+ CAST_U32(total));
updateCounter();
}
};
diff --git a/src/gui/widgets/tabs/socialnavigationtab.h b/src/gui/widgets/tabs/socialnavigationtab.h
index 6d9a5e9f0..e673c689b 100644
--- a/src/gui/widgets/tabs/socialnavigationtab.h
+++ b/src/gui/widgets/tabs/socialnavigationtab.h
@@ -159,8 +159,8 @@ class SocialNavigationTab final : public SocialTab
// TRANSLATORS: social window label
mCounterString = strprintf(_("Portals: %u/%u"),
- static_cast<uint32_t>(online),
- static_cast<uint32_t>(total));
+ CAST_U32(online),
+ CAST_U32(total));
updateCounter();
}
@@ -170,7 +170,7 @@ class SocialNavigationTab final : public SocialTab
return;
std::vector<Avatar*> *const avatars = mBeings->getMembers();
- if (avatars->size() <= static_cast<size_t>(num))
+ if (avatars->size() <= CAST_SIZE(num))
return;
const Avatar *const ava = avatars->at(num);
diff --git a/src/gui/widgets/tabs/socialpartytab.h b/src/gui/widgets/tabs/socialpartytab.h
index 6202e537a..153c1b3ec 100644
--- a/src/gui/widgets/tabs/socialpartytab.h
+++ b/src/gui/widgets/tabs/socialpartytab.h
@@ -157,8 +157,8 @@ class SocialPartyTab final : public SocialTab,
// TRANSLATORS: social window label
mCounterString = strprintf(_("Players: %u/%u"),
- static_cast<uint32_t>(online),
- static_cast<uint32_t>(total));
+ CAST_U32(online),
+ CAST_U32(total));
updateCounter();
}
diff --git a/src/gui/widgets/tabs/socialplayerstab.h b/src/gui/widgets/tabs/socialplayerstab.h
index b3a234301..50d86e33c 100644
--- a/src/gui/widgets/tabs/socialplayerstab.h
+++ b/src/gui/widgets/tabs/socialplayerstab.h
@@ -186,7 +186,7 @@ class SocialPlayersTab final : public SocialTab
}
// TRANSLATORS: social window label
mCounterString = strprintf(_("Visible players: %d"),
- static_cast<int>(avatars->size()));
+ CAST_S32(avatars->size()));
updateCounter();
}