Beispiel #1
0
static void splitGitFileName(const char *fullName, StringAttr &gitDir, StringAttr &revision, StringAttr &relPath)
{
    assertex(fullName);
    const char *git = strstr(fullName, ".git" PATHSEPSTR "{" );
    assertex(git);
    const char *tail = git+5;
    gitDir.set(fullName, tail-fullName);
    assertex (*tail=='{');
    tail++;
    const char *end = strchr(tail, '}');
    if (!end)
        throw MakeStringException(0, "Invalid git repository filename - no matching } found");
    revision.set(tail, end - tail);
    tail = end+1;
    if (*tail==PATHSEPCHAR)
        tail++;
    else if (*tail != 0)
        throw MakeStringException(0, "Invalid git repository filename - " PATHSEPSTR " expected after }");
    if (tail && *tail)
    {
        StringBuffer s(tail);
        s.replace(PATHSEPCHAR, '/');
        relPath.set(s);
    }
    else
        relPath.clear();
    // Check it's a valid git repository
    StringBuffer configName(gitDir);
    configName.append("config");
    if (!checkFileExists(configName.str()))
        throw MakeStringException(0, "Invalid git repository - config file %s not found", configName.str());
}
void ChoixConfig::MAJNoms()
{
    QFile configName(QString("../RTKBASE/data/ConfigNames"));
    configName.open(QIODevice::ReadOnly | QIODevice::Text);
    QString line;
    QStringList list;
    QTextStream flux(&configName);
    while(! flux.atEnd())
    {
        line = flux.readLine();
        qDebug()<<line;
        list<<line;
    }
    configName.close();

    ui->Custom1Button->setText(list[0].simplified());
    ui->Custom2Button->setText(list[1].simplified());
    ui->Custom3Button->setText(list[2].simplified());
    ui->Custom4Button->setText(list[3].simplified());
    ui->Custom5Button->setText(list[4].simplified());
    ui->Custom6Button->setText(list[5].simplified());
    ui->Custom7Button->setText(list[6].simplified());
    ui->Custom8Button->setText(list[7].simplified());
    ui->Custom9Button->setText(list[8].simplified());
    ui->Custom10Button->setText(list[9].simplified());
    ui->Custom11Button->setText(list[10].simplified());
    ui->Custom12Button->setText(list[11].simplified());
}
Beispiel #3
0
/**
 *	Returns the RP Filter Value for an interface
 *	Return on success: RP Filter Value
 *	Return on failure:
 *	-1 : Could not open the Rp Filter Option
 */
int routingHandler::getRpFilterValue(std::string device){

	std::string configName("net.ipv4.conf.");
	configName.append(device);
	configName.append(".rp_filter");

	std::string saveRpFilter("sysctl ");
	saveRpFilter.append(configName);


	FILE* pipe = popen(saveRpFilter.c_str(), "r");
	if(pipe == NULL){
		return -1;
	}
	int bufSize = 512;
	char buffer[bufSize];
	std::string valueString;
	while(!feof(pipe)){
		if(fgets(buffer, bufSize, pipe) != NULL)
			valueString.append(buffer);
	}

	int value = StringToInt(valueString.substr(configName.length()+3));

	pclose(pipe);
	return value;
}
Beispiel #4
0
void Waveform::writeConfig()
{
    KSharedConfigPtr config = KSharedConfig::openConfig();
    KConfigGroup scopeConfig(config, configName());
    scopeConfig.writeEntry("paintmode", ui->paintMode->currentIndex());
    scopeConfig.writeEntry("rec601", m_aRec601->isChecked());
    scopeConfig.sync();
}
void AbstractScopeWidget::readConfig()
{
    KSharedConfigPtr config = KSharedConfig::openConfig();
    KConfigGroup scopeConfig(config, configName());
    m_aAutoRefresh->setChecked(scopeConfig.readEntry("autoRefresh", true));
    m_aRealtime->setChecked(scopeConfig.readEntry("realtime", false));
    scopeConfig.sync();
}
void AbstractScopeWidget::writeConfig()
{
    KSharedConfigPtr config = KSharedConfig::openConfig();
    KConfigGroup scopeConfig(config, configName());
    scopeConfig.writeEntry("autoRefresh", m_aAutoRefresh->isChecked());
    scopeConfig.writeEntry("realtime", m_aRealtime->isChecked());
    scopeConfig.sync();
}
Beispiel #7
0
 bool XmlParseConfig(Config &c, TiXmlElement *conf)
 {
     if ( conf == NULL ) return false;
     stringstream ss;
     TiXmlElement *config = conf->FirstChildElement();
     for ( ; config; config = config->NextSiblingElement() ) {
         if ( config->Type() != TiXmlNode::TINYXML_ELEMENT ) continue;
         string configType(config->Value());
         const char *name = config->Attribute("Name");
         if ( !name ) {
             Severe("Config Name attribute missing");
             return false;
         }
         string configName(name);
         if ( configType == "Float" ) {
             double value;
             if ( !config->Attribute("Value", &value) ) {
                 ss << "Config [" << configName << "] missing value";
                 Severe(ss);
                 return false;
             }
             c.AddAttribute(configName, (float) value);
         } else if ( configType == "Int32" ) {
             int i;
             if ( !config->Attribute("Value", &i) ) {
                 ss << "Config [" << configName << "] missing value";
                 Severe(ss);
                 return false;
             }
             c.AddAttribute(configName, i);
         } else if ( configType == "Vector" ) {
             Vector vec;
             TiXmlElement *elemVec = config->FirstChildElement("Value");
             if ( !elemVec ) {
                 ss << "Config [" << configName << "] missing value";
                 Severe(ss);
                 return false;
             }
             if ( !XmlParseVector(vec, elemVec) ) return false;
             c.AddAttribute(configName, vec);
         } else if ( configType == "Bool" ) {
             int b;
             if ( !config->Attribute("Value", &b) ) {
                 ss << "Config [" << configName << "] missing value";
                 Severe(ss);
                 return false;
             }
             c.AddAttribute(configName, b != 0);
         } else {
             ss << "Unknown config type: [" << configType << "]";
             Severe(ss);
             return false;
         }
     }
     return true;
 }
Beispiel #8
0
void Waveform::readConfig()
{
    AbstractGfxScopeWidget::readConfig();

    KSharedConfigPtr config = KSharedConfig::openConfig();
    KConfigGroup scopeConfig(config, configName());
    ui->paintMode->setCurrentIndex(scopeConfig.readEntry("paintmode", 0));
    m_aRec601->setChecked(scopeConfig.readEntry("rec601", false));
    m_aRec709->setChecked(!m_aRec601->isChecked());
}
Beispiel #9
0
void Histogram::writeConfig()
{
    KSharedConfigPtr config = KGlobal::config();
    KConfigGroup scopeConfig(config, configName());
    scopeConfig.writeEntry("yEnabled", ui->cbY->isChecked());
    scopeConfig.writeEntry("sEnabled", ui->cbS->isChecked());
    scopeConfig.writeEntry("rEnabled", ui->cbR->isChecked());
    scopeConfig.writeEntry("gEnabled", ui->cbG->isChecked());
    scopeConfig.writeEntry("bEnabled", ui->cbB->isChecked());
    scopeConfig.writeEntry("rec601", m_aRec601->isChecked());
    scopeConfig.sync();
}
Beispiel #10
0
void Histogram::readConfig()
{
    AbstractGfxScopeWidget::readConfig();

    KSharedConfigPtr config = KGlobal::config();
    KConfigGroup scopeConfig(config, configName());
    ui->cbY->setChecked(scopeConfig.readEntry("yEnabled", true));
    ui->cbS->setChecked(scopeConfig.readEntry("sEnabled", false));
    ui->cbR->setChecked(scopeConfig.readEntry("rEnabled", true));
    ui->cbG->setChecked(scopeConfig.readEntry("gEnabled", true));
    ui->cbB->setChecked(scopeConfig.readEntry("bEnabled", true));
    m_aRec601->setChecked(scopeConfig.readEntry("rec601", false));
    m_aRec709->setChecked(!m_aRec601->isChecked());
}
Beispiel #11
0
/**
 * \brief Save the values and this way make it available.
 *
 * Save the current set of data. A call to @see OGenericPluginLoader::filtered
 * now would return  your saved changes.
 */
void OPluginManager::save() {
    QMap<QString, QStringList> excluded;  // map for path to excluded name
    QMap<QString, QStringList> positions; // if positions matter contains splitted up by dirs
    bool sorted = m_loader ? m_loader->isSorted() : m_isSorted;

    /*
     * We will create some maps for the  groups to include positions a
     */
    for ( OPluginItem::List::Iterator it = m_plugins.begin(); it != m_plugins.end(); ++it ) {
        OPluginItem item = *it;
        QString path = QFileInfo(  item.path() ).dirPath(true);
        if ( sorted ) {
            positions[path].append( item.name() );
            positions[path].append( QString::number( item.position() ) );
        }

        if ( !item.isEnabled() )
            excluded[path].append( item.name() );
        if ( !excluded.contains( path ) )
            excluded[path] = QString::null;

    }

/*
 * The code below wouldn't work because we can't delete groups/keys from the config
 * ### for ODP   make Config right!
 */
//    if ( excluded.isEmpty() && positions.isEmpty() ) return;
    /*
     * Now safe for each path
     */
    OConfig cfg( configName() );

    /* safe excluded items */
    for ( QMap<QString, QStringList>::Iterator it = excluded.begin(); it != excluded.end(); ++it ) {
        OConfigGroupSaver saver( &cfg, it.key() );
        cfg.writeEntry("Excluded", it.data(), ',' );
    }

    /*  safe positions we could also see if positions.contains(path) and remove/write in the above loop
     * ### Write a Test Suite that can profile these runs...
     */
    for ( QMap<QString, QStringList>::Iterator it = positions.begin(); it != positions.end(); ++it ) {
        OConfigGroupSaver saver( &cfg, it.key() );
        cfg.writeEntry("Positions", it.data(), '.' );
    }
}
Beispiel #12
0
/**
 * \brief Load necessary information after constructing the object
 * If you speified  a OGenericPluginLoader you need to call this method
 * so that this manager knows what to manage and have a right value for \sa crashedPlugin
 * For the name and the list of plugins this does only try to find out the crashed plugin
 */
void OPluginManager::load() {
    OConfig cfg( configName() );
    cfg.setGroup(  "General" );
    QString crashedPath = cfg.readEntry( "CrashedPlugin" );

    /* if we've a loader this applies if we were called from the first part */
    if ( m_loader )
        m_plugins = m_loader->allAvailable( m_loader->isSorted() );

    /*  fast and normal route if we did not crash... */
    if ( crashedPath.isEmpty() )
        return;

    /* lets try to find the plugin path and this way the associated item */
    for ( OPluginItem::List::Iterator it = m_plugins.begin(); it != m_plugins.end(); ++it )
        if (  (*it).path() ==  crashedPath ) {
            m_crashed = *it;
            break;
        }
}
Beispiel #13
0
void WStreamAdd::saveSettings()
{
	KConfig * conf = new KSimpleConfig(configName());
	conf->setGroup("main");

	conf->writeEntry("type", comboBox1->currentItem());
        conf->writeEntry("port", kIntNumInput1->value());
	conf->writeEntry("host", kLineEdit1->text());
	conf->writeEntry("package", slider1->value());
	conf->writeEntry("length", kIntNumInput2->value());
	conf->writeEntry("len_rnd", checkBox1->isChecked());
	conf->writeEntry("cov", kIntNumInput3->value());
	conf->writeEntry("cov_rnd", checkBox2->isChecked());
	conf->writeEntry("filename", kLineEdit2->text());
	conf->writeEntry("reloop", checkBox3->isChecked());

	conf->sync();

	delete conf;
}
Beispiel #14
0
void WStreamAdd::loadSettings()
{
	KConfig * conf = new KSimpleConfig(configName());
	conf->setGroup("main");

	comboBox1->setCurrentItem(conf->readUnsignedNumEntry("type", 1));
	kIntNumInput1->setValue(conf->readUnsignedNumEntry("port", 5000));
	kLineEdit1->setText(conf->readEntry("host", ""));
	slider1->setValue(conf->readUnsignedNumEntry("package", 1));

	kIntNumInput2->setValue(conf->readUnsignedNumEntry("length", 40));
	checkBox1->setChecked(conf->readBoolEntry("len_rnd", false));

	kIntNumInput3->setValue(conf->readUnsignedNumEntry("cov", 8));
	checkBox2->setChecked(conf->readBoolEntry("cov_rnd", false));

	kLineEdit2->setText(conf->readEntry("filename", ""));
	checkBox3->setChecked(conf->readBoolEntry("reloop", false));

	delete conf;

	typeChanged();
}
// do the actual cleanup
void CompileRequest::Process(IManager* manager)
{
    wxString cmd;
    wxString errMsg;
    wxStringMap_t om;

    BuildSettingsConfig* bsc(manager ? manager->GetBuildSettingsConfigManager() : BuildSettingsConfigST::Get());
    BuildManager* bm(manager ? manager->GetBuildManager() : BuildManagerST::Get());
    clCxxWorkspace* w(manager ? manager->GetWorkspace() : clCxxWorkspaceST::Get());
    EnvironmentConfig* env(manager ? manager->GetEnv() : EnvironmentConfig::Instance());

    ProjectPtr proj = w->FindProjectByName(m_info.GetProject(), errMsg);
    if(!proj) {
        AppendLine(_("Cant find project: ") + m_info.GetProject());
        return;
    }

    wxString pname(proj->GetName());
    // BuilderPtr builder = bm->GetBuilder(wxT("GNU makefile for g++/gcc"));
    BuilderPtr builder = bm->GetSelectedBuilder();
    if(m_fileName.IsEmpty() == false) {
        // we got a complie request of a single file
        cmd = m_preprocessOnly ?
                  builder->GetPreprocessFileCmd(m_info.GetProject(), m_info.GetConfiguration(), m_fileName, errMsg) :
                  builder->GetSingleFileCmd(m_info.GetProject(), m_info.GetConfiguration(), m_fileName);
    } else if(m_info.GetProjectOnly()) {

        switch(m_info.GetKind()) {
        case QueueCommand::kRebuild:
            cmd = builder->GetPORebuildCommand(m_info.GetProject(), m_info.GetConfiguration());
            break;
        default:
        case QueueCommand::kBuild:
            cmd = builder->GetPOBuildCommand(m_info.GetProject(), m_info.GetConfiguration());
            break;
        }

    } else {
        cmd = builder->GetBuildCommand(m_info.GetProject(), m_info.GetConfiguration());
    }

    // Notify plugins that a compile process is going to start
    clBuildEvent event(wxEVT_BUILD_STARTING);
    event.SetProjectName(pname);
    event.SetConfigurationName(m_info.GetConfiguration());

    if(EventNotifier::Get()->ProcessEvent(event)) {

        // the build is being handled by some plugin, no need to build it
        // using the standard way
        return;
    }

    // Send the EVENT_STARTED : even if this event is sent, next event will
    // be post, so no way to be sure the the build process has not started
    SendStartMsg();

    // if we require to run the makefile generation command only, replace the 'cmd' with the
    // generation command line
    BuildConfigPtr bldConf = w->GetProjBuildConf(m_info.GetProject(), m_info.GetConfiguration());
    if(m_premakeOnly && bldConf) {
        BuildConfigPtr bldConf = w->GetProjBuildConf(m_info.GetProject(), m_info.GetConfiguration());
        if(bldConf) {
            cmd = bldConf->GetMakeGenerationCommand();
        }
    }

    if(bldConf) {
        wxString cmpType = bldConf->GetCompilerType();
        CompilerPtr cmp = bsc->GetCompiler(cmpType);
        if(cmp) {
            // Add the 'bin' folder of the compiler to the PATH environment variable
            wxString scxx = cmp->GetTool("CXX");
            scxx.Trim().Trim(false);
            scxx.StartsWith("\"", &scxx);
            scxx.EndsWith("\"", &scxx);
            // Strip the double quotes
            wxFileName cxx(scxx);
            wxString pathvar;
            pathvar << cxx.GetPath() << clPATH_SEPARATOR;
            
            // If we have an additional path, add it as well
            if(!cmp->GetPathVariable().IsEmpty()) {
                pathvar << cmp->GetPathVariable() << clPATH_SEPARATOR;
            }
            pathvar << "$PATH";
            om["PATH"] = pathvar;
        }
    }

    if(cmd.IsEmpty()) {
        // if we got an error string, use it
        if(errMsg.IsEmpty() == false) {
            AppendLine(errMsg);
        } else {
            AppendLine(_("Command line is empty. Build aborted."));
        }
        return;
    }

    WrapInShell(cmd);
    DirSaver ds;

    DoSetWorkingDirectory(proj, false, m_fileName.IsEmpty() == false);

    // expand the variables of the command
    cmd = ExpandAllVariables(cmd, w, m_info.GetProject(), m_info.GetConfiguration(), m_fileName);

    // print the build command
    AppendLine(cmd + wxT("\n"));
    if(m_info.GetProjectOnly() || m_fileName.IsEmpty() == false) {
        // set working directory
        DoSetWorkingDirectory(proj, false, m_fileName.IsEmpty() == false);
    }

    // print the prefix message of the build start. This is important since the parser relies
    // on this message
    if(m_info.GetProjectOnly() || m_fileName.IsEmpty() == false) {
        wxString configName(m_info.GetConfiguration());

        // also, send another message to the main frame, indicating which project is being built
        // and what configuration
        wxString text;
        text << wxGetTranslation(BUILD_PROJECT_PREFIX) << m_info.GetProject() << wxT(" - ") << configName << wxT(" ]");
        if(m_fileName.IsEmpty()) {
            text << wxT("----------\n");
        } else if(m_preprocessOnly) {
            text << wxT(" (Preprocess Single File)----------\n");
        } else {
            text << wxT(" (Single File Build)----------\n");
        }
        AppendLine(text);
    }

    EnvSetter envir(env, &om, proj->GetName());
    m_proc = CreateAsyncProcess(this, cmd);
    if(!m_proc) {
        wxString message;
        message << _("Failed to start build process, command: ") << cmd << _(", process terminated with exit code: 0");
        AppendLine(message);
        return;
    }
}
Beispiel #16
0
// ------------------------- start it up ----------------------------
int main( int argc,      // Number of strings in array argv
          char *argv[],   // Array of command-line argument strings
          char *envp[] ) 
{

	ofAppGlutWindow window;
#ifdef TARGET_OSX
	window.setGlutDisplayString("rgba double samples>=8 depth");
#endif

	projectorConfiguration projConfig;
	showDefinition show;

	// TODO: make command line parameter for this
	ofLogLevel(OF_LOG_VERBOSE);

	int primaryScreenWidth = GetSystemMetrics(SM_CXSCREEN);
	int primaryScreenHeight = GetSystemMetrics(SM_CYSCREEN);
	int virtualScreenWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);
	int virtualScreenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);


	// get parameter: which configuration to load -> = name of folder
	// if no parameter specified, then create a default configuration
	if(argc == 1)
	{
		projConfig.setName("Default");
		projConfig.setWindowWidth(primaryScreenWidth);
		projConfig.setWindowHeight(primaryScreenHeight);
		projConfig.initialize(primaryScreenWidth, primaryScreenHeight, virtualScreenWidth, virtualScreenHeight);
		projConfig.allocateViewports(1);
		projConfig.getProjView(0).proj.name = "Single";
		projConfig.getProjView(0).index = 0;
		projConfig.getProjView(0).setViewport(0, 0, primaryScreenWidth, primaryScreenHeight);

		show.addMovie("movies/oefentrap-uvtemplate_2.mov", "oefentrap");
		show.addPicture("pictures/oefentrap-stonesandgrass.png", "stone and grass");
	}
	else
	{
		string configName(argv[1]);

		if(configName == "FourViewTest")
		{
			float vpWidth = (float)primaryScreenWidth/2; 
			float vpHeight = (float)primaryScreenHeight/2; 

			projConfig.setName("FourViewportsSingleScreen");
			projConfig.setWindowWidth(primaryScreenWidth);
			projConfig.setWindowHeight(primaryScreenHeight);
			projConfig.initialize(primaryScreenWidth, primaryScreenHeight, virtualScreenWidth, virtualScreenHeight);
			projConfig.allocateViewports(4);
			projConfig.getProjView(0).proj.name = "Top left";
			projConfig.getProjView(0).index = 0;
			projConfig.getProjView(0).setViewport(0, 0, vpWidth, vpHeight);
			projConfig.getProjView(1).index = 1;
			projConfig.getProjView(1).proj.name = "Top right";
			projConfig.getProjView(1).setViewport(vpWidth, 0, vpWidth, vpHeight);
			projConfig.getProjView(2).index = 2;
			projConfig.getProjView(2).proj.name = "Bottom left";
			projConfig.getProjView(2).setViewport(0, vpHeight, vpWidth, vpHeight);
			projConfig.getProjView(3).index = 3;
			projConfig.getProjView(3).proj.name = "Bottom right";
			projConfig.getProjView(3).setViewport(vpWidth, vpHeight, vpWidth, vpHeight);
			projConfig.setViewToCalibrate(0);

			show.addMovie("movies/fingers.mov", "fingers");
			show.addPicture("pictures/oefentrap-stonesandgrass.png", "stone and grass");
		}
		else
		{
			projConfig.initialize(primaryScreenWidth, primaryScreenHeight, virtualScreenWidth, virtualScreenHeight);
			projConfig.loadConfiguration(configName);
			show.load(configName);

			// Poco::XML::NodeIterator it(pDoc, Poco::XML::NodeFilter::WhatToShow::SHOW_ELEMENT);
			//Poco::XML::Node* pNode = it.nextNode();
			//while (pNode)
			//{
			// std::cout<<pNode->nodeName()<<":"<< pNode->nodeValue()<<std::endl;
			// pNode = it.nextNode();
			//}

			// default, single monitor configuration: one projector, one screen
			//projConfig.initialize(1);
			//projConfig.getProjView(0).viewport.x = 0;
			//projConfig.getProjView(0).viewport.y = 0;
			//projConfig.getProjView(0).viewport.width = ofGetWidth();
			//projConfig.getProjView(0).viewport.height = ofGetHeight();
			//projConfig.setViewToCalibrate(0);

			// testing: four projector views on a single monitor
		}
	}

	// todo: production:
	// multiple views laid out on large extended desktop


	//ofSetupOpenGL(&window, 1024, 768, OF_FULLSCREEN);
	ofSetupOpenGL(&window, projConfig.getWindowWidth(), projConfig.getWindowHeight(), OF_WINDOW);



	ofRunApp(new testApp(projConfig, show));
}
Beispiel #17
0
//do the actual cleanup
void CleanRequest::Process(IManager *manager)
{
    wxString cmd;
    wxString errMsg;
    wxStringMap_t om;

    BuildSettingsConfig *bsc(manager ? manager->GetBuildSettingsConfigManager() : BuildSettingsConfigST::Get());
    BuildManager *       bm(manager ? manager->GetBuildManager() : BuildManagerST::Get());
    Workspace *          w(manager ? manager->GetWorkspace() : WorkspaceST::Get());


    ProjectPtr proj = w->FindProjectByName(m_info.GetProject(), errMsg);
    if (!proj) {
        AppendLine(_("Cant find project: ") + m_info.GetProject());
        return;
    }
    wxString             pname (proj->GetName());

    //BuilderPtr builder = bm->GetBuilder(wxT("GNU makefile for g++/gcc"));
    BuilderPtr builder = bm->GetSelectedBuilder();
    if (m_info.GetProjectOnly()) {
        cmd = builder->GetPOCleanCommand(m_info.GetProject(), m_info.GetConfiguration());
    } else {
        cmd = builder->GetCleanCommand(m_info.GetProject(), m_info.GetConfiguration());
    }

    if ( cmd.IsEmpty() ) {
        AppendLine(_("Sorry, there is no 'Clean' command available\n"));
        return;
    }

    BuildConfigPtr bldConf = w->GetProjBuildConf(m_info.GetProject(), m_info.GetConfiguration());
    if(bldConf) {
        wxString cmpType = bldConf->GetCompilerType();
        CompilerPtr cmp = bsc->GetCompiler(cmpType);
        if(cmp) {
            wxString value( cmp->GetPathVariable() );
            if(value.Trim().Trim(false).IsEmpty() == false) {
                wxLogMessage(wxString::Format(wxT("Setting PATH to '%s'"), value.c_str()));
                om[wxT("PATH")] = value.Trim().Trim(false);
            }
        }
    } else {
        AppendLine(_("Sorry, couldn't find the Build configuration\n"));
        return;
    }

    // Notify plugins that a compile process is going to start
    clBuildEvent event(wxEVT_BUILD_STARTING);
    event.SetProjectName( pname );
    event.SetConfigurationName( m_info.GetConfiguration() );
    
    if (EventNotifier::Get()->ProcessEvent(event)) {
        // the build is being handled by some plugin, no need to build it
        // using the standard way
        return;
    }
    
    SendStartMsg();
    // Expand the variables of the command
    cmd = ExpandAllVariables(cmd, w, m_info.GetProject(), m_info.GetConfiguration(), wxEmptyString);
    WrapInShell(cmd);
    DirSaver ds;
    DoSetWorkingDirectory(proj, false, false);

    if (m_info.GetProjectOnly() ) {
        //need to change directory to project dir
        wxSetWorkingDirectory(proj->GetFileName().GetPath());
    }
    //print the build command
    AppendLine(cmd + wxT("\n"));

    // print the prefix message of the build start. This is important since the parser relies
    // on this message
    if(m_info.GetProjectOnly()) {
        wxString configName(m_info.GetConfiguration());

        //also, send another message to the main frame, indicating which project is being built
        //and what configuration
        wxString text;
        text << wxGetTranslation(CLEAN_PROJECT_PREFIX) << m_info.GetProject() << wxT(" - ") << configName << wxT(" ]");
        text << wxT("----------\n");
        AppendLine(text);
    }

    //apply environment settings
    EnvSetter env(NULL, &om, proj->GetName());
    m_proc = CreateAsyncProcess(this, cmd);
    if ( !m_proc ) {

        //remove environment settings applied
        wxString message;
        message << _("Failed to start clean process, command: ") << cmd << _(", process terminated with exit code: 0");
        AppendLine(message);
        return;
    }
}
Beispiel #18
0
//static
void VolumeManager::InitConfig()
{
  MOZ_ASSERT(MessageLoop::current() == XRE_GetIOMessageLoop());

  // This function uses /system/etc/volume.cfg to add additional volumes
  // to the Volume Manager.
  //
  // This is useful on devices like the Nexus 4, which have no physical sd card
  // or dedicated partition.
  //
  // The format of the volume.cfg file is as follows:
  // create volume-name mount-point
  // configure volume-name preference preference-value
  // Blank lines and lines starting with the hash character "#" will be ignored.

  ScopedCloseFile fp;
  int n = 0;
  char line[255];
  const char *filename = "/system/etc/volume.cfg";
  if (!(fp = fopen(filename, "r"))) {
    LOG("Unable to open volume configuration file '%s' - ignoring", filename);
    return;
  }
  while(fgets(line, sizeof(line), fp)) {
    n++;

    if (line[0] == '#')
      continue;

    nsCString commandline(line);
    nsCWhitespaceTokenizer tokenizer(commandline);
    if (!tokenizer.hasMoreTokens()) {
      // Blank line - ignore
      continue;
    }

    nsCString command(tokenizer.nextToken());
    if (command.EqualsLiteral("create")) {
      if (!tokenizer.hasMoreTokens()) {
        ERR("No vol_name in %s line %d",  filename, n);
        continue;
      }
      nsCString volName(tokenizer.nextToken());
      if (!tokenizer.hasMoreTokens()) {
        ERR("No mount point for volume '%s'. %s line %d",
             volName.get(), filename, n);
        continue;
      }
      nsCString mountPoint(tokenizer.nextToken());
      RefPtr<Volume> vol = FindAddVolumeByName(volName);
      vol->SetFakeVolume(mountPoint);
      continue;
    }
    if (command.EqualsLiteral("configure")) {
      if (!tokenizer.hasMoreTokens()) {
        ERR("No vol_name in %s line %d", filename, n);
        continue;
      }
      nsCString volName(tokenizer.nextToken());
      if (!tokenizer.hasMoreTokens()) {
        ERR("No configuration name specified for volume '%s'. %s line %d",
             volName.get(), filename, n);
        continue;
      }
      nsCString configName(tokenizer.nextToken());
      if (!tokenizer.hasMoreTokens()) {
        ERR("No value for configuration name '%s'. %s line %d",
            configName.get(), filename, n);
        continue;
      }
      nsCString configValue(tokenizer.nextToken());
      RefPtr<Volume> vol = FindVolumeByName(volName);
      if (vol) {
        vol->SetConfig(configName, configValue);
      } else {
        ERR("Invalid volume name '%s'.", volName.get());
      }
      continue;
    }
    if (command.EqualsLiteral("ignore")) {
      // This command is useful to remove volumes which are being tracked by
      // vold, but for which we have no interest.
      if (!tokenizer.hasMoreTokens()) {
        ERR("No vol_name in %s line %d", filename, n);
        continue;
      }
      nsCString volName(tokenizer.nextToken());
      RemoveVolumeByName(volName);
      continue;
    }
    ERR("Unrecognized command: '%s'", command.get());
  }
}
ChoixConfig::ChoixConfig(int _rover_edit, QWidget *parent):
    QDialog(parent),
    ui(new Ui::ChoixConfig)
{
    ui->setupUi(this);
    rover_edit=_rover_edit;

    this->setWindowFlags(Qt::Window);
    this->showFullScreen();

    if(rover_edit==0) ui->WindowTitleEdit->setText(QString("CONFIGURATION CHOICE"));
    else ui->WindowTitleEdit->setText(QString("MODELE CHOICE"));

    QObject::connect(ui->SingleButton,SIGNAL(clicked()),this,SLOT(ouvreSingle()));
    QObject::connect(ui->SBASButton,SIGNAL(clicked()),this,SLOT(ouvreSBAS()));
    QObject::connect(ui->DGPSButton,SIGNAL(clicked()),this,SLOT(ouvreDGPS()));
    QObject::connect(ui->PPPButton,SIGNAL(clicked()),this,SLOT(ouvrePPP()));
    QObject::connect(ui->RTKButton,SIGNAL(clicked()),this,SLOT(ouvreRTKstatic()));
    QObject::connect(ui->RTKButton_2,SIGNAL(clicked()),this,SLOT(ouvreRTKkinematic()));

    QObject::connect(ui->Custom1Button,SIGNAL(clicked()),this,SLOT(OuvreConfig1()));
    QObject::connect(ui->Custom2Button,SIGNAL(clicked()),this,SLOT(OuvreConfig2()));
    QObject::connect(ui->Custom3Button,SIGNAL(clicked()),this,SLOT(OuvreConfig3()));
    QObject::connect(ui->Custom4Button,SIGNAL(clicked()),this,SLOT(OuvreConfig4()));
    QObject::connect(ui->Custom5Button,SIGNAL(clicked()),this,SLOT(OuvreConfig5()));
    QObject::connect(ui->Custom6Button,SIGNAL(clicked()),this,SLOT(OuvreConfig6()));
    QObject::connect(ui->Custom7Button,SIGNAL(clicked()),this,SLOT(OuvreConfig7()));
    QObject::connect(ui->Custom8Button,SIGNAL(clicked()),this,SLOT(OuvreConfig8()));
    QObject::connect(ui->Custom9Button,SIGNAL(clicked()),this,SLOT(OuvreConfig9()));
    QObject::connect(ui->Custom10Button,SIGNAL(clicked()),this,SLOT(OuvreConfig10()));
    QObject::connect(ui->Custom11Button,SIGNAL(clicked()),this,SLOT(OuvreConfig11()));
    QObject::connect(ui->Custom12Button,SIGNAL(clicked()),this,SLOT(OuvreConfig12()));

    QObject::connect(ui->ReturnButton,SIGNAL(clicked()),this,SLOT(Retour()));

    if(rover_edit==0)
    {
        ui->EditeButton->show();
        QObject::connect(ui->EditeButton,SIGNAL(clicked()),this,SLOT(OuvreEdit()));
    }
    else
    {
        ui->EditeButton->hide();
    }

    QFile configName(QString("../RTKBASE/data/ConfigNames"));
    configName.open(QIODevice::ReadOnly | QIODevice::Text);
    QString line;
    QStringList list;
    QTextStream flux(&configName);
    while(! flux.atEnd())
    {
        line = flux.readLine();
        qDebug()<<line;
        list<<line;
    }
    configName.close();

    ui->Custom1Button->setText(list[0].simplified());
    ui->Custom2Button->setText(list[1].simplified());
    ui->Custom3Button->setText(list[2].simplified());
    ui->Custom4Button->setText(list[3].simplified());
    ui->Custom5Button->setText(list[4].simplified());
    ui->Custom6Button->setText(list[5].simplified());
    ui->Custom7Button->setText(list[6].simplified());
    ui->Custom8Button->setText(list[7].simplified());
    ui->Custom9Button->setText(list[8].simplified());
    ui->Custom10Button->setText(list[9].simplified());
    ui->Custom11Button->setText(list[10].simplified());
    ui->Custom12Button->setText(list[11].simplified());
}
void CustomBuildRequest::Process(IManager* manager)
{
    wxString cmd;
    wxString errMsg;
    wxStringMap_t om;

    clCxxWorkspace* w(manager->GetWorkspace());
    EnvironmentConfig* env(manager->GetEnv());

    ProjectPtr proj = w->FindProjectByName(m_info.GetProject(), errMsg);
    if(!proj) {
        AppendLine(_("Cant find project: ") + m_info.GetProject());
        return;
    }

    // Notify plugins that a compile process is going to start
    clBuildEvent event(wxEVT_BUILD_STARTING);
    event.SetProjectName(proj->GetName());
    event.SetConfigurationName(m_info.GetConfiguration());

    if(EventNotifier::Get()->ProcessEvent(event)) {
        // the build is being handled by some plugin, no need to build it
        // using the standard way
        return;
    }

    SendStartMsg();

    BuildConfigPtr bldConf = w->GetProjBuildConf(m_info.GetProject(), m_info.GetConfiguration());
    if(!bldConf) {
        wxLogMessage(wxString::Format(wxT("Failed to find build configuration for project '%s' and configuration '%s'"),
                                      m_info.GetProject().c_str(),
                                      m_info.GetConfiguration().c_str()));
        return;
    }

    // try the special targets first:
    bool isClean(false);
    if(m_info.GetCustomBuildTarget() == wxT("Build")) {
        cmd = bldConf->GetCustomBuildCmd();

    } else if(m_info.GetCustomBuildTarget() == wxT("Clean")) {
        cmd = bldConf->GetCustomCleanCmd();
        isClean = true;
    } else if(m_info.GetCustomBuildTarget() == wxT("Rebuild")) {
        cmd = bldConf->GetCustomRebuildCmd();

    } else if(m_info.GetCustomBuildTarget() == wxT("Compile Single File")) {
        cmd = bldConf->GetSingleFileBuildCommand();

    } else if(m_info.GetCustomBuildTarget() == wxT("Preprocess File")) {
        cmd = bldConf->GetPreprocessFileCommand();
    }

    // if still no luck, try with the other custom targets
    if(cmd.IsEmpty()) {
        std::map<wxString, wxString> targets = bldConf->GetCustomTargets();
        std::map<wxString, wxString>::iterator iter = targets.find(m_info.GetCustomBuildTarget());
        if(iter != targets.end()) {
            cmd = iter->second;
        }
    }

    if(cmd.IsEmpty()) {
        // if we got an error string, use it
        if(errMsg.IsEmpty() == false) {
            AppendLine(errMsg);
        } else {
            AppendLine(_("Command line is empty. Build aborted."));
        }
        return;
    }

    // Working directory:
    // By default we use the project path
    //////////////////////////////////////////////////////

    DirSaver ds;

    // first set the path to the project working directory
    ::wxSetWorkingDirectory(proj->GetFileName().GetPath());

    // If a working directory was specified, use it instead
    wxString wd = bldConf->GetCustomBuildWorkingDir();
    wd.Trim().Trim(false);

    wxString filename;
    if(manager->GetActiveEditor()) {
        filename = manager->GetActiveEditor()->GetFileName().GetFullPath();
    }

    if(wd.IsEmpty()) {

        // use the project path
        wd = proj->GetFileName().GetPath();

    } else {

        // expand macros from the working directory
        wd = ExpandAllVariables(wd, clCxxWorkspaceST::Get(), proj->GetName(), bldConf->GetName(), filename);
    }

    {
        // Ensure that the path to the working directory exist
        wxFileName fnwd(wd, "");
        if(!fnwd.DirExists()) {
            fnwd.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
        }
    }

    ::wxSetWorkingDirectory(wd);

    // Print message to the build tab
    AppendLine(wxString::Format(_("MESSAGE: Entering directory `%s'\n"), wd.c_str()));

    // Command handling:
    //////////////////////////////////////////////////////

    // expand the variables of the command
    cmd = ExpandAllVariables(cmd, w, m_info.GetProject(), m_info.GetConfiguration(), filename);

    // in case our configuration includes post/pre build commands
    // we generate a makefile to include them as well and we update
    // the build command
    bool bCommandAltered = DoUpdateCommand(manager, cmd, proj, bldConf, isClean);

#ifdef __WXMSW__
    // Windows CD command requires the paths to be backslashe
    if(cmd.Find(wxT("cd ")) != wxNOT_FOUND) cmd.Replace(wxT("/"), wxT("\\"));
#endif

    // Wrap the build command in the shell, so it will be able
    // to perform 'chain' commands like
    // cd SOMEWHERE && make && ...

    // Dont wrap the command if it was altered previously
    if(!bCommandAltered) {
        WrapInShell(cmd);
    }

    // print the build command
    AppendLine(cmd + wxT("\n"));
    wxString configName(m_info.GetConfiguration());

    // also, send another message to the main frame, indicating which project is being built
    // and what configuration
    wxString text;
    if(isClean) {
        text << wxGetTranslation(CLEAN_PROJECT_PREFIX);
    } else {
        text << wxGetTranslation(BUILD_PROJECT_PREFIX);
    }
    text << m_info.GetProject() << wxT(" - ") << configName << wxT(" ]----------\n");

    AppendLine(text);
    
    // Avoid Unicode chars coming from the compiler by setting LC_ALL to "C"
    om["LC_ALL"] = "C";
    EnvSetter environment(env, &om, proj->GetName());

    m_proc = CreateAsyncProcess(this, cmd);
    if(!m_proc) {
        wxString message;
        message << _("Failed to start build process, command: ") << cmd << _(", process terminated with exit code: 0");
        AppendLine(message);
        return;
    }
}