commit
97eac497ff
@ -0,0 +1,39 @@
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SRC_DIR} ${QT_INCLUDES})
|
||||
FILE(GLOB CRASHREPORT_SRC *.cpp)
|
||||
FILE(GLOB CRASHREPORT_HDR *h)
|
||||
|
||||
SET(CRASHREPORT_MOC_HDR
|
||||
crash_report_socket.h
|
||||
crash_report_widget.h
|
||||
)
|
||||
|
||||
SET(CRASHREPORT_UI
|
||||
crash_report_widget.ui
|
||||
)
|
||||
|
||||
SET(QT_USE_QTGUI TRUE)
|
||||
SET(QT_USE_QTNETWORK TRUE)
|
||||
SET(QT_USE_QTMAIN TRUE)
|
||||
SET(QT_USE_QTOPENGL FALSE)
|
||||
SET(QT_USE_QTXML FALSE)
|
||||
|
||||
INCLUDE(${QT_USE_FILE})
|
||||
ADD_DEFINITIONS(${QT_DEFINITIONS})
|
||||
|
||||
QT4_WRAP_CPP(CRASHREPORT_MOC_SRC ${CRASHREPORT_MOC_HDR})
|
||||
QT4_WRAP_UI(CRASHREPORT_UI_HDR ${CRASHREPORT_UI})
|
||||
|
||||
SOURCE_GROUP(QtResources FILES ${CRASHREPORT_UI})
|
||||
SOURCE_GROUP(QtGeneratedUiHdr FILES ${CRASHREPORT_UI_HDR})
|
||||
SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${CRASHREPORT_MOC_SRC})
|
||||
SOURCE_GROUP("source files" FILES ${CRASHREPORT_SRC})
|
||||
SOURCE_GROUP("header files" FILES ${CRASHREPORT_HDR})
|
||||
|
||||
ADD_EXECUTABLE(crash_report WIN32 MACOSX_BUNDLE ${CRASHREPORT_SRC} ${CRASHREPORT_MOC_HDR} ${CRASHREPORT_MOC_SRC} ${CRASHREPORT_UI_HDR})
|
||||
TARGET_LINK_LIBRARIES(crash_report ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
|
||||
|
||||
NL_DEFAULT_PROPS(crash_report "NeL, Tools, Misc: Crash Report")
|
||||
NL_ADD_RUNTIME_FLAGS(crash_report)
|
||||
|
||||
INSTALL(TARGETS crash_report RUNTIME DESTINATION ${NL_BIN_PREFIX})
|
||||
|
@ -0,0 +1,111 @@
|
||||
// Nel MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "crash_report_widget.h"
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class CCmdLineParser
|
||||
{
|
||||
public:
|
||||
static void parse( int argc, char **argv, std::vector< std::pair< std::string, std::string > > &v )
|
||||
{
|
||||
std::stack< std::string > stack;
|
||||
std::string key;
|
||||
std::string value;
|
||||
|
||||
for( int i = argc - 1 ; i >= 0; i-- )
|
||||
{
|
||||
stack.push( std::string( argv[ i ] ) );
|
||||
}
|
||||
|
||||
while( !stack.empty() )
|
||||
{
|
||||
key = stack.top();
|
||||
stack.pop();
|
||||
|
||||
// If not a real parameter ( they start with '-' ), discard.
|
||||
if( key[ 0 ] != '-' )
|
||||
continue;
|
||||
|
||||
// Remove the '-'
|
||||
key = key.substr( 1 );
|
||||
|
||||
// No more parameters
|
||||
if( stack.empty() )
|
||||
{
|
||||
v.push_back( std::make_pair( key, "" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
value = stack.top();
|
||||
|
||||
// If next parameter is a key, process it in the next iteration
|
||||
if( value[ 0 ] == '-' )
|
||||
{
|
||||
v.push_back( std::make_pair( key, "" ) );
|
||||
continue;
|
||||
}
|
||||
// Otherwise store the pair
|
||||
else
|
||||
{
|
||||
v.push_back( std::make_pair( key, value ) );
|
||||
stack.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
#ifndef WIN32
|
||||
// Workaround to default -style=gtk+ on recent Cinnamon versions
|
||||
char *currentDesktop = getenv("XDG_CURRENT_DESKTOP");
|
||||
if (currentDesktop)
|
||||
{
|
||||
printf("XDG_CURRENT_DESKTOP: %s\n", currentDesktop);
|
||||
if (!strcmp(currentDesktop, "X-Cinnamon"))
|
||||
{
|
||||
setenv("XDG_CURRENT_DESKTOP", "gnome", 1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QApplication app( argc, argv );
|
||||
|
||||
std::vector< std::pair< std::string, std::string > > params;
|
||||
|
||||
CCmdLineParser::parse( argc, argv, params );
|
||||
|
||||
CCrashReportWidget w;
|
||||
w.setup( params );
|
||||
w.show();
|
||||
|
||||
int ret = app.exec();
|
||||
|
||||
if( ret != EXIT_SUCCESS )
|
||||
return ret;
|
||||
else
|
||||
return w.getReturnValue();
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
// Ryzom Core MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef RCERROR_DATA
|
||||
#define RCERROR_DATA
|
||||
|
||||
#include <QString>
|
||||
|
||||
|
||||
struct SCrashReportData
|
||||
{
|
||||
QString description;
|
||||
QString report;
|
||||
QString email;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,78 @@
|
||||
// Nel MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "crash_report_socket.h"
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QUrl>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
# include <QUrlQuery>
|
||||
#endif
|
||||
|
||||
class CCrashReportSocketPvt
|
||||
{
|
||||
public:
|
||||
QNetworkAccessManager mgr;
|
||||
};
|
||||
|
||||
CCrashReportSocket::CCrashReportSocket( QObject *parent ) :
|
||||
QObject( parent )
|
||||
{
|
||||
m_pvt = new CCrashReportSocketPvt();
|
||||
|
||||
connect( &m_pvt->mgr, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( onFinished( QNetworkReply* ) ) );
|
||||
}
|
||||
|
||||
CCrashReportSocket::~CCrashReportSocket()
|
||||
{
|
||||
delete m_pvt;
|
||||
}
|
||||
|
||||
void CCrashReportSocket::sendReport( const SCrashReportData &data )
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
QUrlQuery params;
|
||||
#else
|
||||
QUrl params;
|
||||
#endif
|
||||
params.addQueryItem( "report", data.report );
|
||||
params.addQueryItem( "descr", data.description );
|
||||
params.addQueryItem("email", data.email);
|
||||
|
||||
QUrl url( m_url );
|
||||
QNetworkRequest request( url );
|
||||
request.setRawHeader( "Connection", "close" );
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
QByteArray postData = params.query(QUrl::FullyEncoded).toUtf8();
|
||||
#else
|
||||
QByteArray postData = params.encodedQuery();
|
||||
#endif
|
||||
|
||||
m_pvt->mgr.post(request, postData);
|
||||
}
|
||||
|
||||
void CCrashReportSocket::onFinished( QNetworkReply *reply )
|
||||
{
|
||||
if( reply->error() != QNetworkReply::NoError )
|
||||
Q_EMIT reportFailed();
|
||||
else
|
||||
Q_EMIT reportSent();
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
// Nel MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef RCERROR_SOCKET
|
||||
#define RCERROR_SOCKET
|
||||
|
||||
#include <QObject>
|
||||
#include "crash_report_data.h"
|
||||
|
||||
class CCrashReportSocketPvt;
|
||||
class QNetworkReply;
|
||||
|
||||
class CCrashReportSocket : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CCrashReportSocket( QObject *parent );
|
||||
~CCrashReportSocket();
|
||||
|
||||
void setURL( const char *URL ){ m_url = URL; }
|
||||
QString url() const{ return m_url; }
|
||||
|
||||
void sendReport( const SCrashReportData &data );
|
||||
|
||||
Q_SIGNALS:
|
||||
void reportSent();
|
||||
void reportFailed();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onFinished( QNetworkReply *reply );
|
||||
|
||||
private:
|
||||
CCrashReportSocketPvt *m_pvt;
|
||||
QString m_url;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,301 @@
|
||||
// Nel MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "crash_report_widget.h"
|
||||
#include "crash_report_socket.h"
|
||||
#include "crash_report_data.h"
|
||||
#include <QTimer>
|
||||
#include <QTextStream>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QFile>
|
||||
#include <QPushButton>
|
||||
#include <QHBoxLayout>
|
||||
#include <QCheckBox>
|
||||
|
||||
CCrashReportWidget::CCrashReportWidget( QWidget *parent ) :
|
||||
QWidget( parent )
|
||||
{
|
||||
m_developerMode = false;
|
||||
m_forceSend = false;
|
||||
m_devSendReport = false;
|
||||
m_returnValue = ERET_NULL;
|
||||
|
||||
m_ui.setupUi( this );
|
||||
|
||||
m_socket = new CCrashReportSocket( this );
|
||||
|
||||
QTimer::singleShot( 1, this, SLOT( onLoad() ) );
|
||||
|
||||
connect( m_ui.emailCB, SIGNAL( stateChanged( int ) ), this, SLOT( onCBClicked() ) );
|
||||
|
||||
connect( m_socket, SIGNAL( reportSent() ), this, SLOT( onReportSent() ) );
|
||||
connect( m_socket, SIGNAL( reportFailed() ), this, SLOT( onReportFailed() ) );
|
||||
}
|
||||
|
||||
CCrashReportWidget::~CCrashReportWidget()
|
||||
{
|
||||
m_socket = NULL;
|
||||
}
|
||||
|
||||
void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::string > > ¶ms )
|
||||
{
|
||||
for( int i = 0; i < params.size(); i++ )
|
||||
{
|
||||
const std::pair< std::string, std::string > &p = params[ i ];
|
||||
const std::string &k = p.first;
|
||||
const std::string &v = p.second;
|
||||
|
||||
if( k == "log" )
|
||||
{
|
||||
m_fileName = v.c_str();
|
||||
if( !QFile::exists( m_fileName ) )
|
||||
m_fileName.clear();
|
||||
}
|
||||
else
|
||||
if( k == "host" )
|
||||
{
|
||||
m_socket->setURL( v.c_str() );
|
||||
}
|
||||
else
|
||||
if( k == "title" )
|
||||
{
|
||||
setWindowTitle( v.c_str() );
|
||||
}
|
||||
else
|
||||
if( k == "dev" )
|
||||
{
|
||||
m_developerMode = true;
|
||||
}
|
||||
else
|
||||
if( k == "sendreport" )
|
||||
{
|
||||
m_forceSend = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_fileName.isEmpty() )
|
||||
{
|
||||
m_ui.reportLabel->hide();
|
||||
m_ui.reportEdit->hide();
|
||||
}
|
||||
|
||||
|
||||
if( m_socket->url().isEmpty() || m_fileName.isEmpty() )
|
||||
{
|
||||
m_ui.descriptionEdit->hide();
|
||||
m_ui.emailCB->hide();
|
||||
m_ui.emailEdit->hide();
|
||||
m_ui.descrLabel->hide();
|
||||
}
|
||||
|
||||
QHBoxLayout *hbl = new QHBoxLayout( this );
|
||||
|
||||
if( m_developerMode )
|
||||
{
|
||||
if( !m_socket->url().isEmpty() && !m_fileName.isEmpty() )
|
||||
{
|
||||
m_ui.emailCB->setEnabled( false );
|
||||
|
||||
QCheckBox *cb = new QCheckBox( tr( "Send report" ), this );
|
||||
m_ui.gridLayout->addWidget( cb, 4, 0, 1, 1 );
|
||||
|
||||
m_ui.gridLayout->addWidget( m_ui.emailCB, 5, 0, 1, 1 );
|
||||
m_ui.gridLayout->addWidget( m_ui.emailEdit, 6, 0, 1, 1 );
|
||||
|
||||
connect(cb, SIGNAL(stateChanged(int)), this, SLOT(onSendCBClicked()));
|
||||
if (m_forceSend)
|
||||
cb->setChecked(true);
|
||||
}
|
||||
|
||||
hbl->addStretch();
|
||||
|
||||
QPushButton *alwaysIgnoreButton = new QPushButton( tr( "Always Ignore" ), this );
|
||||
QPushButton *ignoreButton = new QPushButton( tr( "Ignore" ), this );
|
||||
QPushButton *abortButton = new QPushButton( tr( "Abort" ), this );
|
||||
QPushButton *breakButton = new QPushButton(tr("Break"), this);
|
||||
breakButton->setAutoDefault(true);
|
||||
|
||||
hbl->addWidget( alwaysIgnoreButton );
|
||||
hbl->addWidget( ignoreButton );
|
||||
hbl->addWidget( abortButton );
|
||||
hbl->addWidget( breakButton );
|
||||
|
||||
m_ui.gridLayout->addLayout( hbl, 7, 0, 1, 3 );
|
||||
|
||||
connect( alwaysIgnoreButton, SIGNAL( clicked( bool ) ), this, SLOT( onAlwaysIgnoreClicked() ) );
|
||||
connect( ignoreButton, SIGNAL( clicked( bool ) ), this, SLOT( onIgnoreClicked() ) );
|
||||
connect( abortButton, SIGNAL( clicked( bool ) ), this, SLOT( onAbortClicked() ) );
|
||||
connect( breakButton, SIGNAL( clicked( bool ) ), this, SLOT( onBreakClicked() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
hbl->addStretch();
|
||||
|
||||
// If -host is specified, offer the send function
|
||||
if( !m_socket->url().isEmpty() && !m_fileName.isEmpty() )
|
||||
{
|
||||
if (!m_forceSend)
|
||||
{
|
||||
QPushButton *cancelButton = new QPushButton(tr("Don't send report"), this);
|
||||
connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(onCancelClicked()));
|
||||
hbl->addWidget(cancelButton);
|
||||
}
|
||||
|
||||
QPushButton *sendButton = new QPushButton( tr( "Send report" ), this );
|
||||
sendButton->setAutoDefault(true);
|
||||
connect( sendButton, SIGNAL( clicked( bool ) ), this, SLOT( onSendClicked() ) );
|
||||
hbl->addWidget( sendButton );
|
||||
}
|
||||
// Otherwise only offer exit
|
||||
else
|
||||
{
|
||||
QPushButton *exitButton = new QPushButton( tr( "Exit" ), this );
|
||||
connect( exitButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) );
|
||||
hbl->addWidget(exitButton);
|
||||
exitButton->setAutoDefault(true);
|
||||
}
|
||||
|
||||
m_ui.gridLayout->addLayout( hbl, 6, 0, 1, 3 );
|
||||
}
|
||||
}
|
||||
|
||||
void CCrashReportWidget::onLoad()
|
||||
{
|
||||
if( m_fileName.isEmpty() )
|
||||
return;
|
||||
|
||||
QFile f( m_fileName );
|
||||
bool b = f.open( QFile::ReadOnly | QFile::Text );
|
||||
if( !b )
|
||||
{
|
||||
m_fileName.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream ss( &f );
|
||||
m_ui.reportEdit->setPlainText( ss.readAll() );
|
||||
f.close();
|
||||
}
|
||||
|
||||
void CCrashReportWidget::onSendClicked()
|
||||
{
|
||||
if( m_developerMode && !m_devSendReport )
|
||||
{
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_socket->url().isEmpty() || m_fileName.isEmpty() )
|
||||
{
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
|
||||
SCrashReportData data;
|
||||
data.description = m_ui.descriptionEdit->toPlainText();
|
||||
data.report = m_ui.reportEdit->toPlainText();
|
||||
|
||||
if( m_ui.emailCB->isChecked() )
|
||||
data.email = m_ui.emailEdit->text();
|
||||
|
||||
m_socket->sendReport( data );
|
||||
}
|
||||
|
||||
void CCrashReportWidget::onCancelClicked()
|
||||
{
|
||||
removeAndQuit();
|
||||
}
|
||||
|
||||
void CCrashReportWidget::onCBClicked()
|
||||
{
|
||||
m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() );
|
||||
}
|
||||
|
||||
void CCrashReportWidget::onSendCBClicked()
|
||||
{
|
||||
bool b = m_ui.emailCB->isEnabled();
|
||||
|
||||
if( b )
|
||||
{
|
||||
m_ui.emailCB->setChecked( false );
|
||||
}
|
||||
|
||||
m_ui.emailCB->setEnabled( !b );
|
||||
|
||||
m_devSendReport = !m_devSendReport;
|
||||
}
|
||||
|
||||
void CCrashReportWidget::onAlwaysIgnoreClicked()
|
||||
{
|
||||
m_returnValue = ERET_ALWAYS_IGNORE;
|
||||
onSendClicked();
|
||||
}
|
||||
|
||||
void CCrashReportWidget::onIgnoreClicked()
|
||||
{
|
||||
m_returnValue = ERET_IGNORE;
|
||||
onSendClicked();
|
||||
}
|
||||
|
||||
void CCrashReportWidget::onAbortClicked()
|
||||
{
|
||||
m_returnValue = ERET_ABORT;
|
||||
onSendClicked();
|
||||
}
|
||||
|
||||
void CCrashReportWidget::onBreakClicked()
|
||||
{
|
||||
m_returnValue = ERET_BREAK;
|
||||
onSendClicked();
|
||||
}
|
||||
|
||||
|
||||
void CCrashReportWidget::onReportSent()
|
||||
{
|
||||
QApplication::setOverrideCursor( Qt::ArrowCursor );
|
||||
|
||||
QMessageBox::information( this,
|
||||
tr( "Report sent" ),
|
||||
tr( "The report has been sent." ) );
|
||||
|
||||
removeAndQuit();
|
||||
}
|
||||
|
||||
void CCrashReportWidget::onReportFailed()
|
||||
{
|
||||
QApplication::setOverrideCursor( Qt::ArrowCursor );
|
||||
|
||||
QMessageBox::information( this,
|
||||
tr( "Report failed" ),
|
||||
tr( "Failed to send the report..." ) );
|
||||
|
||||
removeAndQuit();
|
||||
}
|
||||
|
||||
void CCrashReportWidget::removeAndQuit()
|
||||
{
|
||||
if( !m_fileName.isEmpty() )
|
||||
QFile::remove( m_fileName );
|
||||
|
||||
close();
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
// Nel MMORPG framework - Error Reporter
|
||||
//
|
||||
// Copyright (C) 2015 Laszlo Kis-Adam
|
||||
// Copyright (C) 2010 Ryzom Core <http://ryzomcore.org/>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#ifndef RCERROR_WIDGET
|
||||
#define RCERROR_WIDGET
|
||||
|
||||
|
||||
#include "ui_crash_report_widget.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class CCrashReportSocket;
|
||||
|
||||
class CCrashReportWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
enum EReturnValue
|
||||
{
|
||||
ERET_NULL = 0,
|
||||
ERET_ALWAYS_IGNORE = 21,
|
||||
ERET_IGNORE = 22,
|
||||
ERET_ABORT = 23,
|
||||
ERET_BREAK = 24
|
||||
};
|
||||
|
||||
CCrashReportWidget( QWidget *parent = NULL );
|
||||
~CCrashReportWidget();
|
||||
|
||||
void setFileName( const char *fn ){ m_fileName = fn; }
|
||||
|
||||
void setup( const std::vector< std::pair< std::string, std::string > > ¶ms );
|
||||
|
||||
EReturnValue getReturnValue() const{ return m_returnValue; }
|
||||
|
||||
private Q_SLOTS:
|
||||
void onLoad();
|
||||
void onSendClicked();
|
||||
void onCancelClicked();
|
||||
void onCBClicked();
|
||||
void onSendCBClicked();
|
||||
|
||||
void onAlwaysIgnoreClicked();
|
||||
void onIgnoreClicked();
|
||||
void onAbortClicked();
|
||||
void onBreakClicked();
|
||||
|
||||
void onReportSent();
|
||||
void onReportFailed();
|
||||
|
||||
private:
|
||||
void removeAndQuit();
|
||||
|
||||
Ui::CrashReportWidget m_ui;
|
||||
QString m_fileName;
|
||||
CCrashReportSocket *m_socket;
|
||||
bool m_developerMode;
|
||||
bool m_forceSend;
|
||||
bool m_devSendReport;
|
||||
|
||||
EReturnValue m_returnValue;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CrashReportWidget</class>
|
||||
<widget class="QWidget" name="CrashReportWidget">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::ApplicationModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>406</width>
|
||||
<height>430</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>NeL report</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="descrLabel">
|
||||
<property name="text">
|
||||
<string>What were you doing when the crash occured?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="reportLabel">
|
||||
<property name="text">
|
||||
<string>Contents of the report ( automatically generated )</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QPlainTextEdit" name="descriptionEdit"/>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="emailCB">
|
||||
<property name="text">
|
||||
<string>Email me if you have further questions, or updates on this issue</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QLineEdit" name="emailEdit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enter your email address here</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QPlainTextEdit" name="reportEdit">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue