void cwVideoPlayer::readWebcamFeed()
{
	qDebug() << "--> readWebcamFeed - m_deviceId: " << m_deviceId;
	// Reads the webcam feed
	if (!VideoDeviceManager::getInstance()->getVideoDeviceList().isEmpty() && VideoDeviceManager::getInstance()->getVideoDeviceList().at(m_deviceId) != NULL)
	{
		if (p_videoDevice != NULL)
		{
			p_videoDevice->detachView();
			disconnect(p_videoDevice, SIGNAL(imageReaded()), this, SLOT(updateGUI()));
		}

		p_videoDevice = VideoDeviceManager::getInstance()->getDevice(m_deviceId);
		qDebug() << "--> readWebcamFeed - connect(): " << p_videoDevice->getId();
		
		p_videoDevice->readImage();
		m_image = p_videoDevice->getImage();
		p_pixmap = new QPixmap(Tools::cvMatToQPixmap(m_image));
		m_pixmapRes = QPixmap(p_pixmap->copy(bounds[0], bounds[1], bounds[2], bounds[3]));

		p_videoDevice->attachView();
		connect(p_videoDevice, SIGNAL(imageReaded()), this, SLOT(updateGUI()));

		if (p_pixmap)
		{
			delete p_pixmap;
			p_pixmap = NULL;
		}
		
		m_image.release();
	}
}
Exemple #2
0
void NormDock::initUi()
{

	normModeBox->addItem("Observed");
	normModeBox->addItem("Theoretical");
	normModeBox->addItem("Fixed");

	// FIXME: could not find implementation for clamping in ImageModel.
	// -> no Clamp button for now.
	normClampButton->hide();

	connect(normIButton, SIGNAL(toggled(bool)),
			this, SLOT(updateGUI()));
	connect(normGButton, SIGNAL(toggled(bool)),
			this, SLOT(updateGUI()));
	connect(normModeBox, SIGNAL(currentIndexChanged(int)),
			this, SLOT(processNormModeSelected(int)));
	connect(normMinBox, SIGNAL(editingFinished()),
			this, SLOT(processMinValueChanged()));
	connect(normMaxBox, SIGNAL(editingFinished()),
			this, SLOT(processMaxValueChanged()));
	connect(normApplyButton, SIGNAL(clicked()),
			this, SLOT(processApplyClicked()));

	// update values in GUI elements
	updateGUI();
}
Exemple #3
0
    void FieldLineEdit::slotTextChanged( )
    {
        QString text;
        switch ( m_inputType )
        {
        case itSingleLine:
            text = m_lineEdit->text();
            break;
        case itMultiLine:
            text = m_textEdit->text();
            break;
        }

        if ( m_value->items.count() <= 1 )
        {
            m_value->items.clear();
            if ( !text.isEmpty() )
            {
                if ( m_pushButtonString->isOn() )
                    m_value->items.append( new BibTeX::MacroKey( text ) );
                else
                    m_value->items.append( new BibTeX::PlainText( text ) );
            }
            m_isModified = TRUE;
        }

        updateGUI();
    }
Exemple #4
0
/*!
 * \brief Updates module based on the new status.
 * \param[in] newStatus - new status received from module
 */
void GUI::statusChanged(int newStatus)
{
    status = newStatus;
    updateGUI();
    updateProgressBar(progress);
	updateProgressBarClients();
}
Exemple #5
0
void ScopeGUI::setScaleY(Scales scale, const double markSpacing, const int labelHop, const int decimalPlaces) throw()
{
	lock();
	switch(scale)
	{
		case LabelYNone:
		case LabelYMarks:
		case LabelYAmplitude:
		case LabelYPercent:
		case LabelYDecibels:
			scaleY = scale;
			break;
		default:
			;
	}
	
	if(markSpacing > 0.0)
		markSpacingY = markSpacing;
	
	if(labelHop > 0)
		labelHopY = labelHop;
	
	if(decimalPlaces >= 0)
		decimalPlacesY = decimalPlaces;
	
	unlock();
	updateGUI();
}
cwVideoPlayer::cwVideoPlayer(QWidget * pParent, Qt::WindowFlags flags): QWidget(pParent, flags)
{
	qDebug() << "=== cw Video Player ===";
	m_ui.setupUi(this);

	p_videoDevice = NULL;
	
	// Init
	readFullPixmap	= false;
	isPause			= true;
	m_deviceId		= 0;
	m_image			= Mat(1080, 1920, CV_8UC3);

	bounds[0] = 0;
	bounds[1] = 0;
	bounds[2] = m_ui.view->getScene()->getWidth();
	bounds[3] = m_ui.view->getScene()->getHeight();

	readWebcamFeed();
		
	qDebug() << "== end video player constructor ==";

	// === Connect ===
	connect(m_ui.pbPlayPause,	SIGNAL(clicked()),	SLOT(playPause()) );
	connect(m_ui.pbFit,			SIGNAL(clicked()),	SLOT(fitView())   );

	m_ui.pbPlayPause->setVisible(false);

	connect(&m_fitDelayTimer, SIGNAL(timeout()), this, SLOT(fitView())); 
	m_fitDelayTimer.setInterval(200);
	m_fitDelayTimer.stop();

	updateGUI();
	playPause();
}
Exemple #7
0
//! SLOTS
//!
//!
void ImageView::openDir()
{
  folderName = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "./", QFileDialog::ShowDirsOnly);

  if (folderName == "") {
      return;
    }

  QDir imageDir(folderName);
  QStringList imageFilters;
  imageFilters << "*.bmp" << "*.png" << "*.jpg" << "*.jpeg" << "*.gif";

  imageDir.setNameFilters(imageFilters);
  imageDir.setFilter(QDir::Files);
  imageDir.setSorting(QDir::Name);

  fileList.clear();
  fileList = imageDir.entryInfoList();

  imageNumber = 0;
  totalImages = fileList.size();

  updateGUI();
  if(!ui->actionSave->isEnabled())
    ui->actionSave->setEnabled(true);
}
void CharCreator::on_action_Open_triggered()
{
    // If user has edited character info
    if (ui->nameValue->text() != "" || ui->levelValue->text().toInt() > 1 || rollClicked == true) {
        // Display warning about unsaved info
        QMessageBox::StandardButton warn = QMessageBox::warning(this, "Save Character?", "Do you want to save the changes you have made to the current character?", QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes);
        if (warn == QMessageBox::Yes) {
            if (!on_action_Save_triggered()) {
                return;
            }
            setupDefaults();
        }
        else if (warn == QMessageBox::Cancel) {
            return;
        }
        else if (warn == QMessageBox::No) {
            setupDefaults();
        }
    }
    else {
        setupDefaults();
    }
    QString charName = QFileDialog::getOpenFileName(this, tr("Open Character"), "C:/Users/chris/Documents/Visual Studio 2012/Projects/DnD_Game/characters", tr("CHARACTER Files (*.dcchar)"));
    std::string fileName = charName.toStdString();
    c->loadCharacter(fileName);
    updateGUI();
    ui->levelButton->setEnabled(true);
}
void WatchVector::attachFpData(PixelBox *f, QString name)
{
    int idx;

    if (!f) {
        return;
    }

    if (!getNumFreeMappings()) {
        return;
    }

    if (getIndexFromPixelBox(f) != -1) {
        return;
    }
    
    /* Fill empty slot with attachment */
    idx = getFirstFreeMapping();
    m_pData[idx] = f;
    m_qName[idx] = name;
    m_nActiveMappings++;

    connect(f, SIGNAL(dataChanged()), this, SLOT(updateData()));
    connect(f, SIGNAL(dataDeleted()), this, SLOT(detachData()));
    connect(this->m_pImageView, SIGNAL(minMaxAreaChanged(const QRect&)), 
        f, SLOT(setMinMaxArea(const QRect&)));
    connect(this->m_pImageView, SIGNAL(setMappingBounds()), this,
        SLOT(updateAllMinMax()));        
    connect(f, SIGNAL(minMaxAreaChanged()), this, SLOT(onMinMaxAreaChanged()));


    addMappingOptions(idx);
    updateGUI();
}
void CDlgPasswordEntropy::OnBnClickedGeneratepassword()
{
	// before generating the password, we need both the password bit length and the alphabet
	if(stringPasswordBitLength.IsEmpty() || stringPasswordAlphabet.IsEmpty()) {
		LoadString(AfxGetInstanceHandle(), IDS_PQM_ENTROPY_NOT_ALL_INPUT_PARAMETERS_SET, pc_str, STR_LAENGE_STRING_TABLE);
		MessageBox(pc_str, "CrypTool", MB_ICONINFORMATION);
		return;
	}

	// get the desired password length
	int passwordCharactersNeeded = atoi((const char*)(stringPasswordLength));

	// generate a "random" password and make it visible
	stringPasswordExample = "";
	for(int i=0; i<(int)(passwordCharactersNeeded); i++) {
		int index = rand() % stringPasswordAlphabet.GetLength();
		stringPasswordExample +=  stringPasswordAlphabet[index];
	}

	// set the focus to bit length input field
	GetDlgItem(IDC_EDIT_PASSWORDBITLENGTH)->SetFocus();

	// update the GUI
	updateGUI();

	UpdateData(false);
}
void CDlgPasswordEntropy::EditPasswordAlphabetChanged()
{
	// flomar, 04/25/2012: get the current selection
	int selectionStart;
	int selectionEnd;
	editControlPasswordAlphabet.GetSel(selectionStart, selectionEnd);

	UpdateData(true);

	// make sure there are no double entries
	CString validAlphabet;
	for(int i=0; i<stringPasswordAlphabet.GetLength(); i++) {
		if(stringPasswordAlphabet.Find(stringPasswordAlphabet[i], i+1) == -1) {
			validAlphabet += stringPasswordAlphabet[i];
		}
	}
	stringPasswordAlphabet = validAlphabet;

	// clear result field
	stringPasswordExample = "";

	// update the GUI
	updateGUI();

	UpdateData(false);

	// update the required password length
	updatePasswordLength();

	// flomar, 04/25/2012: set cursor to the correct position
	// (not just to the end, as it was done in previous versions)
	editControlPasswordAlphabet.SetSel(selectionStart, selectionEnd);
}
void CDlgPasswordEntropy::updatePasswordLength()
{
	UpdateData(true);

	// figure out how many bits of entropy we get with ONE CHARACTER, given the assumption 
	// that each password character is independently and randomly chosen from the alphabet
	double bitsPerCharacter = log2((double)(stringPasswordAlphabet.GetLength()));

	// now compute how many characters we need to get the desired entropy
	double passwordLengthInBitsDesired = (double)(atoi(stringPasswordBitLength.GetBuffer()));
	double passwordCharactersNeeded = ceil(passwordLengthInBitsDesired/bitsPerCharacter);

	// make the number of characters needed for the password visible to the user
	char buffer[16];
	memset(buffer, 0, 16);
	sprintf(buffer, "%d", (int)(passwordCharactersNeeded));
	stringPasswordLength = buffer;

	// make sure a password of zero length is impossible
	if(stringPasswordLength == "0") {
		stringPasswordLength = "";
		stringPasswordExample = "";
	}

	// update the GUI
	updateGUI();

	UpdateData(false);
}
Exemple #13
0
void MainWindow::on_actionContainerClear_triggered()
{
    QAxWidget *container = activeAxWidget();
    if (container)
	container->clear();
    updateGUI();
}
void CDlgPasswordEntropy::OnBnClickedTextoptions()
{
	// allow the user to change the CrypTool alphabet
	CString oldAlphabet = theApp.TextOptions.getAlphabet();
	theApp.TextOptions.DoModal();

	// don't do anything if check box for CrypTool alphabet is not checked
	if(!useCrypToolAlphabet) return;
	// else: assign the new alphabet
	else stringPasswordAlphabet = theApp.TextOptions.getAlphabet();
	
	// clear result fields if the alphabet has changed
	if(oldAlphabet != theApp.TextOptions.getAlphabet()) {
        stringPasswordLength = "";
		stringPasswordExample = "";
	}

	// update the GUI
	updateGUI();

	UpdateData(false);

	// update the required password length
	updatePasswordLength();

	// set the focus to bit length input field
	GetDlgItem(IDC_EDIT_PASSWORDBITLENGTH)->SetFocus();
}
GameController::GameController(ClientStates *states, QWidget *parent) : mStates(states), mParent(parent) {

	mDrawer = new GameDrawer(states, parent);
	mDrawer->setMouseTracking(true);
	mIconHolder  = new QVBoxLayout(parent);
	mLower = new QHBoxLayout();
	mUpper = new QHBoxLayout();
	mIconHolder->insertLayout(0, mLower);
	mIconHolder->insertSpacing(1, -1);
	mIconHolder->insertLayout(0, mUpper);

	mSlider = new GameSlider(states->getSim(), states, parent);

	mLabel1 = new GameButton(states->getSim(), states, 0, mSlider, parent);
	mLabel2 = new GameButton(states->getSim(), states, 0, mSlider, parent);


	mLabel1->setPixmap(QPixmap("../testmod/graphics/temp/temp.png"));
	mLabel1->resize(60,60);
	mLabel2->setPixmap(QPixmap("../testmod/graphics/temp/temp2.png"));
	mLabel2->resize(60,60);
	mProfiles[0] = QPixmap("../testmod/graphics/profiles/test.png");
	mSpace = new QSpacerItem(parent->width(), 0, QSizePolicy::Expanding);
	mLower->insertWidget(0, mLabel1);
	mLower->insertWidget(1, mLabel2);
	mLower->insertSpacerItem(2, mSpace);
	mLower->setAlignment(Qt::AlignBottom);
	mUpper->setAlignment(Qt::AlignTop);
	updateGUI();
}
Exemple #16
0
void ImageButton::clear()
{
    mPicture = KABC::Picture();
    updateGUI();

    emit changed();
}
Exemple #17
0
void
KnobGui::onRemoveAnimationActionTriggered()
{
    QAction* action = qobject_cast<QAction*>( sender() );

    assert(action);
    int dim = action->data().toInt();
    KnobPtr knob = getKnob();
    std::map<boost::shared_ptr<CurveGui>, std::vector<KeyFrame > > toRemove;
    KnobGuiPtr thisShared = shared_from_this();
    for (int i = 0; i < knob->getDimension(); ++i) {
        if ( (dim == -1) || (dim == i) ) {
            std::list<boost::shared_ptr<CurveGui> > curves = getGui()->getCurveEditor()->findCurve(thisShared, i);
            for (std::list<boost::shared_ptr<CurveGui> >::iterator it = curves.begin(); it != curves.end(); ++it) {
                KeyFrameSet keys = (*it)->getInternalCurve()->getKeyFrames_mt_safe();
                std::vector<KeyFrame > vect;
                for (KeyFrameSet::const_iterator it2 = keys.begin(); it2 != keys.end(); ++it2) {
                    vect.push_back(*it2);
                }
                toRemove.insert( std::make_pair(*it, vect) );
            }
        }
    }
    pushUndoCommand( new RemoveKeysCommand(getGui()->getCurveEditor()->getCurveWidget(),
                                           toRemove) );
    //refresh the gui so it doesn't indicate the parameter is animated anymore
    updateGUI(dim);
}
Exemple #18
0
void MixerGUI::changeOutputDevice(){
  QString dev = ui->combo_outdevice->currentData().toString();
  if(dev.isEmpty()){ return; }
  QProcess::execute("pc-sysconfig \"setdefaultaudiodevice "+dev+"\"");
  updateGUI();
  emit outChanged();
}
Exemple #19
0
void ScopeGUI::setScaleX(Scales scale, const double markSpacing, const int labelHop, const bool labelFirst) throw()
{	
	lock();
	switch(scale)
	{
		case LabelXNone:
		case LabelXMarks:
		case LabelXSamples:
		case LabelXTime:
		case LabelXFrequency:
			scaleX = scale;
			break;
		default:
			;
	}
	
	if(markSpacing > 0.0)
		markSpacingX = markSpacing;
	
	if(labelHop > 0)
		labelHopX = labelHop;
	
	labelFirstX = labelFirst;
	
	unlock();
	updateGUI();
}
void Memory::set(const int address, const int &value)
{
    if(address > 999 || address < 0){
        throw "Set address " + address;
    }
    cells.at(address)->setCell(value);
    updateGUI();
}
Exemple #21
0
void ScopeGUI::setPolarity(const bool isBipolar) throw()
{
	lock();
	this->isBipolar = isBipolar;
	unlock();
	
	updateGUI();
}
Exemple #22
0
void NormDock::processMaxValueChanged()
{
	//GGDBG_CALL();
	const double val = normMaxBox->value();
	ranges[normTarget].max = val;
	ranges[normTarget].min = min(val, ranges[normTarget].min);
	updateGUI();
}
void GameController::showAll() {
	mLabel1->show();
	mLabel2->show();
	mDrawer->show();
	mDrawer->startTimers();
	mSlider->show();
	updateGUI();
}
CpuWidget::CpuWidget(CPU *cpu, QWidget *parent) :
  QWidget(parent),
  ui(new Ui::CpuWidget)
{
  ui->setupUi(this);
  impl = cpu;
  updateGUI();
}
Exemple #25
0
void ImageView::setEnd()
{
  if (totalImages == 0) {
      return;
    }
  imageNumber = totalImages-1;
  updateGUI();
}
Exemple #26
0
void ResourceWindow::draw()
{	
	if (_dirty)
	{
		updateGUI();
	}
	Fl_Group::draw();
}
void MainWindow::on_registers_table_cellChanged(int row, int column)
{
    if(column ==0 || updating_gui)
        return;

    static_cast<InfoWidgetItem*>(ui->registers_table->item(row, column))->onEdit();
    updateGUI();
}
Exemple #28
0
void ImageView::setBegin()
{
  if (totalImages == 0) {
      return;
    }
  imageNumber = 0;
  updateGUI();
}
Exemple #29
0
void NormDock::setNormMode(representation::t type,multi_img::NormMode mode)
{
	if(!(representation::IMG == type || representation::GRAD == type ))
		return;
	modes[type] = mode;
	// update GUI with new values
	updateGUI();
}
Exemple #30
0
void ScopeGUI::setYMaximum(const float maximum) throw()
{
	lock();
	yMaximum = maximum;
	unlock();
	
	updateGUI();
}