Vidalia 0.2.12

CrashReportDialog.h

Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.vidalia-project.net/. No part of Vidalia, including this file,
00007 **  may be copied, modified, propagated, or distributed except according to the
00008 **  terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file CrashReportDialog.h
00013 ** \brief Dialog that asks the user whether they would like to
00014 ** submit the crash report, along with optional additional details
00015 ** about what they were doing at the time of the crash.
00016 */
00017 
00018 #include "ui_CrashReportDialog.h"
00019 
00020 #include <QHash>
00021 #include <QByteArray>
00022 
00023 class QString;
00024 
00025 
00026 class CrashReportDialog : public QDialog
00027 {
00028   Q_OBJECT
00029 
00030 public:
00031   /** Default constructor.
00032    */
00033   CrashReportDialog(QWidget *parent = 0);
00034 
00035   /** Sets the crash <b>annotations</b> key-value pairs associated with
00036    * the generated minidump.
00037    */
00038   void setCrashAnnotations(const QHash<QString,QString> &annotations);
00039 
00040   /** Sets the <b>minidump</b> contents generated by the crashed
00041    * applications exception handler.
00042    */
00043   void setMinidump(const QString &id, const QByteArray &minidump);
00044 
00045   /** Uploads the generated minidump, user comments, and any additional
00046    * crash annotations generated by the exception handler to the crash
00047    * reporting server.
00048    * \sa setMinidump()
00049    * \sa setCrashAnnotations()
00050    */
00051   void submitCrashReport();
00052 
00053 public slots:
00054   /** Called when the user clicks the "Restart Vidalia" button on the
00055    * dialog. If the "Submit my crash report..." checkbox is checked, it
00056    * will first attempt to submit the crash report. After that is complete,
00057    * it will try to restart the Vidalia process with any arguments specified
00058    * in the crash annotations file.
00059    * \sa setCrashAnnotations()
00060    */
00061   virtual void accept();
00062 
00063   /** Called when the user clicks the "Don't Restart" button on the
00064    * dialog. If the "Submit my crash report.." checkbox is checked, it
00065    * will attempt to submit the crash report and then exit without
00066    * restarting Vidalia.
00067    */
00068   virtual void reject();
00069 
00070 private:
00071   /** Each minidump is given a randomly-generated GUID when it is created,
00072    * which is used to form the minidump filename. This ID is also used by
00073    * the crash reporting server when accepting and processing uploaded
00074    * minidumps.
00075    */
00076   QString _minidumpId;
00077 
00078   /** Contents of the generated minidump.
00079    */
00080   QByteArray _minidump;
00081 
00082   /** Set of parsed key-value pairs generated by the crashed application's
00083    * exception handler and written alongside the minidump.
00084    */
00085   QHash<QString,QString> _annotations;
00086 
00087   /** Qt Designer created object.
00088    */
00089   Ui::CrashReportDialog ui;
00090 };
00091