mirror of
https://github.com/PCSX2/pcsx2.git
synced 2025-12-16 04:08:48 +00:00
Qt: Fix nodiscard warning when opening HTML files for the about dialog
This commit is contained in:
parent
9955e07470
commit
7385cbe40a
@ -12,6 +12,7 @@
|
|||||||
#include "common/SmallString.h"
|
#include "common/SmallString.h"
|
||||||
|
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtGui/QDesktopServices>
|
#include <QtGui/QDesktopServices>
|
||||||
#include <QtWidgets/QDialog>
|
#include <QtWidgets/QDialog>
|
||||||
@ -134,12 +135,16 @@ void AboutDialog::showHTMLDialog(QWidget* parent, const QString& title, const QS
|
|||||||
tb->setOpenExternalLinks(true);
|
tb->setOpenExternalLinks(true);
|
||||||
|
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
file.open(QIODevice::ReadOnly);
|
QFileInfo fi(path);
|
||||||
if (const QByteArray data = file.readAll(); !data.isEmpty())
|
if (!fi.exists() || !fi.isReadable())
|
||||||
tb->setText(QString::fromUtf8(data));
|
{
|
||||||
else
|
|
||||||
tb->setText(tr("File not found: %1").arg(path));
|
tb->setText(tr("File not found: %1").arg(path));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tb->setSource(QUrl::fromLocalFile(path));
|
||||||
|
}
|
||||||
|
|
||||||
layout->addWidget(tb, 1);
|
layout->addWidget(tb, 1);
|
||||||
|
|
||||||
QDialogButtonBox* bb = new QDialogButtonBox(QDialogButtonBox::Close, &dialog);
|
QDialogButtonBox* bb = new QDialogButtonBox(QDialogButtonBox::Close, &dialog);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user