mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 21:32:50 +00:00
Review fixes
This commit is contained in:
parent
c589001dff
commit
319657e815
@ -1358,17 +1358,10 @@ namespace np
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::string communication_id_str = std::string(basic_handler.context.data);
|
const std::string communication_id_str = std::string(basic_handler.context.data);
|
||||||
u32 count = 0;
|
return std::count_if(players_history.begin(), players_history.end(), [&](const auto& entry)
|
||||||
|
|
||||||
for (auto it = players_history.begin(); it != players_history.end(); it++)
|
|
||||||
{
|
|
||||||
if (it->second.communication_ids.contains(communication_id_str))
|
|
||||||
{
|
{
|
||||||
count++;
|
return entry.second.communication_ids.contains(communication_id_str);
|
||||||
}
|
});
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool np_handler::get_player_history_entry(u32 options, u32 index, SceNpId* npid)
|
bool np_handler::get_player_history_entry(u32 options, u32 index, SceNpId* npid)
|
||||||
@ -1392,6 +1385,7 @@ namespace np
|
|||||||
{
|
{
|
||||||
const std::string communication_id_str = std::string(basic_handler.context.data);
|
const std::string communication_id_str = std::string(basic_handler.context.data);
|
||||||
|
|
||||||
|
// Get the nth element that contains the current communication_id
|
||||||
for (auto it = players_history.begin(); it != players_history.end(); it++)
|
for (auto it = players_history.begin(); it != players_history.end(); it++)
|
||||||
{
|
{
|
||||||
if (it->second.communication_ids.contains(communication_id_str))
|
if (it->second.communication_ids.contains(communication_id_str))
|
||||||
|
@ -42,7 +42,7 @@ namespace np
|
|||||||
|
|
||||||
struct player_history
|
struct player_history
|
||||||
{
|
{
|
||||||
u64 timestamp;
|
u64 timestamp{};
|
||||||
std::set<std::string> communication_ids;
|
std::set<std::string> communication_ids;
|
||||||
std::string description;
|
std::string description;
|
||||||
};
|
};
|
||||||
|
@ -1200,7 +1200,7 @@ namespace rpcn
|
|||||||
vec_stream reply(packet_data);
|
vec_stream reply(packet_data);
|
||||||
auto error = static_cast<ErrorType>(reply.get<u8>());
|
auto error = static_cast<ErrorType>(reply.get<u8>());
|
||||||
|
|
||||||
if (error == ErrorType::NotFound)
|
if (is_error(error))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -889,7 +889,7 @@ namespace np
|
|||||||
{
|
{
|
||||||
struct player_history
|
struct player_history
|
||||||
{
|
{
|
||||||
u64 timestamp;
|
u64 timestamp{};
|
||||||
std::set<std::string> communication_ids;
|
std::set<std::string> communication_ids;
|
||||||
std::string description;
|
std::string description;
|
||||||
};
|
};
|
||||||
@ -1012,17 +1012,23 @@ rpcn_friends_dialog::rpcn_friends_dialog(QWidget* parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto history = np::load_players_history();
|
auto history = np::load_players_history();
|
||||||
std::map<u64, std::string, std::greater<u64>> sorted_history;
|
std::map<u64, std::pair<std::string, std::string>, std::greater<u64>> sorted_history;
|
||||||
|
|
||||||
for (const auto& [username, user_info] : history)
|
for (const auto& [username, user_info] : history)
|
||||||
{
|
{
|
||||||
if (!data.friends.contains(username) && !data.requests_sent.contains(username) && !data.requests_received.contains(username))
|
if (!data.friends.contains(username) && !data.requests_sent.contains(username) && !data.requests_received.contains(username))
|
||||||
sorted_history.insert(std::make_pair(user_info.timestamp, std::move(username)));
|
sorted_history.insert(std::make_pair(user_info.timestamp, std::make_pair(std::move(username), std::move(user_info.description))));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& [_, username] : sorted_history)
|
for (const auto& [_, username_and_description] : sorted_history)
|
||||||
{
|
{
|
||||||
m_lst_history->addItem(new QListWidgetItem(QString::fromStdString(username)));
|
const auto& [username, description] = username_and_description;
|
||||||
|
auto* item = new QListWidgetItem(QString::fromStdString(username));
|
||||||
|
|
||||||
|
if (!description.empty())
|
||||||
|
item->setToolTip(QString::fromStdString(description));
|
||||||
|
|
||||||
|
m_lst_history->addItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(this, &rpcn_friends_dialog::signal_add_update_friend, this, &rpcn_friends_dialog::add_update_friend);
|
connect(this, &rpcn_friends_dialog::signal_add_update_friend, this, &rpcn_friends_dialog::add_update_friend);
|
||||||
@ -1113,13 +1119,12 @@ rpcn_friends_dialog::rpcn_friends_dialog(QWidget* parent)
|
|||||||
if (!m_rpcn->add_friend(str_sel_friend))
|
if (!m_rpcn->add_friend(str_sel_friend))
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Error sending a friend request!"), tr("An error occurred while trying to send a friend request!"), QMessageBox::Ok);
|
QMessageBox::critical(this, tr("Error sending a friend request!"), tr("An error occurred while trying to send a friend request!"), QMessageBox::Ok);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
QString qstr_friend = QString::fromStdString(str_sel_friend);
|
||||||
QString qstr_friend = QString::fromStdString(str_sel_friend);
|
add_update_list(m_lst_requests, qstr_friend, m_orange_icon, QVariant(false));
|
||||||
add_update_list(m_lst_requests, qstr_friend, m_orange_icon, QVariant(false));
|
remove_list(m_lst_history, qstr_friend);
|
||||||
remove_list(m_lst_history, qstr_friend);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
context_menu->exec(m_lst_history->viewport()->mapToGlobal(pos));
|
context_menu->exec(m_lst_history->viewport()->mapToGlobal(pos));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user