mirror of https://github.com/EspoTek/Labrador.git
Can put scope range dialog on main window
This commit is contained in:
parent
dde6d6ac42
commit
1a3fd72041
|
@ -238,6 +238,8 @@ void isoDriver::setVoltageRange(QWheelEvent *event){
|
|||
if (topRange > (double)20) topRange = (double)20;
|
||||
if (botRange <- (double)20) botRange = (double)-20;
|
||||
if (autoGainEnabled && !properlyPaused()) autoGain();
|
||||
topRangeUpdated(topRange);
|
||||
botRangeUpdated(botRange);
|
||||
}
|
||||
else if(properlyPaused()){
|
||||
double c = (window) / (double)200;
|
||||
|
@ -253,17 +255,31 @@ void isoDriver::setVoltageRange(QWheelEvent *event){
|
|||
if (event->delta()==120){
|
||||
window -= c* ((double)pixPct);
|
||||
delay += c* ((double)100 - (double)pixPct) * pixPct/100;
|
||||
delayUpdated(delay);
|
||||
}
|
||||
else{
|
||||
window += c* ((double)pixPct);
|
||||
delay -= c* ((double)100 - (double)pixPct) * pixPct/100;
|
||||
delayUpdated(delay);
|
||||
}
|
||||
|
||||
double mws = fileModeEnabled ? daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
||||
|
||||
if (window > mws) window = mws;
|
||||
if ((window + delay) > mws) delay -= window + delay - mws;
|
||||
if (delay < 0) delay = 0;
|
||||
if (window > mws)
|
||||
{
|
||||
window = mws;
|
||||
timeWindowUpdated(window);
|
||||
}
|
||||
if ((window + delay) > mws)
|
||||
{
|
||||
delay -= window + delay - mws;
|
||||
delayUpdated(delay);
|
||||
}
|
||||
if (delay < 0)
|
||||
{
|
||||
delay = 0;
|
||||
delayUpdated(delay);
|
||||
}
|
||||
qDebug() << window << delay;
|
||||
} else {
|
||||
qDebug() << "TIGGERED";
|
||||
|
@ -285,17 +301,29 @@ void isoDriver::setVoltageRange(QWheelEvent *event){
|
|||
if (event->delta()==120){
|
||||
window -= c* ((double)pixPct);
|
||||
delay += c* ((double)100 - (double)pixPct) * pixPct/100;
|
||||
delayUpdated(delay);
|
||||
timeWindowUpdated(window);
|
||||
}
|
||||
else{
|
||||
window += c* ((double)pixPct);
|
||||
delay -= c* ((double)100 - (double)pixPct) * pixPct/100;
|
||||
delayUpdated(delay);
|
||||
timeWindowUpdated(window);
|
||||
}
|
||||
|
||||
double mws = fileModeEnabled ? daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
||||
|
||||
if (window > mws) window = mws;
|
||||
if ((window + delay) > mws) delay -= window + delay - mws;
|
||||
if (delay < 0) delay = 0;
|
||||
if ((window + delay) > mws)
|
||||
{
|
||||
delay -= window + delay - mws;
|
||||
delayUpdated(delay);
|
||||
}
|
||||
if (delay < 0)
|
||||
{
|
||||
delay = 0;
|
||||
delayUpdated(delay);
|
||||
}
|
||||
windowAtPause = window;
|
||||
qDebug() << window << delay;
|
||||
}
|
||||
|
@ -325,6 +353,7 @@ void isoDriver::pauseEnable_CH1(bool enabled){
|
|||
|
||||
if(!properlyPaused()) {
|
||||
delay = 0;
|
||||
delayUpdated(delay);
|
||||
if (autoGainEnabled) autoGain();
|
||||
//window = windowAtPause;
|
||||
}
|
||||
|
@ -339,6 +368,7 @@ void isoDriver::pauseEnable_CH2(bool enabled){
|
|||
|
||||
if(!properlyPaused()){
|
||||
delay = 0;
|
||||
delayUpdated(delay);
|
||||
if (autoGainEnabled) autoGain();
|
||||
//window = windowAtPause;
|
||||
}
|
||||
|
@ -351,6 +381,7 @@ void isoDriver::pauseEnable_multimeter(bool enabled){
|
|||
|
||||
if(!properlyPaused()) {
|
||||
delay = 0;
|
||||
delayUpdated(delay);
|
||||
//window = windowAtPause;
|
||||
}
|
||||
|
||||
|
@ -608,6 +639,7 @@ int isoDriver::trigger(void){
|
|||
|
||||
if(singleShotEnabled && (location != -1)) {
|
||||
delay = triggerDelay;
|
||||
delayUpdated(delay);
|
||||
singleShotTriggered(1);
|
||||
}
|
||||
return location;
|
||||
|
@ -1214,19 +1246,23 @@ void isoDriver::slowTimerTick(){
|
|||
|
||||
void isoDriver::setTopRange(double newTop){
|
||||
topRange = newTop;
|
||||
topRangeUpdated(topRange);
|
||||
}
|
||||
|
||||
void isoDriver::setBotRange(double newBot){
|
||||
botRange = newBot;
|
||||
botRangeUpdated(botRange);
|
||||
}
|
||||
|
||||
void isoDriver::setTimeWindow(double newWindow){
|
||||
window = newWindow;
|
||||
windowAtPause = window;
|
||||
timeWindowUpdated(window);
|
||||
}
|
||||
|
||||
void isoDriver::setDelay(double newDelay){
|
||||
delay = newDelay;
|
||||
delayUpdated(delay);
|
||||
}
|
||||
|
||||
void isoDriver::takeSnapshot(QString *fileName, unsigned char channel){
|
||||
|
@ -1449,9 +1485,21 @@ void isoDriver::disableFileMode(){
|
|||
|
||||
//Shrink screen back, if necessary.
|
||||
double mws = fileModeEnabled ? daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
||||
if (window > mws) window = mws;
|
||||
if ((window + delay) > mws) delay -= window + delay - mws;
|
||||
if (delay < 0) delay = 0;
|
||||
if (window > mws)
|
||||
{
|
||||
window = mws;
|
||||
timeWindowUpdated(window);
|
||||
}
|
||||
if ((window + delay) > mws)
|
||||
{
|
||||
delay -= window + delay - mws;
|
||||
delayUpdated(delay);
|
||||
}
|
||||
if (delay < 0)
|
||||
{
|
||||
delay = 0;
|
||||
delayUpdated(delay);
|
||||
}
|
||||
}
|
||||
|
||||
void isoDriver::setSerialType(unsigned char type)
|
||||
|
|
|
@ -154,6 +154,10 @@ signals:
|
|||
void multimeterREnabled(int source);
|
||||
void mainWindowPleaseDisableSerial(int);
|
||||
void showRealtimeButton(bool visible);
|
||||
void topRangeUpdated(double);
|
||||
void botRangeUpdated(double);
|
||||
void timeWindowUpdated(double);
|
||||
void delayUpdated(double);
|
||||
public slots:
|
||||
void setWindow(int newWindow);
|
||||
void setVoltageRange(QWheelEvent *event);
|
||||
|
|
|
@ -987,6 +987,7 @@ void MainWindow::cycleDelayRight(){
|
|||
qDebug() << "RIGHT";
|
||||
ui->controller_iso->delay -= ui->controller_iso->window/10;
|
||||
if(ui->controller_iso->delay < 0) ui->controller_iso->delay = 0;
|
||||
ui->controller_iso->delayUpdated(ui->controller_iso->delay);
|
||||
}
|
||||
|
||||
void MainWindow::cycleDelayLeft(){
|
||||
|
@ -994,12 +995,14 @@ void MainWindow::cycleDelayLeft(){
|
|||
double mws = ui->controller_iso->fileModeEnabled ? ui->controller_iso->daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
||||
ui->controller_iso->delay += ui->controller_iso->window/10;
|
||||
if(ui->controller_iso->delay > (mws - ui->controller_iso->window)) ui->controller_iso->delay = (mws - ui->controller_iso->window);
|
||||
ui->controller_iso->delayUpdated(ui->controller_iso->delay);
|
||||
}
|
||||
|
||||
void MainWindow::cycleDelayRight_large(){
|
||||
qDebug() << "RIGHT";
|
||||
ui->controller_iso->delay -= ui->controller_iso->window/2;
|
||||
if(ui->controller_iso->delay < 0) ui->controller_iso->delay = 0;
|
||||
ui->controller_iso->delayUpdated(ui->controller_iso->delay);
|
||||
}
|
||||
|
||||
void MainWindow::cycleDelayLeft_large(){
|
||||
|
@ -1007,6 +1010,7 @@ void MainWindow::cycleDelayLeft_large(){
|
|||
double mws = ui->controller_iso->fileModeEnabled ? ui->controller_iso->daq_maxWindowSize : ((double)MAX_WINDOW_SIZE);
|
||||
ui->controller_iso->delay += ui->controller_iso->window/2;
|
||||
if(ui->controller_iso->delay > (mws - ui->controller_iso->window)) ui->controller_iso->delay = (mws - ui->controller_iso->window);
|
||||
ui->controller_iso->delayUpdated(ui->controller_iso->delay);
|
||||
}
|
||||
|
||||
void MainWindow::enableLabradorDebugging(){
|
||||
|
@ -2198,3 +2202,28 @@ void MainWindow::on_actionI2C_triggered(bool checked)
|
|||
{
|
||||
ui->controller_iso->setSerialType(1);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionShow_Range_Dialog_on_Main_Page_triggered(bool checked)
|
||||
{
|
||||
qDebug() << "on_actionShow_Range_Dialog_on_Main_Page_triggered" << checked;
|
||||
if (checked)
|
||||
{
|
||||
scopeRangeSwitch = new scopeRangeEnterDialog(nullptr, false, ui->controller_iso->topRange, ui->controller_iso->botRange, ui->controller_iso->window, ui->controller_iso->delay);
|
||||
scopeRangeSwitch->setWindowFlags(Qt::Widget);
|
||||
ui->verticalLayout_5->insertWidget(2, scopeRangeSwitch);
|
||||
connect(scopeRangeSwitch, SIGNAL(yTopUpdated(double)), ui->controller_iso, SLOT(setTopRange(double)));
|
||||
connect(scopeRangeSwitch, SIGNAL(yBotUpdated(double)), ui->controller_iso, SLOT(setBotRange(double)));
|
||||
connect(scopeRangeSwitch, SIGNAL(windowUpdated(double)), ui->controller_iso, SLOT(setTimeWindow(double)));
|
||||
connect(scopeRangeSwitch, SIGNAL(delayUpdated(double)), ui->controller_iso, SLOT(setDelay(double)));
|
||||
|
||||
connect(ui->controller_iso, SIGNAL(topRangeUpdated(double)), scopeRangeSwitch, SLOT(yTopChanged(double)));
|
||||
connect(ui->controller_iso, SIGNAL(botRangeUpdated(double)), scopeRangeSwitch, SLOT(yBotChanged(double)));
|
||||
connect(ui->controller_iso, SIGNAL(timeWindowUpdated(double)), scopeRangeSwitch, SLOT(windowChanged(double)));
|
||||
connect(ui->controller_iso, SIGNAL(delayUpdated(double)), scopeRangeSwitch, SLOT(delayChanged(double)));
|
||||
}
|
||||
else
|
||||
{
|
||||
delete scopeRangeSwitch;
|
||||
scopeRangeSwitch = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,6 +193,8 @@ private slots:
|
|||
|
||||
void on_actionI2C_triggered(bool checked);
|
||||
|
||||
void on_actionShow_Range_Dialog_on_Main_Page_triggered(bool checked);
|
||||
|
||||
private:
|
||||
//Generic Vars
|
||||
Ui::MainWindow *ui;
|
||||
|
@ -262,6 +264,8 @@ private:
|
|||
int daq_num_to_average;
|
||||
qulonglong daq_max_file_size;
|
||||
|
||||
scopeRangeEnterDialog* scopeRangeSwitch = nullptr;
|
||||
|
||||
#ifdef PLATFORM_ANDROID
|
||||
//Android Special
|
||||
QScreen *screenPtr;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "scoperangeenterdialog.h"
|
||||
#include "ui_scoperangeenterdialog.h"
|
||||
|
||||
scopeRangeEnterDialog::scopeRangeEnterDialog(QWidget *parent, double yTop, double yBot, double window, double delay) :
|
||||
scopeRangeEnterDialog::scopeRangeEnterDialog(QWidget *parent, bool buttonVisible, double yTop, double yBot, double window, double delay) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::scopeRangeEnterDialog)
|
||||
{
|
||||
|
@ -13,6 +13,7 @@ scopeRangeEnterDialog::scopeRangeEnterDialog(QWidget *parent, double yTop, doubl
|
|||
ui->vMaxBox->setValue(yTop);
|
||||
ui->vMinBox->setValue(yBot);
|
||||
ui->timeWindowBox->setValue(window);
|
||||
ui->buttonBox->setVisible(buttonVisible);
|
||||
}
|
||||
|
||||
scopeRangeEnterDialog::~scopeRangeEnterDialog()
|
||||
|
@ -22,24 +23,65 @@ scopeRangeEnterDialog::~scopeRangeEnterDialog()
|
|||
|
||||
void scopeRangeEnterDialog::toUpdateYTop(double val){
|
||||
qDebug() << val;
|
||||
|
||||
if (yTop != val)
|
||||
{
|
||||
yTop = val;
|
||||
yTopUpdated(val);
|
||||
}
|
||||
}
|
||||
|
||||
void scopeRangeEnterDialog::toUpdateYBot(double val){
|
||||
qDebug() << val;
|
||||
|
||||
if (yBot != val)
|
||||
{
|
||||
yBot = val;
|
||||
yBotUpdated(val);
|
||||
}
|
||||
}
|
||||
|
||||
void scopeRangeEnterDialog::toUpdateWindow(double val){
|
||||
qDebug() << val;
|
||||
windowUpdated(val);
|
||||
|
||||
if (timeWindow != val)
|
||||
{
|
||||
ui->delayBox->setMax(((double)MAX_WINDOW_SIZE) - ui->timeWindowBox->value());
|
||||
qDebug() << "delayBox updating to" << ui->delayBox->maximum();
|
||||
timeWindow = val;
|
||||
windowUpdated(val);
|
||||
}
|
||||
}
|
||||
|
||||
void scopeRangeEnterDialog::toUpdateDelay(double val){
|
||||
qDebug() << val;
|
||||
delayUpdated(val);
|
||||
|
||||
if (delay != val)
|
||||
{
|
||||
ui->timeWindowBox->setMax(((double)MAX_WINDOW_SIZE) - ui->delayBox->value());
|
||||
qDebug() << "timeWindowBox updating max to" << ui->timeWindowBox->maximum();
|
||||
delay = val;
|
||||
delayUpdated(val);
|
||||
}
|
||||
}
|
||||
|
||||
void scopeRangeEnterDialog::yTopChanged(double val)
|
||||
{
|
||||
ui->vMaxBox->setValue(val);
|
||||
}
|
||||
|
||||
void scopeRangeEnterDialog::yBotChanged(double val)
|
||||
{
|
||||
ui->vMinBox->setValue(val);
|
||||
}
|
||||
|
||||
void scopeRangeEnterDialog::windowChanged(double val)
|
||||
{
|
||||
ui->timeWindowBox->setValue(val);
|
||||
}
|
||||
|
||||
void scopeRangeEnterDialog::delayChanged(double val)
|
||||
{
|
||||
ui->delayBox->setValue(val);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,11 +17,15 @@ class scopeRangeEnterDialog : public QDialog
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit scopeRangeEnterDialog(QWidget *parent = 0, double yTop = 20, double yBot = -20, double window = -10, double delay = 0);
|
||||
explicit scopeRangeEnterDialog(QWidget *parent = 0, bool buttonVisible = true, double yTop = 20, double yBot = -20, double window = -10, double delay = 0);
|
||||
~scopeRangeEnterDialog();
|
||||
|
||||
private:
|
||||
Ui::scopeRangeEnterDialog *ui;
|
||||
double delay = 130065506;
|
||||
double timeWindow = 130065506;
|
||||
double yBot = 130065506;
|
||||
double yTop = 130065506;
|
||||
|
||||
signals:
|
||||
void yTopUpdated(double val);
|
||||
|
@ -33,6 +37,10 @@ private slots:
|
|||
void toUpdateYBot(double val);
|
||||
void toUpdateWindow(double val);
|
||||
void toUpdateDelay(double val);
|
||||
void yTopChanged(double val);
|
||||
void yBotChanged(double val);
|
||||
void windowChanged(double val);
|
||||
void delayChanged(double val);
|
||||
};
|
||||
|
||||
#endif // SCOPERANGEENTERDIALOG_H
|
||||
|
|
|
@ -1402,6 +1402,7 @@
|
|||
<addaction name="actionCalibrate"/>
|
||||
<addaction name="actionForce_Square"/>
|
||||
<addaction name="actionAutomatically_Enable_Cursors"/>
|
||||
<addaction name="actionShow_Range_Dialog_on_Main_Page"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuMultimeter_2">
|
||||
<property name="title">
|
||||
|
@ -2296,6 +2297,14 @@
|
|||
<string>I2C</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionShow_Range_Dialog_on_Main_Page">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show Range Dialog on Main Page</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
|
Loading…
Reference in New Issue