File: crash-report.cpp

package info (click to toggle)
obs-studio 29.0.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 35,920 kB
  • sloc: ansic: 182,921; cpp: 98,959; sh: 1,591; python: 945; makefile: 858; javascript: 19
file content (51 lines) | stat: -rw-r--r-- 1,239 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "crash-report.hpp"
#include <QApplication>
#include <QFontDatabase>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QClipboard>
#include "qt-wrappers.hpp"
#include "plain-text-edit.hpp"

OBSCrashReport::OBSCrashReport(QWidget *parent, const char *text)
	: QDialog(parent)
{
	QPushButton *copyButton = new QPushButton;
	copyButton->setText("Copy crash log");

	QPushButton *exitButton = new QPushButton;
	exitButton->setText("Exit");

	textBox = new OBSPlainTextEdit;
	textBox->setPlainText(QT_UTF8(text));
	textBox->setLineWrapMode(QPlainTextEdit::NoWrap);

	QHBoxLayout *buttonLayout = new QHBoxLayout;
	buttonLayout->addWidget(copyButton);
	buttonLayout->addWidget(exitButton);

	QVBoxLayout *mainLayout = new QVBoxLayout;
	mainLayout->addWidget(textBox);
	mainLayout->addItem(buttonLayout);

	setLayout(mainLayout);

	QWidget::connect(copyButton, SIGNAL(clicked()), this,
			 SLOT(CopyClicked()));
	QWidget::connect(exitButton, SIGNAL(clicked()), this,
			 SLOT(ExitClicked()));

	resize(800, 600);
	setWindowTitle("Oops, OBS has crashed!");
}

void OBSCrashReport::ExitClicked()
{
	exit(-1);
}

void OBSCrashReport::CopyClicked()
{
	QApplication::clipboard()->setText(textBox->toPlainText());
}