Implement volume shortcuts (for feature request #1954994: volume keybind)

git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@1162 05730e5d-ab1b-0410-a4ac-84af385074fa
This commit is contained in:
Mikkel Krautz 2008-05-27 22:57:10 +00:00
parent ab53c51e8a
commit e0617e0660
3 changed files with 26 additions and 3 deletions

View File

@ -167,7 +167,7 @@
<string>&lt;b>This adjusts the volume of incoming speech.&lt;/b>&lt;br />Note that this can only be used to decrease the volume. No amplification is possible.</string>
</property>
<property name="minimum" >
<number>10</number>
<number>0</number>
</property>
<property name="maximum" >
<number>100</number>

View File

@ -197,6 +197,12 @@ void MainWindow::createActions() {
gsMinimal=new GlobalShortcut(this, idx++, tr("Toggle Minimal", "Global Shortcut"));
gsMinimal->setObjectName(QLatin1String("ToggleMinimal"));
gsVolumeUp=new GlobalShortcut(this, idx++, tr("Volume Up (+10%)", "Global Shortcut"));
gsVolumeUp->setObjectName(QLatin1String("VolumeUp"));
gsVolumeDown=new GlobalShortcut(this, idx++, tr("Volume Down (-10%)", "Global Shortcut"));
gsVolumeDown->setObjectName(QLatin1String("VolumeDown"));
qstiIcon = new QSystemTrayIcon(qiIcon, this);
qstiIcon->setToolTip(tr("Mumble"));
qstiIcon->setObjectName(QLatin1String("Icon"));
@ -1028,6 +1034,22 @@ void MainWindow::on_CenterPos_triggered(bool down) {
}
}
void MainWindow::on_VolumeUp_triggered(bool down) {
if (down) {
float v = floorf(g.s.fVolume * 10.0);
if (v < 10.0)
g.s.fVolume = ++v / 10.0;
}
}
void MainWindow::on_VolumeDown_triggered(bool down) {
if (down) {
float v = ceilf(g.s.fVolume * 10.0);
if (v > 0.0)
g.s.fVolume = --v / 10.0;
}
}
void MainWindow::pushLink(bool down) {
if (down) {
g.iAltSpeak++;

View File

@ -78,8 +78,7 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin
GlobalShortcut *gsPushTalk, *gsResetAudio, *gsMuteSelf, *gsDeafSelf;
GlobalShortcut *gsUnlink, *gsCenterPos, *gsPushMute, *gsMetaChannel, *gsToggleOverlay;
GlobalShortcut *gsAltTalk;
GlobalShortcut *gsMinimal;
GlobalShortcut *gsAltTalk, *gsMinimal, *gsVolumeUp, *gsVolumeDown;
LogTitleBar *ltbDockTitle;
ACLEditor *aclEdit;
@ -146,6 +145,8 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin
void on_PushToMute_triggered(bool);
void on_AltPushToTalk_triggered(bool);
void on_CenterPos_triggered(bool);
void on_VolumeUp_triggered(bool);
void on_VolumeDown_triggered(bool);
void on_Reconnect_timeout();
void on_Icon_activated(QSystemTrayIcon::ActivationReason);
void serverConnected();