MCPcopy Create free account
hub / github.com/baldurk/renderdoc / CrashDialog

Method CrashDialog

qrenderdoc/Windows/Dialogs/CrashDialog.cpp:44–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42const qint64 MaxUploadSize = 2250LL * 1024LL * 1024LL;
43
44CrashDialog::CrashDialog(PersistantConfig &cfg, QVariantMap crashReportJSON, QWidget *parent)
45 : QDialog(parent), ui(new Ui::CrashDialog), m_Config(cfg)
46{
47 ui->setupUi(this);
48
49 m_NetManager = new QNetworkAccessManager(this);
50
51 m_ReportPath = crashReportJSON[lit("report")].toString();
52 m_ReportMetadata = crashReportJSON;
53
54 const bool replayCrash = crashReportJSON[lit("replaycrash")].toUInt() != 0;
55 const bool forceCapture = crashReportJSON[lit("forcecapture")].toUInt() != 0;
56 const bool manualReport =
57 crashReportJSON.contains(lit("manual")) && crashReportJSON[lit("manual")].toUInt() != 0;
58
59 // remove metadata we don't send directly
60 m_ReportMetadata.remove(lit("report"));
61 m_ReportMetadata.remove(lit("forcecapture"));
62 m_ReportMetadata.remove(lit("replaycrash"));
63
64 setStage(ReportStage::FillingDetails);
65
66 m_CaptureFilename = m_Config.CrashReport_LastOpenedCapture;
67
68 ui->rememberEmail->setChecked(m_Config.CrashReport_ShouldRememberEmail);
69 ui->email->setText(m_Config.CrashReport_EmailAddress);
70
71 QFileInfo capInfo(m_CaptureFilename);
72
73 bool hasEmbeddedFiles = false;
74 if(replayCrash && capInfo.exists())
75 {
76 // if we have a previous capture, fill out the capture group
77 ui->captureFilename->setTextFormat(Qt::RichText);
78 ui->captureFilename->setText(lit("<a href=\"file://%1\">%2</a>")
79 .arg(QUrl::fromLocalFile(capInfo.absoluteFilePath()).toString())
80 .arg(capInfo.fileName()));
81
82 // hide the preview until we have a successful thumbnail
83 ui->capturePreviewFrame->hide();
84
85 ICaptureFile *cap = RENDERDOC_OpenCaptureFile();
86
87 ResultDetails result = cap->OpenFile(capInfo.absoluteFilePath(), "", NULL);
88
89 if(result.OK())
90 {
91 Thumbnail thumb = cap->GetThumbnail(FileType::Raw, 320);
92 QImage i = QImage(thumb.data.data(), (int)thumb.width, (int)thumb.height, QImage::Format_RGB888)
93 .copy(0, 0, (int)thumb.width, (int)thumb.height);
94 if(!i.isNull())
95 {
96 ui->capturePreview->setPixmap(QPixmap::fromImage(i));
97 ui->capturePreview->setPreserveAspectRatio(true);
98 ui->capturePreviewFrame->show();
99
100 m_Thumbnail = new Thumbnail(cap->GetThumbnail(FileType::JPG, 0));
101 }

Callers

nothing calls this directly

Calls 15

fromImageFunction · 0.85
existsMethod · 0.80
fileNameMethod · 0.80
OpenFileMethod · 0.80
QImageFunction · 0.50
trFunction · 0.50
QStringFunction · 0.50
toStringMethod · 0.45
containsMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected