void KPluginSelectionWidget::executed(QListViewItem *item) { kdDebug(702) << k_funcinfo << endl; if(item == 0) return; // Why not a dynamic_cast? - Martijn // because this is what the Qt API suggests; and since gcc 3.x I don't // trust dynamic_cast anymore - mkretz if(item->rtti() != 1) // check for a QCheckListItem return; QCheckListItem *citem = static_cast< QCheckListItem * >(item); bool checked = citem->isOn(); // kdDebug( 702 ) << "it's a " << ( checked ? "checked" : "unchecked" ) // << " QCheckListItem" << endl; KPluginInfo *info = d->pluginInfoMap[citem]; Q_ASSERT(!info->isHidden()); if(info->isPluginEnabled() != checked) { kdDebug(702) << "Item changed state, emitting changed()" << endl; if(!d->plugincheckedchanged[info]) { ++d->changed; if(d->changed == 1) emit changed(true); } d->plugincheckedchanged[info] = true; checkDependencies(info); } else { if(d->plugincheckedchanged[info]) { --d->changed; if(d->changed == 0) emit changed(false); } d->plugincheckedchanged[info] = false; // FIXME: plugins that depend on this plugin need to be disabled, too } updateConfigPage(info, checked); }
void KPluginSelectionWidget::checkDependencies(const KPluginInfo *info) { if(info->dependencies().isEmpty()) return; for(QStringList::ConstIterator it = info->dependencies().begin(); it != info->dependencies().end(); ++it) for(QMap< QCheckListItem *, KPluginInfo * >::Iterator infoIt = d->pluginInfoMap.begin(); infoIt != d->pluginInfoMap.end(); ++infoIt) if(infoIt.data()->pluginName() == *it) { if(!infoIt.key()->isOn()) { infoIt.key()->setOn(true); checkDependencies(infoIt.data()); } continue; } }
void AbstractEngine::init() { log->record(GreasyLog::devel, "AbstractEngine::init", "Entering..."); log->record(GreasyLog::silent,"Start greasing " + taskFile); parseTaskFile(); checkDependencies(); if ((validTasks.size() != taskMap.size())&&(!strictChecking)) { log->record(GreasyLog::warning, "Invalid tasks found. Greasy will ignore them"); } // Only set the number of workers if any subclass has not changed the value before. if (nworkers == 0){ // Set the number of workers if (config->keyExists("NWorkers")) { log->record(GreasyLog::devel, "Using defined NWorkers: " + toString(nworkers)); nworkers = fromString(nworkers, config->getValue("NWorkers")); } else { getDefaultNWorkers(); log->record(GreasyLog::warning, "Falling back to the default number of workers " + toString(nworkers)); log->record(GreasyLog::warning, "Consider setting environment variable GREASY_NWORKERS to the desired cpus to use"); } } if (!fileErrors) { if(nworkers>0) { ready = true; log->record(GreasyLog::info, toUpper(engineType) + " engine is ready to run with " + toString(nworkers) + " workers"); } else { log->record(GreasyLog::error, toUpper(engineType) + " engine has no workers. Please check your greasy setup"); } } log->record(GreasyLog::devel, "Configuration contents:\n\n" + config->printContents()); log->record(GreasyLog::devel, "End of configuration contents"); log->record(GreasyLog::devel, "AbstractEngine::init", "Exiting..."); }
void CModHandler::initialize(std::vector<std::string> availableMods) { std::string confName = "config/modSettings.json"; JsonNode modConfig; // Porbably new install. Create initial configuration if (!CResourceHandler::get()->existsResource(ResourceID(confName))) CResourceHandler::get()->createResource(confName); else modConfig = JsonNode(ResourceID(confName)); const JsonNode & modList = modConfig["activeMods"]; JsonNode resultingList; std::vector <TModID> detectedMods; for(std::string name : availableMods) { boost::to_lower(name); std::string modFileName = "mods/" + name + "/mod.json"; if (CResourceHandler::get()->existsResource(ResourceID(modFileName))) { const JsonNode config = JsonNode(ResourceID(modFileName)); if (config.isNull()) continue; if (!modList[name].isNull() && modList[name].Bool() == false ) { resultingList[name].Bool() = false; continue; // disabled mod } resultingList[name].Bool() = true; CModInfo & mod = allMods[name]; mod.identifier = name; mod.name = config["name"].String(); mod.description = config["description"].String(); mod.dependencies = config["depends"].convertTo<std::set<std::string> >(); mod.conflicts = config["conflicts"].convertTo<std::set<std::string> >(); detectedMods.push_back(name); } else logGlobal->warnStream() << "\t\t Directory " << name << " does not contains VCMI mod"; } if (!checkDependencies(detectedMods)) { logGlobal->errorStream() << "Critical error: failed to load mods! Exiting..."; exit(1); } activeMods = resolveDependencies(detectedMods); modConfig["activeMods"] = resultingList; CResourceHandler::get()->createResource("CONFIG/modSettings.json"); std::ofstream file(CResourceHandler::get()->getResourceName(ResourceID("config/modSettings.json")), std::ofstream::trunc); file << modConfig; }
{ const auto& thisInstance = customInstances[ i ]; if ( thisInstance.value( "module" ) == module && thisInstance.value( "id" ) == id ) return i; } return -1; } void ModuleManager::loadModules() { QTimer::singleShot( 0, this, [ this ]() { QStringList failedModules = checkDependencies(); Settings::InstanceDescriptionList customInstances = Settings::instance()->customModuleInstances(); const auto modulesSequence = failedModules.isEmpty() ? Settings::instance()->modulesSequence() : Settings::ModuleSequence(); for ( const auto& modulePhase : modulesSequence ) { ModuleAction currentAction = modulePhase.first; foreach ( const QString& moduleEntry, modulePhase.second ) { QStringList moduleEntrySplit = moduleEntry.split( '@' ); QString moduleName; QString instanceId; QString configFileName;
// ****************************************************************************************** // Save package using default path // ****************************************************************************************** bool ConfigurationFilesWidget::generatePackage() { // Get path name std::string new_package_path = stack_path_->getPath(); // Check that a valid stack package name has been given if( new_package_path.empty() ) { QMessageBox::warning( this, "Error Generating", "No package path provided. Please choose a directory location to generate the MoveIt configuration files." ); return false; } // Check setup assist deps if( !checkDependencies() ) return false; // canceled // Check that all groups have components if( !noGroupsEmpty() ) return false; // not ready // Trim whitespace from user input boost::trim( new_package_path ); // Get the package name --------------------------------------------------------------------------------- new_package_name_ = getPackageName( new_package_path ); const std::string setup_assistant_file = config_data_->appendPaths( new_package_path, ".setup_assistant" ); // Make sure old package is correct package type and verify over write if( fs::is_directory( new_package_path ) && !fs::is_empty( new_package_path ) ) { // Check if the old package is a setup assistant package. If it is not, quit if( ! fs::is_regular_file( setup_assistant_file ) ) { QMessageBox::warning( this, "Incorrect Folder/Package", QString("The chosen package location already exists but was not previously created using this MoveIt Setup Assistant. If this is a mistake, replace the missing file: ") .append( setup_assistant_file.c_str() ) ); return false; } // Confirm overwrite if( QMessageBox::question( this, "Confirm Package Update", QString("Are you sure you want to overwrite this existing package with updated configurations?<br /><i>") .append( new_package_path.c_str() ) .append( "</i>" ), QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel ) { return false; // abort } } else // this is a new package (but maybe the folder already exists) { // Create new directory ------------------------------------------------------------------ try { fs::create_directory( new_package_path ) && !fs::is_directory( new_package_path ); } catch( ... ) { QMessageBox::critical( this, "Error Generating Files", QString("Unable to create directory ").append( new_package_path.c_str() ) ); return false; } } // Begin to create files and folders ---------------------------------------------------------------------- std::string absolute_path; for (int i = 0; i < gen_files_.size(); ++i) { GenerateFile* file = &gen_files_[i]; // Check if we should skip this file if( !file->generate_ ) { continue; } // Create the absolute path absolute_path = config_data_->appendPaths( new_package_path, file->rel_path_ ); ROS_DEBUG_STREAM("Creating file " << absolute_path ); // Run the generate function if( !file->gen_func_(absolute_path) ) { // Error occured QMessageBox::critical( this, "Error Generating File", QString("Failed to generate folder or file: '") .append( file->rel_path_.c_str() ).append("' at location:\n").append( absolute_path.c_str() )); return false; } updateProgress(); // Increment and update GUI } return true; }