summaryrefslogtreecommitdiffstats
blob: 11b45041b589693c8279f0db21b4bc35febff363 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Copyright (c) 2012 Yoann Blein
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

#pragma once

#include <Swiften/JID/JID.h>
#include <Swiften/ScreenSharing/ScreenSharing.h>

#include <boost/shared_ptr.hpp>

namespace Swift {
	class ScreenSharing;
	class ScreenSharingManager;
	class IncomingScreenSharing;
	class Timer;
	class TimerFactory;
	class DesktopScreenGrabber;
	class RemoteScreenWindowFactory;
	class RemoteScreenWindow;
	class ChatWindow;

	class ScreenSharingController {
		public:
			ScreenSharingController(ScreenSharingManager* screenSharingManager, TimerFactory* timerFactory, DesktopScreenGrabber* desktopScreenGrabber, const JID& to);
			ScreenSharingController(boost::shared_ptr<IncomingScreenSharing> screenSharing, RemoteScreenWindowFactory* remoteScreenWindowFactory);
			~ScreenSharingController();

			const JID& getOtherParty() const;

			std::string setChatWindow(ChatWindow *wnd, std::string nickname);

			void accept();
			void cancel();
			void stop();

		private:
			void handleGrabTimerTick();
			void handleReady();
			void handleFinished();
			void handleStateChange(ScreenSharing::SCState state);
			void handleWindowStopRequest();

		private:
			DesktopScreenGrabber* screenGrabber;
			boost::shared_ptr<Timer> grabTimer;
			RemoteScreenWindowFactory* remoteScreenWindowFactory;
			RemoteScreenWindow* remoteScreenWindow;

			boost::shared_ptr<ScreenSharing> screenSharing;
			JID otherParty;
			bool incoming;
			std::string uiID;
			ChatWindow* chatWindow;
	};
}