SVN_SILENT made messages (.desktop file)
[kdeaccessibility.git] / kmouth / texttospeechconfigurationwidget.cpp
blobbee040fbbe228b3a3131ce52df746baffd2e2747
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 ***************************************************************************/
18 #include "texttospeechconfigurationwidget.h"
19 #include <kconfig.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>
30 #include <klocale.h>
31 #include "speech.h"
32 #include <kurlrequester.h>
34 TextToSpeechConfigurationWidget::TextToSpeechConfigurationWidget (QWidget *parent, const char *name)
35 : QWidget (parent)
37 setObjectName(name);
38 setupUi(this);
39 ttsSystem = new TextToSpeechSystem();
41 buildCodecList();
44 TextToSpeechConfigurationWidget::~TextToSpeechConfigurationWidget() {
47 void TextToSpeechConfigurationWidget::buildCodecList () {
48 QString local = i18n("Local")+" (";
49 local += QTextCodec::codecForLocale()->name() + ')';
50 characterCodingBox->addItem (local, Speech::Local);
51 characterCodingBox->addItem (i18n("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 {
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->setCurrentIndex(ttsSystem->codec);
80 useKttsd->setChecked (ttsSystem->useKttsd);
83 void TextToSpeechConfigurationWidget::saveOptions (KConfig *config, const QString &langGroup) {
84 ttsSystem->saveOptions (config, langGroup);