1
/* This file is part of Clementine.
2
Copyright 2010, David Sansome <me@davidsansome.com>
4
Clementine is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
9
Clementine is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
18
#ifndef CRASHREPORTING_H
19
#define CRASHREPORTING_H
23
#include <boost/scoped_ptr.hpp>
26
class QNetworkAccessManager;
27
class QProgressDialog;
29
namespace google_breakpad {
30
class ExceptionHandler;
34
// Wraps google_breakpad::ExceptionHandler - while an instance of this class
35
// is alive crashes will be handled.
36
class CrashReporting {
41
// If the commandline contains the --send-crash-report option, the user will
42
// be prompted to send the crash report and the function will return true
43
// (in which case the caller should exit the program). Otherwise the function
45
static bool SendCrashReport(int argc, char** argv);
47
// If this is set then the application is exec'd again with
48
// --send-crash-report when a crash happens.
49
static void SetApplicationPath(const QString& path);
52
// Prints the message to stdout without using libc.
53
static void Print(const char* message);
56
static bool Handler(const char* dump_path,
57
const char* minidump_id,
62
Q_DISABLE_COPY(CrashReporting);
64
static const char* kSendCrashReportOption;
67
boost::scoped_ptr<google_breakpad::ExceptionHandler> handler_;
71
// Asks the user if he wants to send a crash report, and displays a progress
72
// dialog while uploading it if he does.
73
class CrashSender : public QObject {
77
CrashSender(const QString& path);
79
// Returns false if the user doesn't want to send the crash report (caller
80
// should exit), or true if he does (caller should start the Qt event loop).
84
void RedirectFinished();
85
void UploadProgress(qint64 bytes);
88
static const char* kUploadURL;
90
QNetworkAccessManager* network_;
94
QProgressDialog* progress_;
97
#endif // CRASHREPORTING_H