int MStyleSheetAttribute::attributeToInt(const QByteArray &attribute, bool *conversionOk) { QByteArray value = attribute.trimmed(); if (attribute.endsWith(units[PIXELS_UNIT])) { // strip "px" from the end value.truncate(value.length() - 2); return value.toInt(conversionOk); } if (attribute.endsWith(units[MM_UNIT])) { // strip "mm" from the end value.truncate(value.length() - 2); return MDeviceProfile::instance()->mmToPixels(value.toFloat(conversionOk)); } if (attribute.endsWith(units[PT_UNIT])) { // strip "pt" from the end value.truncate(value.length() - 2); return MDeviceProfile::instance()->ptToPixels(value.toFloat(conversionOk)); } return value.toInt(conversionOk); }
void PingPong::readSocket() { if (!socket) return; const char sep = ' '; QByteArray line; while (socket->canReadLine()) { line = socket->readLine(); //qDebug() << QString::fromUtf8(line.constData(), line.length()); if (line.contains("result")) { QList<QByteArray> result = line.split(sep); if (result.size() > 2) { QByteArray leftSide = result.at(1); QByteArray rightSide = result.at(2); m_resultLeft = leftSide.toInt(); m_resultRight = rightSide.toInt(); Q_EMIT resultChanged(); checkResult(); } } } if ((m_proportionX == 0 || m_proportionY == 0)) { QList<QByteArray> boardSize = line.split(sep); if (boardSize.size() > 1) { QByteArray boardWidth = boardSize.at(0); QByteArray boardHeight = boardSize.at(1); m_proportionX = m_boardWidth/boardWidth.toFloat(); m_proportionY = m_boardHeight/boardHeight.toFloat(); setMessage("Screen adjusted. Get ready!"); QTimer::singleShot(3000, this, SLOT(startGame())); } } else if (m_role == 1) { QList<QByteArray> boardSize = line.split(sep); if (boardSize.size() > 1) { QByteArray rightBlockY = boardSize.at(0); m_rightBlockY = m_proportionY * rightBlockY.toFloat(); Q_EMIT rightBlockChanged(); } } else if (m_role == 2) { QList<QByteArray> boardSize = line.split(sep); if (boardSize.size() > 2) { QByteArray ballX = boardSize.at(0); QByteArray ballY = boardSize.at(1); QByteArray leftBlockY = boardSize.at(2); m_ballX = m_proportionX * ballX.toFloat(); m_ballY = m_proportionY * ballY.toFloat(); m_leftBlockY = m_proportionY * leftBlockY.toFloat(); Q_EMIT leftBlockChanged(); Q_EMIT ballChanged(); } } }
int MonarkConnection::readConfiguredLoad() { m_serial->write("B\r"); if (!m_serial->waitForBytesWritten(500)) { // failure to write to device, bail out this->exit(-1); } QByteArray data = readAnswer(500); data.remove(0,1); qDebug() << "Current configure load: " << data.toInt(); return data.toInt(); }
QT_BEGIN_NAMESPACE QEglFSScreen::QEglFSScreen(EGLDisplay dpy) : m_dpy(dpy), m_surface(EGL_NO_SURFACE), m_cursor(0), m_rootContext(0) { #ifdef QEGL_EXTRA_DEBUG qWarning("QEglScreen %p\n", this); #endif QByteArray hideCursorVal = qgetenv("QT_QPA_EGLFS_HIDECURSOR"); bool hideCursor = false; if (hideCursorVal.isEmpty()) { #if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK)) QScopedPointer<QDeviceDiscovery> dis(QDeviceDiscovery::create(QDeviceDiscovery::Device_Mouse)); hideCursor = dis->scanConnectedDevices().isEmpty(); #endif } else { hideCursor = hideCursorVal.toInt() != 0; } if (!hideCursor) m_cursor = QEglFSHooks::hooks()->createCursor(this); }
bool Matrix::getHdcpStatus(QByteArray input) { QByteArray resp; QByteArray esc = "\x1B"; resp = dxpClient->sendQuery(esc + "E" + input + "HDCP\r").trimmed(); return resp.toInt(); }
bool QXcbScreen::xResource(const QByteArray &identifier, const QByteArray &expectedIdentifier, int *value) { Q_ASSERT(value != 0); if (identifier.startsWith(expectedIdentifier)) { QByteArray stringValue = identifier.mid(expectedIdentifier.size()); bool ok; *value = stringValue.toInt(&ok); if (!ok) { if (stringValue == "hintfull") *value = QFontEngine::HintFull; else if (stringValue == "hintnone") *value = QFontEngine::HintNone; else if (stringValue == "hintmedium") *value = QFontEngine::HintMedium; else if (stringValue == "hintslight") *value = QFontEngine::HintLight; return *value != 0; } return true; } return false; }
CrossFlip::CrossFlip(QByteArray fileData){ fileData = fileData.mid(fileData.indexOf("var boardinit")); fileData = fileData.mid(0, fileData.indexOf("</script>")); QByteArray board; board = fileData.mid(fileData.indexOf("\"")+1); board = board.mid(0, board.indexOf("\"")); std::vector<bool> bufferBlocked, bufferStartValue; for(int i=0; i< board.size(); ++i){ if(board[i] == ','){ Blocked.push_back(bufferBlocked); startValue.push_back(bufferStartValue); bufferBlocked.clear(); bufferStartValue.clear(); continue; } if(board[i] == '0'){ bufferBlocked.push_back(false); bufferStartValue.push_back(false); }else if(board[i] == '1'){ bufferBlocked.push_back(false); bufferStartValue.push_back(true); }else if(board[i] == '2'){ bufferBlocked.push_back(true); bufferStartValue.push_back(false); } } Blocked.push_back(bufferBlocked); startValue.push_back(bufferStartValue); QByteArray lev = fileData; lev = lev.mid(lev.indexOf("level")); lev = lev.mid(lev.indexOf("=")+2); lev = lev.mid(0, lev.indexOf(";")); level = lev.toInt(); }
void QTcpClient::readMessage() { qDebug()<<"////////////////"; qint64 numc = 0; qint64 numb = tcpsocket->bytesAvailable(); qDebug()<<numb<<" numb"; while(numc < numb) { int type = 0; int length = 0; QByteArray databy; databy = tcpsocket->read(1); numc++; type = databy.toInt(); if(type != m_type) { databy = tcpsocket->readAll(); databy.clear(); continue; } databy.clear(); databy = tcpsocket->read(4); numc = numc + 4; length = Char2Dec(databy.data()); if(length == 0) { continue; } databy.clear(); databy = tcpsocket->read(length); numc = numc +length; qDebug()<<m_time.currentDateTime().toString("hh:mm:ss.zzz")<<" Lib"; (*g_callRead)(databy); } }
QVariant StelJsonParserInstance::readOther() { QByteArray str; char c; while (getChar(&c)) { if (c==' ' || c==',' || c=='\n' || c=='\r' || c==']' || c=='\t' || c=='}') { ungetChar(c); break; } str+=c; } bool ok; const int i = str.toInt(&ok); if (ok) return i; const double d = str.toDouble(&ok); if (ok) return d; if (str=="true") return QVariant(true); if (str=="false") return QVariant(false); if (str=="null") return QVariant(); QDateTime dt = QDateTime::fromString(str, Qt::ISODate); if (dt.isValid()) return QVariant(dt); throw std::runtime_error(qPrintable(QString("Invalid JSON value: \"")+str+"\"")); }
QString DevicePrivate::decodePropertyValue(const QByteArray &encoded) const { QByteArray decoded; const int len = encoded.length(); for (int i = 0; i < len; i++) { quint8 ch = encoded.at(i); if (ch == '\\') { if (i + 1 < len && encoded.at(i + 1) == '\\') { decoded.append('\\'); i++; continue; } else if (i + 3 < len && encoded.at(i + 1) == 'x') { QByteArray hex = encoded.mid(i + 2, 2); bool ok; int code = hex.toInt(&ok, 16); if (ok) decoded.append(char(code)); i += 3; continue; } } else { decoded.append(ch); } } return QString::fromUtf8(decoded); }
unsigned int GyroscopeAdaptor::interval() const { if (mode() == SysfsAdaptor::IntervalMode) return SysfsAdaptor::interval(); QByteArray byteArray = readFromFile(dataRatePath_); return byteArray.size() > 0 ? byteArray.toInt() : 0; }
/**@brief convert QString to float (4 bytes, 32 bits); * *@param str [IN]: the string to convert; *@param data [OUT]: the result is stored in this parm; *@return bool: if convert succeed, return true; else, return false; *@note hex->decimal->float */ bool Lms511Thread::Str2Real(QByteArray str, float* data) { bool ok = false; int n = str.toInt(&ok, 16); memcpy(data, &n, sizeof(float)); return ok; }
bool QHttpNetworkReplyPrivate::parseStatus(const QByteArray &status) { // from RFC 2616: // Status-Line = HTTP-Version SP Status-Code SP Reason-Phrase CRLF // HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT // that makes: 'HTTP/n.n xxx Message' // byte count: 0123456789012 static const int minLength = 11; static const int dotPos = 6; static const int spacePos = 8; static const char httpMagic[] = "HTTP/"; if (status.length() < minLength || !status.startsWith(httpMagic) || status.at(dotPos) != '.' || status.at(spacePos) != ' ') { // I don't know how to parse this status line return false; } // optimize for the valid case: defer checking until the end majorVersion = status.at(dotPos - 1) - '0'; minorVersion = status.at(dotPos + 1) - '0'; int i = spacePos; int j = status.indexOf(' ', i + 1); // j == -1 || at(j) == ' ' so j+1 == 0 && j+1 <= length() const QByteArray code = status.mid(i + 1, j - i - 1); bool ok; statusCode = code.toInt(&ok); reasonPhrase = QString::fromLatin1(status.constData() + j + 1); return ok && uint(majorVersion) <= 9 && uint(minorVersion) <= 9; }
//读取数据 void MainWindow::readMyCom() { QByteArray temp = myCom->readAll(); if(!temp.isEmpty()){ if(write2fileName.isEmpty()){ ui->textBrowser->setTextColor(Qt::lightGray); ui->textBrowser->append(tr("接收: ")); ui->textBrowser->setTextColor(Qt::black); if(ui->ccradioButton->isChecked()){ ui->textBrowser->append(temp); }else if(ui->chradioButton->isChecked()){ ui->textBrowser->append(tr("")+temp.toHex()); }else{ ui->textBrowser->append(tr("")+temp.toInt()); } }else{ QFile file(write2fileName); //如果打开失败则给出提示并退出函数 if(!file.open(QFile::Append | QIODevice::Text)){ QMessageBox::warning(this, tr("写入文件"), tr("打开文件 %1 失败, 无法写入\n%2").arg(write2fileName).arg(file.errorString()), QMessageBox::Ok); return; } QTextStream out(&file); out<<temp<<endl; file.close(); ui->textBrowser->append(tr("接收:数据已经写入文件 %1").arg(write2fileName)); } ui->recvbyteslcdNumber->display(ui->recvbyteslcdNumber->value() + temp.size()); ui->statusBar->showMessage(tr("成功读取%1字节数据").arg(temp.size())); } }
static void QWebOSGLContext::initialize(EGLNativeDisplayType display) { EGLint major, minor; if (!eglBindAPI(EGL_OPENGL_ES_API)) { qWarning("Could not bind GL_ES API\n"); qFatal("EGL error"); } s_eglDisplay = eglGetDisplay(display); if (s_eglDisplay == EGL_NO_DISPLAY) qDebug() << "Could not open egl display\n"; if (!eglInitialize(s_eglDisplay, &major, &minor)) qDebug() << "Could not initialize egl display"; int swapInterval = 1; QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL"); if (!swapIntervalString.isEmpty()) { bool ok; swapInterval = swapIntervalString.toInt(&ok); if (!ok) swapInterval = 1; } eglSwapInterval(s_eglDisplay, swapInterval); }
void CGroupClient::cutMessageFromBuffer() { QByteArray rest; if (currentMessageLen == 0) { int index = buffer.indexOf(' '); if (index == -1) { print_debug(DEBUG_GROUP, "Incoming buffer contains broken message"); // zap the buffer in this case, and hope for the best buffer.clear(); return; } QByteArray len = buffer.left(index); currentMessageLen = len.toInt(); // print_debug(DEBUG_GROUP, "Incoming buffer length: %i, incoming message length %i", // buffer.size(), currentMessageLen); rest = buffer.right( buffer.size() - index - 1); buffer = rest; if (buffer.size() == currentMessageLen) cutMessageFromBuffer(); return; } // print_debug(DEBUG_GROUP, "cutting off one message case"); getParent()->incomingData(this, buffer.left(currentMessageLen)); rest = buffer.right( buffer.size() - currentMessageLen); buffer = rest; currentMessageLen = 0; }
void YouTube::resumeVideoUpload() { uploadRetries--; QByteArray rangeHeader = uploadReply->rawHeader("Range"); QByteArray startByte = rangeHeader.split('-').last(); QByteArray locationHeader = uploadReply->rawHeader("Location"); //qDebug() << rangeHeader << startByte << locationHeader; if (locationHeader.length() > 0) { uploadUrl = QUrl(locationHeader); } fileToBeUploaded->open(QIODevice::ReadOnly); int fs = fileToBeUploaded->size(); QByteArray fileSize = QByteArray::number(fs); QByteArray endByte = QByteArray::number(fs - 1); QByteArray range(startByte + '-' + endByte + '/' + fileSize); QNetworkRequest request(uploadUrl); request.setRawHeader("Host", "uploads.gdata.youtube.com"); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/octet-stream"); request.setHeader(QNetworkRequest::ContentLengthHeader, fs - startByte.toInt()); request.setRawHeader("Content-Range", range); uploadReply = nam->put(request, fileToBeUploaded); connect(uploadReply, SIGNAL(uploadProgress(qint64,qint64)), this, SIGNAL(updateUploadProgress(qint64,qint64))); connect(uploadReply, SIGNAL(finished()), this, SLOT(uploadFinished())); emit uploadStatusChanged("started"); }
/* ========================================================================== */ QVariant LispPlugin::read_from(QVariantList& tokenz) { if (tokenz.isEmpty()) throw runtime_error("unexpected EOF while reading"); QByteArray token = tokenz.takeFirst().toByteArray(); if (token == "(") { //auto L = QVariant(QVariant::List); QVariantList L; while (tokenz[0] != ")") L.append(read_from(tokenz)); tokenz.takeFirst(); // pop off ) return L; } else if (token == ")") { throw std::runtime_error("enexcepted )"); } else { bool successCast; auto i = token.toInt(&successCast); if (successCast) return i; auto d = token.toDouble(&successCast); if (successCast) return d; return QString(token); } }
static int getIntegerValue(const QString& path) { QByteArray data = getByteArray(path); if (data.size()) return data.toInt(); return 0; }
void QMinimalEglScreen::createAndSetPlatformContext() { QSurfaceFormat platformFormat; QByteArray depthString = qgetenv("QT_QPA_EGLFS_DEPTH"); if (depthString.toInt() == 16) { platformFormat.setDepthBufferSize(16); platformFormat.setRedBufferSize(5); platformFormat.setGreenBufferSize(6); platformFormat.setBlueBufferSize(5); m_depth = 16; m_format = QImage::Format_RGB16; } else { platformFormat.setDepthBufferSize(24); platformFormat.setStencilBufferSize(8); platformFormat.setRedBufferSize(8); platformFormat.setGreenBufferSize(8); platformFormat.setBlueBufferSize(8); m_depth = 32; m_format = QImage::Format_RGB32; } if (!qEnvironmentVariableIsEmpty("QT_QPA_EGLFS_MULTISAMPLE")) platformFormat.setSamples(4); EGLConfig config = q_configFromGLFormat(m_dpy, platformFormat); EGLNativeWindowType eglWindow = 0; #ifdef Q_OPENKODE if (kdInitializeNV() == KD_ENOTINITIALIZED) { qFatal("Did not manage to initialize openkode"); } KDWindow *window = kdCreateWindow(m_dpy,config,0); kdRealizeWindow(window,&eglWindow); #endif #ifdef QEGL_EXTRA_DEBUG q_printEglConfig(m_dpy, config); #endif m_surface = eglCreateWindowSurface(m_dpy, config, eglWindow, NULL); if (m_surface == EGL_NO_SURFACE) { qWarning("Could not create the egl surface: error = 0x%x\n", eglGetError()); eglTerminate(m_dpy); qFatal("EGL error"); } // qWarning("Created surface %dx%d\n", w, h); QEGLPlatformContext *platformContext = new QMinimalEglContext(platformFormat, 0, m_dpy); m_platformContext = platformContext; EGLint w,h; // screen size detection eglQuerySurface(m_dpy, m_surface, EGL_WIDTH, &w); eglQuerySurface(m_dpy, m_surface, EGL_HEIGHT, &h); m_geometry = QRect(0,0,w,h); }
static int thumbnailerMaxCost() { const QByteArray costEnv = qgetenv("NEMO_THUMBNAILER_CACHE_SIZE"); bool ok = false; int cost = costEnv.toInt(&ok); return ok ? cost : 1360 * 768 * 3; }
static int get_env_int(const char *name, int defaultValue) { QByteArray content = qgetenv(name); bool ok = false; int value = content.toInt(&ok); return ok ? value : defaultValue; }
int byte2int (QByteArray num){ bool ok; QByteArray tmp = num.mid(3,1).toHex().data(); tmp.append(num.mid(2,1).toHex().data()); tmp.append(num.mid(1,1).toHex().data()); tmp.append(num.mid(0,1).toHex().data()); return tmp.toInt(&ok,16); }
static QEglContext *createContext(QPaintDevice *device) { QEglContext *context; // Create the context object and open the display. context = new QEglContext(); context->setApi(QEgl::OpenVG); if (!context->openDisplay(device)) { delete context; return 0; } // Set the swap interval for the display. QByteArray interval = qgetenv("QT_VG_SWAP_INTERVAL"); if (!interval.isEmpty()) eglSwapInterval(context->display(), interval.toInt()); else eglSwapInterval(context->display(), 1); // Choose an appropriate configuration for rendering into the device. QEglProperties configProps; configProps.setPaintDeviceFormat(device); int redSize = configProps.value(EGL_RED_SIZE); if (redSize == EGL_DONT_CARE || redSize == 0) configProps.setPixelFormat(QImage::Format_ARGB32); // XXX #ifndef QVG_SCISSOR_CLIP // If we are using the mask to clip, then explicitly request a mask. configProps.setValue(EGL_ALPHA_MASK_SIZE, 1); #endif #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT | EGL_VG_ALPHA_FORMAT_PRE_BIT); configProps.setRenderableType(QEgl::OpenVG); if (!context->chooseConfig(configProps)) { // Try again without the "pre" bit. configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT); if (!context->chooseConfig(configProps)) { delete context; return 0; } } #else configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT | EGL_PBUFFER_BIT); configProps.setRenderableType(QEgl::OpenVG); if (!context->chooseConfig(configProps)) { delete context; return 0; } #endif // Construct a new EGL context for the selected configuration. if (!context->createContext()) { delete context; return 0; } return context; }
void HTTPConnection::readHeaders() { while (_socket->canReadLine()) { QByteArray line = _socket->readLine(); QByteArray trimmed = line.trimmed(); if (trimmed.isEmpty()) { _socket->disconnect(this, SLOT(readHeaders())); QByteArray clength = requestHeader("Content-Length"); if (clength.isEmpty()) { _parentManager->handleHTTPRequest(this, _requestUrl); } else { bool success = false; auto length = clength.toInt(&success); if (!success) { qWarning() << "Invalid header." << _address << trimmed; respond("400 Bad Request", "The header was malformed."); return; } // Storing big requests in memory gets expensive, especially on servers // with limited memory. So we store big requests in a temporary file on disk // and map it to faster read/write access. static const int MAX_CONTENT_SIZE_IN_MEMORY = 10 * 1000 * 1000; if (length < MAX_CONTENT_SIZE_IN_MEMORY) { _requestContent = MemoryStorage::make(length); } else { _requestContent = FileStorage::make(length); } connect(_socket, SIGNAL(readyRead()), SLOT(readContent())); // read any content immediately available readContent(); } return; } char first = line.at(0); if (first == ' ' || first == '\t') { // continuation _requestHeaders[_lastRequestHeader].append(trimmed); continue; } int idx = trimmed.indexOf(':'); if (idx == -1) { qWarning() << "Invalid header." << _address << trimmed; respond("400 Bad Request", "The header was malformed."); return; } _lastRequestHeader = trimmed.left(idx).toLower(); QByteArray& value = _requestHeaders[_lastRequestHeader]; if (!value.isEmpty()) { value.append(", "); } value.append(trimmed.mid(idx + 1).trimmed()); } }
bool Utility::fsCasePreserving() { #ifndef WITH_TESTING QByteArray env = qgetenv("OWNCLOUD_TEST_CASE_PRESERVING"); if (!env.isEmpty()) return env.toInt(); #endif return isWindows() || isMac(); }
void PdbEngine::handleBreakInsert(const PdbResponse &response) { //qDebug() << "BP RESPONSE: " << response.data; // "Breakpoint 1 at /pdb/math.py:10" BreakpointId id(response.cookie.toInt()); BreakHandler *handler = breakHandler(); QTC_ASSERT(response.data.startsWith("Breakpoint "), return); int pos1 = response.data.indexOf(" at "); QTC_ASSERT(pos1 != -1, return); QByteArray bpnr = response.data.mid(11, pos1 - 11); int pos2 = response.data.lastIndexOf(":"); QByteArray file = response.data.mid(pos1 + 4, pos2 - pos1 - 4); QByteArray line = response.data.mid(pos2 + 1); BreakpointResponse br; br.number = bpnr.toInt(); br.fileName = _(file); br.lineNumber = line.toInt(); handler->setResponse(id, br); }
void gui::PacketFromData (packet & p,QByteArray * data) { QVector <int> * poziceLomeno=new QVector <int> (0); int index=0; int pocatek=0; int flag=0; int options=0; QString receiver,sender ; QByteArray flagarray ,optionsarray ,receiverarray ,senderarray ,dataarray ; do { if (data->at (index)=='/') { poziceLomeno->append (index); index ++; index++; } else { index++; } } while (data->at (index)!='\0'); for (int poziceVector=0;poziceVector<poziceLomeno->size ();poziceVector++) { int lomeno=poziceLomeno->at (poziceVector); switch (poziceVector) { case 0: flagarray.append (data->left (lomeno)); p.flag=flagarray.toInt (); pocatek=lomeno+2; break; case 1: dataarray.append (data->mid (pocatek,lomeno-pocatek)); p.data.append (dataarray); pocatek=lomeno+2; break; case 2: receiver.append (data->mid (pocatek,lomeno-pocatek)); p.receiver.append (receiver); pocatek=lomeno+2; break; case 3: sender.append (data->mid (pocatek,lomeno-pocatek)); p.sender.append (sender); pocatek=lomeno+2; optionsarray.append (data->at (data->size ()-1)); p.options=optionsarray.toInt (); break; break; } } }
int KGameRenderer::frameCount(const QString& key) const { //ensure that some theme is loaded if (!d->m_currentTheme) { d->_k_setTheme(d->m_provider->currentTheme()); } //look up in in-process cache QHash<QString, int>::const_iterator it = d->m_frameCountCache.constFind(key); if (it != d->m_frameCountCache.constEnd()) { return it.value(); } //look up in shared cache (if SVG is not yet loaded) int count = -1; bool countFound = false; const QString cacheKey = d->m_frameCountPrefix + key; if (d->m_rendererPool.hasAvailableRenderers() && (d->m_strategies & KGameRenderer::UseDiskCache)) { QByteArray buffer; if (d->m_imageCache->find(cacheKey, &buffer)) { count = buffer.toInt(); countFound = true; } } //determine from SVG if (!countFound) { QSvgRenderer* renderer = d->m_rendererPool.allocRenderer(); //look for animated sprite first count = d->m_frameBaseIndex; while (renderer->elementExists(d->spriteFrameKey(key, count, false))) { ++count; } count -= d->m_frameBaseIndex; //look for non-animated sprite instead if (count == 0) { if (!renderer->elementExists(key)) { count = -1; } } d->m_rendererPool.freeRenderer(renderer); //save in shared cache for following requests if (d->m_strategies & KGameRenderer::UseDiskCache) { d->m_imageCache->insert(cacheKey, QByteArray::number(count)); } } d->m_frameCountCache.insert(key, count); return count; }
void Moc::parseSignals(ClassDef *def) { int defaultRevision = -1; if (test(Q_REVISION_TOKEN)) { next(LPAREN); QByteArray revision = lexemUntil(RPAREN); revision.remove(0, 1); revision.chop(1); bool ok = false; defaultRevision = revision.toInt(&ok); if (!ok || defaultRevision < 0) error("Invalid revision"); } next(COLON); while (inClass(def) && hasNext()) { switch (next()) { case PUBLIC: case PROTECTED: case PRIVATE: case Q_SIGNALS_TOKEN: case Q_SLOTS_TOKEN: prev(); return; case SEMIC: continue; case FRIEND: until(SEMIC); continue; case USING: error("'using' directive not supported in 'signals' section"); default: prev(); } FunctionDef funcDef; funcDef.access = FunctionDef::Protected; parseFunction(&funcDef); if (funcDef.isVirtual) warning("Signals cannot be declared virtual"); if (funcDef.inlineCode) error("Not a signal declaration"); if (funcDef.revision > 0) { ++def->revisionedMethods; } else if (defaultRevision != -1) { funcDef.revision = defaultRevision; ++def->revisionedMethods; } def->signalList += funcDef; while (funcDef.arguments.size() > 0 && funcDef.arguments.last().isDefault) { funcDef.wasCloned = true; funcDef.arguments.removeLast(); def->signalList += funcDef; } } }