#include "MainWindow.h" #include "ui_MainWindow.h" #include "SpeechReverser.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui( new Ui::MainWindow() ) , speechReverser( new SpeechReverser(this) ) { ui->setupUi(this); #if WAY1 connect(ui->textEditInput, SIGNAL(textChanged()), this, SLOT(onTextEditInputTextChanged())); #endif connect(ui->textEditInput, SIGNAL(textChanged()), this, SLOT(onTextEditInputTextChanged())); connect(speechReverser, SIGNAL(reverseDone(QString)), ui->textEditOutput, SLOT(setPlainText(QString))); } MainWindow::~MainWindow() { delete ui; } void MainWindow::onTextEditInputTextChanged() { #if WAY1 QString text = ui->textEditInput->document()->toPlainText(); text = speechReverser->reverse(text); ui->textEditOutput->setPlainText( text ); #endif speechReverser->reverse( ui->textEditInput->document()->toPlainText() ); }