X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/12f5e1e78fe906050ff2fee9529476db332633f0..403695b3236ce0ccca5ba7493736926566c9addc:/interface/wx/debugrpt.h diff --git a/interface/wx/debugrpt.h b/interface/wx/debugrpt.h index 04e52b1d97..65aa1a5185 100644 --- a/interface/wx/debugrpt.h +++ b/interface/wx/debugrpt.h @@ -3,7 +3,7 @@ // Purpose: interface of wxDebugReport* // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @@ -44,7 +44,7 @@ public: chose to cancel report generation or removed all files from it. */ - virtual bool Show(wxDebugReport& dbgrpt) const; + virtual bool Show(wxDebugReport& dbgrpt) const = 0; }; @@ -67,11 +67,49 @@ public: */ wxDebugReportCompress(); + /** + Set the directory where the debug report should be generated. + + By default, the debug report is generated under user temporary files + directory. This is usually fine if it is meant to be processed in some + way (e.g. automatically uploaded to a remote server) but if the user is + asked to manually upload or send the report, it may be more convenient + to generate it in e.g. the users home directory and this function + allows to do this. + + Notice that it should be called before wxDebugReport::Process() or it + has no effect. + + @param dir + The full path to an existing directory where the debug report file + should be generated. + + @since 2.9.1 + */ + void SetCompressedFileDirectory(const wxString& dir); + + /** + Set the base name of the generated debug report file. + + This function is similar to SetCompressedFileDirectory() but allows to + change the base name of the file. Notice that the file extension will + always be @c .zip. + + By default, a unique name constructed from wxApp::GetAppName(), the + current process id and the current date and time is used. + + @param name + The base name (i.e. without extension) of the file. + + @since 2.9.1 + */ + void SetCompressedFileBaseName(const wxString& name); + /** Returns the full path of the compressed file (empty if creation failed). */ - const wxString GetCompressedFileName() const; + const wxString& GetCompressedFileName() const; }; @@ -135,7 +173,7 @@ public: constructor with all the files it contains. Call Reset() to prevent this from happening. */ - ~wxDebugReport(); + virtual ~wxDebugReport(); /** Adds all available information to the report. Currently this includes a @@ -148,7 +186,7 @@ public: Add an XML file containing the current or exception context and the stack trace. */ - bool AddContext(Context ctx); + virtual bool AddContext(Context ctx); /** The same as calling AddContext(Context_Current). @@ -167,7 +205,7 @@ public: (@c dbghlp32.dll can be installed under older systems to make minidumps available). */ - bool AddDump(Context ctx); + virtual bool AddDump(Context ctx); /** The same as calling AddContext(Context_Exception). @@ -182,13 +220,15 @@ public: /** Add another file to the report. If @a filename is an absolute path, it is copied to a file in the debug report directory with the same name. - Otherwise the file should already exist in this directory - @a description only exists to be displayed to the user in the report - summary shown by wxDebugReportPreview. + Otherwise the file will be searched in the temporary directory returned + by GetDirectory(). + + The argument @a description only exists to be displayed to the user in + the report summary shown by wxDebugReportPreview. @see GetDirectory(), AddText() */ - void AddFile(const wxString& filename, const wxString& description); + virtual void AddFile(const wxString& filename, const wxString& description); /** This is a convenient wrapper around AddFile(). It creates the file with @@ -201,30 +241,6 @@ public: bool AddText(const wxString& filename, const wxString& text, const wxString& description); - /** - This function may be overridden to add arbitrary custom context to the - XML context file created by AddContext(). By default, it does nothing. - */ - void DoAddCustomContext(wxXmlNode* nodeRoot); - - /** - This function may be overridden to modify the contents of the exception - tag in the XML context file. - */ - bool DoAddExceptionInfo(wxXmlNode* nodeContext); - - /** - This function may be overridden to modify the contents of the modules - tag in the XML context file. - */ - bool DoAddLoadedModules(wxXmlNode* nodeModules); - - /** - This function may be overridden to modify the contents of the system - tag in the XML context file. - */ - bool DoAddSystemInfo(wxXmlNode* nodeSystemInfo); - /** This method should be used to construct the full name of the files which you wish to add to the report using AddFile(). @@ -232,7 +248,7 @@ public: @return The name of the temporary directory used for the files in this report. */ - const wxString GetDirectory() const; + const wxString& GetDirectory() const; /** Retrieves the name (relative to GetDirectory()) and the description of @@ -250,7 +266,7 @@ public: Gets the name used as a base name for various files, by default wxApp::GetAppName() is used. */ - wxString GetReportName() const; + virtual wxString GetReportName() const; /** Returns @true if the object was successfully initialized. If this @@ -277,6 +293,32 @@ public: after this as it becomes uninitialized and invalid. */ void Reset(); + +protected: + + /** + This function may be overridden to add arbitrary custom context to the + XML context file created by AddContext(). By default, it does nothing. + */ + virtual void DoAddCustomContext(wxXmlNode* nodeRoot); + + /** + This function may be overridden to modify the contents of the exception + tag in the XML context file. + */ + virtual bool DoAddExceptionInfo(wxXmlNode* nodeContext); + + /** + This function may be overridden to modify the contents of the modules + tag in the XML context file. + */ + virtual bool DoAddLoadedModules(wxXmlNode* nodeModules); + + /** + This function may be overridden to modify the contents of the system + tag in the XML context file. + */ + virtual bool DoAddSystemInfo(wxXmlNode* nodeSystemInfo); }; @@ -335,12 +377,13 @@ public: const wxString& action, const wxString& curl = "curl"); +protected: /** This function may be overridden in a derived class to show the output from curl: this may be an HTML page or anything else that the server returned. Value returned by this function becomes the return value of wxDebugReport::Process(). */ - bool OnServerReply(const wxArrayString& reply); + virtual bool OnServerReply(const wxArrayString& reply); };