source: pacpusframework/trunk/src/DBITEPlayerLib/DbtPlyTrigger.cpp@ 70

Last change on this file since 70 was 65, checked in by Marek Kurdej, 12 years ago

Removed unnecessary comment.

  • Property svn:keywords set to Id
File size: 1.6 KB
Line 
1// This file is part of the PACPUS framework distributed under the
2// CECILL-C License, Version 1.0.
3//
4/// @version $Id: DbtPlyTrigger.cpp 65 2013-01-09 16:42:43Z kurdejma $
5
6#include <Pacpus/DbitePlayer/DbtPlyTrigger.h>
7
8#include <Pacpus/kernel/ComponentManager.h>
9#include <Pacpus/kernel/Log.h>
10
11namespace pacpus {
12
13DECLARE_STATIC_LOGGER("pacpus.core.DbtPlyTrigger");
14
15// Construction de la fabrique de composant DbtPlyTrigger
16//static ComponentFactory<DbtPlyTrigger> factory("DbtPlyTrigger");
17
18DbtPlyTrigger::DbtPlyTrigger(QString name)
19 : ComponentBase(name)
20 , mEngine(NULL)
21{
22 THREAD_ALIVE = false;
23}
24
25DbtPlyTrigger::~DbtPlyTrigger()
26{
27}
28
29ComponentBase::COMPONENT_CONFIGURATION DbtPlyTrigger::configureComponent(XmlComponentConfig /*config*/)
30{
31 ComponentManager * mgr = ComponentManager::getInstance();
32 // we get a pointer to the engine component
33 mEngine = dynamic_cast<DbtPlyEngine *>(mgr->getComponent("dbiteEngine"));
34 if (NULL == mEngine) {
35 LOG_FATAL("cannot get a pointer of the 'dbiteEngine' component");
36 return CONFIGURED_FAILED;
37 }
38 connect(this, SIGNAL(triggerSig()),
39 mEngine,SLOT(engReceiver()),
40 Qt::DirectConnection);
41
42 return CONFIGURED_OK;
43}
44
45void DbtPlyTrigger::startActivity()
46{
47 THREAD_ALIVE = true;
48 start();
49}
50
51void DbtPlyTrigger::stopActivity()
52{
53 THREAD_ALIVE = false;
54}
55
56// The thread is started when the user press the play button
57void DbtPlyTrigger::run()
58{
59#ifdef WIN32
60 timeBeginPeriod(1);
61#endif
62
63 while(THREAD_ALIVE) {
64 if (mEngine->isPlaying()) {
65 Q_EMIT triggerSig();
66 }
67 msleep(1);
68 }
69
70#ifdef WIN32
71 timeEndPeriod(1);
72#endif
73}
74
75} // namespace pacpus
Note: See TracBrowser for help on using the repository browser.