add more spacing
[personal-kdebase.git] / workspace / khotkeys / libkhotkeysprivate / voices.h
blob5f25a2b484f487042f55739afa810f149e9d546d
1 /****************************************************************************
3 KHotKeys
5 Copyright (C) 2005 Olivier Goffart <ogoffart @ kde.org>
7 Distributed under the terms of the GNU General Public License version 2.
9 ****************************************************************************/
11 #ifndef VOICES_H_
12 #define VOICES_H_
14 #include <QtGui/QWidget>
15 #include <kshortcut.h>
17 class Sound;
18 class QTimer;
19 class KAction;
21 namespace KHotKeys
24 class Voice;
25 class SoundRecorder;
27 class Voice_trigger;
28 class VoiceSignature;
31 class KDE_EXPORT Voice : public QObject
33 Q_OBJECT
34 public:
35 Voice( bool enabled_P, QObject* parent_P );
36 virtual ~Voice();
37 void enable( bool enable_P );
39 void register_handler( Voice_trigger* );
40 void unregister_handler( Voice_trigger* );
41 // bool x11Event( XEvent* e );
43 void set_shortcut( const KShortcut &k);
45 /**
46 * return QString() is a new signature is far enough from others signature
47 * otherwise, return the stringn which match.
49 QString isNewSoundFarEnough(const VoiceSignature& s, const QString& currentTrigger);
51 bool doesVoiceCodeExists(const QString &s);
53 public slots:
54 void record_start();
55 void record_stop();
57 private slots:
58 void slot_sound_recorded( const Sound & );
59 void slot_key_pressed();
60 void slot_timeout();
62 signals:
63 void handle_voice( const QString &voice );
64 private:
66 bool _enabled;
67 bool _recording;
69 QList<Voice_trigger *> _references;
70 SoundRecorder *_recorder;
72 KShortcut _shortcut;
73 KAction *_kga;
75 QTimer *_timer;
79 KDE_EXPORT extern Voice* voice_handler;
81 } // namespace KHotKeys
83 #endif