Removed messages.?pp files (and used the strings directly where they
are needed).
This commit is contained in:
parent
6175d9f5bb
commit
a50177c96a
@ -1,109 +0,0 @@
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2013 Glenn De Jonghe
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "online/messages.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/time.hpp"
|
||||
|
||||
namespace Online
|
||||
{
|
||||
namespace Messages
|
||||
{
|
||||
irr::core::stringw signingIn()
|
||||
{
|
||||
return irr::core::stringw(_("Signing in")) + loadingDots();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw signingOut()
|
||||
{
|
||||
return irr::core::stringw(_("Signing out")) + loadingDots();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
irr::core::stringw validatingInfo()
|
||||
{
|
||||
return irr::core::stringw(_("Validating info")) + loadingDots();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
irr::core::stringw searching()
|
||||
{
|
||||
return irr::core::stringw(_("Searching")) + loadingDots();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw joiningServer()
|
||||
{
|
||||
return irr::core::stringw(_("Joining server")) + loadingDots();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw creatingServer()
|
||||
{
|
||||
return irr::core::stringw(_("Creating server")) + loadingDots();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw fetchingServers()
|
||||
{
|
||||
return irr::core::stringw(_("Fetching servers")) + loadingDots();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw fetchingFriends()
|
||||
{
|
||||
return irr::core::stringw(_("Fetching friends")) + loadingDots();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw fetchingAchievements()
|
||||
{
|
||||
return irr::core::stringw(_("Fetching achievements")) + loadingDots();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
irr::core::stringw processing()
|
||||
{
|
||||
return irr::core::stringw(_("Processing")) + loadingDots();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Convenience function to type less in calls. */
|
||||
irr::core::stringw loadingDots(const wchar_t *s)
|
||||
{
|
||||
return irr::core::stringw(s)+loadingDots();
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/**
|
||||
* Shows a increasing number of dots.
|
||||
* \param interval A float representing the time it takes to add a new dot
|
||||
* \param max_dots The number of dots used. Defaults to 3.
|
||||
*/
|
||||
irr::core::stringw loadingDots(float interval, int max_dots)
|
||||
{
|
||||
int nr_dots = int(floor(StkTime::getRealTime() / interval)) % (max_dots+1);
|
||||
return irr::core::stringw((std::string(nr_dots,'.') + std::string(max_dots-nr_dots,' ')).c_str());
|
||||
}
|
||||
} // namespace messages
|
||||
} // namespace Online
|
||||
|
||||
|
||||
/* EOF */
|
@ -1,49 +0,0 @@
|
||||
//
|
||||
// SuperTuxKart - a fun racing game with go-kart
|
||||
// Copyright (C) 2013 Glenn De Jonghe
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 3
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#ifndef HEADER_ONLINE_MESSAGES_HPP
|
||||
#define HEADER_ONLINE_MESSAGES_HPP
|
||||
|
||||
#include <string>
|
||||
#include <irrString.h>
|
||||
|
||||
namespace Online
|
||||
{
|
||||
/**
|
||||
* \brief Messages to be shown related to API communication
|
||||
* \ingroup online
|
||||
*/
|
||||
namespace Messages
|
||||
{
|
||||
irr::core::stringw loadingDots (float interval = 0.5f, int max_dots = 3);
|
||||
irr::core::stringw loadingDots (const wchar_t *s);
|
||||
irr::core::stringw signingIn ();
|
||||
irr::core::stringw signingOut ();
|
||||
irr::core::stringw validatingInfo ();
|
||||
irr::core::stringw searching ();
|
||||
irr::core::stringw joiningServer ();
|
||||
irr::core::stringw creatingServer ();
|
||||
irr::core::stringw fetchingServers ();
|
||||
irr::core::stringw fetchingFriends ();
|
||||
irr::core::stringw fetchingAchievements ();
|
||||
irr::core::stringw processing ();
|
||||
} // namespace Messages
|
||||
}// namespace Online
|
||||
#endif
|
||||
|
||||
/* EOF */
|
@ -24,7 +24,6 @@
|
||||
#include "config/player_manager.hpp"
|
||||
#include "modes/demo_world.hpp"
|
||||
#include "online/servers_manager.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/online_screen.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
@ -115,7 +114,8 @@ void CreateServerScreen::onUpdate(float delta)
|
||||
else
|
||||
{
|
||||
m_info_widget->setDefaultColor();
|
||||
m_info_widget->setText(Online::Messages::creatingServer(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Creating server")),
|
||||
false);
|
||||
}
|
||||
}
|
||||
} // onUpdate
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "config/player_manager.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/widgets.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
@ -227,7 +226,8 @@ void ChangePasswordDialog::error(const irr::core::stringw & error)
|
||||
void ChangePasswordDialog::onUpdate(float dt)
|
||||
{
|
||||
if(!m_options_widget->isActivated())
|
||||
m_info_widget->setText(Online::Messages::validatingInfo(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Validating info")),
|
||||
false );
|
||||
|
||||
// It's unsafe to delete from inside the event handler so we do it here
|
||||
if (m_self_destroy)
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
@ -200,7 +199,8 @@ void RecoveryDialog::onUpdate(float dt)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_info_widget->setText(Messages::validatingInfo(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Validating info")),
|
||||
false);
|
||||
}
|
||||
}
|
||||
// It's unsafe to delete from inside the event handler so we do it here
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "states_screens/register_screen.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "online/messages.hpp"
|
||||
|
||||
#include <IGUIEnvironment.h>
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "network/protocol_manager.hpp"
|
||||
#include "network/protocols/connect_to_server.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "online/servers_manager.hpp"
|
||||
#include "states_screens/dialogs/registration_dialog.hpp"
|
||||
#include "states_screens/networking_lobby.hpp"
|
||||
@ -152,7 +151,8 @@ void ServerInfoDialog::onUpdate(float dt)
|
||||
else
|
||||
{
|
||||
m_info_widget->setDefaultColor();
|
||||
m_info_widget->setText(Online::Messages::joiningServer(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Joining server")),
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "guiengine/dialog_queue.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "online/online_profile.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/online_profile_friends.hpp"
|
||||
#include "states_screens/online_profile_overview.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
@ -453,7 +452,8 @@ bool UserInfoDialog::onEscapePressed()
|
||||
|
||||
void UserInfoDialog::onUpdate(float dt)
|
||||
{
|
||||
if(m_processing) m_info_widget->setText(Messages::processing(), false);
|
||||
if(m_processing)
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Processing")), false);
|
||||
|
||||
//If we want to open the registration dialog, we need to close this one first
|
||||
if (m_enter_profile) m_self_destroy = true;
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
@ -164,8 +163,8 @@ void VoteDialog::updateFetchVote()
|
||||
if (!m_fetch_vote_request->isDone())
|
||||
{
|
||||
// request still pending
|
||||
m_info_widget->setText(irr::core::stringw(_("Fetching last vote"))
|
||||
+ Messages::loadingDots(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Fetching last vote")),
|
||||
false );
|
||||
return;
|
||||
} // !isDone
|
||||
|
||||
@ -236,8 +235,8 @@ void VoteDialog::onUpdate(float dt)
|
||||
} // isDone
|
||||
else
|
||||
{
|
||||
m_info_widget->setText(irr::core::stringw(_("Performing vote"))
|
||||
+ Messages::loadingDots(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Performing vote")),
|
||||
false);
|
||||
} // !isDone
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "guiengine/screen.hpp"
|
||||
#include "guiengine/widget.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "online/online_profile.hpp"
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
@ -122,7 +121,7 @@ void OnlineProfileAchievements::init()
|
||||
m_visiting_profile->fetchAchievements();
|
||||
m_achievements_list_widget->clear();
|
||||
m_achievements_list_widget->addItem("loading",
|
||||
Messages::fetchingAchievements());
|
||||
StringUtils::loadingDots(_("Fetching achievements")));
|
||||
}
|
||||
} // init
|
||||
|
||||
@ -161,8 +160,8 @@ void OnlineProfileAchievements::onUpdate(float delta)
|
||||
if (!m_visiting_profile->isReady())
|
||||
{
|
||||
// This will display an increasing number of dots while waiting.
|
||||
m_achievements_list_widget->renameItem("loading",
|
||||
Messages::fetchingAchievements());
|
||||
m_achievements_list_widget->renameItem("loading",
|
||||
StringUtils::loadingDots(_("Fetching achievements")));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "guiengine/scalable_font.hpp"
|
||||
#include "guiengine/screen.hpp"
|
||||
#include "guiengine/widget.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/dialogs/user_info_dialog.hpp"
|
||||
#include "states_screens/online_user_search.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
@ -85,7 +84,8 @@ void OnlineProfileFriends::init()
|
||||
m_visiting_profile->fetchFriends();
|
||||
m_waiting_for_friends = true;
|
||||
m_friends_list_widget->clear();
|
||||
m_friends_list_widget->addItem("loading", Messages::fetchingFriends());
|
||||
m_friends_list_widget->addItem("loading",
|
||||
StringUtils::loadingDots(_("Fetching friends")));
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -171,7 +171,7 @@ void OnlineProfileFriends::onUpdate(float delta)
|
||||
else
|
||||
{
|
||||
m_friends_list_widget->renameItem("loading",
|
||||
Messages::fetchingFriends());
|
||||
StringUtils::loadingDots(_("Fetching friends")));
|
||||
}
|
||||
}
|
||||
} // onUpdate
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "network/protocol_manager.hpp"
|
||||
#include "network/protocols/connect_to_server.hpp"
|
||||
#include "network/protocols/request_connection.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "online/profile_manager.hpp"
|
||||
#include "online/request.hpp"
|
||||
#include "online/servers_manager.hpp"
|
||||
@ -153,11 +152,13 @@ void OnlineScreen::onUpdate(float delta)
|
||||
|
||||
if (m_recorded_state == PlayerProfile::OS_SIGNING_IN)
|
||||
{
|
||||
m_online_status_widget->setText(Messages::signingIn(), false);
|
||||
m_online_status_widget->setText(StringUtils::loadingDots(_("Signing in")),
|
||||
false );
|
||||
}
|
||||
else if (m_recorded_state == PlayerProfile::OS_SIGNING_OUT)
|
||||
{
|
||||
m_online_status_widget->setText(Messages::signingOut(), false);
|
||||
m_online_status_widget->setText(StringUtils::loadingDots(_("Signing out")),
|
||||
false );
|
||||
}
|
||||
} // onUpdate
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "config/player_manager.hpp"
|
||||
#include "guiengine/modaldialog.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "online/profile_manager.hpp"
|
||||
#include "states_screens/dialogs/user_info_dialog.hpp"
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
@ -199,7 +198,7 @@ void OnlineUserSearch::search()
|
||||
|
||||
m_user_list_widget->clear();
|
||||
m_user_list_widget->addItem("spacer", L"");
|
||||
m_user_list_widget->addItem("loading", Messages::searching());
|
||||
m_user_list_widget->addItem("loading", StringUtils::loadingDots(_("Searching")));
|
||||
m_back_widget->setDeactivated();
|
||||
m_search_box_widget->setDeactivated();
|
||||
m_search_button_widget->setDeactivated();
|
||||
@ -276,7 +275,8 @@ void OnlineUserSearch::onUpdate(float dt)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_user_list_widget->renameItem("loading", Messages::searching());
|
||||
m_user_list_widget->renameItem("loading",
|
||||
StringUtils::loadingDots(_("Searching")) );
|
||||
}
|
||||
}
|
||||
} // onUpdate
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "guiengine/widgets/ribbon_widget.hpp"
|
||||
#include "guiengine/widgets/text_box_widget.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "online/xml_request.hpp"
|
||||
#include "states_screens/dialogs/registration_dialog.hpp"
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
@ -286,7 +285,8 @@ void RegisterScreen::onUpdate(float dt)
|
||||
if(m_signup_request)
|
||||
{
|
||||
if(!m_options_widget->isActivated())
|
||||
m_info_widget->setText(Messages::validatingInfo(), false);
|
||||
m_info_widget->setText(StringUtils::loadingDots(_("Validating info")),
|
||||
false);
|
||||
|
||||
if(m_signup_request->isDone())
|
||||
{
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "states_screens/state_manager.hpp"
|
||||
#include "utils/translation.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "audio/sfx_manager.hpp"
|
||||
|
||||
using namespace Online;
|
||||
@ -64,7 +63,8 @@ void ServerSelection::refresh()
|
||||
m_fake_refresh = (m_refresh_request == NULL ? true : false);
|
||||
m_server_list_widget->clear();
|
||||
m_server_list_widget->addItem("spacer", L"");
|
||||
m_server_list_widget->addItem("loading", Messages::fetchingServers());
|
||||
m_server_list_widget->addItem("loading",
|
||||
StringUtils::loadingDots(_("Fetching servers")));
|
||||
m_reload_widget->setDeactivated();
|
||||
}
|
||||
|
||||
@ -206,7 +206,8 @@ void ServerSelection::onUpdate(float dt)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_server_list_widget->renameItem("loading", Messages::fetchingServers());
|
||||
m_server_list_widget->renameItem("loading",
|
||||
StringUtils::loadingDots(_("Fetching servers")));
|
||||
}
|
||||
}
|
||||
else if(m_fake_refresh)
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "guiengine/widgets/label_widget.hpp"
|
||||
#include "guiengine/widgets/list_widget.hpp"
|
||||
#include "guiengine/widgets/text_box_widget.hpp"
|
||||
#include "online/messages.hpp"
|
||||
#include "states_screens/dialogs/message_dialog.hpp"
|
||||
#include "states_screens/main_menu_screen.hpp"
|
||||
#include "states_screens/options_screen_audio.hpp"
|
||||
@ -395,8 +394,8 @@ void BaseUserScreen::onUpdate(float dt)
|
||||
core::stringw message = (m_state & STATE_LOGOUT)
|
||||
? _(L"Signing out '%s'",m_sign_out_name.c_str())
|
||||
: _(L"Signing in '%s'", m_sign_in_name.c_str());
|
||||
m_info_widget->setText(Online::Messages::loadingDots(message.c_str()),
|
||||
false );
|
||||
m_info_widget->setText(StringUtils::loadingDots(message.c_str()),
|
||||
false );
|
||||
}
|
||||
PlayerProfile *player = getSelectedPlayer();
|
||||
if(player)
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "utils/string_utils.hpp"
|
||||
|
||||
#include "utils/log.hpp"
|
||||
#include "utils/time.hpp"
|
||||
|
||||
#include "coreutil.h"
|
||||
|
||||
@ -523,6 +524,29 @@ namespace StringUtils
|
||||
return std::string(s);
|
||||
} // timeToString
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Shows a increasing number of dots.
|
||||
* \param interval A float representing the time it takes to add a new dot
|
||||
* \param max_dots The number of dots used. Defaults to 3.
|
||||
*/
|
||||
irr::core::stringw loadingDots(float interval, int max_dots)
|
||||
{
|
||||
int nr_dots = int(floor(StkTime::getRealTime() / interval))
|
||||
% (max_dots + 1);
|
||||
return irr::core::stringw((std::string(nr_dots, '.') +
|
||||
std::string(max_dots - nr_dots, ' ')).c_str());
|
||||
} // loadingDots
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the string given with loadingDots appended. A simple
|
||||
* convenience function to type less in calls.
|
||||
* \parameter s The string to which the loading dots are appended.
|
||||
*/
|
||||
irr::core::stringw loadingDots(const wchar_t *s)
|
||||
{
|
||||
return irr::core::stringw(s) + loadingDots();
|
||||
} // loadingDots
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Replaces values in a string.
|
||||
* \param other string in which to replace stuff
|
||||
|
@ -46,6 +46,8 @@ namespace StringUtils
|
||||
|
||||
bool notEmpty(const irr::core::stringw& input);
|
||||
std::string timeToString(float time);
|
||||
irr::core::stringw loadingDots(float interval = 0.5f, int max_dots = 3);
|
||||
irr::core::stringw loadingDots(const wchar_t *s);
|
||||
std::string toUpperCase(const std::string&);
|
||||
std::string toLowerCase(const std::string&);
|
||||
std::vector<std::string> split(const std::string& s, char c,
|
||||
|
Loading…
Reference in New Issue
Block a user