Qt: Add per-game link to PCSX2 Wiki pages on right-click

This commit is contained in:
TheTechnician27 2024-07-19 17:52:46 -05:00 committed by Ty
parent 06bc0300c0
commit 3a72328d55
5 changed files with 38 additions and 5 deletions

View File

@ -1356,6 +1356,11 @@ void MainWindow::onGameListEntryContextMenuRequested(const QPoint& point)
connect(menu.addAction(tr("Reset Play Time")), &QAction::triggered, [this, entry]() { clearGameListEntryPlayTime(entry); });
if (!entry->serial.empty())
{
connect(menu.addAction(tr("Check Wiki Page")), &QAction::triggered, [this, entry]() { goToWikiPage(entry); });
}
menu.addSeparator();
if (!s_vm_valid)
@ -2719,6 +2724,11 @@ void MainWindow::clearGameListEntryPlayTime(const GameList::Entry* entry)
m_game_list_widget->refresh(false);
}
void MainWindow::goToWikiPage(const GameList::Entry* entry)
{
QtUtils::OpenURL(this, fmt::format("https://wiki.pcsx2.net/{}", entry->serial).c_str());
}
std::optional<bool> MainWindow::promptForResumeState(const QString& save_state_path)
{
if (save_state_path.isEmpty())

View File

@ -267,6 +267,7 @@ private:
const GameList::Entry* entry, std::optional<s32> save_slot = std::nullopt, std::optional<bool> fast_boot = std::nullopt);
void setGameListEntryCoverImage(const GameList::Entry* entry);
void clearGameListEntryPlayTime(const GameList::Entry* entry);
void goToWikiPage(const GameList::Entry* entry);
std::optional<bool> promptForResumeState(const QString& save_state_path);
void loadSaveStateSlot(s32 slot);

View File

@ -49,11 +49,13 @@ GameSummaryWidget::GameSummaryWidget(const GameList::Entry* entry, SettingsWindo
connect(m_ui.inputProfile, &QComboBox::currentIndexChanged, this, &GameSummaryWidget::onInputProfileChanged);
connect(m_ui.verify, &QAbstractButton::clicked, this, &GameSummaryWidget::onVerifyClicked);
connect(m_ui.searchHash, &QAbstractButton::clicked, this, &GameSummaryWidget::onSearchHashClicked);
connect(m_ui.checkWiki, &QAbstractButton::clicked, this, [this, entry]() { onCheckWikiClicked(entry); });
bool has_custom_title = false, has_custom_region = false;
GameList::CheckCustomAttributesForPath(m_entry_path, has_custom_title, has_custom_region);
m_ui.restoreTitle->setEnabled(has_custom_title);
m_ui.restoreRegion->setEnabled(has_custom_region);
m_ui.checkWiki->setEnabled(!entry->serial.empty());
}
GameSummaryWidget::~GameSummaryWidget() = default;
@ -348,6 +350,11 @@ void GameSummaryWidget::onSearchHashClicked()
QtUtils::OpenURL(this, fmt::format("http://redump.org/discs/quicksearch/{}", m_redump_search_keyword).c_str());
}
void GameSummaryWidget::onCheckWikiClicked(const GameList::Entry* entry)
{
QtUtils::OpenURL(this, fmt::format("https://wiki.pcsx2.net/{}", entry->serial).c_str());
}
void GameSummaryWidget::setVerifyResult(QString error)
{
m_ui.verify->setVisible(false);

View File

@ -28,6 +28,7 @@ private Q_SLOTS:
void onDiscPathBrowseClicked();
void onVerifyClicked();
void onSearchHashClicked();
void onCheckWikiClicked(const GameList::Entry* entry);
private:
void populateInputProfiles();

View File

@ -104,11 +104,25 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="serial">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QLineEdit" name="serial">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="checkWiki">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Check Wiki</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_36">