~ubuntu-branches/ubuntu/raring/sflphone/raring

« back to all changes in this revision

Viewing changes to kde/src/conf/dlgaudio.cpp

  • Committer: Package Import Robot
  • Author(s): Whoopie
  • Date: 2012-03-22 10:29:10 UTC
  • mfrom: (4.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20120322102910-tb8hugi2su1tguwh
Tags: 1.0.2-1ubuntu1
* Apply some upstream patches to fix FTBFS (LP: #913018):
  - debian/patches/05_glib_includes.patch: fix glib includes.
  - debian/patches/06_use_XkbKeycodeToKeysym.patch: use 
    XkbKeycodeToKeysym instead of (deprecated) XKeycodeToKeysym.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2009-2012 by Savoir-Faire Linux                         *
 
3
 *   Author : Jérémy Quentin <jeremy.quentin@savoirfairelinux.com>         *
 
4
 *            Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>*
 
5
 *                                                                         *
 
6
 *   This program is free software; you can redistribute it and/or modify  *
 
7
 *   it under the terms of the GNU General Public License as published by  *
 
8
 *   the Free Software Foundation; either version 3 of the License, or     *
 
9
 *   (at your option) any later version.                                   *
 
10
 *                                                                         *
 
11
 *   This program is distributed in the hope that it will be useful,       *
 
12
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
13
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
14
 *   GNU General Public License for more details.                          *
 
15
 *                                                                         *
 
16
 *   You should have received a copy of the GNU General Public License     *
 
17
 *   along with this program; if not, write to the                         *
 
18
 *   Free Software Foundation, Inc.,                                       *
 
19
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 
20
 ***************************************************************************/
 
21
#include "dlgaudio.h"
 
22
 
 
23
#include <KLineEdit>
 
24
#include "lib/configurationmanager_interface_singleton.h"
 
25
#include "conf/ConfigurationSkeleton.h"
 
26
#include "conf/ConfigurationDialog.h"
 
27
#include <QtGui/QHeaderView>
 
28
 
 
29
#include "lib/sflphone_const.h"
 
30
 
 
31
DlgAudio::DlgAudio(KConfigDialog *parent)
 
32
 : QWidget(parent)
 
33
{
 
34
   setupUi(this);
 
35
 
 
36
   KUrlRequester_ringtone->setMode(KFile::File | KFile::ExistingOnly);
 
37
   KUrlRequester_ringtone->lineEdit()->setObjectName("kcfg_ringtone");
 
38
   KUrlRequester_ringtone->lineEdit()->setReadOnly(true);
 
39
 
 
40
   KUrlRequester_destinationFolder->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly);
 
41
   KUrlRequester_destinationFolder->setUrl(KUrl(QDir::home().path()));
 
42
   KUrlRequester_destinationFolder->lineEdit()->setObjectName("kcfg_destinationFolder");
 
43
   KUrlRequester_destinationFolder->lineEdit()->setReadOnly(true);
 
44
 
 
45
   connect( box_alsaPlugin, SIGNAL(activated(int)),  parent, SLOT(updateButtons()));
 
46
   connect( this,           SIGNAL(updateButtons()), parent, SLOT(updateButtons()));
 
47
 
 
48
}
 
49
 
 
50
 
 
51
DlgAudio::~DlgAudio()
 
52
{
 
53
}
 
54
 
 
55
void DlgAudio::updateWidgets()
 
56
{
 
57
   loadAlsaSettings();
 
58
}
 
59
 
 
60
 
 
61
void DlgAudio::updateSettings()
 
62
{
 
63
   //alsaPlugin
 
64
   ConfigurationSkeleton * skeleton = ConfigurationSkeleton::self();
 
65
   skeleton->setAlsaPlugin(box_alsaPlugin->currentText());
 
66
 
 
67
   //codecTableHasChanged = false;
 
68
}
 
69
 
 
70
bool DlgAudio::hasChanged()
 
71
{
 
72
   ConfigurationSkeleton * skeleton = ConfigurationSkeleton::self();
 
73
   bool alsaPluginHasChanged = skeleton->interface() == ConfigurationSkeleton::EnumInterface::ALSA && skeleton->alsaPlugin() != box_alsaPlugin->currentText();
 
74
   return alsaPluginHasChanged ;
 
75
}
 
76
 
 
77
void DlgAudio::loadAlsaSettings()
 
78
{
 
79
   ConfigurationManagerInterface& configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
 
80
   if(QString(configurationManager.getAudioManager()) == "alsa") {
 
81
      ConfigurationSkeleton* skeleton = ConfigurationSkeleton::self();
 
82
 
 
83
      int index = box_alsaPlugin->findText(skeleton->alsaPlugin());
 
84
      if(index < 0) index = 0;
 
85
      QStringList pluginList       = configurationManager.getAudioPluginList       ();
 
86
      box_alsaPlugin->clear                 (                              );
 
87
      box_alsaPlugin->addItems              ( pluginList                   );
 
88
      box_alsaPlugin->setCurrentIndex       ( index                        );
 
89
 
 
90
      QStringList inputDeviceList  = configurationManager.getAudioInputDeviceList  ();
 
91
      kcfg_alsaInputDevice->clear           (                              );
 
92
      kcfg_alsaInputDevice->addItems        ( inputDeviceList              );
 
93
      kcfg_alsaInputDevice->setCurrentIndex ( skeleton->alsaInputDevice()  );
 
94
 
 
95
      QStringList outputDeviceList = configurationManager.getAudioOutputDeviceList ();
 
96
      kcfg_alsaOutputDevice->clear          (                              );
 
97
      kcfg_alsaOutputDevice->addItems       ( outputDeviceList             );
 
98
      kcfg_alsaOutputDevice->setCurrentIndex( skeleton->alsaOutputDevice() );
 
99
 
 
100
      groupBox_alsa->setEnabled(true);
 
101
   }
 
102
   else {
 
103
      groupBox_alsa->setEnabled(false);
 
104
   }
 
105
}
 
 
b'\\ No newline at end of file'