diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/widgets/SpeechRecognitionUI.cpp	Fri Jun 20 12:33:08 2008 +0000
@@ -0,0 +1,83 @@
+
+#include "SpeechRecognitionUI.h"
+
+#include <QGridLayout>
+
+
+#include "../sv/main/MainWindow.h"
+#include "../sv/main/EasaierSessionManager.h"
+
+
+
+
+SpeechRecognitionUI::SpeechRecognitionUI(QWidget *parent) : QWidget(parent){
+
+	_audioRecorder = new AudioRecording();
+	
+	connect(this, SIGNAL(startRect()),_audioRecorder, SLOT(rect()));
+	connect(this, SIGNAL(stopRect()),_audioRecorder, SLOT(stopRect()));
+
+	_bRect = new QPushButton;
+	_bPlay = new QPushButton;
+	_bSend = new QPushButton;
+
+	
+	_bRect->setMaximumSize(24,24);
+	_bPlay->setMaximumSize(24,24);
+	_bSend->setMaximumSize(24,24);
+
+	_bPlay->setEnabled(false);
+	_bSend->setEnabled(false);
+
+	_bRect->setIcon(QIcon(":icons/rect.png"));
+	_bPlay->setIcon(QIcon(":icons/playpause.png"));
+	_bSend->setIcon(QIcon(":icons/addToLayer.png"));
+	
+
+
+	_textEdit = new QTextEdit();
+	_textEdit->setMinimumWidth(200);
+
+	QGridLayout *layout = new QGridLayout;
+	this->setLayout(layout);
+	layout->addWidget(_bRect,1,1,1,1,Qt::AlignTop);
+	layout->addWidget(_bPlay,2,1,1,1,Qt::AlignTop);
+	layout->addWidget(_bSend,3,1,1,1,Qt::AlignTop);
+	layout->addWidget(_textEdit,1,2,4,1);
+
+
+	//SLOTs end SIGNALs
+	
+	connect(_bRect, SIGNAL(pressed ()), this,SLOT(rect()));
+	connect(_bSend, SIGNAL(pressed ()), this,SLOT(sendQuery()));
+
+}
+
+
+SpeechRecognitionUI::~SpeechRecognitionUI(){
+
+}
+
+
+void SpeechRecognitionUI::play(){
+
+}
+
+void SpeechRecognitionUI::rect(){
+	if(_audioRecorder->isRecording()){
+		emit(stopRect());
+		_bRect->setIcon(QIcon(":icons/rect.png"));
+		_bPlay->setEnabled(true);
+		_bSend->setEnabled(true);
+
+	}else{
+		emit(startRect());
+		_bRect->setIcon(QIcon(":icons/stop.png"));
+		_bPlay->setEnabled(false);
+		_bSend->setEnabled(false);
+	}
+}
+
+void SpeechRecognitionUI::sendQuery(){
+	MainWindow::instance()->getEasaierSessionManager()->speechRecognition("SpeechRecognition");
+}
\ No newline at end of file