compile/link
[kdeaccessibility.git] / kmouth / texttospeechconfigurationwidget.cpp
blob34e3f52d9f0d9e950b86d83be9e0f1e0aa87f1cc
1 /***************************************************************************
2 texttospeechconfigurationdialog.cpp - description
3 -------------------
4 begin : Son Sep 8 2002
5 copyright : (C) 2002 by Gunnar Schmi Dt
6 email : kmouth@schmi-dt.de
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
19 #include "texttospeechconfigurationwidget.h"
20 #include <kconfig.h>
21 #include <qtextcodec.h>
22 #include <q3ptrlist.h>
23 #include <qlayout.h>
24 #include <q3whatsthis.h>
25 #include <kcombobox.h>
26 #include <klocale.h>
27 #include <qlabel.h>
28 #include "speech.h"
29 #include <qlineedit.h>
30 #include <qpushbutton.h>
31 #include <qcheckbox.h>
32 #include <kurlrequester.h>
34 TextToSpeechConfigurationWidget::TextToSpeechConfigurationWidget (QWidget *parent, const char *name)
35 : texttospeechconfigurationui (parent, name)
37 ttsSystem = new TextToSpeechSystem();
39 urlReq->setShowLocalProtocol (false);
40 buildCodecList();
43 TextToSpeechConfigurationWidget::~TextToSpeechConfigurationWidget() {
46 void TextToSpeechConfigurationWidget::buildCodecList () {
47 QString local = i18n("Local")+" (";
48 local += QTextCodec::codecForLocale()->name();
49 local += ")";
50 characterCodingBox->insertItem (local, Speech::Local);
51 characterCodingBox->insertItem (i18n("Latin1"), Speech::Latin1);
52 characterCodingBox->insertItem (i18n("Unicode"), Speech::Unicode);
53 for (uint i = 0; i < ttsSystem->codecList->count(); i++ )
54 characterCodingBox->insertItem (ttsSystem->codecList->at(i)->name(), Speech::UseCodec + i);
57 void TextToSpeechConfigurationWidget::cancel() {
58 urlReq->setURL (ttsSystem->ttsCommand);
59 stdInButton->setChecked (ttsSystem->stdIn);
60 characterCodingBox->setCurrentItem(ttsSystem->codec);
61 useKttsd->setChecked (ttsSystem->useKttsd);
64 void TextToSpeechConfigurationWidget::ok() {
65 ttsSystem->ttsCommand = urlReq->url();
66 ttsSystem->stdIn = stdInButton->isChecked();
67 ttsSystem->codec = characterCodingBox->currentItem();
68 ttsSystem->useKttsd = useKttsd->isChecked();
71 TextToSpeechSystem *TextToSpeechConfigurationWidget::getTTSSystem() const {
72 return ttsSystem;
75 void TextToSpeechConfigurationWidget::readOptions (KConfig *config, const QString &langGroup) {
76 ttsSystem->readOptions (config, langGroup);
77 urlReq->setURL (ttsSystem->ttsCommand);
78 stdInButton->setChecked (ttsSystem->stdIn);
79 characterCodingBox->setCurrentItem(ttsSystem->codec);
80 useKttsd->setChecked (ttsSystem->useKttsd);
83 void TextToSpeechConfigurationWidget::saveOptions (KConfig *config, const QString &langGroup) {
84 ttsSystem->saveOptions (config, langGroup);