void ActionEnableTilemaskEditor::Redo() { if (sceneEditor == NULL) { return; } bool enabled = sceneEditor->tilemaskEditorSystem->IsLandscapeEditingEnabled(); if (enabled) { return; } sceneEditor->DisableTools(SceneEditor2::LANDSCAPE_TOOLS_ALL); bool success = !sceneEditor->IsToolsEnabled(SceneEditor2::LANDSCAPE_TOOLS_ALL); if (!success ) { ShowErrorDialog(ResourceEditor::LANDSCAPE_EDITOR_SYSTEM_DISABLE_EDITORS); } LandscapeEditorDrawSystem::eErrorType enablingError = sceneEditor->tilemaskEditorSystem->EnableLandscapeEditing(); if (enablingError != LandscapeEditorDrawSystem::LANDSCAPE_EDITOR_SYSTEM_NO_ERRORS) { ShowErrorDialog(LandscapeEditorDrawSystem::GetDescriptionByError(enablingError)); } SceneSignals::Instance()->EmitTilemaskEditorToggled(sceneEditor); }
void SceneEditorScreenMain::SaveToFolder(const String & folder) { BodyItem *iBody = FindCurrentBody(); iBody->bodyControl->PushDebugCamera(); SceneData *sceneData = SceneDataManager::Instance()->SceneGetActive(); String filePath = sceneData->GetScenePathname(); String dataSourcePath = EditorSettings::Instance()->GetDataSourcePath(); String::size_type pos = filePath.find(dataSourcePath); if(String::npos != pos) { filePath = filePath.replace(pos, dataSourcePath.length(), ""); } else { DVASSERT(0); } // Get project path KeyedArchive *keyedArchieve = EditorSettings::Instance()->GetSettings(); String projectPath = keyedArchieve->GetString(String("ProjectPath")); if(!SceneSaver::Instance()) new SceneSaver(); String inFolder = projectPath + String("DataSource/3d/"); SceneSaver::Instance()->SetInFolder(inFolder); SceneSaver::Instance()->SetOutFolder(folder); Set<String> errorsLog; SceneSaver::Instance()->SaveScene(iBody->bodyControl->GetScene(), filePath, errorsLog); iBody->bodyControl->PopDebugCamera(); ShowErrorDialog(errorsLog); }
void ExporterScreen::DidAppear() { if(0 < errorLog.size()) { printf("Errors:\n"); Logger::Error("Errors:"); Set<String>::const_iterator endIt = errorLog.end(); int32 index = 0; for (Set<String>::const_iterator it = errorLog.begin(); it != endIt; ++it) { printf("[%d] %s\n", index, (*it).c_str()); Logger::Error(Format("[%d] %s\n", index, (*it).c_str())); ++index; } ShowErrorDialog(errorLog); } bool forceMode = CommandLineTool::Instance()->CommandIsFound(String("-force")) || CommandLineTool::Instance()->CommandIsFound(String("-forceclose")); if(forceMode || 0 == errorLog.size()) { Core::Instance()->Quit(); } }
void SceneValidator::ValidateTextureAndShowErrors(Texture *texture, const FilePath &textureName, const String &validatedObjectName) { errorMessages.clear(); ValidateTexture(texture, textureName, validatedObjectName, errorMessages); ShowErrorDialog(errorMessages); }
static Bool RecvFile( NETFILE *fp, char *name) { char *buff; Bool ret; ENTER_FUNC; GL_SendString(fp,name); if (fMlog) { MessageLogPrintf("recv screen file [%s]\n",name); } if (GL_RecvPacketClass(fp) == GL_ScreenDefine) { // download buff = xmalloc(SIZE_LARGE_BUFF); GL_RecvString(fp, SIZE_LARGE_BUFF, buff); CreateWindow(name,strlen(buff),buff); xfree(buff); ret = TRUE; } else { ShowErrorDialog(_("invalid protocol sequence")); ret = FALSE; } LEAVE_FUNC; return (ret); }
void SceneEditorScreenMain::ExportAs(ImageFileFormat format) { String formatStr; switch (format) { case DAVA::PNG_FILE: formatStr = String("png"); break; case DAVA::PVR_FILE: formatStr = String("pvr"); break; case DAVA::DXT_FILE: formatStr = String("dds"); break; default: DVASSERT(0); return; } BodyItem *iBody = FindCurrentBody(); iBody->bodyControl->PushDebugCamera(); SceneData *sceneData = SceneDataManager::Instance()->SceneGetActive(); String filePath = sceneData->GetScenePathname(); String dataSourcePath = EditorSettings::Instance()->GetDataSourcePath(); String::size_type pos = filePath.find(dataSourcePath); if(String::npos != pos) { filePath = filePath.replace(pos, dataSourcePath.length(), ""); } else { DVASSERT(0); } // Get project path KeyedArchive *keyedArchieve = EditorSettings::Instance()->GetSettings(); String projectPath = keyedArchieve->GetString(String("ProjectPath")); if(!SceneExporter::Instance()) new SceneExporter(); String inFolder = projectPath + String("DataSource/3d/"); SceneExporter::Instance()->SetInFolder(inFolder); SceneExporter::Instance()->SetOutFolder(projectPath + String("Data/3d/")); SceneExporter::Instance()->SetExportingFormat(formatStr); //TODO: how to be with removed nodes? Set<String> errorsLog; SceneExporter::Instance()->ExportScene(iBody->bodyControl->GetScene(), filePath, errorsLog); iBody->bodyControl->PopDebugCamera(); ShowErrorDialog(errorsLog); }
bool SceneValidator::ValidateSceneAndShowErrors(Scene *scene, const DAVA::FilePath &scenePath) { errorMessages.clear(); ValidateScene(scene, scenePath, errorMessages); ShowErrorDialog(errorMessages); return (!errorMessages.empty()); }
bool SceneEditorScreenMain::SaveIsAvailable() { if(FindCurrentBody()->bodyControl->LandscapeEditorActive()) { ShowErrorDialog(String("Can't save level at Landscape Editor Mode.")); return false; } return true; }
bool LandscapeEditorColor::SetScene(EditorScene *newScene) { EditorLandscape *editorLandscape = dynamic_cast<EditorLandscape *>(newScene->GetLandscape(newScene)); if(editorLandscape) { ShowErrorDialog(String("Cannot start tile mask editor. Remove EditorLandscape from scene")); return false; } return LandscapeEditorBase::SetScene(newScene); }
bool LandscapeEditorCustomColors::SetScene(EditorScene *newScene) { EditorLandscape *editorLandscape = dynamic_cast<EditorLandscape *>(FindLandscape(newScene)); if(editorLandscape) { ShowErrorDialog(String("Cannot start color editor. Remove EditorLandscape from scene")); return false; } return LandscapeEditorBase::SetScene(newScene); }
void ImageSplitterScreen::DidAppear() { ShowErrorDialog(errorLog); bool forceMode = CommandLineTool::Instance()->CommandIsFound(String("-force")) || CommandLineTool::Instance()->CommandIsFound(String("-forceclose")); if(forceMode || 0 == errorLog.size()) { Core::Instance()->Quit(); } }
void ActionComponentEditor::OnAddAction() { //add action with default values DAVA::ActionComponent::Action action = GetDefaultAction(); bool duplicateAction = IsActionPresent(action); if(duplicateAction) { ShowErrorDialog("Duplicate actions not allowed!"); } else { targetComponent->Add(action); UpdateTableFromComponent(targetComponent); ui->buttonAddItem->setEnabled(false); } }
bool LandscapeEditorBase::SetScene(EditorScene *newScene) { SafeRelease(workingScene); workingLandscape = SafeRetain(newScene->GetLandscape(newScene)); workingLandscapeEntity = SafeRetain(newScene->GetLandscapeNode(newScene)); if(!workingLandscape) { ShowErrorDialog(String("No landscape at level.")); return false; } savedShaderMode = workingLandscape->GetTiledShaderMode(); workingLandscape->SetTiledShaderMode(Landscape::TILED_MODE_TILEMASK); workingScene = SafeRetain(newScene); return true; }
void SettingsDialog::OnClose(BaseObject * , void * , void * ) { for(int32 iLod = 1; iLod < LodComponent::MAX_LOD_LAYERS; ++iLod) { float32 prev = EditorSettings::Instance()->GetLodLayerDistance(iLod - 1); float32 cur = EditorSettings::Instance()->GetLodLayerDistance(iLod); if(cur <= prev) { ShowErrorDialog("Lod layers have wrong values."); return; } } GetParent()->RemoveControl(this); if(delegate) { delegate->SettingsChanged(); } }
void ActionDisableVisibilityTool::Redo() { if (sceneEditor == NULL) { return; } bool disabled = !sceneEditor->visibilityToolSystem->IsLandscapeEditingEnabled(); if (disabled) { return; } disabled = sceneEditor->visibilityToolSystem->DisableLandscapeEdititing(); if (!disabled) { ShowErrorDialog(ResourceEditor::VISIBILITY_TOOL_DISABLE_ERROR); } SceneSignals::Instance()->EmitVisibilityToolToggled(sceneEditor); }
void ActionDisableTilemaskEditor::Redo() { if (sceneEditor == NULL) { return; } bool disabled = !sceneEditor->tilemaskEditorSystem->IsLandscapeEditingEnabled(); if (disabled) { return; } disabled = sceneEditor->tilemaskEditorSystem->DisableLandscapeEdititing(); if (!disabled) { ShowErrorDialog(ResourceEditor::TILEMASK_EDITOR_DISABLE_ERROR); } SceneSignals::Instance()->EmitTilemaskEditorToggled(sceneEditor); }
static void GL_RecvString( NETFILE *fp, size_t maxsize, char *str) { size_t lsize; ENTER_FUNC; lsize = GL_RecvLength(fp); if ( maxsize >= lsize ){ Recv(fp,str,lsize); if ( !CheckNetFile(fp) ) { GL_Error(); } str[lsize] = 0; } else { ShowErrorDialog( _("GL_RecvString invalid size %ld > %ld(max size)"), (unsigned long)lsize,(unsigned long)maxsize); } LEAVE_FUNC; }
static void SetRateCB(Widget w, XtPointer closure,XtPointer call_data) { char *text,*tag; float rateVal; Boolean UpdateRequired; text = XmTextFieldGetString(rate_tag); puts(text); if(ParseRateParTag(text,&tag,rate_tag,rate_dlg,cur_rpar)) { XtFree(text); return ; } tag=strdup(tag); XtFree(text); text = XmTextFieldGetString(rate_rate); if(ParseRate(text,&rateVal)) { free(tag); XtFree(text); ShowErrorDialog("Rate must be a positive number !",rate_dlg); XmProcessTraversal(rate_rate,XmTRAVERSE_CURRENT); return ; } XtFree(text); if(cur_rpar == NULL) { struct rpar_object * l_rpar; cur_rpar = (struct rpar_object *) emalloc(RPAOBJ_SIZE); cur_rpar->tag = NULL; cur_rpar->center.x = fix_x; cur_rpar->center.y = fix_y; cur_rpar->next = NULL; cur_rpar->layer = NewLayerList(CURRENTVIEWANDWHOLE,NULL); if (netobj->rpars == NULL) l_rpar = NULL; else for (l_rpar = netobj->rpars;l_rpar->next != NULL; l_rpar = l_rpar->next); if (l_rpar != NULL) l_rpar->next = cur_rpar; else netobj->rpars = cur_rpar; UpdateRequired=FALSE; } else ShowRpar(cur_rpar, CLEAR); XFlush(XtDisplay(rate_dlg)); if(UpdateRequired) { ShowRate(FALSE); } if(cur_rpar->tag != NULL) free(cur_rpar->tag); cur_rpar->tag=tag; cur_rpar->value=rateVal; if(UpdateRequired) { if (rate_visible) ShowRate(TRUE); } ShowRpar(cur_rpar, OR); ClearRes(); menu_action(); SetModify(); HideRateChangeDialog(); }
int SVNBase::ShowErrorDialog( HWND hParent) { return ShowErrorDialog(hParent, CTSVNPath()); }
void CollectDeadl(int complain) { FILE *p_f; char buf[LINEMAX], buf2[LINEMAX]; struct p_i_object *pip; struct p_i_l_type *pil=NULL; int i, j, np; struct place_object *plp; char string[300]; strcpy(buf,GetCurrentFilename()); strcpy(buf2,GetCurrentFilename()); strcat(buf,".mdead"); strcat(buf2,".net"); { struct stat stb, stb2; if ((stat(buf, &stb) < 0) || (stat(buf2, &stb2) < 0) || (stb2.st_mtime > stb.st_mtime)) { if (complain) { sprintf(string,"No up-to-date Deadlocks for net %s", GetCurrentFilename()); ShowInfoDialog(string,frame_w); } return; } } if ((p_f = fopen(buf, "r")) == NULL) { if (complain) { sprintf(string,"Can't open file %s for read", buf); ShowErrorDialog(string,frame_w); } return; } ClearDeadl(); fscanf(p_f, "%d\n", &num_pinv); p_invars = NULL; if (num_pinv <= 0) return; for (i = num_pinv; i-- > 0;) { if (p_invars == NULL) p_invars = pil = (struct p_i_l_type *) emalloc(sizeof(struct p_i_l_type)); else { pil->next = (struct p_i_l_type *) emalloc(sizeof(struct p_i_l_type)); pil = pil->next; } fscanf(p_f, "%d", &j); pil->i_l = pip = NULL; for (; j-- > 0;) { if (pip == NULL) pil->i_l = pip = (struct p_i_object *) emalloc(sizeof(struct p_i_object)); else { pip->next = (struct p_i_object *) emalloc(sizeof(struct p_i_object)); pip = pip->next; } fscanf(p_f, "%d", &np); for (plp = netobj->places; --np > 0; plp = plp->next); pip->p_p = plp; } pip->next = NULL; } pil->next = p_invars; (void) fclose(p_f); }
void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& path, bool& watch){ //Get the input file //Make sure to load the proper system encoding first LUtils::LoadTranslation(0,""); //bypass application modification QString inFile, ActionID; bool showDLG = false; //flag to bypass any default application setting if(argc > 1){ for(int i=1; i<argc; i++){ if(QString(argv[i]).simplified() == "-select"){ showDLG = true; }else if(QString(argv[i]).simplified() == "-volumeup"){ int vol = LOS::audioVolume()+5; //increase 5% if(vol>100){ vol=100; } LOS::setAudioVolume(vol); showOSD(argc,argv, QString(QObject::tr("Audio Volume %1%")).arg(QString::number(vol)) ); return; }else if(QString(argv[i]).simplified() == "-volumedown"){ int vol = LOS::audioVolume()-5; //decrease 5% if(vol<0){ vol=0; } LOS::setAudioVolume(vol); showOSD(argc,argv, QString(QObject::tr("Audio Volume %1%")).arg(QString::number(vol)) ); return; }else if(QString(argv[i]).simplified() == "-brightnessup"){ int bright = LOS::ScreenBrightness(); if(bright > 0){ //brightness control available bright = bright+5; //increase 5% if(bright>100){ bright = 100; } LOS::setScreenBrightness(bright); showOSD(argc,argv, QString(QObject::tr("Screen Brightness %1%")).arg(QString::number(bright)) ); } return; }else if(QString(argv[i]).simplified() == "-brightnessdown"){ int bright = LOS::ScreenBrightness(); if(bright > 0){ //brightness control available bright = bright-5; //decrease 5% if(bright<0){ bright = 0; } LOS::setScreenBrightness(bright); showOSD(argc,argv, QString(QObject::tr("Screen Brightness %1%")).arg(QString::number(bright)) ); } return; }else if( (QString(argv[i]).simplified() =="-action") && (argc>(i+1)) ){ ActionID = QString(argv[i+1]); i++; //skip the next input }else{ inFile = QString::fromLocal8Bit(argv[i]); break; } } }else{ printUsageInfo(); } //Make sure that it is a valid file/URL bool isFile=false; bool isUrl=false; if(QFile::exists(inFile)){ isFile=true; } else if(QFile::exists(QDir::currentPath()+"/"+inFile)){isFile=true; inFile = QDir::currentPath()+"/"+inFile;} //account for relative paths else if(QUrl(inFile).isValid() && !inFile.startsWith("/") ){ isUrl=true; } if( !isFile && !isUrl ){ ShowErrorDialog( argc, argv, QString(QObject::tr("Invalid file or URL: %1")).arg(inFile) ); } //Determing the type of file (extension) QString extension; //qDebug() << "File Type:" << isFile << isUrl; if(isFile){ QFileInfo info(inFile); extension=info.suffix(); //qDebug() << " - Extension:" << extension; if(info.isDir()){ extension="directory"; } else if(info.isExecutable() && extension.isEmpty()){ extension="binary"; } else if(extension!="desktop"){ extension="mimetype"; } //flag to check for mimetype default based on file } else if(isUrl && inFile.startsWith("mailto:")){ extension = "email"; } else if(isUrl){ extension = "webbrowser"; } //qDebug() << "Input:" << inFile << isFile << isUrl << extension; //if not an application - find the right application to open the file QString cmd; bool useInputFile = false; if(extension=="desktop" && !showDLG){ bool ok = false; XDGDesktop DF = LXDG::loadDesktopFile(inFile, ok); if(!ok){ ShowErrorDialog( argc, argv, QString(QObject::tr("File could not be opened: %1")).arg(inFile) ); } switch(DF.type){ case XDGDesktop::APP: if(!DF.exec.isEmpty()){ cmd = LXDG::getDesktopExec(DF,ActionID); if(!DF.path.isEmpty()){ path = DF.path; } watch = DF.startupNotify; }else{ ShowErrorDialog( argc, argv, QString(QObject::tr("Application shortcut is missing the launching information (malformed shortcut): %1")).arg(inFile) ); } break; case XDGDesktop::LINK: if(!DF.url.isEmpty()){ //This is a URL - so adjust the input variables appropriately inFile = DF.url; cmd.clear(); extension = inFile.section(":",0,0); watch = DF.startupNotify; }else{ ShowErrorDialog( argc, argv, QString(QObject::tr("URL shortcut is missing the URL: %1")).arg(inFile) ); } break; case XDGDesktop::DIR: if(!DF.path.isEmpty()){ //This is a directory link - adjust inputs inFile = DF.path; cmd.clear(); extension = "directory"; watch = DF.startupNotify; }else{ ShowErrorDialog( argc, argv, QString(QObject::tr("Directory shortcut is missing the path to the directory: %1")).arg(inFile) ); } break; default: qDebug() << DF.type << DF.name << DF.icon << DF.exec; ShowErrorDialog( argc, argv, QString(QObject::tr("Unknown type of shortcut : %1")).arg(inFile) ); } } if(cmd.isEmpty()){ if(extension=="binary" && !showDLG){ cmd = inFile; } else{ //Find out the proper application to use this file/directory useInputFile=true; cmd = cmdFromUser(argc, argv, inFile, extension, path, showDLG); if(cmd.isEmpty()){ return; } } } //Now assemble the exec string (replace file/url field codes as necessary) if(useInputFile){ args = inFile; //just to keep them distinct internally // NOTE: lumina-open is only designed for a single input file, // so no need to distinguish between the list codes (uppercase) // and the single-file codes (lowercase) //Special "inFile" format replacements for input codes if( (cmd.contains("%f") || cmd.contains("%F") ) ){ //Apply any special field replacements for the desired format inFile.replace("%20"," "); //Now replace the field codes cmd.replace("%f","\""+inFile+"\""); cmd.replace("%F","\""+inFile+"\""); }else if( (cmd.contains("%U") || cmd.contains("%u")) ){ //Apply any special field replacements for the desired format if(!inFile.contains("://")){ inFile.prepend("file:"); } //local file - add the extra flag inFile.replace(" ", "%20"); //Now replace the field codes cmd.replace("%u","\""+inFile+"\""); cmd.replace("%U","\""+inFile+"\""); }else{ //No field codes (or improper field codes given in the file - which is quite common) // - Just tack the input file on the end and let the app handle it as necessary cmd.append(" \""+inFile+"\""); } } //qDebug() << "Found Command:" << cmd << "Extension:" << extension; //Clean up any leftover "Exec" field codes (should have already been replaced earlier) if(cmd.contains("%")){cmd = cmd.remove("%U").remove("%u").remove("%F").remove("%f").remove("%i").remove("%c").remove("%k").simplified(); } binary = cmd; //pass this string to the calling function }
extern Bool SendConnect( NETFILE *fp, char *apl) { Bool rc; PacketClass pc; char ver[16]; ENTER_FUNC; rc = TRUE; if ( fMlog ) { MessageLog(_("connection start\n")); } GL_SendPacketClass(fp,GL_Connect); GL_SendVersionString(fp); GL_SendString(fp,User); GL_SendString(fp,Pass); GL_SendString(fp,apl); pc = GL_RecvPacketClass(fp); if ( pc == GL_OK ) { } else if (pc == GL_ServerVersion) { GL_RecvString(fp, sizeof(ver), ver); if (strcmp(ver, "1.4.4.01") >= 0) { SetPingTimerFunc(PingTimerFunc, fp); } if (strcmp(ver, "1.4.6.99") >= 0) { fV47 = TRUE; } else { fV47 = FALSE; } } else { rc = FALSE; switch (pc) { case GL_NOT: ShowErrorDialog(_("can not connect server")); break; case GL_E_VERSION: ShowErrorDialog(_("can not connect server(version not match)")); break; case GL_E_AUTH: #ifdef USE_SSL if (fSsl) { ShowErrorDialog( _("can not connect server(authentication error)")); } else { ShowErrorDialog( _("can not connect server(user or password is incorrect)")); } #else ShowErrorDialog( _("can not connect server(user or password is incorrect)")); #endif break; case GL_E_APPL: ShowErrorDialog( _("can not connect server(application name invalid)")); break; default: dbgprintf("[%X]\n",pc); ShowErrorDialog(_("can not connect server(other protocol error)")); break; } } LEAVE_FUNC; return (rc); }
static gint PingTimerFunc(gpointer data) { NETFILE *fp = (NETFILE *)data; PacketClass c; char buff[CLIENT_SIZE_BUFF]; if (ISRECV(Session)) { return 1; } ISRECV(Session) = TRUE; fp = (NETFILE *)data; if (fV47) { GL_SendPacketClass(fp,GL_Ping);ON_IO_ERROR(fp,badio); c = GL_RecvPacketClass(fp);ON_IO_ERROR(fp,badio); switch (c) { case GL_Pong_Dialog: GL_RecvString(fp, sizeof(buff), buff);ON_IO_ERROR(fp,badio); ISRECV(Session) = FALSE; ShowInfoDialog(buff); break; case GL_Pong_Popup: GL_RecvString(fp, sizeof(buff), buff);ON_IO_ERROR(fp,badio); ISRECV(Session) = FALSE; Notify(_("glclient message notify"),buff,"gtk-dialog-info",0); break; case GL_Pong_Abort: GL_RecvString(fp, sizeof(buff), buff);ON_IO_ERROR(fp,badio); ShowInfoDialog(buff); exit(1); break; case GL_Pong: ISRECV(Session) = FALSE; break; default: ShowErrorDialog(_("connection error(invalid pong packet)")); break; } } else { GL_SendPacketClass(fp,GL_Ping);ON_IO_ERROR(fp,badio); c = GL_RecvPacketClass(fp);ON_IO_ERROR(fp,badio); if (c != GL_Pong) { ShowErrorDialog(_("connection error(server doesn't reply ping)")); return 1; } c = GL_RecvPacketClass(fp);ON_IO_ERROR(fp,badio); switch (c) { case GL_STOP: GL_RecvString(fp, sizeof(buff), buff);ON_IO_ERROR(fp,badio); ShowInfoDialog(buff); exit(1); break; case GL_CONTINUE: GL_RecvString(fp, sizeof(buff), buff);ON_IO_ERROR(fp,badio); ISRECV(Session) = FALSE; ShowInfoDialog(buff); break; case GL_END: default: ISRECV(Session) = FALSE; break; }; } ISRECV(Session) = FALSE; CheckPrintList(); CheckDLList(); return 1; badio: ShowErrorDialog(_("connection error(server doesn't reply ping)")); return 1; }
static void GL_Error(void) { ShowErrorDialog(_("Connection lost\n")); }
void CubeMapTextureBrowser::OnDeleteSelectedItemsClicked() { int checkedItemCount = GetCheckedItemsCount(); int answer = MB_FLAG_NO; if(checkedItemCount > 0) { QString text = QString("%1 item(s) will be deleted. Continue?").arg(QString().setNum(checkedItemCount)); answer = ShowQuestion("Confirmation", text.toStdString(), MB_FLAG_YES | MB_FLAG_NO, MB_FLAG_NO); } if(MB_FLAG_YES == answer) { DAVA::Vector<DAVA::String> failedToRemove; int itemCount = ui->listTextures->count(); for(int i = 0; i < itemCount; ++i) { QListWidgetItem* item = ui->listTextures->item(i); bool checkedState = item->data(Qt::CheckStateRole).toBool(); if(checkedState) { FilePath fp = item->data(CUBELIST_DELEGATE_ITEMFULLPATH).toString().toStdString(); if(fp.Exists()) { DAVA::Vector<DAVA::String> faceNames; CubemapUtils::GenerateFaceNames(fp.GetAbsolutePathname(), faceNames); for(size_t faceIndex = 0; faceIndex < faceNames.size(); ++faceIndex) { FilePath hackTex = faceNames[faceIndex]; hackTex.ReplaceExtension(".tex"); QFile::remove(hackTex.GetAbsolutePathname().c_str()); bool removeResult = QFile::remove(faceNames[faceIndex].c_str()); if(!removeResult) { failedToRemove.push_back(faceNames[faceIndex]); } } bool removeResult = QFile::remove(fp.GetAbsolutePathname().c_str()); if(!removeResult) { failedToRemove.push_back(fp.GetAbsolutePathname().c_str()); } } } } if(failedToRemove.size() > 0) { DAVA::String fileList; int count = failedToRemove.size(); for(int i = 0; i < count; ++i) { fileList += failedToRemove[i]; fileList += "\n"; } DAVA::String message = "Failed to remove the following files. Please delete them manually.\n"; message += fileList; ShowErrorDialog(message); } QString path = ui->textRootPath->text(); ReloadTexturesFromUI(path); UpdateCheckedState(); } }
int OperationErrorList_c::ShowErrorDialog ( HWND hWnd, int iError, bool bWinError, const Str_c & sFile1 ) { return ShowErrorDialog ( hWnd, iError, bWinError, sFile1, L"" ); }
void LandscapePropertyControl::OnFilepathPropertyChanged(PropertyList *forList, const String &forKey, const String &newValue) { Set<String> errorsLog; if("property.landscape.heightmap" == forKey) { bool isValid = SceneValidator::Instance()->ValidateHeightmapPathname(newValue, errorsLog); if(isValid) { LandscapeNode *landscape = GetLandscape(); if (!landscape) return; Vector3 size( propertyList->GetFloatPropertyValue("property.landscape.size"), propertyList->GetFloatPropertyValue("property.landscape.size"), propertyList->GetFloatPropertyValue("property.landscape.height")); AABBox3 bbox; bbox.AddPoint(Vector3(-size.x/2.f, -size.y/2.f, 0.f)); bbox.AddPoint(Vector3(size.x/2.f, size.y/2.f, size.z)); if(newValue.length()) { landscape->BuildLandscapeFromHeightmapImage(newValue, bbox); } } } else { bool isValid = (newValue.empty()) ? true: SceneValidator::Instance()->ValidateTexturePathname(newValue, errorsLog); if(isValid) { String descriptorPathname = String(""); if(!newValue.empty()) { descriptorPathname = TextureDescriptor::GetDescriptorPathname(newValue); } if("property.landscape.texture.tile0" == forKey) { SetLandscapeTexture(LandscapeNode::TEXTURE_TILE0, descriptorPathname); } else if("property.landscape.texture.tile1" == forKey) { SetLandscapeTexture(LandscapeNode::TEXTURE_TILE1, descriptorPathname); } else if("property.landscape.texture.tile2" == forKey) { SetLandscapeTexture(LandscapeNode::TEXTURE_TILE2, descriptorPathname); } else if("property.landscape.texture.tile3" == forKey) { SetLandscapeTexture(LandscapeNode::TEXTURE_TILE3, descriptorPathname); } else if("property.landscape.texture.tilemask" == forKey) { SetLandscapeTexture(LandscapeNode::TEXTURE_TILE_MASK, descriptorPathname); } else if("property.landscape.texture.color" == forKey) { SetLandscapeTexture(LandscapeNode::TEXTURE_COLOR, descriptorPathname); } else if("property.landscape.texture.tiledtexture" == forKey) { SetLandscapeTexture(LandscapeNode::TEXTURE_TILE_FULL, descriptorPathname); } } } if(0 == errorsLog.size()) { NodesPropertyControl::OnFilepathPropertyChanged(forList, forKey, newValue); } else { ShowErrorDialog(errorsLog); } }