Cosmetic changes only.
This commit is contained in:
parent
9b1b66689b
commit
cb8daa4977
@ -39,28 +39,37 @@ using namespace irr::gui;
|
|||||||
using namespace irr::core;
|
using namespace irr::core;
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
/** Creates a modal dialog with given percentage of screen width and height.
|
||||||
PlayerInfoDialog::PlayerInfoDialog(PlayerProfile* player, const float w, const float h) : ModalDialog(w, h)
|
*/
|
||||||
|
PlayerInfoDialog::PlayerInfoDialog(PlayerProfile* player, const float w,
|
||||||
|
const float h)
|
||||||
|
: ModalDialog(w, h)
|
||||||
{
|
{
|
||||||
m_player = player;
|
m_player = player;
|
||||||
doInit();
|
doInit();
|
||||||
|
|
||||||
showRegularDialog();
|
showRegularDialog();
|
||||||
}
|
} // PlayerInfoDialog
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
/** When the dialog is finished, select the just edited player again in the
|
||||||
|
* option screen.
|
||||||
|
*/
|
||||||
PlayerInfoDialog::~PlayerInfoDialog()
|
PlayerInfoDialog::~PlayerInfoDialog()
|
||||||
{
|
{
|
||||||
if (m_player != NULL)
|
if (m_player != NULL)
|
||||||
{
|
{
|
||||||
OptionsScreenPlayers::getInstance()->selectPlayer( translations->fribidize(m_player->getName()) );
|
OptionsScreenPlayers::getInstance()->selectPlayer(
|
||||||
}
|
translations->fribidize(m_player->getName()) );
|
||||||
}
|
}
|
||||||
|
} // ~PlayerInfoDialog
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
/** Show the current data of this player.
|
||||||
|
*/
|
||||||
void PlayerInfoDialog::showRegularDialog()
|
void PlayerInfoDialog::showRegularDialog()
|
||||||
{
|
{
|
||||||
|
if (m_irrlicht_window)
|
||||||
clearWindow();
|
clearWindow();
|
||||||
|
|
||||||
const int y1 = m_area.getHeight()/6;
|
const int y1 = m_area.getHeight()/6;
|
||||||
@ -92,7 +101,8 @@ void PlayerInfoDialog::showRegularDialog()
|
|||||||
//I18N: In the player info dialog
|
//I18N: In the player info dialog
|
||||||
widget->setText( _("Rename") );
|
widget->setText( _("Rename") );
|
||||||
|
|
||||||
const int textWidth = font->getDimension( widget->getText().c_str() ).Width + 40;
|
const int textWidth =
|
||||||
|
font->getDimension( widget->getText().c_str() ).Width + 40;
|
||||||
|
|
||||||
widget->m_x = m_area.getWidth()/2 - textWidth/2;
|
widget->m_x = m_area.getWidth()/2 - textWidth/2;
|
||||||
widget->m_y = y2;
|
widget->m_y = y2;
|
||||||
@ -139,10 +149,11 @@ void PlayerInfoDialog::showRegularDialog()
|
|||||||
}
|
}
|
||||||
|
|
||||||
textCtrl->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
|
textCtrl->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
|
||||||
}
|
} // showRegularDialog
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
/** Changes this dialog to confirm the changes.
|
||||||
|
*/
|
||||||
void PlayerInfoDialog::showConfirmDialog()
|
void PlayerInfoDialog::showConfirmDialog()
|
||||||
{
|
{
|
||||||
clearWindow();
|
clearWindow();
|
||||||
@ -158,7 +169,8 @@ void PlayerInfoDialog::showConfirmDialog()
|
|||||||
|
|
||||||
if (PlayerManager::get()->getCurrentPlayer() == m_player)
|
if (PlayerManager::get()->getCurrentPlayer() == m_player)
|
||||||
{
|
{
|
||||||
message = _("You cannot delete this player because it is currently in use.");
|
message = _("You cannot delete this player "
|
||||||
|
"because it is currently in use.");
|
||||||
}
|
}
|
||||||
|
|
||||||
core::rect< s32 > area_left(5, 0, m_area.getWidth()-5, m_area.getHeight()/2);
|
core::rect< s32 > area_left(5, 0, m_area.getWidth()-5, m_area.getHeight()/2);
|
||||||
@ -167,7 +179,8 @@ void PlayerInfoDialog::showConfirmDialog()
|
|||||||
// we can add irrlicht labels directly
|
// we can add irrlicht labels directly
|
||||||
// (more complicated uses require the use of our widget set)
|
// (more complicated uses require the use of our widget set)
|
||||||
IGUIStaticText* a = GUIEngine::getGUIEnv()->addStaticText( message.c_str(),
|
IGUIStaticText* a = GUIEngine::getGUIEnv()->addStaticText( message.c_str(),
|
||||||
area_left, false /* border */, true /* word wrap */,
|
area_left, false /* border */,
|
||||||
|
true /* word wrap */,
|
||||||
m_irrlicht_window);
|
m_irrlicht_window);
|
||||||
a->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
|
a->setTextAlignment(EGUIA_CENTER, EGUIA_CENTER);
|
||||||
|
|
||||||
@ -212,22 +225,23 @@ void PlayerInfoDialog::showConfirmDialog()
|
|||||||
widget->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
|
widget->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // showConfirmDialog
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
void PlayerInfoDialog::onEnterPressedInternal()
|
void PlayerInfoDialog::onEnterPressedInternal()
|
||||||
{
|
{
|
||||||
}
|
} // onEnterPressedInternal
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
GUIEngine::EventPropagation PlayerInfoDialog::processEvent(const std::string& eventSource)
|
GUIEngine::EventPropagation
|
||||||
|
PlayerInfoDialog::processEvent(const std::string& eventSource)
|
||||||
{
|
{
|
||||||
if (eventSource == "renameplayer")
|
if (eventSource == "renameplayer")
|
||||||
{
|
{
|
||||||
// accept entered name
|
// accept entered name
|
||||||
stringw playerName = textCtrl->getText().trim();
|
stringw player_name = textCtrl->getText().trim();
|
||||||
|
|
||||||
const int player_amount = PlayerManager::get()->getNumPlayers();
|
const int player_amount = PlayerManager::get()->getNumPlayers();
|
||||||
for(int n=0; n<player_amount; n++)
|
for(int n=0; n<player_amount; n++)
|
||||||
@ -235,7 +249,7 @@ GUIEngine::EventPropagation PlayerInfoDialog::processEvent(const std::string& ev
|
|||||||
const PlayerProfile *player = PlayerManager::get()->getPlayer(n);
|
const PlayerProfile *player = PlayerManager::get()->getPlayer(n);
|
||||||
if (player == m_player) continue;
|
if (player == m_player) continue;
|
||||||
|
|
||||||
if (player->getName() == playerName)
|
if (player->getName() == player_name)
|
||||||
{
|
{
|
||||||
ButtonWidget* label = getWidget<ButtonWidget>("renameplayer");
|
ButtonWidget* label = getWidget<ButtonWidget>("renameplayer");
|
||||||
label->setBadge(BAD_BADGE);
|
label->setBadge(BAD_BADGE);
|
||||||
@ -244,9 +258,9 @@ GUIEngine::EventPropagation PlayerInfoDialog::processEvent(const std::string& ev
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerName.size() <= 0) return GUIEngine::EVENT_BLOCK;
|
if (player_name.size() <= 0) return GUIEngine::EVENT_BLOCK;
|
||||||
|
|
||||||
OptionsScreenPlayers::getInstance()->renamePlayer( playerName, m_player );
|
OptionsScreenPlayers::getInstance()->renamePlayer(player_name,m_player);
|
||||||
|
|
||||||
// irrLicht is too stupid to remove focus from deleted widgets
|
// irrLicht is too stupid to remove focus from deleted widgets
|
||||||
// so do it by hand
|
// so do it by hand
|
||||||
@ -292,7 +306,7 @@ GUIEngine::EventPropagation PlayerInfoDialog::processEvent(const std::string& ev
|
|||||||
return GUIEngine::EVENT_BLOCK;
|
return GUIEngine::EVENT_BLOCK;
|
||||||
}
|
}
|
||||||
return GUIEngine::EVENT_LET;
|
return GUIEngine::EVENT_LET;
|
||||||
}
|
} // processEvent
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -40,9 +40,6 @@ class PlayerInfoDialog : public GUIEngine::ModalDialog
|
|||||||
void showRegularDialog();
|
void showRegularDialog();
|
||||||
void showConfirmDialog();
|
void showConfirmDialog();
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* Creates a modal dialog with given percentage of screen width and height
|
|
||||||
*/
|
|
||||||
PlayerInfoDialog(PlayerProfile* PlayerInfoDialog,
|
PlayerInfoDialog(PlayerProfile* PlayerInfoDialog,
|
||||||
const float percentWidth, const float percentHeight);
|
const float percentWidth, const float percentHeight);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user