Skip to content

Commit

Permalink
FEAT(client): Toggle positional audio shortcut
Browse files Browse the repository at this point in the history
Added new global shortcut that toggles the state of positional audio

Fixes #6133
  • Loading branch information
GrossTrevor authored and Krzmbrzl committed Oct 3, 2024
1 parent 1a630e1 commit e4b78f2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mumble/GlobalShortcutTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ enum Type {
HelpAbout,
HelpAboutQt,
HelpVersionCheck,
TogglePositionalAudio,
};

// A few assertions meant to catch, if anyone inserts a new value in-between instead of appending
Expand All @@ -65,6 +66,7 @@ static_assert(PushToTalk == 1, "You may only append to the end of the enum!");
static_assert(ToggleMinimalView == 9, "You may only append to the end of the enum!");
static_assert(ToggleSearch == 22, "You may only append to the end of the enum!");
static_assert(HelpVersionCheck == 43, "You may only append to the end of the enum!");
static_assert(TogglePositionalAudio == 44, "You may only append to the end of the enum!");
} // namespace GlobalShortcutType

#endif // MUMBLE_MUMBLE_GLOBALSHORTCUTTYPES_H_
17 changes: 17 additions & 0 deletions src/mumble/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,11 @@ void MainWindow::createActions() {
gsHelpVersionCheck->setObjectName(QLatin1String("gsHelpVersionCheck"));
gsHelpVersionCheck->qsWhatsThis = tr("This will check if mumble is up to date");

gsTogglePositionalAudio = new GlobalShortcut(this, GlobalShortcutType::TogglePositionalAudio,
tr("Toggle positional audio", "Global Shortcut"));
gsTogglePositionalAudio->setObjectName("gsTogglePositionalAudio");
gsTogglePositionalAudio->qsWhatsThis = tr("This will toggle positional audio on/off");

#ifndef Q_OS_MAC
qstiIcon->show();
#endif
Expand Down Expand Up @@ -3386,6 +3391,14 @@ void MainWindow::on_gsHelpVersionCheck_triggered(bool down, QVariant) {
versionCheck();
}

void MainWindow::on_gsTogglePositionalAudio_triggered(bool down, QVariant) {
if (!down) {
return;
}

togglePositionalAudio(!Global::get().s.bPositionalAudio);
}


void MainWindow::whisperReleased(QVariant scdata) {
if (Global::get().iPushToTalk <= 0)
Expand Down Expand Up @@ -4188,6 +4201,10 @@ void MainWindow::versionCheck() {
new VersionCheck(false, this);
}

void MainWindow::enablePositionalAudio(bool enable) {
Global::get().s.bPositionalAudio = enable;
}

void MainWindow::on_muteCuePopup_triggered() {
if (Global::get().s.muteCueShown || Global::get().inConfigUI) {
return;
Expand Down
3 changes: 3 additions & 0 deletions src/mumble/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindow {
GlobalShortcut *gsConfigDialog, *gsAudioWizard, *gsConfigCert;
GlobalShortcut *gsAudioTTS;
GlobalShortcut *gsHelpAbout, *gsHelpAboutQt, *gsHelpVersionCheck;
GlobalShortcut *gsTogglePositionalAudio;

DockTitleBar *dtbLogDockTitle, *dtbChatDockTitle;

Expand Down Expand Up @@ -342,6 +343,7 @@ public slots:
void on_gsHelpAbout_triggered(bool, QVariant);
void on_gsHelpAboutQt_triggered(bool, QVariant);
void on_gsHelpVersionCheck_triggered(bool, QVariant);
void on_gsTogglePositionalAudio_triggered(bool, QVariant);

void on_Reconnect_timeout();
void on_Icon_activated(QSystemTrayIcon::ActivationReason);
Expand Down Expand Up @@ -437,6 +439,7 @@ public slots:
void openAboutDialog();
void openAboutQtDialog();
void versionCheck();
void enablePositionalAudio(bool enable);
};

#endif

0 comments on commit e4b78f2

Please sign in to comment.