1/*
2 * Copyright 2015-2016, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef REPORT_USER_INTERFACE_H
6#define REPORT_USER_INTERFACE_H
7
8
9#include <ObjectList.h>
10#include <String.h>
11
12#include "UserInterface.h"
13#include "Team.h"
14
15
16class ReportUserInterface : public UserInterface,
17	private Team::Listener {
18public:
19								ReportUserInterface(thread_id targetThread,
20									const char* reportPath);
21	virtual						~ReportUserInterface();
22
23	virtual	const char*			ID() const;
24
25	virtual	status_t			Init(Team* team,
26									UserInterfaceListener* listener);
27	virtual	void				Show();
28	virtual	void				Terminate();
29
30	virtual	UserInterface*		Clone() const;
31
32	virtual	bool				IsInteractive() const;
33
34	virtual status_t			LoadSettings(const TeamUiSettings* settings);
35	virtual status_t			SaveSettings(TeamUiSettings*& settings)	const;
36
37	virtual	void				NotifyUser(const char* title,
38									const char* message,
39									user_notification_type type);
40	virtual	void				NotifyBackgroundWorkStatus(
41									const char* message);
42	virtual	int32				SynchronouslyAskUser(const char* title,
43									const char* message, const char* choice1,
44									const char* choice2, const char* choice3);
45	virtual	status_t			SynchronouslyAskUserForFile(entry_ref* _ref);
46
47			void				Run();
48
49	// Team::Listener
50	virtual	void				ThreadAdded(const Team::ThreadEvent& event);
51	virtual	void				ThreadStateChanged(
52									const Team::ThreadEvent& event);
53	virtual void				DebugReportChanged(
54									const Team::DebugReportEvent& event);
55
56private:
57			::Team*				fTeam;
58			UserInterfaceListener* fListener;
59			thread_id			fTargetThread;
60			const char*			fReportPath;
61			sem_id				fShowSemaphore;
62			sem_id				fReportSemaphore;
63			bool				fShown;
64	volatile bool				fTerminating;
65};
66
67
68#endif	// REPORT_USER_INTERFACE_H
69