root/branches/libffado-2.0/support/mixer-qt4/mixer_global.py

Revision 1298, 2.9 kB (checked in by ppalmers, 13 years ago)

add Qt4 port of the mixer (only for audiofire and saffire ATM). needed since PyQt?3 doesn't support DBUS signals.

Line 
1 #
2 # Copyright (C) 2008 by Arnold Krille
3 #
4 # This file is part of FFADO
5 # FFADO = Free Firewire (pro-)audio drivers for linux
6 #
7 # FFADO is based upon FreeBoB.
8 #
9 # This program is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 2 of the License, or
12 # (at your option) version 3 of the License.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 #
22
23 from PyQt4.QtGui import QWidget, QMessageBox
24 from mixer_globalui import Ui_GlobalMixerUi
25
26 class GlobalMixer( QWidget, Ui_GlobalMixerUi ):
27     def __init__( self, parent ):
28         QWidget.__init__( self, parent )
29         self.setupUi(self)
30
31     def clockChanged( self, clock ):
32         #print "updateClockSource( " + str(clock) + " )"
33         self.clockselect.select( clock )
34         selected = self.clockselect.selected()
35
36         if selected != clock:
37             clockname = self.clockselect.getEnumLabel( clock )
38             msg = QMessageBox()
39             msg.question( msg, "Failed to select clock source", \
40                 "<qt>Could not select %s as clock source.</qt>" % clockname, \
41                 QMessageBox.Ok )
42             self.clocksource.setCurrentIndex( selected )
43
44     def samplerateChanged( self, sr ):
45         print "samplerateChanged( " + str(sr) + " )"
46         self.samplerateselect.select( sr )
47         selected = self.samplerateselect.selected()
48
49         if selected != sr:
50             srname = self.samplerateselect.getEnumLabel( sr )
51             msg = QMessageBox()
52             msg.question( msg, "Failed to select sample rate", \
53                 "<qt>Could not select %s as samplerate.</qt>" % srname, \
54                 QMessageBox.Ok )
55             self.samplerate.setCurrentIndex( selected )
56
57     def nicknameChanged( self, name ):
58         #print "nicknameChanged( %s )" % name
59         asciiData = name.toAscii()
60         self.nickname.setText( asciiData.data() )
61
62     def initValues( self ):
63         #print "GlobalMixer::initValues()"
64         nb_clocks = self.clockselect.count()
65         for i in range( nb_clocks ):
66             self.clocksource.insertItem( nb_clocks, self.clockselect.getEnumLabel( i ) )
67         self.clocksource.setCurrentIndex( self.clockselect.selected() )
68        
69         nb_rates = self.samplerateselect.count()
70         for i in range( nb_rates ):
71             self.samplerate.insertItem( nb_rates, self.samplerateselect.getEnumLabel( i ) )
72         self.samplerate.setCurrentIndex( self.samplerateselect.selected() )
73
74         self.txtNickname.setText( self.nickname.text() )
75
Note: See TracBrowser for help on using the browser.