mirror of https://github.com/EspoTek/Labrador.git
XY Mode fixed
This commit is contained in:
parent
7c168bb14e
commit
0b007c4b37
|
@ -733,7 +733,8 @@ void isoDriver::frameActionGeneric(char CH1_mode, char CH2_mode)
|
|||
udateCursors();
|
||||
|
||||
if(XYmode){
|
||||
axes->graph(0)->setData(CH1,CH2);
|
||||
QCPCurve* curve = reinterpret_cast<QCPCurve*>(axes->plottable(0));
|
||||
curve->setData(CH1, CH2);
|
||||
axes->xAxis->setRange(xmin, xmax);
|
||||
axes->yAxis->setRange(ymin, ymax);
|
||||
}else{
|
||||
|
@ -1090,14 +1091,35 @@ void isoDriver::setSerialDecodeEnabled_CH2(bool enabled){
|
|||
}
|
||||
|
||||
void isoDriver::setXYmode(bool enabled){
|
||||
XYmode = enabled;
|
||||
if(!enabled){
|
||||
int graphCount = axes->graphCount();
|
||||
static QVector<bool> graphState;
|
||||
graphState.resize(graphCount);
|
||||
|
||||
if(enabled) // Hide graphs - we only want the X-Y plot to appear
|
||||
{
|
||||
xmin = 20;
|
||||
xmax = -20;
|
||||
ymin = 20;
|
||||
ymax = -20;
|
||||
|
||||
for (int i=0; i < graphCount; i++)
|
||||
{
|
||||
qDebug() << "isVisible" << axes->graph(i)->visible();
|
||||
graphState[i] = axes->graph(i)->visible();
|
||||
axes->graph(i)->setVisible(false);
|
||||
}
|
||||
}
|
||||
axes->graph(1)->setVisible(!enabled);
|
||||
else // Restore State
|
||||
{
|
||||
for (int i=0; i < graphCount; i++)
|
||||
{
|
||||
qDebug() << "graphState" << graphState[i];
|
||||
axes->graph(i)->setVisible(graphState[i]);
|
||||
}
|
||||
}
|
||||
|
||||
emit enableCursorGroup(!enabled);
|
||||
XYmode = enabled;
|
||||
}
|
||||
|
||||
void isoDriver::triggerGroupStateChange(bool enabled){
|
||||
|
|
|
@ -216,6 +216,7 @@ signals:
|
|||
void botRangeUpdated(double);
|
||||
void timeWindowUpdated(double);
|
||||
void delayUpdated(double);
|
||||
void enableCursorGroup(bool);
|
||||
public slots:
|
||||
void setVoltageRange(QWheelEvent *event);
|
||||
void timerTick(void);
|
||||
|
|
|
@ -236,6 +236,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
connect(ui->offsetSpinBox_CH2, SIGNAL(valueChanged(double)), ui->controller_iso, SLOT(offsetChanged_CH2(double)));
|
||||
connect(ui->attenuationComboBox_CH1, SIGNAL(currentIndexChanged(int)), ui->controller_iso, SLOT(attenuationChanged_CH1(int)));
|
||||
connect(ui->attenuationComboBox_CH2, SIGNAL(currentIndexChanged(int)), ui->controller_iso, SLOT(attenuationChanged_CH2(int)));
|
||||
connect(ui->controller_iso, &isoDriver::enableCursorGroup, this, &MainWindow::cursorGroupEnabled);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -245,6 +246,9 @@ MainWindow::~MainWindow()
|
|||
|
||||
void MainWindow::initialisePlot()
|
||||
{
|
||||
QCPCurve *xyCurve = new QCPCurve(ui->scopeAxes->xAxis, ui->scopeAxes->yAxis);
|
||||
xyCurve->setPen(QPen(Qt::yellow, 1));
|
||||
ui->scopeAxes->addPlottable(xyCurve);
|
||||
ui->scopeAxes->addGraph();
|
||||
ui->scopeAxes->addGraph();
|
||||
ui->scopeAxes->addGraph();
|
||||
|
@ -308,7 +312,6 @@ void MainWindow::initialisePlot()
|
|||
|
||||
ui->scopeAxes->setBackground(Qt::black);
|
||||
|
||||
|
||||
ui->scopeAxes->replot();
|
||||
}
|
||||
|
||||
|
@ -2377,3 +2380,25 @@ void MainWindow::on_actionPinout_triggered()
|
|||
{
|
||||
QDesktopServices::openUrl(QUrl(kPinoutUrl, QUrl::TolerantMode));
|
||||
}
|
||||
|
||||
void MainWindow::cursorGroupEnabled(bool enabled)
|
||||
{
|
||||
static bool cursorStatsEnabledState;
|
||||
static bool makeCursorsNicerState;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
ui->controller_iso->cursorStatsEnabled = cursorStatsEnabledState;
|
||||
ui->makeCursorsNicer->setTurnedOn(makeCursorsNicerState);
|
||||
ui->cursorGroup->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
cursorStatsEnabledState = ui->controller_iso->cursorStatsEnabled;
|
||||
makeCursorsNicerState = ui->makeCursorsNicer->turnedOn();
|
||||
ui->controller_iso->cursorStatsEnabled = false;
|
||||
ui->makeCursorsNicer->setTurnedOn(false);
|
||||
ui->cursorGroup->setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -213,6 +213,8 @@ private slots:
|
|||
|
||||
void on_actionPinout_triggered();
|
||||
|
||||
void cursorGroupEnabled(bool enabled);
|
||||
|
||||
private:
|
||||
//Generic Vars
|
||||
Ui::MainWindow *ui;
|
||||
|
|
|
@ -5,23 +5,25 @@ cursorEnabler::cursorEnabler(QWidget *parent) : QLabel(parent)
|
|||
{
|
||||
this->setVisible(0);
|
||||
#ifdef PLATFORM_ANDROID
|
||||
this->turnedOn = false;
|
||||
this->m_turnedOn = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void cursorEnabler::setTurnedOn(bool enabled){
|
||||
turnedOn = enabled;
|
||||
m_turnedOn = enabled;
|
||||
#ifdef PLATFORM_ANDROID
|
||||
this->turnedOn = false;
|
||||
this->m_turnedOn = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void cursorEnabler::clickDetected(QMouseEvent* event){
|
||||
if(turnedOn){
|
||||
if (event->button() == Qt::LeftButton){
|
||||
if(m_turnedOn){
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
tickHori(1);
|
||||
}
|
||||
if (event->button() == Qt::RightButton){
|
||||
else if (event->button() == Qt::RightButton)
|
||||
{
|
||||
tickVert(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,9 @@ class cursorEnabler : public QLabel
|
|||
Q_OBJECT
|
||||
public:
|
||||
explicit cursorEnabler(QWidget *parent = 0);
|
||||
bool turnedOn() {return m_turnedOn;}
|
||||
private:
|
||||
bool turnedOn = true;
|
||||
bool m_turnedOn = true;
|
||||
signals:
|
||||
void tickHori(bool);
|
||||
void tickVert(bool);
|
||||
|
|
Loading…
Reference in New Issue