From e6b6712c1d57b6e2555b10175f17b98bc1ef916c Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Fri, 24 Jun 2011 09:27:18 -0700 Subject: [PATCH] Volume control --- CHANGELOG.mkdn | 1 + menus.py | 15 +++++++++++++++ pesterchum.py | 17 +++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/CHANGELOG.mkdn b/CHANGELOG.mkdn index 0955c48..5b8cac5 100644 --- a/CHANGELOG.mkdn +++ b/CHANGELOG.mkdn @@ -50,6 +50,7 @@ CHANGELOG * Say something when server is full - Kiooeht [evacipatedBox] * Ping server if no ping from server to test connection - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance]) * MSPA comic update notifier - Kiooeht [evacipatedBox] +* Volume control - Kiooeht [evacipatedBox] * Bug fixes * Logviewer updates - Kiooeht [evacipatedBox] * Memo scrollbar thing - Kiooeht [evacipatedBox] diff --git a/menus.py b/menus.py index 33346a0..407e2d5 100644 --- a/menus.py +++ b/menus.py @@ -949,6 +949,14 @@ class PesterOptions(QtGui.QDialog): self.chatsoundcheck.setEnabled(False) self.memosoundcheck.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) @@ -1130,6 +1138,10 @@ class PesterOptions(QtGui.QDialog): layout_indent.addWidget(self.namesoundcheck) layout_indent.setContentsMargins(22,0,0,0) 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) # Logging @@ -1195,6 +1207,9 @@ class PesterOptions(QtGui.QDialog): self.chatsoundcheck.setEnabled(True) self.memosoundcheck.setEnabled(True) self.namesoundcheck.setEnabled(True) + @QtCore.pyqtSlot(int) + def printValue(self, v): + self.currentVol.setText(str(v)+"%") class PesterUserlist(QtGui.QDialog): def __init__(self, config, theme, parent): diff --git a/pesterchum.py b/pesterchum.py index 7f57200..23cad81 100644 --- a/pesterchum.py +++ b/pesterchum.py @@ -110,6 +110,7 @@ class waitingMessageHolder(object): class NoneSound(object): def play(self): pass + def set_volume(self, v): pass class PesterLog(object): def __init__(self, handle, parent=None): @@ -508,6 +509,8 @@ class userConfig(object): return self.config.get('memoSound', True) def nameSound(self): return self.config.get('nameSound', True) + def volume(self): + return self.config.get('volume', 100) def set(self, item, setting): self.config[item] = setting try: @@ -2023,6 +2026,15 @@ class PesterWindow(MovingWindow): self.ceasesound = 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): # check theme try: @@ -2598,6 +2610,11 @@ class PesterWindow(MovingWindow): curnamesound = self.config.nameSound() if namesoundsetting != curnamesound: 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 timestampsetting = self.optionmenu.timestampcheck.isChecked() self.config.set("showTimeStamps", timestampsetting)