source: qutecom-2.2/wengophone/src/control/wenbox/CWenboxPlugin.cpp @ 0:e18c44432190

Last change on this file since 0:e18c44432190 was 0:e18c44432190, checked in by vadim@…, 5 years ago

initial commit

File size: 2.3 KB
Line 
1/*
2 * WengoPhone, a voice over Internet phone
3 * Copyright (C) 2004-2006  Wengo
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18 */
19
20#include "CWenboxPlugin.h"
21
22#include <presentation/PFactory.h>
23#include <presentation/PWenboxPlugin.h>
24
25#include <model/wenbox/WenboxPlugin.h>
26
27#include <thread/ThreadEvent.h>
28
29CWenboxPlugin::CWenboxPlugin(WenboxPlugin & wenboxPlugin, CWengoPhone & cWengoPhone)
30        : _wenboxPlugin(wenboxPlugin),
31        _cWengoPhone(cWengoPhone) {
32
33        _pWenboxPlugin = NULL;
34        typedef ThreadEvent0<void ()> MyThreadEvent;
35        MyThreadEvent * event = new MyThreadEvent(boost::bind(&CWenboxPlugin::initPresentationThreadSafe, this));
36        PFactory::postEvent(event);
37}
38
39CWenboxPlugin::~CWenboxPlugin() {
40        //delete _pWenboxPlugin;
41}
42
43Presentation * CWenboxPlugin::getPresentation() const {
44        return _pWenboxPlugin;
45}
46
47CWengoPhone & CWenboxPlugin::getCWengoPhone() const {
48        return _cWengoPhone;
49}
50
51void CWenboxPlugin::initPresentationThreadSafe() {
52        _pWenboxPlugin = PFactory::getFactory().createPresentationWenboxPlugin(*this);
53
54        _wenboxPlugin.phoneNumberBufferUpdatedEvent += boost::bind(&CWenboxPlugin::phoneNumberBufferUpdatedEventHandler, this, _1, _2);
55}
56
57void CWenboxPlugin::phoneNumberBufferUpdatedEventHandler(WenboxPlugin & sender, const std::string & phoneNumberBuffer) {
58        typedef ThreadEvent1<void (std::string), std::string> MyThreadEvent;
59        MyThreadEvent * event = new MyThreadEvent(boost::bind(&CWenboxPlugin::phoneNumberBufferUpdatedEventHandlerThreadSafe, this, _1), phoneNumberBuffer);
60        PFactory::postEvent(event);
61}
62
63void CWenboxPlugin::phoneNumberBufferUpdatedEventHandlerThreadSafe(std::string phoneNumberBuffer) {
64        _pWenboxPlugin->phoneNumberBufferUpdatedEvent(phoneNumberBuffer);
65}
Note: See TracBrowser for help on using the repository browser.