From 9fe21fcd8883b37bdc30224822e6e42afb35b8f0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 7 Feb 2016 16:18:13 +0300 Subject: Replace most static_cast to shorter versions from defines. --- src/gui/windows/chatwindow.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/gui/windows/chatwindow.cpp') diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 8f74a6877..e15f68f35 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -403,7 +403,7 @@ void ChatWindow::closeTab() const void ChatWindow::defaultTab() { if (mChatTabs) - mChatTabs->setSelectedTabByIndex(static_cast(0)); + mChatTabs->setSelectedTabByIndex(CAST_U32(0)); } void ChatWindow::action(const ActionEvent &event) @@ -773,7 +773,7 @@ void ChatWindow::keyPressed(KeyEvent &event) if (mCurHist != mHistory.end()) { mChatInput->setText(*mCurHist); - mChatInput->setCaretPosition(static_cast( + mChatInput->setCaretPosition(CAST_U32( mChatInput->getText().length())); } else @@ -797,7 +797,7 @@ void ChatWindow::keyPressed(KeyEvent &event) --mCurHist; addCurrentToHistory(); mChatInput->setText(*mCurHist); - mChatInput->setCaretPosition(static_cast( + mChatInput->setCaretPosition(CAST_U32( mChatInput->getText().length())); } else if (actionId == InputAction::GUI_INSERT && @@ -828,7 +828,7 @@ void ChatWindow::keyPressed(KeyEvent &event) { if (!mChatHistoryIndex) { - mChatHistoryIndex = static_cast( + mChatHistoryIndex = CAST_U32( tab->getRows().size()); mChatInput->setText(""); @@ -848,7 +848,7 @@ void ChatWindow::keyPressed(KeyEvent &event) if (f == mChatHistoryIndex) mChatInput->setText(*it); } - mChatInput->setCaretPosition(static_cast( + mChatInput->setCaretPosition(CAST_U32( mChatInput->getText().length())); } } @@ -860,11 +860,11 @@ void ChatWindow::keyPressed(KeyEvent &event) { const std::list &rows = tab->getRows(); const size_t &tabSize = rows.size(); - if (static_cast(mChatHistoryIndex) + 1 < tabSize) + if (CAST_SIZE(mChatHistoryIndex) + 1 < tabSize) { mChatHistoryIndex ++; } - else if (static_cast(mChatHistoryIndex) < tabSize) + else if (CAST_SIZE(mChatHistoryIndex) < tabSize) { mChatHistoryIndex ++; mChatInput->setText(""); @@ -884,7 +884,7 @@ void ChatWindow::keyPressed(KeyEvent &event) if (f == mChatHistoryIndex) mChatInput->setText(*it); } - mChatInput->setCaretPosition(static_cast( + mChatInput->setCaretPosition(CAST_U32( mChatInput->getText().length())); } } @@ -1014,8 +1014,8 @@ void ChatWindow::addInputText(const std::string &text, const bool space) ss << inputText.substr(caretPos); mChatInput->setText(ss.str()); - mChatInput->setCaretPosition(caretPos + static_cast( - text.length()) + static_cast(space)); + mChatInput->setCaretPosition(caretPos + CAST_S32( + text.length()) + CAST_S32(space)); requestChatFocus(); } @@ -1298,7 +1298,7 @@ void ChatWindow::postConnection() skip --; \ continue; \ } \ - const unsigned char ch = static_cast(msg.at(f)); \ + const unsigned char ch = CAST_U8(msg.at(f)); \ if (f + 2 < sz && msg.substr(f, 2) == "%%") \ { \ newMsg += msg.at(f); \ @@ -1419,8 +1419,8 @@ void ChatWindow::autoComplete() .append(inputText.substr(caretPos, inputText.length() - caretPos))); - const int len = caretPos - static_cast(name.length()) - + static_cast(newName.length()); + const int len = caretPos - CAST_S32(name.length()) + + CAST_S32(newName.length()); if (startName > 0) mChatInput->setCaretPosition(len + 1); @@ -1592,7 +1592,7 @@ bool ChatWindow::resortChatLog(std::string line, { const std::string nick = line.substr(0, idx2 - 1); line = line.substr(idx2 + 6); - localPetEmote(nick, static_cast( + localPetEmote(nick, CAST_U8( atoi(line.c_str()))); } else if (line.find(": \302\202\302m") != std::string::npos) @@ -1608,7 +1608,7 @@ bool ChatWindow::resortChatLog(std::string line, { const std::string nick = line.substr(0, idx2 - 1); line = line.substr(idx2 + 6); - localPetDirection(nick, static_cast( + localPetDirection(nick, CAST_U8( atoi(line.c_str()))); } else if (line.find(": \302\202\302a") != std::string::npos) @@ -1946,9 +1946,9 @@ bool ChatWindow::saveTab(const int num, ChatTab *const tab) const tab->getChannelName()); serverConfig.setValue("chatWhisperFlags" + toString(num), - static_cast(tab->getAllowHighlight()) - + (2 * static_cast(tab->getRemoveNames())) - + (4 * static_cast(tab->getNoAway()))); + CAST_S32(tab->getAllowHighlight()) + + (2 * CAST_S32(tab->getRemoveNames())) + + (4 * CAST_S32(tab->getNoAway()))); return true; } -- cgit v1.2.3-60-g2f50