Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT(client): Toggle positional audio shortcut #6133 #6326

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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(QLatin1String("gsTogglePositionalAudio"));
gsTogglePositionalAudio->qsWhatsThis = tr("This will turn on/off positional audio");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gsTogglePositionalAudio->qsWhatsThis = tr("This will turn on/off positional audio");
gsTogglePositionalAudio->qsWhatsThis = tr("This will toggle positional audio on/off");


#ifndef Q_OS_MAC
qstiIcon->show();
#endif
Expand Down Expand Up @@ -3350,6 +3355,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 @@ -4152,6 +4165,10 @@ void MainWindow::versionCheck() {
new VersionCheck(false, this);
}

void MainWindow::togglePositionalAudio(const bool &newState) {
Global::get().s.bPositionalAudio = newState;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not what the name suggests. If it is supposed to toggle the positional audio state, this function shouldn't take a parameter for the new state as the new state is simply the inverted old state (e.g. state = !state). If in fact you want to be able to set the state of positional audio, the function should be called setPositionalAudio or even better enablePositionalAudio.

}

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 @@ -336,6 +337,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 @@ -431,6 +433,7 @@ public slots:
void openAboutDialog();
void openAboutQtDialog();
void versionCheck();
void togglePositionalAudio(const bool &newState);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you take the boolean parameter by reference? This seems unnecessary as the size of a boolean is quite a bit smaller than the size of a pointer (which is what a reference really is, under the hood) and therefore passing the boolean by value should be more efficient.
Premature optimizations aside, I think it would also be clearer to pass by value as passing a boolean by reference introduces the semantics that it shall act as some kind of out-parameter (though that is of course not possible here due to the const qualification).

So in short: Unless you have good reason to do so, I would prefer if we passed the boolean by value instead of by reference.

};

#endif
9 changes: 9 additions & 0 deletions src/mumble/mumble_ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6630,6 +6630,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_bg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6627,6 +6627,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_br.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6626,6 +6626,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6652,6 +6652,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6686,6 +6686,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6630,6 +6630,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_da.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6682,6 +6682,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished">Nej</translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6773,6 +6773,15 @@ Gültige Optionen sind:
<source>No</source>
<translation type="unfinished">Nein</translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_el.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6780,6 +6780,15 @@ mumble://[&lt;username&gt;[:&lt;password&gt;]@]&lt;host&gt;[:&lt;port&gt;][/&lt;
<source>No</source>
<translation type="unfinished">Όχι</translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6625,6 +6625,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_en_GB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6679,6 +6679,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_eo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6638,6 +6638,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6781,6 +6781,15 @@ Las opciones válidas son:
<source>No</source>
<translation type="unfinished">No</translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_et.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6627,6 +6627,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_eu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6647,6 +6647,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_fa_IR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6627,6 +6627,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_fi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6779,6 +6779,15 @@ Hyväksytyt valinnat ovat
<source>No</source>
<translation type="unfinished">Ei</translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6787,6 +6787,15 @@ Les options valides sont :
<source>No</source>
<translation type="unfinished">Non</translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_gl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6628,6 +6628,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down
9 changes: 9 additions & 0 deletions src/mumble/mumble_he.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6678,6 +6678,15 @@ Valid options are:
<source>No</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle positional audio</source>
<comment>Global Shortcut</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This will turn on/off positional audio</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Manual</name>
Expand Down