void VCSlider::setSliderMode(SliderMode mode) { Q_ASSERT(mode >= Bus && mode <= Submaster); /* Disconnect these to prevent double callbacks and non-needes signals */ disconnect(Bus::instance(), SIGNAL(nameChanged(quint32, const QString&)), this, SLOT(slotBusNameChanged(quint32, const QString&))); disconnect(Bus::instance(), SIGNAL(valueChanged(quint32, quint32)), this, SLOT(slotBusValueChanged(quint32, quint32))); /* Unregister this as a DMX source if the new mode is not "Level" */ if (m_sliderMode == Level && mode != Level) _app->masterTimer()->unregisterDMXSource(this); m_sliderMode = mode; if (mode == Bus) { /* Set the slider range */ m_slider->setRange(busLowLimit() * MasterTimer::frequency(), busHighLimit() * MasterTimer::frequency()); setSliderValue(Bus::instance()->value(bus())); slotSliderMoved(sliderValue()); /* Reconnect to bus emitter */ connect(Bus::instance(), SIGNAL(nameChanged(quint32, const QString&)), this, SLOT(slotBusNameChanged(quint32, const QString&))); connect(Bus::instance(), SIGNAL(valueChanged(quint32, quint32)), this, SLOT(slotBusValueChanged(quint32, quint32))); m_bottomLabel->hide(); m_tapButton->show(); m_time->start(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); // start tcp socket QThread* thread = new QThread;// writetodatabase *database; database = new writetodatabase(); database->moveToThread(thread); connect(thread, SIGNAL(started()), database, SLOT(startDb())); connect(database, SIGNAL(finished()), thread, SLOT(quit())); connect(database, SIGNAL(finished()), database, SLOT(deleteLater())); connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); connect(this,SIGNAL(sendSetPoint(const QString)),database, SLOT(sendSetPoint(const QString))); thread->start(); connect(ui->sendht, SIGNAL(clicked()), this, SLOT(sliderValue())); // setgraphs( ui->qtplot,"Time","Flowrate",14); setgraphs( ui->qtplot_2,"Time","Voltage(PWM)",100); setgraphs( ui->qtplot_3,"Time","IR Reading",400); // setup a timer that repeatedly calls MainWindow::realtimeDataSlot: connect(&dataTimer, SIGNAL(timeout()), this, SLOT(realtimeDataSlot())); dataTimer.start(500); }
void VCSlider::slotMonitorDMXValueChanged(int value) { if (value != sliderValue()) { if (invertedAppearance()) m_monitorValue = 255 - value; else m_monitorValue = value; m_levelValueMutex.lock(); m_levelValue = m_monitorValue; m_levelValueMutex.unlock(); if (m_slider) m_slider->blockSignals(true); setSliderValue(m_monitorValue, true); setTopLabelText(sliderValue()); if (m_slider) m_slider->blockSignals(false); updateFeedback(); } }