• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeaccessibility API Reference
  • KDE Home
  • Contact Us
 

jovie

  • sources
  • kde-4.12
  • kdeaccessibility
  • jovie
  • libkttsd
selecttalkerdlg.cpp
Go to the documentation of this file.
1 /***************************************************** vim:set ts=4 sw=4 sts=4:
2  Description:
3  A dialog for user to select a Talker, either by specifying
4  selected Talker attributes, or by specifying all attributes
5  of an existing configured Talker.
6 
7  Copyright:
8  (C) 2005 by Gary Cramblitt <garycramblitt@comcast.net>
9  -------------------
10  Original author: Gary Cramblitt <garycramblitt@comcast.net>
11 
12  This program is free software; you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation; either version 2 of the License, or
15  (at your option) any later version.
16 
17  This program is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with this program; if not, write to the Free Software
24  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25  ******************************************************************************/
26 
27 #include "selecttalkerdlg.h"
28 
29 // Qt includes.
30 #include <QtGui/QCheckBox>
31 #include <QtGui/QRadioButton>
32 #include <QtGui/QTableWidget>
33 #include <QtGui/QHeaderView>
34 
35 // KDE includes.
36 #include <kdialog.h>
37 #include <kcombobox.h>
38 #include <kpushbutton.h>
39 #include <klineedit.h>
40 #include <kconfig.h>
41 #include <kdebug.h>
42 #include <kservicetypetrader.h>
43 
44 // KTTS includes.
45 #include "utils.h"
46 #include "talkerlistmodel.h"
47 #include "selectlanguagedlg.h"
48 #include "selecttalkerdlg.moc"
49 
50 SelectTalkerDlg::SelectTalkerDlg(
51  QWidget* parent,
52  const char* name,
53  const QString& caption,
54  const QString& talkerCode,
55  bool runningTalkers) :
56 
57  KDialog(parent)
58 {
59  Q_UNUSED(name);
60  setCaption(caption);
61  setButtons(KDialog::Ok|KDialog::Cancel);
62  m_widget = new Ui::SelectTalkerWidget();
63  QWidget* w = new QWidget();
64  m_widget->setupUi( w );
65  m_talkerListModel = new TalkerListModel();
66  m_widget->talkersView->setModel(m_talkerListModel);
67 
68  setMainWidget( w );
69  m_runningTalkers = runningTalkers;
70  m_talkerCode = TalkerCode( talkerCode, false );
71 
72  // Fill combo boxes.
73  //KComboBox* cb;
74  //= m_widget->genderComboBox;
75  //cb->addItem( QString() );
76  //cb->addItem( TalkerCode::translatedGender("male") );
77  //cb->addItem( TalkerCode::translatedGender("female") );
78  //cb->addItem( TalkerCode::translatedGender("neutral") );
79 
80  //cb = m_widget->volumeComboBox;
81  //cb->addItem( QString() );
82  //cb->addItem( TalkerCode::translatedVolume("medium") );
83  //cb->addItem( TalkerCode::translatedVolume("loud") );
84  //cb->addItem( TalkerCode::translatedVolume("soft") );
85 
86  //cb = m_widget->rateComboBox;
87  //cb->addItem( QString() );
88  //cb->addItem( TalkerCode::translatedRate("medium") );
89  //cb->addItem( TalkerCode::translatedRate("fast") );
90  //cb->addItem( TalkerCode::translatedRate("slow") );
91 
92  //cb = m_widget->synthComboBox;
93  //cb->addItem( QString() );
94  //KService::List offers = KServiceTypeTrader::self()->query("KTTSD/SynthPlugin");
95  //for(int i=0; i < offers.count() ; ++i)
96  // cb->addItem(offers[i]->name());
97 
98  // Fill List View with list of Talkers.
99  KConfig config(QLatin1String( "kttsdrc" ));
100  m_talkerListModel->loadTalkerCodesFromConfig(&config);
101 
102  // Set initial radio button state.
103  if ( talkerCode.isEmpty() )
104  m_widget->useDefaultRadioButton->setChecked(true);
105  else
106  {
107  m_widget->useSpecificTalkerRadioButton->setChecked(true);
108  }
109 
110  //applyTalkerCodeToControls();
111  enableDisableControls();
112 
113  connect(m_widget->useDefaultRadioButton, SIGNAL(clicked()),
114  this, SLOT(configChanged()));
115  connect(m_widget->useSpecificTalkerRadioButton, SIGNAL(clicked()),
116  this, SLOT(configChanged()));
117 
118  connect(m_widget->talkersView, SIGNAL(clicked(QModelIndex)),
119  this, SLOT(slotTalkersView_clicked()));
120 
121  m_widget->talkersView->setMinimumHeight( 120 );
122 }
123 
124 SelectTalkerDlg::~SelectTalkerDlg()
125 {
126  delete m_widget;
127 }
128 
129 QString SelectTalkerDlg::getSelectedTalkerCode()
130 {
131  return m_talkerCode.getTalkerCode();
132 }
133 
134 QString SelectTalkerDlg::getSelectedTranslatedDescription()
135 {
136  return m_talkerCode.getTranslatedDescription();
137 }
138 
139 void SelectTalkerDlg::slotTalkersView_clicked()
140 {
141  QModelIndex modelIndex = m_widget->talkersView->currentIndex();
142  if (!modelIndex.isValid()) return;
143  if (!m_widget->useSpecificTalkerRadioButton->isChecked()) return;
144  m_talkerCode = m_talkerListModel->getRow(modelIndex.row());
145  configChanged();
146 }
147 
148 void SelectTalkerDlg::configChanged()
149 {
150  enableDisableControls();
151 }
152 
153 void SelectTalkerDlg::enableDisableControls()
154 {
155  bool enableSpecific = ( m_widget->useSpecificTalkerRadioButton->isChecked() );
156  m_widget->talkersView->setEnabled( enableSpecific );
157 }
selecttalkerdlg.h
TalkerCode::getTranslatedDescription
QString getTranslatedDescription() const
The Talker Code translated for display.
Definition: talkercode.cpp:221
QWidget
KDialog
SelectTalkerDlg::getSelectedTalkerCode
QString getSelectedTalkerCode()
Returns the Talker Code user chose.
Definition: selecttalkerdlg.cpp:129
utils.h
SelectTalkerDlg::SelectTalkerDlg
SelectTalkerDlg(QWidget *parent=0, const char *name="selecttalkerdialog", const QString &caption=i18n("Select Talker"), const QString &talkerCode=QString(), bool runningTalkers=false)
Constructor.
Definition: selecttalkerdlg.cpp:50
SelectTalkerDlg::~SelectTalkerDlg
~SelectTalkerDlg()
Destructor.
Definition: selecttalkerdlg.cpp:124
TalkerListModel
Model for list of configured talkers.
Definition: talkerlistmodel.h:45
TalkerCode::getTalkerCode
QString getTalkerCode() const
Definition: talkercode.cpp:202
talkerlistmodel.h
TalkerCode
Definition: talkercode.h:38
selectlanguagedlg.h
TalkerListModel::getRow
TalkerCode getRow(int row) const
Returns the TalkerCode for a specified row of the model/view.
Definition: talkerlistmodel.cpp:157
TalkerListModel::loadTalkerCodesFromConfig
void loadTalkerCodesFromConfig(KConfig *config)
Loads the TalkerCodes into the model/view from the config file.
Definition: talkerlistmodel.cpp:193
SelectTalkerDlg::getSelectedTranslatedDescription
QString getSelectedTranslatedDescription()
Returns the Talker user chose in a translated displayable format.
Definition: selecttalkerdlg.cpp:134
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:32:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

jovie

Skip menu "jovie"
  • Main Page
  • Namespace List
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeaccessibility API Reference

Skip menu "kdeaccessibility API Reference"
  • jovie

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal