diff --git a/rpcs3/rpcs3qt/trophy_manager_dialog.cpp b/rpcs3/rpcs3qt/trophy_manager_dialog.cpp index 4721c7e00f..073eafaa7f 100644 --- a/rpcs3/rpcs3qt/trophy_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/trophy_manager_dialog.cpp @@ -14,6 +14,8 @@ #include "Emu/system_utils.hpp" #include "Emu/Cell/Modules/sceNpTrophy.h" +#include +#include #include #include #include @@ -714,14 +716,15 @@ void trophy_manager_dialog::ApplyFilter() void trophy_manager_dialog::ShowContextMenu(const QPoint& pos) { - QTableWidgetItem* item = m_trophy_table->item(m_trophy_table->currentRow(), TrophyColumns::Icon); - if (!item) + const int row = m_trophy_table->currentRow(); + + if (!m_trophy_table->item(row, TrophyColumns::Icon)) { return; } QMenu* menu = new QMenu(); - QAction* show_trophy_dir = new QAction(tr("Open Trophy Directory"), menu); + QAction* show_trophy_dir = new QAction(tr("&Open Trophy Directory"), menu); const int db_ind = m_game_combo->currentData().toInt(); @@ -732,6 +735,50 @@ void trophy_manager_dialog::ShowContextMenu(const QPoint& pos) }); menu->addAction(show_trophy_dir); + + const QTableWidgetItem* name_item = m_trophy_table->item(row, TrophyColumns::Name); + const QTableWidgetItem* desc_item = m_trophy_table->item(row, TrophyColumns::Description); + + const QString name = name_item ? name_item->text() : ""; + const QString desc = desc_item ? desc_item->text() : ""; + + if (!name.isEmpty() || !desc.isEmpty()) + { + QMenu* copy_menu = new QMenu(tr("&Copy Info"), menu); + + if (!name.isEmpty() && !desc.isEmpty()) + { + QAction* copy_both = new QAction(tr("&Copy Name + Description"), copy_menu); + connect(copy_both, &QAction::triggered, this, [this, name, desc]() + { + QApplication::clipboard()->setText(name % QStringLiteral("\n\n") % desc); + }); + copy_menu->addAction(copy_both); + } + + if (!name.isEmpty()) + { + QAction* copy_name = new QAction(tr("&Copy Name"), copy_menu); + connect(copy_name, &QAction::triggered, this, [this, name]() + { + QApplication::clipboard()->setText(name); + }); + copy_menu->addAction(copy_name); + } + + if (!desc.isEmpty()) + { + QAction* copy_desc = new QAction(tr("&Copy Description"), copy_menu); + connect(copy_desc, &QAction::triggered, this, [this, desc]() + { + QApplication::clipboard()->setText(desc); + }); + copy_menu->addAction(copy_desc); + } + + menu->addMenu(copy_menu); + } + menu->exec(m_trophy_table->viewport()->mapToGlobal(pos)); }