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_NAME "DSRemote"
#define PROGRAM_VERSION "0.20_1506272131" #define PROGRAM_VERSION "0.20_1506272231"
#define MAX_PATHLEN 4096 #define MAX_PATHLEN 4096
#define MAX_CHNS 4 #define MAX_CHNS 4
#define SCREEN_TIMER_IVAL 50
#define ADJDIAL_TIMER_IVAL_1 3000 #define ADJDIAL_TIMER_IVAL_1 3000
#define ADJDIAL_TIMER_IVAL_2 2000 #define ADJDIAL_TIMER_IVAL_2 2000
@ -89,6 +87,8 @@ struct device_settings
int modelserie; // 1=DS1000, 2=DS2000, etc. int modelserie; // 1=DS1000, 2=DS2000, etc.
int hordivisions; // number of horizontal divisions int hordivisions; // number of horizontal divisions
int screentimerival;
double samplerate; // Samplefrequency double samplerate; // Samplefrequency
int memdepth; // Number of waveform points that the oscilloscope can store in a single trigger sample 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 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) if(devparms.screenupdates_on == 1)
{ {
scrn_timer->start(SCREEN_TIMER_IVAL); scrn_timer->start(devparms.screentimerival);
} }
waveForm->update(); waveForm->update();
@ -2097,7 +2097,7 @@ void UI_Mainwindow::autoButtonClicked()
get_device_settings(); 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); 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; devparms.screenupdates_on = 1;
scrn_timer->start(SCREEN_TIMER_IVAL); scrn_timer->start(devparms.screentimerival);
return; return;
@ -2571,7 +2571,7 @@ void UI_Mainwindow::set_to_factory()
QApplication::restoreOverrideCursor(); 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::setOrganizationDomain("teuniz.net");
QCoreApplication::setApplicationName(PROGRAM_NAME); QCoreApplication::setApplicationName(PROGRAM_NAME);
QSettings settings;
memset(&devparms, 0, sizeof(struct device_settings)); memset(&devparms, 0, sizeof(struct device_settings));
devparms.screenshot_buf = (char *)malloc(1024 * 1024 * 2); devparms.screenshot_buf = (char *)malloc(1024 * 1024 * 2);
@ -69,6 +71,15 @@ UI_Mainwindow::UI_Mainwindow()
devparms.chanscale[i] = 1; 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.displaygrid = 2;
devparms.channel_cnt = 4; devparms.channel_cnt = 4;
@ -378,8 +389,6 @@ UI_Mainwindow::UI_Mainwindow()
device = NULL; device = NULL;
QSettings settings;
strcpy(recent_savedir, settings.value("path/savedir").toString().toLocal8Bit().data()); strcpy(recent_savedir, settings.value("path/savedir").toString().toLocal8Bit().data());
strcpy(str, settings.value("connection/type").toString().toLatin1().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, "")) if(!strcmp(opath, ""))
{ {
scrn_timer->start(SCREEN_TIMER_IVAL); scrn_timer->start(devparms.screentimerival);
return; return;
} }
@ -134,13 +134,13 @@ void UI_Mainwindow::save_screenshot()
goto OUT_ERROR; goto OUT_ERROR;
} }
scrn_timer->start(SCREEN_TIMER_IVAL); scrn_timer->start(devparms.screentimerival);
return; return;
OUT_ERROR: OUT_ERROR:
scrn_timer->start(SCREEN_TIMER_IVAL); scrn_timer->start(devparms.screentimerival);
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Critical); msgBox.setIcon(QMessageBox::Critical);
@ -642,7 +642,7 @@ OUT_NORMAL:
free(wavbuf[chn]); free(wavbuf[chn]);
} }
scrn_timer->start(SCREEN_TIMER_IVAL); scrn_timer->start(devparms.screentimerival);
return; return;
@ -704,7 +704,7 @@ OUT_ERROR:
free(wavbuf[chn]); free(wavbuf[chn]);
} }
scrn_timer->start(SCREEN_TIMER_IVAL); scrn_timer->start(devparms.screentimerival);
} }
@ -1008,7 +1008,7 @@ OUT_NORMAL:
free(wavbuf[chn]); free(wavbuf[chn]);
} }
scrn_timer->start(SCREEN_TIMER_IVAL); scrn_timer->start(devparms.screentimerival);
return; return;
@ -1029,7 +1029,7 @@ OUT_ERROR:
free(wavbuf[chn]); 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]; char dev_str[128];
setMinimumSize(QSize(400, 200)); setMinimumSize(QSize(490, 200));
setMaximumSize(QSize(400, 200)); setMaximumSize(QSize(490, 200));
setWindowTitle("Settings"); setWindowTitle("Settings");
setModal(true); setModal(true);
@ -55,7 +55,7 @@ UI_settings_window::UI_settings_window(QWidget *parnt)
lanRadioButton = new QRadioButton("LAN", this); lanRadioButton = new QRadioButton("LAN", this);
lanRadioButton->setAutoExclusive(true); lanRadioButton->setAutoExclusive(true);
lanRadioButton->setGeometry(260, 20, 110, 25); lanRadioButton->setGeometry(220, 20, 110, 25);
if(mainwindow->devparms.connectiontype == 1) if(mainwindow->devparms.connectiontype == 1)
{ {
lanRadioButton->setChecked(true); lanRadioButton->setChecked(true);
@ -75,7 +75,7 @@ UI_settings_window::UI_settings_window(QWidget *parnt)
comboBox1->addItem("/dev/usbtmc9"); comboBox1->addItem("/dev/usbtmc9");
ipLineEdit = new QLineEdit(this); ipLineEdit = new QLineEdit(this);
ipLineEdit->setGeometry(240, 65, 110, 25); ipLineEdit->setGeometry(200, 65, 110, 25);
ipLineEdit->setInputMask("000.000.000.000;_"); ipLineEdit->setInputMask("000.000.000.000;_");
if(settings.contains("connection/ip")) if(settings.contains("connection/ip"))
{ {
@ -86,12 +86,23 @@ UI_settings_window::UI_settings_window(QWidget *parnt)
ipLineEdit->setText("192.168.001.088"); 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 = new QPushButton(this);
applyButton->setGeometry(20, 155, 100, 25); applyButton->setGeometry(20, 155, 100, 25);
applyButton->setText("Apply"); applyButton->setText("Apply");
cancelButton = new QPushButton(this); cancelButton = new QPushButton(this);
cancelButton->setGeometry(240, 155, 100, 25); cancelButton->setGeometry(200, 155, 100, 25);
cancelButton->setText("Cancel"); cancelButton->setText("Cancel");
strcpy(dev_str, settings.value("connection/device").toString().toLocal8Bit().data()); strcpy(dev_str, settings.value("connection/device").toString().toLocal8Bit().data());
@ -117,6 +128,7 @@ UI_settings_window::UI_settings_window(QWidget *parnt)
} }
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(); 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 <QSettings>
#include <QLineEdit> #include <QLineEdit>
#include <QRadioButton> #include <QRadioButton>
#include <QSpinBox>
#include "mainwindow.h" #include "mainwindow.h"
#include "global.h" #include "global.h"
@ -70,11 +71,16 @@ QComboBox *comboBox1;
QLineEdit *ipLineEdit; QLineEdit *ipLineEdit;
QSpinBox *refreshSpinbox;
QLabel *refreshLabel;
UI_Mainwindow *mainwindow; UI_Mainwindow *mainwindow;
private slots: private slots:
void applyButtonClicked(); void applyButtonClicked();
void refreshSpinboxChanged(int);
}; };

Wyświetl plik

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

Wyświetl plik

@ -61,7 +61,7 @@ void UI_Mainwindow::navDial_timer_handler()
if(devparms.screenupdates_on == 1) 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) if(devparms.screenupdates_on == 1)
{ {
scrn_timer->start(SCREEN_TIMER_IVAL); scrn_timer->start(devparms.screentimerival);
} }
} }