/* Keep? */ VisionDialog::VisionDialog(QWidget *parent) : QDialog(parent) , ui(new Ui::VisionDialog) , m_configModel(new VisionConfigModel(this)) , m_channelModel(new VisionChannelModel(this)) , m_device(new Camera::Device(new Camera::UsbInputProvider)) { ui->setupUi(this); ui->configsList->setModel(m_configModel); ui->configsList->setRootIndex(m_configModel->index(m_configModel->rootPath())); ui->configsList->setItemDelegate(new ConfigItemDelegate(this)); ui->channelsList->setModel(m_channelModel); ui->channelsList->setItemDelegate(new ChannelItemDelegate(m_channelModel, this)); connect(&m_cameraTimer, SIGNAL(timeout()), SLOT(updateCamera())); m_cameraTimer.start(100); /* Need this? */ Config startConfig; startConfig.beginGroup(CAMERA_GROUP); startConfig.setValue(CAMERA_NUM_CHANNELS_KEY, 1); startConfig.beginGroup((QString(CAMERA_CHANNEL_GROUP_PREFIX) + "0").toStdString()); startConfig.setValue(CAMERA_CHANNEL_TYPE_KEY, CAMERA_CHANNEL_TYPE_HSV_KEY); startConfig.clearGroup(); m_device->setConfig(startConfig); connect(ui->_th, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString))); connect(ui->_ts, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString))); connect(ui->_tv, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString))); connect(ui->_bh, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString))); connect(ui->_bs, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString))); connect(ui->_bv, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString))); connect(ui->visual, SIGNAL(minChanged(QColor)), SLOT(visualChanged())); connect(ui->visual, SIGNAL(maxChanged(QColor)), SLOT(visualChanged())); connect(ui->cv, SIGNAL(pressed(int, int)), SLOT(imagePressed(int, int))); connect(ui->channelsList->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), SLOT(currentChannelChanged(const QModelIndex &, const QModelIndex &))); connect(ui->configsList->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), SLOT(currentConfigChanged(const QModelIndex &, const QModelIndex &))); m_defaultConfigPath = m_configModel->filePath(m_configModel->defaultConfiguration()); }
HsvChannelConfigWidget::HsvChannelConfigWidget(const QModelIndex &index, QWidget *parent) : ChannelConfigWidget(index, parent), ui(new Ui::HsvChannelConfigWidget), m_numpad(new NumpadDialog("Enter Value")) { ui->setupUi(this); Config deviceConfig; deviceConfig.beginGroup(CAMERA_GROUP); deviceConfig.setValue(CAMERA_NUM_CHANNELS_KEY, 1); deviceConfig.beginGroup((QString(CAMERA_CHANNEL_GROUP_PREFIX) + "0").toStdString()); deviceConfig.setValue(CAMERA_CHANNEL_TYPE_KEY, CAMERA_CHANNEL_TYPE_HSV_KEY); deviceConfig.clearGroup(); ui->camera->setConfig(&deviceConfig); visual(); connect(ui->manualButton, SIGNAL(clicked()), SLOT(manual())); connect(ui->visualButton, SIGNAL(clicked()), SLOT(visual())); connect(ui->th, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString))); connect(ui->ts, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString))); connect(ui->tv, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString))); connect(ui->bh, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString))); connect(ui->bs, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString))); connect(ui->bv, SIGNAL(textChanged(QString)), SLOT(manualEntry(QString))); connect(ui->visual, SIGNAL(minChanged(QColor)), SLOT(visualChanged())); connect(ui->visual, SIGNAL(maxChanged(QColor)), SLOT(visualChanged())); connect(ui->camera, SIGNAL(pressed(cv::Mat, int, int)), SLOT(imagePressed(cv::Mat, int, int))); connect(ui->done, SIGNAL(clicked()), SLOT(done())); ui->th->setInputProvider(m_numpad); ui->ts->setInputProvider(m_numpad); ui->tv->setInputProvider(m_numpad); ui->bh->setInputProvider(m_numpad); ui->bs->setInputProvider(m_numpad); ui->bv->setInputProvider(m_numpad); ui->camera->setTrackBlobs(true); }