2017-08-05 15:20:02 +10:00
/****************************************
*
* 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/>.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2016-05-29 17:03:52 +10:00
# include "segfaultdialog.h"
# include "ui_segfaultdialog.h"
2016-06-23 22:47:39 +10:00
SegfaultDialog : : SegfaultDialog ( QString signal , QWidget * parent ) :
2016-05-29 17:03:52 +10:00
QDialog ( parent ) ,
ui ( new Ui : : SegfaultDialog )
{
ui - > setupUi ( this ) ;
this - > setFixedSize ( this - > size ( ) ) ;
2017-01-22 00:08:04 +11:00
ui - > label_3 - > setText ( tr ( " To debug, attach a debugger to PID %1 " ) . arg ( QString : : number ( QApplication : : applicationPid ( ) ) ) ) ;
2016-12-14 22:39:35 +11:00
ui - > pushButton_3 - > setProperty ( " type " , " destructive " ) ;
2016-09-13 14:07:51 +10:00
ui - > signal - > setText ( signal ) ;
2016-05-29 17:03:52 +10:00
}
SegfaultDialog : : ~ SegfaultDialog ( )
{
delete ui ;
}
void SegfaultDialog : : on_pushButton_clicked ( )
{
this - > close ( ) ;
}
2016-07-01 14:01:19 +10:00
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 ) ;
}
2016-09-13 14:07:51 +10:00
void SegfaultDialog : : on_pushButton_3_clicked ( )
{
2017-01-22 00:08:04 +11:00
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 ) {
2016-09-13 14:07:51 +10:00
QSettings ( ) . clear ( ) ;
this - > close ( ) ;
}
}