Permalink
Browse files

Qt: Remove ActionHelper

  • Loading branch information...
spycrab committed Jul 9, 2018
1 parent 4266d1f commit a22ffb6387d9500283baf0079c55e8a6623b3f5f
@@ -33,7 +33,6 @@
#include "DolphinQt/Config/ARCodeWidget.h"
#include "DolphinQt/Config/GeckoCodeWidget.h"
#include "DolphinQt/GameList/GameListModel.h"
#include "DolphinQt/QtUtils/ActionHelper.h"
#include "DolphinQt/Settings.h"
constexpr u32 MAX_RESULTS = 50;
@@ -132,7 +131,7 @@ void CheatsManager::OnWatchContextMenu()
QMenu* menu = new QMenu(this);
AddAction(menu, tr("Remove from Watch"), this, [this] {
menu->addAction(tr("Remove from Watch"), this, [this] {
auto* item = m_match_table->selectedItems()[0];
int index = item->data(INDEX_ROLE).toInt();
@@ -144,7 +143,7 @@ void CheatsManager::OnWatchContextMenu()
menu->addSeparator();
AddAction(menu, tr("Generate Action Replay Code"), this, &CheatsManager::GenerateARCode);
menu->addAction(tr("Generate Action Replay Code"), this, &CheatsManager::GenerateARCode);
menu->exec(QCursor::pos());
}
@@ -156,7 +155,7 @@ void CheatsManager::OnMatchContextMenu()
QMenu* menu = new QMenu(this);
AddAction(menu, tr("Add to Watch"), this, [this] {
menu->addAction(tr("Add to Watch"), this, [this] {
auto* item = m_match_table->selectedItems()[0];
int index = item->data(INDEX_ROLE).toInt();
@@ -23,7 +23,6 @@
#include "DiscIO/Filesystem.h"
#include "DiscIO/Volume.h"
#include "DolphinQt/QtUtils/ActionHelper.h"
#include "DolphinQt/Resources.h"
#include "UICommon/UICommon.h"
@@ -180,7 +179,7 @@ void FilesystemWidget::ShowContextMenu(const QPoint&)
if (type == EntryType::Dir || is_filesystem_root)
{
AddAction(menu, tr("Extract Files..."), this, [this, partition, path] {
menu->addAction(tr("Extract Files..."), this, [this, partition, path] {
auto folder = SelectFolder();
if (!folder.isEmpty())
@@ -190,7 +189,7 @@ void FilesystemWidget::ShowContextMenu(const QPoint&)
if (is_filesystem_root)
{
AddAction(menu, tr("Extract System Data..."), this, [this, partition] {
menu->addAction(tr("Extract System Data..."), this, [this, partition] {
auto folder = SelectFolder();
if (folder.isEmpty())
@@ -206,7 +205,7 @@ void FilesystemWidget::ShowContextMenu(const QPoint&)
switch (type)
{
case EntryType::Disc:
AddAction(menu, tr("Extract Entire Disc..."), this, [this, path] {
menu->addAction(tr("Extract Entire Disc..."), this, [this, path] {
auto folder = SelectFolder();
if (folder.isEmpty())
@@ -231,20 +230,20 @@ void FilesystemWidget::ShowContextMenu(const QPoint&)
});
break;
case EntryType::Partition:
AddAction(menu, tr("Extract Entire Partition..."), this, [this, partition] {
menu->addAction(tr("Extract Entire Partition..."), this, [this, partition] {
auto folder = SelectFolder();
if (!folder.isEmpty())
ExtractPartition(partition, folder);
});
if (m_volume->IsEncryptedAndHashed())
{
menu->addSeparator();
AddAction(menu, tr("Check Partition Integrity"), this,
[this, partition] { CheckIntegrity(partition); });
menu->addAction(tr("Check Partition Integrity"), this,
[this, partition] { CheckIntegrity(partition); });
}
break;
case EntryType::File:
AddAction(menu, tr("Extract File..."), this, [this, partition, path] {
menu->addAction(tr("Extract File..."), this, [this, partition, path] {
auto dest =
QFileDialog::getSaveFileName(this, tr("Save File to"), QFileInfo(path).fileName());
@@ -18,7 +18,6 @@
#include "Core/PowerPC/PowerPC.h"
#include "DolphinQt/Debugger/NewBreakpointDialog.h"
#include "DolphinQt/QtUtils/ActionHelper.h"
#include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h"
@@ -102,12 +101,12 @@ void BreakpointWidget::CreateWidgets()
layout->addWidget(m_toolbar);
layout->addWidget(m_table);
m_new = AddAction(m_toolbar, tr("New"), this, &BreakpointWidget::OnNewBreakpoint);
m_delete = AddAction(m_toolbar, tr("Delete"), this, &BreakpointWidget::OnDelete);
m_clear = AddAction(m_toolbar, tr("Clear"), this, &BreakpointWidget::OnClear);
m_new = m_toolbar->addAction(tr("New"), this, &BreakpointWidget::OnNewBreakpoint);
m_delete = m_toolbar->addAction(tr("Delete"), this, &BreakpointWidget::OnDelete);
m_clear = m_toolbar->addAction(tr("Clear"), this, &BreakpointWidget::OnClear);
m_load = AddAction(m_toolbar, tr("Load"), this, &BreakpointWidget::OnLoad);
m_save = AddAction(m_toolbar, tr("Save"), this, &BreakpointWidget::OnSave);
m_load = m_toolbar->addAction(tr("Load"), this, &BreakpointWidget::OnLoad);
m_save = m_toolbar->addAction(tr("Save"), this, &BreakpointWidget::OnSave);
m_new->setEnabled(false);
m_load->setEnabled(false);
@@ -26,7 +26,6 @@
#include "Core/PowerPC/PPCAnalyst.h"
#include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/PowerPC.h"
#include "DolphinQt/QtUtils/ActionHelper.h"
#include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h"
@@ -215,36 +214,36 @@ void CodeViewWidget::OnContextMenu()
bool has_symbol = g_symbolDB.GetSymbolFromAddr(addr);
auto* follow_branch_action =
AddAction(menu, tr("Follow &branch"), this, &CodeViewWidget::OnFollowBranch);
menu->addAction(tr("Follow &branch"), this, &CodeViewWidget::OnFollowBranch);
menu->addSeparator();
AddAction(menu, tr("&Copy address"), this, &CodeViewWidget::OnCopyAddress);
menu->addAction(tr("&Copy address"), this, &CodeViewWidget::OnCopyAddress);
auto* copy_address_action =
AddAction(menu, tr("Copy &function"), this, &CodeViewWidget::OnCopyFunction);
menu->addAction(tr("Copy &function"), this, &CodeViewWidget::OnCopyFunction);
auto* copy_line_action =
AddAction(menu, tr("Copy code &line"), this, &CodeViewWidget::OnCopyCode);
auto* copy_hex_action = AddAction(menu, tr("Copy &hex"), this, &CodeViewWidget::OnCopyHex);
menu->addAction(tr("Copy code &line"), this, &CodeViewWidget::OnCopyCode);
auto* copy_hex_action = menu->addAction(tr("Copy &hex"), this, &CodeViewWidget::OnCopyHex);
menu->addSeparator();
auto* symbol_rename_action =
AddAction(menu, tr("&Rename symbol"), this, &CodeViewWidget::OnRenameSymbol);
menu->addAction(tr("&Rename symbol"), this, &CodeViewWidget::OnRenameSymbol);
auto* symbol_size_action =
AddAction(menu, tr("Set symbol &size"), this, &CodeViewWidget::OnSetSymbolSize);
menu->addAction(tr("Set symbol &size"), this, &CodeViewWidget::OnSetSymbolSize);
auto* symbol_end_action =
AddAction(menu, tr("Set symbol &end address"), this, &CodeViewWidget::OnSetSymbolEndAddress);
menu->addAction(tr("Set symbol &end address"), this, &CodeViewWidget::OnSetSymbolEndAddress);
menu->addSeparator();
AddAction(menu, tr("Run &To Here"), this, &CodeViewWidget::OnRunToHere);
menu->addAction(tr("Run &To Here"), this, &CodeViewWidget::OnRunToHere);
auto* function_action =
AddAction(menu, tr("&Add function"), this, &CodeViewWidget::OnAddFunction);
auto* ppc_action = AddAction(menu, tr("PPC vs Host"), this, &CodeViewWidget::OnPPCComparison);
auto* insert_blr_action = AddAction(menu, tr("&Insert blr"), this, &CodeViewWidget::OnInsertBLR);
auto* insert_nop_action = AddAction(menu, tr("Insert &nop"), this, &CodeViewWidget::OnInsertNOP);
menu->addAction(tr("&Add function"), this, &CodeViewWidget::OnAddFunction);
auto* ppc_action = menu->addAction(tr("PPC vs Host"), this, &CodeViewWidget::OnPPCComparison);
auto* insert_blr_action = menu->addAction(tr("&Insert blr"), this, &CodeViewWidget::OnInsertBLR);
auto* insert_nop_action = menu->addAction(tr("Insert &nop"), this, &CodeViewWidget::OnInsertNOP);
auto* replace_action =
AddAction(menu, tr("Re&place instruction"), this, &CodeViewWidget::OnReplaceInstruction);
menu->addAction(tr("Re&place instruction"), this, &CodeViewWidget::OnReplaceInstruction);
auto* restore_action =
AddAction(menu, tr("Restore instruction"), this, &CodeViewWidget::OnRestoreInstruction);
menu->addAction(tr("Restore instruction"), this, &CodeViewWidget::OnRestoreInstruction);
follow_branch_action->setEnabled(running && GetBranchFromAddress(addr));
@@ -19,7 +19,6 @@
#include "Core/PowerPC/MMU.h"
#include "Core/PowerPC/PowerPC.h"
#include "DolphinQt/QtUtils/ActionHelper.h"
#include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h"
@@ -351,16 +350,16 @@ void MemoryViewWidget::OnContextMenu()
{
auto* menu = new QMenu(this);
AddAction(menu, tr("Copy Address"), this, &MemoryViewWidget::OnCopyAddress);
menu->addAction(tr("Copy Address"), this, &MemoryViewWidget::OnCopyAddress);
auto* copy_hex = AddAction(menu, tr("Copy Hex"), this, &MemoryViewWidget::OnCopyHex);
auto* copy_hex = menu->addAction(tr("Copy Hex"), this, &MemoryViewWidget::OnCopyHex);
copy_hex->setEnabled(Core::GetState() != Core::State::Uninitialized &&
PowerPC::HostIsRAMAddress(GetContextAddress()));
menu->addSeparator();
AddAction(menu, tr("Toggle Breakpoint"), this, &MemoryViewWidget::ToggleBreakpoint);
menu->addAction(tr("Toggle Breakpoint"), this, &MemoryViewWidget::ToggleBreakpoint);
menu->exec(QCursor::pos());
}
@@ -15,7 +15,6 @@
#include "Core/HW/ProcessorInterface.h"
#include "Core/PowerPC/PowerPC.h"
#include "DolphinQt/Host.h"
#include "DolphinQt/QtUtils/ActionHelper.h"
#include "DolphinQt/Settings.h"
RegisterWidget::RegisterWidget(QWidget* parent) : QDockWidget(parent)
@@ -118,8 +117,8 @@ void RegisterWidget::ShowContextMenu()
auto type = static_cast<RegisterType>(item->data(DATA_TYPE).toInt());
auto display = item->GetDisplay();
AddAction(menu, tr("Add to &watch"), this,
[this, item] { emit RequestMemoryBreakpoint(item->GetValue()); });
menu->addAction(tr("Add to &watch"), this,
[this, item] { emit RequestMemoryBreakpoint(item->GetValue()); });
menu->addAction(tr("View &memory"));
menu->addAction(tr("View &code"));
@@ -211,7 +210,7 @@ void RegisterWidget::ShowContextMenu()
menu->addSeparator();
}
AddAction(menu, tr("Update"), this, [this] { emit RequestTableUpdate(); });
menu->addAction(tr("Update"), this, [this] { emit RequestTableUpdate(); });
menu->exec(QCursor::pos());
}
@@ -11,7 +11,6 @@
#include "Core/PowerPC/MMU.h"
#include "Core/PowerPC/PowerPC.h"
#include "DolphinQt/QtUtils/ActionHelper.h"
#include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h"
@@ -84,8 +83,8 @@ void WatchWidget::CreateWidgets()
m_table->setContextMenuPolicy(Qt::CustomContextMenu);
m_table->setSelectionMode(QAbstractItemView::SingleSelection);
m_load = AddAction(m_toolbar, tr("Load"), this, &WatchWidget::OnLoad);
m_save = AddAction(m_toolbar, tr("Save"), this, &WatchWidget::OnSave);
m_load = m_toolbar->addAction(tr("Load"), this, &WatchWidget::OnLoad);
m_save = m_toolbar->addAction(tr("Save"), this, &WatchWidget::OnSave);
m_load->setEnabled(false);
m_save->setEnabled(false);
@@ -238,16 +237,16 @@ void WatchWidget::ShowContextMenu()
{
// i18n: This kind of "watch" is used for watching emulated memory.
// It's not related to timekeeping devices.
AddAction(menu, tr("&Delete Watch"), this, [this, row] { DeleteWatch(row); });
AddAction(menu, tr("&Add Memory Breakpoint"), this,
[this, row] { AddWatchBreakpoint(row); });
menu->addAction(tr("&Delete Watch"), this, [this, row] { DeleteWatch(row); });
menu->addAction(tr("&Add Memory Breakpoint"), this,
[this, row] { AddWatchBreakpoint(row); });
}
}
}
menu->addSeparator();
AddAction(menu, tr("Update"), this, &WatchWidget::Update);
menu->addAction(tr("Update"), this, &WatchWidget::Update);
menu->exec(QCursor::pos());
}
@@ -36,7 +36,6 @@
#include "DolphinQt/Config/PropertiesDialog.h"
#include "DolphinQt/GameList/GridProxyModel.h"
#include "DolphinQt/GameList/ListProxyModel.h"
#include "DolphinQt/QtUtils/ActionHelper.h"
#include "DolphinQt/QtUtils/DoubleClickEventFilter.h"
#include "DolphinQt/Resources.h"
#include "DolphinQt/Settings.h"
@@ -227,19 +226,19 @@ void GameList::ShowContextMenu(const QPoint&)
}
if (compress)
AddAction(menu, tr("Compress selected ISOs..."), this, [this] { CompressISO(false); });
menu->addAction(tr("Compress selected ISOs..."), this, [this] { CompressISO(false); });
if (decompress)
AddAction(menu, tr("Decompress selected ISOs..."), this, [this] { CompressISO(true); });
menu->addAction(tr("Decompress selected ISOs..."), this, [this] { CompressISO(true); });
if (compress || decompress)
menu->addSeparator();
if (wii_saves)
{
AddAction(menu, tr("Export Wii saves (Experimental)"), this, &GameList::ExportWiiSave);
menu->addAction(tr("Export Wii saves (Experimental)"), this, &GameList::ExportWiiSave);
menu->addSeparator();
}
AddAction(menu, tr("Delete selected files..."), this, &GameList::DeleteFile);
menu->addAction(tr("Delete selected files..."), this, &GameList::DeleteFile);
}
else
{
@@ -248,23 +247,23 @@ void GameList::ShowContextMenu(const QPoint&)
if (platform != DiscIO::Platform::ELFOrDOL)
{
AddAction(menu, tr("&Properties"), this, &GameList::OpenProperties);
AddAction(menu, tr("&Wiki"), this, &GameList::OpenWiki);
menu->addAction(tr("&Properties"), this, &GameList::OpenProperties);
menu->addAction(tr("&Wiki"), this, &GameList::OpenWiki);
menu->addSeparator();
}
if (platform == DiscIO::Platform::GameCubeDisc || platform == DiscIO::Platform::WiiDisc)
{
AddAction(menu, tr("Set as &default ISO"), this, &GameList::SetDefaultISO);
menu->addAction(tr("Set as &default ISO"), this, &GameList::SetDefaultISO);
const auto blob_type = game->GetBlobType();
if (blob_type == DiscIO::BlobType::GCZ)
AddAction(menu, tr("Decompress ISO..."), this, [this] { CompressISO(true); });
menu->addAction(tr("Decompress ISO..."), this, [this] { CompressISO(true); });
else if (blob_type == DiscIO::BlobType::PLAIN)
AddAction(menu, tr("Compress ISO..."), this, [this] { CompressISO(false); });
menu->addAction(tr("Compress ISO..."), this, [this] { CompressISO(false); });
QAction* change_disc = AddAction(menu, tr("Change &Disc"), this, &GameList::ChangeDisc);
QAction* change_disc = menu->addAction(tr("Change &Disc"), this, &GameList::ChangeDisc);
connect(&Settings::Instance(), &Settings::EmulationStateChanged, change_disc,
[change_disc] { change_disc->setEnabled(Core::IsRunning()); });
@@ -275,7 +274,7 @@ void GameList::ShowContextMenu(const QPoint&)
if (platform == DiscIO::Platform::WiiDisc)
{
auto* perform_disc_update = AddAction(menu, tr("Perform System Update"), this, [this] {
auto* perform_disc_update = menu->addAction(tr("Perform System Update"), this, [this] {
WiiUpdate::PerformDiscUpdate(GetSelectedGame()->GetFilePath(), this);
});
perform_disc_update->setEnabled(!Core::IsRunning() || !SConfig::GetInstance().bWii);
@@ -309,13 +308,13 @@ void GameList::ShowContextMenu(const QPoint&)
if (platform == DiscIO::Platform::WiiWAD || platform == DiscIO::Platform::WiiDisc)
{
AddAction(menu, tr("Open Wii &save folder"), this, &GameList::OpenSaveFolder);
AddAction(menu, tr("Export Wii save (Experimental)"), this, &GameList::ExportWiiSave);
menu->addAction(tr("Open Wii &save folder"), this, &GameList::OpenSaveFolder);
menu->addAction(tr("Export Wii save (Experimental)"), this, &GameList::ExportWiiSave);
menu->addSeparator();
}
AddAction(menu, tr("Open &containing folder"), this, &GameList::OpenContainingFolder);
AddAction(menu, tr("Delete File..."), this, &GameList::DeleteFile);
menu->addAction(tr("Open &containing folder"), this, &GameList::OpenContainingFolder);
menu->addAction(tr("Delete File..."), this, &GameList::DeleteFile);
QAction* netplay_host = new QAction(tr("Host with NetPlay"), menu);
Oops, something went wrong.

0 comments on commit a22ffb6

Please sign in to comment.