Volume control

This commit is contained in:
Kiooeht 2011-06-24 09:27:18 -07:00
parent 38fa6ffd1c
commit e6b6712c1d
3 changed files with 33 additions and 0 deletions

View file

@ -50,6 +50,7 @@ CHANGELOG
* Say something when server is full - Kiooeht [evacipatedBox] * Say something when server is full - Kiooeht [evacipatedBox]
* Ping server if no ping from server to test connection - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance]) * Ping server if no ping from server to test connection - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* MSPA comic update notifier - Kiooeht [evacipatedBox] * MSPA comic update notifier - Kiooeht [evacipatedBox]
* Volume control - Kiooeht [evacipatedBox]
* Bug fixes * Bug fixes
* Logviewer updates - Kiooeht [evacipatedBox] * Logviewer updates - Kiooeht [evacipatedBox]
* Memo scrollbar thing - Kiooeht [evacipatedBox] * Memo scrollbar thing - Kiooeht [evacipatedBox]

View file

@ -949,6 +949,14 @@ class PesterOptions(QtGui.QDialog):
self.chatsoundcheck.setEnabled(False) self.chatsoundcheck.setEnabled(False)
self.memosoundcheck.setEnabled(False) self.memosoundcheck.setEnabled(False)
self.namesoundcheck.setEnabled(False) self.namesoundcheck.setEnabled(False)
self.volume = QtGui.QSlider(QtCore.Qt.Horizontal, self)
self.volume.setMinimum(0)
self.volume.setMaximum(100)
self.volume.setValue(self.config.volume())
self.connect(self.volume, QtCore.SIGNAL('valueChanged(int)'),
self, QtCore.SLOT('printValue(int)'))
self.currentVol = QtGui.QLabel(str(self.config.volume())+"%", self)
self.currentVol.setAlignment(QtCore.Qt.AlignHCenter)
self.timestampcheck = QtGui.QCheckBox("Time Stamps", self) self.timestampcheck = QtGui.QCheckBox("Time Stamps", self)
@ -1130,6 +1138,10 @@ class PesterOptions(QtGui.QDialog):
layout_indent.addWidget(self.namesoundcheck) layout_indent.addWidget(self.namesoundcheck)
layout_indent.setContentsMargins(22,0,0,0) layout_indent.setContentsMargins(22,0,0,0)
layout_sound.addLayout(layout_indent) layout_sound.addLayout(layout_indent)
layout_sound.addSpacing(15)
layout_sound.addWidget(QtGui.QLabel("Master Volume:", self))
layout_sound.addWidget(self.volume)
layout_sound.addWidget(self.currentVol)
self.pages.addWidget(widget) self.pages.addWidget(widget)
# Logging # Logging
@ -1195,6 +1207,9 @@ class PesterOptions(QtGui.QDialog):
self.chatsoundcheck.setEnabled(True) self.chatsoundcheck.setEnabled(True)
self.memosoundcheck.setEnabled(True) self.memosoundcheck.setEnabled(True)
self.namesoundcheck.setEnabled(True) self.namesoundcheck.setEnabled(True)
@QtCore.pyqtSlot(int)
def printValue(self, v):
self.currentVol.setText(str(v)+"%")
class PesterUserlist(QtGui.QDialog): class PesterUserlist(QtGui.QDialog):
def __init__(self, config, theme, parent): def __init__(self, config, theme, parent):

View file

@ -110,6 +110,7 @@ class waitingMessageHolder(object):
class NoneSound(object): class NoneSound(object):
def play(self): pass def play(self): pass
def set_volume(self, v): pass
class PesterLog(object): class PesterLog(object):
def __init__(self, handle, parent=None): def __init__(self, handle, parent=None):
@ -508,6 +509,8 @@ class userConfig(object):
return self.config.get('memoSound', True) return self.config.get('memoSound', True)
def nameSound(self): def nameSound(self):
return self.config.get('nameSound', True) return self.config.get('nameSound', True)
def volume(self):
return self.config.get('volume', 100)
def set(self, item, setting): def set(self, item, setting):
self.config[item] = setting self.config[item] = setting
try: try:
@ -2023,6 +2026,15 @@ class PesterWindow(MovingWindow):
self.ceasesound = NoneSound() self.ceasesound = NoneSound()
self.honksound = NoneSound() self.honksound = NoneSound()
def setVolume(self, vol):
vol = vol/100.0
print vol
self.alarm.set_volume(vol)
self.memosound.set_volume(vol)
self.namesound.set_volume(vol)
self.ceasesound.set_volume(vol)
self.honksound.set_volume(vol)
def changeTheme(self, theme): def changeTheme(self, theme):
# check theme # check theme
try: try:
@ -2598,6 +2610,11 @@ class PesterWindow(MovingWindow):
curnamesound = self.config.nameSound() curnamesound = self.config.nameSound()
if namesoundsetting != curnamesound: if namesoundsetting != curnamesound:
self.config.set('nameSound', namesoundsetting) self.config.set('nameSound', namesoundsetting)
volumesetting = self.optionmenu.volume.value()
curvolume = self.config.volume()
if volumesetting != curvolume:
self.config.set('volume', volumesetting)
self.setVolume(volumesetting)
# timestamps # timestamps
timestampsetting = self.optionmenu.timestampcheck.isChecked() timestampsetting = self.optionmenu.timestampcheck.isChecked()
self.config.set("showTimeStamps", timestampsetting) self.config.set("showTimeStamps", timestampsetting)