kopia lustrzana https://gitlab.com/Teuniz/DSRemote
Added the possibility to show the number of waveform updates per second (fps).
rodzic
9a8560ef95
commit
a86711f44c
5
global.h
5
global.h
|
@ -35,7 +35,7 @@
|
|||
|
||||
|
||||
#define PROGRAM_NAME "DSRemote"
|
||||
#define PROGRAM_VERSION "0.32_1601121654"
|
||||
#define PROGRAM_VERSION "0.32_1601301710"
|
||||
|
||||
#define MAX_PATHLEN 4096
|
||||
|
||||
|
@ -203,6 +203,9 @@ struct device_settings
|
|||
double fft_voffset;
|
||||
|
||||
int current_screen_sf;
|
||||
|
||||
int fps;
|
||||
int fps_on;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -373,6 +373,10 @@ void UI_Mainwindow::open_connection()
|
|||
|
||||
scrn_timer->start(devparms.screentimerival);
|
||||
|
||||
fps_timer->start(100);
|
||||
|
||||
devparms.fps = 0;
|
||||
|
||||
return;
|
||||
|
||||
OUT_ERROR:
|
||||
|
@ -400,6 +404,8 @@ void UI_Mainwindow::close_connection()
|
|||
|
||||
adjdial_timer->stop();
|
||||
|
||||
fps_timer->stop();
|
||||
|
||||
devparms.connected = 0;
|
||||
|
||||
if(scrn_thread->wait(5000) == false)
|
||||
|
@ -483,6 +489,8 @@ void UI_Mainwindow::close_connection()
|
|||
devparms.k_cfg = NULL;
|
||||
}
|
||||
|
||||
devparms.fps = 0;
|
||||
|
||||
statusLabel->setText("Disconnected");
|
||||
}
|
||||
|
||||
|
|
|
@ -136,6 +136,7 @@ private:
|
|||
*vertOffsDial_timer,
|
||||
*horScaleDial_timer,
|
||||
*vertScaleDial_timer,
|
||||
*fps_timer,
|
||||
*test_timer;
|
||||
|
||||
QStatusBar *statusBar;
|
||||
|
@ -236,6 +237,7 @@ private slots:
|
|||
void vertOffsDial_timer_handler();
|
||||
void horScaleDial_timer_handler();
|
||||
void vertScaleDial_timer_handler();
|
||||
void fps_timer_handler();
|
||||
|
||||
void show_about_dialog();
|
||||
void show_howto_operate();
|
||||
|
|
|
@ -103,6 +103,21 @@ UI_Mainwindow::UI_Mainwindow()
|
|||
settings.setValue("screenshot/inverted", devparms.screenshot_inv);
|
||||
}
|
||||
|
||||
devparms.fps_on = settings.value("gui/fps_on", 0).toInt();
|
||||
|
||||
if(devparms.fps_on)
|
||||
{
|
||||
devparms.fps_on = 1;
|
||||
|
||||
settings.setValue("gui/fps_on", devparms.fps_on);
|
||||
}
|
||||
else
|
||||
{
|
||||
devparms.fps_on = 0;
|
||||
|
||||
settings.setValue("gui/fps_on", devparms.fps_on);
|
||||
}
|
||||
|
||||
devparms.displaygrid = 2;
|
||||
|
||||
devparms.channel_cnt = 4;
|
||||
|
@ -471,6 +486,7 @@ UI_Mainwindow::UI_Mainwindow()
|
|||
horScaleDial_timer->setSingleShot(true);
|
||||
vertScaleDial_timer = new QTimer(this);
|
||||
vertScaleDial_timer->setSingleShot(true);
|
||||
fps_timer = new QTimer(this);
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
scrn_timer->setTimerType(Qt::PreciseTimer);
|
||||
|
@ -483,6 +499,7 @@ UI_Mainwindow::UI_Mainwindow()
|
|||
vertOffsDial_timer->setTimerType(Qt::PreciseTimer);
|
||||
horScaleDial_timer->setTimerType(Qt::PreciseTimer);
|
||||
vertScaleDial_timer->setTimerType(Qt::PreciseTimer);
|
||||
fps_timer->setTimerType(Qt::PreciseTimer);
|
||||
#endif
|
||||
|
||||
connect(scrn_timer, SIGNAL(timeout()), this, SLOT(scrn_timer_handler()));
|
||||
|
@ -497,6 +514,7 @@ UI_Mainwindow::UI_Mainwindow()
|
|||
connect(vertOffsDial_timer, SIGNAL(timeout()), this, SLOT(vertOffsDial_timer_handler()));
|
||||
connect(horScaleDial_timer, SIGNAL(timeout()), this, SLOT(horScaleDial_timer_handler()));
|
||||
connect(vertScaleDial_timer, SIGNAL(timeout()), this, SLOT(vertScaleDial_timer_handler()));
|
||||
connect(fps_timer, SIGNAL(timeout()), this, SLOT(fps_timer_handler()));
|
||||
|
||||
///// TEST /////////////////////////////////////
|
||||
// DPRwidget->setEnabled(true);
|
||||
|
|
|
@ -156,6 +156,22 @@ UI_settings_window::UI_settings_window(QWidget *parnt)
|
|||
invScrShtCheckbox->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
|
||||
showfpsLabel = new QLabel(this);
|
||||
showfpsLabel->setGeometry(40, 220, 120, 35);
|
||||
showfpsLabel->setText("Show frames\n per second");
|
||||
|
||||
showfpsCheckbox = new QCheckBox(this);
|
||||
showfpsCheckbox->setGeometry(180, 220, 120, 35);
|
||||
showfpsCheckbox->setTristate(false);
|
||||
if(mainwindow->devparms.fps_on)
|
||||
{
|
||||
showfpsCheckbox->setCheckState(Qt::Checked);
|
||||
}
|
||||
else
|
||||
{
|
||||
showfpsCheckbox->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
|
||||
applyButton = new QPushButton(this);
|
||||
applyButton->setGeometry(40, 450, 100, 25);
|
||||
applyButton->setText("Apply");
|
||||
|
@ -194,6 +210,7 @@ UI_settings_window::UI_settings_window(QWidget *parnt)
|
|||
QObject::connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
QObject::connect(refreshSpinbox, SIGNAL(valueChanged(int)), this, SLOT(refreshSpinboxChanged(int)));
|
||||
QObject::connect(invScrShtCheckbox, SIGNAL(stateChanged(int)), this, SLOT(invScrShtCheckboxChanged(int)));
|
||||
QObject::connect(showfpsCheckbox, SIGNAL(stateChanged(int)), this, SLOT(showfpsCheckboxChanged(int)));
|
||||
|
||||
exec();
|
||||
}
|
||||
|
@ -247,6 +264,19 @@ void UI_settings_window::applyButtonClicked()
|
|||
settings.setValue("screenshot/inverted", 0);
|
||||
}
|
||||
|
||||
if(showfpsCheckbox->checkState() == Qt::Checked)
|
||||
{
|
||||
mainwindow->devparms.fps_on = 1;
|
||||
|
||||
settings.setValue("gui/fps_on", 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
mainwindow->devparms.fps_on = 0;
|
||||
|
||||
settings.setValue("gui/fps_on", 0);
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
|
@ -283,6 +313,23 @@ void UI_settings_window::invScrShtCheckboxChanged(int state)
|
|||
}
|
||||
|
||||
|
||||
void UI_settings_window::showfpsCheckboxChanged(int state)
|
||||
{
|
||||
QSettings settings;
|
||||
|
||||
if(state == Qt::Checked)
|
||||
{
|
||||
mainwindow->devparms.fps_on = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
mainwindow->devparms.fps_on = 0;
|
||||
}
|
||||
|
||||
settings.setValue("gui/show_fps", mainwindow->devparms.fps_on);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -76,9 +76,11 @@ QSpinBox *refreshSpinbox,
|
|||
*ipSpinbox4;
|
||||
|
||||
QLabel *refreshLabel,
|
||||
*invScrShtLabel;
|
||||
*invScrShtLabel,
|
||||
*showfpsLabel;
|
||||
|
||||
QCheckBox *invScrShtCheckbox;
|
||||
QCheckBox *invScrShtCheckbox,
|
||||
*showfpsCheckbox;
|
||||
|
||||
UI_Mainwindow *mainwindow;
|
||||
|
||||
|
@ -87,6 +89,7 @@ private slots:
|
|||
void applyButtonClicked();
|
||||
void refreshSpinboxChanged(int);
|
||||
void invScrShtCheckboxChanged(int);
|
||||
void showfpsCheckboxChanged(int);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -218,6 +218,11 @@ void SignalCurve::drawWidget(QPainter *painter, int curve_w, int curve_h)
|
|||
drawChanLabel(painter, 8 + (i * 125), curve_h - 25, i);
|
||||
}
|
||||
|
||||
if(devparms->connected && devparms->fps_on)
|
||||
{
|
||||
drawfpsLabel(painter, curve_w - 80, curve_h - 11);
|
||||
}
|
||||
|
||||
/////////////////////////////////// translate coordinates, draw and fill a rectangle ///////////////////////////////////////////
|
||||
|
||||
painter->translate(bordersize, bordersize);
|
||||
|
@ -1178,6 +1183,22 @@ void SignalCurve::drawTopLabels(QPainter *painter)
|
|||
}
|
||||
|
||||
|
||||
void SignalCurve::drawfpsLabel(QPainter *painter, int xpos, int ypos)
|
||||
{
|
||||
char str[256];
|
||||
|
||||
if(devparms->fps == 0) return;
|
||||
|
||||
painter->setPen(Qt::red);
|
||||
|
||||
sprintf(str, "%.1f fps", 10.0 / devparms->fps);
|
||||
|
||||
painter->drawText(xpos, ypos, str);
|
||||
|
||||
devparms->fps = 0;
|
||||
}
|
||||
|
||||
|
||||
void SignalCurve::drawChanLabel(QPainter *painter, int xpos, int ypos, int chn)
|
||||
{
|
||||
QPainterPath path;
|
||||
|
|
|
@ -152,6 +152,7 @@ private:
|
|||
void paintLabel(QPainter *, int, int, int, int, const char *, QColor);
|
||||
void paintCounterLabel(QPainter *, int, int);
|
||||
void drawFFT(QPainter *, int, int);
|
||||
void drawfpsLabel(QPainter *, int, int);
|
||||
|
||||
struct device_settings *devparms;
|
||||
|
||||
|
|
|
@ -219,6 +219,11 @@ void UI_Mainwindow::vertScaleDial_timer_handler()
|
|||
}
|
||||
|
||||
|
||||
void UI_Mainwindow::fps_timer_handler()
|
||||
{
|
||||
devparms.fps++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue