void TestKeePass2Format::initTestCase()
{
    QVERIFY(Crypto::init());

    // read raw XML database
    bool hasError;
    QString errorString;
    m_xmlDb = readXml(QString(KEEPASSX_TEST_DATA_DIR).append("/NewDatabase.xml"), true, hasError, errorString);
    if (hasError) {
        QFAIL(qPrintable(QString("Error while reading XML: ").append(errorString)));
    }
    QVERIFY(m_xmlDb.data());

    // construct and write KDBX to buffer
    auto key = QSharedPointer<CompositeKey>::create();
    key->addKey(QSharedPointer<PasswordKey>::create("test"));

    m_kdbxSourceDb = QSharedPointer<Database>::create();
    m_kdbxSourceDb->setKey(key);
    m_kdbxSourceDb->metadata()->setName("TESTDB");
    Group* group = m_kdbxSourceDb->rootGroup();
    group->setUuid(QUuid::createUuid());
    group->setNotes("I'm a note!");
    auto entry = new Entry();
    entry->setPassword(QString::fromUtf8("\xc3\xa4\xa3\xb6\xc3\xbc\xe9\x9b\xbb\xe7\xb4\x85"));
    entry->setUuid(QUuid::createUuid());
    entry->attributes()->set("test", "protectedTest", true);
    QVERIFY(entry->attributes()->isProtected("test"));
    entry->attachments()->set("myattach.txt", QByteArray("this is an attachment"));
    entry->attachments()->set("aaa.txt", QByteArray("also an attachment"));
    entry->setGroup(group);
    auto groupNew = new Group();
    groupNew->setUuid(QUuid::createUuid());
    groupNew->setName("TESTGROUP");
    groupNew->setNotes("I'm a sub group note!");
    groupNew->setParent(group);

    m_kdbxTargetBuffer.open(QBuffer::ReadWrite);
    writeKdbx(&m_kdbxTargetBuffer, m_kdbxSourceDb.data(), hasError, errorString);
    if (hasError) {
        QFAIL(qPrintable(QString("Error while writing database: ").append(errorString)));
    }

    // call sub class init method
    initTestCaseImpl();
}
Exemple #2
0
KPropColor::KPropColor( QWidget *parent, const char *buttontext, int perc, QColor mydefault, const char *key, const char *group, KConfig *config, const char *name )
	: QFrame( parent,name )
{
	setKConfig( config );
	setGroup( group );
	setKey( key );
	setFrameStyle( QFrame::NoFrame );
	setFontPropagation( NoChildren );
	defaultColor = mydefault;

	button = new QPushButton( buttontext, this );
	connect( button, SIGNAL( clicked() ), 
			this, SLOT( getColorDialog() ) );
	percentage = perc;

	sizeUpdate();
}
Exemple #3
0
Status::Status( Command * c, Mailbox * m )
    : Command( c->imap() ), d( new StatusData )
{
    setGroup( 4 );
    d->mailbox = m;
    d->uidnext = true;

    IMAP * i = c->imap();
    if ( !i )
        return;

    if ( i->clientSupports( IMAP::Condstore ) )
        d->modseq = true;
    requireRight( d->mailbox, Permissions::Read );

    i->commands()->insert( i->commands()->find( c ), this );
    setState( Executing );
}
Exemple #4
0
FindContours::FindContours()
{
    setName("FindContours");
    setDesc(QObject::tr("Extracts contours from an image"));
    setGroup("image/contour");

    mIn.setName("imageIn");
    mIn.setDesc(QObject::tr("Image input"));
    addInputPort(mIn);

    mOffsetIn.setName("offset");
    mOffsetIn.setDesc(QObject::tr("Offset that will be added to all calculated positions"));
    mOffsetIn.setDefault(QPointF(0.0, 0.0));
    addInputPort(mOffsetIn);

    mContourOut.setName("contour");
    addOutputListPort(mContourOut);
}
Exemple #5
0
ToggleButton::ToggleButton(Image *up_file , Image *down_file, Image *hover_file, const std::string& caption, const std::string& group):
    Button(),
    m_upImage(up_file),
    m_downImage(down_file),
    m_hoverImage(hover_file),
    x_downoffset(0),
    y_downoffset(0),
    m_group(group) {

    m_hoverImage = hover_file;
    setFrameSize(0);
    setGroup(m_group);
    adjustSize();
    mCaption = caption;
    m_toggled = false;

    addActionListener(this);
}
Exemple #6
0
PoseInput::PoseInput()
{
    setName(tr("Pose"));
    setDesc(QObject::tr("Pose input filter for the automation"));
    setGroup("automation/input");

    mIn.setName("input pose");
    mIn.setMode(SingleShotPortMode);

    mOut.setName("output pose");

    mUpdated.setName("updated");
    mUpdated.setVisibility(ExpertPortVisibility);

    addInputPort(mIn);
    addOutputPort(mOut);
    addOutputPort(mUpdated);
}
int QUndoView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QListView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setStack((*reinterpret_cast< QUndoStack*(*)>(_a[1]))); break;
        case 1: setGroup((*reinterpret_cast< QUndoGroup*(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 2;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = emptyLabel(); break;
        case 1: *reinterpret_cast< QIcon*>(_v) = cleanIcon(); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setEmptyLabel(*reinterpret_cast< QString*>(_v)); break;
        case 1: setCleanIcon(*reinterpret_cast< QIcon*>(_v)); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 2;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Exemple #8
0
void PostedItem::loadGroup(const uint32_t &token)
{
	std::vector<RsPostedGroup> groups;
	if (!rsPosted->getGroupData(token, groups))
	{
		std::cerr << "PostedItem::loadGroup() ERROR getting data";
		std::cerr << std::endl;
		return;
	}

	if (groups.size() != 1)
	{
		std::cerr << "PostedItem::loadGroup() Wrong number of Items";
		std::cerr << std::endl;
		return;
	}

	setGroup(groups[0]);
}
Exemple #9
0
void Message::setGroup( const std::string& msg, const FieldBase& field,
                        const std::string& string,
                        std::string::size_type& pos, FieldMap& map,
                        const DataDictionary& dataDictionary )
{
  int group = field.getTag();
  int delim;
  const DataDictionary* pDD = 0;
  if ( !dataDictionary.getGroup( msg, group, delim, pDD ) ) return ;
  std::unique_ptr<Group> pGroup;

  while ( pos < string.size() )
  {
    std::string::size_type oldPos = pos;
    FieldBase field = extractField( string, pos, &dataDictionary, &dataDictionary, pGroup.get() );
       
    // Start a new group because...
    if (// found delimiter
    (field.getTag() == delim) ||
    // no delimiter, but field belongs to group OR field already processed
    (pDD->isField( field.getTag() ) && (pGroup.get() == 0 || pGroup->isSetField( field.getTag() )) ))
    {
      if ( pGroup.get() )
      {
        map.addGroupPtr( group, pGroup.release(), false );
      }
      pGroup.reset( new Group( field.getTag(), delim, pDD->getOrderedFields() ) );
    }
    else if ( !pDD->isField( field.getTag() ) )
    {
      if ( pGroup.get() )
      {
        map.addGroupPtr( group, pGroup.release(), false );
      }
      pos = oldPos;
      return ;
    }

    if ( !pGroup.get() ) return ;
    pGroup->setField( field, false );
    setGroup( msg, field, string, pos, *pGroup, *pDD );
  }
}
Exemple #10
0
ContoursFilter::ContoursFilter()
{
    setName("ContoursFilter");
    setDesc("Extracts contours from an image. The image should be thresholded");
    setGroup("user");
    
	mIn.setName("input");
    mIn.setDesc("Thresholded input image");
    addInputPort(mIn);
	
	mOffsetIn.setName("offset");
    mOffsetIn.setDesc("Offset that will be added to all calculated positions");
    mOffsetIn.setDefault(QPointF(0.0, 0.0));
	addInputPort(mOffsetIn);
	
    mContourOut.setName("contour");
    mContourOut.setDesc("A list of the calculated outer contours");
    addOutputListPort(mContourOut);
}
Exemple #11
0
VarianceFilter::VarianceFilter()
{
    setName("VarianceFilter");
    setDesc("Calculates the variance inside the image or region of interest");
    setGroup("user");
   
	mIn.setName("imageIn");
	addInputPort(mIn);
	
	mRoiIn.setMode(OptionalPortMode);
    mRoiIn.setName("roi");
	addInputPort(mRoiIn);
	
    mVarianceOut.setName("variance");
	addOutputPort(mVarianceOut);
	
    mMeanOut.setName("mean grayscale");
    addOutputPort(mMeanOut);
}
bool Settings::fromJson(const Json::Value &json) {
	if (!json.isObject())
		return false;
	m_json = json;
	for (const auto & key: json.getMemberNames()) {
		if (json[key].isObject()) {
			//setJson(key, json[key]); // save type info
			auto s = new Settings;
			s->fromJson(json[key]);
			setGroup(key, s);
		} else if (json[key].isArray()) {
			//setJson(key, json[key]);
		} else {
			set(key, json[key].asString());
			m_json.removeMember(key); // todo: remove
		}
	}
	return true;
}
Exemple #13
0
Fichier : MPF.cpp Projet : aaly/MPF
int MPF::nextPage()
{
	groups.at(currentGroup)->getCurrentPage()->finishUp();

	if(groups.at(currentGroup)->currentPage < groups.at(currentGroup)->pages.size()-1)
	{
		if(!groups.at(currentGroup)->pages.at(groups.at(currentGroup)->currentPage+1)->init)
		{
			nextPushButton->setDisabled(true);
			nextButtonIcon->setEnabled(true);
		}
	}

	previousPushButton->setEnabled(true);
	prevButtonIcon->setEnabled(true);

	if (groups.at(currentGroup)->currentPage == groups.at(currentGroup)->pages.size()-1)
	{
		if(currentGroup < groups.size()-1)
		{
			setGroup(groups.at(currentGroup+1));
		}

		if(currentGroup == groups.size()-1)
		{
			nextPushButton->setDisabled(true);
			nextButtonIcon->setDisabled(true);
		}
		return 1;
	}
	else if (groups.at(currentGroup)->currentPage == groups.at(currentGroup)->pages.size()-2)
	{
		nextPushButton->setEnabled(false);
		nextButtonIcon->setEnabled(false);
	}



	changePage(1);

	return groups.at(currentGroup)->currentPage;
}
Exemple #14
0
ScaleImage::ScaleImage()
{
    setName("Scale");
    setDesc(QObject::tr("Scales an image by a factor"));
    setGroup("image/reshape");

    mOut.setName("imageOut");
    mOut.setDesc(QObject::tr("Image output"));
    addOutputPort(mOut);

    mIn.setName("imageIn");
    mIn.setDesc(QObject::tr("Image input"));
    addInputPort(mIn);

    mScale.setName("scale");
    mScale.setDesc(QObject::tr("The new image size in percent of the original image"));
    mScale.setRange(10, 1000);
    mScale.setDefault(100.0);
    addInputPort(mScale);
}
Exemple #15
0
MinoAnimation::MinoAnimation(QObject *parent) :
    MinoPersistentObject(parent),
    _group(NULL),
    _enabled(false),
    _currentRandY(0)
{
    Q_ASSERT(parent);
    if(MinoAnimationGroup* mag = qobject_cast<MinoAnimationGroup*>(parent))
    {
        setGroup(mag);
        _scene = Minotor::minotor()->scene();
        _boundingRect = Minotor::minotor()->displayRect();
    }
    _color = new MinoPropertyColor(this);
    QColor randColor;
    randColor.setHslF(qrandF(), 1.0, 0.5);
    _color->setColor(randColor);

    _beatFactor = new MinoPropertyBeat(this);
}
Exemple #16
0
QButton::QButton( QWidget *parent, const char *name, WFlags f )
    : QWidget( parent, name, f )
{
    bpixmap    = 0;
    toggleTyp  = SingleShot;			// button is simple
    buttonDown = FALSE;				// button is up
    stat       = Off;				// button is off
    mlbDown    = FALSE;				// mouse left button up
    autoresize = FALSE;				// not auto resizing
    animation  = FALSE;				// no pending animateClick
    repeat     = FALSE;				// not in autorepeat mode
    d	       = 0;
#ifndef QT_NO_BUTTONGROUP
    if ( parent && parent->inherits("QButtonGroup") ) {
	setGroup((QButtonGroup*)parent);
	group()->insert( this );		// insert into button group
    }
#endif
    setFocusPolicy( TabFocus );
}
Exemple #17
0
bool QLCChannel::loadXML(const QDomElement* root)
{
	QDomNode node;
	QDomElement tag;
	QString str;

	Q_ASSERT(root != NULL);

	/* Get channel name */
	str = root->attribute(KXMLQLCChannelName);
	if (str == QString::null)
		return false;
	else
		setName(str);

	/* Subtags */
	node = root->firstChild();
	while (node.isNull() == false)
	{
		tag = node.toElement();

		if (tag.tagName() == KXMLQLCCapability)
		{
			addCapability(new QLCCapability(&tag));
		}
		else if (tag.tagName() == KXMLQLCChannelGroup)
		{
			str = tag.attribute(KXMLQLCChannelGroupByte);
			setControlByte(str.toInt());
			setGroup(tag.text());
		}
		else
		{
			qDebug() << "Unknown Channel tag: " << tag.tagName();
		}

		node = node.nextSibling();
	}

	return true;
}
Exemple #18
0
void Cspi::write(u08 adr, u08 len, u08* dat) {
	u08 cnt;
	adr |= 0x80;
	ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
	{
		setGroup(base->CTRL, SPI_MODE_gm, mode);
		pinSS->set();
		while (!pinSS->isSet()) {
		};

		base->DATA = adr;
		while ((base->STATUS & 0x80) == 0x00) {
		};
		for (cnt = 0; cnt < len; cnt++) {
			base->DATA = dat[cnt];
			while ((base->STATUS & 0x80) == 0x00) {
			};
		}
		pinSS->clr();
	}
}
ImageInput::ImageInput()
{
    setName("ImageInput");
    setDesc(QObject::tr("Reads a single image from disc and outputs it"));
    setGroup("input");

    mOut.setName("imageOut");
    mOut.setDesc(QObject::tr("Image output"));
    addOutputPort(mOut);

    mIn.setName("fileName");
    mIn.setDesc(QObject::tr("File to read"));
    mIn.setFilter("*.jpg *.png *.bmp");

    mAlwaysRead.setName("alwaysReload");
    mAlwaysRead.setDefault(false);
    mAlwaysRead.setDesc(QObject::tr("Read the file from disc every time"));
    mAlwaysRead.setVisibility(AdvancedPortVisibility);
    addInputPort(mIn);
    addInputPort(mAlwaysRead);
}
Exemple #20
0
void Attack::callback2(Node* sender)
{
    Sprite* xx = (Sprite*)sender;
    Point pt = xx->getPosition();
    
    Sprite* sprite = Sprite::createWithSpriteFrameName("zidan.png");
    auto body = PhysicsBody::createCircle(sprite->getContentSize().width/2);
    body->setCategoryBitmask(0x04);
    body->setCollisionBitmask(0x04);
    body->setGroup(10);
    sprite->setPhysicsBody(body);
    sprite->setPosition(pt);
    sprite->setRotation(xx->getRotation());
    addChild(sprite,0,10);
    
    auto seq = Sequence::create(DelayTime::create(0.5f), CallFunc::create( std::bind(&Attack::fuckxx, this, sprite)),
                                DelayTime::create(1.0f),
                                RemoveSelf::create(),
                                NULL);
    this->runAction(seq);
}
Exemple #21
0
/**
 * This method is called when subtracting from rhythm value can't be solved in single note.
 * So given 'long' note is split, then calling method tries to subtract from smaller rhythm.
 * Because adding new, split note doesn't change measure duration,
 * this method simplifies process of adding new note to staff and measure.
 * It ties notes as well.
 */
void TscoreMeasure::split(TscoreNote* sn) {
  auto tieCopy = sn->note()->rtm.tie();
//   if (!sn->note()->isRest())
//     preserveTie(tieCopy, sn);

  TrhythmList splitList;
  sn->note()->rtm.split(splitList);
  sn->note()->rtm.setRhythm(splitList.first());
  Tnote n2(*sn->note(), splitList.last());
  // TODO: common code like in @p noteChangedSlot() - do method of it
  auto inserted = m_staff->insertNote(n2, sn->index() + 1, sn->isReadOnly());
  fixStemDirection(inserted);
  m_notes.insert(inserted->index() - firstNoteId(), inserted);
  connect(inserted, &TscoreNote::noteGoingToChange, this, &TscoreMeasure::noteChangedSlot);
  inserted->setGroup(sn->group());
  m_staff->updateNotesPos(inserted->index());
  // ------------

  if (!sn->note()->isRest())
    restoreTie(tieCopy, sn);
}
FetchTemplate::FetchTemplate()
{
    setName("FetchTemplate");
    setDesc(QObject::tr("Fetches a template from the given image on the ROI position"));
    setGroup("image/object detection");

    mIn.setName("imageIn");
    mIn.setDesc(QObject::tr("Image input"));
    addInputPort(mIn);

    mOut.setName("template");
    mOut.setDesc(QObject::tr("Template output port"));
    addOutputPort(mOut);

    mRoi.setName("roi");
    mRoi.setDesc(QObject::tr("Region where the template is extracted. Only applied when changed"));
    mRoi.setMode(SingleShotPortMode);
    mRoi.setDisplayVisibility(false);
    addInputPort(mRoi);

}
int Settings::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 1)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 1;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = group(); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setGroup(*reinterpret_cast< QString*>(_v)); break;
        }
        _id -= 1;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 1;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 1;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
RotateImage::RotateImage()
{
    setName("Rotate");
    setGroup("image/reshape");
    setDesc(QObject::tr("Rotates an image"));

    mOut.setName("imageOut");
    mOut.setDesc(QObject::tr("Image output"));
    addOutputPort(mOut);

    mIn.setName("imageIn");
    mIn.setDesc(QObject::tr("Image input"));
    addInputPort(mIn);

    mAngle.setName("angle");
    mAngle.setDesc(QObject::tr("Angle of the rotation"));
    mAngle.addChoice(0, tr("None"));
    mAngle.addChoice(90, tr("90 degree clockwise"));
    mAngle.addChoice(180, tr("180 degree"));
    mAngle.addChoice(270, tr("90 degree counter-clockwise"));
    mAngle.setDefault(0);
    addInputPort(mAngle);
}
void
RangeSensorWidget::setSensor(const QString& _sensor)
{
  QString error;
  bool ok = true;

  // build the lookup string for the naming service
  CosNaming::Name name;
  name.length(2);
  name[0].id = CORBA::string_dup(robotName_.latin1());
  name[1].id = CORBA::string_dup(_sensor.latin1());

  try {
    sensor_ = client_.resolveName<Miro::RangeSensor>(name);
  }
  catch(const CORBA::Exception& e) {
    std::ostringstream sstr;
    sstr << "Sensor " << robotName_ << "::" << _sensor << endl
	 << "Communication Failed." << endl
	 << "CORBA exception: " << e << flush;
    
    error = sstr.str().c_str();
    ok = false;
  }

  if (ok) {
    sensorName_ = _sensor;
    scanDescription_ = sensor_->getScanDescription();

    menuFile_->setItemEnabled(groupIndex_, true);
    setGroup(0);    
  }
  else {
    calcCaption();
    QMessageBox::warning(this, "Couln't set sensor:", error);
  }
}
Exemple #26
0
      void Tuning::sessionModeChange()
      {
        if (!session()) return;

        if (windowState_ == NO_DISPLAY)
        {
          setGroup("Minimized");
          return;
        }
        if (windowState_ == DISPLAY_ONLY)
        {
          setGroup("PreviewOnly");
          return;
        }
          
        auto _mode = session()->mode();

        // Show close button only in screen- and projection setup
        titleBar_->setCloseButtonVisible(
            _mode == Session::Mode::SCREENSETUP ||
            _mode == Session::Mode::PROJECTIONSETUP);

        switch (_mode)
        {
        case Session::Mode::SCREENSETUP:
          setGroup("FOVSliders");
          break;
        case Session::Mode::PROJECTIONSETUP:
          if (windowState_ == ADJUSTMENT_SLIDERS)
            setGroup(tuning()->projector().setup()->getTypeId().str());
          if (windowState_ == FOV_SLIDERS)
            setGroup("FOVSliders");
          break;
        case Session::Mode::WARP:
        case Session::Mode::BLEND:
        case Session::Mode::EXPORT:
          setGroup("PreviewOnly");
          break;
        default:
          break;
        }

        fullscreen_->update();
      }
bool RoleEmemyBig::init() {
	//////////////////////////////
	// 1. super init first
	if (!Sprite::initWithSpriteFrameName("hero1.png")) {
		return false;
	}

	setTag(TAG_ENEMY_PLANE);
	auto body = PhysicsBody::createBox(getContentSize());
	body->setGroup(PHYSICAL_BODY_ENEMY_GROUP);
	body->setCategoryBitmask(PHYSICAL_BODY_ENEMY_BITMASK_CATEGORY);
	body->setContactTestBitmask(PHYSICAL_BODY_ENEMY_BITMASK_CONTACT_TEST);
	body->setCollisionBitmask(PHYSICAL_BODY_ENEMY_BITMASK_COLLISION);
	setPhysicsBody(body);
	setRotation(-90);

	Point endPos = Point(0, 100);
	runAction(
			Sequence::create(MoveTo::create(3.0, endPos),
					CallFunc::create(
							CC_CALLBACK_0(RoleEmemyBig::doRemoveSelf, this, this)),
					NULL));
	return true;
}
void GxsChannelPostItem::loadGroup(const uint32_t &token)
{
#ifdef DEBUG_ITEM
	std::cerr << "GxsChannelGroupItem::loadGroup()";
	std::cerr << std::endl;
#endif

	std::vector<RsGxsChannelGroup> groups;
	if (!rsGxsChannels->getGroupData(token, groups))
	{
		std::cerr << "GxsChannelGroupItem::loadGroup() ERROR getting data";
		std::cerr << std::endl;
		return;
	}

	if (groups.size() != 1)
	{
		std::cerr << "GxsChannelGroupItem::loadGroup() Wrong number of Items";
		std::cerr << std::endl;
		return;
	}

	setGroup(groups[0]);
}
VideoInput::VideoInput()
{
    setName("VideoInput");
    setDesc(QObject::tr("Reads a video data stream and outputs the single frames (with variable frame rate). The fps-rate of this processor in always >= the requested fps"));
    setGroup("input");

    // Inputs
    mIn.setName("filePath");
    mIn.setDesc(QObject::tr("File to read video data stream from"));
    mIn.setFilter("*.avi *.wmv *.m4v *.mp4 *.mov");
    addInputPort(mIn);

    mRepeat.setName("repeat");
    mRepeat.setDefault(true);
    mRepeat.setDesc(QObject::tr("Repeat from beginning if the video data stream has finished"));
    mRepeat.setIcon(QImage(":/SimpleNodes/repeat.png"));
    mRepeat.setVisibility(AdvancedPortVisibility);
    addInputPort(mRepeat);

    mSpeed.setName("speed");
    mSpeed.setDesc(QObject::tr("Playback speed"));
    mSpeed.setDefault(1.0);
    mSpeed.addChoice(0.01, "0.01x");
    mSpeed.addChoice(0.1, "0.1x");
    mSpeed.addChoice(0.25, "0.25x");
    mSpeed.addChoice(0.5, "0.5x");
    mSpeed.addChoice(1.0, QObject::tr("Normal"));
    mSpeed.addChoice(2.0, "2x");
    mSpeed.addChoice(4.0, "4x");
    mSpeed.addChoice(10.0, "10x");
    mSpeed.addChoice(1000.0, QObject::tr("fastest"));
    addInputPort(mSpeed);

    mStart.setName("startPosition");
    mStart.setDesc(QObject::tr("Start offset (range: 0.0 to 1.0)"));
    mStart.setRange(0.0, 1.0);
    mStart.setDefault(0.0);
    mStart.setVisibility(AdvancedPortVisibility);
    addInputPort(mStart);

    mEnd.setName("endPosition");
    mEnd.setDesc(QObject::tr("End offset (range: 0.0 to 1.0)"));
    mEnd.setRange(0.0, 1.0);
    mEnd.setDefault(1.0);
    mEnd.setVisibility(AdvancedPortVisibility);
    addInputPort(mStart);
    addInputPort(mEnd);

    // Outputs
    mFpsOut.setName("fps");
    mFpsOut.setDesc(QObject::tr("Original fps of input video data stream"));
    addOutputPort(mFpsOut);

    mPositionOut.setName("outPosition");
    mPositionOut.setDesc(QObject::tr("Position of the current video file (range: 0.0 to 1.0)"));
    mPositionOut.setVisibility(AdvancedPortVisibility);
    addOutputPort(mPositionOut);

    mElapsedOut.setName("outElapsed");
    mElapsedOut.setDesc(QObject::tr("Elapsed time of the current video file in seconds"));
    mElapsedOut.setVisibility(AdvancedPortVisibility);
    addOutputPort(mElapsedOut);

    mOut.setName("imageOut");
    mOut.setDesc(QObject::tr("Image output"));
    addOutputPort(mOut);
}
Exemple #30
0
void Message::setString( int direction, const std::string& string,
                         const ValidationRules *validationRules,
                         const DataDictionary* pSessionDataDictionary,
                         const DataDictionary* pApplicationDataDictionary )
throw( Exception )
{
  clear();

  std::string::size_type pos = 0;
  int count = 0;
  std::string msg;

  /*
  static int const headerOrder[] =
  {
    FIELD::BeginString,
    FIELD::BodyLength,
    FIELD::MsgType
  };
  */

  field_type type = header;

  while ( pos < string.size() )
  {
    FieldBase field = extractField( string, pos, pSessionDataDictionary, pApplicationDataDictionary );
    if ( count < 3 &&
         headerOrder[ count++ ] != field.getTag() && 
         !ValidationRules::shouldTolerateOutOfOrderTag(validationRules, OUTGOING_DIRECTION, safeMsgType(), field.getTag() ) 
 )
    {
      //throw InvalidMessage("Header fields out of order.");
      throw TagOutOfOrder( field.getTag() );
    }

    if ( isHeaderField( field, pSessionDataDictionary ) )
    {
      if ( type != header )
      {
        if(m_tag == 0) m_tag = field.getTag();
        m_validStructure = false;
      }

      if ( field.getTag() == FIELD::MsgType )
        msg = field.getString();

      m_header.setField( field, false );

      if ( pSessionDataDictionary )
        setGroup( "_header_", field, string, pos, getHeader(), *pSessionDataDictionary );
    }
    else if ( isTrailerField( field, pSessionDataDictionary ) )
    {
      type = trailer;
      m_trailer.setField( field, false );

      if ( pSessionDataDictionary )
        setGroup( "_trailer_", field, string, pos, getTrailer(), *pSessionDataDictionary );
    }
    else
    {
      if ( type == trailer )
      {
        if(m_tag == 0) m_tag = field.getTag();
        m_validStructure = false;
      }

      type = body;
      setField( field, false );

      if ( pApplicationDataDictionary )
      {
        setGroup( msg, field, string, pos, *this, *pApplicationDataDictionary );
      }
    }
  }

  validate( validationRules );
}