More renames...
--HG-- branch : feature-crashreport
This commit is contained in:
parent
3987971792
commit
cfe2d60350
8 changed files with 41 additions and 41 deletions
|
@ -115,9 +115,9 @@ static void doSendReport()
|
||||||
f.close();
|
f.close();
|
||||||
|
|
||||||
#ifdef NL_OS_WINDOWS
|
#ifdef NL_OS_WINDOWS
|
||||||
NLMISC::launchProgram( "rcerror.exe", filename );
|
NLMISC::launchProgram( "crash_report.exe", filename );
|
||||||
#else
|
#else
|
||||||
NLMISC::launchProgram( "rcerror", filename );
|
NLMISC::launchProgram( "crash_report", filename );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#include "rcerror_widget.h"
|
#include "crash_report_widget.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ int main( int argc, char **argv )
|
||||||
{
|
{
|
||||||
QApplication app( argc, argv );
|
QApplication app( argc, argv );
|
||||||
|
|
||||||
CRCErrorWidget w;
|
CCrashReportWidget w;
|
||||||
w.setFileName( "rcerrorlog.txt" );
|
w.setFileName( "rcerrorlog.txt" );
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
struct SRCErrorData
|
struct SCrashReportData
|
||||||
{
|
{
|
||||||
QString description;
|
QString description;
|
||||||
QString report;
|
QString report;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
// You should have received a copy of the GNU Affero General Public License
|
// 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/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "rcerror_socket.h"
|
#include "crash_report_socket.h"
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
|
@ -27,26 +27,26 @@ namespace
|
||||||
static const char *BUG_URL = "http://192.168.2.66/dfighter/r.php";
|
static const char *BUG_URL = "http://192.168.2.66/dfighter/r.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
class CRCErrorSocketPvt
|
class CCrashReportSocketPvt
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QNetworkAccessManager mgr;
|
QNetworkAccessManager mgr;
|
||||||
};
|
};
|
||||||
|
|
||||||
CRCErrorSocket::CRCErrorSocket( QObject *parent ) :
|
CCrashReportSocket::CCrashReportSocket( QObject *parent ) :
|
||||||
QObject( parent )
|
QObject( parent )
|
||||||
{
|
{
|
||||||
m_pvt = new CRCErrorSocketPvt();
|
m_pvt = new CCrashReportSocketPvt();
|
||||||
|
|
||||||
connect( &m_pvt->mgr, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( onFinished( QNetworkReply* ) ) );
|
connect( &m_pvt->mgr, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( onFinished( QNetworkReply* ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
CRCErrorSocket::~CRCErrorSocket()
|
CCrashReportSocket::~CCrashReportSocket()
|
||||||
{
|
{
|
||||||
delete m_pvt;
|
delete m_pvt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRCErrorSocket::sendReport( const SRCErrorData &data )
|
void CCrashReportSocket::sendReport( const SCrashReportData &data )
|
||||||
{
|
{
|
||||||
QUrl params;
|
QUrl params;
|
||||||
params.addQueryItem( "report", data.report );
|
params.addQueryItem( "report", data.report );
|
||||||
|
@ -60,7 +60,7 @@ void CRCErrorSocket::sendReport( const SRCErrorData &data )
|
||||||
m_pvt->mgr.post( request, params.encodedQuery() );
|
m_pvt->mgr.post( request, params.encodedQuery() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRCErrorSocket::onFinished( QNetworkReply *reply )
|
void CCrashReportSocket::onFinished( QNetworkReply *reply )
|
||||||
{
|
{
|
||||||
if( reply->error() != QNetworkReply::NoError )
|
if( reply->error() != QNetworkReply::NoError )
|
||||||
Q_EMIT reportFailed();
|
Q_EMIT reportFailed();
|
||||||
|
|
|
@ -21,20 +21,20 @@
|
||||||
#define RCERROR_SOCKET
|
#define RCERROR_SOCKET
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include "rcerror_data.h"
|
#include "crash_report_data.h"
|
||||||
|
|
||||||
class CRCErrorSocketPvt;
|
class CCrashReportSocketPvt;
|
||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
|
|
||||||
class CRCErrorSocket : public QObject
|
class CCrashReportSocket : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CRCErrorSocket( QObject *parent );
|
CCrashReportSocket( QObject *parent );
|
||||||
~CRCErrorSocket();
|
~CCrashReportSocket();
|
||||||
|
|
||||||
void sendReport( const SRCErrorData &data );
|
void sendReport( const SCrashReportData &data );
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void reportSent();
|
void reportSent();
|
||||||
|
@ -44,7 +44,7 @@ private Q_SLOTS:
|
||||||
void onFinished( QNetworkReply *reply );
|
void onFinished( QNetworkReply *reply );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CRCErrorSocketPvt *m_pvt;
|
CCrashReportSocketPvt *m_pvt;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,20 +17,20 @@
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
#include "rcerror_widget.h"
|
#include "crash_report_widget.h"
|
||||||
#include "rcerror_socket.h"
|
#include "crash_report_socket.h"
|
||||||
#include "rcerror_data.h"
|
#include "crash_report_data.h"
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
CRCErrorWidget::CRCErrorWidget( QWidget *parent ) :
|
CCrashReportWidget::CCrashReportWidget( QWidget *parent ) :
|
||||||
QWidget( parent )
|
QWidget( parent )
|
||||||
{
|
{
|
||||||
m_ui.setupUi( this );
|
m_ui.setupUi( this );
|
||||||
|
|
||||||
m_socket = new CRCErrorSocket( this );
|
m_socket = new CCrashReportSocket( this );
|
||||||
|
|
||||||
QTimer::singleShot( 1, this, SLOT( onLoad() ) );
|
QTimer::singleShot( 1, this, SLOT( onLoad() ) );
|
||||||
|
|
||||||
|
@ -42,12 +42,12 @@ QWidget( parent )
|
||||||
connect( m_socket, SIGNAL( reportFailed() ), this, SLOT( onReportFailed() ) );
|
connect( m_socket, SIGNAL( reportFailed() ), this, SLOT( onReportFailed() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
CRCErrorWidget::~CRCErrorWidget()
|
CCrashReportWidget::~CCrashReportWidget()
|
||||||
{
|
{
|
||||||
m_socket = NULL;
|
m_socket = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRCErrorWidget::onLoad()
|
void CCrashReportWidget::onLoad()
|
||||||
{
|
{
|
||||||
QFile f( m_fileName );
|
QFile f( m_fileName );
|
||||||
bool b = f.open( QFile::ReadOnly | QFile::Text );
|
bool b = f.open( QFile::ReadOnly | QFile::Text );
|
||||||
|
@ -64,12 +64,12 @@ void CRCErrorWidget::onLoad()
|
||||||
f.close();
|
f.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRCErrorWidget::onSendClicked()
|
void CCrashReportWidget::onSendClicked()
|
||||||
{
|
{
|
||||||
m_ui.sendButton->setEnabled( false );
|
m_ui.sendButton->setEnabled( false );
|
||||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||||
|
|
||||||
SRCErrorData data;
|
SCrashReportData data;
|
||||||
data.description = m_ui.descriptionEdit->toPlainText();
|
data.description = m_ui.descriptionEdit->toPlainText();
|
||||||
data.report = m_ui.reportEdit->toPlainText();
|
data.report = m_ui.reportEdit->toPlainText();
|
||||||
data.email = m_ui.emailEdit->text();
|
data.email = m_ui.emailEdit->text();
|
||||||
|
@ -77,17 +77,17 @@ void CRCErrorWidget::onSendClicked()
|
||||||
m_socket->sendReport( data );
|
m_socket->sendReport( data );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRCErrorWidget::onCancelClicked()
|
void CCrashReportWidget::onCancelClicked()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRCErrorWidget::onCBClicked()
|
void CCrashReportWidget::onCBClicked()
|
||||||
{
|
{
|
||||||
m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() );
|
m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRCErrorWidget::onReportSent()
|
void CCrashReportWidget::onReportSent()
|
||||||
{
|
{
|
||||||
QApplication::setOverrideCursor( Qt::ArrowCursor );
|
QApplication::setOverrideCursor( Qt::ArrowCursor );
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ void CRCErrorWidget::onReportSent()
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CRCErrorWidget::onReportFailed()
|
void CCrashReportWidget::onReportFailed()
|
||||||
{
|
{
|
||||||
QApplication::setOverrideCursor( Qt::ArrowCursor );
|
QApplication::setOverrideCursor( Qt::ArrowCursor );
|
||||||
|
|
||||||
|
|
|
@ -21,16 +21,16 @@
|
||||||
#define RCERROR_WIDGET
|
#define RCERROR_WIDGET
|
||||||
|
|
||||||
|
|
||||||
#include "ui_rcerror_widget.h"
|
#include "ui_crash_report_widget.h"
|
||||||
|
|
||||||
class CRCErrorSocket;
|
class CCrashReportSocket;
|
||||||
|
|
||||||
class CRCErrorWidget : public QWidget
|
class CCrashReportWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CRCErrorWidget( QWidget *parent = NULL );
|
CCrashReportWidget( QWidget *parent = NULL );
|
||||||
~CRCErrorWidget();
|
~CCrashReportWidget();
|
||||||
|
|
||||||
void setFileName( const char *fn ){ m_fileName = fn; }
|
void setFileName( const char *fn ){ m_fileName = fn; }
|
||||||
|
|
||||||
|
@ -44,9 +44,9 @@ private Q_SLOTS:
|
||||||
void onReportFailed();
|
void onReportFailed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::RCErrorWidget m_ui;
|
Ui::CrashReportWidget m_ui;
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
CRCErrorSocket *m_socket;
|
CCrashReportSocket *m_socket;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>RCErrorWidget</class>
|
<class>CrashReportWidget</class>
|
||||||
<widget class="QWidget" name="RCErrorWidget">
|
<widget class="QWidget" name="CrashReportWidget">
|
||||||
<property name="windowModality">
|
<property name="windowModality">
|
||||||
<enum>Qt::ApplicationModal</enum>
|
<enum>Qt::ApplicationModal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Reference in a new issue