~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to noatun/noatun/modules/infrared/infrared.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
#include <stdio.h>
 
3
 
 
4
#include <unistd.h>
 
5
#include <player.h>
 
6
#include <noatunapp.h>
 
7
 
 
8
#include <klocale.h>
 
9
 
 
10
#include "infrared.h"
 
11
#include "lirc.h"
 
12
#include "irprefs.h"
 
13
 
 
14
extern "C"
 
15
{
 
16
        Plugin *create_plugin()
 
17
        {
 
18
                return new InfraRed();
 
19
        }
 
20
}
 
21
 
 
22
 
 
23
InfraRed::InfraRed()
 
24
        : QObject(),
 
25
          Plugin()
 
26
{
 
27
        NOATUNPLUGINC(InfraRed);
 
28
        m_lirc = new Lirc(this);
 
29
        connect(m_lirc,
 
30
                SIGNAL(commandReceived(const QString &, const QString &, int)),
 
31
                SLOT(slotCommand(const QString &, const QString &, int)));
 
32
 
 
33
        IRPrefs::s_lirc = m_lirc;
 
34
        new IRPrefs(this);
 
35
}
 
36
 
 
37
InfraRed::~InfraRed()
 
38
{
 
39
}
 
40
 
 
41
void InfraRed::slotCommand(const QString &remote, const QString &button, int repeat)
 
42
{
 
43
        switch (IRPrefs::actionFor(remote, button, repeat))
 
44
        {
 
45
        case IRPrefs::None:
 
46
                break;
 
47
        
 
48
        case IRPrefs::Play:
 
49
                napp->player()->play();
 
50
                break;
 
51
        
 
52
        case IRPrefs::Stop:
 
53
                napp->player()->stop();
 
54
                break;
 
55
        
 
56
        case IRPrefs::Previous:
 
57
                napp->player()->back();
 
58
                break;
 
59
        
 
60
        case IRPrefs::Next:
 
61
                napp->player()->fastForward();
 
62
                break;
 
63
        
 
64
        case IRPrefs::VolumeDown:
 
65
                napp->player()->setVolume(napp->player()->volume() - 1);
 
66
                break;
 
67
        
 
68
        case IRPrefs::VolumeUp:
 
69
                napp->player()->setVolume(napp->player()->volume() + 1);
 
70
                break;
 
71
        }
 
72
}
 
73
 
 
74
#include "infrared.moc"
 
75