Skip to content

Commit

Permalink
Qt: Add per-game link to PCSX2 Wiki pages on right-click
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechnician27 authored and F0bes committed Jul 23, 2024
1 parent 06bc030 commit 3a72328
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 5 deletions.
10 changes: 10 additions & 0 deletions pcsx2-qt/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions pcsx2-qt/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ private Q_SLOTS:
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);
Expand Down
7 changes: 7 additions & 0 deletions pcsx2-qt/Settings/GameSummaryWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions pcsx2-qt/Settings/GameSummaryWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ private Q_SLOTS:
void onDiscPathBrowseClicked();
void onVerifyClicked();
void onSearchHashClicked();
void onCheckWikiClicked(const GameList::Entry* entry);

private:
void populateInputProfiles();
Expand Down
24 changes: 19 additions & 5 deletions pcsx2-qt/Settings/GameSummaryWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit 3a72328

Please sign in to comment.