QDataStream& WebCore::HistoryItem::saveState(QDataStream& out, int version) const
{
    // we only support version 1 for now.
    if (version != 1)
        return out;

    out << urlString() << title() << alternateTitle() << lastVisitedTime();
    out << originalURLString() << referrer() << target() << parent();
    out << lastVisitWasHTTPNonGet() << lastVisitWasFailure() << isTargetItem();
    out << visitCount() << documentState() << scrollPoint();
    out << dailyVisitCounts() << weeklyVisitCounts();
    /*if (m_formData) {
        out << true;
        out << formContentType();
        out << m_formData->flatten();
    } else {
        out << false;
    }*/
    // save user data
    if (userData().isValid())
        out << true << userData();
    else
        out << false;

    return out;
}
示例#2
0
void PictureShape::saveOdf( KoShapeSavingContext & context ) const
{
    // make sure we have a valid image data pointer before saving
    KoImageData * data = m_imageData;
    if( data != userData() )
        data = dynamic_cast<KoImageData*> (userData());
    if(data == 0)
        return;

    KoXmlWriter &writer = context.xmlWriter();

    writer.startElement( "draw:frame" );
    saveOdfAttributes( context, OdfAllAttributes );
    writer.startElement("draw:image");
    // In the spec, only the xlink:href attribute is marked as mandatory, cool :)
    QString name = context.imageHref(data);
    writer.addAttribute("xlink:type", "simple" );
    writer.addAttribute("xlink:show", "embed" );
    writer.addAttribute("xlink:actuate", "onLoad");
    writer.addAttribute("xlink:href", name);
    writer.endElement(); // draw:image
    saveOdfCommonChildElements( context );
    writer.endElement(); // draw:frame

    context.addDataCenter( m_imageCollection );
}
Message::Message(char cmd, char byte1, char byte2)
{
    header(START_12);
    length(1 + 2 + 2);
    id(cmd);
    userData()[0] = byte1;
    userData()[1] = byte2;
    checksum(calcChecksum());
}
Message::Message(char cmd, const char * msg)
{
    header(START_12);
    length(strlen(msg) + 2);
    id(cmd);
    type(SF_ARGSTR);
    strcpy((char *)userData(), msg);
    userData()[strlen(msg)] = '\0'; // 0 termination
    checksum(calcChecksum());
}
示例#5
0
bool PictureShape::saveSvg(SvgSavingContext &context)
{
    KoImageData *imageData = qobject_cast<KoImageData*>(userData());
    if (!imageData) {
        qWarning() << "Picture has no image data. Omitting.";
        return false;
    }

    context.shapeWriter().startElement("image");
    context.shapeWriter().addAttribute("id", context.getID(this));

    QTransform m = transformation();
    if (m.type() == QTransform::TxTranslate) {
        const QPointF pos = position();
        context.shapeWriter().addAttributePt("x", pos.x());
        context.shapeWriter().addAttributePt("y", pos.y());
    } else {
        context.shapeWriter().addAttribute("transform", SvgUtil::transformToString(m));
    }

    const QSizeF s = size();
    context.shapeWriter().addAttributePt("width", s.width());
    context.shapeWriter().addAttributePt("height", s.height());
    context.shapeWriter().addAttribute("xlink:href", context.saveImage(imageData));
    context.shapeWriter().endElement();

    return true;
}
void ChangeListLevelCommand::redo()
{
    if (!m_first) {
        KoTextCommandBase::redo();
        UndoRedoFinalizer finalizer(this);
        for (int i = 0; i < m_blocks.size(); ++i) {
            m_lists.value(i)->updateStoredList(m_blocks.at(i));
            QTextBlock currentBlock(m_blocks.at(i));
            KoTextBlockData userData(currentBlock);
            userData.setCounterWidth(-1.0);
        }
    }
    else {
        for (int i = 0; i < m_blocks.size() && m_lists.value(i); ++i) {
            if (!m_lists.value(i)->style()->hasLevelProperties(m_levels.value(i))) {
                KoListLevelProperties llp = m_lists.value(i)->style()->levelProperties(m_levels.value(i));
                if (llp.alignmentMode() == false) {
                    //old list mode, see KoListLevelProperties::alignmentMode() documentation
                    llp.setIndent((m_levels.value(i)-1) * 20); //TODO make this configurable
                } else {
                    llp.setTabStopPosition(MARGIN_DEFAULT*(m_levels.value(i)+1));
                    llp.setMargin(MARGIN_DEFAULT*(m_levels.value(i)+1));
                    llp.setTextIndent(- MARGIN_DEFAULT);
                }
                llp.setDisplayLevel(llp.displayLevel() + m_coefficient);
                llp.setLevel(m_levels.value(i));

                m_lists.value(i)->style()->setLevelProperties(llp);
            }
            m_lists.value(i)->add(m_blocks.at(i), m_levels.value(i));
        }
    }
    m_first = false;
}
示例#7
0
void PictureShape::waitUntilReady(const KoViewConverter &converter, bool asynchronous) const
{
    KoImageData *imageData = qobject_cast<KoImageData*>(userData());
    if (imageData == 0) {
        return;
    }

    if (asynchronous) {
        // get pixmap and schedule it if not
        QSize pixels = converter.documentToView(QRectF(QPointF(0,0), size())).size().toSize();
        QImage image = imageData->image();
        if (image.isNull()) {
            return;
        }
        m_printQualityRequestedSize = pixels;
        if (image.size().width() < pixels.width()) { // don't scale up.
            pixels = image.size();
        }
        m_printQualityImage = image.scaled(pixels, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    }
    else {
        QSize pixmapSize = calcOptimalPixmapSize(converter.documentToView(QRectF(QPointF(0,0), size())).size(), imageData->image().size());
        QString key(generate_key(imageData->key(), pixmapSize));
        if (QPixmapCache::find(key) == 0) {
            QPixmap pixmap = imageData->pixmap(pixmapSize);
            QPixmapCache::insert(key, pixmap);
        }
    }
}
示例#8
0
void PictureShape::paint( QPainter& painter, const KoViewConverter& converter ) {
    QRectF target = converter.documentToView(QRectF(QPointF(0,0), size()));

    if (m_imageData != userData()) {
        m_imageData = dynamic_cast<KoImageData*> (userData());
    }

    if (m_imageData == 0) {
        painter.fillRect(target, QColor(Qt::gray));
    }
    else {
        QPixmap pm = m_imageData->pixmap();
        // TODO only paint the rect that is visible
        painter.drawPixmap(target.toRect(), pm, QRect(0, 0, pm.width(), pm.height()));
    }
}
示例#9
0
OnlineTracker::EntryList* AnilistDotCoTracker::fetchRemote() {
    if (this->user.id <= 0) {
        if (!this->user.fetchCurrentlyLoggedInUser(this->credentials, this->lock)) {
            return NULL;
        }
    }

    QUrl url(QString("https://anilist.co/api/user/%1/animelist").arg(user.id));
    CurlResult userData(NULL);

    CURL* handle = credentials.curlClient(lock, url.toString(QUrl::FullyEncoded).toStdString().c_str(), userData);
    CURLcode error = curl_easy_perform(handle);
    curl_easy_cleanup(handle);
    if (error || userData.data.str().size() < 2) {
        qDebug() << "received error" << error << "for anilist.co Tracker Update '" << url << "'' with this message:\n";
        userData.print();
    } else {
        userData.print();
        nw::JsonReader jr(userData.data);
        EntryList* entries = new EntryList(jr);
        jr.close();
        if (!jr.getErrorMessage().empty()) {
            qDebug() << "got error from anilist.co status list parsing:" << QString(jr.getErrorMessage().c_str());
            delete entries;
            return NULL;
        }
        return entries;
    }
    return NULL;
}
示例#10
0
void PictureShape::saveOdf(KoShapeSavingContext &context) const
{
    // make sure we have a valid image data pointer before saving
    KoImageData *imageData = qobject_cast<KoImageData*>(userData());
    if (imageData == 0) {
        return;
    }

    KoXmlWriter &writer = context.xmlWriter();

    writer.startElement("draw:frame");
    saveOdfAttributes(context, OdfAllAttributes);
    writer.startElement("draw:image");
    // In the spec, only the xlink:href attribute is marked as mandatory, cool :)
    QString name = context.imageHref(imageData);
    writer.addAttribute("xlink:type", "simple");
    writer.addAttribute("xlink:show", "embed");
    writer.addAttribute("xlink:actuate", "onLoad");
    writer.addAttribute("xlink:href", name);
    saveText(context);
    writer.endElement(); // draw:image
    QSizeF scaleFactor(imageData->imageSize().width() / size().width(),
                  imageData->imageSize().height() / size().height());
    saveOdfClipContour(context, scaleFactor);
    writer.endElement(); // draw:frame

    context.addDataCenter(m_imageCollection);
}
示例#11
0
void VideoShape::saveOdf(KoShapeSavingContext &context) const
{
    // make sure we have a valid image data pointer before saving
    VideoData *videoData = qobject_cast<VideoData*>(userData());
    if (videoData == 0)
        return;

    KoXmlWriter &writer = context.xmlWriter();

    writer.startElement("draw:frame");
    saveOdfAttributes(context, OdfAllAttributes);
    writer.startElement("draw:plugin");
    // In the spec, only the xlink:href attribute is marked as mandatory, cool :)
    QString name = videoData->tagForSaving(m_videoCollection->saveCounter);
    writer.addAttribute("xlink:type", "simple");
    writer.addAttribute("xlink:show", "embed");
    writer.addAttribute("xlink:actuate", "onLoad");
    writer.addAttribute("xlink:href", name);
    writer.addAttribute("draw:mime-type", "application/vnd.sun.star.media");
    writer.endElement(); // draw:plugin
    saveOdfCommonChildElements(context);
    writer.endElement(); // draw:frame

    context.addDataCenter(m_videoCollection);
}
示例#12
0
/*!
    Deletes all client data associated to the service context.

    \sa clientData(), setClientData()
    \since 1.1
*/
void QServiceContext::resetClientData()
{
#ifndef QT_NO_USERDATA
    ServiceContextClientData* data =
        static_cast<ServiceContextClientData*>(userData(CLIENT_DATA_INDEX));
    data->clientData.clear();
#endif
}
示例#13
0
/*!
    Attaches arbitrary data \a value to the context object. The value
    can be retrieved via \a key.

    \sa clientData(), resetClientData()
    \since 1.1
*/
void QServiceContext::setClientData(const QString& key, const QVariant& value)
{
#ifndef QT_NO_USERDATA
    ServiceContextClientData* data =
        static_cast<ServiceContextClientData*>(userData(CLIENT_DATA_INDEX));
    data->clientData[key] = value;
#endif
}
Message::Message(char cmd, short val)
{
    header(START_12);
    length( 2+ 2 + 2);
    id(cmd);
    type((val >= 0)? SF_ARGINT : SF_ARGNINT);
    *(short*)userData() = ((val >= 0)? val : -val);
    checksum(calcChecksum());
}
示例#15
0
void GenCertDialog::init()
{
	std::cerr << "Finding PGPUsers" << std::endl;

	ui.genPGPuser->clear() ;

	std::list<RsPgpId> pgpIds;
	std::list<RsPgpId>::iterator it;
	bool foundGPGKeys = false;
	if (!mOnlyGenerateIdentity) {
		if (RsAccounts::GetPGPLogins(pgpIds)) {
			for(it = pgpIds.begin(); it != pgpIds.end(); ++it)
			{
				QVariant userData(QString::fromStdString( (*it).toStdString() ));
				std::string name, email;
				RsAccounts::GetPGPLoginDetails(*it, name, email);
				std::cerr << "Adding PGPUser: "******" id: " << *it << std::endl;
				QString gid = QString::fromStdString( (*it).toStdString()).right(8) ;
				ui.genPGPuser->addItem(QString::fromUtf8(name.c_str()) + " <" + QString::fromUtf8(email.c_str()) + "> (" + gid + ")", userData);
				foundGPGKeys = true;
			}
		}
	}

	if (foundGPGKeys) {
		ui.no_gpg_key_label->hide();
		ui.new_gpg_key_checkbox->setChecked(false);
		setWindowTitle(tr("Create new node"));
        ui.genButton2->setText(tr("Generate new node"));
		ui.headerFrame->setHeaderText(tr("Create a new node"));
		genNewGPGKey = false;
	} else {
		ui.no_gpg_key_label->setVisible(!mOnlyGenerateIdentity);
		ui.new_gpg_key_checkbox->setChecked(true);
		ui.new_gpg_key_checkbox->setEnabled(true);
		setWindowTitle(tr("Create new Identity"));
        ui.genButton2->setText(tr("Generate new Identity"));
		ui.headerFrame->setHeaderText(tr("Create a new Identity"));
		genNewGPGKey = true;
	}

	QString text; /*= ui.header_label->text() + "\n";*/
	text += tr("You can create a new identity with this form.");

	if (mOnlyGenerateIdentity) {
		ui.new_gpg_key_checkbox->setChecked(true);
		ui.new_gpg_key_checkbox->hide();
		ui.genprofileinfo_label->hide();
	} else {
		text += "\n";
		text += tr("Alternatively you can use an existing identity. Just uncheck \"Create a new identity\"");
	}
	ui.header_label->setText(text);

	newGPGKeyGenUiSetup();
    updateUiSetup();
}
示例#16
0
void QuetzalChoiceDialog::callBack(PurpleRequestChoiceCb cb)
{
	if (!cb)
		return;
	foreach (QRadioButton *button, m_radios) {
		if (button->isChecked())
			cb(userData(), button->property("choiceId").toInt());
	}
}
Message::Message(char cmd, unsigned short val)
{
    header(START_12);
    length(2 + 2 + 2);
    id(cmd);
    type(SF_ARGINT);
    *(unsigned short*)userData() = val;
    checksum(calcChecksum());
}
示例#18
0
/*!
    Returns the client data associated to \a key.

    \sa setClientData(), resetClientData()
    \since 1.1
*/
QVariant QServiceContext::clientData(const QString& key) const
{
#ifndef QT_NO_USERDATA
    ServiceContextClientData* data =
        static_cast<ServiceContextClientData*>(userData(CLIENT_DATA_INDEX));
    return data->clientData.value(key);
#else
    return QVariant();
#endif
}
示例#19
0
void GenCertDialog::init()
{
	std::cerr << "Finding PGPUsers" << std::endl;

	ui.genPGPuser->clear() ;

	std::list<std::string> pgpIds;
	std::list<std::string>::iterator it;
	bool foundGPGKeys = false;
	if (!mOnlyGenerateIdentity) {
		if (RsInit::GetPGPLogins(pgpIds)) {
			for(it = pgpIds.begin(); it != pgpIds.end(); it++)
			{
				QVariant userData(QString::fromStdString(*it));
				std::string name, email;
				RsInit::GetPGPLoginDetails(*it, name, email);
				std::cerr << "Adding PGPUser: "******" id: " << *it << std::endl;
				QString gid = QString::fromStdString(*it).right(8) ;
				ui.genPGPuser->addItem(QString::fromUtf8(name.c_str()) + " <" + QString::fromUtf8(email.c_str()) + "> (" + gid + ")", userData);
				foundGPGKeys = true;
			}
		}
	}

	if (foundGPGKeys) {
		ui.no_gpg_key_label->hide();
		ui.new_gpg_key_checkbox->setChecked(false);
		setWindowTitle(tr("Create new Location"));
		ui.genButton->setText(tr("Generate new Location"));
		ui.headerFrame->setHeaderText(tr("Create a new Location"));
		genNewGPGKey = false;
	} else {
		ui.no_gpg_key_label->setVisible(!mOnlyGenerateIdentity);
		ui.new_gpg_key_checkbox->setChecked(true);
		ui.new_gpg_key_checkbox->setEnabled(true);
		setWindowTitle(tr("Create new Identity"));
		ui.genButton->setText(tr("Generate new Identity"));
		ui.headerFrame->setHeaderText(tr("Create a new Identity"));
		genNewGPGKey = true;
	}

	QString text = ui.header_label->text() + "\n";

	if (mOnlyGenerateIdentity) {
		ui.new_gpg_key_checkbox->setChecked(true);
		ui.new_gpg_key_checkbox->hide();
		ui.genprofileinfo_label->hide();
		text += tr("You can create a new identity with this form.");
	} else {
		text += tr("You can use an existing identity (i.e. a PGP key pair), from the list below, or create a new one with this form.");
	}
	ui.header_label->setText(text);

	newGPGKeyGenUiSetup();
}
GA1DArrayGenome<T>::
GA1DArrayGenome(unsigned int length, GAGenome::Evaluator f, void * u) :
    GAArray<T>(length),
    GAGenome(DEFAULT_1DARRAY_INITIALIZER,
             DEFAULT_1DARRAY_MUTATOR,
             DEFAULT_1DARRAY_COMPARATOR) {
    evaluator(f);
    userData(u);
    nx=minX=maxX=length;
    crossover(DEFAULT_1DARRAY_CROSSOVER);
}
// Set all the initial values to NULL or zero, then allocate the space we'll
// need (using the resize method).  We do NOT call the initialize method at
// this point - initialization must be done explicitly by the user of the
// genome (eg when the population is created or reset).  If we called the
// initializer routine here then we could end up with multiple initializations
// and/or calls to dummy initializers (for example when the genome is 
// created with a dummy initializer and the initializer is assigned later on).
GA1DBinaryStringGenome::
GA1DBinaryStringGenome(unsigned int len, 
		       GAGenome::Evaluator f, void * u) :
GABinaryString(len),
GAGenome(DEFAULT_1DBINSTR_INITIALIZER, 
	 DEFAULT_1DBINSTR_MUTATOR,
	 DEFAULT_1DBINSTR_COMPARATOR) {
  evaluator(f);
  userData(u);
  crossover(DEFAULT_1DBINSTR_CROSSOVER); // assign the default sexual crossover
  nx=minX=maxX=0;
  resize(len);
}
示例#22
0
/* ----------------------------------------------------------------------------
   Genome class definition
---------------------------------------------------------------------------- */
GA2DBinaryStringGenome::
GA2DBinaryStringGenome(unsigned int width, unsigned int height, 
		       GAGenome::Evaluator f, void * u) :
GABinaryString(width*height),
GAGenome(DEFAULT_2DBINSTR_INITIALIZER,
	 DEFAULT_2DBINSTR_MUTATOR,
	 DEFAULT_2DBINSTR_COMPARATOR) {
  evaluator(f);
  userData(u);
  crossover(DEFAULT_2DBINSTR_CROSSOVER);
  nx=minX=maxX=0; ny=minY=maxY=0;
  resize(width, height);
}
void ChangeListLevelCommand::undo()
{
    KoTextCommandBase::undo();
    UndoRedoFinalizer finalizer(this);
    for (int i = 0; i < m_blocks.size(); ++i) {
        if (m_blocks.at(i).textList())
            m_lists.value(i)->updateStoredList(m_blocks.at(i));

        QTextBlock currentBlock(m_blocks.at(i));
        KoTextBlockData userData(currentBlock);
        userData.setCounterWidth(-1.0);
    }
}
示例#24
0
GA3DArrayGenome<T>::
GA3DArrayGenome(unsigned int w, unsigned int h, unsigned int d,
		GAGenome::Evaluator f,
		void * u) :
GAArray<T>(w*h*d),
GAGenome(DEFAULT_3DARRAY_INITIALIZER, 
	 DEFAULT_3DARRAY_MUTATOR,
	 DEFAULT_3DARRAY_COMPARATOR)
{
  evaluator(f);
  userData(u);
  crossover(DEFAULT_3DARRAY_CROSSOVER);
  nx=minX=maxX=w; ny=minY=maxY=h; nz=minZ=maxZ=d;
}
示例#25
0
void TweetJob::result(KJob *job)
{
    kDebug() << "job returned " << m_url;
    kDebug() << "Job returned... e:" << job->errorText();
    //kDebug() << "Job returned data:" << m_data;
    if (m_operation.startsWith("friendships")) {
        kDebug() << "emitting userdata";
        emit userData(m_data);
    }
    setError(job->error());
    setErrorText(job->errorText());
    setResult(!job->error());
    m_data.clear();
}
示例#26
0
void ParseLEF(HDesign& design)
{
  ConfigContext ctx(design.cfg.OpenContext("LEFParser"));

  if(!design.HasTechInfo())
    design.SetTechInfo();

  LEFParserData userData(&design);
  
  userData.rlBuilder.LayersStart(
    design.cfg.ValueOf(".startLayersCount", 6));
  userData.mtBuilder.MacroTypesStart(
    design.cfg.ValueOf(".startMacrosCount", 42),
    design.cfg.ValueOf(".startPinsCount", 224));
  userData.stBuilder.SitesStart(
    design.cfg.ValueOf(".startSitesCount", 1));
  
  lefrSetMacroBeginCbk(macroBeginCB);
  lefrSetMacroCbk(macroCB);
  lefrSetMacroEndCbk(macroEndCB);
  lefrSetPinCbk(pinCB);
  lefrSetLayerCbk(layerCB);
  lefrSetSiteCbk(siteCB);

  lefrSetMallocFunction(mallocCB);
  lefrSetReallocFunction(reallocCB);
  lefrSetFreeFunction(freeCB);

  lefrSetCaseSensitivity(false);
  lefrSetRelaxMode();
  lefrSetShiftCase();  // will shift name to uppercase if caseinsensitive
                       // is set to off or not set

  static int __init_reader_code = lefrInit();

  lefrReset();
  FILE* lefFile = fopen(design.cfg.ValueOf("benchmark.lef"),"r");
  CRITICAL_ASSERT(lefFile != NULL);

  ALERT("LEF file %s parsing started...", (const char*)design.cfg.ValueOf("benchmark.lef"));

  int lefReaderStatus = lefrRead(lefFile, design.cfg.ValueOf("benchmark.lef"), (void*)(&userData));
  ASSERT(lefReaderStatus == PARSE_OK);

  fclose(lefFile);

  lefrReleaseNResetMemory();

  ALERT("LEF parsing finished.");
}
示例#27
0
OnlineTracker::UpdateResult AnilistDotCoTracker::updateinOnlineTrackerOrAdd(const TvShow *show, const QString &type) const {
    Entry e;
    e.anime.id = show->getRemoteId(identifierKey());
    e.episodes_watched = show->episodeList().highestWatchedEpisodeNumber(0);
    e.rewatched = show->getRewatchCount();
    QUrl url = (QStringList()
        << "https://anilist.co/api/animelist"
        << "?id=" << QString::number(e.anime.id)
        << "&list_status=" << watchStatusToString(show->getStatus())
//        << "&score_raw=" << e->score_raw
        << "&episodes_watched=" << QString::number(e.watchedEpisodes())
        << "&rewatched=" << QString::number(e.rewatched)).join("");
//        << "&score=" << e->score // (See bottom of page - List score types)
//        << "&notes=" << e->notes
//        << "&advanced_rating_scores=" << e->advanced_rating_scores
//        << "&custom_lists=" << e->custom_lists
//        << "&hidden_default=" << e->hidden_default

//    qDebug() << url.toString(QUrl::FullyEncoded);
//    qDebug() << show->episodeList().numberOfEpisodes() << "/"
//             << show->episodeList().highestWatchedEpisodeNumber(0)
//             << TvShow::watchStatusToString(show->getStatus())
//            << show->getRemoteId(identifierKey())
//            << show->name();

    CurlResult userData(NULL);
    CURL* handle = credentials.curlClient(lock, url.toString(QUrl::FullyEncoded).toStdString().c_str(), userData);

    if (type == "add") {
//        curl_easy_setopt(handle, CURLOPT_HTTPPOST, true);
//        curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE, 0);
//        curl_easy_setopt(handle, CURLOPT_COPYPOSTFIELDS, NULL);
        curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "POST");
    } else {
        curl_easy_setopt(handle, CURLOPT_CUSTOMREQUEST, "PUT");
    }

    CURLcode error = curl_easy_perform(handle);
    curl_easy_cleanup(handle);
    if (error || userData.data.str().size() < 2) {
        qDebug() << "received error" << error << "for anilist.co tracker " << type << " with this message:\n";
        userData.print();
        return OnlineTracker::failedDueToNetwork;
    } else {
        qDebug() << "success" << error << "for anilist.co tracker " << type << " with this message:\n";
        userData.print();
        return OnlineTracker::success;
    }
}
示例#28
0
bool AnilistDotCoTracker::User::fetchCurrentlyLoggedInUser(const OnlineCredentials& credentials, OnlineCredentials::TimeLock& lock) {
    CurlResult userData(NULL);

    CURL* handle = credentials.curlClient(lock, "https://anilist.co/api/user", userData);
    CURLcode error = curl_easy_perform(handle);
    curl_easy_cleanup(handle);
    if (error || userData.data.str().size() < 2) {
        qDebug() << "received error" << error << "for anilist.co user fetch with this message:\n";
        userData.print();
    } else {
        userData.print();
        nw::JsonReader jr(userData.data);
        this->describe(jr);
        jr.close();
    }
    return this->id > 0;
}
示例#29
0
bool PictureShape::loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context)
{
    loadOdfAttributes(element, context, OdfAllAttributes);

    if (loadOdfFrame(element, context)) {
        // load contour (clip)
        KoImageData *imageData = qobject_cast<KoImageData*>(userData());

        QSizeF scaleFactor(size().width() / imageData->imageSize().width(),
                 size().height() / imageData->imageSize().height());

        loadOdfClipContour(element, context, scaleFactor);
        // this is needed so that the image is already normalized when calling waitUntilReady e.g. by cstester
        m_clippingRect.normalize(imageData->imageSize());

        return true;
    }
    return false;
}
示例#30
0
void QuetzalFieldsDialog::onClicked(int button)
{
	debug() << Q_FUNC_INFO << button;
	PurpleRequestFieldsCb cb = button == 0 ? m_ok_cb : m_cancel_cb;
	if (button == 0) {
		const QList<DataItem> items = form()->item().subitems();
		for (int i = 0; i < items.size(); i++) {
			const DataItem &item = items.at(i);
			QByteArray id = item.name().toUtf8();
			PurpleRequestField *field = purple_request_fields_get_field(m_fields, id.constData());
			switch (purple_request_field_get_type(field)) {
			case PURPLE_REQUEST_FIELD_STRING:
				purple_request_field_string_set_value(field, item.data().toString().toUtf8().constData());
				break;
			case PURPLE_REQUEST_FIELD_INTEGER:
				purple_request_field_int_set_value(field, item.data().toInt());
				break;
			case PURPLE_REQUEST_FIELD_BOOLEAN:
				purple_request_field_bool_set_value(field, item.data().toBool());
				break;
			case PURPLE_REQUEST_FIELD_CHOICE:
				{
					QStringList alternatives = item.property("alternatives", QStringList());
					purple_request_field_choice_set_value(field, alternatives.indexOf(item.data().toString()));
				}
				break;
			case PURPLE_REQUEST_FIELD_LIST:
				break;
			case PURPLE_REQUEST_FIELD_ACCOUNT:
				break;
			case PURPLE_REQUEST_FIELD_IMAGE:
			case PURPLE_REQUEST_FIELD_LABEL:
			case PURPLE_REQUEST_FIELD_NONE:
			default:
				continue;
			}
		}
	}
	cb(userData(), m_fields);
	quetzal_request_close(PURPLE_REQUEST_FIELDS, this);
}