-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display error preview if reading a file fails
- Loading branch information
1 parent
b05fa5b
commit 154892a
Showing
10 changed files
with
115 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "ErrorPreview.h" | ||
|
||
#include <QHBoxLayout> | ||
#include <QLabel> | ||
#include <QPixmap> | ||
|
||
ErrorPreview::ErrorPreview(QWidget* parent) | ||
: QWidget(parent) { | ||
this->setSizePolicy(QSizePolicy::Policy::Maximum, QSizePolicy::Policy::Minimum); | ||
|
||
auto* layout = new QHBoxLayout(this); | ||
layout->setSpacing(16); | ||
|
||
auto* warningImage = new QLabel(this); | ||
warningImage->setPixmap(QPixmap(":/error.png")); | ||
layout->addWidget(warningImage, Qt::AlignCenter); | ||
|
||
auto* warningLabel = new QLabel(this); | ||
warningLabel->setText(tr("Failed to read file contents!\nPlease ensure that a game or another application is not using the VPK.")); | ||
layout->addWidget(warningLabel, Qt::AlignLeft); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#pragma once | ||
|
||
#include <QWidget> | ||
|
||
class ErrorPreview : public QWidget { | ||
Q_OBJECT; | ||
|
||
public: | ||
static inline const QStringList EXTENSIONS { | ||
// None, this is displayed when an entry cannot be read, maybe due to another process using it | ||
}; | ||
|
||
explicit ErrorPreview(QWidget* parent = nullptr); | ||
}; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<RCC> | ||
<qresource prefix="/"> | ||
<file>icon.png</file> | ||
<file>error.png</file> | ||
</qresource> | ||
</RCC> |