From 439302da23d7aab40dce14bd3d4788483082797e Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Thu, 19 Feb 2015 00:20:18 +0100 Subject: [PATCH] Added the Ryzom Core Error Reporter's skeleton. --- code/nel/CMakeLists.txt | 3 ++ code/nel/rcerror/CMakeLists.txt | 37 +++++++++++++ code/nel/rcerror/rcerror.cpp | 50 ++++++++++++++++++ code/nel/rcerror/rcerror_socket.cpp | 20 +++++++ code/nel/rcerror/rcerror_socket.h | 23 ++++++++ code/nel/rcerror/rcerror_widget.cpp | 70 ++++++++++++++++++++++++ code/nel/rcerror/rcerror_widget.h | 47 +++++++++++++++++ code/nel/rcerror/rcerror_widget.ui | 82 +++++++++++++++++++++++++++++ 8 files changed, 332 insertions(+) create mode 100644 code/nel/rcerror/CMakeLists.txt create mode 100644 code/nel/rcerror/rcerror.cpp create mode 100644 code/nel/rcerror/rcerror_socket.cpp create mode 100644 code/nel/rcerror/rcerror_socket.h create mode 100644 code/nel/rcerror/rcerror_widget.cpp create mode 100644 code/nel/rcerror/rcerror_widget.h create mode 100644 code/nel/rcerror/rcerror_widget.ui diff --git a/code/nel/CMakeLists.txt b/code/nel/CMakeLists.txt index 53bf071e3..00290d097 100644 --- a/code/nel/CMakeLists.txt +++ b/code/nel/CMakeLists.txt @@ -84,3 +84,6 @@ IF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN) ADD_SUBDIRECTORY(tools) ENDIF(WITH_NEL_TOOLS OR WITH_NEL_MAXPLUGIN) +IF(WITH_QT) + ADD_SUBDIRECTORY(rcerror) +ENDIF(WITH_QT) diff --git a/code/nel/rcerror/CMakeLists.txt b/code/nel/rcerror/CMakeLists.txt new file mode 100644 index 000000000..412da9b6c --- /dev/null +++ b/code/nel/rcerror/CMakeLists.txt @@ -0,0 +1,37 @@ +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SRC_DIR} ${QT_INCLUDES}) +FILE(GLOB RCERROR_SRC *.cpp) +FILE(GLOB RCERROR_HDR *h) + +SET(RCERROR_MOC_HDR +rcerror_socket.h +rcerror_widget.h +) + +SET(RCERROR_UI +rcerror_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(RCERROR_MOC_SRC ${RCERROR_MOC_HDR}) +QT4_WRAP_UI(RCERROR_UI_HDR ${RCERROR_UI}) + +SOURCE_GROUP(QtResources FILES ${RCERROR_UI}) +SOURCE_GROUP(QtGeneratedUiHdr FILES ${RCERROR_UI_HDR}) +SOURCE_GROUP(QtGeneratedMocQrcSrc FILES ${RCERROR_MOC_SRC}) +SOURCE_GROUP("source files" FILES ${RCERROR_SRC}) +SOURCE_GROUP("header files" FILES ${RCERROR_HDR}) + +ADD_EXECUTABLE(rcerror WIN32 MACOSX_BUNDLE ${RCERROR_SRC} ${RCERROR_MOC_HDR} ${RCERROR_MOC_SRC} ${RCERROR_UI_HDR}) +TARGET_LINK_LIBRARIES(rcerror ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY}) + +NL_DEFAULT_PROPS(rcerror "Ryzom Core Error Reporter") +NL_ADD_RUNTIME_FLAGS(rcerror) + diff --git a/code/nel/rcerror/rcerror.cpp b/code/nel/rcerror/rcerror.cpp new file mode 100644 index 000000000..6fa876e81 --- /dev/null +++ b/code/nel/rcerror/rcerror.cpp @@ -0,0 +1,50 @@ +// Ryzom Core MMORPG framework - Error Reporter +// +// Copyright (C) 2015 Laszlo Kis-Adam +// Copyright (C) 2010 Ryzom Core +// +// 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 . + + +#include "rcerror_widget.h" +#include +#include + +int main( int argc, char **argv ) +{ + QApplication app( argc, argv ); + +#if 0 + + if( argc < 2 ) + { + QMessageBox::information( NULL, + QObject::tr( "Error" ), + QObject::tr( "Need to specify a path to the error report." ) ); + return 1; + } +#endif + + RCErrorWidget w; + +#if 0 + w.setFileName( argv[ 1 ] ); +#else + w.setFileName( "log.log" ); +#endif + + w.show(); + + return app.exec(); +} \ No newline at end of file diff --git a/code/nel/rcerror/rcerror_socket.cpp b/code/nel/rcerror/rcerror_socket.cpp new file mode 100644 index 000000000..f39946423 --- /dev/null +++ b/code/nel/rcerror/rcerror_socket.cpp @@ -0,0 +1,20 @@ +// Ryzom Core MMORPG framework - Error Reporter +// +// Copyright (C) 2015 Laszlo Kis-Adam +// Copyright (C) 2010 Ryzom Core +// +// 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 . + +#include "rcerror_socket.h" + diff --git a/code/nel/rcerror/rcerror_socket.h b/code/nel/rcerror/rcerror_socket.h new file mode 100644 index 000000000..8cd9f54ad --- /dev/null +++ b/code/nel/rcerror/rcerror_socket.h @@ -0,0 +1,23 @@ +// Ryzom Core MMORPG framework - Error Reporter +// +// Copyright (C) 2015 Laszlo Kis-Adam +// Copyright (C) 2010 Ryzom Core +// +// 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 . + + +#ifndef RCERROR_SOCKET +#define RCERROR_SOCKET +#endif + diff --git a/code/nel/rcerror/rcerror_widget.cpp b/code/nel/rcerror/rcerror_widget.cpp new file mode 100644 index 000000000..a50b273d3 --- /dev/null +++ b/code/nel/rcerror/rcerror_widget.cpp @@ -0,0 +1,70 @@ +// Ryzom Core MMORPG framework - Error Reporter +// +// Copyright (C) 2015 Laszlo Kis-Adam +// Copyright (C) 2010 Ryzom Core +// +// 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 . + + +#include "rcerror_widget.h" +#include +#include +#include + +RCErrorWidget::RCErrorWidget( QWidget *parent ) : +QWidget( parent ) +{ + m_ui.setupUi( this ); + QTimer::singleShot( 1, this, SLOT( onLoad() ) ); + + connect( m_ui.sendButton, SIGNAL( clicked( bool ) ), this, SLOT( onSendClicked() ) ); + connect( m_ui.canceButton, SIGNAL( clicked( bool ) ), this, SLOT( onCancelClicked() ) ); + connect( m_ui.emailCB, SIGNAL( stateChanged( int ) ), this, SLOT( onCBClicked() ) ); +} + +RCErrorWidget::~RCErrorWidget() +{ +} + +void RCErrorWidget::onLoad() +{ + QFile f( m_fileName ); + bool b = f.open( QFile::ReadOnly | QFile::Text ); + if( !b ) + { + return; + } + + QTextStream ss( &f ); + m_ui.reportEdit->setPlainText( ss.readAll() ); + f.close(); +} + +void RCErrorWidget::onSendClicked() +{ + close(); +} + +void RCErrorWidget::onCancelClicked() +{ + close(); +} + +void RCErrorWidget::onCBClicked() +{ + m_ui.emailEdit->setEnabled( m_ui.emailCB->isChecked() ); +} + + + diff --git a/code/nel/rcerror/rcerror_widget.h b/code/nel/rcerror/rcerror_widget.h new file mode 100644 index 000000000..ae5629e55 --- /dev/null +++ b/code/nel/rcerror/rcerror_widget.h @@ -0,0 +1,47 @@ +// Ryzom Core MMORPG framework - Error Reporter +// +// Copyright (C) 2015 Laszlo Kis-Adam +// Copyright (C) 2010 Ryzom Core +// +// 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 . + + +#ifndef RCERROR_WIDGET +#define RCERROR_SOCKET + + +#include "ui_rcerror_widget.h" + +class RCErrorWidget : public QWidget +{ + Q_OBJECT +public: + RCErrorWidget( QWidget *parent = NULL ); + ~RCErrorWidget(); + + void setFileName( const char *fn ){ m_fileName = fn; } + +private Q_SLOTS: + void onLoad(); + void onSendClicked(); + void onCancelClicked(); + void onCBClicked(); + +private: + Ui::RCErrorWidget m_ui; + QString m_fileName; +}; + +#endif + diff --git a/code/nel/rcerror/rcerror_widget.ui b/code/nel/rcerror/rcerror_widget.ui new file mode 100644 index 000000000..72e5f92f5 --- /dev/null +++ b/code/nel/rcerror/rcerror_widget.ui @@ -0,0 +1,82 @@ + + + RCErrorWidget + + + Qt::ApplicationModal + + + + 0 + 0 + 400 + 407 + + + + Ryzom Core error report + + + + + + What were you doing when the crash occured? + + + + + + + + + + Contents of the report ( automatically generated ) + + + + + + + true + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Email me if you have further questions, or updates on this issue + + + + + + + false + + + Enter your email address here + + + + + + + Send + + + + + + + Cancel + + + + + + + +