~ubuntu-branches/ubuntu/feisty/kdetv/feisty

« back to all changes in this revision

Viewing changes to kdetv/libkdetv/lirc.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-09-17 23:25:16 UTC
  • Revision ID: james.westby@ubuntu.com-20050917232516-9wdsn3ckagbqieh8
Tags: upstream-0.8.8
ImportĀ upstreamĀ versionĀ 0.8.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- c++ -*-
 
2
/*
 
3
 * Copyright (C) 2002 Zsolt Rizsanyi <rizsanyi@myrealbox.com>
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Library General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This library 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 GNU
 
13
 * Library General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Library General Public License
 
16
 * along with this library; see the file COPYING.LIB.  If not, write to
 
17
 * the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
 
18
 * Boston, MA 02110-1301, USA.
 
19
 */
 
20
 
 
21
 
 
22
#ifndef __LIRC_H__
 
23
#define __LIRC_H__
 
24
 
 
25
#include <qmap.h>
 
26
#include <qobject.h>
 
27
#include <qstring.h>
 
28
 
 
29
#ifdef HAVE_CONFIG_H
 
30
# include <config.h>
 
31
#endif
 
32
 
 
33
#ifdef HAVE_LIRC_KDETV
 
34
# include <lirc/lirc_client.h>
 
35
#endif
 
36
 
 
37
/**
 
38
 * Object for lirc support.
 
39
 */
 
40
class Lirc : public QObject
 
41
{
 
42
    Q_OBJECT
 
43
 
 
44
public:
 
45
    /**
 
46
     * Creates a lirc connection, and initializes configuration with appname @p appname.
 
47
     */
 
48
    Lirc( QObject *parent, const QString& appname);
 
49
    virtual ~Lirc();
 
50
 
 
51
    /**
 
52
     * Sets the default keymap to use if there is no lirc config file, or default is specified
 
53
     * as command.
 
54
     * @p keymap will be deleted in the destructor
 
55
     */
 
56
    void setDefaultKeyMap(const QMap<QString, QString>& keymap) { _keymap = keymap; }
 
57
 
 
58
signals:
 
59
    /**
 
60
     * an event received from lirc
 
61
     * you get this signal only if a not recognized key is pressed
 
62
     * @p key the name of the key pressed
 
63
     */
 
64
    void event(const QString& key, unsigned repeat);
 
65
 
 
66
    /**
 
67
     * lirc command received
 
68
     * @p cmd the cmd corresponding to pressed lirc key (as defined in the lirc config file)
 
69
     */
 
70
    void command(const QString& cmd, unsigned repeat);
 
71
 
 
72
private slots:
 
73
    void dataReceived();
 
74
 
 
75
private:
 
76
    QString _appname;
 
77
#ifdef HAVE_LIRC_KDETV
 
78
    lirc_config* _config;
 
79
    int _lircfd;
 
80
#endif
 
81
    QMap<QString, QString> _keymap;
 
82
};
 
83
 
 
84
#endif // __LIRC_H__