From ac3953030df11f8c9356fa8998c795608f3180e0 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Mon, 23 Oct 2017 16:09:27 -0500 Subject: Fix the nexus description link handler --- src/CMakeLists.txt | 1 + src/descriptionpage.h | 28 ++++++++++ src/modinfodialog.cpp | 14 +++-- src/organizer_en.ts | 147 ++++++++++++++++++++++++++------------------------ 4 files changed, 117 insertions(+), 73 deletions(-) create mode 100644 src/descriptionpage.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 833f7504..d5ebf6ae 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -171,6 +171,7 @@ SET(organizer_HDRS instancemanager.h usvfsconnector.h eventfilter.h + descriptionpage.h shared/windows_error.h shared/error_report.h diff --git a/src/descriptionpage.h b/src/descriptionpage.h new file mode 100644 index 00000000..f6158ee0 --- /dev/null +++ b/src/descriptionpage.h @@ -0,0 +1,28 @@ +#include + +#ifndef DESCRIPTIONPAGE_H +#define DESCRIPTIONPAGE_H + +class DescriptionPage : public QWebEnginePage +{ + Q_OBJECT + +public: + DescriptionPage(QObject* parent = 0) : QWebEnginePage(parent){} + + bool acceptNavigationRequest(const QUrl & url, QWebEnginePage::NavigationType type, bool isMainFrame) + { + if (type == QWebEnginePage::NavigationTypeLinkClicked) + { + emit linkClicked(url); + return false; + } + return true; + } + +signals: + void linkClicked(const QUrl&); + +}; + +#endif //DESCRIPTIONPAGE_H diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp index c96c2b4a..c586c6b6 100644 --- a/src/modinfodialog.cpp +++ b/src/modinfodialog.cpp @@ -19,6 +19,7 @@ along with Mod Organizer. If not, see . #include "modinfodialog.h" #include "ui_modinfodialog.h" +#include "descriptionpage.h" #include "iplugingame.h" #include "nexusinterface.h" @@ -38,6 +39,7 @@ along with Mod Organizer. If not, see . #include #include #include +#include #include @@ -85,10 +87,12 @@ ModInfoDialog::ModInfoDialog(ModInfo::Ptr modInfo, const DirectoryEntry *directo ui->notesEdit->setText(modInfo->notes()); + ui->descriptionView->setPage(new DescriptionPage); + connect(&m_ThumbnailMapper, SIGNAL(mapped(const QString&)), this, SIGNAL(thumbnailClickedSignal(const QString&))); connect(this, SIGNAL(thumbnailClickedSignal(const QString&)), this, SLOT(thumbnailClicked(const QString&))); connect(m_ModInfo.data(), SIGNAL(modDetailsUpdated(bool)), this, SLOT(modDetailsUpdated(bool))); - connect(ui->descriptionView, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClicked(QUrl))); + connect(ui->descriptionView->page(), SIGNAL(linkClicked(QUrl)), this, SLOT(linkClicked(QUrl))); //TODO: No easy way to delegate links //ui->descriptionView->page()->acceptNavigationRequest(QWebEnginePage::DelegateAllLinks); @@ -826,11 +830,13 @@ void ModInfoDialog::modDetailsUpdated(bool success) "%1" "").arg(BBCode::convertToHTML(nexusDescription)); + ui->descriptionView->page()->setHtml(descriptionAsHTML); + // QString descriptionAsHTML = BBCode::convertToHTML(result["description"].toString()); - ui->descriptionView->setHtml(descriptionAsHTML); + // ui->descriptionView->setHtml(descriptionAsHTML); } else { // ui->descriptionView->setHtml(result["summary"].toString().append(QString("\r\n") + tr("(description incomplete, please visit nexus)"))); - ui->descriptionView->setHtml(tr("(description incomplete, please visit nexus)")); + ui->descriptionView->page()->setHtml(tr("(description incomplete, please visit nexus)")); } updateVersionColor(); @@ -876,7 +882,7 @@ void ModInfoDialog::on_modIDEdit_editingFinished() if (oldID != modID){ m_ModInfo->setNexusID(modID); - ui->descriptionView->setHtml(""); + ui->descriptionView->page()->setHtml(""); if (modID != 0) { m_RequestStarted = false; refreshNexusData(modID); diff --git a/src/organizer_en.ts b/src/organizer_en.ts index 535c16a5..15785d1f 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -2989,227 +2989,227 @@ p, li { white-space: pre-wrap; } - + &Delete - + &Rename - + &Hide - + &Unhide - + &Open - + &New Folder - - + + Save changes? - - + + Save changes to "%1"? - + File Exists - + A file with that name exists, please enter a new one - + failed to move file - + failed to create directory "optional" - - + + Info requested, please wait - + Main - + Update - + Optional - + Old - + Misc - + Unknown - + Current Version: %1 - + No update available - + (description incomplete, please visit nexus) - + <a href="%1">Visit on Nexus</a> - + Failed to delete %1 - - + + Confirm - + Are sure you want to delete "%1"? - + Are sure you want to delete the selected files? - - + + New Folder - + Failed to create "%1" - - + + Replace file? - + There already is a hidden version of this file. Replace it? - - + + File operation failed - - + + Failed to remove "%1". Maybe you lack the required file permissions? - - + + failed to rename %1 to %2 - + There already is a visible version of this file. Replace it? - + Un-Hide - + Hide - + Name - + Please enter a name - - + + Error - + Invalid name. Must be a valid file name - + A tweak by that name exists - + Create Tweak @@ -3870,7 +3870,8 @@ Continue? - The modindex determins the formids of objects originating from this mods. + The modindex determines the formids of objects originating from this mods. + The modindex determins the formids of objects originating from this mods. @@ -3905,37 +3906,37 @@ Continue? - + This plugin can't be disabled (enforced by the game) - + <b>Origin</b>: %1 - + Author - + Description - + Missing Masters - + Enabled Masters - + failed to restore load order for %1 @@ -5628,22 +5629,26 @@ On Windows XP: - <img src=":/MO/gui/emblem_conflict_overwrite" /> indicates that the mod overwrites files that are also available in another mod. + <img src="qrc:///MO/gui/emblem_conflict_overwrite" /> indicates that the mod overwrites files that are also available in another mod. + <img src=":/MO/gui/emblem_conflict_overwrite" /> indicates that the mod overwrites files that are also available in another mod. - <img src=":/MO/gui/emblem_conflict_overwritten" /> indicates that the mod is <b>partially</b> overwritten by another. + <img src="qrc:///MO/gui/emblem_conflict_overwritten" /> indicates that the mod is <b>partially</b> overwritten by another. + <img src=":/MO/gui/emblem_conflict_overwritten" /> indicates that the mod is <b>partially</b> overwritten by another. - <img src=":/MO/gui/emblem_conflict_mixed" /> indicates that both of the above is true. + <img src="qrc:///MO/gui/emblem_conflict_mixed" /> indicates that both of the above is true. + <img src=":/MO/gui/emblem_conflict_mixed" /> indicates that both of the above is true. - <img src=":/MO/gui/emblem_conflict_redundant" /> indicates that the mod is completely overwrtten by another. You could as well disable it. + <img src="qrc:///MO/gui/emblem_conflict_redundant" /> indicates that the mod is completely overwrtten by another. You could as well disable it. + <img src=":/MO/gui/emblem_conflict_redundant" /> indicates that the mod is completely overwrtten by another. You could as well disable it. @@ -5684,7 +5689,8 @@ On Windows XP: - Please open the "ESPs"-tab... + Please open the "Plugins"-tab... + Please open the "ESPs"-tab... @@ -5694,17 +5700,20 @@ On Windows XP: - Unlike with file conflicts, MO does not provide help on finding conflicts. The good news is, there already is a perfect tool for that called BOSS. BOSS is available on the Nexus and integrates neatly with MO. Basically, if you don't have BOSS yet, install it once this tutorial is over. + Unlike with file conflicts, MO does not provide help on finding conflicts. The good news is, there already is a perfect tool for that called LOOT. LOOT is available on the Nexus and integrates neatly with MO. Basically, if you don't have LOOT yet, install it once this tutorial is over. + Unlike with file conflicts, MO does not provide help on finding conflicts. The good news is, there already is a perfect tool for that called BOSS. BOSS is available on the Nexus and integrates neatly with MO. Basically, if you don't have BOSS yet, install it once this tutorial is over. - After you installed BOSS in the default location (follow its instructions), start MO again and BOSS should automatically appear as an Executable... + After you installed LOOT in the default location (follow its instructions), start MO again and LOOT should automatically appear as an Executable... + After you installed BOSS in the default location (follow its instructions), start MO again and BOSS should automatically appear as an Executable... - When you run BOSS, it will automatically re-organize plugins for best compatibility (overwriting your manual changes). It will also open a report in your browser that warns about incompatibilities. You should read the report, at least for new mods. + When you run LOOT, it will automatically re-organize plugins for best compatibility (overwriting your manual changes). It will also open a report in your browser that warns about incompatibilities. You should read the report, at least for new mods. + When you run BOSS, it will automatically re-organize plugins for best compatibility (overwriting your manual changes). It will also open a report in your browser that warns about incompatibilities. You should read the report, at least for new mods. -- cgit v1.3.1