MCPcopy Create free account
hub / github.com/alpha-liu-01/SpeedyNote / ControllerMappingDialog

Method ControllerMappingDialog

source/ControllerMappingDialog.cpp:8–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <QApplication>
7
8ControllerMappingDialog::ControllerMappingDialog(SDLControllerManager *controllerManager, QWidget *parent)
9 : QDialog(parent), controller(controllerManager) {
10
11 setWindowTitle(tr("Controller Button Mapping"));
12 setModal(true);
13 resize(600, 500);
14
15 // Setup timeout timer for button mapping
16 mappingTimeoutTimer = new QTimer(this);
17 mappingTimeoutTimer->setSingleShot(true);
18 mappingTimeoutTimer->setInterval(10000); // 10 second timeout
19
20 connect(mappingTimeoutTimer, &QTimer::timeout, this, [this]() {
21 if (!currentMappingButton.isEmpty()) {
22 QMessageBox::information(this, tr("Mapping Timeout"),
23 tr("Button mapping timed out. Please try again."));
24
25 // Reset the button text
26 if (mappingButtons.contains(currentMappingButton)) {
27 mappingButtons[currentMappingButton]->setText(tr("Click to Map"));
28 mappingButtons[currentMappingButton]->setEnabled(true);
29 }
30
31 currentMappingButton.clear();
32 controller->stopButtonDetection();
33 }
34 });
35
36 // Connect to controller signals
37 connect(controller, &SDLControllerManager::rawButtonPressed,
38 this, &ControllerMappingDialog::onRawButtonPressed);
39
40 setupUI();
41 loadCurrentMappings();
42}
43
44void ControllerMappingDialog::setupUI() {
45 QVBoxLayout *mainLayout = new QVBoxLayout(this);

Callers

nothing calls this directly

Calls 6

connectFunction · 0.85
stopButtonDetectionMethod · 0.80
isEmptyMethod · 0.45
setTextMethod · 0.45
setEnabledMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected