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())); }
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())); }