mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* CrashReporter now also sends Tomahawk.log and the proper version number to our breakpad server.
This commit is contained in:
@@ -13,8 +13,8 @@ QT4_WRAP_UI( crashreporter_UI_HEADERS ${crashreporter_UI} )
|
|||||||
QT4_ADD_RESOURCES( crashreporter_RC_RCC ${crashreporter_RC} )
|
QT4_ADD_RESOURCES( crashreporter_RC_RCC ${crashreporter_RC} )
|
||||||
|
|
||||||
INCLUDE( ${QT_USE_FILE} )
|
INCLUDE( ${QT_USE_FILE} )
|
||||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
|
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/src ../../libtomahawk )
|
||||||
ADD_DEFINITIONS( ${QT_DEFINITIONS} )
|
ADD_DEFINITIONS( ${QT_DEFINITIONS} )
|
||||||
|
|
||||||
ADD_EXECUTABLE( CrashReporter ${crashreporter_SOURCES} ${crashreporter_HEADERS_MOC} ${crashreporter_UI_HEADERS} ${crashreporter_RC_RCC} )
|
ADD_EXECUTABLE( CrashReporter ${crashreporter_SOURCES} ${crashreporter_HEADERS_MOC} ${crashreporter_UI_HEADERS} ${crashreporter_RC_RCC} )
|
||||||
TARGET_LINK_LIBRARIES( CrashReporter ${QT_LIBRARIES} )
|
TARGET_LINK_LIBRARIES( CrashReporter ${QT_LIBRARIES} tomahawklib )
|
||||||
|
@@ -25,6 +25,9 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QHttp>
|
#include <QHttp>
|
||||||
|
|
||||||
|
#include "utils/tomahawkutils.h"
|
||||||
|
|
||||||
|
#define LOGFILE TomahawkUtils::appLogDir().filePath( "Tomahawk.log" ).toLocal8Bit()
|
||||||
#define RESPATH ":/data/"
|
#define RESPATH ":/data/"
|
||||||
|
|
||||||
|
|
||||||
@@ -40,7 +43,6 @@ CrashReporter::CrashReporter( const QStringList& args )
|
|||||||
ui.progressLabel->setPalette( Qt::gray );
|
ui.progressLabel->setPalette( Qt::gray );
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
// macify++
|
|
||||||
QFont f = ui.bottomLabel->font();
|
QFont f = ui.bottomLabel->font();
|
||||||
f.setPointSize( 10 );
|
f.setPointSize( 10 );
|
||||||
ui.bottomLabel->setFont( f );
|
ui.bottomLabel->setFont( f );
|
||||||
@@ -55,12 +57,14 @@ CrashReporter::CrashReporter( const QStringList& args )
|
|||||||
ui.bottomLabel->setIndent( 1 );
|
ui.bottomLabel->setIndent( 1 );
|
||||||
|
|
||||||
// adjust the spacer since we adjusted the spacing above
|
// adjust the spacer since we adjusted the spacing above
|
||||||
for (int x = 0; x < ui.vboxLayout->count(); ++x)
|
for ( int x = 0; x < ui.vboxLayout->count(); ++x )
|
||||||
if (QSpacerItem* spacer = ui.vboxLayout->itemAt( x )->spacerItem())
|
{
|
||||||
|
if ( QSpacerItem* spacer = ui.vboxLayout->itemAt( x )->spacerItem() )
|
||||||
{
|
{
|
||||||
spacer->changeSize( 6, 2, QSizePolicy::Minimum, QSizePolicy::Fixed );
|
spacer->changeSize( 6, 2, QSizePolicy::Minimum, QSizePolicy::Fixed );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif //Q_WS_MAC
|
#endif //Q_WS_MAC
|
||||||
|
|
||||||
m_http = new QHttp( "oops.tomahawk-player.org", 80, this );
|
m_http = new QHttp( "oops.tomahawk-player.org", 80, this );
|
||||||
@@ -72,9 +76,9 @@ CrashReporter::CrashReporter( const QStringList& args )
|
|||||||
m_minidump = m_dir + '/' + args.value( 2 ) + ".dmp";
|
m_minidump = m_dir + '/' + args.value( 2 ) + ".dmp";
|
||||||
m_product_name = args.value( 3 );
|
m_product_name = args.value( 3 );
|
||||||
|
|
||||||
QTimer::singleShot( 0, this, SLOT(send()) );
|
|
||||||
|
|
||||||
setFixedSize( sizeHint() );
|
setFixedSize( sizeHint() );
|
||||||
|
|
||||||
|
QTimer::singleShot( 0, this, SLOT( send() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -94,7 +98,7 @@ CrashReporter::send()
|
|||||||
|
|
||||||
// socorro expects a 10 digit build id
|
// socorro expects a 10 digit build id
|
||||||
QRegExp rx( "(\\d+\\.\\d+\\.\\d+).(\\d+)" );
|
QRegExp rx( "(\\d+\\.\\d+\\.\\d+).(\\d+)" );
|
||||||
rx.exactMatch( "0.2.99" );
|
rx.exactMatch( TomahawkUtils::appFriendlyVersion() );
|
||||||
QString const version = rx.cap( 1 );
|
QString const version = rx.cap( 1 );
|
||||||
QString const buildId = rx.cap( 2 ).leftJustified( 10, '0' );
|
QString const buildId = rx.cap( 2 ).leftJustified( 10, '0' );
|
||||||
|
|
||||||
@@ -103,7 +107,7 @@ CrashReporter::send()
|
|||||||
QList<Pair> pairs;
|
QList<Pair> pairs;
|
||||||
pairs << Pair( "BuildID", buildId.toUtf8() )
|
pairs << Pair( "BuildID", buildId.toUtf8() )
|
||||||
<< Pair( "ProductName", m_product_name.toUtf8() )
|
<< Pair( "ProductName", m_product_name.toUtf8() )
|
||||||
<< Pair( "Version", version.toUtf8() )
|
<< Pair( "Version", TomahawkUtils::appFriendlyVersion().toLocal8Bit() )
|
||||||
<< Pair( "Vendor", "Tomahawk" )
|
<< Pair( "Vendor", "Tomahawk" )
|
||||||
<< Pair( "timestamp", QByteArray::number( QDateTime::currentDateTime().toTime_t() ) );
|
<< Pair( "timestamp", QByteArray::number( QDateTime::currentDateTime().toTime_t() ) );
|
||||||
|
|
||||||
@@ -126,14 +130,13 @@ CrashReporter::send()
|
|||||||
|
|
||||||
// add logfile
|
// add logfile
|
||||||
body += "--thkboundary\r\n";
|
body += "--thkboundary\r\n";
|
||||||
body += "Content-Disposition: form-data; name=\"upload_file_containerlog\"; filename=\"container.log\"\r\n";
|
body += "Content-Disposition: form-data; name=\"upload_file_tomahawklog\"; filename=\"Tomahawk.log\"\r\n";
|
||||||
body += "Content-Type: application/x-gzip\r\n";
|
body += "Content-Type: application/x-gzip\r\n";
|
||||||
body += "\r\n";
|
body += "\r\n";
|
||||||
// body += qCompress( contents( "Tomahawk.log" ) );
|
body += qCompress( contents( LOGFILE ) );
|
||||||
body += "\r\n";
|
body += "\r\n";
|
||||||
body += "--thkboundary--\r\n";
|
body += "--thkboundary--\r\n";
|
||||||
|
|
||||||
//////
|
|
||||||
QHttpRequestHeader header( "POST", "/addreport.php" );
|
QHttpRequestHeader header( "POST", "/addreport.php" );
|
||||||
header.setContentType( "multipart/form-data; boundary=thkboundary" );
|
header.setContentType( "multipart/form-data; boundary=thkboundary" );
|
||||||
header.setValue( "HOST", "oops.tomahawk-player.org" );
|
header.setValue( "HOST", "oops.tomahawk-player.org" );
|
||||||
@@ -179,5 +182,5 @@ CrashReporter::onFail( int error, const QString& errorString )
|
|||||||
{
|
{
|
||||||
ui.button->setText( tr( "Close" ) );
|
ui.button->setText( tr( "Close" ) );
|
||||||
ui.progressLabel->setText( tr( "Failed to send crash info." ) );
|
ui.progressLabel->setText( tr( "Failed to send crash info." ) );
|
||||||
qDebug() << "Error: " << error << errorString;
|
qDebug() << "Error:" << error << errorString;
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
|
|
||||||
#define LOGFILE TomahawkUtils::appLogDir().filePath( "Tomahawk.log" ).toLocal8Bit()
|
#define LOGFILE TomahawkUtils::appLogDir().filePath( "Tomahawk.log" ).toLocal8Bit()
|
||||||
#define LOGFILE_SIZE 1024 * 512
|
#define LOGFILE_SIZE 1024 * 256
|
||||||
|
|
||||||
#define RELEASE_LEVEL_THRESHOLD 0
|
#define RELEASE_LEVEL_THRESHOLD 0
|
||||||
#define DEBUG_LEVEL_THRESHOLD LOGEXTRA
|
#define DEBUG_LEVEL_THRESHOLD LOGEXTRA
|
||||||
|
Reference in New Issue
Block a user