michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef CRASHREPORTER_OSX_H__ michael@0: #define CRASHREPORTER_OSX_H__ michael@0: michael@0: #include michael@0: #include "HTTPMultipartUpload.h" michael@0: #include "crashreporter.h" michael@0: michael@0: // Defined below michael@0: @class TextViewWithPlaceHolder; michael@0: michael@0: @interface CrashReporterUI : NSObject michael@0: { michael@0: IBOutlet NSWindow* mWindow; michael@0: michael@0: /* Crash reporter view */ michael@0: IBOutlet NSTextField* mHeaderLabel; michael@0: IBOutlet NSTextField* mDescriptionLabel; michael@0: IBOutlet NSButton* mViewReportButton; michael@0: IBOutlet NSScrollView* mCommentScrollView; michael@0: IBOutlet TextViewWithPlaceHolder* mCommentText; michael@0: IBOutlet NSButton* mSubmitReportButton; michael@0: IBOutlet NSButton* mIncludeURLButton; michael@0: IBOutlet NSButton* mEmailMeButton; michael@0: IBOutlet NSTextField* mEmailText; michael@0: IBOutlet NSButton* mCloseButton; michael@0: IBOutlet NSButton* mRestartButton; michael@0: IBOutlet NSProgressIndicator* mProgressIndicator; michael@0: IBOutlet NSTextField* mProgressText; michael@0: michael@0: /* Error view */ michael@0: IBOutlet NSView* mErrorView; michael@0: IBOutlet NSTextField* mErrorHeaderLabel; michael@0: IBOutlet NSTextField* mErrorLabel; michael@0: IBOutlet NSButton* mErrorCloseButton; michael@0: michael@0: /* For "show info" alert */ michael@0: IBOutlet NSWindow* mViewReportWindow; michael@0: IBOutlet NSTextView* mViewReportTextView; michael@0: IBOutlet NSButton* mViewReportOkButton; michael@0: michael@0: HTTPMultipartUpload* mPost; michael@0: } michael@0: michael@0: - (void)showCrashUI:(const std::string&)dumpfile michael@0: queryParameters:(const StringTable&)queryParameters michael@0: sendURL:(const std::string&)sendURL; michael@0: - (void)showErrorUI:(const std::string&)dumpfile; michael@0: - (void)showReportInfo; michael@0: - (void)maybeSubmitReport; michael@0: - (void)closeMeDown:(id)unused; michael@0: michael@0: - (IBAction)submitReportClicked:(id)sender; michael@0: - (IBAction)viewReportClicked:(id)sender; michael@0: - (IBAction)viewReportOkClicked:(id)sender; michael@0: - (IBAction)closeClicked:(id)sender; michael@0: - (IBAction)restartClicked:(id)sender; michael@0: - (IBAction)includeURLClicked:(id)sender; michael@0: - (IBAction)emailMeClicked:(id)sender; michael@0: michael@0: - (void)controlTextDidChange:(NSNotification *)note; michael@0: - (void)textDidChange:(NSNotification *)aNotification; michael@0: - (BOOL)textView:(NSTextView *)aTextView shouldChangeTextInRange:(NSRange)affectedCharRange replacementString:(NSString *)replacementString; michael@0: michael@0: - (void)doInitialResizing; michael@0: - (float)setStringFitVertically:(NSControl*)control michael@0: string:(NSString*)str michael@0: resizeWindow:(BOOL)resizeWindow; michael@0: - (void)setView:(NSView*)v animate: (BOOL) animate; michael@0: - (void)enableControls:(BOOL)enabled; michael@0: - (void)updateSubmit; michael@0: - (void)updateURL; michael@0: - (void)updateEmail; michael@0: - (void)sendReport; michael@0: - (bool)setupPost; michael@0: - (void)uploadThread:(HTTPMultipartUpload*)post; michael@0: - (void)uploadComplete:(NSData*)data; michael@0: michael@0: -(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication; michael@0: -(void)applicationWillTerminate:(NSNotification *)aNotification; michael@0: michael@0: @end michael@0: michael@0: /* michael@0: * Subclass NSTextView to provide a text view with placeholder text. michael@0: * Also provide a setEnabled implementation. michael@0: */ michael@0: @interface TextViewWithPlaceHolder : NSTextView { michael@0: NSMutableAttributedString *mPlaceHolderString; michael@0: } michael@0: michael@0: - (BOOL)becomeFirstResponder; michael@0: - (void)drawRect:(NSRect)rect; michael@0: - (BOOL)resignFirstResponder; michael@0: - (void)setPlaceholder:(NSString*)placeholder; michael@0: - (void)insertTab:(id)sender; michael@0: - (void)insertBacktab:(id)sender; michael@0: - (void)setEnabled:(BOOL)enabled; michael@0: - (void)dealloc; michael@0: michael@0: @end michael@0: michael@0: #endif