Ejemplo n.º 1
0
void RubySupportPart::slotRun ()
{
    // if we can't save all parts, then the user canceled
    if ( partController()->saveAllFiles() == false )
        return;
    QFileInfo program(mainProgram());
    if (mainProgram().endsWith("script/server")) {
         QString cmd;
         QFileInfo server(project()->projectDirectory() + "/script/server");

        // Starting WEBrick for a Rails app. Translate a SIGTERM signal sent by KDevelop
        // to a SIGINT expected by WEBrick (ie control&c) to terminate it.
        cmd += "script/server& \n trap \"kill -s SIGINT $!\" TERM \n wait \n exit 0";
        if (KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend"))
            appFrontend->startAppCommand(project()->projectDirectory(), cmd, false);
    } else {
        QString cmd = QString("%1 -K%2 -C\"%3\" -I\"%4\" \"%5\" %6")
                          .arg(interpreter())
                          .arg(characterCoding())
                          .arg(runDirectory())
                          .arg(program.dirPath())
                          .arg(program.fileName())
                          .arg(programArgs());
        startApplication(cmd);
    }
}
Ejemplo n.º 2
0
int UoToolMain::main()
{
  const std::vector<std::string> binArgs = programArgs();

  /**********************************************
   * show help
   **********************************************/
  if (binArgs.size() == 1)
  {
    showHelp();
    return 0; // return "okay"
  }

  /**********************************************
   * TODO: rework the following cruft from former uotool.cpp
   **********************************************/
  Clib::ConfigFile cf( "pol.cfg" );
  Clib::ConfigElem elem;

  cf.readraw( elem );

  Plib::systemstate.config.uo_datafile_root = elem.remove_string( "UoDataFileRoot" );
  Plib::systemstate.config.uo_datafile_root = Clib::normalized_dir_form( Plib::systemstate.config.uo_datafile_root );

  unsigned short max_tile = elem.remove_ushort( "MaxTileID", UOBJ_DEFAULT_MAX );

  if ( max_tile != UOBJ_DEFAULT_MAX && max_tile != UOBJ_SA_MAX && max_tile != UOBJ_HSA_MAX )
    Plib::systemstate.config.max_tile_id = UOBJ_DEFAULT_MAX;
  else
    Plib::systemstate.config.max_tile_id = max_tile;

  std::string argvalue = binArgs[1];
  if ( argvalue[0] == '/' || argvalue[0] == ':' )
  {
    Plib::systemstate.config.uo_datafile_root = argvalue;
    if (binArgs.size() < 3)
    {
      showHelp();
      return 0;
    }
    argvalue = binArgs[2];
  }

  std::transform(argvalue.begin(), argvalue.end(), argvalue.begin(), ::tolower);

  if ( argvalue == "tiledump" )
  {
    return UoTool::tiledump( s_argc, s_argv );
  }
  else if ( argvalue == "vertile" )
  {
    return UoTool::vertile();
  }
  else if ( argvalue == "verlandtile" )
  {
    return UoTool::verlandtile();
  }
  else if ( argvalue == "landtilehist" )
  {
    return UoTool::landtilehist();
  }
  else if ( argvalue == "flagsearch" )
  {
    return UoTool::flagsearch( s_argc, s_argv );
  }
  else if ( argvalue == "landtileflagsearch" )
  {
    return UoTool::landtileflagsearch( s_argc, s_argv );
  }
  else if ( argvalue == "loschange" )
  {
    return UoTool::loschange( s_argc, s_argv );
  }
  else if ( argvalue == "rawdump" )
  {
    return UoTool::rawdump( s_argc, s_argv );
  }
  else if ( argvalue == "ctable" )
  {
    return UoTool::print_ctable();
  }
  else if ( argvalue == "sndlist" )
  {
    return UoTool::print_sndlist();
  }
  else if ( argvalue == "statics" )
  {
    return UoTool::print_statics();
  }
  else if ( argvalue == "verdata" )
  {
    return UoTool::print_verdata_info();
  }
  else if ( argvalue == "multis" )
  {
    return UoTool::print_multis();
  }
  else if ( argvalue == "water" )
  {
    return UoTool::print_water_data();
  }
  else if ( argvalue == "newstatics" )
  {
    return Core::write_pol_static_files( "main" );
  }
  else if ( argvalue == "staticsmax" )
  {
    Core::open_uo_data_files();
    Core::staticsmax();
    return 0;
  }
  else if ( argvalue == "watersearch" )
  {
    return UoTool::water_search();
  }
  else if ( argvalue == "zhist" )
  {
    return UoTool::z_histogram();
  }
  else if ( argvalue == "staticshist" )
  {
    return UoTool::statics_histogram();
  }
  else if ( argvalue == "writedungmap" )
  {
    return UoTool::write_polmap();
  }
  else if ( argvalue == "writekeys" )
  {
    INFO_PRINT << "Keys written to current.key\n";
    return 0;
  }
  else if ( argvalue == "mapdump" )
  {
    return UoTool::mapdump( s_argc, s_argv );
  }
  else if ( argvalue == "contour" )
  {
    return UoTool::contour();
  }
  else if ( argvalue == "findlandtile" )
  {
    return UoTool::findlandtile( s_argc - 1, s_argv + 1 );
  }
  else if ( argvalue == "findlandtileflags" )
  {
    return UoTool::findlandtileflags( s_argc - 1, s_argv + 1 );
  }
  else if ( argvalue == "findgraphic" )
  {
    return UoTool::findgraphic( s_argc - 1, s_argv + 1 );
  }
  else if ( argvalue == "defragstatics" )
  {
    return UoTool::defragstatics( s_argc - 1, s_argv + 1 );
  }
  else if ( argvalue == "formatdesc" )
  {
    return UoTool::format_description( s_argc - 1, s_argv + 1 );
  }
  else if ( argvalue == "checkmultis" )
  {
    return UoTool::checkmultis();
  }

  showHelp();
  return 0;
}
Ejemplo n.º 3
0
int UoConvertMain::main()
{
  const std::vector<std::string>& binArgs = programArgs();

  /**********************************************
   * show help
   **********************************************/
  if ( binArgs.size() == 1 )
  {
    showHelp();
    return 0;  // return "okay"
  }

  /**********************************************
   * TODO: rework the following cruft from former uoconvert.cpp
   **********************************************/
  Plib::systemstate.config.max_tile_id = UOBJ_DEFAULT_MAX;  // default
  std::string argvalue = programArgsFindEquals( "uodata=", "" );
  if ( !argvalue.empty() )
  {
    Plib::systemstate.config.uo_datafile_root = argvalue;
    Plib::systemstate.config.uo_datafile_root =
        Clib::normalized_dir_form( Plib::systemstate.config.uo_datafile_root );
  }
  else
  {
    INFO_PRINT << "Reading pol.cfg.\n";
    Clib::ConfigFile cf( "pol.cfg" );
    Clib::ConfigElem elem;

    cf.readraw( elem );
    Plib::systemstate.config.uo_datafile_root = elem.remove_string( "UoDataFileRoot" );
    Plib::systemstate.config.uo_datafile_root =
        Clib::normalized_dir_form( Plib::systemstate.config.uo_datafile_root );

    unsigned short max_tile = elem.remove_ushort( "MaxTileID", UOBJ_DEFAULT_MAX );

    if ( max_tile == UOBJ_DEFAULT_MAX || max_tile == UOBJ_SA_MAX || max_tile == UOBJ_HSA_MAX )
      Plib::systemstate.config.max_tile_id = max_tile;
  }

  unsigned short max_tile =
      static_cast<unsigned short>( programArgsFindEquals( "maxtileid=", UOBJ_DEFAULT_MAX, true ) );
  if ( max_tile == UOBJ_DEFAULT_MAX || max_tile == UOBJ_SA_MAX || max_tile == UOBJ_HSA_MAX )
    Plib::systemstate.config.max_tile_id = max_tile;


  std::string main_cfg = "uoconvert.cfg";
  if ( Clib::FileExists( main_cfg.c_str() ) )
  {
    std::string temp;
    Clib::ConfigElem elem;
    INFO_PRINT << "Reading uoconvert.cfg.\n";
    Clib::ConfigFile cf_main( main_cfg.c_str() );
    while ( cf_main.read( elem ) )
    {
      if ( elem.type_is( "MultiTypes" ) )
      {
        temp = elem.remove_string( "Boats" );
        ISTRINGSTREAM is_boats( temp );
        std::string graphicnum;
        while ( is_boats >> graphicnum )
          UoConvert::BoatTypes.insert( strtoul( graphicnum.c_str(), NULL, 0 ) );

        temp = elem.remove_string( "Houses" );
        ISTRINGSTREAM is_houses( temp );
        while ( is_houses >> graphicnum )
          UoConvert::HouseTypes.insert( strtoul( graphicnum.c_str(), NULL, 0 ) );

        temp = elem.remove_string( "Stairs" );
        ISTRINGSTREAM is_stairs( temp );
        while ( is_stairs >> graphicnum )
          UoConvert::StairTypes.insert( strtoul( graphicnum.c_str(), NULL, 0 ) );
      }
      else if ( elem.type_is( "LOSOptions" ) )