mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-20 03:24:49 +00:00
Clickable links for PRs in the changelog (#2588)
This commit is contained in:
parent
f62884ffda
commit
dc52cfb9bc
1 changed files with 23 additions and 3 deletions
|
@ -19,7 +19,7 @@
|
|||
#include <QStandardPaths>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QTextEdit>
|
||||
#include <QTextBrowser>
|
||||
#include <QVBoxLayout>
|
||||
#include <common/config.h>
|
||||
#include <common/path_util.h>
|
||||
|
@ -247,7 +247,7 @@ void CheckUpdate::setupUI(const QString& downloadUrl, const QString& latestDate,
|
|||
bool latest_isWIP = latestRev.endsWith("WIP", Qt::CaseInsensitive);
|
||||
if (current_isWIP && !latest_isWIP) {
|
||||
} else {
|
||||
QTextEdit* textField = new QTextEdit(this);
|
||||
QTextBrowser* textField = new QTextBrowser(this);
|
||||
textField->setReadOnly(true);
|
||||
textField->setFixedWidth(500);
|
||||
textField->setFixedHeight(200);
|
||||
|
@ -349,8 +349,28 @@ void CheckUpdate::requestChangelog(const QString& currentRev, const QString& lat
|
|||
}
|
||||
|
||||
// Update the text field with the changelog
|
||||
QTextEdit* textField = findChild<QTextEdit*>();
|
||||
QTextBrowser* textField = findChild<QTextBrowser*>();
|
||||
if (textField) {
|
||||
QRegularExpression re("\\(\\#(\\d+)\\)");
|
||||
QString newChanges;
|
||||
int lastIndex = 0;
|
||||
QRegularExpressionMatchIterator i = re.globalMatch(changes);
|
||||
while (i.hasNext()) {
|
||||
QRegularExpressionMatch match = i.next();
|
||||
newChanges += changes.mid(lastIndex, match.capturedStart() - lastIndex);
|
||||
QString num = match.captured(1);
|
||||
newChanges +=
|
||||
QString(
|
||||
"(<a "
|
||||
"href=\"https://github.com/shadps4-emu/shadPS4/pull/%1\">#%1</a>)")
|
||||
.arg(num);
|
||||
lastIndex = match.capturedEnd();
|
||||
}
|
||||
|
||||
newChanges += changes.mid(lastIndex);
|
||||
changes = newChanges;
|
||||
|
||||
textField->setOpenExternalLinks(true);
|
||||
textField->setHtml("<h2>" + tr("Changes") + ":</h2>" + changes);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue