void KDir::updateFiltered() { myFilteredNames.clear(); myFilteredEntries.clear(); if (myDirtyFlag) { myTmpEntries.clear(); myEntries.clear(); if (isBlocking) getEntries(); else startLoading(); } else { for (KFileInfo *i= myEntries.first(); i; i=myEntries.next()) { if (filterEntry(i)) { KFileInfo *fi= new KFileInfo(*i); CHECK_PTR(fi); myFilteredEntries.append(fi); myFilteredNames.append(fi->fileName()); } } } }
ExceptionOr<String> FileReaderSync::startLoadingString(ScriptExecutionContext& scriptExecutionContext, FileReaderLoader& loader, Blob& blob) { auto result = startLoading(scriptExecutionContext, loader, blob); if (result.hasException()) return result.releaseException(); return loader.stringResult(); }
LoadingDialog::LoadingDialog(QWidget *parent) : BaseStyleWidget(parent) { //this->setFixedSize(900, 400); //设置透明度 this->setWindowOpacity(0.8); //设置背景色为淡蓝色 this->setStyleSheet("background-color: white;"); //取消对话框标题 this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint); label = new QLabel; label->setStyleSheet("background-color: transparent;"); tip_label = new QLabel; translateLanguage(); label->setFixedSize(140, 140); movie = new QMovie(":/img/loading"); label->setScaledContents(true); label->setMovie(movie); QVBoxLayout *mainlayout = new QVBoxLayout; mainlayout->addWidget(label, 0, Qt::AlignCenter); mainlayout->addWidget(tip_label, 0, Qt::AlignCenter); mainlayout->setContentsMargins(0,80,0,100); this->setLayout(mainlayout); index = 0; timer = new QTimer(); connect(timer, SIGNAL(timeout()), this, SLOT(changeText())); startLoading(); }
ExceptionOr<RefPtr<ArrayBuffer>> FileReaderSync::readAsArrayBuffer(ScriptExecutionContext& scriptExecutionContext, Blob& blob) { FileReaderLoader loader(FileReaderLoader::ReadAsArrayBuffer, 0); auto result = startLoading(scriptExecutionContext, loader, blob); if (result.hasException()) return result.releaseException(); return loader.arrayBufferResult(); }
void ActionWidget::startLoad() { QString fileName = "/home/rayman/Downloads/anakinHand/gui/action/actionFiles/" + ui->comboBox->currentText(); ui->isLoadedCheckBox->setChecked(true); emit startLoading(fileName); }
String FileReaderSync::readAsBinaryString(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec) { if (!blob) { ec = NOT_FOUND_ERR; return String(); } FileReaderLoader loader(FileReaderLoader::ReadAsBinaryString, 0); startLoading(scriptExecutionContext, loader, blob, ec); return loader.stringResult(); }
String FileReaderSync::readAsBinaryString(ExecutionContext* executionContext, Blob* blob, ExceptionState& exceptionState) { if (!blob) { exceptionState.throwDOMException(NotFoundError, FileError::notFoundErrorMessage); return String(); } FileReaderLoader loader(FileReaderLoader::ReadAsBinaryString, 0); startLoading(executionContext, loader, *blob, exceptionState); return loader.stringResult(); }
bool GameLogo::init() { if (!Layer::init()) { return false; } //init startLoading(); return true; }
PassRefPtr<ArrayBuffer> FileReaderSync::readAsArrayBuffer(ExecutionContext* executionContext, Blob* blob, ExceptionState& exceptionState) { if (!blob) { exceptionState.throwDOMException(NotFoundError, FileError::notFoundErrorMessage); return 0; } FileReaderLoader loader(FileReaderLoader::ReadAsArrayBuffer, 0); startLoading(executionContext, loader, *blob, exceptionState); return loader.arrayBufferResult(); }
PassRefPtr<ArrayBuffer> FileReaderSync::readAsArrayBuffer(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec) { if (!blob) { ec = NOT_FOUND_ERR; return 0; } FileReaderLoader loader(FileReaderLoader::ReadAsArrayBuffer, 0); startLoading(scriptExecutionContext, loader, blob, ec); return loader.arrayBufferResult(); }
String FileReaderSync::readAsDataURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob, ExceptionCode& ec) { if (!blob) { ec = NOT_FOUND_ERR; return String(); } FileReaderLoader loader(FileReaderLoader::ReadAsDataURL, 0); loader.setDataType(blob->type()); startLoading(scriptExecutionContext, loader, blob, ec); return loader.stringResult(); }
String FileReaderSync::readAsText(ScriptExecutionContext* scriptExecutionContext, Blob* blob, const String& encoding, ExceptionCode& ec) { if (!blob) { ec = NOT_FOUND_ERR; return String(); } FileReaderLoader loader(FileReaderLoader::ReadAsText, 0); loader.setEncoding(encoding); startLoading(scriptExecutionContext, loader, blob, ec); return loader.stringResult(); }
int ICACHE_FLASH_ATTR cgiPropLoadFile(HttpdConnData *connData) { PropellerConnection *connection = &myConnection; char fileName[128]; int fileSize = 0; // check for the cleanup call if (connData->conn == NULL) { if (connection->file) { roffs_close(connection->file); connection->file = NULL; } return HTTPD_CGI_DONE; } if (connection->state != stIdle) { char buf[128]; os_sprintf(buf, "Transfer already in progress: state %s\r\n", stateName(connection->state)); httpdSendResponse(connData, 400, buf, -1); return HTTPD_CGI_DONE; } connData->cgiData = connection; connection->connData = connData; os_timer_setfn(&connection->timer, timerCallback, connection); if (httpdFindArg(connData->getArgs, "file", fileName, sizeof(fileName)) < 0) { httpdSendResponse(connData, 400, "Missing file argument\r\n", -1); return HTTPD_CGI_DONE; } if (!(connection->file = roffs_open(fileName))) { httpdSendResponse(connData, 400, "File not found\r\n", -1); return HTTPD_CGI_DONE; } fileSize = roffs_file_size(connection->file); if (!getIntArg(connData, "baud-rate", &connection->baudRate)) connection->baudRate = flashConfig.loader_baud_rate; if (!getIntArg(connData, "final-baud-rate", &connection->finalBaudRate)) connection->finalBaudRate = flashConfig.baud_rate; if (!getIntArg(connData, "reset-pin", &connection->resetPin)) connection->resetPin = flashConfig.reset_pin; DBG("load-file: file %s, size %d, baud-rate %d, final-baud-rate %d, reset-pin %d\n", fileName, fileSize, connection->baudRate, connection->finalBaudRate, connection->resetPin); startLoading(connection, NULL, fileSize); return HTTPD_CGI_MORE; }
int ICACHE_FLASH_ATTR cgiPropLoad(HttpdConnData *connData) { PropellerConnection *connection = &myConnection; // check for the cleanup call if (connData->conn == NULL) return HTTPD_CGI_DONE; if (connection->state != stIdle) { char buf[128]; os_sprintf(buf, "Transfer already in progress: state %s\r\n", stateName(connection->state)); httpdSendResponse(connData, 400, buf, -1); return HTTPD_CGI_DONE; } connData->cgiData = connection; connection->connData = connData; os_timer_setfn(&connection->timer, timerCallback, connection); if (connData->post->len == 0) { httpdSendResponse(connData, 400, "No data\r\n", -1); abortLoading(connection); return HTTPD_CGI_DONE; } else if (connData->post->buffLen != connData->post->len) { httpdSendResponse(connData, 400, "Data too large\r\n", -1); return HTTPD_CGI_DONE; } if (!getIntArg(connData, "baud-rate", &connection->baudRate)) connection->baudRate = flashConfig.loader_baud_rate; if (!getIntArg(connData, "final-baud-rate", &connection->finalBaudRate)) connection->finalBaudRate = flashConfig.baud_rate; if (!getIntArg(connData, "reset-pin", &connection->resetPin)) connection->resetPin = flashConfig.reset_pin; if (!getIntArg(connData, "response-size", &connection->responseSize)) connection->responseSize = 0; if (!getIntArg(connData, "response-timeout", &connection->responseTimeout)) connection->responseTimeout = 1000; DBG("load: size %d, baud-rate %d, final-baud-rate %d, reset-pin %d\n", connData->post->buffLen, connection->baudRate, connection->finalBaudRate, connection->resetPin); if (connection->responseSize > 0) DBG(" responseSize %d, responseTimeout %d\n", connection->responseSize, connection->responseTimeout); connection->file = NULL; startLoading(connection, (uint8_t *)connData->post->buff, connData->post->buffLen); return HTTPD_CGI_MORE; }
AllMusic::AllMusic(void) : m_numPcs(0), m_numLoaded(0), m_metadata_loader(NULL), m_done_loading(false), m_last_listed(-1), m_playcountMin(0), m_playcountMax(0), m_lastplayMin(0.0), m_lastplayMax(0.0) { // Start a thread to do data loading and sorting startLoading(); }
void Notification::show() { #if PLATFORM(QT) if (iconURL().isEmpty()) { // Set the state before actually showing, because // handling of ondisplay may rely on that. if (m_state == Idle) { m_state = Showing; if (m_notificationCenter->presenter()) m_notificationCenter->presenter()->show(this); } } else startLoading(); #else // prevent double-showing if (m_state == Idle && m_notificationCenter->presenter() && m_notificationCenter->presenter()->show(this)) m_state = Showing; #endif }
AllMusic::AllMusic(QString path_assignment, QString a_startdir) { m_startdir = a_startdir; m_done_loading = false; m_numPcs = m_numLoaded = 0; m_cd_title = QObject::tr("CD -- none"); // How should we sort? setSorting(path_assignment); m_root_node = new MusicNode(QObject::tr("All My Music"), m_paths); // // Start a thread to do data // loading and sorting // m_metadata_loader = NULL; startLoading(); m_last_listed = -1; }
/* Replay the append log file. On error REDIS_OK is returned. On non fatal * error (the append only file is zero-length) REDIS_ERR is returned. On * fatal error an error message is logged and the program exists. */ int loadAppendOnlyFile(char *filename) { struct redisClient *fakeClient; FILE *fp = fopen(filename,"r"); struct redis_stat sb; int old_aof_state = server.aof_state; long loops = 0; if (fp && redis_fstat(fileno(fp),&sb) != -1 && sb.st_size == 0) { server.aof_current_size = 0; fclose(fp); return REDIS_ERR; } if (fp == NULL) { redisLog(REDIS_WARNING,"Fatal error: can't open the append log file for reading: %s",strerror(errno)); exit(1); } /* Temporarily disable AOF, to prevent EXEC from feeding a MULTI * to the same file we're about to read. */ server.aof_state = REDIS_AOF_OFF; fakeClient = createFakeClient(); startLoading(fp); while(1) { int argc, j; unsigned long len; robj **argv; char buf[128]; sds argsds; struct redisCommand *cmd; /* Serve the clients from time to time */ if (!(loops++ % 1000)) { loadingProgress(ftello(fp)); processEventsWhileBlocked(); } if (fgets(buf,sizeof(buf),fp) == NULL) { if (feof(fp)) break; else goto readerr; } if (buf[0] != '*') goto fmterr; if (buf[1] == '\0') goto readerr; argc = atoi(buf+1); if (argc < 1) goto fmterr; argv = zmalloc(sizeof(robj*)*argc); fakeClient->argc = argc; fakeClient->argv = argv; for (j = 0; j < argc; j++) { if (fgets(buf,sizeof(buf),fp) == NULL) { fakeClient->argc = j; /* Free up to j-1. */ freeFakeClientArgv(fakeClient); goto readerr; } if (buf[0] != '$') goto fmterr; len = strtol(buf+1,NULL,10); argsds = sdsnewlen(NULL,len); if (len && fread(argsds,len,1,fp) == 0) { sdsfree(argsds); fakeClient->argc = j; /* Free up to j-1. */ freeFakeClientArgv(fakeClient); goto readerr; } argv[j] = createObject(REDIS_STRING,argsds); if (fread(buf,2,1,fp) == 0) { fakeClient->argc = j+1; /* Free up to j. */ freeFakeClientArgv(fakeClient); goto readerr; /* discard CRLF */ } } /* Command lookup */ cmd = lookupCommand(argv[0]->ptr); if (!cmd) { redisLog(REDIS_WARNING,"Unknown command '%s' reading the append only file", (char*)argv[0]->ptr); exit(1); } /* Run the command in the context of a fake client */ cmd->proc(fakeClient); /* The fake client should not have a reply */ redisAssert(fakeClient->bufpos == 0 && listLength(fakeClient->reply) == 0); /* The fake client should never get blocked */ redisAssert((fakeClient->flags & REDIS_BLOCKED) == 0); /* Clean up. Command code may have changed argv/argc so we use the * argv/argc of the client instead of the local variables. */ freeFakeClientArgv(fakeClient); } /* This point can only be reached when EOF is reached without errors. * If the client is in the middle of a MULTI/EXEC, log error and quit. */ if (fakeClient->flags & REDIS_MULTI) goto uxeof; loaded_ok: /* DB loaded, cleanup and return REDIS_OK to the caller. */ fclose(fp); freeFakeClient(fakeClient); server.aof_state = old_aof_state; stopLoading(); aofUpdateCurrentSize(); server.aof_rewrite_base_size = server.aof_current_size; return REDIS_OK; readerr: /* Read error. If feof(fp) is true, fall through to unexpected EOF. */ if (!feof(fp)) { redisLog(REDIS_WARNING,"Unrecoverable error reading the append only file: %s", strerror(errno)); exit(1); } uxeof: /* Unexpected AOF end of file. */ if (server.aof_load_truncated) { redisLog(REDIS_WARNING,"!!! Warning: short read while loading the AOF file !!!"); redisLog(REDIS_WARNING, "AOF loaded anyway because aof-load-truncated is enabled"); goto loaded_ok; } redisLog(REDIS_WARNING,"Unexpected end of file reading the append only file. You can: 1) Make a backup of your AOF file, then use ./redis-check-aof --fix <filename>. 2) Alternatively you can set the 'aof-load-truncated' configuration option to yes and restart the server."); exit(1); fmterr: /* Format error. */ redisLog(REDIS_WARNING,"Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>"); exit(1); }
void FileLoader::start(bool loadFirst, bool prior) { if (_paused) { _paused = false; } if (_complete || tryLoadLocal()) return; if (_fromCloud == LoadFromLocalOnly) { cancel(); return; } if (!_fname.isEmpty() && _toCache == LoadToFileOnly && !_fileIsOpen) { _fileIsOpen = _file.open(QIODevice::WriteOnly); if (!_fileIsOpen) { return cancel(true); } } FileLoader *before = 0, *after = 0; if (prior) { if (_inQueue && _priority == GlobalPriority) { if (loadFirst) { if (!_prev) return startLoading(loadFirst, prior); before = _queue->start; } else { if (!_next || _next->_priority < GlobalPriority) return startLoading(loadFirst, prior); after = _next; while (after->_next && after->_next->_priority == GlobalPriority) { after = after->_next; } } } else { _priority = GlobalPriority; if (loadFirst) { if (_inQueue && !_prev) return startLoading(loadFirst, prior); before = _queue->start; } else { if (_inQueue) { if (_next && _next->_priority == GlobalPriority) { after = _next; } else if (_prev && _prev->_priority < GlobalPriority) { before = _prev; while (before->_prev && before->_prev->_priority < GlobalPriority) { before = before->_prev; } } else { return startLoading(loadFirst, prior); } } else { if (_queue->start && _queue->start->_priority == GlobalPriority) { after = _queue->start; } else { before = _queue->start; } } if (after) { while (after->_next && after->_next->_priority == GlobalPriority) { after = after->_next; } } } } } else { if (loadFirst) { if (_inQueue && (!_prev || _prev->_priority == GlobalPriority)) return startLoading(loadFirst, prior); before = _prev; while (before->_prev && before->_prev->_priority != GlobalPriority) { before = before->_prev; } } else { if (_inQueue && !_next) return startLoading(loadFirst, prior); after = _queue->end; } } removeFromQueue(); _inQueue = true; if (!_queue->start) { _queue->start = _queue->end = this; } else if (before) { if (before != _next) { _prev = before->_prev; _next = before; _next->_prev = this; if (_prev) { _prev->_next = this; } if (_queue->start->_prev) _queue->start = _queue->start->_prev; } } else if (after) { if (after != _prev) { _next = after->_next; _prev = after; after->_next = this; if (_next) { _next->_prev = this; } if (_queue->end->_next) _queue->end = _queue->end->_next; } } else { LOG(("Queue Error: _start && !before && !after")); } return startLoading(loadFirst, prior); }
Action::ResultE ProxyGroup::render(Action *action) { DrawActionBase *da = dynamic_cast<DrawActionBase *>(action); if(getEnabled() == false) return Action::Continue; if(getState() == NOT_LOADED) startLoading(); if(getState() == LOAD_THREAD_FINISHED) { if(_loadedRoot != NULL) { _loadThread = NULL; setRoot(_loadedRoot); getRoot()->invalidateVolume(); getRoot()->updateVolume(); setState(LOADED); da->getActNode()->invalidateVolume(); da->getActNode()->updateVolume (); } else { SWARNING << "failed to load " << getAbsoluteUrl() << std::endl; setState(LOAD_ERROR); } } if(getState() == LOADED) { da->useNodeList(); if(da->isVisible(getCPtr(getRoot()))) da->addNode(getRoot()); } else { if(da->getActNode()->getNChildren() == 0) { Color3f col; col.setValuesRGB(.5,.3,0); dropVolume(da, da->getActNode(), col); } } // thread cleanup if(_loadThread && _loadQueue.empty()) { printf("join\n"); BaseThread::join(_loadThread); _loadThread = NULL; } return Action::Continue; }
/* Replay the append log file. On error REDIS_OK is returned. On non fatal * error (the append only file is zero-length) REDIS_ERR is returned. On * fatal error an error message is logged and the program exists. */ int loadAppendOnlyFile(char *filename) { struct redisClient *fakeClient; FILE *fp = fopen(filename,"r"); struct redis_stat sb; int old_aof_state = server.aof_state; long loops = 0; if (fp && redis_fstat(fileno(fp),&sb) != -1 && sb.st_size == 0) { server.aof_current_size = 0; fclose(fp); return REDIS_ERR; } if (fp == NULL) { redisLog(REDIS_WARNING,"Fatal error: can't open the append log file for reading: %s",strerror(errno)); exit(1); } /* Temporarily disable AOF, to prevent EXEC from feeding a MULTI * to the same file we're about to read. */ server.aof_state = REDIS_AOF_OFF; fakeClient = createFakeClient(); startLoading(fp); while(1) { int argc, j; unsigned long len; robj **argv; char buf[128]; sds argsds; struct redisCommand *cmd; /* Serve the clients from time to time */ if (!(loops++ % 1000)) { loadingProgress(ftello(fp)); aeProcessEvents(server.el, AE_FILE_EVENTS|AE_DONT_WAIT); } if (fgets(buf,sizeof(buf),fp) == NULL) { if (feof(fp)) break; else goto readerr; } if (buf[0] != '*') goto fmterr; argc = atoi(buf+1); if (argc < 1) goto fmterr; argv = zmalloc(sizeof(robj*)*argc); for (j = 0; j < argc; j++) { if (fgets(buf,sizeof(buf),fp) == NULL) goto readerr; if (buf[0] != '$') goto fmterr; len = strtol(buf+1,NULL,10); argsds = sdsnewlen(NULL,len); if (len && fread(argsds,len,1,fp) == 0) goto fmterr; argv[j] = createObject(REDIS_STRING,argsds); if (fread(buf,2,1,fp) == 0) goto fmterr; /* discard CRLF */ } /* Command lookup */ cmd = lookupCommand(argv[0]->ptr); if (!cmd) { redisLog(REDIS_WARNING,"Unknown command '%s' reading the append only file", argv[0]->ptr); exit(1); } /* Run the command in the context of a fake client */ fakeClient->argc = argc; fakeClient->argv = argv; cmd->proc(fakeClient); /* The fake client should not have a reply */ redisAssert(fakeClient->bufpos == 0 && listLength(fakeClient->reply) == 0); /* The fake client should never get blocked */ redisAssert((fakeClient->flags & REDIS_BLOCKED) == 0); /* Clean up. Command code may have changed argv/argc so we use the * argv/argc of the client instead of the local variables. */ for (j = 0; j < fakeClient->argc; j++) decrRefCount(fakeClient->argv[j]); zfree(fakeClient->argv); } /* This point can only be reached when EOF is reached without errors. * If the client is in the middle of a MULTI/EXEC, log error and quit. */ if (fakeClient->flags & REDIS_MULTI) goto readerr; fclose(fp); freeFakeClient(fakeClient); server.aof_state = old_aof_state; stopLoading(); aofUpdateCurrentSize(); server.aof_rewrite_base_size = server.aof_current_size; return REDIS_OK; readerr: if (feof(fp)) { redisLog(REDIS_WARNING,"Unexpected end of file reading the append only file"); } else { redisLog(REDIS_WARNING,"Unrecoverable error reading the append only file: %s", strerror(errno)); } exit(1); fmterr: redisLog(REDIS_WARNING,"Bad file format reading the append only file: make a backup of your AOF file, then use ./redis-check-aof --fix <filename>"); exit(1); }
void MainWindow::initMainWindow() { setWindowTitle("Grabber Remote GUI"); video_mode_labels << "160x120 YUV444" << "320x240 YUV422" << "640x480 YUV411" << "640x480 YUV422" << "640x480 RGB8" << "640x480 MONO8" << "640x480 MONO16" << "800x600 YUV422" << "800x600 RGB8" << "800x600_MONO8" << "1024x768 YUV422" << "1024x768 RGB8" << "1024x768 MONO8" << "800x600 MONO16" << "1024x768 MONO16" << "1280x960 YUV422" << "1280x960 RGB8" << "1280x960_MONO8" << "1600x1200 YUV422" << "1600x1200 RGB8" << "1600x1200 MONO8" << "1280x960 MONO16" << "1600x1200_MONO16" << "EXIF" << "FORMAT7 0" << "FORMAT7 1" << "FORMAT7 2" << "FORMAT7 3" << "FORMAT7 4" << "FORMAT7 5" << "FORMAT7 6" << "FORMAT7 7"; video_rate_labels << "1.875 fps" << "3.75 fps" << "7.5 fps" << "15 fps" << "30 fps" << "60 fps" << "120 fps" <<"240 fps"; color_coding_labels << "MONO8" << "YUV411" << "YUV422" << "YUV444" << "RGB8" << "MONO16" << "RGB16" << "MONO16S" << "RGB16S" << "RAW8" << "RAW16"; iso_speed_labels << "100 Mbps" << "200 Mbps" << "400 Mbps" << "800 Mbps" << "1600 Mbps" << "3200 Mbps"; op_mode_labels << "LEGACY" << "1394b"; connect(ui->btnRefresh1,SIGNAL(clicked()),this,SLOT(onReloadClicked())); connect(ui->btnRefresh2,SIGNAL(clicked()),this,SLOT(onReloadClicked())); connect(&dc1394Thread,SIGNAL(initFormatTabDone(uint,uint,uint)), this,SLOT(initFormatTab(uint,uint,uint)),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(initDone(uint,uint,uint,bool,uint,QSize,QSize,QSize,QSize,QSize,uint,bool)), this,SLOT(Init(uint,uint,uint,bool,uint,QSize,QSize,QSize,QSize,QSize,uint,bool)),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(reloadDone(uint,uint,QSize,QSize,QSize,QSize,QSize,uint,uint,uint,uint,uint)), this,SLOT(Reload(uint,uint,QSize,QSize,QSize,QSize,QSize,uint,uint,uint,uint,uint)),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(loadDefaultDone(uint,uint,bool)), this,SLOT(loadDefault(uint,uint,bool)),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(resetDone(uint,uint,bool)), this,SLOT(reset(uint,uint,bool)),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(setTransmissionDC1394Done()), this,SLOT(onTransmissionOnoffDone()),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(setPowerDC1394Done()), this,SLOT(onPowerOnoffDone()),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(setFormat7WindowDC1394Done()), this,SLOT(onFormat7WindowDone()),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(setVideoModeDC1394Done()), this,SLOT(onVideoFormatCurrentDone()),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(setColorCodingDC1394Done()), this,SLOT(onColorCodingDone()),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(setFPSDC1394Done()), this,SLOT(onFramerateDone()),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(setISOSpeedDC1394Done()), this,SLOT(onISOSpeedDone()),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(setBytesPerPacketDC1394Done()), this,SLOT(onSizeByteDone()),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(setOperationModeDC1394Done()), this,SLOT(onOpModeDone()),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(startLoading()), this,SLOT(onStartLoading()),Qt::QueuedConnection); connect(&dc1394Thread,SIGNAL(stopLoading()), this,SLOT(onStopLoading()),Qt::QueuedConnection); dc1394Thread.start(); m_pSli.append(ui->sliderSharpness); m_pSli.append(ui->sliderHue); m_pSli.append(ui->sliderSaturation); m_pSli.append(ui->sliderGamma); m_pSli.append(ui->sliderIris); m_pSli.append(ui->sliderFocus); m_pSli.append(ui->sliderShutter); m_pSli.append(ui->sliderBrightness); m_pSli.append(ui->sliderGain); m_pSli.append(ui->sliderExposure); m_pSli.append(ui->sliderWB); for(int i=0;i<m_pSli.count();i++){ connect(((DC1394SliderBase*)m_pSli.at(i)),SIGNAL(featureDisabled(QObject*)), this,SLOT(onSliderDisabled(QObject *)),Qt::QueuedConnection); } }
void LoadVideoThread::run() { QTimer::singleShot(0, this, SLOT(startLoading())); exec(); }
void MainWindow::init(AnyOption *opts) { cmdopts = opts; if (cmdopts->getValue("config") || cmdopts->getValue('c')) { qDebug(">> Config option in command prompt..."); QString cfgPath = cmdopts->getValue('c'); if (cfgPath.isEmpty()) { cfgPath = cmdopts->getValue("config"); } loadSettings(cfgPath); } else { loadSettings(QString("")); } if (mainSettings->value("signals/enable").toBool()) { connect(handler, SIGNAL(sigUSR1()), SLOT(unixSignalUsr1())); connect(handler, SIGNAL(sigUSR2()), SLOT(unixSignalUsr2())); } handler->start(); setMinimumWidth(320); setMinimumHeight(200); quint16 minimalWidth = mainSettings->value("view/minimal-width").toUInt(); quint16 minimalHeight = mainSettings->value("view/minimal-height").toUInt(); if (minimalWidth) { setMinimumWidth(minimalWidth); } if (minimalHeight) { setMinimumHeight(minimalHeight); } hiddenCurdor = new QCursor(Qt::BlankCursor); qDebug() << "Application icon: " << mainSettings->value("application/icon").toString(); setWindowIcon(QIcon( mainSettings->value("application/icon").toString() )); if (cmdopts->getValue("uri") || cmdopts->getValue('u')) { qDebug(">> Uri option in command prompt..."); QString uri = cmdopts->getValue('u'); if (uri.isEmpty()) { uri = cmdopts->getValue("uri"); } mainSettings->setValue("browser/homepage", uri); } QCoreApplication::setOrganizationName( mainSettings->value("application/organization").toString() ); QCoreApplication::setOrganizationDomain( mainSettings->value("application/organization-domain").toString() ); QCoreApplication::setApplicationName( mainSettings->value("application/name").toString() ); QCoreApplication::setApplicationVersion( mainSettings->value("application/version").toString() ); // --- Network --- // if (mainSettings->value("proxy/enable").toBool()) { bool system = mainSettings->value("proxy/system").toBool(); if (system) { QNetworkProxyFactory::setUseSystemConfiguration(system); } else { QNetworkProxy proxy; proxy.setType(QNetworkProxy::HttpProxy); proxy.setHostName( mainSettings->value("proxy/host").toString() ); proxy.setPort(mainSettings->value("proxy/port").toUInt()); if (mainSettings->value("proxy/auth").toBool()) { proxy.setUser(mainSettings->value("proxy/username").toString()); proxy.setPassword(mainSettings->value("proxy/password").toString()); } QNetworkProxy::setApplicationProxy(proxy); } } // --- Web View --- // view = new WebView(this); if (mainSettings->value("view/show_load_progress").toBool()) { // --- Progress Bar --- // loadProgress = new QProgressBar(view); loadProgress->setContentsMargins(2, 2, 2, 2); loadProgress->setMinimumWidth(100); loadProgress->setMinimumHeight(16); loadProgress->setFixedHeight(16); loadProgress->setAutoFillBackground(true); QPalette palette = this->palette(); palette.setColor(QPalette::Window, QColor(255,255,255,63)); loadProgress->setPalette(palette); // Do not work... Need Layout... loadProgress->setAlignment(Qt::AlignTop); loadProgress->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); loadProgress->hide(); } setCentralWidget(view); view->setSettings(mainSettings); view->setPage(new QWebPage(view)); // --- Disk cache --- // if (mainSettings->value("cache/enable").toBool()) { diskCache = new QNetworkDiskCache(this); QString location = mainSettings->value("cache/location").toString(); if (!location.length()) { #ifdef QT5 location = QStandardPaths::writableLocation(QStandardPaths::CacheLocation); #else location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation); #endif } diskCache->setCacheDirectory(location); diskCache->setMaximumCacheSize(mainSettings->value("cache/size").toUInt()); if (mainSettings->value("cache/clear-on-start").toBool()) { diskCache->clear(); } else if (cmdopts->getFlag('C') || cmdopts->getFlag("clear-cache")) { diskCache->clear(); } CachingNetworkManager *nm = new CachingNetworkManager(); nm->setCache(diskCache); view->page()->setNetworkAccessManager(nm); } if (mainSettings->value("browser/cookiejar").toBool()) { view->page()->networkAccessManager()->setCookieJar(new PersistentCookieJar()); } view->settings()->setAttribute(QWebSettings::JavascriptEnabled, mainSettings->value("browser/javascript").toBool() ); view->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, mainSettings->value("browser/javascript_can_open_windows").toBool() ); view->settings()->setAttribute(QWebSettings::JavascriptCanCloseWindows, mainSettings->value("browser/javascript_can_close_windows").toBool() ); view->settings()->setAttribute(QWebSettings::WebGLEnabled, mainSettings->value("browser/webgl").toBool() ); view->settings()->setAttribute(QWebSettings::JavaEnabled, mainSettings->value("browser/java").toBool() ); view->settings()->setAttribute(QWebSettings::PluginsEnabled, mainSettings->value("browser/plugins").toBool() ); if (mainSettings->value("inspector/enable").toBool()) { view->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true); inspector = new QWebInspector(); inspector->setVisible(mainSettings->value("inspector/visible").toBool()); inspector->setMinimumSize(800, 600); inspector->setWindowTitle(mainSettings->value("application/name").toString() + " - WebInspector"); inspector->setWindowIcon(this->windowIcon()); inspector->setPage(view->page()); } connect(view, SIGNAL(titleChanged(QString)), SLOT(adjustTitle())); connect(view, SIGNAL(loadStarted()), SLOT(startLoading())); connect(view, SIGNAL(urlChanged(const QUrl &)), SLOT(urlChanged(const QUrl &))); connect(view, SIGNAL(loadProgress(int)), SLOT(setProgress(int))); connect(view, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool))); connect(view, SIGNAL(iconChanged()), SLOT(pageIconLoaded())); QDesktopWidget *desktop = QApplication::desktop(); connect(desktop, SIGNAL(resized(int)), SLOT(desktopResized(int))); // Window show, start events loop show(); view->page()->view()->setFocusPolicy(Qt::StrongFocus); view->setFocusPolicy(Qt::StrongFocus); if (mainSettings->value("view/hide_mouse_cursor").toBool()) { QApplication::setOverrideCursor(Qt::BlankCursor); view->setCursor(*hiddenCurdor); } int delay_resize = 0; if (mainSettings->value("view/startup_resize_delayed").toBool()) { delay_resize = mainSettings->value("view/startup_resize_delay").toInt(); } delayedResize->singleShot(delay_resize, this, SLOT(delayedWindowResize())); int delay_load = 0; if (mainSettings->value("browser/startup_load_delayed").toBool()) { delay_load = mainSettings->value("browser/startup_load_delay").toInt(); } delayedLoad->singleShot(delay_load, this, SLOT(delayedPageLoad())); }
int webPage::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: loading((*reinterpret_cast< QString(*)>(_a[1]))); break; case 1: isLoading((*reinterpret_cast< QPixmap(*)>(_a[1]))); break; case 2: titleChanged((*reinterpret_cast< QString(*)>(_a[1]))); break; case 3: pageChanged((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break; case 4: showSources((*reinterpret_cast< QString(*)>(_a[1]))); break; case 5: speedDial(); break; case 6: needPrint((*reinterpret_cast< QPrinter*(*)>(_a[1]))); break; case 7: openTab((*reinterpret_cast< webPage*(*)>(_a[1]))); break; case 8: setFullScreen((*reinterpret_cast< bool(*)>(_a[1]))); break; case 9: startLoading(); break; case 10: finishLoading((*reinterpret_cast< bool(*)>(_a[1]))); break; case 11: changeTitle((*reinterpret_cast< QString(*)>(_a[1]))); break; case 12: changeUrl((*reinterpret_cast< QUrl(*)>(_a[1]))); break; case 13: goToHome(); break; case 14: loadUrl(); break; case 15: loadUrl((*reinterpret_cast< QUrl(*)>(_a[1]))); break; case 16: loadUrl((*reinterpret_cast< QString(*)>(_a[1]))); break; case 17: addToBookMark(); break; case 18: downloadFile((*reinterpret_cast< const QNetworkRequest(*)>(_a[1]))); break; case 19: downloadFile((*reinterpret_cast< QNetworkReply*(*)>(_a[1]))); break; case 20: loadBookMark(); break; case 21: showBookMark(); break; case 22: sources(); break; case 23: defineHome(); break; case 24: findNext(); break; case 25: findPrevious(); break; case 26: print(); break; case 27: createNewPage((*reinterpret_cast< WebView*(*)>(_a[1]))); break; case 28: createNewPage(); break; case 29: updateIcon(); break; case 30: copy(); break; case 31: authentification((*reinterpret_cast< QNetworkReply*(*)>(_a[1])),(*reinterpret_cast< QAuthenticator*(*)>(_a[2]))); break; case 32: inspectPage(); break; case 33: goToDial(); break; case 34: updateUrlIcon((*reinterpret_cast< QPixmap(*)>(_a[1]))); break; case 35: updateBookMark(); break; case 36: updateOptions(); break; case 37: showBar(); break; case 38: showPage(); break; case 39: showDial(); break; case 40: inCache(); break; case 41: showConsole(); break; case 42: zoomIn(); break; case 43: zoomOut(); break; case 44: restoreZoom(); break; case 45: savePage(); break; case 46: back(); break; case 47: forward(); break; default: ; } _id -= 48; } return _id; }
/* Check the specified RDB file. Return 0 if the RDB looks sane, otherwise * 1 is returned. */ int redis_check_rdb(char *rdbfilename) { uint64_t dbid; int type, rdbver; char buf[1024]; long long expiretime, now = mstime(); FILE *fp; static rio rdb; /* Pointed by global struct riostate. */ if ((fp = fopen(rdbfilename,"r")) == NULL) return 1; rioInitWithFile(&rdb,fp); rdbstate.rio = &rdb; rdb.update_cksum = rdbLoadProgressCallback; if (rioRead(&rdb,buf,9) == 0) goto eoferr; buf[9] = '\0'; if (memcmp(buf,"REDIS",5) != 0) { rdbCheckError("Wrong signature trying to load DB from file"); return 1; } rdbver = atoi(buf+5); if (rdbver < 1 || rdbver > RDB_VERSION) { rdbCheckError("Can't handle RDB format version %d",rdbver); return 1; } startLoading(fp); while(1) { robj *key, *val; expiretime = -1; /* Read type. */ rdbstate.doing = RDB_CHECK_DOING_READ_TYPE; if ((type = rdbLoadType(&rdb)) == -1) goto eoferr; /* Handle special types. */ if (type == RDB_OPCODE_EXPIRETIME) { rdbstate.doing = RDB_CHECK_DOING_READ_EXPIRE; /* EXPIRETIME: load an expire associated with the next key * to load. Note that after loading an expire we need to * load the actual type, and continue. */ if ((expiretime = rdbLoadTime(&rdb)) == -1) goto eoferr; /* We read the time so we need to read the object type again. */ rdbstate.doing = RDB_CHECK_DOING_READ_TYPE; if ((type = rdbLoadType(&rdb)) == -1) goto eoferr; /* the EXPIRETIME opcode specifies time in seconds, so convert * into milliseconds. */ expiretime *= 1000; } else if (type == RDB_OPCODE_EXPIRETIME_MS) { /* EXPIRETIME_MS: milliseconds precision expire times introduced * with RDB v3. Like EXPIRETIME but no with more precision. */ rdbstate.doing = RDB_CHECK_DOING_READ_EXPIRE; if ((expiretime = rdbLoadMillisecondTime(&rdb)) == -1) goto eoferr; /* We read the time so we need to read the object type again. */ rdbstate.doing = RDB_CHECK_DOING_READ_TYPE; if ((type = rdbLoadType(&rdb)) == -1) goto eoferr; } else if (type == RDB_OPCODE_EOF) { /* EOF: End of file, exit the main loop. */ break; } else if (type == RDB_OPCODE_SELECTDB) { /* SELECTDB: Select the specified database. */ rdbstate.doing = RDB_CHECK_DOING_READ_LEN; if ((dbid = rdbLoadLen(&rdb,NULL)) == RDB_LENERR) goto eoferr; rdbCheckInfo("Selecting DB ID %d", dbid); continue; /* Read type again. */ } else if (type == RDB_OPCODE_RESIZEDB) { /* RESIZEDB: Hint about the size of the keys in the currently * selected data base, in order to avoid useless rehashing. */ uint64_t db_size, expires_size; rdbstate.doing = RDB_CHECK_DOING_READ_LEN; if ((db_size = rdbLoadLen(&rdb,NULL)) == RDB_LENERR) goto eoferr; if ((expires_size = rdbLoadLen(&rdb,NULL)) == RDB_LENERR) goto eoferr; continue; /* Read type again. */ } else if (type == RDB_OPCODE_AUX) { /* AUX: generic string-string fields. Use to add state to RDB * which is backward compatible. Implementations of RDB loading * are requierd to skip AUX fields they don't understand. * * An AUX field is composed of two strings: key and value. */ robj *auxkey, *auxval; rdbstate.doing = RDB_CHECK_DOING_READ_AUX; if ((auxkey = rdbLoadStringObject(&rdb)) == NULL) goto eoferr; if ((auxval = rdbLoadStringObject(&rdb)) == NULL) goto eoferr; rdbCheckInfo("AUX FIELD %s = '%s'", (char*)auxkey->ptr, (char*)auxval->ptr); decrRefCount(auxkey); decrRefCount(auxval); continue; /* Read type again. */ } else { if (!rdbIsObjectType(type)) { rdbCheckError("Invalid object type: %d", type); return 1; } rdbstate.key_type = type; } /* Read key */ rdbstate.doing = RDB_CHECK_DOING_READ_KEY; if ((key = rdbLoadStringObject(&rdb)) == NULL) goto eoferr; rdbstate.key = key; rdbstate.keys++; /* Read value */ rdbstate.doing = RDB_CHECK_DOING_READ_OBJECT_VALUE; if ((val = rdbLoadObject(type,&rdb)) == NULL) goto eoferr; /* Check if the key already expired. This function is used when loading * an RDB file from disk, either at startup, or when an RDB was * received from the master. In the latter case, the master is * responsible for key expiry. If we would expire keys here, the * snapshot taken by the master may not be reflected on the slave. */ if (server.masterhost == NULL && expiretime != -1 && expiretime < now) rdbstate.already_expired++; if (expiretime != -1) rdbstate.expires++; rdbstate.key = NULL; decrRefCount(key); decrRefCount(val); rdbstate.key_type = -1; } /* Verify the checksum if RDB version is >= 5 */ if (rdbver >= 5 && server.rdb_checksum) { uint64_t cksum, expected = rdb.cksum; rdbstate.doing = RDB_CHECK_DOING_CHECK_SUM; if (rioRead(&rdb,&cksum,8) == 0) goto eoferr; memrev64ifbe(&cksum); if (cksum == 0) { rdbCheckInfo("RDB file was saved with checksum disabled: no check performed."); } else if (cksum != expected) { rdbCheckError("RDB CRC error"); } else { rdbCheckInfo("Checksum OK"); } } fclose(fp); return 0; eoferr: /* unexpected end of file is handled here with a fatal exit */ if (rdbstate.error_set) { rdbCheckError(rdbstate.error); } else { rdbCheckError("Unexpected EOF reading RDB file"); } return 1; }