diff --git a/src/ui/JoystickWidget.cc b/src/ui/JoystickWidget.cc index ddd54acbb2c02dc3ff7f8f59098d8a74c58deca0..95b8fb8ebad1300b9dd34534222064033abd0807 100644 --- a/src/ui/JoystickWidget.cc +++ b/src/ui/JoystickWidget.cc @@ -7,6 +7,7 @@ JoystickWidget::JoystickWidget(JoystickInput* joystick, QWidget *parent) : m_ui(new Ui::JoystickWidget) { m_ui->setupUi(this); + clearKeys(); this->joystick = joystick; m_ui->rollMapSpinBox->setValue(joystick->getMappingXAxis()); @@ -87,55 +88,59 @@ void JoystickWidget::clearKeys() { QString colorstyle; QColor buttonStyleColor = QColor(200, 20, 20); - colorstyle = QString("QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}").arg(buttonStyleColor.name()); - - m_ui->buttonLabel0->setStyleSheet(colorstyle); - m_ui->buttonLabel1->setStyleSheet(colorstyle); - m_ui->buttonLabel2->setStyleSheet(colorstyle); - m_ui->buttonLabel3->setStyleSheet(colorstyle); - m_ui->buttonLabel4->setStyleSheet(colorstyle); - m_ui->buttonLabel5->setStyleSheet(colorstyle); - m_ui->buttonLabel6->setStyleSheet(colorstyle); - m_ui->buttonLabel7->setStyleSheet(colorstyle); - m_ui->buttonLabel8->setStyleSheet(colorstyle); - m_ui->buttonLabel9->setStyleSheet(colorstyle); + colorstyle = QString("QLabel { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}").arg(buttonStyleColor.name()); + + m_ui->button0->setStyleSheet(colorstyle); + m_ui->button1->setStyleSheet(colorstyle); + m_ui->button2->setStyleSheet(colorstyle); + m_ui->button3->setStyleSheet(colorstyle); + m_ui->button4->setStyleSheet(colorstyle); + m_ui->button5->setStyleSheet(colorstyle); + m_ui->button6->setStyleSheet(colorstyle); + m_ui->button7->setStyleSheet(colorstyle); + m_ui->button8->setStyleSheet(colorstyle); + m_ui->button9->setStyleSheet(colorstyle); + m_ui->button10->setStyleSheet(colorstyle); } void JoystickWidget::pressKey(int key) { QString colorstyle; QColor buttonStyleColor = QColor(20, 200, 20); - colorstyle = QString("QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}").arg(buttonStyleColor.name()); + colorstyle = QString("QLabel { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: %1;}").arg(buttonStyleColor.name()); switch(key) { case 0: - m_ui->buttonLabel0->setStyleSheet(colorstyle); + m_ui->button0->setStyleSheet(colorstyle); break; case 1: - m_ui->buttonLabel1->setStyleSheet(colorstyle); + m_ui->button1->setStyleSheet(colorstyle); break; case 2: - m_ui->buttonLabel2->setStyleSheet(colorstyle); + m_ui->button2->setStyleSheet(colorstyle); break; case 3: - m_ui->buttonLabel3->setStyleSheet(colorstyle); + m_ui->button3->setStyleSheet(colorstyle); break; case 4: - m_ui->buttonLabel4->setStyleSheet(colorstyle); + m_ui->button4->setStyleSheet(colorstyle); break; case 5: - m_ui->buttonLabel5->setStyleSheet(colorstyle); + m_ui->button5->setStyleSheet(colorstyle); break; case 6: - m_ui->buttonLabel6->setStyleSheet(colorstyle); + m_ui->button6->setStyleSheet(colorstyle); break; case 7: - m_ui->buttonLabel7->setStyleSheet(colorstyle); + m_ui->button7->setStyleSheet(colorstyle); break; case 8: - m_ui->buttonLabel8->setStyleSheet(colorstyle); + m_ui->button8->setStyleSheet(colorstyle); break; case 9: - m_ui->buttonLabel9->setStyleSheet(colorstyle); + m_ui->button9->setStyleSheet(colorstyle); + break; + case 10: + m_ui->button10->setStyleSheet(colorstyle); break; } QTimer::singleShot(20, this, SLOT(clearKeys())); diff --git a/src/ui/JoystickWidget.ui b/src/ui/JoystickWidget.ui index 7b76f4b02d757cd41503baa48031efa8f1a04dec..5c426fc3bc86ee9a0ce3e4844274c5a53137eb6a 100644 --- a/src/ui/JoystickWidget.ui +++ b/src/ui/JoystickWidget.ui @@ -6,8 +6,8 @@ 0 0 - 654 - 376 + 497 + 448 @@ -19,416 +19,314 @@ Dialog - + 8 8 - - - - No joystick detecte yet.. waiting + + + + + 0 + 0 + - - - - - 60 - 16777215 + 40 + 400 - Throttle + Buttons - + + Qt::AlignCenter + + + false + + - 0 + 1 - 2 + 3 - - - - 40 - 20 - - - - 0 - - - Qt::Vertical - - - - - - - - - - Stick - - - - 6 - - - - - -100 - - - 100 - - - Qt::Horizontal - - - - - - - - 40 - 24 - - - - QFrame::Plain - - + + true - - 3 - - - QLCDNumber::Flat + + + 0 + 0 + - - - - - - -100 - - - 100 - - - - - - Y + 0 - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - X - - - - - - - - 0 - 0 - - - - - 40 - 24 - - - - QFrame::Plain - - - true - - - 3 - - - QLCDNumber::Flat + Qt::AlignCenter - - - - -100 - - - 100 - - - Qt::Vertical - - - - - - - - - - - 40 - 16777215 - - - - Buttons - - - - 2 - - - - false + + + true - - QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: #FF2222;} + + + 0 + 0 + - - + + 1 - - false + + Qt::AlignCenter - - - false + + + true - - QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: #FF2222;} + + + 0 + 0 + - - + + 2 - - false + + Qt::AlignCenter - - - false + + + true - - QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: #FF2222;} + + + 0 + 0 + - - + + 3 - - false + + Qt::AlignCenter - - - false + + + true - - QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: #FF2222;} + + + 0 + 0 + - - + + 4 - - false + + Qt::AlignCenter - - - false + + + true - - QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: #FF2222;} + + + 0 + 0 + - - + + 5 - - false + + Qt::AlignCenter - - - false + + + true - - QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: #FF2222;} + + + 0 + 0 + - - + + 6 - - false + + Qt::AlignCenter - - - false + + + true - - QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: #FF2222;} + + + 0 + 0 + - - + + 7 - - false + + Qt::AlignCenter - - - false + + + true - - QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: #FF2222;} + + + 0 + 0 + - - + + 8 - - false + + Qt::AlignCenter - - - false + + + true - - QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: #FF2222;} + + + 0 + 0 + - - + + 9 - - false + + Qt::AlignCenter - - - false + + + true - - QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: #FF2222;} + + + 0 + 0 + - - + + 10 - - false + + Qt::AlignCenter - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - + Mappings - - + + Qt::AlignCenter + + + Throttle - + Stabilized Button - + Auto Button - + Manual Button - + Pitch Axis - + Yaw Axis - + Roll Axis - + Qt::Vertical @@ -441,30 +339,224 @@ - + - + - + - + - + - + - + + + + + Stick + + + Qt::AlignCenter + + + + 6 + + + + + + 0 + 0 + + + + + 40 + 24 + + + + QFrame::Plain + + + true + + + 3 + + + QLCDNumber::Flat + + + + + + + false + + + -100 + + + 100 + + + Qt::Vertical + + + + + + + true + + + + 40 + 24 + + + + QFrame::Plain + + + true + + + 3 + + + QLCDNumber::Flat + + + + + + + false + + + -100 + + + 100 + + + + + + + Y + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + false + + + -100 + + + 100 + + + Qt::Horizontal + + + + + + + X + + + + + + + + + + + 60 + 16777215 + + + + Throttle + + + + 0 + + + 2 + + + + + true + + + + 40 + 20 + + + + 0 + + + Qt::Vertical + + + + + + + + + + + + 1 + + + No joystick detected yet.. waiting + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + +