]> git.sesse.net Git - vlc/blob - modules/gui/macosx/BWQuincyManager.h
macosx: lock access to addon_entry_t
[vlc] / modules / gui / macosx / BWQuincyManager.h
1 /*
2  * Author: Andreas Linde <mail@andreaslinde.de>
3  *         Kent Sutherland
4  *
5  * Copyright (c) 2011 Andreas Linde & Kent Sutherland.
6  * All rights reserved.
7  *
8  * Permission is hereby granted, free of charge, to any person
9  * obtaining a copy of this software and associated documentation
10  * files (the "Software"), to deal in the Software without
11  * restriction, including without limitation the rights to use,
12  * copy, modify, merge, publish, distribute, sublicense, and/or sell
13  * copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following
15  * conditions:
16  *
17  * The above copyright notice and this permission notice shall be
18  * included in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  */
29
30 #import <Cocoa/Cocoa.h>
31
32 typedef enum CrashAlertType {
33   CrashAlertTypeSend = 0,
34   CrashAlertTypeFeedback = 1,
35 } CrashAlertType;
36
37 typedef enum CrashReportStatus {
38   // This app version is set to discontinued, no new crash reports accepted by the server
39   CrashReportStatusFailureVersionDiscontinued = -30,
40
41   // XML: Sender ersion string contains not allowed characters, only alphanumberical including space and . are allowed
42   CrashReportStatusFailureXMLSenderVersionNotAllowed = -21,
43
44   // XML: Version string contains not allowed characters, only alphanumberical including space and . are allowed
45   CrashReportStatusFailureXMLVersionNotAllowed = -20,
46
47   // SQL for adding a symoblicate todo entry in the database failed
48   CrashReportStatusFailureSQLAddSymbolicateTodo = -18,
49
50   // SQL for adding crash log in the database failed
51   CrashReportStatusFailureSQLAddCrashlog = -17,
52
53   // SQL for adding a new version in the database failed
54   CrashReportStatusFailureSQLAddVersion = -16,
55
56   // SQL for checking if the version is already added in the database failed
57   CrashReportStatusFailureSQLCheckVersionExists = -15,
58
59   // SQL for creating a new pattern for this bug and set amount of occurrances to 1 in the database failed
60   CrashReportStatusFailureSQLAddPattern = -14,
61
62   // SQL for checking the status of the bugfix version in the database failed
63   CrashReportStatusFailureSQLCheckBugfixStatus = -13,
64
65   // SQL for updating the occurances of this pattern in the database failed
66   CrashReportStatusFailureSQLUpdatePatternOccurances = -12,
67
68   // SQL for getting all the known bug patterns for the current app version in the database failed
69   CrashReportStatusFailureSQLFindKnownPatterns = -11,
70
71   // SQL for finding the bundle identifier in the database failed
72   CrashReportStatusFailureSQLSearchAppName = -10,
73
74   // the post request didn't contain valid data
75   CrashReportStatusFailureInvalidPostData = -3,
76
77   // incoming data may not be added, because e.g. bundle identifier wasn't found
78   CrashReportStatusFailureInvalidIncomingData = -2,
79
80   // database cannot be accessed, check hostname, username, password and database name settings in config.php
81   CrashReportStatusFailureDatabaseNotAvailable = -1,
82
83   CrashReportStatusUnknown = 0,
84
85   CrashReportStatusAssigned = 1,
86
87   CrashReportStatusSubmitted = 2,
88
89   CrashReportStatusAvailable = 3,
90 } CrashReportStatus;
91
92
93 @class BWQuincyUI;
94
95 @protocol BWQuincyManagerDelegate <NSObject>
96
97 @optional
98
99 // Invoked once the modal sheets are gone
100 - (void) showMainApplicationWindow;
101
102 // Return the description the crashreport should contain, empty by default. The string will automatically be wrapped into <[DATA[ ]]>, so make sure you don't do that in your string.
103 -(NSString *) crashReportDescription;
104
105 // Return the userid the crashreport should contain, empty by default
106 -(NSString *) crashReportUserID;
107
108 // Return the contact value (e.g. email) the crashreport should contain, empty by default
109 -(NSString *) crashReportContact;
110 @end
111
112
113 @interface BWQuincyManager : NSObject 
114 #if defined(MAC_OS_X_VERSION_10_6) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6) 
115  <NSXMLParserDelegate> 
116 #endif
117 {
118   CrashReportStatus _serverResult;
119   NSInteger         _statusCode;
120
121   NSMutableString   *_contentOfProperty;
122
123   id<BWQuincyManagerDelegate> _delegate;
124
125   NSString   *_submissionURL;
126   NSString   *_companyName;
127   NSString   *_appIdentifier;
128   BOOL       _autoSubmitCrashReport;
129
130   NSString   *_crashFile;
131
132   BWQuincyUI *_quincyUI;
133 }
134
135 - (NSString*) modelVersion;
136
137 + (BWQuincyManager *)sharedQuincyManager;
138
139 // submission URL defines where to send the crash reports to (required)
140 @property (nonatomic, retain) NSString *submissionURL;
141
142 // defines the company name to be shown in the crash reporting dialog
143 @property (nonatomic, retain) NSString *companyName;
144
145 // delegate is required
146 @property (nonatomic, assign) id <BWQuincyManagerDelegate> delegate;
147
148 // if YES, the crash report will be submitted without asking the user
149 // if NO, the user will be asked if the crash report can be submitted (default)
150 @property (nonatomic, assign, getter=isAutoSubmitCrashReport) BOOL autoSubmitCrashReport;
151
152 ///////////////////////////////////////////////////////////////////////////////////////////////////
153 // settings
154
155 // If you want to use HockeyApp instead of your own server, this is required
156 @property (nonatomic, retain) NSString *appIdentifier;
157
158
159 - (void) cancelReport;
160 - (void) sendReportCrash:(NSString*)crashContent
161              description:(NSString*)description;
162
163 - (NSString *) applicationName;
164 - (NSString *) applicationVersionString;
165 - (void)setApplicationVersion:(NSString *)appVersion;
166 - (NSString *) applicationVersion;
167
168 @end