-
Notifications
You must be signed in to change notification settings - Fork 1k
Push-to-talk using Libuiohook #6185
base: master
Are you sure you want to change the base?
Conversation
0451681
to
492d1a3
Compare
492d1a3
to
2ba1466
Compare
I think the code is ready to go, there's just the small issue of libuiohook causing every test to segfault in CI. This is because it's doing registration with the system during library load, and that's failing because there's no display present. To work around this I'll have to avoid linking libuiohook until qTox can verify that a display is present, then load it in code at that time. |
b182617
to
a9e1006
Compare
Updated to load libuiohook at runtime instead of linking to it, and made the AV form's option for PTT dynamically dependent on the ability to load the lib, and I've cleaned up git history to a point where I think this is ready to be reviewed and tested. It looks like CI is failing due to this issue:
which I've been seeing for about a week. |
1e1c7db
to
3a04c04
Compare
66b7085
to
f49181b
Compare
Tested on Windows, a couple issues:
Other than that it works well. OSX isn't tested yet, but I've got an environment set up to test, just don't see where I can grab the build from from the CI. Will build locally a try it, but at least issue 2) should still be present. |
0ec1f30
to
bd47313
Compare
a947eab
to
f71ea54
Compare
I've added a single commit backing out the (otherwise working) macOS implementation. This commit can be backed out when #6214 is fixed. I'd still like to merge this PR as-is since setting up permission management is a fairly unrelated task, this works fully on Windows, and this would help testing on macOS in the future by just backing out the last commit. If the reviewer doesn't want a change that includes then backs out macOS support that's reasonable, but I think it would be nice to have a finished working version of adding hook to the macOS for future use. |
026f826
to
2e5fed5
Compare
On second thought adding macOS support then backing it out in the same PR is dumb. I've just added support on top of this change and pushed that to https://github.com/anthonybilinski/qTox/tree/libuiohook_ptt_macos, which I've mentioned in #6214. This PR now only adds Linux and Windows support, and doesn't touch macOS at all. Once permissions are properly handled on macOS in #6214, it should be very easy to just include the one commit from https://github.com/anthonybilinski/qTox/tree/libuiohook_ptt_macos. |
4583014
to
e0f58fb
Compare
Trying it out and just a couple comments
This may be related to my libuiohook version. I have version 1.0.3 from https://aur.archlinux.org/packages/libuiohook/
I'm not sure if any of these should block the PR, just making them known just in case. @anthonybilinski let me know if you want me to proceed with review now or hold off until some of the above are addressed. |
e0f58fb
to
4a39179
Compare
Adds a selection of audio capture mode (continuous/voice activation/push to talk) in audio/video settings and an ability to set a push to talk hotkey.
We still need to also save the key codes though since the QKeyEvent holds both but we can't necessarily convert from one to the other.
The mute option in each call is toggled when the key combo is pressed, so this feature is also effectively push-to-mute as well if users are unmuted in chat to start. Load libuiohook at runtime because it registers with the OS on library load, and segfaults if no window system is available, e.g. for unit tests.
Don't add to macOS build yet due to macOS specific issues, qTox#6214
To avoid the old shortcut from interfering with the entering of the new one.
Clearing all PTT keys just puts us in a state where the input mode is still PTT, but we're effectively in continuous mode. Just let the user change to continuous mode to disable PTT. Also the text said that esc cancelled, but really leaving focus cancels and ESC just cleared.
4a39179
to
5908f21
Compare
Installed this but seems Install log:
No relevant output in qTox log. I think it could make sense to log if I don't need any special build flags for qTox, do I? UI for audio activation looks very nice now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 6 of 19 files at r6.
Reviewable status: 0 of 1 LGTMs obtained
src/hookmanager.cpp, line 43 at r6 (raw file):
case UIOHOOK_SUCCESS: return;
whitespace error
src/persistence/settings.h, line 367 at r6 (raw file):
} void setOutVolume(int volume) override;
whitespace error
src/persistence/settings.h, line 370 at r6 (raw file):
AudioCaptureMode getAudioCaptureMode() const override; void setAudioCaptureMode(AudioCaptureMode mode) override;
whitespace error
src/persistence/settings.h, line 376 at r6 (raw file):
QList<int> getPttShortcutNames() const override; void setPttShortcutNames(QList<int> keys) override;
whitespace error
src/widget/form/settings/avform.cpp, line 581 at r6 (raw file):
pushToTalkShortcutLabel->hide(); pushToTalkShortcutInput->hide();
whitespace error
src/widget/form/settings/avform.cpp, line 598 at r6 (raw file):
void AVForm::on_inModeComboBox_currentIndexChanged(int index) { const IAudioSettings::AudioCaptureMode mode = static_cast<IAudioSettings::AudioCaptureMode>(inModeComboBox->currentData().toInt());
whitespace error
This change is
This is currently in a working state. TODOs are
Overall this is way less work than the previous implementations. A couple limitations using this approach: