void checkDock::runTests( ValidateType type ) { for ( int i = 0; i < mTestTable->rowCount(); ++i ) { QString testName = mTestTable->item( i, 0 )->text(); QString layer1Str = mTestTable->item( i, 3 )->text(); QString layer2Str = mTestTable->item( i, 4 )->text(); // test if layer1 is in the registry if ( !( ( QgsVectorLayer * )QgsProject::instance()->mapLayers().contains( layer1Str ) ) ) { QgsMessageLog::logMessage( tr( "Layer %1 not found in registry." ).arg( layer1Str ), tr( "Topology plugin" ) ); return; } QgsVectorLayer *layer1 = ( QgsVectorLayer * )QgsProject::instance()->mapLayer( layer1Str ); QgsVectorLayer *layer2 = nullptr; if ( ( QgsVectorLayer * )QgsProject::instance()->mapLayers().contains( layer2Str ) ) layer2 = ( QgsVectorLayer * )QgsProject::instance()->mapLayer( layer2Str ); QProgressDialog progress( testName, tr( "Abort" ), 0, layer1->featureCount(), this ); progress.setWindowModality( Qt::WindowModal ); connect( &progress, &QProgressDialog::canceled, mTest, &topolTest::setTestCanceled ); connect( mTest, &topolTest::progress, &progress, &QProgressDialog::setValue ); // run the test ErrorList errors = mTest->runTest( testName, layer1, layer2, type ); QList<TopolError *>::Iterator it; QgsRubberBand *rb = nullptr; for ( it = errors.begin(); it != errors.end(); ++it ) { TopolError *te = *it; te->conflict(); QgsSettings settings; if ( te->conflict().type() == QgsWkbTypes::PolygonGeometry ) { rb = new QgsRubberBand( qgsInterface->mapCanvas(), QgsWkbTypes::PolygonGeometry ); } else { rb = new QgsRubberBand( qgsInterface->mapCanvas(), te->conflict().type() ); } rb->setColor( "red" ); rb->setWidth( 4 ); rb->setToGeometry( te->conflict(), layer1 ); rb->show(); mRbErrorMarkers << rb; } disconnect( &progress, &QProgressDialog::canceled, mTest, &topolTest::setTestCanceled ); disconnect( mTest, &topolTest::progress, &progress, &QProgressDialog::setValue ); mErrorList << errors; } mToggleRubberband->setChecked( true ); mErrorListModel->resetModel(); }
//--------------------------------------------------------------------------- void TMultDispFrame::showErrorList( ErrorList &errs ) { ErrList->Clear(); for ( ErrorIterator i = errs.begin(); i != errs.end(); i++ ) { ErrList->Items->Add( ( *i ) ->errStr.c_str() ); } ErrList->ItemIndex = 0; }
void AbstractResourceItem::validateItem() { if (_state == ResourceState::FILE_ERROR || _state == ResourceState::NOT_LOADED) { return; } ErrorList err; // check dependencies bool dependenciesOk = true; for (auto& dep : _dependencies) { AbstractResourceItem* dItem = _project->findResourceItem(dep.type, dep.name); if (dItem == nullptr) { if (auto* rl = _project->findResourceList(dep.type)) { QString rtn = rl->resourceTypeNameSingle(); err.addError("Dependency Error: Missing " + rtn.toStdString() + u8" · " + dep.name.toStdString()); } else { err.addError("Dependency Error: Missing " + dep.name.toStdString()); } dependenciesOk = false; } else if (dItem->state() != ResourceState::VALID) { QString rtn = dItem->resourceList()->resourceTypeNameSingle(); err.addError("Dependency Error: " + rtn.toStdString() + u8" · " + dep.name.toStdString()); dependenciesOk = false; } } if (dependenciesOk) { try { bool s = compileResource(err); setState(s ? ResourceState::VALID : ResourceState::ERROR); } catch (const std::exception& ex) { err.addError(std::string("EXCEPTION: ") + ex.what()); setState(ResourceState::ERROR); } _errorList = std::move(err); emit errorListChanged(); emit resourceComplied(); } else { _errorList = std::move(err); emit errorListChanged(); setState(ResourceState::DEPENDENCY_ERROR); } }
std::unique_ptr<AnimatedTilesetData> convertAnimationFrames(const AnimationFramesInput& input, const PaletteInput& paletteInput, ErrorList& err) { bool valid = input.validate(err); if (!valid) { return nullptr; } const unsigned initialErrorCount = err.errorCount(); const auto& firstImageFilename = input.frameImageFilenames.front(); const auto& imgSize = ImageCache::loadPngImage(firstImageFilename)->size(); auto ret = std::make_unique<AnimatedTilesetData>(input.bitDepth); ret->animationDelay = input.animationDelay; const usize mapSize(imgSize.width / 8, imgSize.height / 8); const auto palette = extractFirstPalette(paletteInput, input.bitDepth, err); if (palette.empty()) { return nullptr; } auto invalidImagesError = std::make_unique<InvalidImageError>(); const auto frameTiles = tilesFromFrameImages(input, palette, err); if (initialErrorCount != err.errorCount()) { return nullptr; } const auto tilesetIntermediate = combineFrameTiles(frameTiles, mapSize.width, err); if (input.addTransparentTile) { ret->staticTiles.addTile(); } buildTilesetAndTilemap(*ret, mapSize, tilesetIntermediate); if (initialErrorCount != err.errorCount()) { return nullptr; } valid = ret->validate(err); if (!valid) { return nullptr; } return ret; }
ActionPointMapping MetaSprite::generateActionPointMapping(const NamedList<ActionPointFunction>& apFunctions, ErrorList& err) { bool valid = true; auto addError = [&](const std::string msg) { err.addError(std::move(msg)); valid = false; }; auto addApfError = [&](const ActionPointFunction& apf, const std::string msg) { err.addError(std::make_unique<ListItemError>(&apf, std::move(msg))); valid = false; }; ActionPointMapping ret; if (apFunctions.empty()) { addError("Expected at least one action point function"); return ret; } if (apFunctions.size() > MAX_ACTION_POINT_FUNCTIONS) { addError("Too many action point functions (max " + std::to_string(MAX_ACTION_POINT_FUNCTIONS) + ")"); return ret; } ret.reserve(apFunctions.size()); for (unsigned i = 0; i < apFunctions.size(); i++) { const unsigned romValue = (i + 1) * 2; assert(romValue <= 255 - 2); const ActionPointFunction& apf = apFunctions.at(i); if (not apf.name.isValid()) { addApfError(apf, "Missing action point function name"); } auto success = ret.emplace(apf.name, romValue); if (success.second == false) { addApfError(apf, "Action point function name already exists: " + apf.name); } } if (not valid) { ret.clear(); } return ret; }
bool AnimationFramesInput::validate(ErrorList& err) const { bool valid = true; if (bitDepth != 2 && bitDepth != 4 && bitDepth != 8) { err.addError("Invalid bit-depth, expected 2, 4 or 8"); valid = false; } if (frameImageFilenames.empty()) { err.addError("Missing frame image"); valid = false; } std::vector<usize> imageSizes(frameImageFilenames.size()); for (unsigned i = 0; i < frameImageFilenames.size(); i++) { const auto& imageFilename = frameImageFilenames.at(i); const auto& image = ImageCache::loadPngImage(imageFilename); imageSizes.at(i) = image->size(); if (image->empty()) { err.addError("Missing frame image: " + image->errorString()); valid = false; break; } if (image->size().width % 8 != 0 || image->size().height % 8 != 0) { err.addError("image size invalid (height and width must be a multiple of 8): " + imageFilename); valid = false; } } if (valid) { for (const usize& imgSize : imageSizes) { if (imgSize != imageSizes.front()) { err.addError("All frame images must be the same size"); valid = false; break; } } } return valid; }
void ErrorWindow::AppendToList(ErrorList& list) { list.Rewind(); error_msg* message = list.GetNextItem(); int32 counter = 0; while (message != NULL) { error_msg* newmessage = new error_msg; *newmessage = *message; fErrors.msglist.AddItem(newmessage); ErrMsgToItem(newmessage); if (counter % 5 == 0) UpdateIfNeeded(); counter++; message = list.GetNextItem(); } }
void AbstractResourceItem::loadResource() { Q_ASSERT(_undoStack->count() == 0); ErrorList err; try { bool s = loadResourceData(err); setState(s ? ResourceState::UNCHECKED : ResourceState::FILE_ERROR); } catch (const std::exception& ex) { err.addError(std::string("EXCEPTION: ") + ex.what()); setState(ResourceState::FILE_ERROR); } _errorList = std::move(err); emit resourceLoaded(); emit errorListChanged(); }
static bool _testFrameSet(const FrameSetExportOrder& eo, const FrameSetT& frameSet, ErrorList& errorList) { bool valid = true; for (auto& en : eo.stillFrames) { if (en.frameExists(frameSet.frames) == false) { errorList.addError("Cannot find frame " + en.name); valid = false; } } for (auto& en : eo.animations) { if (en.animationExists(frameSet.animations) == false) { errorList.addError("Cannot find animation " + en.name); valid = false; } } return valid; }
bool Animation::_validate(const FrameSetT& frameSet, ErrorList& err) const { const unsigned oldErrorCount = err.errorCount(); if (oneShot == false && nextAnimation.isValid()) { if (!frameSet.animations.find(nextAnimation)) { err.addError(animationError(*this, "Cannot find animation " + nextAnimation)); } } if (frames.size() == 0) { err.addError(animationError(*this, "Expected at least one animation frame")); } for (unsigned i = 0; i < frames.size(); i++) { const AnimationFrame& aFrame = frames.at(i); if (aFrame.testFrameValid(frameSet) == false) { err.addError(animationFrameError(*this, i, "Cannot find frame " + aFrame.frame.name)); } } return err.errorCount() == oldErrorCount; }
void TfDiagnosticMgr::_SpliceErrors(ErrorList &src) { if (!HasActiveErrorMark()) { for (ErrorList::const_iterator i = src.begin(), end = src.end(); i != end; ++i) { _ReportError(*i); } } else { // Reassign new serial numbers to the errors. size_t serial = _nextSerial.fetch_and_add(src.size()); for (auto& error : src) { error._data->_serial = serial++; } // Now splice them into the main list. ErrorList &errorList = _errorList.local(); // We store the begin iterator from the new list. This iterator remains // valid *after the splice*, and iterates the spliced elements from src // in errorList. ErrorList::iterator newErrorsBegin = src.begin(); errorList.splice(errorList.end(), src); _AppendErrorsToLogText(newErrorsBegin); } }
/** * @brief Database::load * @param errorList */ void Database::load(ErrorList &errorList) { QFile f(makeFullPath()); if (f.open(QIODevice::ReadOnly)) { QJsonParseError errorMessage; QJsonDocument jdoc(QJsonDocument::fromJson(f.readAll(), &errorMessage)); if (errorMessage.error == QJsonParseError::NoError) { fromJson(jdoc.object(), errorList); } else { errorList << errorMessage.errorString(); } } else { errorList << QObject::tr("Can't load database: %1.").arg(f.fileName()); } m_Valid = errorList.isEmpty(); }
/** * @brief RelationFactory::make * @param src * @param addToScene * @return */ SharedRelation RelationFactory::make(const QJsonObject &src, ErrorList &errors, CreationOptions options) const { if (src.contains(relationship::Relation::typeMarker())) { auto relType = RelationType(src[relationship::Relation::typeMarker()].toInt()); if (auto maker = G_ASSERT(relationMaker[relType])) { db::WeakTypeSearchers ts {G_ASSERT(project())->database(), G_ASSERT(project())->globalDatabase()}; if (auto relation = maker(common::ID::nullID(), common::ID::nullID(), ts)) { relation->fromJson(src, errors); if (errors.isEmpty()) { addRelation(relation, G_ASSERT(project())->database(), scene(), options); return relation; } else { qWarning() << "Relation was loaded with errors."; } } } } return nullptr; }
static std::vector<std::vector<FrameTile>> tilesFromFrameImages(const AnimationFramesInput input, const std::vector<Snes::SnesColor>& palettes, ErrorList& err) { const unsigned colorsPerPalette = 1 << input.bitDepth; std::vector<std::vector<FrameTile>> frameTiles; frameTiles.reserve(input.frameImageFilenames.size()); const unsigned nFrames = input.frameImageFilenames.size(); for (unsigned frameId = 0; frameId < nFrames; frameId++) { auto imageErr = std::make_unique<InvalidImageError>(frameId); const auto& image = ImageCache::loadPngImage(input.frameImageFilenames.at(frameId)); frameTiles.emplace_back( tilesFromFrameImage(*image, palettes, colorsPerPalette, *imageErr)); if (imageErr->hasError()) { err.addError(std::move(imageErr)); } } return frameTiles; }
/* Test for the required minimum number of columns selected and * the selection is consistent. * @param An ErrorList object to which all found issues are added. */ void GncTxImport::verify_column_selections (ErrorList& error_msg) { /* Verify if a date column is selected and it's parsable. */ if (!check_for_column_type(GncTransPropType::DATE)) error_msg.add_error( _("Please select a date column.")); /* Verify if an account is selected either in the base account selector * or via a column in the import data. */ if (!check_for_column_type(GncTransPropType::ACCOUNT)) { if (m_settings.m_multi_split) error_msg.add_error( _("Please select an account column.")); else if (!m_settings.m_base_account) error_msg.add_error( _("Please select an account column or set a base account in the Account field.")); } /* Verify a description column is selected. */ if (!check_for_column_type(GncTransPropType::DESCRIPTION)) error_msg.add_error( _("Please select a description column.")); /* Verify at least one amount column (deposit or withdrawal) column is selected. */ if (!check_for_column_type(GncTransPropType::DEPOSIT) && !check_for_column_type(GncTransPropType::WITHDRAWAL)) error_msg.add_error( _("Please select a deposit or withdrawal column.")); /* Verify a transfer account is selected if any of the other transfer properties * are selected. */ if ((check_for_column_type(GncTransPropType::TACTION) || check_for_column_type(GncTransPropType::TMEMO) || check_for_column_type(GncTransPropType::TREC_STATE) || check_for_column_type(GncTransPropType::TREC_DATE)) && !check_for_column_type(GncTransPropType::TACCOUNT)) error_msg.add_error( _("Please select a transfer account column or remove the other transfer related columns.")); }
MemCheckIterTools::ErrorListIterator::ErrorListIterator(ErrorList & l, const IterTool & iterTool) : p(l.begin()), m_end(l.end()), m_iterTool(iterTool) { while (p != m_end && m_iterTool.omitSuppressed && p->suppressed) ++p; }
void ProjectWindow::MessageReceived(BMessage *msg) { status_t status; if ( (msg->WasDropped() && msg->what == B_SIMPLE_DATA) || msg->what == M_ADD_FILES) { fAddFileStruct.refmsg = *msg; fAddFileStruct.parent = this; uint32 buttons; fProjectList->GetMouse(&fAddFileStruct.droppt,&buttons); thread_id addThread = spawn_thread(AddFileThread,"file adding thread", B_NORMAL_PRIORITY, &fAddFileStruct); if (addThread >= 0) resume_thread(addThread); } switch (msg->what) { case M_IMPORT_REFS: { fImportStruct.refmsg = *msg; fImportStruct.parent = this; thread_id importThread = spawn_thread(ImportFileThread,"file import thread", B_NORMAL_PRIORITY, &fImportStruct); if (importThread >= 0) resume_thread(importThread); break; } case M_BACKUP_PROJECT: { thread_id backupThread = spawn_thread(BackupThread,"project backup thread", B_NORMAL_PRIORITY, this); if (backupThread >= 0) { fStatusBar->SetText(TR("Backing up project")); UpdateIfNeeded(); SetMenuLock(true); resume_thread(backupThread); } break; } case M_GET_CHECK_IN_MSG: { if (!fSourceControl) { printf("NULL source control\n"); break; } BString out; fSourceControl->GetCheckinHeader(out); bool select = false; if (out.CountChars() > 1) out.Prepend("\n\n"); else { out = TR("Enter the description for the changes in this revision."); select = true; } GetTextWindow *gtw = new GetTextWindow("Paladin", out.String(), BMessage(M_CHECK_IN_PROJECT), BMessenger(this)); if (!select) gtw->GetTextView()->Select(0,0); gtw->Show(); break; } case M_CHECK_IN_PROJECT: { BString commitstr; if (msg->FindString("text", &commitstr) == B_OK && fSourceControl) { SCMOutputWindow *win = new SCMOutputWindow(TR("Commit")); win->Show(); fSourceControl->Commit(commitstr.String()); } break; } case M_REVERT_PROJECT: { if (!fSourceControl) break; int32 result = ShowAlert(TR("This will undo all changes since the last commit. " "Continue?"), "Don't Revert", "Revert"); if (result == 1) { SCMOutputWindow *win = new SCMOutputWindow(TR("Revert")); win->Show(); fSourceControl->Revert(NULL); } break; } case M_REBUILD_FILE: case M_ADD_SELECTION_TO_REPO: case M_REMOVE_SELECTION_FROM_REPO: case M_REVERT_SELECTION: case M_DIFF_SELECTION: { ActOnSelectedFiles(msg->what); break; } case M_DIFF_PROJECT: { if (fSourceControl) { SCMOutputWindow *win = new SCMOutputWindow(TR("Differences")); win->Show(); fSourceControl->Diff(NULL); } break; } case M_PROJECT_SCM_STATUS: { if (fSourceControl) { SCMOutputWindow *win = new SCMOutputWindow(TR("Project Status")); BString strstatus; fSourceControl->GetChangeStatus(strstatus); win->GetTextView()->SetText(strstatus.String()); win->Show(); } break; } case M_PUSH_PROJECT: { if (fSourceControl) { SCMOutputWindow *win = new SCMOutputWindow(TR("Push")); win->Show(); fSourceControl->Push(NULL); } break; } case M_PULL_PROJECT: { if (fSourceControl) { SCMOutputWindow *win = new SCMOutputWindow(TR("Pull")); win->Show(); status = fSourceControl->Pull(NULL); if (!status) ShowAlert("Unable to pull from the remote repository. If it " "uses a secure connection, please set up the appropriate " "SSH keys on the remote server.", "OK"); } break; } case M_CULL_EMPTY_GROUPS: { CullEmptyGroups(); break; } case M_RUN_FILE_TYPES: { int32 selection = fProjectList->FullListCurrentSelection(); if (selection < 0) break; SourceFileItem *item = dynamic_cast<SourceFileItem*>(fProjectList->FullListItemAt(selection)); if (!item) break; SpawnFileTypes(item->GetData()->GetPath()); break; } case M_OPEN_PARENT_FOLDER: { BMessage openmsg(B_REFS_RECEIVED); int32 selindex = 0; int32 selection = fProjectList->FullListCurrentSelection(); selindex++; if (selection >= 0) { while (selection >= 0) { SourceFileItem *item = dynamic_cast<SourceFileItem*>(fProjectList->FullListItemAt(selection)); if (!item) break; SourceFile *file = item->GetData(); BString abspath = file->GetPath().GetFullPath(); if (abspath[0] != '/') { abspath.Prepend("/"); abspath.Prepend(fProject->GetPath().GetFolder()); } DPath filepath(abspath); entry_ref ref; BEntry(filepath.GetFolder()).GetRef(&ref); openmsg.AddRef("refs",&ref); selection = fProjectList->FullListCurrentSelection(selindex++); } BMessenger msgr("application/x-vnd.Be-TRAK"); msgr.SendMessage(&openmsg); } break; } case M_SHOW_PROJECT_FOLDER: { entry_ref ref; BEntry(fProject->GetPath().GetFolder()).GetRef(&ref); BMessenger msgr("application/x-vnd.Be-TRAK"); BMessage openmsg(B_REFS_RECEIVED); openmsg.AddRef("refs",&ref); msgr.SendMessage(&openmsg); break; } case M_SHOW_ASCII_TABLE: { AsciiWindow *ascwin = new AsciiWindow(); ascwin->Show(); break; } case M_SHOW_VREGEX: { VRegWindow *vregwin = new VRegWindow(); vregwin->Show(); break; } case M_SHOW_LICENSES: { LicenseManager *man = new LicenseManager(fProject->GetPath().GetFolder()); man->Show(); break; } case M_RUN_TOOL: { BString sig; if (msg->FindString("signature", &sig) == B_OK) { LaunchHelper launcher(sig.String()); launcher.Launch(); } break; } case M_MAKE_MAKE: { DPath out(fProject->GetPath().GetFolder()); out.Append("Makefile"); if (MakeMake(fProject,out) == B_OK); { BEntry entry(out.GetFullPath()); entry_ref ref; if (entry.InitCheck() == B_OK) { entry.GetRef(&ref); BMessage refmsg(B_REFS_RECEIVED); refmsg.AddRef("refs",&ref); be_app->PostMessage(&refmsg); } } break; } case M_SHOW_CODE_LIBRARY: { #ifdef BUILD_CODE_LIBRARY CodeLibWindow *libwin = CodeLibWindow::GetInstance(BRect(100,100,500,350)); libwin->Show(); #endif break; } case M_OPEN_PARTNER: { int32 selection = fProjectList->FullListCurrentSelection(); if (selection < 0) break; SourceFileItem *item = dynamic_cast<SourceFileItem*>( fProjectList->FullListItemAt(selection)); if (!item) break; entry_ref ref; BEntry(fProject->GetPathForFile(item->GetData()).GetFullPath()).GetRef(&ref); BMessage refmsg(M_OPEN_PARTNER); refmsg.AddRef("refs",&ref); be_app->PostMessage(&refmsg); break; } case M_NEW_GROUP: { MakeGroup(fProjectList->FullListCurrentSelection()); PostMessage(M_SHOW_RENAME_GROUP); break; } case M_SHOW_RENAME_GROUP: { int32 selection = fProjectList->FullListCurrentSelection(); SourceGroupItem *groupItem = NULL; if (selection < 0) { // Don't need a selection if there is only one group in the project if (fProject->CountGroups() == 1) groupItem = fProjectList->ItemForGroup(fProject->GroupAt(0)); } else { BStringItem *strItem = (BStringItem*)fProjectList->FullListItemAt(selection); groupItem = fProjectList->GroupForItem(strItem); } if (!groupItem) break; GroupRenameWindow *grwin = new GroupRenameWindow(groupItem->GetData(), BMessage(M_RENAME_GROUP), BMessenger(this)); grwin->Show(); break; } case M_RENAME_GROUP: { SourceGroup *group; BString newname; if (msg->FindPointer("group",(void**)&group) != B_OK || msg->FindString("newname",&newname) != B_OK) break; group->name = newname; SourceGroupItem *groupItem = fProjectList->ItemForGroup(group); if (!groupItem) break; groupItem->SetText(newname.String()); fProjectList->InvalidateItem(fProjectList->IndexOf(groupItem)); fProject->Save(); break; } case M_SORT_GROUP: { int32 selection = fProjectList->FullListCurrentSelection(); SourceGroupItem *groupItem = NULL; if (selection < 0) { // Don't need a selection if there is only one group in the project if (fProject->CountGroups() == 1) groupItem = fProjectList->ItemForGroup(fProject->GroupAt(0)); } else { BStringItem *strItem = (BStringItem*)fProjectList->FullListItemAt(selection); groupItem = fProjectList->GroupForItem(strItem); } if (!groupItem) break; fProjectList->SortItemsUnder(groupItem,true,compare_source_file_items); groupItem->GetData()->Sort(); fProject->Save(); break; } case M_TOGGLE_ERROR_WINDOW: { ToggleErrorWindow(fProject->GetErrorList()); break; } case M_SHOW_ERROR_WINDOW: { ShowErrorWindow(fProject->GetErrorList()); break; } case M_SHOW_PROJECT_SETTINGS: { BRect r(0,0,350,300); BRect screen(BScreen().Frame()); r.OffsetTo((screen.Width() - r.Width()) / 2.0, (screen.Height() - r.Height()) / 2.0); ProjectSettingsWindow *win = new ProjectSettingsWindow(r,fProject); win->Show(); break; } case M_SHOW_RUN_ARGS: { RunArgsWindow *argwin = new RunArgsWindow(fProject); argwin->Show(); break; } case M_JUMP_TO_MSG: { entry_ref ref; if (msg->FindRef("refs",&ref) == B_OK) { msg->what = B_REFS_RECEIVED; be_app->PostMessage(msg); } break; } case B_ABOUT_REQUESTED: { be_app->PostMessage(B_ABOUT_REQUESTED); break; } case M_SHOW_OPEN_PROJECT: { be_app->PostMessage(msg); break; } case M_NEW_WINDOW: { be_app->PostMessage(M_NEW_PROJECT); break; } case M_SHOW_PROGRAM_SETTINGS: { PrefsWindow *prefwin = new PrefsWindow(BRect(0,0,500,400)); prefwin->Show(); break; } case M_SHOW_FIND_AND_OPEN_PANEL: { BString text; msg->FindString("name",&text); // Passing a NULL string to this is OK FindOpenFileWindow *findwin = new FindOpenFileWindow(text.String()); findwin->Show(); break; } case M_FILE_NEEDS_BUILD: { SourceFile *file; if (msg->FindPointer("file",(void**)&file) == B_OK) { SourceFileItem *item = fProjectList->ItemForFile(file); if (item) { item->SetDisplayState(SFITEM_NEEDS_BUILD); fProjectList->InvalidateItem(fProjectList->IndexOf(item)); } } break; } case M_EDIT_FILE: { int32 i = 0; int32 selection = fProjectList->FullListCurrentSelection(i); i++; BMessage refmsg(B_REFS_RECEIVED); while (selection >= 0) { SourceFileItem *item = dynamic_cast<SourceFileItem*> (fProjectList->FullListItemAt(selection)); if (item && item->GetData()) { BString abspath = item->GetData()->GetPath().GetFullPath(); if (abspath[0] != '/') { abspath.Prepend("/"); abspath.Prepend(fProject->GetPath().GetFolder()); } BEntry entry(abspath.String()); if (entry.InitCheck() == B_OK) { entry_ref ref; entry.GetRef(&ref); refmsg.AddRef("refs",&ref); } else { if (!entry.Exists()) { BString errmsg = TR("Couldn't find XXXXX. It may have been moved or renamed."); errmsg.ReplaceFirst("XXXXX",abspath.String()); ShowAlert(errmsg.String()); } } } else { SourceGroupItem *groupItem = dynamic_cast<SourceGroupItem*> (fProjectList->FullListItemAt(selection)); if (groupItem) { if (groupItem->IsExpanded()) fProjectList->Collapse(groupItem); else fProjectList->Expand(groupItem); groupItem->GetData()->expanded = groupItem->IsExpanded(); } } selection = fProjectList->CurrentSelection(i); i++; } be_app->PostMessage(&refmsg); break; } case M_LIBWIN_CLOSED: { fShowingLibs = false; break; } case M_SHOW_LIBRARIES: { fShowingLibs = true; LibraryWindow *libwin = new LibraryWindow(Frame().OffsetByCopy(15,15), BMessenger(this), fProject); libwin->Show(); break; } case M_SHOW_ADD_NEW_PANEL: { AddNewFileWindow *anfwin = new AddNewFileWindow(BMessage(M_ADD_NEW_FILE), BMessenger(this)); anfwin->Show(); break; } case M_SHOW_FIND_IN_PROJECT_FILES: { if (!gLuaAvailable) { ShowAlert("Paladin's multi-file Find window depends on Lua. It will " "need to be installed if you wish to use this feature.", "OK", NULL, NULL, B_STOP_ALERT); break; } FindWindow *findwin = new FindWindow(); findwin->Show(); break; } case M_ADD_NEW_FILE: { BString name; bool makepair; if (msg->FindString("name",&name) == B_OK && msg->FindBool("makepair",&makepair) == B_OK) AddNewFile(name,makepair); break; } case M_SHOW_ADD_PANEL: { if (!fFilePanel) { BMessenger msgr(this); BEntry entry(fProject->GetPath().GetFolder()); entry_ref ref; entry.GetRef(&ref); fFilePanel = new BFilePanel(B_OPEN_PANEL,&msgr,&ref,B_FILE_NODE,true, new BMessage(M_ADD_FILES)); } fFilePanel->Show(); break; } case M_REMOVE_FILES: { bool save = false; for (int32 i = 0; i < fProjectList->CountItems(); i++) { SourceFileItem *item = dynamic_cast<SourceFileItem*>(fProjectList->ItemAt(i)); if (item && item->IsSelected()) { fProjectList->RemoveItem(item); fProject->RemoveFile(item->GetData()); delete item; save = true; i--; } } CullEmptyGroups(); if (save) fProject->Save(); break; } case M_EMPTY_CCACHE: { // We don't do this when forcing a rebuild of the sources because sometimes it // can take quite a while if (gUseCCache && gCCacheAvailable) { fStatusBar->SetText(TR("Emptying build cache")); UpdateIfNeeded(); system("ccache -c > /dev/null"); fStatusBar->SetText(""); UpdateIfNeeded(); } break; } case M_FORCE_REBUILD: { fProject->ForceRebuild(); for (int32 i = 0; i < fProjectList->FullListCountItems(); i++) { SourceFileItem *item = dynamic_cast<SourceFileItem*>(fProjectList->FullListItemAt(i)); if (!item) continue; SourceFile *file = item->GetData(); if (file->UsesBuild()) { item->SetDisplayState(SFITEM_NEEDS_BUILD); fProjectList->InvalidateItem(i); } } // This is necessary because InvalidateItem() uses indices from ItemAt(), // not FullListItemAt fProjectList->Invalidate(); break; } case M_UPDATE_DEPENDENCIES: { UpdateDependencies(); break; } case M_MAKE_PROJECT: case M_BUILD_PROJECT: { fBuildingFile = 0; DoBuild(POSTBUILD_NOTHING); break; } case M_RUN_PROJECT: { DoBuild(POSTBUILD_RUN); break; } case M_RUN_IN_TERMINAL: { DoBuild(POSTBUILD_RUN_IN_TERMINAL); break; } case M_DEBUG_PROJECT: { if (!fProject->Debug()) { BString errmsg = TR("Your project does not have debugging information compiled "); errmsg << TR("in and will need to be rebuilt to debug. Do you wish to rebuild and ") << TR("run the debugger?"); int32 result = ShowAlert("Debugging information needs to compiled into " "your project. This may take some time for large " "projects. Do you wish to rebuild and run " "the debugger?", "Rebuild","Cancel"); if (result == 1) break; fProject->SetDebug(true); fProject->Save(); fProject->ForceRebuild(); } DoBuild(POSTBUILD_DEBUG); break; } case M_EXAMINING_FILE: { SourceFile *file; if (msg->FindPointer("file",(void**)&file) == B_OK) { BString out; out << TR("Examining ") << file->GetPath().GetFileName(); fStatusBar->SetText(out.String()); } break; } case M_BUILDING_FILE: { SourceFile *file; if (msg->FindPointer("sourcefile",(void**)&file) == B_OK) { SourceFileItem *item = fProjectList->ItemForFile(file); if (item) { item->SetDisplayState(SFITEM_BUILDING); fProjectList->InvalidateItem(fProjectList->IndexOf(item)); BString out; int32 count,total; if (msg->FindInt32("count",&count) == B_OK && msg->FindInt32("total",&total) == B_OK) { fBuildingFile = MAX(fBuildingFile, count); out << "(" << fBuildingFile << "/" << total << ") "; } out << TR("Building ") << item->Text(); fStatusBar->SetText(out.String()); } } break; } case M_BUILDING_DONE: { SourceFile *file; if (msg->FindPointer("sourcefile",(void**)&file) == B_OK) { SourceFileItem *item = fProjectList->ItemForFile(file); if (item) { item->SetDisplayState(SFITEM_NORMAL); fProjectList->InvalidateItem(fProjectList->IndexOf(item)); } } break; } case M_LINKING_PROJECT: { fStatusBar->SetText(TR("Linking")); break; } case M_UPDATING_RESOURCES: { fStatusBar->SetText(TR("Updating Resources")); break; } case M_DOING_POSTBUILD: { fStatusBar->SetText(TR("Performing Post-build tasks")); break; } case M_BUILD_FAILURE: { SetMenuLock(false); // fall through } case M_BUILD_MESSAGES: case M_BUILD_WARNINGS: { if (!fErrorWindow) { BRect screen(BScreen().Frame()); BRect r(screen); r.left = r.right / 4.0; r.right *= .75; r.top = r.bottom - 200; BDeskbar deskbar; if (deskbar.Location() == B_DESKBAR_BOTTOM) r.OffsetBy(0,-deskbar.Frame().Height()); fErrorWindow = new ErrorWindow(r,this); fErrorWindow->Show(); } else { if (!fErrorWindow->IsFront()) fErrorWindow->Activate(); } fStatusBar->SetText(""); // Should this be an Unflatten or an Append? ErrorList *errorList = fProject->GetErrorList(); errorList->Unflatten(*msg); fErrorWindow->PostMessage(msg); break; } case M_BUILD_SUCCESS: { SetMenuLock(false); fStatusBar->SetText(""); break; } case M_ERRORWIN_CLOSED: { fErrorWindow = NULL; break; } case M_SYNC_MODULES: { #ifdef BUILD_CODE_LIBRARY thread_id syncID = spawn_thread(SyncThread,"module update thread", B_NORMAL_PRIORITY, this); if (syncID >= 0) resume_thread(syncID); #endif break; } case M_TOGGLE_DEBUG_MENU: { ToggleDebugMenu(); break; } case M_DEBUG_DUMP_DEPENDENCIES: { DumpDependencies(fProject); break; } case M_DEBUG_DUMP_INCLUDES: { DumpIncludes(fProject); break; } default: { DWindow::MessageReceived(msg); break; } } }
string compile(StringMap const& _sources, bool _optimize, CStyleReadFileCallback _readCallback) { Json::Value output(Json::objectValue); Json::Value errors(Json::arrayValue); CompilerStack::ReadFileCallback readCallback; if (_readCallback) { readCallback = [=](string const& _path) { char* contents_c = nullptr; char* error_c = nullptr; _readCallback(_path.c_str(), &contents_c, &error_c); CompilerStack::ReadFileResult result; result.success = true; if (!contents_c && !error_c) { result.success = false; result.contentsOrErrorMesage = "File not found."; } if (contents_c) { result.success = true; result.contentsOrErrorMesage = string(contents_c); free(contents_c); } if (error_c) { result.success = false; result.contentsOrErrorMesage = string(error_c); free(error_c); } return result; }; } CompilerStack compiler(readCallback); auto scannerFromSourceName = [&](string const& _sourceName) -> solidity::Scanner const& { return compiler.scanner(_sourceName); }; bool success = false; try { compiler.addSources(_sources); bool succ = compiler.compile(_optimize); for (auto const& error: compiler.errors()) { auto err = dynamic_pointer_cast<Error const>(error); errors.append(formatError( *error, (err->type() == Error::Type::Warning) ? "Warning" : "Error", scannerFromSourceName )); } success = succ; // keep success false on exception } catch (Error const& error) { errors.append(formatError(error, error.typeName(), scannerFromSourceName)); } catch (CompilerError const& exception) { errors.append(formatError(exception, "Compiler error", scannerFromSourceName)); } catch (InternalCompilerError const& exception) { errors.append(formatError(exception, "Internal compiler error", scannerFromSourceName)); } catch (Exception const& exception) { errors.append("Exception during compilation: " + boost::diagnostic_information(exception)); } catch (...) { errors.append("Unknown exception during compilation."); } if (errors.size() > 0) output["errors"] = errors; if (success) { try { output["contracts"] = Json::Value(Json::objectValue); for (string const& contractName: compiler.contractNames()) { Json::Value contractData(Json::objectValue); contractData["interface"] = compiler.interface(contractName); contractData["bytecode"] = compiler.object(contractName).toHex(); contractData["runtimeBytecode"] = compiler.runtimeObject(contractName).toHex(); contractData["opcodes"] = solidity::disassemble(compiler.object(contractName).bytecode); contractData["functionHashes"] = functionHashes(compiler.contractDefinition(contractName)); contractData["gasEstimates"] = estimateGas(compiler, contractName); auto sourceMap = compiler.sourceMapping(contractName); contractData["srcmap"] = sourceMap ? *sourceMap : ""; auto runtimeSourceMap = compiler.runtimeSourceMapping(contractName); contractData["srcmapRuntime"] = runtimeSourceMap ? *runtimeSourceMap : ""; ostringstream unused; contractData["assembly"] = compiler.streamAssembly(unused, contractName, _sources, true); output["contracts"][contractName] = contractData; } } catch (...) { output["errors"].append("Unknown exception while generating contract data output."); } try { // Do not taint the internal error list ErrorList formalErrors; if (compiler.prepareFormalAnalysis(&formalErrors)) output["formal"]["why3"] = compiler.formalTranslation(); if (!formalErrors.empty()) { Json::Value errors(Json::arrayValue); for (auto const& error: formalErrors) errors.append(formatError( *error, (error->type() == Error::Type::Warning) ? "Warning" : "Error", scannerFromSourceName )); output["formal"]["errors"] = errors; } } catch (...) { output["errors"].append("Unknown exception while generating formal method output."); } try { // Indices into this array are used to abbreviate source names in source locations. output["sourceList"] = Json::Value(Json::arrayValue); for (auto const& source: compiler.sourceNames()) output["sourceList"].append(source); output["sources"] = Json::Value(Json::objectValue); for (auto const& source: compiler.sourceNames()) output["sources"][source]["AST"] = ASTJsonConverter(compiler.ast(source), compiler.sourceIndices()).json(); } catch (...) { output["errors"].append("Unknown exception while generating source name output."); } } try { return Json::FastWriter().write(output); } catch (...) { return "{\"errors\":[\"Unknown error while generating JSON.\"]}"; } }
void App::MessageReceived(BMessage *msg) { switch (msg->what) { case M_MAKE_PROJECT: case M_RUN_PROJECT: case M_RUN_IN_TERMINAL: case M_RUN_IN_DEBUGGER: case M_RUN_WITH_ARGS: case M_FORCE_REBUILD: case M_SHOW_ADD_NEW_PANEL: case M_SHOW_FIND_AND_OPEN_PANEL: case M_SHOW_FIND_IN_PROJECT_FILES: case M_SHOW_ERROR_WINDOW: case M_TOGGLE_ERROR_WINDOW: { entry_ref ref; if (msg->FindRef("refs",&ref) == B_OK) PostToProjectWindow(msg,&ref); else PostToProjectWindow(msg,NULL); break; } case M_OPEN_PARTNER: { entry_ref ref; if (msg->FindRef("refs",&ref) == B_OK) OpenPartner(ref); break; } case M_NEW_PROJECT: { TemplateWindow *win = new TemplateWindow(BRect(100, 100, 400, 300)); win->Show(); break; } case M_SHOW_OPEN_PROJECT: { CheckCreateOpenPanel(); fOpenPanel->Show(); break; } case M_CREATE_PROJECT: { CreateNewProject(*msg); break; } case M_QUICK_IMPORT: { entry_ref ref; if (msg->FindRef("refs",&ref) != B_OK || !QuickImportProject(DPath(ref))) { StartWindow *startwin = new StartWindow(); startwin->Show(); break; } break; } // These are for quit determination. We have to use our own counter variable // (sWindowCount) because BFilePanels throw the count off. Using a variable // is much preferable to subclassing just for this reason. case M_REGISTER_WINDOW: { sWindowCount++; break; } case M_DEREGISTER_WINDOW: { sWindowCount--; if (sWindowCount <= 1) PostMessage(B_QUIT_REQUESTED); break; } case EDIT_OPEN_FILE: { int32 index = 0; entry_ref ref; while (msg->FindRef("refs",index,&ref) == B_OK) { int32 line; if (msg->FindInt32("line",index,&line) != B_OK) line = -1; int32 column; if (msg->FindInt32("column",index,&column) != B_OK) column = -1; OpenFile(ref,line,column); index++; } CheckCreateOpenPanel(); fOpenPanel->GetPanelDirectory(&ref); gLastProjectPath.SetTo(ref); BWindow* openWindow = fOpenPanel->Window(); break; } case M_FIND_AND_OPEN_FILE: { FindAndOpenFile(msg); break; } case M_BUILDING_FILE: { SourceFile *file; if (msg->FindPointer("sourcefile",(void**)&file) == B_OK) printf(B_TRANSLATE("Building %s\n"),file->GetPath().GetFileName()); else printf(B_TRANSLATE("NULL pointer in M_BUILDING_FILE\n")); break; } case M_LINKING_PROJECT: { printf(B_TRANSLATE("Linking\n")); break; } case M_UPDATING_RESOURCES: { printf(B_TRANSLATE("Updating resources\n")); break; } case M_BUILD_FAILURE: { BString errstr; if (msg->FindString("errstr",&errstr) == B_OK) printf("%s\n",errstr.String()); else { ErrorList errors; errors.Unflatten(*msg); printf(B_TRANSLATE("Build failure\n%s"), errors.AsString().String()); } sReturnCode = -1; PostMessage(B_QUIT_REQUESTED); break; } case M_BUILD_WARNINGS: { BString errstr; if (msg->FindString("errstr",&errstr) == B_OK) printf("%s\n",errstr.String()); break; } case M_BUILD_SUCCESS: { printf(B_TRANSLATE("Success\n")); PostMessage(B_QUIT_REQUESTED); break; } default: BApplication::MessageReceived(msg); } }
Route::Route(std::string &line, HighwaySystem *sys, ErrorList &el, std::unordered_map<std::string, Region*> ®ion_hash) { /* initialize object from a .csv file line, but do not yet read in waypoint file */ con_route = 0; mileage = 0; rootOrder = -1; // order within connected route if (line.back() == 0x0D) line.erase(line.end()-1); // trim DOS newlines // system size_t left = line.find(';'); if (left == std::string::npos) { el.add_error("Could not parse " + system->systemname + ".csv line: [" + line + "], expected 8 fields, found 1"); return; } system = sys; if (system->systemname != line.substr(0,left)) { el.add_error("System mismatch parsing " + system->systemname + ".csv line [" + line + "], expected " + system->systemname); return; } // region size_t right = line.find(';', left+1); if (right == std::string::npos) { el.add_error("Could not parse " + system->systemname + ".csv line: [" + line + "], expected 8 fields, found 2"); return; } try { region = region_hash.at(line.substr(left+1, right-left-1)); } catch (const std::out_of_range& oor) { el.add_error("Unrecognized region in " + system->systemname + ".csv line: [" + line + "], " + line.substr(left+1, right-left-1)); region = 0; return; } // route left = right; right = line.find(';', left+1); if (right == std::string::npos) { el.add_error("Could not parse " + system->systemname + ".csv line: [" + line + "], expected 8 fields, found 3"); return; } route = line.substr(left+1, right-left-1); // banner left = right; right = line.find(';', left+1); if (right == std::string::npos) { el.add_error("Could not parse " + system->systemname + ".csv line: [" + line + "], expected 8 fields, found 4"); return; } banner = line.substr(left+1, right-left-1); if (banner.size() > 6) { el.add_error("Banner >6 characters in " + system->systemname + ".csv line: [" + line + "], " + banner); return; } // abbrev left = right; right = line.find(';', left+1); if (right == std::string::npos) { el.add_error("Could not parse " + system->systemname + ".csv line: [" + line + "], expected 8 fields, found 5"); return; } abbrev = line.substr(left+1, right-left-1); if (abbrev.size() > 3) { el.add_error("Abbrev >3 characters in " + system->systemname + ".csv line: [" + line + "], " + abbrev); return; } // city left = right; right = line.find(';', left+1); if (right == std::string::npos) { el.add_error("Could not parse " + system->systemname + ".csv line: [" + line + "], expected 8 fields, found 6"); return; } city = line.substr(left+1, right-left-1); // root left = right; right = line.find(';', left+1); if (right == std::string::npos) { el.add_error("Could not parse " + system->systemname + ".csv line: [" + line + "], expected 8 fields, found 7"); return; } root = line.substr(left+1, right-left-1); // alt_route_names left = right; right = line.find(';', left+1); if (right != std::string::npos) { el.add_error("Could not parse " + system->systemname + ".csv line: [" + line + "], expected 8 fields, found more"); return; } char *arnstr = new char[line.size()-left]; strcpy(arnstr, line.substr(left+1).data()); for (char *token = strtok(arnstr, ","); token; token = strtok(0, ",")) alt_route_names.push_back(token); delete[] arnstr; //yDEBUG*/ std::cout << "returning from Route ctor" << endl; }
void checkDock::runTests( ValidateType type ) { for ( int i = 0; i < mTestTable->rowCount(); ++i ) { QString testName = mTestTable->item( i, 0 )->text(); QString toleranceStr = mTestTable->item( i, 3 )->text(); QString layer1Str = mTestTable->item( i, 4 )->text(); QString layer2Str = mTestTable->item( i, 5 )->text(); // test if layer1 is in the registry if ( !(( QgsVectorLayer* )mLayerRegistry->mapLayers().contains( layer1Str ) ) ) { QgsMessageLog::logMessage( tr( "Layer %1 not found in registry." ).arg( layer1Str ), tr( "Topology plugin" ) ); return; } QgsVectorLayer* layer1 = ( QgsVectorLayer* )mLayerRegistry->mapLayers()[layer1Str]; QgsVectorLayer* layer2 = 0; if (( QgsVectorLayer* )mLayerRegistry->mapLayers().contains( layer2Str ) ) layer2 = ( QgsVectorLayer* )mLayerRegistry->mapLayers()[layer2Str]; QProgressDialog progress( testName, tr( "Abort" ), 0, layer1->featureCount(), this ); progress.setWindowModality( Qt::WindowModal ); connect( &progress, SIGNAL( canceled() ), mTest, SLOT( setTestCancelled() ) ); connect( mTest, SIGNAL( progress( int ) ), &progress, SLOT( setValue( int ) ) ); // run the test ErrorList errors = mTest->runTest( testName, layer1, layer2, type, toleranceStr.toDouble() ); QList<TopolError*>::Iterator it; QgsRubberBand* rb = 0; for ( it = errors.begin(); it != errors.end(); ++it ) { TopolError* te = *it; te->conflict(); QSettings settings; if ( te->conflict()->type() == QGis::Polygon ) { rb = new QgsRubberBand( qgsInterface->mapCanvas(), true ); } else { rb = new QgsRubberBand( qgsInterface->mapCanvas(), te->conflict()->type() ); } rb->setColor( "red" ); rb->setWidth( 4 ); rb->setToGeometry( te->conflict(), layer1 ); rb->show(); mRbErrorMarkers << rb; } disconnect( &progress, SIGNAL( canceled() ), mTest, SLOT( setTestCancelled() ) ); disconnect( mTest, SIGNAL( progress( int ) ), &progress, SLOT( setValue( int ) ) ); mErrorList << errors; } mMarkersVisible = true; mErrorListModel->resetModel(); }
void ErrorWindow::MessageReceived(BMessage* message) { switch (message->what) { case M_RUN_PROJECT: case M_RUN_IN_TERMINAL: case M_RUN_IN_DEBUGGER: case M_RUN_WITH_ARGS: case M_MAKE_PROJECT: case M_FORCE_REBUILD: { fParent->PostMessage(message); break; } case M_TOGGLE_ERRORS: case M_TOGGLE_WARNINGS: { RefreshList(); break; } case M_COPY_ERRORS: { CopyList(); break; } case M_CLEAR_ERROR_LIST: { EmptyList(); fErrors.msglist.MakeEmpty(); break; } case M_BUILD_WARNINGS: case M_BUILD_FAILURE: { ErrorList list; list.Unflatten(*message); AppendToList(list); break; } case M_JUMP_TO_MSG: { int32 selection = fErrorList->CurrentSelection(); if (selection >= 0) { ErrorItem* item = (ErrorItem*)fErrorList->ItemAt(selection); error_msg* gcc = item->GetMessage(); if (gcc->path.Length() < 1) break; entry_ref ref; BEntry entry(gcc->path.String()); entry.GetRef(&ref); message->what = EDIT_OPEN_FILE; message->AddRef("refs", &ref); if (gcc->line > 0) message->AddInt32("line", gcc->line); be_app->PostMessage(message); } break; } default: BWindow::MessageReceived(message); } }
static AnimatedTilesetIntermediate combineFrameTiles(const std::vector<std::vector<FrameTile>>& frameTiles, unsigned tileWidth, ErrorList& err) { assert(!frameTiles.empty()); const unsigned nTiles = frameTiles.front().size(); for (const auto& tf : frameTiles) { assert(tf.size() == nTiles); } auto getTile = [&](unsigned frameId, unsigned tileId) -> const Tile8px& { return frameTiles.at(frameId).at(tileId).tile; }; auto getPalette = [&](unsigned frameId, unsigned tileId) -> unsigned { return frameTiles.at(frameId).at(tileId).palette; }; const unsigned nFrames = frameTiles.size(); auto imageErr = std::make_unique<InvalidImageError>(); AnimatedTilesetIntermediate ret; ret.animatedTiles.reserve(64); ret.tileMap.resize(nTiles); for (unsigned tileId = 0; tileId < nTiles; tileId++) { const static unsigned TS = Tile8px::TILE_SIZE; auto& tm = ret.tileMap.at(tileId); unsigned palette = getPalette(0, tileId); for (unsigned frameId = 1; frameId < nFrames; frameId++) { if (getPalette(frameId, tileId) != palette) { imageErr->addInvalidTile(TS, (tileId % tileWidth) * TS, (tileId / tileWidth) * TS, InvalidImageError::NOT_SAME_PALETTE); break; } } tm.palette = palette; const Tile8px& firstTile = getTile(0, tileId); bool isAnimated = false; for (unsigned frameId = 1; frameId < nFrames; frameId++) { if (getTile(frameId, tileId) != firstTile) { isAnimated = true; break; } } tm.isAnimated = isAnimated; if (isAnimated == false) { tm.tile = ret.staticTiles.size(); ret.staticTiles.emplace_back(firstTile); } else { tm.tile = ret.animatedTiles.size(); ret.animatedTiles.emplace_back(nFrames); auto& animatedTile = ret.animatedTiles.back(); for (unsigned frameId = 0; frameId < nFrames; frameId++) { animatedTile.at(frameId) = getTile(frameId, tileId); } } } if (imageErr->hasError()) { err.addError(std::move(imageErr)); } return ret; }