Skip to content

Commit

Permalink
FIX(client): Improve handling of the GlobalShortcutButtons dialog
Browse files Browse the repository at this point in the history
This commits sets the shortcut configuration dialog as a modal window.
It also explicitly uses the MainWindow as a parent, such that the window
is centered over the Mumble application instead of randomly out of bounds
of the screen.
  • Loading branch information
Hartmnt committed May 31, 2024
1 parent 7a6274f commit 7452063
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/mumble/GlobalShortcutButtons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,25 @@

#include "Global.h"

#include <QRect>
#include <QTimer>

GlobalShortcutButtons::GlobalShortcutButtons(QWidget *parent) : QDialog(parent), m_ui(new Ui::GlobalShortcutButtons) {
m_ui->setupUi(this);
setModal(true);

connect(m_ui->addButton, &QPushButton::toggled, this, &GlobalShortcutButtons::toggleCapture);
connect(m_ui->removeButton, &QPushButton::clicked, this, &GlobalShortcutButtons::removeItem);

QWidget *dialogParent = parent;
while (dialogParent && !qobject_cast< QDialog * >(dialogParent)) {
dialogParent = dialogParent->parentWidget();
}

if (dialogParent) {
QRect geometry = dialogParent->geometry();
move(geometry.center().x(), geometry.center().y());
}
}

GlobalShortcutButtons::~GlobalShortcutButtons() {
Expand Down

0 comments on commit 7452063

Please sign in to comment.