Add trim keys to 9x simu too while we're at it

This commit is contained in:
Andre Bernet
2014-04-06 22:38:58 +02:00
parent d33d2b7ae6
commit 514d3fdad2
3 changed files with 280 additions and 77 deletions
+237 -69
View File
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>653</width>
<width>739</width>
<height>613</height>
</rect>
</property>
@@ -73,23 +73,7 @@
<number>6</number>
</property>
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0">
<item row="1" column="2">
<widget class="mySlider" name="trimVLeft">
<property name="toolTip">
<string>Right Double Click to Reset</string>
</property>
<property name="minimum">
<number>-125</number>
</property>
<property name="maximum">
<number>125</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0">
<item row="1" column="1">
<widget class="QGraphicsView" name="leftStick">
<property name="minimumSize">
@@ -360,7 +344,7 @@ QPushButton:checked {
</item>
</layout>
</item>
<item row="7" column="1">
<item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="leftMargin">
<number>20</number>
@@ -391,42 +375,126 @@ QPushButton:checked {
</layout>
</item>
<item row="2" column="1">
<widget class="mySlider" name="trimHLeft">
<property name="toolTip">
<string>Right Double Click to Reset</string>
</property>
<property name="minimum">
<number>-125</number>
</property>
<property name="maximum">
<number>125</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="trimHL_L">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>23</width>
<height>23</height>
</size>
</property>
<property name="text">
<string notr="true">&lt;-</string>
</property>
</widget>
</item>
<item>
<widget class="mySlider" name="trimHLeft">
<property name="toolTip">
<string>Right Double Click to Reset</string>
</property>
<property name="minimum">
<number>-125</number>
</property>
<property name="maximum">
<number>125</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="trimHL_R">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>23</width>
<height>23</height>
</size>
</property>
<property name="text">
<string notr="true">-&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QPushButton" name="trimVL_U">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>23</width>
<height>23</height>
</size>
</property>
<property name="text">
<string notr="true">^</string>
</property>
</widget>
</item>
<item>
<widget class="mySlider" name="trimVLeft">
<property name="toolTip">
<string>Right Double Click to Reset</string>
</property>
<property name="minimum">
<number>-125</number>
</property>
<property name="maximum">
<number>125</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="trimVL_D">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>23</width>
<height>23</height>
</size>
</property>
<property name="text">
<string notr="true">v</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="2">
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0">
<item row="1" column="0">
<widget class="mySlider" name="trimVRight">
<property name="toolTip">
<string>Right Double Click to Reset</string>
</property>
<property name="minimum">
<number>-125</number>
</property>
<property name="maximum">
<number>125</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,0,0,0">
<item row="1" column="2">
<widget class="QGraphicsView" name="rightStick">
<property name="minimumSize">
<size>
@@ -442,7 +510,7 @@ QPushButton:checked {
</property>
</widget>
</item>
<item row="1" column="2">
<item row="1" column="3">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="switchTRN">
@@ -609,7 +677,7 @@ QPushButton:checked {
</item>
</layout>
</item>
<item row="0" column="1">
<item row="0" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="holdRightX">
@@ -733,7 +801,7 @@ QPushButton:checked {
</item>
</layout>
</item>
<item row="3" column="1">
<item row="4" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="leftMargin">
<number>20</number>
@@ -763,21 +831,121 @@ QPushButton:checked {
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="mySlider" name="trimHRight">
<property name="toolTip">
<string>Right Double Click to Reset</string>
</property>
<property name="minimum">
<number>-125</number>
</property>
<property name="maximum">
<number>125</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<item row="2" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="trimHR_L">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>23</width>
<height>23</height>
</size>
</property>
<property name="text">
<string notr="true">&lt;-</string>
</property>
</widget>
</item>
<item>
<widget class="mySlider" name="trimHRight">
<property name="toolTip">
<string>Right Double Click to Reset</string>
</property>
<property name="minimum">
<number>-125</number>
</property>
<property name="maximum">
<number>125</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="trimHR_R">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>23</width>
<height>23</height>
</size>
</property>
<property name="text">
<string notr="true">-&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QPushButton" name="trimVR_U">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>23</width>
<height>23</height>
</size>
</property>
<property name="text">
<string notr="true">^</string>
</property>
</widget>
</item>
<item>
<widget class="mySlider" name="trimVRight">
<property name="toolTip">
<string>Right Double Click to Reset</string>
</property>
<property name="minimum">
<number>-125</number>
</property>
<property name="maximum">
<number>125</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="trimVR_D">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>23</width>
<height>23</height>
</size>
</property>
<property name="text">
<string notr="true">v</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
+40 -4
View File
@@ -20,6 +20,7 @@ SimulatorDialog::SimulatorDialog(QWidget * parent, unsigned int flags):
simulator(NULL),
beepVal(0),
buttonPressed(0),
trimPressed (TRIM_NONE),
middleButtonPressed(false)
{
}
@@ -55,11 +56,36 @@ SimulatorDialog9X::SimulatorDialog9X(QWidget * parent, unsigned int flags):
break;
}
ui->trimHR_L->setText(QString::fromUtf8(leftArrow));
ui->trimHR_R->setText(QString::fromUtf8(rightArrow));
ui->trimVR_U->setText(QString::fromUtf8(upArrow));
ui->trimVR_D->setText(QString::fromUtf8(downArrow));
ui->trimHL_L->setText(QString::fromUtf8(leftArrow));
ui->trimHL_R->setText(QString::fromUtf8(rightArrow));
ui->trimVL_U->setText(QString::fromUtf8(upArrow));
ui->trimVL_D->setText(QString::fromUtf8(downArrow));
connect(ui->dialP_1, SIGNAL(valueChanged(int)), this, SLOT(dialChanged()));
connect(ui->dialP_2, SIGNAL(valueChanged(int)), this, SLOT(dialChanged()));
connect(ui->dialP_3, SIGNAL(valueChanged(int)), this, SLOT(dialChanged()));
connect(ui->cursor, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
connect(ui->menu, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
connect(ui->trimHR_L, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
connect(ui->trimHR_R, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
connect(ui->trimVR_U, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
connect(ui->trimVR_D, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
connect(ui->trimHL_R, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
connect(ui->trimHL_L, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
connect(ui->trimVL_U, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
connect(ui->trimVL_D, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
connect(ui->trimHR_L, SIGNAL(released()), this, SLOT(onTrimReleased()));
connect(ui->trimHR_R, SIGNAL(released()), this, SLOT(onTrimReleased()));
connect(ui->trimVR_U, SIGNAL(released()), this, SLOT(onTrimReleased()));
connect(ui->trimVR_D, SIGNAL(released()), this, SLOT(onTrimReleased()));
connect(ui->trimHL_R, SIGNAL(released()), this, SLOT(onTrimReleased()));
connect(ui->trimHL_L, SIGNAL(released()), this, SLOT(onTrimReleased()));
connect(ui->trimVL_U, SIGNAL(released()), this, SLOT(onTrimReleased()));
connect(ui->trimVL_D, SIGNAL(released()), this, SLOT(onTrimReleased()));
}
SimulatorDialog9X::~SimulatorDialog9X()
@@ -69,7 +95,6 @@ SimulatorDialog9X::~SimulatorDialog9X()
SimulatorDialogTaranis::SimulatorDialogTaranis(QWidget * parent, unsigned int flags):
SimulatorDialog(parent, flags),
trimPressed (TRIM_NONE),
ui(new Ui::SimulatorDialogTaranis)
{
lcdWidth = 212;
@@ -151,7 +176,7 @@ void SimulatorDialog::wheelEvent (QWheelEvent *event)
simulator->wheelEvent(event->delta() > 0 ? 1 : -1);
}
void SimulatorDialogTaranis::onTrimPressed()
void SimulatorDialog::onTrimPressed()
{
if (sender()->objectName() == QString("trimHL_L"))
trimPressed = TRIM_LH_L;
@@ -171,7 +196,7 @@ void SimulatorDialogTaranis::onTrimPressed()
trimPressed = TRIM_RH_R;
}
void SimulatorDialogTaranis::onTrimReleased()
void SimulatorDialog::onTrimReleased()
{
trimPressed = TRIM_NONE;
}
@@ -549,7 +574,18 @@ void SimulatorDialog9X::getValues()
buttonPressed == Qt::Key_Left,
},
middleButtonPressed
middleButtonPressed,
{
trimPressed == TRIM_LH_L,
trimPressed == TRIM_LH_R,
trimPressed == TRIM_LV_DN,
trimPressed == TRIM_LV_UP,
trimPressed == TRIM_RV_DN,
trimPressed == TRIM_RV_UP,
trimPressed == TRIM_RH_L,
trimPressed == TRIM_RH_R
}
};
simulator->setValues(inputs);
+3 -4
View File
@@ -102,6 +102,7 @@ class SimulatorDialog : public QDialog
virtual void keyReleaseEvent(QKeyEvent *);
static int screenshotIdx;
int buttonPressed;
int trimPressed;
bool middleButtonPressed;
private slots:
@@ -119,6 +120,8 @@ class SimulatorDialog : public QDialog
void on_trimHRight_valueChanged(int);
void on_trimVRight_valueChanged(int);
void onTimerEvent();
void onTrimPressed();
void onTrimReleased();
#ifdef JOYSTICKS
void onjoystickAxisValueChanged(int axis, int value);
@@ -157,15 +160,11 @@ class SimulatorDialogTaranis: public SimulatorDialog
virtual ~SimulatorDialogTaranis();
protected:
int trimPressed;
virtual void getValues();
private:
Ui::SimulatorDialogTaranis * ui;
private slots:
void onTrimPressed();
void onTrimReleased();
};
#endif // SIMULATORDIALOG_H