VirtualKeyboardMouseWidget::VirtualKeyboardMouseWidget(JoyButton *button, QWidget *parent) : QTabWidget(parent) { populateTopRowKeys(); this->button = button; keyboardTab = new QWidget(this); mouseTab = new QWidget(this); noneButton = createNoneKey(); this->addTab(keyboardTab, tr("Keyboard")); this->addTab(mouseTab, tr("Mouse")); this->setTabPosition(QTabWidget::South); setupVirtualKeyboardLayout(); setupMouseControlLayout(); establishVirtualKeyboardSingleSignalConnections(); establishVirtualMouseSignalConnections(); QTimer::singleShot(0, this, SLOT(setButtonFontSizes())); connect(mouseSettingsPushButton, SIGNAL(clicked()), this, SLOT(openMouseSettingsDialog())); }
DPadEditDialog::DPadEditDialog(JoyDPad *dpad, QWidget *parent) : QDialog(parent, Qt::Window), ui(new Ui::DPadEditDialog) { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); this->dpad = dpad; updateWindowTitleDPadName(); if (dpad->getJoyMode() == JoyDPad::StandardMode) { ui->joyModeComboBox->setCurrentIndex(0); } else if (dpad->getJoyMode() == JoyDPad::EightWayMode) { ui->joyModeComboBox->setCurrentIndex(1); } else if (dpad->getJoyMode() == JoyDPad::FourWayCardinal) { ui->joyModeComboBox->setCurrentIndex(2); } else if (dpad->getJoyMode() == JoyDPad::FourWayDiagonal) { ui->joyModeComboBox->setCurrentIndex(3); } selectCurrentPreset(); ui->dpadNameLineEdit->setText(dpad->getDpadName()); unsigned int dpadDelay = dpad->getDPadDelay(); ui->dpadDelaySlider->setValue(dpadDelay * .1); ui->dpadDelayDoubleSpinBox->setValue(dpadDelay * .001); connect(ui->presetsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(implementPresets(int))); connect(ui->joyModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(implementModes(int))); connect(ui->mouseSettingsPushButton, SIGNAL(clicked()), this, SLOT(openMouseSettingsDialog())); connect(ui->dpadNameLineEdit, SIGNAL(textEdited(QString)), dpad, SLOT(setDPadName(QString))); connect(ui->dpadDelaySlider, SIGNAL(valueChanged(int)), this, SLOT(updateJoyDPadDelay(int))); connect(dpad, SIGNAL(dpadDelayChanged(int)), this, SLOT(updateDPadDelaySpinBox(int))); connect(ui->dpadDelayDoubleSpinBox, SIGNAL(valueChanged(double)), this, SLOT(updateDPadDelaySlider(double))); connect(dpad, SIGNAL(dpadNameChanged()), this, SLOT(updateWindowTitleDPadName())); }
void JoyAxisContextMenu::buildTriggerMenu() { QAction *action = 0; QActionGroup *presetGroup = new QActionGroup(this); int presetMode = 0; int currentPreset = getTriggerPresetIndex(); action = this->addAction(tr("Left Mouse Button")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setTriggerPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Right Mouse Button")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setTriggerPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("None")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setTriggerPreset())); presetGroup->addAction(action); this->addSeparator(); action = this->addAction(tr("Mouse Settings")); action->setCheckable(false); connect(action, SIGNAL(triggered()), this, SLOT(openMouseSettingsDialog())); }
void JoyControlStickContextMenu::buildMenu() { QAction *action = 0; QActionGroup *presetGroup = new QActionGroup(this); int presetMode = 0; int currentPreset = getPresetIndex(); action = this->addAction(tr("Mouse (Normal)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setStickPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Mouse (Inverted Horizontal)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setStickPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Mouse (Inverted Vertical)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setStickPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Mouse (Inverted Horizontal + Vertical)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setStickPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Arrows")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setStickPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Keys: W | A | S | D")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setStickPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("NumPad")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setStickPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("None")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setStickPreset())); presetGroup->addAction(action); this->addSeparator(); QActionGroup *modesGroup = new QActionGroup(this); int mode = (int)JoyControlStick::StandardMode; action = this->addAction(tr("Standard")); action->setCheckable(true); action->setChecked(stick->getJoyMode() == JoyControlStick::StandardMode); action->setData(QVariant(mode)); connect(action, SIGNAL(triggered()), this, SLOT(setStickMode())); modesGroup->addAction(action); action = this->addAction(tr("Eight Way")); action->setCheckable(true); action->setChecked(stick->getJoyMode() == JoyControlStick::EightWayMode); mode = (int)JoyControlStick::EightWayMode; action->setData(QVariant(mode)); connect(action, SIGNAL(triggered()), this, SLOT(setStickMode())); modesGroup->addAction(action); action = this->addAction(tr("4 Way Cardinal")); action->setCheckable(true); action->setChecked(stick->getJoyMode() == JoyControlStick::FourWayCardinal); mode = (int)JoyControlStick::FourWayCardinal; action->setData(QVariant(mode)); connect(action, SIGNAL(triggered()), this, SLOT(setStickMode())); modesGroup->addAction(action); action = this->addAction(tr("4 Way Diagonal")); action->setCheckable(true); action->setChecked(stick->getJoyMode() == JoyControlStick::FourWayDiagonal); mode = (int)JoyControlStick::FourWayDiagonal; action->setData(QVariant(mode)); connect(action, SIGNAL(triggered()), this, SLOT(setStickMode())); modesGroup->addAction(action); this->addSeparator(); action = this->addAction(tr("Mouse Settings")); action->setCheckable(false); connect(action, SIGNAL(triggered()), this, SLOT(openMouseSettingsDialog())); }
AxisEditDialog::AxisEditDialog(JoyAxis *axis, QWidget *parent) : QDialog(parent, Qt::Window), ui(new Ui::AxisEditDialog) { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); setAxisThrottleConfirm = new SetAxisThrottleDialog(axis, this); this->axis = axis; updateWindowTitleAxisName(); initialThrottleState = axis->getThrottle(); ui->horizontalSlider->setValue(axis->getDeadZone()); ui->lineEdit->setText(QString::number(axis->getDeadZone())); ui->horizontalSlider_2->setValue(axis->getMaxZoneValue()); ui->lineEdit_2->setText(QString::number(axis->getMaxZoneValue())); JoyAxisButton *nButton = axis->getNAxisButton(); if (!nButton->getActionName().isEmpty()) { ui->nPushButton->setText(nButton->getActionName()); } else { ui->nPushButton->setText(nButton->getSlotsSummary()); } JoyAxisButton *pButton = axis->getPAxisButton(); if (!pButton->getActionName().isEmpty()) { ui->pPushButton->setText(pButton->getActionName()); } else { ui->pPushButton->setText(pButton->getSlotsSummary()); } int currentThrottle = axis->getThrottle(); //ui->comboBox_2->setCurrentIndex(currentThrottle+1); if (currentThrottle == JoyAxis::NegativeThrottle || currentThrottle == JoyAxis::NegativeHalfThrottle) { int tempindex = currentThrottle == JoyAxis::NegativeHalfThrottle ? 0 : 1; ui->comboBox_2->setCurrentIndex(tempindex); ui->nPushButton->setEnabled(true); ui->pPushButton->setEnabled(false); } else if (currentThrottle == JoyAxis::PositiveThrottle || currentThrottle == JoyAxis::PositiveHalfThrottle) { int tempindex = currentThrottle == JoyAxis::PositiveThrottle ? 3 : 4; ui->comboBox_2->setCurrentIndex(tempindex); ui->pPushButton->setEnabled(true); ui->nPushButton->setEnabled(false); } ui->axisstatusBox->setDeadZone(axis->getDeadZone()); ui->axisstatusBox->setMaxZone(axis->getMaxZoneValue()); ui->axisstatusBox->setThrottle(axis->getThrottle()); ui->joyValueLabel->setText(QString::number(axis->getCurrentRawValue())); ui->axisstatusBox->setValue(axis->getCurrentRawValue()); selectCurrentPreset(); ui->axisNameLineEdit->setText(axis->getAxisName()); connect(ui->presetsComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(implementPresets(int))); connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(updateDeadZoneBox(int))); connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), ui->axisstatusBox, SLOT(setDeadZone(int))); connect(ui->horizontalSlider, SIGNAL(valueChanged(int)), axis, SLOT(setDeadZone(int))); connect(ui->horizontalSlider_2, SIGNAL(valueChanged(int)), this, SLOT(updateMaxZoneBox(int))); connect(ui->horizontalSlider_2, SIGNAL(valueChanged(int)), ui->axisstatusBox, SLOT(setMaxZone(int))); connect(ui->horizontalSlider_2, SIGNAL(valueChanged(int)), axis, SLOT(setMaxZoneValue(int))); connect(ui->comboBox_2, SIGNAL(currentIndexChanged(int)), this, SLOT(updateThrottleUi(int))); connect(axis, SIGNAL(moved(int)), ui->axisstatusBox, SLOT(setValue(int))); connect(axis, SIGNAL(moved(int)), this, SLOT(updateJoyValue(int))); connect(ui->lineEdit, SIGNAL(textEdited(QString)), this, SLOT(updateDeadZoneSlider(QString))); connect(ui->lineEdit_2, SIGNAL(textEdited(QString)), this, SLOT(updateMaxZoneSlider(QString))); connect(ui->nPushButton, SIGNAL(clicked()), this, SLOT(openAdvancedNDialog())); connect(ui->pPushButton, SIGNAL(clicked()), this, SLOT(openAdvancedPDialog())); connect(ui->mouseSettingsPushButton, SIGNAL(clicked()), this, SLOT(openMouseSettingsDialog())); connect(ui->axisNameLineEdit, SIGNAL(textEdited(QString)), axis, SLOT(setAxisName(QString))); connect(axis, SIGNAL(axisNameChanged()), this, SLOT(updateWindowTitleAxisName())); connect(this, SIGNAL(finished(int)), this, SLOT(checkFinalSettings())); }
void JoyAxisContextMenu::buildAxisMenu() { QAction *action = 0; QActionGroup *presetGroup = new QActionGroup(this); int presetMode = 0; int currentPreset = getPresetIndex(); action = this->addAction(tr("Mouse (Horizontal)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setAxisPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Mouse (Inverted Horizontal)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setAxisPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Mouse (Vertical)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setAxisPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Mouse (Inverted Vertical)")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setAxisPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Arrows: Up | Down")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setAxisPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Arrows: Left | Right")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setAxisPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Keys: W | S")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setAxisPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("Keys: A | D")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setAxisPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("NumPad: KP_8 | KP_2")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setAxisPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("NumPad: KP_4 | KP_6")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setAxisPreset())); presetGroup->addAction(action); presetMode++; action = this->addAction(tr("None")); action->setCheckable(true); action->setChecked(currentPreset == presetMode+1); action->setData(QVariant(presetMode)); connect(action, SIGNAL(triggered()), this, SLOT(setAxisPreset())); presetGroup->addAction(action); this->addSeparator(); action = this->addAction(tr("Mouse Settings")); action->setCheckable(false); connect(action, SIGNAL(triggered()), this, SLOT(openMouseSettingsDialog())); }