mirror of
https://github.com/opentx/opentx.git
synced 2025-07-19 22:35:12 +03:00
[Horus] Simulator refactoring. This one should be nice :)
This commit is contained in:
parent
6f774eb61a
commit
0673663427
24 changed files with 863 additions and 1006 deletions
|
@ -559,7 +559,12 @@ void OpenTxSimulator::getTrims(Trims & trims)
|
||||||
|
|
||||||
void OpenTxSimulator::wheelEvent(int steps)
|
void OpenTxSimulator::wheelEvent(int steps)
|
||||||
{
|
{
|
||||||
#if defined(REV9E)
|
#if defined(PCBHORUS) || defined(PCBFLAMENCO)
|
||||||
|
if (steps > 0)
|
||||||
|
rotencValue -= 2;
|
||||||
|
else
|
||||||
|
rotencValue += 2;
|
||||||
|
#elif defined(REV9E)
|
||||||
if (steps == 255)
|
if (steps == 255)
|
||||||
rotencValue -= 2;
|
rotencValue -= 2;
|
||||||
else
|
else
|
||||||
|
|
|
@ -18,11 +18,9 @@ set(simulation_UIS
|
||||||
|
|
||||||
set(simulation_HDRS
|
set(simulation_HDRS
|
||||||
simulatordialog.h
|
simulatordialog.h
|
||||||
cursorwidget.h
|
# lcdwidget.h
|
||||||
menuwidget.h
|
buttonswidget.h
|
||||||
xcursorwidget.h
|
sliderwidget.h
|
||||||
xmenuwidget.h
|
|
||||||
myslider.h
|
|
||||||
telemetrysimu.h
|
telemetrysimu.h
|
||||||
trainersimu.h
|
trainersimu.h
|
||||||
debugoutput.h
|
debugoutput.h
|
||||||
|
|
120
companion/src/simulation/buttonswidget.h
Normal file
120
companion/src/simulation/buttonswidget.h
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
/*
|
||||||
|
* Author - Bertrand Songis <bsongis@gmail.com>
|
||||||
|
*
|
||||||
|
* Based on th9x -> http://code.google.com/p/th9x/
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _BUTTONSWIDGET_H_
|
||||||
|
#define _BUTTONSWIDGET_H_
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
|
class ButtonsWidget : public QWidget
|
||||||
|
{
|
||||||
|
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit ButtonsWidget(QWidget * parent):
|
||||||
|
QWidget(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virtual void setStyleSheet(const QString & sheet)
|
||||||
|
{
|
||||||
|
defaultStyleSheet = sheet;
|
||||||
|
QWidget::setStyleSheet(sheet);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addArea(int x1, int y1, int x2, int y2, int key, const char * bitmap)
|
||||||
|
{
|
||||||
|
QPolygon polygon;
|
||||||
|
polygon.setPoints(4, x1, y1, x1, y2, x2, y2, x2, y1);
|
||||||
|
addArea(polygon, key, bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addArea(const QPolygon & polygon, int key, const char * bitmap)
|
||||||
|
{
|
||||||
|
areas.push_back(Area(polygon, key, bitmap));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
class Area {
|
||||||
|
public:
|
||||||
|
Area(const QPolygon & polygon, int key, const char * bitmap):
|
||||||
|
polygon(polygon),
|
||||||
|
key(key),
|
||||||
|
bitmap(bitmap)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
bool contains(int x, int y)
|
||||||
|
{
|
||||||
|
return polygon.containsPoint(QPoint(x, y), Qt::OddEvenFill);
|
||||||
|
}
|
||||||
|
public:
|
||||||
|
QPolygon polygon;
|
||||||
|
int key;
|
||||||
|
const char * bitmap;
|
||||||
|
};
|
||||||
|
|
||||||
|
void setBitmap(const char * bitmap)
|
||||||
|
{
|
||||||
|
QWidget::setStyleSheet(QString("background:url(:/images/%1);").arg(bitmap));
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void mousePressEvent(QMouseEvent * event)
|
||||||
|
{
|
||||||
|
int x = event->x();
|
||||||
|
int y = event->y();
|
||||||
|
setFocus();
|
||||||
|
if (event->button() == Qt::LeftButton) {
|
||||||
|
foreach(Area area, areas) {
|
||||||
|
if (area.contains(x, y)) {
|
||||||
|
setBitmap(area.bitmap);
|
||||||
|
emit buttonPressed(area.key);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void mouseReleaseEvent(QMouseEvent * event)
|
||||||
|
{
|
||||||
|
QWidget::setStyleSheet(defaultStyleSheet);
|
||||||
|
setFocus();
|
||||||
|
emit buttonPressed(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void paintEvent(QPaintEvent *)
|
||||||
|
{
|
||||||
|
QStyleOption opt;
|
||||||
|
opt.init(this);
|
||||||
|
QPainter p(this);
|
||||||
|
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void buttonPressed(int button);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
QList<Area> areas;
|
||||||
|
QString defaultStyleSheet;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* _BUTTONSWIDGET_H_ */
|
|
@ -1,106 +0,0 @@
|
||||||
/*
|
|
||||||
* Author - Bertrand Songis <bsongis@gmail.com>
|
|
||||||
*
|
|
||||||
* Based on th9x -> http://code.google.com/p/th9x/
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef CURSORWIDGET_H
|
|
||||||
#define CURSORWIDGET_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QtGui>
|
|
||||||
|
|
||||||
class cursorWidget : public QWidget {
|
|
||||||
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
explicit cursorWidget(QWidget * parent = 0):
|
|
||||||
QWidget(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual void mousePressEvent(QMouseEvent * event)
|
|
||||||
{
|
|
||||||
float upx[] = {68,28,51,83,105,68};
|
|
||||||
float upy[] = {83,45,32,32,45,83};
|
|
||||||
float minx[] = {74,114,127,127,114,74};
|
|
||||||
float miny[] = {90,51,80,106,130,90};
|
|
||||||
float dox[] = {68,28,51,83,105,68};
|
|
||||||
float doy[] = {98,137,151,151,137,98};
|
|
||||||
float plusx[] = { 80,20,7,7,20,80};
|
|
||||||
float plusy[] = {90,51,80,106,130,90};
|
|
||||||
|
|
||||||
int x=event->x();
|
|
||||||
int y=event->y();
|
|
||||||
setFocus();
|
|
||||||
if (event->button()==Qt::LeftButton) {
|
|
||||||
if (pnpoly(6,upx,upy,(float)x,(float)y)==1) {
|
|
||||||
setStyleSheet("background:url(:/images/9xcursup.png);");
|
|
||||||
emit buttonPressed(Qt::Key_Up);
|
|
||||||
}
|
|
||||||
else if (pnpoly(6,minx,miny,(float)x,(float)y)==1) {
|
|
||||||
setStyleSheet("background:url(:/images/9xcursmin.png);");
|
|
||||||
emit buttonPressed(Qt::Key_Right);
|
|
||||||
}
|
|
||||||
else if (pnpoly(6,dox,doy,(float)x,(float)y)==1) {
|
|
||||||
setStyleSheet("background:url(:/images/9xcursdown.png);");
|
|
||||||
emit buttonPressed(Qt::Key_Down);
|
|
||||||
}
|
|
||||||
else if (pnpoly(6,plusx,plusy,(float)x,(float)y)==1) {
|
|
||||||
setStyleSheet("background:url(:/images/9xcursplus.png);");
|
|
||||||
emit buttonPressed(Qt::Key_Left);
|
|
||||||
} else if (sqrt(((float)x-22)*((float)x-22)+((float)y-165)*((float)y-165))<17) {
|
|
||||||
setStyleSheet("background:url(:/images/9xcursphoto.png);");
|
|
||||||
emit buttonPressed(Qt::Key_Print);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// QWidget::mousePressEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void mouseReleaseEvent(QMouseEvent * event)
|
|
||||||
{
|
|
||||||
setStyleSheet("background:url(:/images/9xcurs.png);");
|
|
||||||
emit buttonPressed(0);
|
|
||||||
setFocus();
|
|
||||||
//QWidget::mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *)
|
|
||||||
{
|
|
||||||
QStyleOption opt;
|
|
||||||
opt.init(this);
|
|
||||||
QPainter p(this);
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy)
|
|
||||||
{
|
|
||||||
int i, j, c = 0;
|
|
||||||
for (i = 0, j = nvert-1; i < nvert; j = i++) {
|
|
||||||
if ( ((verty[i]>testy) != (verty[j]>testy)) && (testx < (vertx[j]-vertx[i]) * (testy-verty[i]) / (verty[j]-verty[i]) + vertx[i]) )
|
|
||||||
c = !c;
|
|
||||||
}
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void buttonPressed(int button);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* CURSORWIDGET_H */
|
|
||||||
|
|
25
companion/src/simulation/dialwidget.h
Normal file
25
companion/src/simulation/dialwidget.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef _DIALWIDGET_H_
|
||||||
|
#define _DIALWIDGET_H_
|
||||||
|
|
||||||
|
class DialWidget : public QDial
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit DialWidget(QWidget * parent = 0):
|
||||||
|
QDial(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void mousePressEvent(QMouseEvent * event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::RightButton && event->type() == QEvent::MouseButtonDblClick) {
|
||||||
|
setValue(0);
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
QDial::mousePressEvent(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _DIALWIDGET_H_
|
|
@ -14,14 +14,16 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LCD_WIDGET_H_
|
#ifndef _LCDWIDGET_H_
|
||||||
#define _LCD_WIDGET_H_
|
#define _LCDWIDGET_H_
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "appdata.h"
|
#include "appdata.h"
|
||||||
|
|
||||||
class LcdWidget : public QWidget {
|
class LcdWidget : public QWidget
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
LcdWidget(QWidget * parent = 0):
|
LcdWidget(QWidget * parent = 0):
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
lcdBuf(NULL),
|
lcdBuf(NULL),
|
||||||
|
@ -186,4 +188,4 @@ class LcdWidget : public QWidget {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _LCD_WIDGET_H_
|
#endif // _LCDWIDGET_H_
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
/*
|
|
||||||
* Author - Bertrand Songis <bsongis@gmail.com>
|
|
||||||
*
|
|
||||||
* Based on th9x -> http://code.google.com/p/th9x/
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef MENUWIDGET_H
|
|
||||||
#define MENUWIDGET_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QtGui>
|
|
||||||
|
|
||||||
class menuWidget : public QWidget {
|
|
||||||
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
explicit menuWidget(QWidget * parent = 0):
|
|
||||||
QWidget(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual void mousePressEvent(QMouseEvent * event)
|
|
||||||
{
|
|
||||||
int x=event->x();
|
|
||||||
int y=event->y();
|
|
||||||
setFocus();
|
|
||||||
if (event->button()==Qt::LeftButton) {
|
|
||||||
if (x>25 && x<71 && y>60 && y<81) {
|
|
||||||
setStyleSheet("background:url(:/images/9xmenumenu.png);");
|
|
||||||
emit buttonPressed(Qt::Key_Enter);
|
|
||||||
} else if (x>25 && x<71 && y>117 && y<139) {
|
|
||||||
setStyleSheet("background:url(:/images/9xmenuexit.png);");
|
|
||||||
emit buttonPressed(Qt::Key_Escape);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// QWidget::mousePressEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void mouseReleaseEvent(QMouseEvent * event)
|
|
||||||
{
|
|
||||||
setStyleSheet("background:url(:/images/9xmenu.png);");
|
|
||||||
setFocus();
|
|
||||||
emit buttonPressed(0);
|
|
||||||
// QWidget::mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *)
|
|
||||||
{
|
|
||||||
QStyleOption opt;
|
|
||||||
opt.init(this);
|
|
||||||
QPainter p(this);
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void buttonPressed(int button);
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif /* MENUWIDGET_H */
|
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
#ifndef MYQDIAL_H
|
|
||||||
#define MYQDIAL_H
|
|
||||||
|
|
||||||
|
|
||||||
class myQDial : public QDial
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit myQDial(QWidget *parent = 0) : QDial(parent) {}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void mousePressEvent(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
if (event->button() == Qt::RightButton && event->type() == QEvent::MouseButtonDblClick) {
|
|
||||||
setValue(0);
|
|
||||||
event->accept();
|
|
||||||
}
|
|
||||||
QDial::mousePressEvent(event);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,31 +0,0 @@
|
||||||
#ifndef MYSLIDER_H
|
|
||||||
#define MYSLIDER_H
|
|
||||||
|
|
||||||
#include <QSlider>
|
|
||||||
#include <QtGui>
|
|
||||||
|
|
||||||
class mySlider : public QSlider
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
explicit mySlider(QFrame * parent = 0):
|
|
||||||
QSlider(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent * event)
|
|
||||||
{
|
|
||||||
if (event->button() == Qt::RightButton && event->type() == QEvent::MouseButtonDblClick) {
|
|
||||||
setValue(0);
|
|
||||||
event->accept();
|
|
||||||
}
|
|
||||||
QSlider::mousePressEvent(event);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -30,7 +30,16 @@
|
||||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_6">
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -66,7 +75,16 @@
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_8">
|
<layout class="QGridLayout" name="gridLayout_8">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -399,7 +417,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="mySlider" name="trimHLeft">
|
<widget class="SliderWidget" name="trimHLeft">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Right Double Click to Reset</string>
|
<string>Right Double Click to Reset</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -463,7 +481,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="mySlider" name="trimVLeft">
|
<widget class="SliderWidget" name="trimVLeft">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Right Double Click to Reset</string>
|
<string>Right Double Click to Reset</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -868,7 +886,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="mySlider" name="trimHRight">
|
<widget class="SliderWidget" name="trimHRight">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Right Double Click to Reset</string>
|
<string>Right Double Click to Reset</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -932,7 +950,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="mySlider" name="trimVRight">
|
<widget class="SliderWidget" name="trimVRight">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Right Double Click to Reset</string>
|
<string>Right Double Click to Reset</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -990,7 +1008,16 @@ QPushButton:checked {
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
|
@ -1020,7 +1047,7 @@ QPushButton:checked {
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="myQDial" name="pot0">
|
<widget class="DialWidget" name="pot0">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -1077,7 +1104,7 @@ QPushButton:checked {
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="myQDial" name="pot1">
|
<widget class="DialWidget" name="pot1">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -1137,7 +1164,7 @@ QPushButton:checked {
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0">
|
<item row="8" column="0">
|
||||||
<widget class="myQDial" name="pot2">
|
<widget class="DialWidget" name="pot2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -1286,7 +1313,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="4" rowspan="3">
|
<item row="0" column="4" rowspan="3">
|
||||||
<widget class="menuWidget" name="menu" native="true">
|
<widget class="ButtonsWidget" name="rightbuttons" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -1339,8 +1366,27 @@ QPushButton:checked {
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="3" rowspan="3">
|
||||||
|
<widget class="QWidget" name="right" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>55</width>
|
||||||
|
<height>186</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background:url(:/images/9xdr.png)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0" rowspan="3">
|
<item row="0" column="0" rowspan="3">
|
||||||
<widget class="cursorWidget" name="cursor" native="true">
|
<widget class="ButtonsWidget" name="leftbuttons" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -1361,25 +1407,6 @@ QPushButton:checked {
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3" rowspan="3">
|
|
||||||
<widget class="QWidget" name="right" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>55</width>
|
|
||||||
<height>186</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background:url(:/images/9xdr.png)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
@ -1475,26 +1502,20 @@ QPushButton:checked {
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>mySlider</class>
|
<class>SliderWidget</class>
|
||||||
<extends>QSlider</extends>
|
<extends>QSlider</extends>
|
||||||
<header location="global">myslider.h</header>
|
<header location="global">sliderwidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>cursorWidget</class>
|
<class>DialWidget</class>
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>cursorwidget.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>menuWidget</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>menuwidget.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>myQDial</class>
|
|
||||||
<extends>QDial</extends>
|
<extends>QDial</extends>
|
||||||
<header location="global">myqdial.h</header>
|
<header location="global">dialwidget.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>ButtonsWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">buttonswidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>726</width>
|
<width>726</width>
|
||||||
<height>688</height>
|
<height>708</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -30,7 +30,16 @@
|
||||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_6">
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -86,7 +95,7 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" rowspan="3">
|
<item row="0" column="0" rowspan="3">
|
||||||
<widget class="xcursorWidget" name="cursor" native="true">
|
<widget class="ButtonsWidget" name="leftbuttons" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -108,7 +117,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2" rowspan="3">
|
<item row="0" column="2" rowspan="3">
|
||||||
<widget class="xmenuWidget" name="menu" native="true">
|
<widget class="ButtonsWidget" name="rightbuttons" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -263,7 +272,16 @@
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_8">
|
<layout class="QGridLayout" name="gridLayout_8">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -298,7 +316,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignHCenter">
|
<item alignment="Qt::AlignHCenter">
|
||||||
<widget class="mySlider" name="trimVLeft">
|
<widget class="SliderWidget" name="trimVLeft">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -902,7 +920,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="mySlider" name="trimHLeft">
|
<widget class="SliderWidget" name="trimHLeft">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Right Double Click to Reset</string>
|
<string>Right Double Click to Reset</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -991,7 +1009,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignHCenter">
|
<item alignment="Qt::AlignHCenter">
|
||||||
<widget class="mySlider" name="trimVRight">
|
<widget class="SliderWidget" name="trimVRight">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Right Double Click to Reset</string>
|
<string>Right Double Click to Reset</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1579,7 +1597,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="mySlider" name="trimHRight">
|
<widget class="SliderWidget" name="trimHRight">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -1639,21 +1657,15 @@ QPushButton:checked {
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>mySlider</class>
|
<class>ButtonsWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">buttonswidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>SliderWidget</class>
|
||||||
<extends>QSlider</extends>
|
<extends>QSlider</extends>
|
||||||
<header location="global">myslider.h</header>
|
<header location="global">sliderwidget.h</header>
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>xcursorWidget</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header location="global">xcursorwidget.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>xmenuWidget</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>xmenuwidget.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>726</width>
|
<width>739</width>
|
||||||
<height>688</height>
|
<height>740</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -30,7 +30,16 @@
|
||||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_6">
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -78,54 +87,13 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<layout class="QGridLayout" name="gridLayout_3" columnminimumwidth="120,480,120">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetMinimumSize</enum>
|
<enum>QLayout::SetMinimumSize</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" rowspan="3">
|
|
||||||
<widget class="xcursorWidget" name="cursor" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>120</width>
|
|
||||||
<height>208</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="mouseTracking">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background:url(:/images/x9l0.png);</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2" rowspan="3">
|
|
||||||
<widget class="xmenuWidget" name="menu" native="true">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>120</width>
|
|
||||||
<height>208</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background:url(:/images/x9r0.png)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="LcdWidget" name="lcd" native="true">
|
<widget class="LcdWidget" name="lcd" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -142,6 +110,47 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0" rowspan="3">
|
||||||
|
<widget class="ButtonsWidget" name="leftbuttons" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>89</width>
|
||||||
|
<height>186</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="mouseTracking">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background:url(:/images/9xmenu.png);</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2" rowspan="3">
|
||||||
|
<widget class="ButtonsWidget" name="rightbuttons" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>128</width>
|
||||||
|
<height>186</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background:url(:/images/9xcurs.png)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
@ -263,7 +272,16 @@
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_8">
|
<layout class="QGridLayout" name="gridLayout_8">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -298,7 +316,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignHCenter">
|
<item alignment="Qt::AlignHCenter">
|
||||||
<widget class="mySlider" name="trimVLeft">
|
<widget class="SliderWidget" name="trimVLeft">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -902,7 +920,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="mySlider" name="trimHLeft">
|
<widget class="SliderWidget" name="trimHLeft">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Right Double Click to Reset</string>
|
<string>Right Double Click to Reset</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -991,7 +1009,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignHCenter">
|
<item alignment="Qt::AlignHCenter">
|
||||||
<widget class="mySlider" name="trimVRight">
|
<widget class="SliderWidget" name="trimVRight">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Right Double Click to Reset</string>
|
<string>Right Double Click to Reset</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1579,7 +1597,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="mySlider" name="trimHRight">
|
<widget class="SliderWidget" name="trimHRight">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -1639,21 +1657,15 @@ QPushButton:checked {
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>mySlider</class>
|
<class>ButtonsWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">buttonswidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>SliderWidget</class>
|
||||||
<extends>QSlider</extends>
|
<extends>QSlider</extends>
|
||||||
<header location="global">myslider.h</header>
|
<header location="global">sliderwidget.h</header>
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>xcursorWidget</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header location="global">xcursorwidget.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>xmenuWidget</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>xmenuwidget.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>739</width>
|
<width>739</width>
|
||||||
<height>658</height>
|
<height>695</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -30,7 +30,16 @@
|
||||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_6">
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
<property name="margin">
|
<property name="leftMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
<number>5</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -86,7 +95,7 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0" rowspan="3">
|
<item row="0" column="0" rowspan="3">
|
||||||
<widget class="xcursorWidget" name="cursor" native="true">
|
<widget class="ButtonsWidget" name="leftbuttons" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -127,7 +136,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2" rowspan="3">
|
<item row="0" column="2" rowspan="3">
|
||||||
<widget class="xmenuWidget" name="menu" native="true">
|
<widget class="ButtonsWidget" name="rightbuttons" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -864,7 +873,7 @@
|
||||||
<item row="0" column="8" rowspan="2" colspan="2">
|
<item row="0" column="8" rowspan="2" colspan="2">
|
||||||
<layout class="QGridLayout" name="gridLayout_10">
|
<layout class="QGridLayout" name="gridLayout_10">
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="myQDial" name="pot1">
|
<widget class="DialWidget" name="pot1">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -904,7 +913,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3">
|
<item row="0" column="3">
|
||||||
<widget class="myQDial" name="pot3">
|
<widget class="DialWidget" name="pot3">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
|
@ -935,7 +944,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="myQDial" name="pot2">
|
<widget class="DialWidget" name="pot2">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
|
@ -966,7 +975,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="myQDial" name="pot0">
|
<widget class="DialWidget" name="pot0">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -1248,7 +1257,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignHCenter">
|
<item alignment="Qt::AlignHCenter">
|
||||||
<widget class="mySlider" name="trimVLeft">
|
<widget class="SliderWidget" name="trimVLeft">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
<sizepolicy hsizetype="Fixed" vsizetype="Expanding">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -1320,7 +1329,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="mySlider" name="trimHLeft">
|
<widget class="SliderWidget" name="trimHLeft">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Right Double Click to Reset</string>
|
<string>Right Double Click to Reset</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1420,7 +1429,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignHCenter">
|
<item alignment="Qt::AlignHCenter">
|
||||||
<widget class="mySlider" name="trimVRight">
|
<widget class="SliderWidget" name="trimVRight">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Right Double Click to Reset</string>
|
<string>Right Double Click to Reset</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1638,7 +1647,7 @@ QPushButton:checked {
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="mySlider" name="trimHRight">
|
<widget class="SliderWidget" name="trimHRight">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
|
@ -1741,26 +1750,20 @@ QPushButton:checked {
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>mySlider</class>
|
<class>ButtonsWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">buttonswidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>SliderWidget</class>
|
||||||
<extends>QSlider</extends>
|
<extends>QSlider</extends>
|
||||||
<header location="global">myslider.h</header>
|
<header location="global">sliderwidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>xcursorWidget</class>
|
<class>DialWidget</class>
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header location="global">xcursorwidget.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>xmenuWidget</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>xmenuwidget.h</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>myQDial</class>
|
|
||||||
<extends>QDial</extends>
|
<extends>QDial</extends>
|
||||||
<header location="global">myqdial.h</header>
|
<header location="global">dialwidget.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#include "simulatordialog.h"
|
#include "simulatordialog.h"
|
||||||
#include "ui_simulatordialog-9x.h"
|
#include "appdata.h"
|
||||||
#include "ui_simulatordialog-taranis.h"
|
#include "lcdwidget.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "simulatorinterface.h"
|
#include "simulatorinterface.h"
|
||||||
|
#include "sliderwidget.h"
|
||||||
|
|
||||||
#define GBALL_SIZE 20
|
#define GBALL_SIZE 20
|
||||||
#define RESX 1024
|
#define RESX 1024
|
||||||
|
@ -47,6 +48,11 @@ void SimulatorDialog::updateDebugOutput()
|
||||||
traceMutex.unlock();
|
traceMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SimulatorDialog::wheelEvent (QWheelEvent *event)
|
||||||
|
{
|
||||||
|
simulator->wheelEvent(event->delta() > 0 ? 1 : -1);
|
||||||
|
}
|
||||||
|
|
||||||
SimulatorDialog::SimulatorDialog(QWidget * parent, SimulatorInterface *simulator, unsigned int flags):
|
SimulatorDialog::SimulatorDialog(QWidget * parent, SimulatorInterface *simulator, unsigned int flags):
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
flags(flags),
|
flags(flags),
|
||||||
|
@ -70,154 +76,6 @@ SimulatorDialog::SimulatorDialog(QWidget * parent, SimulatorInterface *simulator
|
||||||
traceCallbackInstance = this;
|
traceCallbackInstance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t SimulatorDialog9X::switchstatus = 0;
|
|
||||||
|
|
||||||
SimulatorDialog9X::SimulatorDialog9X(QWidget * parent, SimulatorInterface *simulator, unsigned int flags):
|
|
||||||
SimulatorDialog(parent, simulator, flags),
|
|
||||||
ui(new Ui::SimulatorDialog9X),
|
|
||||||
beepShow(0)
|
|
||||||
{
|
|
||||||
lcdWidth = 128;
|
|
||||||
lcdHeight = 64;
|
|
||||||
lcdDepth = 1;
|
|
||||||
|
|
||||||
initUi<Ui::SimulatorDialog9X>(ui);
|
|
||||||
|
|
||||||
// install simulator TRACE hook
|
|
||||||
simulator->installTraceHook(traceCb);
|
|
||||||
|
|
||||||
backLight = g.backLight();
|
|
||||||
if (backLight > 4) backLight = 0;
|
|
||||||
switch (backLight) {
|
|
||||||
case 1:
|
|
||||||
ui->lcd->setBackgroundColor(166,247,159);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
ui->lcd->setBackgroundColor(247,159,166);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
ui->lcd->setBackgroundColor(255,195,151);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
ui->lcd->setBackgroundColor(247,242,159);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ui->lcd->setBackgroundColor(159,165,247);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//restore switches
|
|
||||||
if (g.simuSW())
|
|
||||||
restoreSwitches();
|
|
||||||
|
|
||||||
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));
|
|
||||||
for (int i=0; i<pots.count(); i++) {
|
|
||||||
pots[i]->setProperty("index", i);
|
|
||||||
connect(pots[i], SIGNAL(valueChanged(int)), this, SLOT(dialChanged(int)));
|
|
||||||
}
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
saveSwitches();
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t SimulatorDialogTaranis::switchstatus = 0;
|
|
||||||
|
|
||||||
SimulatorDialogTaranis::SimulatorDialogTaranis(QWidget * parent, SimulatorInterface *simulator, unsigned int flags):
|
|
||||||
SimulatorDialog(parent, simulator, flags),
|
|
||||||
ui(new Ui::SimulatorDialogTaranis)
|
|
||||||
{
|
|
||||||
lcdWidth = 212;
|
|
||||||
lcdHeight = 64;
|
|
||||||
lcdDepth = 4;
|
|
||||||
|
|
||||||
initUi<Ui::SimulatorDialogTaranis>(ui);
|
|
||||||
|
|
||||||
// install simulator TRACE hook
|
|
||||||
simulator->installTraceHook(traceCb);
|
|
||||||
|
|
||||||
ui->lcd->setBackgroundColor(47, 123, 227);
|
|
||||||
|
|
||||||
// restore switches
|
|
||||||
if (g.simuSW()) {
|
|
||||||
restoreSwitches();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i=0; i<pots.count(); i++) {
|
|
||||||
if (flags & (SIMULATOR_FLAGS_S1_MULTI << i)) {
|
|
||||||
pots[i]->setValue(-1024);
|
|
||||||
pots[i]->setSingleStep(2048/5);
|
|
||||||
pots[i]->setPageStep(2048/5);
|
|
||||||
}
|
|
||||||
else if (!(flags & (SIMULATOR_FLAGS_S1 << i))) {
|
|
||||||
pots[i]->hide();
|
|
||||||
potLabels[i]->hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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->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()));
|
|
||||||
}
|
|
||||||
|
|
||||||
SimulatorDialogTaranis::~SimulatorDialogTaranis()
|
|
||||||
{
|
|
||||||
saveSwitches();
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SimulatorDialog::~SimulatorDialog()
|
SimulatorDialog::~SimulatorDialog()
|
||||||
{
|
{
|
||||||
traceCallbackInstance = 0;
|
traceCallbackInstance = 0;
|
||||||
|
@ -245,17 +103,6 @@ void SimulatorDialog::mouseReleaseEvent(QMouseEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulatorDialog9X::dialChanged(int value)
|
|
||||||
{
|
|
||||||
int index = sender()->property("index").toInt();
|
|
||||||
potValues[index]->setText(QString("%1 %").arg((value*100)/1024));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulatorDialog::wheelEvent (QWheelEvent *event)
|
|
||||||
{
|
|
||||||
simulator->wheelEvent(event->delta() > 0 ? 1 : -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulatorDialog::onTrimPressed()
|
void SimulatorDialog::onTrimPressed()
|
||||||
{
|
{
|
||||||
if (sender()->objectName() == QString("trimHL_L"))
|
if (sender()->objectName() == QString("trimHL_L"))
|
||||||
|
@ -600,36 +447,6 @@ void SimulatorDialog::onButtonPressed(int value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulatorDialog9X::setLightOn(bool enable)
|
|
||||||
{
|
|
||||||
QString bg = "";
|
|
||||||
if (enable) {
|
|
||||||
QStringList list;
|
|
||||||
list << "bl" << "gr" << "rd" << "or" << "yl";
|
|
||||||
bg = QString("-") + list[backLight];
|
|
||||||
}
|
|
||||||
ui->top->setStyleSheet(QString("background:url(:/images/9xdt%1.png);").arg(bg));
|
|
||||||
ui->bottom->setStyleSheet(QString("background:url(:/images/9xdb%1.png);").arg(bg));
|
|
||||||
ui->left->setStyleSheet(QString("background:url(:/images/9xdl%1.png);").arg(bg));
|
|
||||||
ui->right->setStyleSheet(QString("background:url(:/images/9xdr%1.png);").arg(bg));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulatorDialog9X::updateBeepButton()
|
|
||||||
{
|
|
||||||
#define CBEEP_ON "QLabel { background-color: #FF364E }"
|
|
||||||
#define CBEEP_OFF "QLabel { }"
|
|
||||||
|
|
||||||
if (beepVal) {
|
|
||||||
beepShow = 20;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->label_beep->setStyleSheet(beepShow ? CBEEP_ON : CBEEP_OFF);
|
|
||||||
|
|
||||||
if (beepShow) {
|
|
||||||
beepShow--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulatorDialog::onTimerEvent()
|
void SimulatorDialog::onTimerEvent()
|
||||||
{
|
{
|
||||||
static unsigned int lcd_counter = 0;
|
static unsigned int lcd_counter = 0;
|
||||||
|
@ -729,211 +546,6 @@ void SimulatorDialog::setTrims()
|
||||||
trimHRight->setRange(trimMin, trimMax); trimHRight->setValue(trims.values[3]);
|
trimHRight->setRange(trimMin, trimMax); trimHRight->setValue(trims.values[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulatorDialog9X::getValues()
|
|
||||||
{
|
|
||||||
TxInputs inputs = {
|
|
||||||
{
|
|
||||||
int(1024*nodeLeft->getX()), // LEFT HORZ
|
|
||||||
int(-1024*nodeLeft->getY()), // LEFT VERT
|
|
||||||
int(-1024*nodeRight->getY()), // RGHT VERT
|
|
||||||
int(1024*nodeRight->getX()) // RGHT HORZ
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
pots[0]->value(),
|
|
||||||
pots[1]->value(),
|
|
||||||
pots[2]->value()
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
ui->switchTHR->isChecked(),
|
|
||||||
ui->switchRUD->isChecked(),
|
|
||||||
ui->switchELE->isChecked(),
|
|
||||||
ui->switchID2->isChecked() ? 1 : (ui->switchID1->isChecked() ? 0 : -1),
|
|
||||||
ui->switchAIL->isChecked(),
|
|
||||||
ui->switchGEA->isChecked(),
|
|
||||||
ui->switchTRN->isDown(),
|
|
||||||
0, 0, 0
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
buttonPressed == Qt::Key_Enter,
|
|
||||||
buttonPressed == Qt::Key_Escape,
|
|
||||||
buttonPressed == Qt::Key_Down,
|
|
||||||
buttonPressed == Qt::Key_Up,
|
|
||||||
buttonPressed == Qt::Key_Right,
|
|
||||||
buttonPressed == Qt::Key_Left,
|
|
||||||
},
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulatorDialog9X::saveSwitches(void)
|
|
||||||
{
|
|
||||||
// qDebug() << "SimulatorDialog9X::saveSwitches()";
|
|
||||||
switchstatus=ui->switchTHR->isChecked();
|
|
||||||
switchstatus<<=1;
|
|
||||||
switchstatus+=(ui->switchRUD->isChecked()&0x1);
|
|
||||||
switchstatus<<=1;
|
|
||||||
switchstatus+=(ui->switchID2->isChecked()&0x1);
|
|
||||||
switchstatus<<=1;
|
|
||||||
switchstatus+=(ui->switchID1->isChecked()&0x1);
|
|
||||||
switchstatus<<=1;
|
|
||||||
switchstatus+=(ui->switchID0->isChecked()&0x1);
|
|
||||||
switchstatus<<=1;
|
|
||||||
switchstatus+=(ui->switchGEA->isChecked()&0x1);
|
|
||||||
switchstatus<<=1;
|
|
||||||
switchstatus+=(ui->switchELE->isChecked()&0x1);
|
|
||||||
switchstatus<<=1;
|
|
||||||
switchstatus+=(ui->switchAIL->isChecked()&0x1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulatorDialog9X::restoreSwitches(void)
|
|
||||||
{
|
|
||||||
// qDebug() << "SimulatorDialog9X::restoreSwitches()";
|
|
||||||
ui->switchAIL->setChecked(switchstatus & 0x1);
|
|
||||||
switchstatus >>=1;
|
|
||||||
ui->switchELE->setChecked(switchstatus & 0x1);
|
|
||||||
switchstatus >>=1;
|
|
||||||
ui->switchGEA->setChecked(switchstatus & 0x1);
|
|
||||||
switchstatus >>=1;
|
|
||||||
ui->switchID0->setChecked(switchstatus & 0x1);
|
|
||||||
switchstatus >>=1;
|
|
||||||
ui->switchID1->setChecked(switchstatus & 0x1);
|
|
||||||
switchstatus >>=1;
|
|
||||||
ui->switchID2->setChecked(switchstatus & 0x1);
|
|
||||||
switchstatus >>=1;
|
|
||||||
ui->switchRUD->setChecked(switchstatus & 0x1);
|
|
||||||
switchstatus >>=1;
|
|
||||||
ui->switchTHR->setChecked(switchstatus & 0x1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulatorDialogTaranis::resetSH()
|
|
||||||
{
|
|
||||||
ui->switchH->setValue(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulatorDialogTaranis::on_switchH_sliderReleased()
|
|
||||||
{
|
|
||||||
QTimer::singleShot(400, this, SLOT(resetSH()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulatorDialogTaranis::getValues()
|
|
||||||
{
|
|
||||||
for (int i=0; i<pots.count(); i++) {
|
|
||||||
if (flags & (SIMULATOR_FLAGS_S1_MULTI << i)) {
|
|
||||||
int s1 = round((pots[i]->value()+1024)/(2048.0/5))*(2048.0/5)-1024;
|
|
||||||
pots[i]->setValue(s1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TxInputs inputs = {
|
|
||||||
{
|
|
||||||
int(1024*nodeLeft->getX()), // LEFT HORZ
|
|
||||||
int(-1024*nodeLeft->getY()), // LEFT VERT
|
|
||||||
int(-1024*nodeRight->getY()), // RGHT VERT
|
|
||||||
int(1024*nodeRight->getX()) // RGHT HORZ
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-pots[0]->value(),
|
|
||||||
pots[1]->value(),
|
|
||||||
((flags && SIMULATOR_FLAGS_S3) ? pots[2]->value() : 0),
|
|
||||||
-sliders[0]->value(),
|
|
||||||
sliders[1]->value()
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
ui->switchA->value() - 1,
|
|
||||||
ui->switchB->value() - 1,
|
|
||||||
ui->switchC->value() - 1,
|
|
||||||
ui->switchD->value() - 1,
|
|
||||||
ui->switchE->value() - 1,
|
|
||||||
ui->switchF->value(),
|
|
||||||
ui->switchG->value() - 1,
|
|
||||||
ui->switchH->value(), 0, 0
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
buttonPressed == Qt::Key_PageUp,
|
|
||||||
buttonPressed == Qt::Key_Escape,
|
|
||||||
buttonPressed == Qt::Key_Enter,
|
|
||||||
buttonPressed == Qt::Key_PageDown,
|
|
||||||
buttonPressed == Qt::Key_Plus,
|
|
||||||
buttonPressed == Qt::Key_Minus
|
|
||||||
},
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulatorDialogTaranis::saveSwitches(void)
|
|
||||||
{
|
|
||||||
// qDebug() << "SimulatorDialogTaranis::saveSwitches()";
|
|
||||||
switchstatus=ui->switchA->value();
|
|
||||||
switchstatus<<=2;
|
|
||||||
switchstatus+=ui->switchB->value();
|
|
||||||
switchstatus<<=2;
|
|
||||||
switchstatus+=ui->switchC->value();
|
|
||||||
switchstatus<<=2;
|
|
||||||
switchstatus+=ui->switchD->value();
|
|
||||||
switchstatus<<=2;
|
|
||||||
switchstatus+=ui->switchE->value();
|
|
||||||
switchstatus<<=2;
|
|
||||||
switchstatus+=ui->switchF->value();
|
|
||||||
switchstatus<<=2;
|
|
||||||
switchstatus+=ui->switchG->value();
|
|
||||||
switchstatus<<=2;
|
|
||||||
switchstatus+=ui->switchH->value();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimulatorDialogTaranis::restoreSwitches(void)
|
|
||||||
{
|
|
||||||
// qDebug() << "SimulatorDialogTaranis::restoreSwitches()";
|
|
||||||
ui->switchH->setValue(switchstatus & 0x3);
|
|
||||||
switchstatus>>=2;
|
|
||||||
ui->switchG->setValue(switchstatus & 0x3);
|
|
||||||
switchstatus>>=2;
|
|
||||||
ui->switchF->setValue(switchstatus & 0x3);
|
|
||||||
switchstatus>>=2;
|
|
||||||
ui->switchE->setValue(switchstatus & 0x3);
|
|
||||||
switchstatus>>=2;
|
|
||||||
ui->switchD->setValue(switchstatus & 0x3);
|
|
||||||
switchstatus>>=2;
|
|
||||||
ui->switchC->setValue(switchstatus & 0x3);
|
|
||||||
switchstatus>>=2;
|
|
||||||
ui->switchB->setValue(switchstatus & 0x3);
|
|
||||||
switchstatus>>=2;
|
|
||||||
ui->switchA->setValue(switchstatus & 0x3);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int chVal(int val)
|
inline int chVal(int val)
|
||||||
{
|
{
|
||||||
return qMin(1024, qMax(-1024, val));
|
return qMin(1024, qMax(-1024, val));
|
||||||
|
@ -1136,5 +748,7 @@ void SimulatorDialog::onjoystickAxisValueChanged(int axis, int value)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "simulatordialog9x.cpp"
|
||||||
|
#include "simulatordialogtaranis.cpp"
|
||||||
#include "simulatordialogflamenco.cpp"
|
#include "simulatordialogflamenco.cpp"
|
||||||
#include "simulatordialoghorus.cpp"
|
#include "simulatordialoghorus.cpp"
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace Ui {
|
||||||
|
|
||||||
// TODO rename + move?
|
// TODO rename + move?
|
||||||
class LcdWidget;
|
class LcdWidget;
|
||||||
class mySlider;
|
class SliderWidget;
|
||||||
|
|
||||||
#define SIMULATOR_FLAGS_NOTX 1
|
#define SIMULATOR_FLAGS_NOTX 1
|
||||||
#define SIMULATOR_FLAGS_STICK_MODE_LEFT 2
|
#define SIMULATOR_FLAGS_STICK_MODE_LEFT 2
|
||||||
|
@ -67,7 +67,7 @@ class SimulatorDialog : public QDialog
|
||||||
QVector<QLabel *> potValues;
|
QVector<QLabel *> potValues;
|
||||||
QVector<QSlider *> sliders;
|
QVector<QSlider *> sliders;
|
||||||
|
|
||||||
mySlider * trimHLeft, * trimVLeft, * trimHRight, * trimVRight;
|
SliderWidget * trimHLeft, * trimVLeft, * trimHRight, * trimVRight;
|
||||||
QLabel * leftXPerc, * rightXPerc, * leftYPerc, * rightYPerc;
|
QLabel * leftXPerc, * rightXPerc, * leftYPerc, * rightYPerc;
|
||||||
QTabWidget * tabWidget;
|
QTabWidget * tabWidget;
|
||||||
QVector<QLabel *> logicalSwitchLabels;
|
QVector<QLabel *> logicalSwitchLabels;
|
||||||
|
|
225
companion/src/simulation/simulatordialog9x.cpp
Normal file
225
companion/src/simulation/simulatordialog9x.cpp
Normal file
|
@ -0,0 +1,225 @@
|
||||||
|
#include "ui_simulatordialog-9x.h"
|
||||||
|
|
||||||
|
uint32_t SimulatorDialog9X::switchstatus = 0;
|
||||||
|
|
||||||
|
SimulatorDialog9X::SimulatorDialog9X(QWidget * parent, SimulatorInterface *simulator, unsigned int flags):
|
||||||
|
SimulatorDialog(parent, simulator, flags),
|
||||||
|
ui(new Ui::SimulatorDialog9X),
|
||||||
|
beepShow(0)
|
||||||
|
{
|
||||||
|
QPolygon polygon;
|
||||||
|
|
||||||
|
lcdWidth = 128;
|
||||||
|
lcdHeight = 64;
|
||||||
|
lcdDepth = 1;
|
||||||
|
|
||||||
|
initUi<Ui::SimulatorDialog9X>(ui);
|
||||||
|
|
||||||
|
polygon.setPoints(6, 68, 83, 28, 45, 51, 32, 83, 32, 105, 45, 68, 83);
|
||||||
|
ui->leftbuttons->addArea(polygon, Qt::Key_Up, "9xcursup.png");
|
||||||
|
polygon.setPoints(6, 74, 90, 114, 51, 127, 80, 127, 106, 114, 130, 74, 90);
|
||||||
|
ui->leftbuttons->addArea(polygon, Qt::Key_Right, "9xcursmin.png");
|
||||||
|
polygon.setPoints(6, 68, 98, 28, 137, 51, 151, 83, 151, 105, 137, 68, 98);
|
||||||
|
ui->leftbuttons->addArea(polygon, Qt::Key_Down, "9xcursdown.png");
|
||||||
|
polygon.setPoints(6, 80, 90, 20, 51, 7, 80, 7, 106, 20, 130, 80, 90);
|
||||||
|
ui->leftbuttons->addArea(polygon, Qt::Key_Left, "9xcursplus.png");
|
||||||
|
ui->leftbuttons->addArea(5, 148, 39, 182, Qt::Key_Print, "9xcursphoto.png");
|
||||||
|
|
||||||
|
ui->rightbuttons->addArea(25, 60, 71, 81, Qt::Key_Enter, "9xmenumenu.png");
|
||||||
|
ui->rightbuttons->addArea(25, 117, 71, 139, Qt::Key_Escape, "9xmenuexit.png");
|
||||||
|
|
||||||
|
// install simulator TRACE hook
|
||||||
|
simulator->installTraceHook(traceCb);
|
||||||
|
|
||||||
|
backLight = g.backLight();
|
||||||
|
if (backLight > 4) backLight = 0;
|
||||||
|
switch (backLight) {
|
||||||
|
case 1:
|
||||||
|
ui->lcd->setBackgroundColor(166,247,159);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
ui->lcd->setBackgroundColor(247,159,166);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
ui->lcd->setBackgroundColor(255,195,151);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
ui->lcd->setBackgroundColor(247,242,159);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
ui->lcd->setBackgroundColor(159,165,247);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//restore switches
|
||||||
|
if (g.simuSW())
|
||||||
|
restoreSwitches();
|
||||||
|
|
||||||
|
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));
|
||||||
|
for (int i=0; i<pots.count(); i++) {
|
||||||
|
pots[i]->setProperty("index", i);
|
||||||
|
connect(pots[i], SIGNAL(valueChanged(int)), this, SLOT(dialChanged(int)));
|
||||||
|
}
|
||||||
|
connect(ui->leftbuttons, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
||||||
|
connect(ui->rightbuttons, 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()
|
||||||
|
{
|
||||||
|
saveSwitches();
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorDialog9X::dialChanged(int value)
|
||||||
|
{
|
||||||
|
int index = sender()->property("index").toInt();
|
||||||
|
potValues[index]->setText(QString("%1 %").arg((value*100)/1024));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorDialog9X::setLightOn(bool enable)
|
||||||
|
{
|
||||||
|
QString bg = "";
|
||||||
|
if (enable) {
|
||||||
|
QStringList list;
|
||||||
|
list << "bl" << "gr" << "rd" << "or" << "yl";
|
||||||
|
bg = QString("-") + list[backLight];
|
||||||
|
}
|
||||||
|
ui->top->setStyleSheet(QString("background:url(:/images/9xdt%1.png);").arg(bg));
|
||||||
|
ui->bottom->setStyleSheet(QString("background:url(:/images/9xdb%1.png);").arg(bg));
|
||||||
|
ui->left->setStyleSheet(QString("background:url(:/images/9xdl%1.png);").arg(bg));
|
||||||
|
ui->right->setStyleSheet(QString("background:url(:/images/9xdr%1.png);").arg(bg));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorDialog9X::updateBeepButton()
|
||||||
|
{
|
||||||
|
#define CBEEP_ON "QLabel { background-color: #FF364E }"
|
||||||
|
#define CBEEP_OFF "QLabel { }"
|
||||||
|
|
||||||
|
if (beepVal) {
|
||||||
|
beepShow = 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->label_beep->setStyleSheet(beepShow ? CBEEP_ON : CBEEP_OFF);
|
||||||
|
|
||||||
|
if (beepShow) {
|
||||||
|
beepShow--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SimulatorDialog9X::getValues()
|
||||||
|
{
|
||||||
|
TxInputs inputs = {
|
||||||
|
{
|
||||||
|
int(1024*nodeLeft->getX()), // LEFT HORZ
|
||||||
|
int(-1024*nodeLeft->getY()), // LEFT VERT
|
||||||
|
int(-1024*nodeRight->getY()), // RGHT VERT
|
||||||
|
int(1024*nodeRight->getX()) // RGHT HORZ
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
pots[0]->value(),
|
||||||
|
pots[1]->value(),
|
||||||
|
pots[2]->value()
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
ui->switchTHR->isChecked(),
|
||||||
|
ui->switchRUD->isChecked(),
|
||||||
|
ui->switchELE->isChecked(),
|
||||||
|
ui->switchID2->isChecked() ? 1 : (ui->switchID1->isChecked() ? 0 : -1),
|
||||||
|
ui->switchAIL->isChecked(),
|
||||||
|
ui->switchGEA->isChecked(),
|
||||||
|
ui->switchTRN->isDown(),
|
||||||
|
0, 0, 0
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
buttonPressed == Qt::Key_Enter,
|
||||||
|
buttonPressed == Qt::Key_Escape,
|
||||||
|
buttonPressed == Qt::Key_Down,
|
||||||
|
buttonPressed == Qt::Key_Up,
|
||||||
|
buttonPressed == Qt::Key_Right,
|
||||||
|
buttonPressed == Qt::Key_Left,
|
||||||
|
},
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorDialog9X::saveSwitches(void)
|
||||||
|
{
|
||||||
|
// qDebug() << "SimulatorDialog9X::saveSwitches()";
|
||||||
|
switchstatus=ui->switchTHR->isChecked();
|
||||||
|
switchstatus<<=1;
|
||||||
|
switchstatus+=(ui->switchRUD->isChecked()&0x1);
|
||||||
|
switchstatus<<=1;
|
||||||
|
switchstatus+=(ui->switchID2->isChecked()&0x1);
|
||||||
|
switchstatus<<=1;
|
||||||
|
switchstatus+=(ui->switchID1->isChecked()&0x1);
|
||||||
|
switchstatus<<=1;
|
||||||
|
switchstatus+=(ui->switchID0->isChecked()&0x1);
|
||||||
|
switchstatus<<=1;
|
||||||
|
switchstatus+=(ui->switchGEA->isChecked()&0x1);
|
||||||
|
switchstatus<<=1;
|
||||||
|
switchstatus+=(ui->switchELE->isChecked()&0x1);
|
||||||
|
switchstatus<<=1;
|
||||||
|
switchstatus+=(ui->switchAIL->isChecked()&0x1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorDialog9X::restoreSwitches(void)
|
||||||
|
{
|
||||||
|
// qDebug() << "SimulatorDialog9X::restoreSwitches()";
|
||||||
|
ui->switchAIL->setChecked(switchstatus & 0x1);
|
||||||
|
switchstatus >>=1;
|
||||||
|
ui->switchELE->setChecked(switchstatus & 0x1);
|
||||||
|
switchstatus >>=1;
|
||||||
|
ui->switchGEA->setChecked(switchstatus & 0x1);
|
||||||
|
switchstatus >>=1;
|
||||||
|
ui->switchID0->setChecked(switchstatus & 0x1);
|
||||||
|
switchstatus >>=1;
|
||||||
|
ui->switchID1->setChecked(switchstatus & 0x1);
|
||||||
|
switchstatus >>=1;
|
||||||
|
ui->switchID2->setChecked(switchstatus & 0x1);
|
||||||
|
switchstatus >>=1;
|
||||||
|
ui->switchRUD->setChecked(switchstatus & 0x1);
|
||||||
|
switchstatus >>=1;
|
||||||
|
ui->switchTHR->setChecked(switchstatus & 0x1);
|
||||||
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@ SimulatorDialogFlamenco::SimulatorDialogFlamenco(QWidget * parent, SimulatorInte
|
||||||
ui->trimVL_U->setText(QString::fromUtf8(upArrow));
|
ui->trimVL_U->setText(QString::fromUtf8(upArrow));
|
||||||
ui->trimVL_D->setText(QString::fromUtf8(downArrow));
|
ui->trimVL_D->setText(QString::fromUtf8(downArrow));
|
||||||
|
|
||||||
connect(ui->cursor, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
connect(ui->leftbuttons, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
||||||
connect(ui->menu, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
connect(ui->rightbuttons, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
||||||
connect(ui->trimHR_L, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
|
connect(ui->trimHR_L, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
|
||||||
connect(ui->trimHR_R, 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_U, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
|
||||||
|
|
|
@ -8,12 +8,27 @@ SimulatorDialogHorus::SimulatorDialogHorus(QWidget * parent, SimulatorInterface
|
||||||
SimulatorDialog(parent, simulator, flags),
|
SimulatorDialog(parent, simulator, flags),
|
||||||
ui(new Ui::SimulatorDialogHorus)
|
ui(new Ui::SimulatorDialogHorus)
|
||||||
{
|
{
|
||||||
|
QPolygon polygon;
|
||||||
|
|
||||||
lcdWidth = 480;
|
lcdWidth = 480;
|
||||||
lcdHeight = 270;
|
lcdHeight = 270;
|
||||||
lcdDepth = 16;
|
lcdDepth = 16;
|
||||||
|
|
||||||
initUi<Ui::SimulatorDialogHorus>(ui);
|
initUi<Ui::SimulatorDialogHorus>(ui);
|
||||||
|
|
||||||
|
polygon.setPoints(6, 68, 83, 28, 45, 51, 32, 83, 32, 105, 45, 68, 83);
|
||||||
|
ui->rightbuttons->addArea(polygon, Qt::Key_Up, "9xcursup.png");
|
||||||
|
polygon.setPoints(6, 74, 90, 114, 51, 127, 80, 127, 106, 114, 130, 74, 90);
|
||||||
|
ui->rightbuttons->addArea(polygon, Qt::Key_Right, "9xcursmin.png");
|
||||||
|
polygon.setPoints(6, 68, 98, 28, 137, 51, 151, 83, 151, 105, 137, 68, 98);
|
||||||
|
ui->rightbuttons->addArea(polygon, Qt::Key_Down, "9xcursdown.png");
|
||||||
|
polygon.setPoints(6, 80, 90, 20, 51, 7, 80, 7, 106, 20, 130, 80, 90);
|
||||||
|
ui->rightbuttons->addArea(polygon, Qt::Key_Left, "9xcursplus.png");
|
||||||
|
ui->rightbuttons->addArea(5, 148, 39, 182, Qt::Key_Print, "9xcursphoto.png");
|
||||||
|
|
||||||
|
ui->leftbuttons->addArea(25, 60, 71, 81, Qt::Key_PageUp, "9xmenumenu.png");
|
||||||
|
ui->leftbuttons->addArea(25, 117, 71, 139, Qt::Key_Escape, "9xmenuexit.png");
|
||||||
|
|
||||||
// install simulator TRACE hook
|
// install simulator TRACE hook
|
||||||
simulator->installTraceHook(traceCb);
|
simulator->installTraceHook(traceCb);
|
||||||
|
|
||||||
|
@ -34,8 +49,8 @@ SimulatorDialogHorus::SimulatorDialogHorus(QWidget * parent, SimulatorInterface
|
||||||
ui->trimVL_U->setText(QString::fromUtf8(upArrow));
|
ui->trimVL_U->setText(QString::fromUtf8(upArrow));
|
||||||
ui->trimVL_D->setText(QString::fromUtf8(downArrow));
|
ui->trimVL_D->setText(QString::fromUtf8(downArrow));
|
||||||
|
|
||||||
connect(ui->cursor, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
connect(ui->leftbuttons, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
||||||
connect(ui->menu, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
connect(ui->rightbuttons, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
||||||
connect(ui->trimHR_L, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
|
connect(ui->trimHR_L, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
|
||||||
connect(ui->trimHR_R, 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_U, SIGNAL(pressed()), this, SLOT(onTrimPressed()));
|
||||||
|
@ -103,9 +118,10 @@ void SimulatorDialogHorus::getValues()
|
||||||
buttonPressed == Qt::Key_PageUp,
|
buttonPressed == Qt::Key_PageUp,
|
||||||
buttonPressed == Qt::Key_Escape,
|
buttonPressed == Qt::Key_Escape,
|
||||||
buttonPressed == Qt::Key_Enter,
|
buttonPressed == Qt::Key_Enter,
|
||||||
buttonPressed == Qt::Key_PageDown,
|
buttonPressed == Qt::Key_Up,
|
||||||
buttonPressed == Qt::Key_Plus,
|
buttonPressed == Qt::Key_Down,
|
||||||
buttonPressed == Qt::Key_Minus
|
buttonPressed == Qt::Key_Right,
|
||||||
|
buttonPressed == Qt::Key_Left
|
||||||
},
|
},
|
||||||
|
|
||||||
middleButtonPressed,
|
middleButtonPressed,
|
||||||
|
|
201
companion/src/simulation/simulatordialogtaranis.cpp
Normal file
201
companion/src/simulation/simulatordialogtaranis.cpp
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
#include "ui_simulatordialog-taranis.h"
|
||||||
|
|
||||||
|
uint32_t SimulatorDialogTaranis::switchstatus = 0;
|
||||||
|
|
||||||
|
SimulatorDialogTaranis::SimulatorDialogTaranis(QWidget * parent, SimulatorInterface *simulator, unsigned int flags):
|
||||||
|
SimulatorDialog(parent, simulator, flags),
|
||||||
|
ui(new Ui::SimulatorDialogTaranis)
|
||||||
|
{
|
||||||
|
QPolygon polygon;
|
||||||
|
|
||||||
|
lcdWidth = 212;
|
||||||
|
lcdHeight = 64;
|
||||||
|
lcdDepth = 4;
|
||||||
|
|
||||||
|
initUi<Ui::SimulatorDialogTaranis>(ui);
|
||||||
|
|
||||||
|
polygon.setPoints(6, 20, 59, 27, 50, 45, 52, 56, 59, 50, 71, 26, 72);
|
||||||
|
ui->leftbuttons->addArea(polygon, Qt::Key_PageUp, "x9l1.png");
|
||||||
|
polygon.setPoints(6, 23, 107, 30, 99, 46, 100, 55, 106, 47, 117, 28, 117);
|
||||||
|
ui->leftbuttons->addArea(polygon, Qt::Key_PageDown, "x9l2.png");
|
||||||
|
polygon.setPoints(6, 24, 154, 32, 144, 46, 146, 57, 156, 46, 167, 29, 166);
|
||||||
|
ui->leftbuttons->addArea(polygon, Qt::Key_Escape, "x9l3.png");
|
||||||
|
ui->leftbuttons->addArea(90, 177, 118, 197, Qt::Key_Print, "x9l4.png");
|
||||||
|
polygon.setPoints(6, 64, 60, 71, 50, 90, 50, 100, 60, 90, 73, 72, 73);
|
||||||
|
ui->rightbuttons->addArea(polygon, Qt::Key_Plus, "x9r1.png");
|
||||||
|
polygon.setPoints(6, 63, 109, 73, 100, 88, 100, 98, 109, 88, 119, 72, 119);
|
||||||
|
ui->rightbuttons->addArea(polygon, Qt::Key_Minus, "x9r2.png");
|
||||||
|
polygon.setPoints(6, 63, 155, 72, 146, 90, 146, 98, 155, 88, 166, 72, 166);
|
||||||
|
ui->rightbuttons->addArea(polygon, Qt::Key_Enter, "x9r3.png");
|
||||||
|
|
||||||
|
// install simulator TRACE hook
|
||||||
|
simulator->installTraceHook(traceCb);
|
||||||
|
|
||||||
|
ui->lcd->setBackgroundColor(47, 123, 227);
|
||||||
|
|
||||||
|
// restore switches
|
||||||
|
if (g.simuSW()) {
|
||||||
|
restoreSwitches();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<pots.count(); i++) {
|
||||||
|
if (flags & (SIMULATOR_FLAGS_S1_MULTI << i)) {
|
||||||
|
pots[i]->setValue(-1024);
|
||||||
|
pots[i]->setSingleStep(2048/5);
|
||||||
|
pots[i]->setPageStep(2048/5);
|
||||||
|
}
|
||||||
|
else if (!(flags & (SIMULATOR_FLAGS_S1 << i))) {
|
||||||
|
pots[i]->hide();
|
||||||
|
potLabels[i]->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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->leftbuttons, SIGNAL(buttonPressed(int)), this, SLOT(onButtonPressed(int)));
|
||||||
|
connect(ui->rightbuttons, 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()));
|
||||||
|
}
|
||||||
|
|
||||||
|
SimulatorDialogTaranis::~SimulatorDialogTaranis()
|
||||||
|
{
|
||||||
|
saveSwitches();
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SimulatorDialogTaranis::resetSH()
|
||||||
|
{
|
||||||
|
ui->switchH->setValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorDialogTaranis::on_switchH_sliderReleased()
|
||||||
|
{
|
||||||
|
QTimer::singleShot(400, this, SLOT(resetSH()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorDialogTaranis::getValues()
|
||||||
|
{
|
||||||
|
for (int i=0; i<pots.count(); i++) {
|
||||||
|
if (flags & (SIMULATOR_FLAGS_S1_MULTI << i)) {
|
||||||
|
int s1 = round((pots[i]->value()+1024)/(2048.0/5))*(2048.0/5)-1024;
|
||||||
|
pots[i]->setValue(s1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TxInputs inputs = {
|
||||||
|
{
|
||||||
|
int(1024*nodeLeft->getX()), // LEFT HORZ
|
||||||
|
int(-1024*nodeLeft->getY()), // LEFT VERT
|
||||||
|
int(-1024*nodeRight->getY()), // RGHT VERT
|
||||||
|
int(1024*nodeRight->getX()) // RGHT HORZ
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
-pots[0]->value(),
|
||||||
|
pots[1]->value(),
|
||||||
|
((flags && SIMULATOR_FLAGS_S3) ? pots[2]->value() : 0),
|
||||||
|
-sliders[0]->value(),
|
||||||
|
sliders[1]->value()
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
ui->switchA->value() - 1,
|
||||||
|
ui->switchB->value() - 1,
|
||||||
|
ui->switchC->value() - 1,
|
||||||
|
ui->switchD->value() - 1,
|
||||||
|
ui->switchE->value() - 1,
|
||||||
|
ui->switchF->value(),
|
||||||
|
ui->switchG->value() - 1,
|
||||||
|
ui->switchH->value(), 0, 0
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
buttonPressed == Qt::Key_PageUp,
|
||||||
|
buttonPressed == Qt::Key_Escape,
|
||||||
|
buttonPressed == Qt::Key_Enter,
|
||||||
|
buttonPressed == Qt::Key_PageDown,
|
||||||
|
buttonPressed == Qt::Key_Plus,
|
||||||
|
buttonPressed == Qt::Key_Minus
|
||||||
|
},
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorDialogTaranis::saveSwitches(void)
|
||||||
|
{
|
||||||
|
// qDebug() << "SimulatorDialogTaranis::saveSwitches()";
|
||||||
|
switchstatus=ui->switchA->value();
|
||||||
|
switchstatus<<=2;
|
||||||
|
switchstatus+=ui->switchB->value();
|
||||||
|
switchstatus<<=2;
|
||||||
|
switchstatus+=ui->switchC->value();
|
||||||
|
switchstatus<<=2;
|
||||||
|
switchstatus+=ui->switchD->value();
|
||||||
|
switchstatus<<=2;
|
||||||
|
switchstatus+=ui->switchE->value();
|
||||||
|
switchstatus<<=2;
|
||||||
|
switchstatus+=ui->switchF->value();
|
||||||
|
switchstatus<<=2;
|
||||||
|
switchstatus+=ui->switchG->value();
|
||||||
|
switchstatus<<=2;
|
||||||
|
switchstatus+=ui->switchH->value();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorDialogTaranis::restoreSwitches(void)
|
||||||
|
{
|
||||||
|
// qDebug() << "SimulatorDialogTaranis::restoreSwitches()";
|
||||||
|
ui->switchH->setValue(switchstatus & 0x3);
|
||||||
|
switchstatus>>=2;
|
||||||
|
ui->switchG->setValue(switchstatus & 0x3);
|
||||||
|
switchstatus>>=2;
|
||||||
|
ui->switchF->setValue(switchstatus & 0x3);
|
||||||
|
switchstatus>>=2;
|
||||||
|
ui->switchE->setValue(switchstatus & 0x3);
|
||||||
|
switchstatus>>=2;
|
||||||
|
ui->switchD->setValue(switchstatus & 0x3);
|
||||||
|
switchstatus>>=2;
|
||||||
|
ui->switchC->setValue(switchstatus & 0x3);
|
||||||
|
switchstatus>>=2;
|
||||||
|
ui->switchB->setValue(switchstatus & 0x3);
|
||||||
|
switchstatus>>=2;
|
||||||
|
ui->switchA->setValue(switchstatus & 0x3);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
30
companion/src/simulation/sliderwidget.h
Normal file
30
companion/src/simulation/sliderwidget.h
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
#ifndef _SLIDERWIDGET_H_
|
||||||
|
#define _SLIDERWIDGET_H_
|
||||||
|
|
||||||
|
#include <QSlider>
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
|
class SliderWidget : public QSlider
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit SliderWidget(QFrame * parent = 0):
|
||||||
|
QSlider(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void mousePressEvent(QMouseEvent * event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::RightButton && event->type() == QEvent::MouseButtonDblClick) {
|
||||||
|
setValue(0);
|
||||||
|
event->accept();
|
||||||
|
}
|
||||||
|
QSlider::mousePressEvent(event);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _SLIDERWIDGET_H_
|
|
@ -1,100 +0,0 @@
|
||||||
/*
|
|
||||||
* Author - Bertrand Songis <bsongis@gmail.com>
|
|
||||||
*
|
|
||||||
* Based on th9x -> http://code.google.com/p/th9x/
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef XCURSORWIDGET_H
|
|
||||||
#define XCURSORWIDGET_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QtGui>
|
|
||||||
|
|
||||||
class xcursorWidget : public QWidget {
|
|
||||||
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
explicit xcursorWidget(QWidget * parent = 0):
|
|
||||||
QWidget(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual void mousePressEvent(QMouseEvent * event)
|
|
||||||
{
|
|
||||||
float p1x[] = {20,27,45,56,50,26};
|
|
||||||
float p1y[] = {59,50,52,59,71,72};
|
|
||||||
float p2x[] = {23,30,46,55,47,28};
|
|
||||||
float p2y[] = {107,99,100,106,117,117};
|
|
||||||
float p3x[] = {24,32,46,57,46,29};
|
|
||||||
float p3y[] = {154,144,146,156,167,166};
|
|
||||||
|
|
||||||
int x=event->x();
|
|
||||||
int y=event->y();
|
|
||||||
setFocus();
|
|
||||||
if (event->button()==Qt::LeftButton) {
|
|
||||||
if (pnpoly(6,p1x,p1y,(float)x,(float)y)==1) {
|
|
||||||
setStyleSheet("background:url(:/images/x9l1.png);");
|
|
||||||
emit buttonPressed(Qt::Key_PageUp);
|
|
||||||
}
|
|
||||||
else if (pnpoly(6,p2x,p2y,(float)x,(float)y)==1) {
|
|
||||||
setStyleSheet("background:url(:/images/x9l2.png);");
|
|
||||||
emit buttonPressed(Qt::Key_PageDown);
|
|
||||||
}
|
|
||||||
else if (pnpoly(6,p3x,p3y,(float)x,(float)y)==1) {
|
|
||||||
setStyleSheet("background:url(:/images/x9l3.png);");
|
|
||||||
emit buttonPressed(Qt::Key_Escape);
|
|
||||||
} else if ((x>90 && x<118) && (y>177 && y<197)) {
|
|
||||||
setStyleSheet("background:url(:/images/x9l4.png);");
|
|
||||||
emit buttonPressed(Qt::Key_Print);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// QWidget::mousePressEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void mouseReleaseEvent(QMouseEvent * event)
|
|
||||||
{
|
|
||||||
setStyleSheet("background:url(:/images/x9l0.png);");
|
|
||||||
emit buttonPressed(0);
|
|
||||||
setFocus();
|
|
||||||
//QWidget::mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *)
|
|
||||||
{
|
|
||||||
QStyleOption opt;
|
|
||||||
opt.init(this);
|
|
||||||
QPainter p(this);
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy)
|
|
||||||
{
|
|
||||||
int i, j, c = 0;
|
|
||||||
for (i = 0, j = nvert-1; i < nvert; j = i++) {
|
|
||||||
if ( ((verty[i]>testy) != (verty[j]>testy)) && (testx < (vertx[j]-vertx[i]) * (testy-verty[i]) / (verty[j]-verty[i]) + vertx[i]) )
|
|
||||||
c = !c;
|
|
||||||
}
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void buttonPressed(int button);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* CURSORWIDGET_H */
|
|
||||||
|
|
|
@ -1,95 +0,0 @@
|
||||||
/*
|
|
||||||
* Author - Bertrand Songis <bsongis@gmail.com>
|
|
||||||
*
|
|
||||||
* Based on th9x -> http://code.google.com/p/th9x/
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#ifndef XMENUWIDGET_H
|
|
||||||
#define XMENUWIDGET_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QtGui>
|
|
||||||
|
|
||||||
class xmenuWidget : public QWidget {
|
|
||||||
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
explicit xmenuWidget(QWidget * parent = 0):
|
|
||||||
QWidget(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
virtual void mousePressEvent(QMouseEvent * event)
|
|
||||||
{
|
|
||||||
float p1x[] = {64,71,90,100,90,72};
|
|
||||||
float p1y[] = {60,50,50,60,73,73};
|
|
||||||
float p2x[] = {63,73,88,98,88,72};
|
|
||||||
float p2y[] = {109,100,100,109,119,119};
|
|
||||||
float p3x[] = {63,72,90,98,88,72};
|
|
||||||
float p3y[] = {155,146,146,155,166,166};
|
|
||||||
|
|
||||||
int x=event->x();
|
|
||||||
int y=event->y();
|
|
||||||
setFocus();
|
|
||||||
if (event->button()==Qt::LeftButton) {
|
|
||||||
if (pnpoly(6,p1x,p1y,(float)x,(float)y)==1) {
|
|
||||||
setStyleSheet("background:url(:/images/x9r1.png);");
|
|
||||||
emit buttonPressed(Qt::Key_Plus);
|
|
||||||
}
|
|
||||||
else if (pnpoly(6,p2x,p2y,(float)x,(float)y)==1) {
|
|
||||||
setStyleSheet("background:url(:/images/x9r2.png);");
|
|
||||||
emit buttonPressed(Qt::Key_Minus);
|
|
||||||
}
|
|
||||||
else if (pnpoly(6,p3x,p3y,(float)x,(float)y)==1) {
|
|
||||||
setStyleSheet("background:url(:/images/x9r3.png);");
|
|
||||||
emit buttonPressed(Qt::Key_Enter);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// QWidget::mousePressEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void mouseReleaseEvent(QMouseEvent * event)
|
|
||||||
{
|
|
||||||
setStyleSheet("background:url(:/images/x9r0.png);");
|
|
||||||
setFocus();
|
|
||||||
emit buttonPressed(0);
|
|
||||||
// QWidget::mouseReleaseEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void paintEvent(QPaintEvent *)
|
|
||||||
{
|
|
||||||
QStyleOption opt;
|
|
||||||
opt.init(this);
|
|
||||||
QPainter p(this);
|
|
||||||
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int pnpoly(int nvert, float *vertx, float *verty, float testx, float testy)
|
|
||||||
{
|
|
||||||
int i, j, c = 0;
|
|
||||||
for (i = 0, j = nvert-1; i < nvert; j = i++) {
|
|
||||||
if ( ((verty[i]>testy) != (verty[j]>testy)) && (testx < (vertx[j]-vertx[i]) * (testy-verty[i]) / (verty[j]-verty[i]) + vertx[i]) )
|
|
||||||
c = !c;
|
|
||||||
}
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void buttonPressed(int button);
|
|
||||||
|
|
||||||
};
|
|
||||||
#endif /* XMENUWIDGET_H */
|
|
||||||
|
|
|
@ -378,7 +378,6 @@ long Open9xSim::onTimeout(FXObject*, FXSelector, void*)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBHORUS)
|
#if defined(ROTARY_ENCODER_NAVIGATION) || defined(PCBHORUS)
|
||||||
extern rotenc_t rotencValue;
|
|
||||||
static bool rotencAction = false;
|
static bool rotencAction = false;
|
||||||
if (getApp()->getKeyState(KEY_G)) {
|
if (getApp()->getKeyState(KEY_G)) {
|
||||||
if (!rotencAction) ROTENC_VALUE += ROTARY_ENCODER_GRANULARITY;
|
if (!rotencAction) ROTENC_VALUE += ROTARY_ENCODER_GRANULARITY;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import glob
|
||||||
try:
|
try:
|
||||||
app = Qt.QApplication(sys.argv)
|
app = Qt.QApplication(sys.argv)
|
||||||
except:
|
except:
|
||||||
pass
|
app = Qt.QCoreApplication(sys.argv)
|
||||||
|
|
||||||
for f in glob.glob("fonts/*.ttf"):
|
for f in glob.glob("fonts/*.ttf"):
|
||||||
QtGui.QFontDatabase.addApplicationFont(f)
|
QtGui.QFontDatabase.addApplicationFont(f)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue