Esempio n. 1
0
void GUI_Button::readAttributes(TiXmlElement* p_element)
{
	TiXmlElement* e = p_element->FirstChildElement("Title");
	if(e)
	{
		const char* p_title = e->GetText();
		setTitle(p_title ? p_title : "");
	}

	e = p_element->FirstChildElement("Image");
	if(e)
	{
		const char* p_imageFilename = e->GetText();
		if(p_imageFilename) setImageFilename(localizeString(p_imageFilename));

		e->QueryIntAttribute("u", &positionOnTexture.x);
		e->QueryIntAttribute("v", &positionOnTexture.y);

		e->QueryIntAttribute("u2", &clickedPositionOnTexture.x);
		e->QueryIntAttribute("v2", &clickedPositionOnTexture.y);
	}

	e = p_element->FirstChildElement("ExtendedStyle");
	if(e) style = 1;
}
Esempio n. 2
0
int QTweetStatusUpdateWithMedia::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QTweetNetBase::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 2)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 2;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 2)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 2;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = status(); break;
        case 1: *reinterpret_cast< QString*>(_v) = imageFilename(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isSensitive(); break;
        case 3: *reinterpret_cast< qint64*>(_v) = inReplyToStatusID(); break;
        case 4: *reinterpret_cast< double*>(_v) = latitude(); break;
        case 5: *reinterpret_cast< double*>(_v) = longitude(); break;
        case 6: *reinterpret_cast< QString*>(_v) = placeID(); break;
        case 7: *reinterpret_cast< bool*>(_v) = displayCoordinates(); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setStatus(*reinterpret_cast< QString*>(_v)); break;
        case 1: setImageFilename(*reinterpret_cast< QString*>(_v)); break;
        case 2: setSensitive(*reinterpret_cast< bool*>(_v)); break;
        case 3: setReplyToStatusID(*reinterpret_cast< qint64*>(_v)); break;
        case 4: setLatitude(*reinterpret_cast< double*>(_v)); break;
        case 5: setLongitude(*reinterpret_cast< double*>(_v)); break;
        case 6: setPlaceID(*reinterpret_cast< QString*>(_v)); break;
        case 7: setDisplayCoordinates(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 8;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 8)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 8;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Esempio n. 3
0
bool K3bCueFileParser::findImageFileName( const QString& dataFile )
{
  //
  // CDRDAO does not use this image filename but replaces the extension from the cue file
  // with "bin" to get the image filename, we should take this into account
  //

  m_imageFilenameInCue = true;

  // first try filename as a hole (absolut)
  if( QFile::exists( dataFile ) ) {
    setImageFilename( QFileInfo(dataFile).absFilePath() );
    return true;
  }

  // try the filename in the cue's directory
  if( QFileInfo( K3b::parentDir(filename()) + dataFile.section( '/', -1 ) ).isFile() ) {
    setImageFilename( K3b::parentDir(filename()) + dataFile.section( '/', -1 ) );
    kdDebug() << "(K3bCueFileParser) found image file: " << imageFilename() << endl;
    return true;
  }

  // try the filename ignoring case
  if( QFileInfo( K3b::parentDir(filename()) + dataFile.section( '/', -1 ).lower() ).isFile() ) {
    setImageFilename( K3b::parentDir(filename()) + dataFile.section( '/', -1 ).lower() );
    kdDebug() << "(K3bCueFileParser) found image file: " << imageFilename() << endl;
    return true;
  }

  m_imageFilenameInCue = false;

  // try removing the ending from the cue file (image.bin.cue and image.bin)
  if( QFileInfo( filename().left( filename().length()-4 ) ).isFile() ) {
    setImageFilename( filename().left( filename().length()-4 ) );
    kdDebug() << "(K3bCueFileParser) found image file: " << imageFilename() << endl;
    return true;
  }

  //
  // we did not find the image specified in the cue.
  // Search for another one having the same filename as the cue but a different extension
  //

  QDir parentDir( K3b::parentDir(filename()) );
  QString filenamePrefix = filename().section( '/', -1 );
  filenamePrefix.truncate( filenamePrefix.length() - 3 ); // remove cue extension
  kdDebug() << "(K3bCueFileParser) checking folder " << parentDir.path() << " for files: " << filenamePrefix << "*" << endl;

  //
  // we cannot use the nameFilter in QDir because of the spaces that may occur in filenames
  //
  QStringList possibleImageFiles = parentDir.entryList( QDir::Files );
  int cnt = 0;
  for( QStringList::const_iterator it = possibleImageFiles.constBegin(); it != possibleImageFiles.constEnd(); ++it ) {
    if( (*it).lower() == dataFile.section( '/', -1 ).lower() ||
	(*it).startsWith( filenamePrefix ) && !(*it).endsWith( "cue" ) ) {
      ++cnt;
      setImageFilename( K3b::parentDir(filename()) + *it );
    }
  }

  //
  // we only do this if there is one unique file which fits the requirements. 
  // Otherwise we cannot be certain to have the right file.
  //
  return ( cnt == 1 && QFileInfo( imageFilename() ).isFile() );
}