Pulse_Widget::Pulse_Widget(QWidget* parent, Qt::WindowFlags f) : QWidget(parent, f), label_t("t = "), ssScanning("background-color: rgb(150, 170, 255); border-color: rgb(150, 170, 255);"), ssNonScanning(""), action_disable("Disable", this), action_t_scan("scan", this), action_t_cal("cal", this), pX(0), bEnabled(true), bValChangeSig(true) { setAutoFillBackground(true); palDisabled.setColor(QPalette::Window, QColor(255, 170, 155)); palEnabled = palette(); palScanning.setColor(QPalette::Base, QColor(150, 170, 255)); palNonScanning = dsb_t.palette(); label_t.setAlignment(Qt::AlignRight | Qt::AlignVCenter); layout.setContentsMargins(0, 0, 0, 0); layout.addWidget(&label_t); layout.addWidget(&dsb_t); addAction(&action_disable); setContextMenuPolicy(Qt::ActionsContextMenu); dsb_t.setSuffix(" us"); dsb_t.setRange(0.0, 1000000); dsb_t.setDecimals(3); dsb_t.setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue); dsb_t.addAction(&action_t_scan); dsb_t.addAction(&action_t_cal); dsb_t.setContextMenuPolicy(Qt::ActionsContextMenu); dsb_t.setKeyboardTracking(false); ssNonScanning = dsb_t.styleSheet(); QObject::connect(&dsb_t, SIGNAL(valueChanged(double)), this, SLOT(slot_valueChanged()), Qt::AutoConnection); QObject::connect(&action_t_scan, SIGNAL(triggered(bool)), this, SLOT(slot_setup_t_scan()), Qt::AutoConnection); QObject::connect(&action_t_cal, SIGNAL(triggered(bool)), this, SLOT(slot_setup_t_cal()), Qt::AutoConnection); QObject::connect(&action_disable, SIGNAL(triggered(bool)), this, SLOT(slot_disable()), Qt::AutoConnection); QObject::connect(this, SIGNAL(sig_update_ss(QWidget *, QString)), this, SLOT(slot_update_ss(QWidget *, QString)), Qt::AutoConnection); setLayout(&layout); show(); }
LOCAL void slot_destroy(int slot) { struct ndas_slot* sd = NDAS_GET_SLOT_DEV(slot); if (sd == NULL) { printk("ndas: slot object for %d doesn't exist: bug caused in race condition\n", slot); return; } nproc_remove_slot(sd); while ( sd->enabled ) { up(&sd->mutex); slot_disable(slot); down(&sd->mutex); } sal_free(sd); NDAS_SET_SLOT_DEV(slot, NULL); }
/* * Disconnected handler. * This function will be called when the driver is disconnected. */ NDAS_CALL LOCAL void ndcmd_disabled_handler(int s, ndas_error_t err, void* arg) { slot_disable((int)s); }