[General] Add optional notes to PasswordDialogs

pull/249/merge
David Cernat 8 years ago
parent 9630f95335
commit 1f682749d6

@ -47,13 +47,14 @@ void GUIFunctions::InputDialog(unsigned short pid, int id, const char *label) no
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->Send(false);
}
void GUIFunctions::PasswordDialog(unsigned short pid, int id, const char *label) noexcept
void GUIFunctions::PasswordDialog(unsigned short pid, int id, const char *label, const char *note) noexcept
{
Player *player;
GET_PLAYER(pid, player,);
player->guiMessageBox.id = id;
player->guiMessageBox.label = label;
player->guiMessageBox.note = note;
player->guiMessageBox.type = Player::GUIMessageBox::PasswordDialog;
mwmp::Networking::get().getPlayerPacketController()->GetPacket(ID_GUI_MESSAGEBOX)->setPlayer(player);

@ -22,7 +22,7 @@ public:
static void CustomMessageBox(unsigned short pid, int id, const char *label, const char *buttons) noexcept;
static void InputDialog(unsigned short pid, int id, const char *label) noexcept;
static void PasswordDialog(unsigned short pid, int id, const char *label) noexcept;
static void PasswordDialog(unsigned short pid, int id, const char *label, const char *note) noexcept;
static void ListBox(unsigned short pid, int id, const char *label, const char *items);

@ -13,7 +13,7 @@
namespace mwmp
{
TextInputDialog::TextInputDialog()
: MWGui::WindowModal("openmw_text_input.layout")
: MWGui::WindowModal("tes3mp_text_input.layout")
{
// Centre dialog
center();
@ -50,6 +50,11 @@ namespace mwmp
setText("LabelT", label);
}
void TextInputDialog::setTextNote(const std::string &note)
{
setText("TextNote", note);
}
void TextInputDialog::open()
{
WindowModal::open();

@ -25,6 +25,7 @@ namespace mwmp
void setNextButtonShow(bool shown);
void setTextLabel(const std::string &label);
void setTextNote(const std::string &note);
void setEditPassword(bool value);

@ -154,6 +154,8 @@ void mwmp::GUIController::showInputBox(const BasePlayer::GUIMessageBox &guiMessa
mInputBox->setEditPassword(guiMessageBox.type == BasePlayer::GUIMessageBox::PasswordDialog);
mInputBox->setTextLabel(guiMessageBox.label);
mInputBox->setTextNote(guiMessageBox.note);
mInputBox->eventDone += MyGUI::newDelegate(this, &GUIController::onInputBoxDone);
}

@ -168,6 +168,7 @@ namespace mwmp
ListBox
};
std::string label;
std::string note;
std::string buttons;
std::string data;

@ -25,5 +25,7 @@ void PacketGUIBoxes::Packet(RakNet::BitStream *bs, bool send)
if (player->guiMessageBox.type == BasePlayer::GUIMessageBox::CustomMessageBox)
RW(player->guiMessageBox.buttons, send);
else if (player->guiMessageBox.type == BasePlayer::GUIMessageBox::PasswordDialog)
RW(player->guiMessageBox.note, send);
}

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="VBox" skin="MW_Dialog" layer="Windows" align="Center" name="_Main">
<Property key="AutoResize" value="true"/>
<Property key="Padding" value="10"/>
<Property key="Spacing" value="12"/>
<!-- Appearance -->
<Widget type="TextBox" skin="ProgressText" position="6 6 300 18" name="LabelT" align="Left Top">
<Property key="TextAlign" value="Left Top"/>
</Widget>
<Widget type="EditBox" skin="MW_TextEdit" position="6 28 300 30" name="TextEdit" align="Left Top"/>
<!-- Dialog buttons -->
<Widget type="HBox" skin="">
<UserString key="HStretch" value="true"/>
<Widget type="Widget">
<UserString key="HStretch" value="true"/>
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" name="OKButton">
<Property key="Caption" value="OK"/>
</Widget>
</Widget>
<Widget type="AutoSizedEditBox" skin="HeaderText" position="6 96 300 0" name="TextNote" align="Left Top">
<Property key="TextAlign" value="Center"/>
<Property key="MultiLine" value="true"/>
<Property key="WordWrap" value="true"/>
</Widget>
</Widget>
</MyGUI>
Loading…
Cancel
Save