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

Method createControllerMappingTab

source/ControlPanelDialog.cpp:1632–1673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1630*/
1631#ifdef SPEEDYNOTE_CONTROLLER_SUPPORT
1632void ControlPanelDialog::createControllerMappingTab() {
1633 controllerMappingTab = new QWidget(this);
1634 QVBoxLayout *layout = new QVBoxLayout(controllerMappingTab);
1635
1636 // Instructions
1637 QLabel *instructionLabel = new QLabel(tr("Configure physical controller button mappings for your Joy-Con or other controller:"), controllerMappingTab);
1638 instructionLabel->setWordWrap(true);
1639 layout->addWidget(instructionLabel);
1640
1641 QLabel *noteLabel = new QLabel(tr("Note: This maps your physical controller buttons to the logical Joy-Con functions used by the application. "
1642 "After setting up the physical mapping, you can configure what actions each logical button performs in the 'Button Mapping' tab."), controllerMappingTab);
1643 noteLabel->setWordWrap(true);
1644 noteLabel->setStyleSheet("color: gray; font-size: 10px; margin-bottom: 10px;");
1645 layout->addWidget(noteLabel);
1646
1647 // Button to open controller mapping dialog
1648 QPushButton *openMappingButton = new QPushButton(tr("Configure Controller Mapping"), controllerMappingTab);
1649 openMappingButton->setMinimumHeight(40);
1650 connect(openMappingButton, &QPushButton::clicked, this, &ControlPanelDialog::openControllerMapping);
1651 layout->addWidget(openMappingButton);
1652
1653 // Button to reconnect controller
1654 reconnectButton = new QPushButton(tr("Reconnect Controller"), controllerMappingTab);
1655 reconnectButton->setMinimumHeight(40);
1656 reconnectButton->setStyleSheet("QPushButton { background-color: #4CAF50; color: white; font-weight: bold; }");
1657 connect(reconnectButton, &QPushButton::clicked, this, &ControlPanelDialog::reconnectController);
1658 layout->addWidget(reconnectButton);
1659
1660 // Status information
1661 QLabel *statusLabel = new QLabel(tr("Current controller status:"), controllerMappingTab);
1662 statusLabel->setStyleSheet("font-weight: bold; margin-top: 20px;");
1663 layout->addWidget(statusLabel);
1664
1665 // Dynamic status label
1666 controllerStatusLabel = new QLabel(controllerMappingTab);
1667 updateControllerStatus();
1668 layout->addWidget(controllerStatusLabel);
1669
1670 layout->addStretch();
1671
1672 tabWidget->addTab(controllerMappingTab, tr("Controller Mapping"));
1673}
1674
1675void ControlPanelDialog::openControllerMapping() {
1676 if (!mainWindowRef) {

Callers

nothing calls this directly

Calls 3

connectFunction · 0.85
addWidgetMethod · 0.80
addStretchMethod · 0.45

Tested by

no test coverage detected