1 /***************************************************************************
2 texttospeechconfigurationdialog.cpp - description
5 copyright : (C) 2002 by Gunnar Schmi Dt
6 email : kmouth@schmi-dt.de
7 ***************************************************************************/
9 /***************************************************************************
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. *
16 ***************************************************************************/
18 #include "texttospeechconfigurationwidget.h"
21 #include <QtCore/QTextCodec>
22 #include <Qt3Support/Q3PtrList>
23 #include <QtGui/QLayout>
24 #include <QtGui/QLabel>
25 #include <QtGui/QLineEdit>
26 #include <QtGui/QPushButton>
27 #include <QtGui/QCheckBox>
29 #include <kcombobox.h>
32 #include <kurlrequester.h>
34 TextToSpeechConfigurationWidget::TextToSpeechConfigurationWidget (QWidget
*parent
, const char *name
)
39 ttsSystem
= new TextToSpeechSystem();
44 TextToSpeechConfigurationWidget::~TextToSpeechConfigurationWidget() {
47 void TextToSpeechConfigurationWidget::buildCodecList () {
48 QString local
= i18nc("Local characterset", "Local")+" (";
49 local
+= QTextCodec::codecForLocale()->name() + ')';
50 characterCodingBox
->addItem (local
, Speech::Local
);
51 characterCodingBox
->addItem (i18nc("Latin1 characterset", "Latin1"), Speech::Latin1
);
52 characterCodingBox
->addItem (i18n("Unicode"), Speech::Unicode
);
53 for (int i
= 0; i
< ttsSystem
->codecList
->count(); i
++ )
54 characterCodingBox
->addItem (ttsSystem
->codecList
->at(i
)->name(), Speech::UseCodec
+ i
);
57 void TextToSpeechConfigurationWidget::cancel() {
58 urlReq
->setUrl (ttsSystem
->ttsCommand
);
59 stdInButton
->setChecked (ttsSystem
->stdIn
);
60 characterCodingBox
->setCurrentIndex(ttsSystem
->codec
);
61 useKttsd
->setChecked (ttsSystem
->useKttsd
);
64 void TextToSpeechConfigurationWidget::ok() {
65 ttsSystem
->ttsCommand
= urlReq
->url().path();
66 ttsSystem
->stdIn
= stdInButton
->isChecked();
67 ttsSystem
->codec
= characterCodingBox
->currentIndex();
68 ttsSystem
->useKttsd
= useKttsd
->isChecked();
71 TextToSpeechSystem
*TextToSpeechConfigurationWidget::getTTSSystem() const {
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
->setCurrentIndex(ttsSystem
->codec
);
80 useKttsd
->setChecked (ttsSystem
->useKttsd
);
83 void TextToSpeechConfigurationWidget::saveOptions (KConfig
*config
, const QString
&langGroup
) {
84 ttsSystem
->saveOptions (config
, langGroup
);