summaryrefslogtreecommitdiffstats
path: root/khotkeys/shared/voices.h
blob: ccd07563f89d233ad7b866079310d4b94e3a53a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/****************************************************************************

 KHotKeys
 
 Copyright (C) 2005 Olivier Goffart  <ogoffart @ kde.org>

 Distributed under the terms of the GNU General Public License version 2.
 
****************************************************************************/

#ifndef VOICES_H_
#define VOICES_H_

#include <tqwidget.h>
#include <tdeshortcut.h>

class Sound;
class TQTimer;
class TDEGlobalAccel;

namespace KHotKeys
{

class Voice;
class SoundRecorder;

class Voice_trigger;
class VoiceSignature;


class KDE_EXPORT Voice  : public TQObject
    {
    Q_OBJECT
    public:
        Voice( bool enabled_P, TQObject* parent_P );
        virtual ~Voice();
        void enable( bool enable_P );

		void register_handler( Voice_trigger* );
		void unregister_handler( Voice_trigger* );
//		bool x11Event( XEvent* e );
		
		void set_shortcut( const TDEShortcut &k);
		
		/**
		 * return TQString::null is a new signature is far enough from others signature
		 * otherwise, return the stringn which match.
		 */
		TQString isNewSoundFarEnough(const VoiceSignature& s, const TQString& currentTrigger);
		
		bool doesVoiceCodeExists(const TQString &s);

    public slots:
         void record_start();
         void record_stop();

    private slots:
		void slot_sound_recorded( const Sound & );
		void slot_key_pressed();
		void slot_timeout();

    signals:
        void handle_voice( const TQString &voice );
    private:

        bool _enabled;
        bool _recording;

		TQValueList<Voice_trigger *> _references;
		SoundRecorder *_recorder;
		
		TDEShortcut _shortcut;
		TDEGlobalAccel *_kga;
		
		TQTimer *_timer;
    };

	
KDE_EXPORT extern Voice* voice_handler;

} // namespace KHotKeys

#endif