mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12:00
overlays: add subject and body to recvmessage dialog
This commit is contained in:
parent
319657e815
commit
a5955657c5
6 changed files with 70 additions and 21 deletions
|
@ -15,26 +15,64 @@ namespace rsx
|
||||||
dlg->callback_handler(std::move(new_msg), msg_id);
|
dlg->callback_handler(std::move(new_msg), msg_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
recvmessage_dialog::list_entry::list_entry(const std::string& msg)
|
recvmessage_dialog::list_entry::list_entry(const std::string& name, const std::string& subj, const std::string& body)
|
||||||
{
|
{
|
||||||
std::unique_ptr<overlay_element> text_stack = std::make_unique<vertical_layout>();
|
std::unique_ptr<overlay_element> prefix_stack = std::make_unique<vertical_layout>();
|
||||||
std::unique_ptr<overlay_element> padding = std::make_unique<spacer>();
|
std::unique_ptr<overlay_element> text_stack = std::make_unique<vertical_layout>();
|
||||||
std::unique_ptr<overlay_element> text_label = std::make_unique<label>(msg);
|
std::unique_ptr<overlay_element> name_label = std::make_unique<label>(name);
|
||||||
|
std::unique_ptr<overlay_element> subj_label = std::make_unique<label>(subj);
|
||||||
|
std::unique_ptr<overlay_element> body_label = std::make_unique<label>(body);
|
||||||
|
std::unique_ptr<overlay_element> name_prefix_label = std::make_unique<label>(get_localized_string(localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_FROM));
|
||||||
|
std::unique_ptr<overlay_element> subj_prefix_label = std::make_unique<label>(get_localized_string(localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_SUBJECT));
|
||||||
|
|
||||||
padding->set_size(1, 1);
|
name_prefix_label->set_size(0, 40);
|
||||||
text_label->set_size(800, 40);
|
name_prefix_label->set_font("Arial", 16);
|
||||||
text_label->set_font("Arial", 16);
|
name_prefix_label->set_wrap_text(false);
|
||||||
text_label->set_wrap_text(true);
|
static_cast<label*>(name_prefix_label.get())->auto_resize(true);
|
||||||
|
|
||||||
|
subj_prefix_label->set_size(0, 40);
|
||||||
|
subj_prefix_label->set_font("Arial", 16);
|
||||||
|
subj_prefix_label->set_wrap_text(false);
|
||||||
|
static_cast<label*>(subj_prefix_label.get())->auto_resize(true);
|
||||||
|
|
||||||
|
name_label->set_size(200, 40);
|
||||||
|
name_label->set_font("Arial", 16);
|
||||||
|
name_label->set_wrap_text(false);
|
||||||
|
|
||||||
|
subj_label->set_size(600, 40);
|
||||||
|
subj_label->set_font("Arial", 16);
|
||||||
|
subj_label->set_wrap_text(false);
|
||||||
|
|
||||||
|
body_label->set_size(800, 0);
|
||||||
|
body_label->set_font("Arial", 16);
|
||||||
|
body_label->set_wrap_text(true);
|
||||||
|
static_cast<label*>(body_label.get())->auto_resize(true);
|
||||||
|
|
||||||
// Make back color transparent for text
|
// Make back color transparent for text
|
||||||
text_label->back_color.a = 0.f;
|
name_label->back_color.a = 0.f;
|
||||||
|
subj_label->back_color.a = 0.f;
|
||||||
|
body_label->back_color.a = 0.f;
|
||||||
|
name_prefix_label->back_color.a = 0.f;
|
||||||
|
subj_prefix_label->back_color.a = 0.f;
|
||||||
|
|
||||||
|
static_cast<vertical_layout*>(prefix_stack.get())->pack_padding = 5;
|
||||||
|
static_cast<vertical_layout*>(prefix_stack.get())->add_spacer();
|
||||||
|
static_cast<vertical_layout*>(prefix_stack.get())->add_element(name_prefix_label);
|
||||||
|
static_cast<vertical_layout*>(prefix_stack.get())->add_element(subj_prefix_label);
|
||||||
|
|
||||||
static_cast<vertical_layout*>(text_stack.get())->pack_padding = 5;
|
static_cast<vertical_layout*>(text_stack.get())->pack_padding = 5;
|
||||||
static_cast<vertical_layout*>(text_stack.get())->add_element(padding);
|
static_cast<vertical_layout*>(text_stack.get())->add_spacer();
|
||||||
static_cast<vertical_layout*>(text_stack.get())->add_element(text_label);
|
static_cast<vertical_layout*>(text_stack.get())->add_element(name_label);
|
||||||
|
static_cast<vertical_layout*>(text_stack.get())->add_element(subj_label);
|
||||||
|
static_cast<vertical_layout*>(text_stack.get())->add_element(body_label);
|
||||||
|
|
||||||
|
// Add spacer to make the thing look a bit nicer at the bottom... should ideally not be necessary
|
||||||
|
static_cast<vertical_layout*>(text_stack.get())->pack_padding = 25;
|
||||||
|
static_cast<vertical_layout*>(text_stack.get())->add_spacer();
|
||||||
|
|
||||||
// Pack
|
// Pack
|
||||||
pack_padding = 15;
|
pack_padding = 15;
|
||||||
|
add_element(prefix_stack);
|
||||||
add_element(text_stack);
|
add_element(text_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +82,7 @@ namespace rsx
|
||||||
m_dim_background->set_size(virtual_width, virtual_height);
|
m_dim_background->set_size(virtual_width, virtual_height);
|
||||||
m_dim_background->back_color.a = 0.5f;
|
m_dim_background->back_color.a = 0.5f;
|
||||||
|
|
||||||
m_list = std::make_unique<list_view>(virtual_width - 2 * 20, 540, false, true);
|
m_list = std::make_unique<list_view>(virtual_width - 2 * 20, 540, true, true);
|
||||||
m_list->set_pos(20, 85);
|
m_list->set_pos(20, 85);
|
||||||
|
|
||||||
m_description = std::make_unique<label>();
|
m_description = std::make_unique<label>();
|
||||||
|
@ -186,7 +224,7 @@ namespace rsx
|
||||||
for (const auto& [id, message] : messages)
|
for (const auto& [id, message] : messages)
|
||||||
{
|
{
|
||||||
ensure(message);
|
ensure(message);
|
||||||
std::unique_ptr<overlay_element> entry = std::make_unique<list_entry>(message->first);
|
std::unique_ptr<overlay_element> entry = std::make_unique<list_entry>(message->first, message->second.subject, message->second.body);
|
||||||
m_entries.emplace_back(std::move(entry));
|
m_entries.emplace_back(std::move(entry));
|
||||||
m_entry_ids.push_back(id);
|
m_entry_ids.push_back(id);
|
||||||
}
|
}
|
||||||
|
@ -279,7 +317,7 @@ namespace rsx
|
||||||
|
|
||||||
std::lock_guard lock(m_mutex);
|
std::lock_guard lock(m_mutex);
|
||||||
|
|
||||||
std::unique_ptr<overlay_element> entry = std::make_unique<list_entry>(new_msg->first);
|
std::unique_ptr<overlay_element> entry = std::make_unique<list_entry>(new_msg->first, new_msg->second.subject, new_msg->second.body);
|
||||||
m_entries.emplace_back(std::move(entry));
|
m_entries.emplace_back(std::move(entry));
|
||||||
m_entry_ids.push_back(msg_id);
|
m_entry_ids.push_back(msg_id);
|
||||||
m_list->add_entry(m_entries.back());
|
m_list->add_entry(m_entries.back());
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace rsx
|
||||||
struct list_entry : horizontal_layout
|
struct list_entry : horizontal_layout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
list_entry(const std::string& msg);
|
list_entry(const std::string& name, const std::string& subj, const std::string& body);
|
||||||
};
|
};
|
||||||
|
|
||||||
shared_mutex m_mutex;
|
shared_mutex m_mutex;
|
||||||
|
|
|
@ -668,6 +668,12 @@ namespace rsx
|
||||||
return compiled_resources;
|
return compiled_resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void layout_container::add_spacer()
|
||||||
|
{
|
||||||
|
std::unique_ptr<overlay_element> spacer_element = std::make_unique<spacer>();
|
||||||
|
add_element(spacer_element);
|
||||||
|
}
|
||||||
|
|
||||||
overlay_element* vertical_layout::add_element(std::unique_ptr<overlay_element>& item, int offset)
|
overlay_element* vertical_layout::add_element(std::unique_ptr<overlay_element>& item, int offset)
|
||||||
{
|
{
|
||||||
if (auto_resize)
|
if (auto_resize)
|
||||||
|
|
|
@ -215,6 +215,7 @@ namespace rsx
|
||||||
compiled_resource& get_compiled() override;
|
compiled_resource& get_compiled() override;
|
||||||
|
|
||||||
virtual u16 get_scroll_offset_px() = 0;
|
virtual u16 get_scroll_offset_px() = 0;
|
||||||
|
void add_spacer();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vertical_layout : public layout_container
|
struct vertical_layout : public layout_container
|
||||||
|
|
|
@ -139,6 +139,8 @@ enum class localized_string_id
|
||||||
CELL_NP_RECVMESSAGE_DIALOG_TITLE,
|
CELL_NP_RECVMESSAGE_DIALOG_TITLE,
|
||||||
CELL_NP_RECVMESSAGE_DIALOG_TITLE_INVITE,
|
CELL_NP_RECVMESSAGE_DIALOG_TITLE_INVITE,
|
||||||
CELL_NP_RECVMESSAGE_DIALOG_TITLE_ADD_FRIEND,
|
CELL_NP_RECVMESSAGE_DIALOG_TITLE_ADD_FRIEND,
|
||||||
|
CELL_NP_RECVMESSAGE_DIALOG_FROM,
|
||||||
|
CELL_NP_RECVMESSAGE_DIALOG_SUBJECT,
|
||||||
|
|
||||||
CELL_NP_SENDMESSAGE_DIALOG_TITLE,
|
CELL_NP_SENDMESSAGE_DIALOG_TITLE,
|
||||||
CELL_NP_SENDMESSAGE_DIALOG_TITLE_INVITE,
|
CELL_NP_SENDMESSAGE_DIALOG_TITLE_INVITE,
|
||||||
|
|
|
@ -160,12 +160,14 @@ private:
|
||||||
case localized_string_id::CELL_SAVEDATA_OVERWRITE: return tr("Do you want to overwrite the saved data?\n\n%0", "Savedata entry info").arg(std::forward<Args>(args)...);
|
case localized_string_id::CELL_SAVEDATA_OVERWRITE: return tr("Do you want to overwrite the saved data?\n\n%0", "Savedata entry info").arg(std::forward<Args>(args)...);
|
||||||
case localized_string_id::CELL_CROSS_CONTROLLER_MSG: return tr("Start [%0] on the PS Vita system.\nIf you have not installed [%0], go to [Remote Play] on the PS Vita system and start [Cross-Controller] from the LiveArea™ screen.", "Cross-Controller message").arg(std::forward<Args>(args)...);
|
case localized_string_id::CELL_CROSS_CONTROLLER_MSG: return tr("Start [%0] on the PS Vita system.\nIf you have not installed [%0], go to [Remote Play] on the PS Vita system and start [Cross-Controller] from the LiveArea™ screen.", "Cross-Controller message").arg(std::forward<Args>(args)...);
|
||||||
case localized_string_id::CELL_CROSS_CONTROLLER_FW_MSG: return tr("If your system software version on the PS Vita system is earlier than 1.80, you must update the system software to the latest version.", "Cross-Controller firmware message");
|
case localized_string_id::CELL_CROSS_CONTROLLER_FW_MSG: return tr("If your system software version on the PS Vita system is earlier than 1.80, you must update the system software to the latest version.", "Cross-Controller firmware message");
|
||||||
case localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_TITLE: return tr("Select Message");
|
case localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_TITLE: return tr("Select Message", "RECVMESSAGE_DIALOG");
|
||||||
case localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_TITLE_INVITE: return tr("Select Invite");
|
case localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_TITLE_INVITE: return tr("Select Invite", "RECVMESSAGE_DIALOG");
|
||||||
case localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_TITLE_ADD_FRIEND: return tr("Add Friend");
|
case localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_TITLE_ADD_FRIEND: return tr("Add Friend", "RECVMESSAGE_DIALOG");
|
||||||
case localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_TITLE: return tr("Select Message To Send");
|
case localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_FROM: return tr("From:", "RECVMESSAGE_DIALOG");
|
||||||
case localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_TITLE_INVITE: return tr("Send Invite");
|
case localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_SUBJECT: return tr("Subject:", "RECVMESSAGE_DIALOG");
|
||||||
case localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_TITLE_ADD_FRIEND: return tr("Add Friend");
|
case localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_TITLE: return tr("Select Message To Send", "SENDMESSAGE_DIALOG");
|
||||||
|
case localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_TITLE_INVITE: return tr("Send Invite", "SENDMESSAGE_DIALOG");
|
||||||
|
case localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_TITLE_ADD_FRIEND: return tr("Add Friend", "SENDMESSAGE_DIALOG");
|
||||||
case localized_string_id::RECORDING_ABORTED: return tr("Recording aborted!");
|
case localized_string_id::RECORDING_ABORTED: return tr("Recording aborted!");
|
||||||
case localized_string_id::RPCN_NO_ERROR: return tr("RPCN: No Error");
|
case localized_string_id::RPCN_NO_ERROR: return tr("RPCN: No Error");
|
||||||
case localized_string_id::RPCN_ERROR_INVALID_INPUT: return tr("RPCN: Invalid Input (Wrong Host/Port)");
|
case localized_string_id::RPCN_ERROR_INVALID_INPUT: return tr("RPCN: Invalid Input (Wrong Host/Port)");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue