| 165 | } |
| 166 | |
| 167 | void YACReaderTranslator::translate() |
| 168 | { |
| 169 | QString text = this->text->toPlainText(); |
| 170 | if (text.isEmpty()) |
| 171 | return; |
| 172 | QString from = this->from->itemData(this->from->currentIndex()).toString(); |
| 173 | QString to = this->to->itemData(this->to->currentIndex()).toString(); |
| 174 | |
| 175 | speakText = text; |
| 176 | speakLocale = from; |
| 177 | |
| 178 | TranslationLoader *translationLoader = new TranslationLoader(text, from, to); |
| 179 | connect(translationLoader, &TranslationLoader::requestFinished, this, &YACReaderTranslator::setTranslation); |
| 180 | connect(translationLoader, &TranslationLoader::error, this, &YACReaderTranslator::error); |
| 181 | connect(translationLoader, &TranslationLoader::timeOut, this, &YACReaderTranslator::error); |
| 182 | connect(translationLoader, &QThread::finished, translationLoader, &QObject::deleteLater); |
| 183 | |
| 184 | translationLoader->start(); |
| 185 | |
| 186 | resultsTitle->setText(tr("Translation")); |
| 187 | |
| 188 | hideResults(); |
| 189 | |
| 190 | busyIndicator->show(); |
| 191 | } |
| 192 | |
| 193 | void YACReaderTranslator::error() |
| 194 | { |
no test coverage detected