mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-11 09:18:40 +12:00
cellOskDialog: add message
This commit is contained in:
parent
cc30b4e5be
commit
7cc4239cc2
4 changed files with 24 additions and 5 deletions
|
@ -100,7 +100,7 @@ public:
|
||||||
|
|
||||||
virtual ~MsgDialogBase();
|
virtual ~MsgDialogBase();
|
||||||
virtual void Create(const std::string& msg, const std::string& title = "") = 0;
|
virtual void Create(const std::string& msg, const std::string& title = "") = 0;
|
||||||
virtual void CreateOsk(const std::string& msg, char16_t* osk_text, u32 charlimit) = 0;
|
virtual void CreateOsk(const std::string& title, const std::u16string& message, char16_t* osk_text, u32 charlimit) = 0;
|
||||||
virtual void SetMsg(const std::string& msg) = 0;
|
virtual void SetMsg(const std::string& msg) = 0;
|
||||||
virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) = 0;
|
virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) = 0;
|
||||||
virtual void ProgressBarReset(u32 progressBarIndex) = 0;
|
virtual void ProgressBarReset(u32 progressBarIndex) = 0;
|
||||||
|
|
|
@ -33,8 +33,10 @@ s32 cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dialogPara
|
||||||
return CELL_SYSUTIL_ERROR_BUSY;
|
return CELL_SYSUTIL_ERROR_BUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get max length of the return value
|
||||||
u32 maxLength = (inputFieldInfo->limit_length >= CELL_OSKDIALOG_STRING_SIZE) ? 511 : (u32)inputFieldInfo->limit_length;
|
u32 maxLength = (inputFieldInfo->limit_length >= CELL_OSKDIALOG_STRING_SIZE) ? 511 : (u32)inputFieldInfo->limit_length;
|
||||||
|
|
||||||
|
// Get init text and prepare return value
|
||||||
s_osk_input_result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK;
|
s_osk_input_result = CELL_OSKDIALOG_INPUT_FIELD_RESULT_OK;
|
||||||
std::memset(s_osk_text, 0, sizeof(s_osk_text));
|
std::memset(s_osk_text, 0, sizeof(s_osk_text));
|
||||||
std::memset(s_osk_text_old, 0, sizeof(s_osk_text_old));
|
std::memset(s_osk_text_old, 0, sizeof(s_osk_text_old));
|
||||||
|
@ -48,6 +50,19 @@ s32 cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dialogPara
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get message to display above the input field
|
||||||
|
// Guarantees 0 terminated (+1). In praxis only 128 but for now lets display all of it
|
||||||
|
char16_t message[CELL_OSKDIALOG_STRING_SIZE + 1];
|
||||||
|
std::memset(message, 0, sizeof(message));
|
||||||
|
|
||||||
|
if (inputFieldInfo->message.addr() != 0)
|
||||||
|
{
|
||||||
|
for (u32 i = 0; (i < CELL_OSKDIALOG_STRING_SIZE) && (inputFieldInfo->message[i] != 0); i++)
|
||||||
|
{
|
||||||
|
message[i] = inputFieldInfo->message[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
osk->on_close = [wptr = std::weak_ptr<MsgDialogBase>(osk)](s32 status)
|
osk->on_close = [wptr = std::weak_ptr<MsgDialogBase>(osk)](s32 status)
|
||||||
|
@ -94,7 +109,7 @@ s32 cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dialogPara
|
||||||
|
|
||||||
Emu.CallAfter([&]()
|
Emu.CallAfter([&]()
|
||||||
{
|
{
|
||||||
osk->CreateOsk("On Screen Keyboard", s_osk_text, maxLength);
|
osk->CreateOsk("On Screen Keyboard", message, s_osk_text, maxLength);
|
||||||
result = true;
|
result = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ void msg_dialog_frame::Create(const std::string& msg, const std::string& title)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void msg_dialog_frame::CreateOsk(const std::string& msg, char16_t* osk_text, u32 charlimit)
|
void msg_dialog_frame::CreateOsk(const std::string& title, const std::u16string& message, char16_t* osk_text, u32 charlimit)
|
||||||
{
|
{
|
||||||
state = MsgDialogState::Open;
|
state = MsgDialogState::Open;
|
||||||
|
|
||||||
|
@ -169,7 +169,10 @@ void msg_dialog_frame::CreateOsk(const std::string& msg, char16_t* osk_text, u32
|
||||||
m_osk_text_return = osk_text;
|
m_osk_text_return = osk_text;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
m_osk_dialog->setWindowTitle(qstr(msg));
|
m_osk_dialog->setWindowTitle(qstr(title));
|
||||||
|
|
||||||
|
// Message
|
||||||
|
QLabel* message_label = new QLabel(QString::fromStdU16String(message));
|
||||||
|
|
||||||
// Text Input
|
// Text Input
|
||||||
QLineEdit* input = new QLineEdit(m_osk_dialog);
|
QLineEdit* input = new QLineEdit(m_osk_dialog);
|
||||||
|
@ -199,6 +202,7 @@ void msg_dialog_frame::CreateOsk(const std::string& msg, char16_t* osk_text, u32
|
||||||
|
|
||||||
QFormLayout* layout = new QFormLayout(m_osk_dialog);
|
QFormLayout* layout = new QFormLayout(m_osk_dialog);
|
||||||
layout->setFormAlignment(Qt::AlignHCenter);
|
layout->setFormAlignment(Qt::AlignHCenter);
|
||||||
|
layout->addRow(message_label);
|
||||||
layout->addRow(inputLayout);
|
layout->addRow(inputLayout);
|
||||||
layout->addRow(buttonsLayout);
|
layout->addRow(buttonsLayout);
|
||||||
m_osk_dialog->setLayout(layout);
|
m_osk_dialog->setLayout(layout);
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
msg_dialog_frame(QWindow* taskbarTarget);
|
msg_dialog_frame(QWindow* taskbarTarget);
|
||||||
~msg_dialog_frame();
|
~msg_dialog_frame();
|
||||||
virtual void Create(const std::string& msg, const std::string& title = "") override;
|
virtual void Create(const std::string& msg, const std::string& title = "") override;
|
||||||
virtual void CreateOsk(const std::string& msg, char16_t* osk_text, u32 charlimit) override;
|
virtual void CreateOsk(const std::string& title, const std::u16string& message, char16_t* osk_text, u32 charlimit) override;
|
||||||
virtual void SetMsg(const std::string& msg) override;
|
virtual void SetMsg(const std::string& msg) override;
|
||||||
virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) override;
|
virtual void ProgressBarSetMsg(u32 progressBarIndex, const std::string& msg) override;
|
||||||
virtual void ProgressBarReset(u32 progressBarIndex) override;
|
virtual void ProgressBarReset(u32 progressBarIndex) override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue