Mercurial > hg > easaier-soundaccess
comparison widgets/SpeechRecognitionUI.cpp @ 262:3f41cb822166
first code for the speech recognition
author | benoitrigolleau |
---|---|
date | Fri, 20 Jun 2008 12:33:08 +0000 |
parents | |
children | 63a485275ed6 |
comparison
equal
deleted
inserted
replaced
261:ff8187498612 | 262:3f41cb822166 |
---|---|
1 | |
2 #include "SpeechRecognitionUI.h" | |
3 | |
4 #include <QGridLayout> | |
5 | |
6 | |
7 #include "../sv/main/MainWindow.h" | |
8 #include "../sv/main/EasaierSessionManager.h" | |
9 | |
10 | |
11 | |
12 | |
13 SpeechRecognitionUI::SpeechRecognitionUI(QWidget *parent) : QWidget(parent){ | |
14 | |
15 _audioRecorder = new AudioRecording(); | |
16 | |
17 connect(this, SIGNAL(startRect()),_audioRecorder, SLOT(rect())); | |
18 connect(this, SIGNAL(stopRect()),_audioRecorder, SLOT(stopRect())); | |
19 | |
20 _bRect = new QPushButton; | |
21 _bPlay = new QPushButton; | |
22 _bSend = new QPushButton; | |
23 | |
24 | |
25 _bRect->setMaximumSize(24,24); | |
26 _bPlay->setMaximumSize(24,24); | |
27 _bSend->setMaximumSize(24,24); | |
28 | |
29 _bPlay->setEnabled(false); | |
30 _bSend->setEnabled(false); | |
31 | |
32 _bRect->setIcon(QIcon(":icons/rect.png")); | |
33 _bPlay->setIcon(QIcon(":icons/playpause.png")); | |
34 _bSend->setIcon(QIcon(":icons/addToLayer.png")); | |
35 | |
36 | |
37 | |
38 _textEdit = new QTextEdit(); | |
39 _textEdit->setMinimumWidth(200); | |
40 | |
41 QGridLayout *layout = new QGridLayout; | |
42 this->setLayout(layout); | |
43 layout->addWidget(_bRect,1,1,1,1,Qt::AlignTop); | |
44 layout->addWidget(_bPlay,2,1,1,1,Qt::AlignTop); | |
45 layout->addWidget(_bSend,3,1,1,1,Qt::AlignTop); | |
46 layout->addWidget(_textEdit,1,2,4,1); | |
47 | |
48 | |
49 //SLOTs end SIGNALs | |
50 | |
51 connect(_bRect, SIGNAL(pressed ()), this,SLOT(rect())); | |
52 connect(_bSend, SIGNAL(pressed ()), this,SLOT(sendQuery())); | |
53 | |
54 } | |
55 | |
56 | |
57 SpeechRecognitionUI::~SpeechRecognitionUI(){ | |
58 | |
59 } | |
60 | |
61 | |
62 void SpeechRecognitionUI::play(){ | |
63 | |
64 } | |
65 | |
66 void SpeechRecognitionUI::rect(){ | |
67 if(_audioRecorder->isRecording()){ | |
68 emit(stopRect()); | |
69 _bRect->setIcon(QIcon(":icons/rect.png")); | |
70 _bPlay->setEnabled(true); | |
71 _bSend->setEnabled(true); | |
72 | |
73 }else{ | |
74 emit(startRect()); | |
75 _bRect->setIcon(QIcon(":icons/stop.png")); | |
76 _bPlay->setEnabled(false); | |
77 _bSend->setEnabled(false); | |
78 } | |
79 } | |
80 | |
81 void SpeechRecognitionUI::sendQuery(){ | |
82 MainWindow::instance()->getEasaierSessionManager()->speechRecognition("SpeechRecognition"); | |
83 } |