src/platform/qt/ReportView.h (view raw)
1/* Copyright (c) 2013-2020 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#pragma once
7
8#include <QDialog>
9#include <QHash>
10
11#include <array>
12#include <memory>
13
14#include "ConfigController.h"
15
16#include "ui_ReportView.h"
17
18namespace QGBA {
19
20class ConfigController;
21class CoreController;
22
23class ReportView : public QDialog {
24Q_OBJECT
25
26public:
27 ReportView(QWidget* parent = nullptr);
28
29public slots:
30 void generateReport();
31 void save();
32
33private slots:
34 void setShownReport(const QString&);
35 void rebuildModel();
36 void openBugReportPage();
37
38protected:
39 bool eventFilter(QObject* obj, QEvent* event) override;
40
41private:
42 void addCpuInfo(QStringList&);
43 void addGLInfo(QStringList&);
44 void addROMInfo(QStringList&, CoreController*);
45 void addScreenInfo(QStringList&, const QScreen*);
46
47 void addReport(const QString& filename, const QString& report);
48 void addBinary(const QString& filename, const QByteArray& report);
49 QString redact(const QString& text);
50
51#if (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) || (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)))
52 static bool cpuid(unsigned id, std::array<unsigned, 4>& regs);
53 static bool cpuid(unsigned id, unsigned sub, std::array<unsigned, 4>& regs);
54
55 static unsigned s_cpuidMax;
56 static unsigned s_cpuidExtMax;
57#endif
58
59 ConfigController* m_config;
60
61 QStringList m_displayOrder;
62 QHash<QString, QString> m_reports;
63 QHash<QString, QByteArray> m_binaries;
64
65 Ui::ReportView m_ui;
66};
67
68}