mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 12:32:43 +00:00
overlays: implement native sendmessage dialog
This commit is contained in:
parent
9ef5a01de4
commit
23dc6a44f6
@ -472,6 +472,7 @@ target_sources(rpcs3_emu PRIVATE
|
||||
RSX/Overlays/HomeMenu/overlay_home_menu_page.cpp
|
||||
RSX/Overlays/HomeMenu/overlay_home_menu_settings.cpp
|
||||
RSX/Overlays/Network/overlay_recvmessage_dialog.cpp
|
||||
RSX/Overlays/Network/overlay_sendmessage_dialog.cpp
|
||||
RSX/Overlays/overlay_animated_icon.cpp
|
||||
RSX/Overlays/overlay_animation.cpp
|
||||
RSX/Overlays/overlay_controls.cpp
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "Emu/RSX/Overlays/overlay_manager.h"
|
||||
#include "Emu/RSX/Overlays/Network/overlay_recvmessage_dialog.h"
|
||||
#include "Emu/RSX/Overlays/Network/overlay_sendmessage_dialog.h"
|
||||
|
||||
LOG_CHANNEL(sceNp);
|
||||
|
||||
@ -1228,19 +1229,27 @@ error_code sceNpBasicSendMessageGui(vm::cptr<SceNpBasicMessageDetails> msg, sys_
|
||||
|
||||
sceNp.trace("Message Data:\n%s", fmt::buf_to_hexstring(msg->data.get_ptr(), msg->size));
|
||||
|
||||
bool result = false;
|
||||
error_code result = CELL_CANCEL;
|
||||
|
||||
input::SetIntercepted(true);
|
||||
|
||||
Emu.BlockingCallFromMainThread([=, &result, msg_data = std::move(msg_data), npids = std::move(npids)]() mutable
|
||||
if (auto manager = g_fxo->try_get<rsx::overlays::display_manager>())
|
||||
{
|
||||
auto send_dlg = Emu.GetCallbacks().get_sendmessage_dialog();
|
||||
result = send_dlg->Exec(msg_data, npids);
|
||||
});
|
||||
auto recv_dlg = manager->create<rsx::overlays::sendmessage_dialog>();
|
||||
result = recv_dlg->Exec(msg_data, npids);
|
||||
}
|
||||
else
|
||||
{
|
||||
input::SetIntercepted(true);
|
||||
|
||||
input::SetIntercepted(false);
|
||||
Emu.BlockingCallFromMainThread([=, &result, msg_data = std::move(msg_data), npids = std::move(npids)]() mutable
|
||||
{
|
||||
auto send_dlg = Emu.GetCallbacks().get_sendmessage_dialog();
|
||||
result = send_dlg->Exec(msg_data, npids);
|
||||
});
|
||||
|
||||
s32 callback_result = result ? 0 : -1;
|
||||
input::SetIntercepted(false);
|
||||
}
|
||||
|
||||
s32 callback_result = result == CELL_OK ? 0 : -1;
|
||||
s32 event = 0;
|
||||
|
||||
switch (msg->mainType)
|
||||
|
@ -1712,7 +1712,11 @@ class SendMessageDialogBase
|
||||
public:
|
||||
virtual ~SendMessageDialogBase() = default;
|
||||
|
||||
virtual bool Exec(message_data& msg_data, std::set<std::string>& npids) = 0;
|
||||
virtual error_code Exec(message_data& msg_data, std::set<std::string>& npids) = 0;
|
||||
virtual void callback_handler(u16 ntype, const std::string& username, bool status) = 0;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<rpcn::rpcn_client> m_rpcn;
|
||||
};
|
||||
|
||||
class RecvMessageDialogBase
|
||||
|
372
rpcs3/Emu/RSX/Overlays/Network/overlay_sendmessage_dialog.cpp
Normal file
372
rpcs3/Emu/RSX/Overlays/Network/overlay_sendmessage_dialog.cpp
Normal file
@ -0,0 +1,372 @@
|
||||
#include "stdafx.h"
|
||||
#include "../overlay_manager.h"
|
||||
#include "overlay_sendmessage_dialog.h"
|
||||
#include "Emu/RSX/RSXThread.h"
|
||||
#include "Emu/NP/rpcn_client.h"
|
||||
#include "Utilities/Thread.h"
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
namespace overlays
|
||||
{
|
||||
void sendmessage_friend_callback(void* param, rpcn::NotificationType ntype, const std::string& username, bool status)
|
||||
{
|
||||
auto* dlg = static_cast<sendmessage_dialog*>(param);
|
||||
dlg->callback_handler(ntype, username, status);
|
||||
}
|
||||
|
||||
sendmessage_dialog::list_entry::list_entry(const std::string& msg)
|
||||
{
|
||||
std::unique_ptr<overlay_element> text_stack = std::make_unique<vertical_layout>();
|
||||
std::unique_ptr<overlay_element> padding = std::make_unique<spacer>();
|
||||
std::unique_ptr<overlay_element> text_label = std::make_unique<label>(msg);
|
||||
|
||||
padding->set_size(1, 1);
|
||||
text_label->set_size(800, 40);
|
||||
text_label->set_font("Arial", 16);
|
||||
text_label->set_wrap_text(true);
|
||||
|
||||
// Make back color transparent for text
|
||||
text_label->back_color.a = 0.f;
|
||||
|
||||
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_element(text_label);
|
||||
|
||||
// Pack
|
||||
pack_padding = 15;
|
||||
add_element(text_stack);
|
||||
}
|
||||
|
||||
sendmessage_dialog::sendmessage_dialog() : SendMessageDialogBase()
|
||||
{
|
||||
m_dim_background = std::make_unique<overlay_element>();
|
||||
m_dim_background->set_size(virtual_width, virtual_height);
|
||||
m_dim_background->back_color.a = 0.5f;
|
||||
|
||||
m_description = std::make_unique<label>();
|
||||
m_description->set_font("Arial", 20);
|
||||
m_description->set_pos(20, 37);
|
||||
m_description->set_text(get_localized_string(localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_TITLE));
|
||||
m_description->auto_resize();
|
||||
m_description->back_color.a = 0.f;
|
||||
|
||||
fade_animation.duration = 0.15f;
|
||||
|
||||
return_code = selection_code::canceled;
|
||||
}
|
||||
|
||||
void sendmessage_dialog::update()
|
||||
{
|
||||
if (fade_animation.active)
|
||||
{
|
||||
fade_animation.update(rsx::get_current_renderer()->vblank_count);
|
||||
}
|
||||
}
|
||||
|
||||
void sendmessage_dialog::on_button_pressed(pad_button button_press, bool is_auto_repeat)
|
||||
{
|
||||
if (fade_animation.active) return;
|
||||
|
||||
bool close_dialog = false;
|
||||
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
switch (button_press)
|
||||
{
|
||||
case pad_button::cross:
|
||||
if (m_list->m_items.empty())
|
||||
break;
|
||||
|
||||
if (!get_current_selection().empty())
|
||||
{
|
||||
return_code = selection_code::ok;
|
||||
}
|
||||
else
|
||||
{
|
||||
return_code = selection_code::error;
|
||||
}
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_decide.wav");
|
||||
close_dialog = true;
|
||||
break;
|
||||
case pad_button::circle:
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cancel.wav");
|
||||
close_dialog = true;
|
||||
break;
|
||||
case pad_button::dpad_up:
|
||||
case pad_button::ls_up:
|
||||
m_list->select_previous();
|
||||
break;
|
||||
case pad_button::dpad_down:
|
||||
case pad_button::ls_down:
|
||||
m_list->select_next();
|
||||
break;
|
||||
case pad_button::L1:
|
||||
m_list->select_previous(10);
|
||||
break;
|
||||
case pad_button::R1:
|
||||
m_list->select_next(10);
|
||||
break;
|
||||
default:
|
||||
rsx_log.trace("[ui] Button %d pressed", static_cast<u8>(button_press));
|
||||
break;
|
||||
}
|
||||
|
||||
if (close_dialog)
|
||||
{
|
||||
fade_animation.current = color4f(1.f);
|
||||
fade_animation.end = color4f(0.f);
|
||||
fade_animation.active = true;
|
||||
|
||||
fade_animation.on_finish = [this]
|
||||
{
|
||||
close(true, true);
|
||||
};
|
||||
}
|
||||
// Play a sound unless this is a fast auto repeat which would induce a nasty noise
|
||||
else if (!is_auto_repeat || m_auto_repeat_ms_interval >= m_auto_repeat_ms_interval_default)
|
||||
{
|
||||
Emu.GetCallbacks().play_sound(fs::get_config_dir() + "sounds/snd_cursor.wav");
|
||||
}
|
||||
}
|
||||
|
||||
compiled_resource sendmessage_dialog::get_compiled()
|
||||
{
|
||||
if (!visible)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
compiled_resource result;
|
||||
result.add(m_dim_background->get_compiled());
|
||||
|
||||
if (m_list)
|
||||
{
|
||||
result.add(m_list->get_compiled());
|
||||
}
|
||||
|
||||
result.add(m_description->get_compiled());
|
||||
|
||||
fade_animation.apply(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
error_code sendmessage_dialog::Exec(message_data& msg_data, std::set<std::string>& npids)
|
||||
{
|
||||
visible = false;
|
||||
|
||||
switch (msg_data.mainType)
|
||||
{
|
||||
case SceNpBasicMessageMainType::SCE_NP_BASIC_MESSAGE_MAIN_TYPE_ADD_FRIEND:
|
||||
m_description->set_text(get_localized_string(localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_TITLE_ADD_FRIEND));
|
||||
m_description->auto_resize();
|
||||
break;
|
||||
case SceNpBasicMessageMainType::SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE:
|
||||
m_description->set_text(get_localized_string(localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_TITLE_INVITE));
|
||||
m_description->auto_resize();
|
||||
break;
|
||||
case SceNpBasicMessageMainType::SCE_NP_BASIC_MESSAGE_MAIN_TYPE_DATA_ATTACHMENT:
|
||||
case SceNpBasicMessageMainType::SCE_NP_BASIC_MESSAGE_MAIN_TYPE_GENERAL:
|
||||
case SceNpBasicMessageMainType::SCE_NP_BASIC_MESSAGE_MAIN_TYPE_CUSTOM_DATA:
|
||||
case SceNpBasicMessageMainType::SCE_NP_BASIC_MESSAGE_MAIN_TYPE_URL_ATTACHMENT:
|
||||
default:
|
||||
break; // Title already set in constructor
|
||||
}
|
||||
|
||||
m_rpcn = rpcn::rpcn_client::get_instance(true);
|
||||
|
||||
// Get list of messages
|
||||
rpcn::friend_data data;
|
||||
m_rpcn->get_friends_and_register_cb(data, sendmessage_friend_callback, this);
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
for (const auto& [name, online_data] : data.friends)
|
||||
{
|
||||
// Only add online friends to the list
|
||||
if (online_data.online)
|
||||
{
|
||||
if (std::any_of(m_entry_names.cbegin(), m_entry_names.cend(), [&name](const std::string& entry){ return entry == name; }))
|
||||
continue;
|
||||
|
||||
m_entry_names.push_back(name);
|
||||
}
|
||||
}
|
||||
|
||||
reload({});
|
||||
}
|
||||
|
||||
fade_animation.current = color4f(0.f);
|
||||
fade_animation.end = color4f(1.f);
|
||||
fade_animation.active = true;
|
||||
|
||||
visible = true;
|
||||
|
||||
const auto notify = std::make_shared<atomic_t<u32>>(0);
|
||||
auto& overlayman = g_fxo->get<display_manager>();
|
||||
|
||||
// Block until the user exits the dialog
|
||||
overlayman.attach_thread_input(
|
||||
uid, "Sendmessage dialog", nullptr,
|
||||
[notify](s32) { *notify = true; notify->notify_one(); }
|
||||
);
|
||||
|
||||
while (!Emu.IsStopped() && !*notify)
|
||||
{
|
||||
notify->wait(0, atomic_wait_timeout{1'000'000});
|
||||
}
|
||||
|
||||
m_rpcn->remove_friend_cb(sendmessage_friend_callback, this);
|
||||
|
||||
error_code result = CELL_CANCEL;
|
||||
|
||||
switch (return_code)
|
||||
{
|
||||
case selection_code::ok:
|
||||
{
|
||||
const std::string current_selection = get_current_selection();
|
||||
|
||||
if (current_selection.empty())
|
||||
{
|
||||
rsx_log.fatal("sendmessage dialog can't send message to empty npid");
|
||||
break;
|
||||
}
|
||||
|
||||
npids.insert(current_selection);
|
||||
|
||||
// Send the message
|
||||
if (m_rpcn->send_message(msg_data, npids))
|
||||
{
|
||||
result = CELL_OK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
rsx_log.error("sendmessage dialog exited with error: %d", return_code);
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string sendmessage_dialog::get_current_selection() const
|
||||
{
|
||||
if (const s32 index = m_list->get_selected_index(); index >= 0 && static_cast<usz>(index) < m_entry_names.size())
|
||||
{
|
||||
return m_entry_names[index];
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void sendmessage_dialog::reload(const std::string& previous_selection)
|
||||
{
|
||||
if (m_list)
|
||||
{
|
||||
status_flags |= status_bits::invalidate_image_cache;
|
||||
}
|
||||
|
||||
m_list = std::make_unique<list_view>(virtual_width - 2 * 20, 540);
|
||||
m_list->set_pos(20, 85);
|
||||
|
||||
for (const std::string& name : m_entry_names)
|
||||
{
|
||||
std::unique_ptr<overlay_element> entry = std::make_unique<list_entry>(name);
|
||||
m_list->add_entry(entry);
|
||||
}
|
||||
|
||||
if (m_list->m_items.empty())
|
||||
{
|
||||
m_list->set_cancel_only(true);
|
||||
}
|
||||
else if (m_list->get_cancel_only())
|
||||
{
|
||||
m_list->set_cancel_only(false);
|
||||
m_list->select_entry(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Only select an entry if there are entries available
|
||||
s32 selected_index = 0;
|
||||
|
||||
// Try to select the previous selection
|
||||
if (!previous_selection.empty())
|
||||
{
|
||||
for (s32 i = 0; i < ::narrow<s32>(m_entry_names.size()); i++)
|
||||
{
|
||||
if (m_entry_names[i] == previous_selection)
|
||||
{
|
||||
selected_index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_list->select_entry(selected_index);
|
||||
}
|
||||
}
|
||||
|
||||
void sendmessage_dialog::callback_handler(u16 ntype, const std::string& username, bool status)
|
||||
{
|
||||
std::lock_guard lock(m_mutex);
|
||||
|
||||
const auto add_friend = [&]()
|
||||
{
|
||||
if (std::any_of(m_entry_names.cbegin(), m_entry_names.cend(), [&username](const std::string& entry){ return entry == username; }))
|
||||
return;
|
||||
|
||||
const std::string current_selection = get_current_selection();
|
||||
m_entry_names.push_back(username);
|
||||
reload(current_selection);
|
||||
};
|
||||
|
||||
const auto remove_friend = [&]()
|
||||
{
|
||||
const auto it = std::find(m_entry_names.cbegin(), m_entry_names.cend(), username);
|
||||
if (it == m_entry_names.cend())
|
||||
return;
|
||||
|
||||
const std::string current_selection = get_current_selection();
|
||||
m_entry_names.erase(it);
|
||||
reload(current_selection);
|
||||
};
|
||||
|
||||
switch (ntype)
|
||||
{
|
||||
case rpcn::NotificationType::FriendQuery: // Other user sent a friend request
|
||||
break;
|
||||
case rpcn::NotificationType::FriendNew: // Add a friend to the friendlist(either accepted a friend request or friend accepted it)
|
||||
{
|
||||
if (status)
|
||||
{
|
||||
add_friend();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case rpcn::NotificationType::FriendLost: // Remove friend from the friendlist(user removed friend or friend removed friend)
|
||||
{
|
||||
remove_friend();
|
||||
break;
|
||||
}
|
||||
case rpcn::NotificationType::FriendStatus: // Set status of friend to Offline or Online
|
||||
{
|
||||
if (status)
|
||||
{
|
||||
add_friend();
|
||||
}
|
||||
else
|
||||
{
|
||||
remove_friend();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
rsx_log.fatal("An unhandled notification type was received by the sendmessage dialog callback!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace overlays
|
||||
} // namespace RSX
|
44
rpcs3/Emu/RSX/Overlays/Network/overlay_sendmessage_dialog.h
Normal file
44
rpcs3/Emu/RSX/Overlays/Network/overlay_sendmessage_dialog.h
Normal file
@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "../overlays.h"
|
||||
#include "../overlay_list_view.hpp"
|
||||
#include "Emu/Cell/ErrorCodes.h"
|
||||
#include "Emu/Cell/Modules/sceNp.h"
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
namespace overlays
|
||||
{
|
||||
struct sendmessage_dialog : public user_interface, public SendMessageDialogBase
|
||||
{
|
||||
private:
|
||||
struct list_entry : horizontal_layout
|
||||
{
|
||||
public:
|
||||
list_entry(const std::string& msg);
|
||||
};
|
||||
|
||||
shared_mutex m_mutex;
|
||||
std::vector<std::string> m_entry_names;
|
||||
std::unique_ptr<overlay_element> m_dim_background;
|
||||
std::unique_ptr<list_view> m_list;
|
||||
std::unique_ptr<label> m_description;
|
||||
|
||||
animation_color_interpolate fade_animation;
|
||||
|
||||
std::string get_current_selection() const;
|
||||
void reload(const std::string& previous_selection);
|
||||
|
||||
public:
|
||||
sendmessage_dialog();
|
||||
|
||||
void update() override;
|
||||
void on_button_pressed(pad_button button_press, bool is_auto_repeat) override;
|
||||
|
||||
compiled_resource get_compiled() override;
|
||||
|
||||
error_code Exec(message_data& msg_data, std::set<std::string>& npids) override;
|
||||
void callback_handler(u16 ntype, const std::string& username, bool status) override;
|
||||
};
|
||||
}
|
||||
}
|
@ -176,14 +176,6 @@ namespace rsx
|
||||
return m_selected_entry;
|
||||
}
|
||||
|
||||
std::u32string list_view::get_selected_item()
|
||||
{
|
||||
if (m_selected_entry < 0)
|
||||
return {};
|
||||
|
||||
return m_items[m_selected_entry]->text;
|
||||
}
|
||||
|
||||
void list_view::set_cancel_only(bool cancel_only)
|
||||
{
|
||||
if (cancel_only)
|
||||
|
@ -37,8 +37,6 @@ namespace rsx
|
||||
int get_selected_index() const;
|
||||
bool get_cancel_only() const;
|
||||
|
||||
std::u32string get_selected_item();
|
||||
|
||||
void set_cancel_only(bool cancel_only);
|
||||
void translate(s16 _x, s16 _y) override;
|
||||
|
||||
|
@ -140,6 +140,10 @@ enum class localized_string_id
|
||||
CELL_NP_RECVMESSAGE_DIALOG_TITLE_INVITE,
|
||||
CELL_NP_RECVMESSAGE_DIALOG_TITLE_ADD_FRIEND,
|
||||
|
||||
CELL_NP_SENDMESSAGE_DIALOG_TITLE,
|
||||
CELL_NP_SENDMESSAGE_DIALOG_TITLE_INVITE,
|
||||
CELL_NP_SENDMESSAGE_DIALOG_TITLE_ADD_FRIEND,
|
||||
|
||||
RECORDING_ABORTED,
|
||||
|
||||
RPCN_NO_ERROR,
|
||||
|
@ -100,6 +100,7 @@
|
||||
<ClCompile Include="Emu\RSX\Overlays\HomeMenu\overlay_home_menu_page.cpp" />
|
||||
<ClCompile Include="Emu\RSX\Overlays\HomeMenu\overlay_home_menu_settings.cpp" />
|
||||
<ClCompile Include="Emu\RSX\Overlays\Network\overlay_recvmessage_dialog.cpp" />
|
||||
<ClCompile Include="Emu\RSX\Overlays\Network\overlay_sendmessage_dialog.cpp" />
|
||||
<ClCompile Include="Emu\RSX\Overlays\overlay_animated_icon.cpp" />
|
||||
<ClCompile Include="Emu\RSX\Overlays\overlay_controls.cpp" />
|
||||
<ClCompile Include="Emu\RSX\Overlays\overlay_cursor.cpp" />
|
||||
@ -585,6 +586,7 @@
|
||||
<ClInclude Include="Emu\RSX\Overlays\HomeMenu\overlay_home_menu_page.h" />
|
||||
<ClInclude Include="Emu\RSX\Overlays\HomeMenu\overlay_home_menu_settings.h" />
|
||||
<ClInclude Include="Emu\RSX\Overlays\Network\overlay_recvmessage_dialog.h" />
|
||||
<ClInclude Include="Emu\RSX\Overlays\Network\overlay_sendmessage_dialog.h" />
|
||||
<ClInclude Include="Emu\RSX\Overlays\overlay_animated_icon.h" />
|
||||
<ClInclude Include="Emu\RSX\Overlays\overlay_cursor.h" />
|
||||
<ClInclude Include="Emu\RSX\Overlays\overlay_debug_overlay.h" />
|
||||
|
@ -1192,6 +1192,9 @@
|
||||
<ClCompile Include="Emu\RSX\Overlays\Network\overlay_recvmessage_dialog.cpp">
|
||||
<Filter>Emu\GPU\RSX\Overlays\Network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\RSX\Overlays\Network\overlay_sendmessage_dialog.cpp">
|
||||
<Filter>Emu\GPU\RSX\Overlays\Network</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Crypto\aes.h">
|
||||
@ -2416,6 +2419,9 @@
|
||||
<ClInclude Include="Emu\RSX\Overlays\Network\overlay_recvmessage_dialog.h">
|
||||
<Filter>Emu\GPU\RSX\Overlays\Network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\RSX\Overlays\Network\overlay_sendmessage_dialog.h">
|
||||
<Filter>Emu\GPU\RSX\Overlays\Network</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Emu\RSX\Program\GLSLSnippets\GPUDeswizzle.glsl">
|
||||
|
@ -160,9 +160,12 @@ 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_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_NP_RECVMESSAGE_DIALOG_TITLE: return tr("Choose Message");
|
||||
case localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_TITLE: return tr("Select Message");
|
||||
case localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_TITLE_INVITE: return tr("Select Invite");
|
||||
case localized_string_id::CELL_NP_RECVMESSAGE_DIALOG_TITLE_ADD_FRIEND: return tr("Add Friend");
|
||||
case localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_TITLE: return tr("Select Message To Send");
|
||||
case localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_TITLE_INVITE: return tr("Send Invite");
|
||||
case localized_string_id::CELL_NP_SENDMESSAGE_DIALOG_TITLE_ADD_FRIEND: return tr("Add Friend");
|
||||
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_ERROR_INVALID_INPUT: return tr("RPCN: Invalid Input (Wrong Host/Port)");
|
||||
|
@ -22,7 +22,7 @@ sendmessage_dialog_frame::~sendmessage_dialog_frame()
|
||||
}
|
||||
}
|
||||
|
||||
bool sendmessage_dialog_frame::Exec(message_data& msg_data, std::set<std::string>& npids)
|
||||
error_code sendmessage_dialog_frame::Exec(message_data& msg_data, std::set<std::string>& npids)
|
||||
{
|
||||
if (m_dialog)
|
||||
{
|
||||
@ -55,7 +55,7 @@ bool sendmessage_dialog_frame::Exec(message_data& msg_data, std::set<std::string
|
||||
connect(this, &sendmessage_dialog_frame::signal_add_friend, this, &sendmessage_dialog_frame::slot_add_friend);
|
||||
connect(this, &sendmessage_dialog_frame::signal_remove_friend, this, &sendmessage_dialog_frame::slot_remove_friend);
|
||||
|
||||
bool result = false;
|
||||
error_code result = CELL_CANCEL;
|
||||
|
||||
connect(btn_ok, &QAbstractButton::clicked, this, [this, &msg_data, &npids, &result]()
|
||||
{
|
||||
@ -70,7 +70,10 @@ bool sendmessage_dialog_frame::Exec(message_data& msg_data, std::set<std::string
|
||||
npids.insert(selected[0]->text().toStdString());
|
||||
|
||||
// Send the message
|
||||
result = m_rpcn->send_message(msg_data, npids);
|
||||
if (m_rpcn->send_message(msg_data, npids))
|
||||
{
|
||||
result = CELL_OK;
|
||||
}
|
||||
m_dialog->close();
|
||||
});
|
||||
|
||||
@ -123,7 +126,7 @@ void sendmessage_dialog_frame::slot_remove_friend(QString name)
|
||||
remove_friend(m_lst_friends, name);
|
||||
}
|
||||
|
||||
void sendmessage_dialog_frame::callback_handler(rpcn::NotificationType ntype, const std::string& username, bool status)
|
||||
void sendmessage_dialog_frame::callback_handler(u16 ntype, const std::string& username, bool status)
|
||||
{
|
||||
QString qtr_username = QString::fromStdString(username);
|
||||
switch (ntype)
|
||||
|
@ -14,8 +14,8 @@ class sendmessage_dialog_frame : public QObject, public SendMessageDialogBase
|
||||
public:
|
||||
sendmessage_dialog_frame() = default;
|
||||
~sendmessage_dialog_frame();
|
||||
bool Exec(message_data& msg_data, std::set<std::string>& npids) override;
|
||||
void callback_handler(rpcn::NotificationType ntype, const std::string& username, bool status);
|
||||
error_code Exec(message_data& msg_data, std::set<std::string>& npids) override;
|
||||
void callback_handler(u16 ntype, const std::string& username, bool status) override;
|
||||
|
||||
private:
|
||||
void add_friend(QListWidget* list, const QString& name);
|
||||
@ -25,8 +25,6 @@ private:
|
||||
custom_dialog* m_dialog = nullptr;
|
||||
QListWidget* m_lst_friends = nullptr;
|
||||
|
||||
std::shared_ptr<rpcn::rpcn_client> m_rpcn;
|
||||
|
||||
Q_SIGNALS:
|
||||
void signal_add_friend(QString name);
|
||||
void signal_remove_friend(QString name);
|
||||
|
Loading…
x
Reference in New Issue
Block a user