本文整理汇总了C++中setFinished函数的典型用法代码示例。如果您正苦于以下问题:C++ setFinished函数的具体用法?C++ setFinished怎么用?C++ setFinished使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setFinished函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setError
/** @short Data for the current message part are available now */
void MsgPartNetworkReply::slotMyDataChanged()
{
if (part.data(Mailbox::RoleIsUnavailable).toBool()) {
setError(TimeoutError, tr("Offline"));
setFinished(true);
emit error(TimeoutError);
emit finished();
return;
}
if (!part.data(Mailbox::RoleIsFetched).toBool())
return;
MsgPartNetAccessManager *netAccess = qobject_cast<MsgPartNetAccessManager*>(manager());
Q_ASSERT(netAccess);
QString mimeType = netAccess->translateToSupportedMimeType(part.data(Mailbox::RolePartMimeType).toString());
QString charset = part.data(Mailbox::RolePartCharset).toString();
if (mimeType.startsWith(QLatin1String("text/"))) {
setHeader(QNetworkRequest::ContentTypeHeader,
charset.isEmpty() ? mimeType : QStringLiteral("%1; charset=%2").arg(mimeType, charset)
);
} else {
setHeader(QNetworkRequest::ContentTypeHeader, mimeType);
}
setFinished(true);
emit readyRead();
emit finished();
}
示例2: switch
int Sample::process_bg() {
/*
This function does the main thing: it stretches the original data as defined by the marker object.
Therefore it reads data from odata and writes to data.
*/
_processing=true;
// setup data
length=getGuessedLength();
delete[] data;
data=new float[length];
switch (getStretchMode()) {
#ifdef MODE_RUBBERBAND
case 1:
RBprocess(olength, data, marker, this);
break;
#endif
default: {
for (int i=0; i<length; ++i) {
data[i]=getOld(marker->new2old(marker->nnew2new(i/(float)length)));
setFinished(i/(float)length);
}
}
}
setFinished(1);
_processing=false;
return 0;
}
示例3: setFinished
bool QuitGame::handleEvent(const sf::Input &Input) {
if(Input.IsKeyDown(sf::Key::Y)) {
setFinished();
if(m_panel != NULL) {
m_panel->setQuit();
}
}
if(Input.IsKeyDown(sf::Key::N)) {
setFinished();
}
return true;
}
示例4: parser
void QGeoRouteReplyNokia::networkFinished()
{
if (!m_reply)
return;
if (m_reply->error() != QNetworkReply::NoError) {
// Removed because this is already done in networkError, which previously caused _two_ errors to be raised for every error.
//setError(QGeoRouteReply::CommunicationError, m_reply->errorString());
//m_reply->deleteLater();
//m_reply = 0;
return;
}
QGeoRouteXmlParser parser(request());
if (parser.parse(m_reply)) {
setRoutes(parser.results());
setFinished(true);
} else {
// add a qWarning with the actual parser.errorString()
setError(QGeoRouteReply::ParseError, "The response from the service was not in a recognisable format.");
}
m_reply->deleteLater();
m_reply = 0;
}
示例5: setMapImageData
void QGeoMapReplyOsm::networkReplyFinished()
{
if (!m_reply)
return;
if (m_reply->error() != QNetworkReply::NoError)
return;
QByteArray a = m_reply->readAll();
setMapImageData(a);
switch (tileSpec().mapId()) {
case 1:
setMapImageFormat("png");
break;
case 2:
setMapImageFormat("png");
break;
default:
qWarning("Unknown map id %d", tileSpec().mapId());
}
setFinished(true);
m_reply->deleteLater();
m_reply = 0;
}
示例6: setCached
void QGeoMapReplyNokia::networkFinished()
{
if (!m_reply)
return;
if (m_reply->error() != QNetworkReply::NoError)
return;
QVariant fromCache = m_reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute);
setCached(fromCache.toBool());
if (!isCached()) {
QAbstractNetworkCache *cache = m_reply->manager()->cache();
if (cache) {
QNetworkCacheMetaData metaData = cache->metaData(m_reply->url());
QDateTime exp = QDateTime::currentDateTime();
exp = exp.addDays(14);
metaData.setExpirationDate(exp);
cache->updateMetaData(metaData);
}
}
setMapImageData(m_reply->readAll());
setMapImageFormat("PNG");
setFinished(true);
m_reply->deleteLater();
m_reply = 0;
}
示例7: viewport
void QGeoCodeReplyNokia::networkFinished()
{
if (!m_reply)
return;
if (m_reply->error() != QNetworkReply::NoError) {
// Removed because this is already done in networkError, which previously caused _two_ errors to be raised for every error.
//setError(QGeoCodeReply::CommunicationError, m_reply->errorString());
//m_reply->deleteLater();
//m_reply = 0;
return;
}
QGeoCodeXmlParser parser;
if (parser.parse(m_reply)) {
QList<QGeoLocation> locations = parser.results();
QGeoShape bounds = viewport();
if (bounds.isValid()) {
for (int i = locations.size() - 1; i >= 0; --i) {
if (!bounds.contains(locations[i].coordinate()))
locations.removeAt(i);
}
}
setLocations(locations);
setFinished(true);
} else {
setError(QGeoCodeReply::ParseError, parser.errorString());
}
m_reply->deleteLater();
m_reply = 0;
}
示例8: if
void RemoteLinuxEnvironmentReader::remoteProcessFinished()
{
if (m_stop)
return;
m_env.clear();
QString errorMessage;
if (m_deviceProcess->exitStatus() != QProcess::NormalExit) {
errorMessage = m_deviceProcess->errorString();
} else if (m_deviceProcess->exitCode() != 0) {
errorMessage = tr("Process exited with code %1.")
.arg(m_deviceProcess->exitCode());
}
if (!errorMessage.isEmpty()) {
errorMessage = tr("Error running 'env': %1").arg(errorMessage);
const QString remoteStderr
= QString::fromUtf8(m_deviceProcess->readAllStandardError()).trimmed();
if (!remoteStderr.isEmpty())
errorMessage += QLatin1Char('\n') + tr("Remote stderr was: \"%1\"").arg(remoteStderr);
emit error(errorMessage);
} else {
QString remoteOutput = QString::fromUtf8(m_deviceProcess->readAllStandardOutput());
if (!remoteOutput.isEmpty()) {
m_env = Utils::Environment(remoteOutput.split(QLatin1Char('\n'),
QString::SkipEmptyParts), Utils::OsTypeLinux);
}
}
setFinished();
}
示例9: error
void QPlaceDetailsReplyImpl::setError(QPlaceReply::Error error_, const QString &errorString)
{
QPlaceReply::setError(error_, errorString);
emit error(error_, errorString);
setFinished(true);
emit finished();
}
示例10: qCDebug
void PendingOperation::setFinishedWithError(const QVariantHash &details)
{
qCDebug(c_pendingOperations) << this << "setFinishedWithError(" << details << ")";
d->m_succeeded = false;
d->m_errorDetails = details;
setFinished();
}
示例11: setFinished
void ThreadedAssignment::checkInWithDomainServerOrExit() {
if (NodeList::getInstance()->getNumNoReplyDomainCheckIns() == MAX_SILENT_DOMAIN_SERVER_CHECK_INS) {
setFinished(true);
} else {
NodeList::getInstance()->sendDomainServerCheckIn();
}
}
示例12: error
/*!
Sets the error state of this reply to \a error and the textual
representation of the error to \a errorString.
This will also cause error() and finished() signals to be emitted, in that
order.
*/
void QGeoCodeReply::setError(QGeoCodeReply::Error error, const QString &errorString)
{
d_ptr->error = error;
d_ptr->errorString = errorString;
emit this->error(error, errorString);
setFinished(true);
}
示例13: setError
void QPlaceContentReplyImpl::replyFinished()
{
if (m_reply->isOpen()) {
QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll());
if (!document.isObject()) {
setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR));
return;
}
QJsonObject object = document.object();
QPlaceContent::Collection collection;
int totalCount;
QPlaceContentRequest previous;
QPlaceContentRequest next;
parseCollection(request().contentType(), object, &collection, &totalCount,
&previous, &next, m_engine);
setTotalCount(totalCount);
setContent(collection);
setPreviousPageRequest(previous);
setNextPageRequest(next);
}
m_reply->deleteLater();
m_reply = 0;
setFinished(true);
emit finished();
}
示例14: switch
void RS_ActionDrawText::init(int status) {
RS_ActionInterface::init(status);
if (RS_DIALOGFACTORY) {
switch (status) {
case ShowDialog: {
reset();
RS_Text tmp(NULL, *data);
if (RS_DIALOGFACTORY->requestTextDialog(&tmp)) {
data.reset(new RS_TextData(tmp.getData()));
setStatus(SetPos);
showOptions();
} else {
hideOptions();
setFinished();
}
}
break;
case SetPos:
RS_DIALOGFACTORY->requestOptions(this, true, true);
deletePreview();
preview->setVisible(true);
preparePreview();
break;
default:
break;
}
}
}
示例15: switch
void XTelepathyPasswordAuthOperation::onDialogFinished(int result)
{
switch (result) {
case QDialog::Rejected:
qDebug() << "Authentication cancelled";
m_saslIface->AbortSASL(Tp::SASLAbortReasonUserAbort, i18n("User cancelled auth"));
setFinished();
if (!m_dialog.isNull()) {
m_dialog.data()->deleteLater();
}
return;
case QDialog::Accepted:
// save password in kwallet if necessary...
if (!m_dialog.isNull()) {
if (m_dialog.data()->savePassword()) {
qDebug() << "Saving password in SSO";
m_canFinish = false;
storeCredentials(m_dialog.data()->password());
} else {
m_canFinish = true;
}
m_dialog.data()->deleteLater();
m_saslIface->StartMechanismWithData(QLatin1String("X-TELEPATHY-PASSWORD"), m_dialog.data()->password().toUtf8());
}
}
}
开发者ID:netrunner-debian-kde-extras,项目名称:kde-telepathy-ktp-auth-handler,代码行数:28,代码来源:x-telepathy-password-auth-operation.cpp