コード例 #1
0
void ProjectCombo::refresh()
{
	if( !mRefreshRequested ) {
		QTimer::singleShot(0,this,SLOT(doRefresh()));
		mRefreshRequested = true;
	}
}
コード例 #2
0
Status SessionsCollectionRS::refreshSessions(OperationContext* opCtx,
                                             const LogicalSessionRecordSet& sessions) {
    return dispatch(NamespaceString::kLogicalSessionsNamespace,
                    opCtx,
                    [&] {
                        DBDirectClient client(opCtx);
                        return doRefresh(NamespaceString::kLogicalSessionsNamespace,
                                         sessions,
                                         makeSendFnForBatchWrite(
                                             NamespaceString::kLogicalSessionsNamespace, &client));
                    },
                    [&](DBClientBase* client) {
                        return doRefresh(NamespaceString::kLogicalSessionsNamespace,
                                         sessions,
                                         makeSendFnForBatchWrite(
                                             NamespaceString::kLogicalSessionsNamespace, client));
                    });
}
コード例 #3
0
void ProjectCombo::setProject( const Project & pt )
{
	if( mRefreshRequested ) doRefresh();
	int idx = mModel->recordList().findIndex( pt );
	if( idx >= 0 ) {
		mCurrent = pt;
		setCurrentIndex( idx );
	}
}
コード例 #4
0
KstViewPicture::KstViewPicture(const KstViewPicture& picture)
: KstBorderedViewObject(picture) {
  _refresh = picture._refresh;
  _url = picture._url;
  doRefresh();
  
  // always have these values
  _type = "Picture";
}
Status SessionsCollectionSharded::refreshSessions(OperationContext* opCtx,
                                                  const LogicalSessionRecordSet& sessions) {
    auto send = [&](BSONObj toSend) {
        auto opMsg =
            OpMsgRequest::fromDBAndBody(NamespaceString::kLogicalSessionsNamespace.db(), toSend);
        auto request = BatchedCommandRequest::parseUpdate(opMsg);

        BatchedCommandResponse response;
        BatchWriteExecStats stats;

        ClusterWriter::write(opCtx, request, &stats, &response);
        return response.toStatus();
    };

    return doRefresh(NamespaceString::kLogicalSessionsNamespace, sessions, send);
}
コード例 #6
0
void NemoCalendarAgendaModel::refresh()
{
    if (!mIsComplete)
        return;

    if (mRefreshingModel) {
        mRerefreshNeeded = true;
        return;
    }

    mRefreshingModel = true;
    doRefresh();
    mRefreshingModel = false;
    if (mRerefreshNeeded) {
        mRerefreshNeeded = false;
        refresh();
    }
}
コード例 #7
0
Status SessionsCollectionSharded::refreshSessions(OperationContext* opCtx,
                                                  const LogicalSessionRecordSet& sessions,
                                                  Date_t refreshTime) {
    auto send = [&](BSONObj toSend) {
        auto opMsg = OpMsgRequest::fromDBAndBody(SessionsCollection::kSessionsDb, toSend);
        auto request = BatchedCommandRequest::parseUpdate(opMsg);

        BatchedCommandResponse response;
        BatchWriteExecStats stats;

        ClusterWriter::write(opCtx, request, &stats, &response);
        if (response.getOk()) {
            return Status::OK();
        }

        auto error = response.isErrCodeSet() ? ErrorCodes::fromInt(response.getErrCode())
                                             : ErrorCodes::UnknownError;
        return Status(error, response.getErrMessage());
    };

    return doRefresh(sessions, refreshTime, send);
}
コード例 #8
0
ファイル: testJpeg.cpp プロジェクト: dsk6711/SdlPlayer
int _tmain(int argc, _TCHAR* argv[])
{
    if(argc<2)
    {
        APP_ERROR("Please type %s aviFileName\n", argv[0]);
        return -1;
    }

    int pos;
    MainAVIHeader *psAviH;


    //integrityCheck(argv[1]);

    int nAviStrhPos;
    struct AVI_strh *psAviStrH;
    DWORD nMainAvihSize;

    int nSize;
    BYTE *pHdrl;

    int nVidsNo;

    SDL_Surface *screen; 

    nSize = aviHdrlBufferGet(argv[1], &pHdrl);

    if (nSize < 0)
        return -1;

    pos = aviHeaderGetFromHdrl(pHdrl, nSize, &nMainAvihSize);
    if (pos >= 0)
    {
        psAviH = (MainAVIHeader *)(pHdrl + pos);

        nAviStrhPos = vidsStrhGetFromHdrl(pHdrl, nSize, psAviH->dwStreams, &nVidsNo);
        if (nAviStrhPos > 0)
        {
            psAviStrH = (struct AVI_strh *)(pHdrl + nAviStrhPos);
        }
    }

    //create screen according to W x H.
    screen = sdlMainScreenInit(psAviH->dwWidth, psAviH->dwHeight);

    Uint32 nTicksInc = (psAviH->dwMicroSecPerFrame)/1000;
    Uint32 nTicksIncUs = (psAviH->dwMicroSecPerFrame);
    printf("\tFrame interval is %d Ms\n", nTicksInc);

    //release memory
    free(pHdrl);

    //create decode thread.
    VideoState aviStream;
    memset(&aviStream, 0 , sizeof(aviStream));
    strcpy(aviStream.filename, argv[1]);

    aviStream.screen = screen;
    aviStream.mutex = SDL_CreateMutex();
    aviStream.cond = SDL_CreateCond();
    aviStream.bBlited = 1;
    aviStream.bFliped = 1;
    //aviStream.nTicksInc = nTicksInc;

    aviStream.parse_tid = SDL_CreateThread(decode_thread, &aviStream);
    if(!aviStream.parse_tid) 
    {
        SDL_Quit();
        return -1;
    }

    SDL_Event   event;
    int res;
    Uint32 nRefreshTicks = 0;
    for(;;) 
    {
        SDL_WaitEvent(&event);
        switch(event.type) 
        {
        case SDL_KEYDOWN:
            switch (event.key.keysym.sym) 
            {
                case SDLK_SPACE: 

                    if(!aviStream.pause)
                    {
                        aviStream.pause = 1;
                        printf("\t\t pause!\n");
                    }
                    else
                    {
                        //reset time control 
                        if(REFRESH_TIME_CTRL == TIME_CTRL_0)
                        {
                            nRefreshTicks = 0;
                        }
                        else
                        {
                            aviStream.nCurFrameCnt = 0;
                            aviStream.nRefTicks = 0;
                        }

                        printf("\n\n resume!\n");
                        SDL_LockMutex(aviStream.mutex);
                        aviStream.pause = 0; 
                        SDL_CondSignal(aviStream.cond);
                        SDL_UnlockMutex(aviStream.mutex);
                    }
                    break;
            }
            break;
        case PW_QUIT_EVENT:
        case SDL_QUIT:
            aviStream.quit = 1;
            SDL_CondSignal(aviStream.cond);
            SDL_WaitThread(aviStream.parse_tid, NULL);

            SDL_Quit();
            SDL_DestroyCond(aviStream.cond);
            SDL_DestroyMutex(aviStream.mutex);
            return 0;
            break;

        case PW_FRAME_REPEAT:
                if(REFRESH_TIME_CTRL == TIME_CTRL_0)
                {
                    //we not plan to support for TIME_CTRL_0 mode.
                }
                else
                {
                    // we just need to advanced the cnt, then next frame refresh would has such delay time.
                    aviStream.nCurFrameCnt++;

                    //for repeat frame case, if it is first frame, we needs update the nRefTicks
                    if(1 == aviStream.nCurFrameCnt)
                    {
                        aviStream.nRefTicks = SDL_GetTicks();
                    }

                    printf("\t\t [%d] frame repeat. frame timing ctrl 1\n", aviStream.nCurFrameCnt);
                }



            break;

        case PW_BLIT_EVENT:
            res = doBlit(event.user.data1);

            //schedule refresh timer if blit success. Or do nothing if postponed.
            if (res)
            {
                if(REFRESH_TIME_CTRL == TIME_CTRL_0)
                {
                    Uint32 ticks;
                    ticks = SDL_GetTicks();
                    int delay; 
                    static int nFrameCnt = 0;

                    delay = (nRefreshTicks > ticks)? (nRefreshTicks - ticks) : 0;  
                    schedule_refresh(&aviStream, delay);

                    printf("\t\t[%d] delay tick = %d Ms. frame timing ctrl 0\n", nFrameCnt, delay);
                    nFrameCnt++;
                }
                else
                {
                    aviStream.nCurFrameCnt++;

                    Uint32 nTargetTicks;
                    nTargetTicks = aviStream.nRefTicks + ((aviStream.nCurFrameCnt)*nTicksIncUs)/1000;

                    Uint32 ticks;
                    ticks = SDL_GetTicks();
                    int delay;

                    delay = (nTargetTicks > ticks)? (nTargetTicks - ticks) : 0;
                    schedule_refresh(&aviStream, delay);

                    //printf("\t\t [%d] delay tick = %d Ms. frame timing ctrl 1\n", aviStream.nCurFrameCnt, delay);
                    printf("\t\t [%d] delay tick = %d Ms. Show at %d Ms. frame timing ctrl 1\n", aviStream.nCurFrameCnt, delay, nTargetTicks-aviStream.nRefTicks);
                }

            }


            break;

        case PW_FLIP_EVENT:
            
            if(REFRESH_TIME_CTRL == TIME_CTRL_0)
            {
                //update nRefreshTicks
                Uint32 ticks;
                ticks = SDL_GetTicks();
                nRefreshTicks = ticks + nTicksInc;
                //printf("\t\t Refresh tick = %d Ms\n", ticks);
            }
            else
            {
                if(1 == aviStream.nCurFrameCnt)
                {
                    aviStream.nRefTicks = SDL_GetTicks();
                }
            }

            doRefresh(event.user.data1);
            break;

        default:
            break;
        }
    }
   
    return 0;

}
コード例 #9
0
	void renderGUI(float newZoom, int activeFBO) {
		
		
		int i;
		
		int j;
		int k;
		int m;
		int n;
		
		int maxLoop = 0;
		
		float shadowOffset = 0.0;
		
		testOver(singleton->guiX,singleton->guiY);
		doRefresh();
		

		Singleton::UICont* curCont = NULL;
		
		
		
		baseComp->updateSS();
		

		singleton->bindFBO("guiFBO");
		singleton->drawFBO("resultFBO", 0, newZoom, activeFBO);
		
		glEnable (GL_BLEND);

		singleton->bindShader("GUIShader");
		singleton->setShaderTexture(0,singleton->fontWrappers[EFW_TEXT]->fontImage->tid);
		singleton->setShaderTexture(1,singleton->fontWrappers[EFW_ICONS]->fontImage->tid);
		singleton->sampleFBO("swapFBOBLin0", 2);
		
		for (i = 0; i < 2; i++) {
			
			
			if (i == 0) {
				maxLoop = 1;
			}
			else {
				maxLoop = 2;
			}
			
			singleton->setShaderFloat("passNum", i);
			singleton->setShaderFloat("zoom", singleton->cameraZoom);
			singleton->setShaderVec2("resolution", singleton->currentFBOResolutionX, singleton->currentFBOResolutionY);
			
			glBegin (GL_QUADS);
				//baseComp->renderAll(i == 0);
			
				for (j = 0; j < MAX_UI_LAYERS; j++) {
					for (k = 0; k < singleton->guiLayers[j].size(); k++) {
						
						curCont = (singleton->guiLayers[j][k]);
						
						if (curCont->uiComp->visible) {
							
							for (m = 0; m < maxLoop; m++) {
								
								shadowOffset = ((1-m)*i)*4.0f;
								
								
								// only shadow text
								if (shadowOffset == 0.0f) {
									
									
									if (curCont->bg.fontId > -1) {
										renderQuad(
											curCont->uiComp,
											curCont->bg.hitBounds,
											shadowOffset
										);
									}
									
									
								}
								
								if (i == 0) {
									// don't render text in first pass
								}
								else {
								
									if (false) { //curCont->locked) {
										// busy updating characters
									}
									else {
										for (n = 0; n < curCont->charVec.size(); n++) {
											renderCharAt(
												curCont->uiComp,
												curCont->charVec[n].cs,
												singleton->fontWrappers[curCont->charVec[n].fontId],
												curCont->charVec[n].hitBounds.xMin,
												curCont->charVec[n].hitBounds.yMin,
												shadowOffset
											);
										}
									}
									
									
									
									
								}	
								
								
								
							}
							
							
							
							
							
						}
						
						
						
						
						
					}
				}
			
			glEnd ();
		}
		
		
		singleton->unsampleFBO("swapFBOBLin0", 2);
		singleton->setShaderTexture(1,0);
		singleton->setShaderTexture(0,0);
		singleton->unbindShader();
		
		singleton->unbindFBO();
		
		glDisable(GL_BLEND);
		
		singleton->drawFBO("guiFBO", 0, 1.0f);
		
	}
コード例 #10
0
bool KstViewPicture::setImage(const QString& source) {
  KURL url;

  if (QFile::exists(source) && QFileInfo(source).isRelative()) {
    url.setPath(source);
  } else {
    url = KURL::fromPathOrURL(source);
  }

#if KDE_VERSION >= KDE_MAKE_VERSION(3,3,0)
  // FIXME: come up with a way to indicate the "widget" and fill it in here so
  //        that KIO dialogs are associated with the proper window
  if (!KIO::NetAccess::exists(url, true, 0L)) {
#else
  if (!KIO::NetAccess::exists(url, true)) {
#endif
    return false;
  }

  QString tmpFile;
#if KDE_VERSION >= KDE_MAKE_VERSION(3,3,0)
  // FIXME: come up with a way to indicate the "widget" and fill it in here so
  //        that KIO dialogs are associated with the proper window
  if (!KIO::NetAccess::download(url, tmpFile, 0L)) {
#else
  if (!KIO::NetAccess::download(url, tmpFile)) {
#endif
    return false;
  }

  bool success = true;

  QImage ti;
  ti.setAlphaBuffer(true);
  if (ti.load(tmpFile)) {
    setImage(ti);
    _url = source;

    if (_maintainAspect == true) { restoreAspect(); }
  } else {
    success = false;
  }

  KIO::NetAccess::removeTempFile(tmpFile);
  return success;
}


void KstViewPicture::setImage(const QImage& image) {
  _url = QString::null;
  _image = image;
  _iCache = QImage();
  setDirty();
}


const QString& KstViewPicture::url() const {
  return _url;
}


const QImage& KstViewPicture::image() const {
  return _image;
}


void KstViewPicture::doRefresh() {
  if (_url.isEmpty()) {
    setRefreshTimer(0);
  } else {
    QString u = _url;
    bool rc = setImage(_url);
    _url = u;
    // FIXME: after n failures, give up?
    if (rc) {
      KstApp::inst()->paintAll(KstPainter::P_PAINT);
    }
  }
}


void KstViewPicture::setRefreshTimer(int seconds) {
  _refresh = kMax(0, seconds);
  if (_refresh) {
    if (!_timer) {
      _timer = new QTimer(this);
      connect(_timer, SIGNAL(timeout()), this, SLOT(doRefresh()));
    }
    _timer->start(_refresh * 1000, false);
  } else {
    delete _timer;
    _timer = 0L;
  }
}