bool OperCFThread::MoveNode( FS* srcFs, FSPath& srcPath, FSNode* srcNode, FS* destFs, FSPath& destPath ) { if ( srcNode->st.IsLnk() ) { int r = MoveFile( srcFs, srcPath, srcNode, destFs, destPath ); if ( r < 0 ) { return false; } if ( r > 0 && !CopyLink( srcFs, srcPath, srcNode, destFs, destPath, true ) ) { return false; } } else if ( srcNode->st.IsDir() ) { int r = MoveDir( srcFs, srcPath, srcNode, destFs, destPath ); if ( r < 0 ) { return false; } if ( r > 0 && !CopyDir( srcFs, srcPath, srcNode, destFs, destPath, true ) ) { return false; } } else { int r = MoveFile( srcFs, srcPath, srcNode, destFs, destPath ); if ( r < 0 ) { return false; } if ( r > 0 && !CopyFile( srcFs, srcPath, srcNode, destFs, destPath, true ) ) { return false; } } return true; }
Preference::Preference(QWidget *parent):QDialog(parent) { QTextCodec::setCodecForTr(QTextCodec::codecForName("utf-8")); ui.setupUi(this); ui.preferenceTab->setTabText(ACCOUNT,tr("账号")); ui.preferenceTab->setTabText(ADVANCED,tr("高级")); ui.preferenceTab->setTabText(ABOUT,tr("关于")); connect(ui.preferenceTab,SIGNAL(currentChanged(int)),this,SLOT(ShowData(int))); connect(ui.unlinkButton,SIGNAL(clicked()),this,SLOT(Unlink())); QSettings settings(qgetenv("HOME")+SYSTEM,QSettings::IniFormat); if(settings.value("SavePath").toString().isEmpty()) { QString Home = qgetenv("HOME"); settings.setValue("SavePath",Home + "/IPan"); } SavePath = settings.value("SavePath").toString(); ui.dirLine->setText(SavePath); emit ChangeSavePath(SavePath); connect(ui.moveButton,SIGNAL(clicked()),this,SLOT(MoveDir())); connect(ui.closeButton,SIGNAL(clicked()),this,SLOT(CloseWindow())); connect(ui.runsysche,SIGNAL(stateChanged(int)),this,SLOT(setRunSys(int))); ui.preferenceTab->setCurrentIndex(ACCOUNT); if(settings.value("RunSys").toString().isEmpty()) { ui.runsysche->setCheckState(Qt::Unchecked); } else { int val = settings.value("RunSys").toInt(); if(val == 0) ui.runsysche->setCheckState(Qt::Unchecked); else if(val == 2) ui.runsysche->setCheckState(Qt::Checked); } }
bool wxGxOpenFileGDB::Move(const CPLString &szDestPath, ITrackCancel* const pTrackCancel) { wxGISDataset* pDSet = GetDatasetFast(); if (NULL != pDSet) { pDSet->Close(); wsDELETE(pDSet); } if (pTrackCancel) pTrackCancel->PutMessage(wxString::Format(_("%s %s %s"), _("Move"), GetCategory().c_str(), m_sName.c_str()), wxNOT_FOUND, enumGISMessageInfo); //CPLString szFullDestPath = CPLFormFilename(szDestPath, CPLGetFilename(m_sPath), NULL); CPLString szFullDestPath = CheckUniqPath(szDestPath, CPLGetFilename(m_sPath), true, " "); bool bRet = MoveDir(m_sPath, szFullDestPath, 777, pTrackCancel); if (!bRet) { const char* err = CPLGetLastErrorMsg(); wxString sErr = wxString::Format(_("Operation '%s' failed! GDAL error: %s, %s '%s'"), _("Move"), GetCategory().c_str(), wxString(err, wxConvUTF8).c_str(), wxString(m_sPath, wxConvUTF8).c_str()); wxLogError(sErr); if (pTrackCancel) pTrackCancel->PutMessage(sErr, wxNOT_FOUND, enumGISMessageErr); return false; } return true; }
void MapActor::UpdateAIMoving(void) { if(!mbIsMoving) { mAIThinkTimeCur += Global::GetTimeDelta(); if(mAIThinkTimeCur > mAIThinkTimeLimit) { mAIThinkTimeCur = 0; mAIThinkTimeLimit = (float)(rand()%2000 - 1000) / 1000.0f; mAInextDir = MoveDir(rand()%4); int moveTargetX = mTileX; int moveTargetY = mTileY; switch(mAInextDir) { case MOVE_DIR_LEFT: moveTargetX--; break; case MOVE_DIR_UP: moveTargetY--; break; case MOVE_DIR_RIGHT: moveTargetX++; break; case MOVE_DIR_DOWN: moveTargetY++; break; } gMapMgr.MoveActor(mActorId, moveTargetX, moveTargetY, mAInextDir); } } }