Work in progress.

merge-requests/1/head
Teuniz 2015-06-10 15:29:45 +02:00
rodzic 0b09566ec2
commit f3e238d35d
6 zmienionych plików z 96 dodań i 9 usunięć

Wyświetl plik

@ -31,7 +31,7 @@
#define PROGRAM_NAME "DSRemote" #define PROGRAM_NAME "DSRemote"
#define PROGRAM_VERSION "0.1" #define PROGRAM_VERSION "0.11"
#define MAX_PATHLEN 4096 #define MAX_PATHLEN 4096
@ -53,6 +53,15 @@
#define NAV_DIAL_FUNC_NONE 0 #define NAV_DIAL_FUNC_NONE 0
#define NAV_DIAL_FUNC_HOLDOFF 1 #define NAV_DIAL_FUNC_HOLDOFF 1
#define LABEL_TIMER_IVAL 1000
#define LABEL_ACTIVE_NONE 0
#define LABEL_ACTIVE_CHAN1 1
#define LABEL_ACTIVE_CHAN2 2
#define LABEL_ACTIVE_CHAN3 3
#define LABEL_ACTIVE_CHAN4 4
#define LABEL_ACTIVE_TRIG 5
struct waveform_preamble struct waveform_preamble

Wyświetl plik

@ -110,7 +110,8 @@ public:
int adjDialFunc, int adjDialFunc,
navDialFunc; navDialFunc;
QTimer *scrn_timer; QTimer *scrn_timer,
*label_timer;
private: private:
@ -205,6 +206,7 @@ private slots:
void scrn_timer_handler(); void scrn_timer_handler();
void stat_timer_handler(); void stat_timer_handler();
void adjdial_timer_handler(); void adjdial_timer_handler();
void label_timer_handler();
void test_timer_handler(); void test_timer_handler();
void show_about_dialog(); void show_about_dialog();

Wyświetl plik

@ -348,12 +348,14 @@ UI_Mainwindow::UI_Mainwindow()
adjdial_timer = new QTimer(this); adjdial_timer = new QTimer(this);
navDial_timer = new QTimer(this); navDial_timer = new QTimer(this);
navDial_timer->setSingleShot(true); navDial_timer->setSingleShot(true);
label_timer = new QTimer(this);
test_timer = new QTimer(this); test_timer = new QTimer(this);
connect(scrn_timer, SIGNAL(timeout()), this, SLOT(scrn_timer_handler())); connect(scrn_timer, SIGNAL(timeout()), this, SLOT(scrn_timer_handler()));
connect(adjdial_timer, SIGNAL(timeout()), this, SLOT(adjdial_timer_handler())); connect(adjdial_timer, SIGNAL(timeout()), this, SLOT(adjdial_timer_handler()));
connect(navDial, SIGNAL(sliderReleased()), this, SLOT(navDialReleased())); connect(navDial, SIGNAL(sliderReleased()), this, SLOT(navDialReleased()));
connect(navDial_timer, SIGNAL(timeout()), this, SLOT(navDial_timer_handler())); connect(navDial_timer, SIGNAL(timeout()), this, SLOT(navDial_timer_handler()));
connect(label_timer, SIGNAL(timeout()), this, SLOT(label_timer_handler()));
connect(test_timer, SIGNAL(timeout()), this, SLOT(test_timer_handler())); connect(test_timer, SIGNAL(timeout()), this, SLOT(test_timer_handler()));
///// TEST ///////////////////////////////////// ///// TEST /////////////////////////////////////

Wyświetl plik

@ -65,6 +65,8 @@ SignalCurve::SignalCurve(QWidget *w_parent) : QWidget(w_parent)
mouse_old_x = 0; mouse_old_x = 0;
mouse_old_y = 0; mouse_old_y = 0;
label_active = LABEL_ACTIVE_NONE;
for(i=0; i<MAX_CHNS; i++) for(i=0; i<MAX_CHNS; i++)
{ {
chan_arrow_moving[i] = 0; chan_arrow_moving[i] = 0;
@ -136,6 +138,8 @@ void SignalCurve::drawWidget(QPainter *painter, int curve_w, int curve_h)
{ {
int i, chn, tmp, rot=1, small_rulers; int i, chn, tmp, rot=1, small_rulers;
char str[256];
double h_step=0.0, double h_step=0.0,
step, step,
step2; step2;
@ -467,21 +471,60 @@ void SignalCurve::drawWidget(QPainter *painter, int curve_w, int curve_h)
paintCounterLabel(painter, curve_w - 150, 6); paintCounterLabel(painter, curve_w - 150, 6);
} }
char str[128];
if((mainwindow->adjDialFunc == ADJ_DIAL_FUNC_HOLDOFF) || (mainwindow->navDialFunc == NAV_DIAL_FUNC_HOLDOFF)) if((mainwindow->adjDialFunc == ADJ_DIAL_FUNC_HOLDOFF) || (mainwindow->navDialFunc == NAV_DIAL_FUNC_HOLDOFF))
{ {
convert_to_metric_suffix(str, devparms->triggerholdoff, 2); convert_to_metric_suffix(str, devparms->triggerholdoff, 2);
strcat(str, "S"); strcat(str, "S");
paintLabel(painter, curve_w - 110, 5, 100, 20, str); paintLabel(painter, curve_w - 110, 5, 100, 20, str, Qt::white);
} }
else if(mainwindow->adjDialFunc == ADJ_DIAL_FUNC_ACQ_AVG) else if(mainwindow->adjDialFunc == ADJ_DIAL_FUNC_ACQ_AVG)
{ {
sprintf(str, "%i", devparms->acquireaverages); sprintf(str, "%i", devparms->acquireaverages);
paintLabel(painter, curve_w - 110, 5, 100, 20, str); paintLabel(painter, curve_w - 110, 5, 100, 20, str, Qt::white);
}
if(label_active == LABEL_ACTIVE_TRIG)
{
convert_to_metric_suffix(str, devparms->triggeredgelevel[devparms->triggeredgesource], 2);
strcat(str, "V");
paintLabel(painter, curve_w - 120, curve_h - 50, 100, 20, str, QColor(255, 128, 0));
}
else if(label_active == LABEL_ACTIVE_CHAN1)
{
convert_to_metric_suffix(str, devparms->chanoffset[0], 2);
strcat(str, "V");
paintLabel(painter, 20, curve_h - 50, 100, 20, str, SignalColor[0]);
}
else if(label_active == LABEL_ACTIVE_CHAN2)
{
convert_to_metric_suffix(str, devparms->chanoffset[1], 2);
strcat(str, "V");
paintLabel(painter, 20, curve_h - 50, 100, 20, str, SignalColor[1]);
}
else if(label_active == LABEL_ACTIVE_CHAN3)
{
convert_to_metric_suffix(str, devparms->chanoffset[2], 2);
strcat(str, "V");
paintLabel(painter, 20, curve_h - 50, 100, 20, str, SignalColor[2]);
}
else if(label_active == LABEL_ACTIVE_CHAN4)
{
convert_to_metric_suffix(str, devparms->chanoffset[3], 2);
strcat(str, "V");
paintLabel(painter, 20, curve_h - 50, 100, 20, str, SignalColor[3]);
} }
// clk_end = clock(); // clk_end = clock();
@ -1469,6 +1512,8 @@ void SignalCurve::mouseMoveEvent(QMouseEvent *move_event)
{ {
int chn; int chn;
double dtmp;
if(!use_move_events) if(!use_move_events)
{ {
return; return;
@ -1509,6 +1554,17 @@ void SignalCurve::mouseMoveEvent(QMouseEvent *move_event)
{ {
trig_level_arrow_pos = h; trig_level_arrow_pos = h;
} }
devparms->triggeredgelevel[devparms->triggeredgesource] = (((h / 2) - trig_level_arrow_pos) * ((devparms->chanscale[devparms->triggeredgesource] * 8) / h))
- devparms->chanoffset[devparms->triggeredgesource];
dtmp = devparms->triggeredgelevel[devparms->triggeredgesource] / (devparms->chanscale[devparms->triggeredgesource] / 50);
devparms->triggeredgelevel[devparms->triggeredgesource] = (devparms->chanscale[devparms->triggeredgesource] / 50) * dtmp;
label_active = LABEL_ACTIVE_TRIG;
mainwindow->label_timer->start(LABEL_TIMER_IVAL);
} }
else else
{ {
@ -1533,6 +1589,16 @@ void SignalCurve::mouseMoveEvent(QMouseEvent *move_event)
chan_arrow_pos[chn] = h; chan_arrow_pos[chn] = h;
} }
devparms->chanoffset[chn] = ((h / 2) - chan_arrow_pos[chn]) * ((devparms->chanscale[chn] * 8) / h);
dtmp = devparms->chanoffset[chn] / (devparms->chanscale[chn] / 50);
devparms->chanoffset[chn] = (devparms->chanscale[chn] / 50) * dtmp;
label_active = chn + 1;
mainwindow->label_timer->start(LABEL_TIMER_IVAL);
break; break;
} }
} }
@ -1576,7 +1642,7 @@ void SignalCurve::trig_stat_timer_handler()
} }
void SignalCurve::paintLabel(QPainter *painter, int xpos, int ypos, int xw, int yh, const char *str) void SignalCurve::paintLabel(QPainter *painter, int xpos, int ypos, int xw, int yh, const char *str, QColor color)
{ {
QPainterPath path; QPainterPath path;
@ -1584,7 +1650,7 @@ void SignalCurve::paintLabel(QPainter *painter, int xpos, int ypos, int xw, int
painter->fillPath(path, Qt::black); painter->fillPath(path, Qt::black);
painter->setPen(Qt::white); painter->setPen(color);
painter->drawRoundedRect(xpos, ypos, xw, yh, 3, 3); painter->drawRoundedRect(xpos, ypos, xw, yh, 3, 3);

Wyświetl plik

@ -68,6 +68,8 @@ public:
QSize sizeHint() const {return minimumSizeHint(); } QSize sizeHint() const {return minimumSizeHint(); }
QSize minimumSizeHint() const {return QSize(30,10); } QSize minimumSizeHint() const {return QSize(30,10); }
int label_active;
void setSignalColor1(QColor); void setSignalColor1(QColor);
void setSignalColor2(QColor); void setSignalColor2(QColor);
void setSignalColor3(QColor); void setSignalColor3(QColor);
@ -141,7 +143,7 @@ private:
void drawTrigCenterArrow(QPainter *, int, int); void drawTrigCenterArrow(QPainter *, int, int);
void drawChanLabel(QPainter *, int, int, int); void drawChanLabel(QPainter *, int, int, int);
void drawTopLabels(QPainter *); void drawTopLabels(QPainter *);
void paintLabel(QPainter *, int, int, int, int, const char *); void paintLabel(QPainter *, int, int, int, int, const char *, QColor);
void paintCounterLabel(QPainter *, int, int); void paintCounterLabel(QPainter *, int, int);
struct device_settings *devparms; struct device_settings *devparms;

Wyświetl plik

@ -36,6 +36,12 @@ void UI_Mainwindow::test_timer_handler()
} }
void UI_Mainwindow::label_timer_handler()
{
waveForm->label_active = LABEL_ACTIVE_NONE;
}
void UI_Mainwindow::navDial_timer_handler() void UI_Mainwindow::navDial_timer_handler()
{ {
if(navDial->isSliderDown() == true) if(navDial->isSliderDown() == true)