Work in progress.

merge-requests/1/head
Teuniz 2015-06-27 22:32:22 +02:00
rodzic e0b264d229
commit bb11eab54e
9 zmienionych plików z 67 dodań i 29 usunięć

Wyświetl plik

@ -31,14 +31,12 @@
#define PROGRAM_NAME "DSRemote"
#define PROGRAM_VERSION "0.20_1506272131"
#define PROGRAM_VERSION "0.20_1506272231"
#define MAX_PATHLEN 4096
#define MAX_CHNS 4
#define SCREEN_TIMER_IVAL 50
#define ADJDIAL_TIMER_IVAL_1 3000
#define ADJDIAL_TIMER_IVAL_2 2000
@ -89,6 +87,8 @@ struct device_settings
int modelserie; // 1=DS1000, 2=DS2000, etc.
int hordivisions; // number of horizontal divisions
int screentimerival;
double samplerate; // Samplefrequency
int memdepth; // Number of waveform points that the oscilloscope can store in a single trigger sample
int channel_cnt; // Device has 2 or 4 channels

Wyświetl plik

@ -202,7 +202,7 @@ void UI_Mainwindow::navDialReleased()
if(devparms.screenupdates_on == 1)
{
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
}
waveForm->update();
@ -2097,7 +2097,7 @@ void UI_Mainwindow::autoButtonClicked()
get_device_settings();
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
}
@ -2224,7 +2224,7 @@ void UI_Mainwindow::horizontal_delayed_toggle()
devparms.timebasedelayscale = atof(device->buf);
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
}
}

Wyświetl plik

@ -300,7 +300,7 @@ void UI_Mainwindow::open_connection()
devparms.screenupdates_on = 1;
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
return;
@ -2571,7 +2571,7 @@ void UI_Mainwindow::set_to_factory()
QApplication::restoreOverrideCursor();
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
}

Wyświetl plik

@ -58,6 +58,8 @@ UI_Mainwindow::UI_Mainwindow()
QCoreApplication::setOrganizationDomain("teuniz.net");
QCoreApplication::setApplicationName(PROGRAM_NAME);
QSettings settings;
memset(&devparms, 0, sizeof(struct device_settings));
devparms.screenshot_buf = (char *)malloc(1024 * 1024 * 2);
@ -69,6 +71,15 @@ UI_Mainwindow::UI_Mainwindow()
devparms.chanscale[i] = 1;
}
devparms.screentimerival = settings.value("gui/refresh").toInt();
if((devparms.screentimerival < 50) || (devparms.screentimerival > 2000))
{
devparms.screentimerival = 500;
settings.setValue("gui/refresh", devparms.screentimerival);
}
devparms.displaygrid = 2;
devparms.channel_cnt = 4;
@ -378,8 +389,6 @@ UI_Mainwindow::UI_Mainwindow()
device = NULL;
QSettings settings;
strcpy(recent_savedir, settings.value("path/savedir").toString().toLocal8Bit().data());
strcpy(str, settings.value("connection/type").toString().toLatin1().data());

Wyświetl plik

@ -121,7 +121,7 @@ void UI_Mainwindow::save_screenshot()
if(!strcmp(opath, ""))
{
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
return;
}
@ -134,13 +134,13 @@ void UI_Mainwindow::save_screenshot()
goto OUT_ERROR;
}
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
return;
OUT_ERROR:
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical);
@ -642,7 +642,7 @@ OUT_NORMAL:
free(wavbuf[chn]);
}
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
return;
@ -704,7 +704,7 @@ OUT_ERROR:
free(wavbuf[chn]);
}
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
}
@ -1008,7 +1008,7 @@ OUT_NORMAL:
free(wavbuf[chn]);
}
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
return;
@ -1029,7 +1029,7 @@ OUT_ERROR:
free(wavbuf[chn]);
}
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
}

Wyświetl plik

@ -40,8 +40,8 @@ UI_settings_window::UI_settings_window(QWidget *parnt)
char dev_str[128];
setMinimumSize(QSize(400, 200));
setMaximumSize(QSize(400, 200));
setMinimumSize(QSize(490, 200));
setMaximumSize(QSize(490, 200));
setWindowTitle("Settings");
setModal(true);
@ -55,7 +55,7 @@ UI_settings_window::UI_settings_window(QWidget *parnt)
lanRadioButton = new QRadioButton("LAN", this);
lanRadioButton->setAutoExclusive(true);
lanRadioButton->setGeometry(260, 20, 110, 25);
lanRadioButton->setGeometry(220, 20, 110, 25);
if(mainwindow->devparms.connectiontype == 1)
{
lanRadioButton->setChecked(true);
@ -75,7 +75,7 @@ UI_settings_window::UI_settings_window(QWidget *parnt)
comboBox1->addItem("/dev/usbtmc9");
ipLineEdit = new QLineEdit(this);
ipLineEdit->setGeometry(240, 65, 110, 25);
ipLineEdit->setGeometry(200, 65, 110, 25);
ipLineEdit->setInputMask("000.000.000.000;_");
if(settings.contains("connection/ip"))
{
@ -86,12 +86,23 @@ UI_settings_window::UI_settings_window(QWidget *parnt)
ipLineEdit->setText("192.168.001.088");
}
refreshLabel = new QLabel(this);
refreshLabel->setGeometry(370, 20, 120, 35);
refreshLabel->setText("Screen update\n interval");
refreshSpinbox = new QSpinBox(this);
refreshSpinbox->setGeometry(370, 65, 100, 25);
refreshSpinbox->setSuffix(" mS");
refreshSpinbox->setRange(50, 2000);
refreshSpinbox->setSingleStep(10);
refreshSpinbox->setValue(mainwindow->devparms.screentimerival);
applyButton = new QPushButton(this);
applyButton->setGeometry(20, 155, 100, 25);
applyButton->setText("Apply");
cancelButton = new QPushButton(this);
cancelButton->setGeometry(240, 155, 100, 25);
cancelButton->setGeometry(200, 155, 100, 25);
cancelButton->setText("Cancel");
strcpy(dev_str, settings.value("connection/device").toString().toLocal8Bit().data());
@ -113,10 +124,11 @@ UI_settings_window::UI_settings_window(QWidget *parnt)
}
else
{
QObject::connect(applyButton, SIGNAL(clicked()), this, SLOT(applyButtonClicked()));
QObject::connect(applyButton, SIGNAL(clicked()), this, SLOT(applyButtonClicked()));
}
QObject::connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));
QObject::connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));
QObject::connect(refreshSpinbox, SIGNAL(valueChanged(int)), this, SLOT(refreshSpinboxChanged(int)));
exec();
}
@ -158,8 +170,19 @@ void UI_settings_window::applyButtonClicked()
}
void UI_settings_window::refreshSpinboxChanged(int value)
{
QSettings settings;
mainwindow->devparms.screentimerival = value;
settings.setValue("gui/refresh", value);
if(mainwindow->scrn_timer->isActive())
{
mainwindow->scrn_timer->start(value);
}
}

Wyświetl plik

@ -42,6 +42,7 @@
#include <QSettings>
#include <QLineEdit>
#include <QRadioButton>
#include <QSpinBox>
#include "mainwindow.h"
#include "global.h"
@ -70,11 +71,16 @@ QComboBox *comboBox1;
QLineEdit *ipLineEdit;
QSpinBox *refreshSpinbox;
QLabel *refreshLabel;
UI_Mainwindow *mainwindow;
private slots:
void applyButtonClicked();
void refreshSpinboxChanged(int);
};

Wyświetl plik

@ -1341,7 +1341,7 @@ void SignalCurve::mouseReleaseEvent(QMouseEvent *release_event)
if(devparms->screenupdates_on == 1)
{
mainwindow->scrn_timer->start(SCREEN_TIMER_IVAL);
mainwindow->scrn_timer->start(devparms->screentimerival);
}
if(trig_pos_arrow_moving)

Wyświetl plik

@ -61,7 +61,7 @@ void UI_Mainwindow::navDial_timer_handler()
if(devparms.screenupdates_on == 1)
{
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
}
}
}
@ -120,7 +120,7 @@ void UI_Mainwindow::adjdial_timer_handler()
if(devparms.screenupdates_on == 1)
{
scrn_timer->start(SCREEN_TIMER_IVAL);
scrn_timer->start(devparms.screentimerival);
}
}