/* ** Common implementation for the ticket setup editor pages. */ static void tktsetup_generic( const char *zTitle, /* Page title */ const char *zDbField, /* Configuration field being edited */ const char *zDfltValue, /* Default text value */ const char *zDesc, /* Description of this field */ char *(*xText)(const char*), /* Validity test or NULL */ void (*xRebuild)(void), /* Run after successful update */ int height /* Height of the edit box */ ){ const char *z; int isSubmit; login_check_credentials(); if( !g.perm.Setup ){ login_needed(0); return; } if( PB("setup") ){ cgi_redirect("tktsetup"); } isSubmit = P("submit")!=0; z = P("x"); if( z==0 ){ z = db_get(zDbField, (char*)zDfltValue); } style_header("Edit %s", zTitle); if( P("clear")!=0 ){ login_verify_csrf_secret(); db_unset(zDbField, 0); if( xRebuild ) xRebuild(); cgi_redirect("tktsetup"); }else if( isSubmit ){ char *zErr = 0; login_verify_csrf_secret(); if( xText && (zErr = xText(z))!=0 ){ cgi_printf("<p class=\"tktsetupError\">ERROR: %h</p>\n",(zErr)); }else{ db_set(zDbField, z, 0); if( xRebuild ) xRebuild(); cgi_redirect("tktsetup"); } } cgi_printf("<form action=\"%s/%s\" method=\"post\"><div>\n",(g.zTop),(g.zPath)); login_insert_csrf_secret(); cgi_printf("<p>%s</p>\n" "<textarea name=\"x\" rows=\"%d\" cols=\"80\">%h</textarea>\n" "<blockquote><p>\n" "<input type=\"submit\" name=\"submit\" value=\"Apply Changes\" />\n" "<input type=\"submit\" name=\"clear\" value=\"Revert To Default\" />\n" "<input type=\"submit\" name=\"setup\" value=\"Cancel\" />\n" "</p></blockquote>\n" "</div></form>\n" "<hr />\n" "<h2>Default %s</h2>\n" "<blockquote><pre>\n" "%h\n" "</pre></blockquote>\n",(zDesc),(height),(z),(zTitle),(zDfltValue)); style_footer(); }
EEGPlot::EEGPlot(int channelId, QWidget *parent, const QObject* sender, const char* dataSignal, unsigned int numChannels) : QwtPlot(parent) , m_channelId(channelId) , m_firstPacket(true) , m_numChannels(numChannels) { setAutoReplot(false); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); CENT::connect(sender, dataSignal, this, SLOT(dataReceived(CentData::AnalogData))); m_curve = new QwtPlotCurve("signal channel"); m_curve->setStyle(QwtPlotCurve::Lines); m_curve->setPen(QPen(Qt::darkBlue)); m_curve->setRenderHint(QwtPlotItem::RenderAntialiased, false); m_curve->setPaintAttribute(QwtPlotCurve::ClipPolygons, true); m_arraySeriesData = new ArraySeriesData(); m_curve->setData(m_arraySeriesData); m_curve->attach(this); // Canvas setCanvasBackground(QBrush(Qt::white)); // Axes enableAxis(QwtPlot::yLeft, true); setAxisTitle(QwtPlot::yLeft, Y_AXIS_TEXT); setAxisAutoScale(QwtPlot::yLeft, true); setAxisScaleDraw(QwtPlot::yLeft, new IntegerScaleDraw); setAxisAutoScale(QwtPlot::xBottom, false); QwtText xText(tr(X_AXIS_TEXT_LOC)); setAxisTitle(QwtPlot::xBottom, xText); CENT::connect(&m_redrawTimer, SIGNAL(timeout()), this, SLOT(replotManual())); m_redrawTimer.setInterval(200); m_redrawTimer.start(); }