mirror of
https://github.com/vicr123/theshell.git
synced 2025-01-23 04:11:49 -05:00
64 lines
2 KiB
C++
64 lines
2 KiB
C++
/****************************************
|
|
*
|
|
* theShell - Desktop Environment
|
|
* Copyright (C) 2017 Victor Tran
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* *************************************/
|
|
|
|
#include "segfaultdialog.h"
|
|
#include "ui_segfaultdialog.h"
|
|
|
|
SegfaultDialog::SegfaultDialog(QString signal, QWidget *parent) :
|
|
QDialog(parent),
|
|
ui(new Ui::SegfaultDialog)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
this->setFixedSize(this->size());
|
|
ui->label_3->setText(tr("To debug, attach a debugger to PID %1").arg(QString::number(QApplication::applicationPid())));
|
|
ui->pushButton_3->setProperty("type", "destructive");
|
|
ui->signal->setText(signal);
|
|
}
|
|
|
|
SegfaultDialog::~SegfaultDialog()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void SegfaultDialog::on_pushButton_clicked()
|
|
{
|
|
this->close();
|
|
}
|
|
|
|
void SegfaultDialog::on_pushButton_2_clicked()
|
|
{
|
|
void* buffer[50];
|
|
int size = backtrace(buffer, 50);
|
|
char** charBt = backtrace_symbols(buffer, size);
|
|
QString trace;
|
|
for (int i = 0; i < size && charBt != NULL; i++) {
|
|
trace.append(QString(charBt[i]) + "\n");
|
|
}
|
|
QMessageBox::information(this, "Backtrace", trace, QMessageBox::Ok, QMessageBox::Ok);
|
|
}
|
|
|
|
void SegfaultDialog::on_pushButton_3_clicked()
|
|
{
|
|
if (QMessageBox::warning(this, tr("Reset theShell?"), tr("You're about to reset theShell. Are you sure?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes) {
|
|
QSettings().clear();
|
|
this->close();
|
|
}
|
|
}
|