summaryrefslogtreecommitdiffstats
blob: 1f5cdec4158e0c738c3ce9adab6726dd296f88b2 (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
/*
 * Copyright (c) 2012 Yoann Blein
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

#include "ScreenSharingOverviewImpl.h"

#include "Swift/QtUI/ScreenSharing/QtDesktopScreenGrabber.h"
#include "Swift/Controllers/ScreenSharing/ScreenSharingController.h"
#include <Swiften/ScreenSharing/ScreenSharingManager.h>

#include <boost/bind.hpp>

namespace Swift {

ScreenSharingOverviewImpl::ScreenSharingOverviewImpl(ScreenSharingManager *screenSharingManager, RemoteScreenWindowFactory* remoteScreenViewerFactory, TimerFactory* timerFactory)
	: ScreenSharingOverview(),
	  screenSharingManager(screenSharingManager), remoteScreenWindowFactory(remoteScreenViewerFactory), timerFactory(timerFactory),
	  screenGrabber(new QtDesktopScreenGrabber)
{
	screenSharingManager->onIncomingScreenSharing.connect(boost::bind(&ScreenSharingOverviewImpl::handleIncomingScreenSharing, this, _1));
}

ScreenSharingOverviewImpl::~ScreenSharingOverviewImpl()
{
	screenSharingManager->onIncomingScreenSharing.disconnect(boost::bind(&ScreenSharingOverviewImpl::handleIncomingScreenSharing, this, _1));
}

void ScreenSharingOverviewImpl::createOugoingScreenSharing(const JID& to)
{
	ScreenSharingController* ssc = new ScreenSharingController(screenSharingManager, timerFactory, screenGrabber, to);
	controllers.push_back(ssc);
	onNewScreenSharingController(ssc);
}

void ScreenSharingOverviewImpl::handleIncomingScreenSharing(boost::shared_ptr<IncomingScreenSharing> incomingScreenSharing)
{
	ScreenSharingController* ssc = new ScreenSharingController(incomingScreenSharing, remoteScreenWindowFactory);
	controllers.push_back(ssc);
	onNewScreenSharingController(ssc);
}

}