コード例 #1
0
        void AppInfoPanel::createGui() {
            const wxBitmap appIconImage = IO::loadImageResource("AppIcon.png");
            wxStaticBitmap* appIcon = new wxStaticBitmap(this, wxID_ANY, appIconImage);
            wxStaticText* appName = new wxStaticText(this, wxID_ANY, "TrenchBroom");
            appName->SetFont(appName->GetFont().Larger().Larger().Larger().Larger().Bold());
            wxStaticLine* appLine = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
            wxStaticText* appClaim = new wxStaticText(this, wxID_ANY, "Level Editor");
            
            wxString versionStr("Version ");
            versionStr << getBuildVersion() << " " << getBuildChannel();
            
            wxString buildStr("Build ");
            buildStr << getBuildId() << " " << getBuildType();
            
            wxStaticText* version = new wxStaticText(this, wxID_ANY, versionStr);
            wxStaticText* build = new wxStaticText(this, wxID_ANY, buildStr);
#if !defined(_WIN32)
            version->SetFont(version->GetFont().Smaller());
            build->SetFont(build->GetFont().Smaller());
#endif
            version->SetForegroundColour(wxColor(128, 128, 128));
            build->SetForegroundColour(wxColor(128, 128, 128));
            
            SetBackgroundColour(*wxWHITE);
            
            wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
            sizer->Add(appIcon, 0, wxALIGN_CENTER_HORIZONTAL);
            sizer->Add(appName, 0, wxALIGN_CENTER_HORIZONTAL);
            sizer->Add(appLine, 0, wxEXPAND);
            sizer->Add(appClaim, 0, wxALIGN_CENTER_HORIZONTAL);
            sizer->Add(version, 0, wxALIGN_CENTER_HORIZONTAL);
            sizer->Add(build, 0, wxALIGN_CENTER_HORIZONTAL);
            sizer->AddStretchSpacer();
            SetSizerAndFit(sizer);
        }
コード例 #2
0
void SyslogParser::parseNew(const std::string& msg, RemoteSyslogChannel::Severity severity, RemoteSyslogChannel::Facility fac, std::size_t& pos)
{
	Poco::Message::Priority prio = convert(severity);
	// rest of the unparsed header is:
	// VERSION SP TIMESTAMP SP HOSTNAME SP APP-NAME SP PROCID SP MSGID
	std::string versionStr(parseUntilSpace(msg, pos));
	std::string timeStr(parseUntilSpace(msg, pos)); // can be the nilvalue!
	std::string hostName(parseUntilSpace(msg, pos));
	std::string appName(parseUntilSpace(msg, pos));
	std::string procId(parseUntilSpace(msg, pos));
	std::string msgId(parseUntilSpace(msg, pos));
	std::string message(msg.substr(pos));
	pos = msg.size();
	Poco::DateTime date;
	int tzd = 0;
	bool hasDate = Poco::DateTimeParser::tryParse(RemoteSyslogChannel::SYSLOG_TIMEFORMAT, timeStr, date, tzd);
	Poco::Message logEntry(msgId, message, prio);
	logEntry["host"] = hostName;
	logEntry["app"] = appName;
	
	if (hasDate)
		logEntry.setTime(date.timestamp());
	int lval(0);
	Poco::NumberParser::tryParse(procId, lval);
	logEntry.setPid(lval);
	_pListener->log(logEntry);
}
コード例 #3
0
        AboutDialog::AboutDialog(wxWindow* parent) :
        wxDialog(parent, wxID_ANY, wxT("About")) {
            IO::FileManager fileManager;
            
            wxBitmap icon(fileManager.appendPath(fileManager.resourceDirectory(), "Icon.png"), wxBITMAP_TYPE_PNG);
            
            wxStaticBitmap* appIcon = new wxStaticBitmap(this, wxID_ANY, icon);
            wxStaticLine* appLine = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
            wxStaticText* appName = new wxStaticText(this, wxID_ANY, wxT("TrenchBroom"));
            appName->SetFont(appName->GetFont().Larger().Larger().Larger().Larger().Bold());
            
            wxStaticText* appClaim = new wxStaticText(this, wxID_ANY, wxT("A Modern Level Editor for Quake"));
            
            wxString versionStr(wxT("Version "));
            versionStr << VERSIONSTR;
            
            wxStaticText* version = new wxStaticText(this, wxID_ANY, versionStr);
            
            wxStaticText* devHeader = new wxStaticText(this, wxID_ANY, wxT("Development"));
            devHeader->SetFont(devHeader->GetFont().Bold());
            wxStaticText* devText = new wxStaticText(this, wxID_ANY, wxT("Kristian Duske"));
            
            wxStaticText* contrHeader = new wxStaticText(this, wxID_ANY, wxT("Contributions"));
            contrHeader->SetFont(contrHeader->GetFont().Bold());
            wxSizer* contrText = CreateTextSizer(wxT("Corey Jones (feedback, testing, documentation)\nAndré König (feedback, testing)\nWouter van Oortmerssen (feedback)\nHannes Kröger (testing)\nMorgan Allen (testing)\nForest Hale (fov code)\nChristian Grawert (Quake.fdg)"));
            
            wxSizer* copyright = CreateTextSizer(wxT("Copyright 2010-2013 Kristian Duske\nQuake is a registered trademark of id Software"));

            wxGridBagSizer* sizer = new wxGridBagSizer();

            int row = 0;
            sizer->Add(0, 10, wxGBPosition(row++, 1));
            sizer->AddGrowableRow(static_cast<size_t>(row - 1));
            sizer->Add(appName, wxGBPosition(row++, 1));
            sizer->Add(appLine, wxGBPosition(row++, 1), wxDefaultSpan, wxEXPAND);
            sizer->Add(appClaim, wxGBPosition(row++, 1));
            sizer->Add(0, 20, wxGBPosition(row++, 1));
            sizer->Add(version, wxGBPosition(row++, 1));
            sizer->Add(0, 20, wxGBPosition(row++, 1));
            sizer->Add(devHeader, wxGBPosition(row++, 1));
            sizer->Add(devText, wxGBPosition(row++, 1));
            sizer->Add(0, 20, wxGBPosition(row++, 1));
            sizer->Add(contrHeader, wxGBPosition(row++, 1));
            sizer->Add(contrText, wxGBPosition(row++, 1));
            sizer->Add(0, 20, wxGBPosition(row++, 1));
            sizer->Add(copyright, wxGBPosition(row++, 1));
            sizer->Add(0, 10, wxGBPosition(row++, 1));
            sizer->AddGrowableRow(static_cast<size_t>(row - 1));
            sizer->Add(appIcon, wxGBPosition(0, 0), wxGBSpan(row, 1), wxALIGN_CENTER);
            
            SetSizer(sizer);
            SetSize(650, 420);
            CenterOnParent();
            
            SetBackgroundColour(*wxWHITE);
        }
コード例 #4
0
/*----------------------------------------------------------------------------*/
void MeasureWindow::onHelpAbout()
{
  QString contens;

  contens += QString("<p>experimenter %1</p>").arg(versionStr());
  contens +=  tr(
      "<p>The <b>experimenter</b> "
      "is part of a software-hardware system "
      "for testing the static strength of diamond powder.</p>"
      );
  contens +=  tr(
      "<p>Experimenter from device receive "
      "test data and stores them in a database "
      "for later analysis.</p>"
      );

  QMessageBox::about(this, tr("About experimenter"), contens);

}
コード例 #5
0
ファイル: ArxDbgApp.cpp プロジェクト: kevinzhwl/ObjectARXMod
CWnd*
ArxDbgApp::startSplashScreen()
{
    CString bmpFileName = appPath();
    bmpFileName += _T("support\\ArxDbgSplash.bmp");    // TBD: make this better later!

        // make sure file is there (either in a main directory, which is
		// where someone would install it, or for developers, go out of 
		// "Debug" directory and up to the main directory.
    CFileStatus status;
    BOOL success = CFile::GetStatus(bmpFileName, status);
	if (success == FALSE) {
		bmpFileName = appPath();
		bmpFileName += _T("..\\support\\ArxDbgSplash.bmp");  // TBD: make this better later!

		success = CFile::GetStatus(bmpFileName, status);
	}

	if (success) {
        ArxDbgUiDlgSplash* dbox = new ArxDbgUiDlgSplash(bmpFileName);
        dbox->setTextStrings(appName(), versionStr(), _T(""), _T(""));

			// TBD: have to do this manually right now, although it should
			// have worked to pass up resource handle through the constructor!
		acDocManager->pushResourceHandle(dllInstance());
        dbox->Create(acedGetAcadDwgView());
		acDocManager->popResourceHandle();

        dbox->ShowWindow(SW_SHOW);
        dbox->UpdateWindow();

        return dbox;
    }
    else {        // intended a splash screen but could not find it!
        acutPrintf(_T("\nCould not find splash box image: \"%s\""), bmpFileName);
        return NULL;
    }
}
コード例 #6
0
	EXPORT_C HBufC* UserStringL(const TBBBuildInfo& aInfo)
	{
		CALLSTACKITEMSTATIC_N(_CL("BuildInfo"), _CL("UserStringL"));
		// Version 0.41.0
		// (11.2.2007 13:14)
		// (Development variant)
		auto_ptr<HBufC> result( HBufC::NewL( 50 + 50 + 50 ) );
		
		auto_ptr< CArrayFix<TInt> > versions( new (ELeave) CArrayFixFlat<TInt>(3));
		versions->AppendL(aInfo.iMajorVersion());
		versions->AppendL(aInfo.iMinorVersion());
		versions->AppendL(aInfo.iInternalVersion());
		auto_ptr<HBufC> versionStr( StringLoader::LoadL(R_TEXT_VERSION_FMT,
														*versions) );		
		result->Des().Append( *versionStr );

		result->Des().Append( KNewLine );
		TBuf<50> date;
		_LIT(KDateFmt, "%F%D.%M.%Y %H:%T");
		aInfo.iWhen().FormatL( date,  KDateFmt );
		result->Des().Append( date );
		
#ifdef __DEV__
		result->Des().Append( KNewLine );		
		_LIT( KDevVariant, "Development variant");
		result->Des().Append( KDevVariant );

		result->Des().Append( KNewLine );		

		_LIT( KBuildBy, "Build by:");
		result->Des().Append( KBuildBy );
		result->Des().Append( aInfo.iBuildBy() );
#endif
		result->Des().Append( KNewLine );
		return result.release();
	}
コード例 #7
0
ファイル: SystemInfo.cpp プロジェクト: MrMC/mrmc
std::string CSysInfo::GetUserAgent()
{
  static std::string result;
  if (!result.empty())
    return result;

  result = GetAppName() + "/" + CSysInfo::GetVersionShort() + " (";
#if defined(TARGET_DARWIN)
#if defined(TARGET_DARWIN_IOS)
  std::string iDevStr(GetModelName()); // device model name with number of model version
  size_t iDevStrDigit = iDevStr.find_first_of("0123456789");
  std::string iDev(iDevStr, 0, iDevStrDigit);  // device model name without number 
  if (iDevStrDigit == 0)
    iDev = "unknown";
  result += iDev + "; ";
  std::string iOSVerison(GetOsVersion());
  size_t lastDotPos = iOSVerison.rfind('.');
  if (lastDotPos != std::string::npos && iOSVerison.find('.') != lastDotPos
      && iOSVerison.find_first_not_of('0', lastDotPos + 1) == std::string::npos)
    iOSVerison.erase(lastDotPos);
  StringUtils::Replace(iOSVerison, '.', '_');
  if (iDev == "AppleTV4")
    result += "CPU TVOS ";
  else if (iDev == "iPad" || iDev == "AppleTV")
    result += "CPU OS ";
  else
    result += "CPU iPhone OS ";
  result += iOSVerison + " like Mac OS X";
#else
  result += "Macintosh; ";
  std::string cpuFam(GetBuildTargetCpuFamily());
  if (cpuFam == "x86")
    result += "Intel ";
  else if (cpuFam == "PowerPC")
    result += "PPC ";
  result += "Mac OS X ";
  std::string OSXVersion(GetOsVersion());
  StringUtils::Replace(OSXVersion, '.', '_');
  result += OSXVersion;
#endif
#elif defined(TARGET_ANDROID)
  result += "Linux; Android ";
  std::string versionStr(GetOsVersion());
  const size_t verLen = versionStr.length();
  if (verLen >= 2 && versionStr.compare(verLen - 2, 2, ".0", 2) == 0)
    versionStr.erase(verLen - 2); // remove last ".0" if any
  result += versionStr;
  std::string deviceInfo(GetModelName());

  char buildId[PROP_VALUE_MAX];
  int propLen = __system_property_get("ro.build.id", buildId);
  if (propLen > 0 && propLen <= PROP_VALUE_MAX)
  {
    if (!deviceInfo.empty())
      deviceInfo += " ";
    deviceInfo += "Build/";
    deviceInfo.append(buildId, propLen);
  }

  if (!deviceInfo.empty())
    result += "; " + deviceInfo;
#elif defined(TARGET_POSIX)
  result += "X11; ";
  struct utsname un;
  if (uname(&un) == 0)
  {
    std::string cpuStr(un.machine);
    if (cpuStr == "x86_64" && GetXbmcBitness() == 32)
      cpuStr = "i686 (x86_64)";
    result += un.sysname;
    result += " ";
    result += cpuStr;
  }
  else
    result += "Unknown";
#else
  result += "Unknown";
#endif
  result += ")";

  if (GetAppName() != "Kodi")
    result += " Kodi_Fork_" + GetAppName() + "/1.0"; // default fork number is '1.0', replace it with actual number if necessary

#ifdef TARGET_LINUX
  // Add distribution name
  std::string linuxOSName(GetOsName(true));
  if (!linuxOSName.empty())
    result += " " + linuxOSName + "/" + GetOsVersion();
#endif

#ifdef TARGET_RASPBERRY_PI
  result += " HW_RaspberryPi/1.0";
#elif defined (TARGET_DARWIN_IOS)
  std::string iDevVer;
  if (iDevStrDigit == std::string::npos)
    iDevVer = "0.0";
  else
    iDevVer.assign(iDevStr, iDevStrDigit, std::string::npos);
  StringUtils::Replace(iDevVer, ',', '.');
  result += " HW_" + iDev + "/" + iDevVer;
#endif
  // add more device IDs here if needed. 
  // keep only one device ID in result! Form:
  // result += " HW_" + "deviceID" + "/" + "1.0"; // '1.0' if device has no version

#if defined(TARGET_ANDROID)
  // Android has no CPU string by default, so add it as additional parameter
  struct utsname un1;
  if (uname(&un1) == 0)
  {
    std::string cpuStr(un1.machine);
    StringUtils::Replace(cpuStr, ' ', '_');
    result += " Sys_CPU/" + cpuStr;
  }
#endif

  result += " App_Bitness/" + StringUtils::Format("%d", GetXbmcBitness());

  std::string fullVer(CSysInfo::GetVersion());
  StringUtils::Replace(fullVer, ' ', '-');
  result += " Version/" + fullVer;

  return result;
}
コード例 #8
0
int main ( int argc, char **argv )
{
  //FILE *testarena;
  char tempstr[256];

  setDefaultLogName("rapicDS.log");
  RapicStartedTime = time(0);
  mainpid = getpid();
  sprintf(arenaname,"%s.arena",argv[0]);
  sprintf(Title,"%s %s",argv[0], versionStr());
  sprintf(tempstr,"%s - Starting as pid %d\n",Title, mainpid);
  RapicLog(tempstr, LOG_WARNING);
  init_signals();

  if (FileExists("rapicquitflag", true, true)) {
    sprintf(tempstr,"%s - Warning - rapicquitflag detected on startup, deleting",Title);
    RapicLog(tempstr, LOG_WARNING);
  }

#ifdef THREAD_SPROC
  usptr_t *arena = 0;
  if (testarena = fopen(arenaname,"r")) {
    fprintf(stderr,"WARNING - IRIX ARENA ALREADY EXISTS - %s\n",arenaname);
    //		fprintf(stderr,"FATAL ERROR - 3D Rapic CANNOT RUN");
    //		exit(-1);
  } 
  else fclose(testarena);
  int ret;
  if (ret = usconfig(CONF_INITSIZE,256000))
    { perror("usconfig(CONF_INITSIZE)"); };
  if (ret = usconfig(CONF_LOCKTYPE,US_DEBUGPLUS))
    { perror("usconfig(CONF_LOCKTYPE)"); };
  //	usconfig(CONF_LOCKTYPE,US_DEBUG);
  //	usconfig(CONF_LOCKTYPE,US_NODEBUG);
  if (ret = usconfig(CONF_ARENATYPE,US_SHAREDONLY))
    { perror("usconfig(CONF_ARENATYPE)"); };
  if (ret = usconfig(CONF_INITUSERS,150))
    { perror("usconfig(CONF_INITUSERS)"); };
  //	usconfig(CONF_STHREADIOOFF);
  if (!(arena = usinit(arenaname))) {
    fprintf(stderr,"usinit(%s) - FAILED ", arenaname);
    perror(0);
    fprintf(stderr,"FATAL ERROR - %s CANNOT RUN", argv[0]);
    exit(-1);
  } 
#endif

  GetSiteInfo(DISABLE_COVERAGE_LOAD);
  FreeListMng = new free_list_mng;
  ScanMng = new scan_mng;
  rpdbCacheCopyMode = argFound(argc, argv, "cache_path");
  if (InitISAM(10,30,12))
    fprintf(stderr,"CTree InitISAM ERROR");
  else {
    DBMngr = new DBMng(!rpdbCacheCopyMode);  // don't allow db purge if cache copy mode
    if (DBMngr) 
      {
	if (ScanMng) 
	  {
	    ScanMng->AddClient(DBMngr);
	    if ((ScanMng->recentCachePeriod > 0) && ScanMng->keepScansInCache)
	      {
		fprintf(stdout, "Loading last %dmins of data from database into recent scan cache\n",
			ScanMng->recentCachePeriod);
		DBMngr->loadInitialSeq(NULL, 1, true);
		ScanMng->startupLatestTime = ScanMng->mostRecentScanTime();  //latest time from db on startup
		ScanMng->PrintScanUsage(stdout, true);
	      }
	  }
      }
    }  
  CommMngr = new RPCommMng;
  if (FileExists(defaultreplayinifile))
    {
      if (ReplayMngr)
        {
          delete ReplayMngr;
          ReplayMngr = 0;
        }
      ReplayMngr = new replay(defaultreplayinifile);
    }
  if (FileExists("nexrad.ini"))
    {
      NexRadManager = new NexRadMgr();
      if (NexRadManager)
	{
	  NexRadManager->StartNexRadStnHdlrs();
	}
    }
  if (FileExists("uf.ini"))
    {
      ufManager = new ufMgr();
      if (ufManager)
	{
	  ufManager->StartUfStnHdlrs();
	}
    }
  if (FileExists("fileReaders.ini"))
    initGlobalFileReaderMng(argv[0], "fileReaders.ini");
  check_rpdbCacheCopyMode(argc, argv);
  if (DBMngr && DBMngr->rpdbCache && cacheCopyReq)
    {
      if (rpdbCacheStatsMode)
	{
	  DBMngr->rpdbCache->dumpCacheContents("rpdb_cache_contents.txt");
	  DBMngr->rpdbCache->dumpStats(*cacheCopyReq, "cache_stats.txt");
	}
      else if (rpdbCacheCopyMode)
	{
	  DBMngr->rpdbCache->dumpCacheContents("rpdb_cache_contents.txt");
	  DBMngr->rpdbCache->copyDB(*cacheCopyReq);
	}
    }
  while (!quitRapicConvert && !rpdbCacheCopyMode)
    {
      timenow = time(0);
      if (CommMngr) {
	if (time(0) >= NextCommPollTime) {
	  CommMngr->CheckComms();
	  NextCommPollTime = timenow + CommPollPeriod;
	}
      }
      if (DBMngr && (timenow > DBMngr->DBCheckTime)) {
	if (DBMngr->CheckScans())   // false if scan check not yet complete
	  DBMngr->DBCheckTime = timenow + DBMngr->DBCheckPeriod;
      }
      if (ReplayMngr && (timenow > ReplayCheckTime)) {
	ReplayMngr->check_replay();
	ReplayCheckTime = timenow + time_t(float(ReplayCheckPeriod)/ReplayMngr->getTimeScale());
      }
      if (ScanMng && (timenow > ScanMng->CheckTime))
	ScanMng->Check();
      if (reqMemCheck ||
	  (MemoryStatusDumpTime <= timenow) || 
	  FileExists("memdump.flag", 1, 1)) {
	AppendMemoryStatus();
	MemoryStatusDumpTime = time(0) + MemoryStatusDumpPeriod;
	reqMemCheck = false;
      }
      sec_delay(0.5);
      if (FileExists("rapicquitflag", true, false))
	{
	  quitRapicConvert = true;
	  fprintf(stdout,"%s - Detected rapicquitflag - Shutting down - pid %d",Title, mainpid);
	}
      
    }
  fprintf(stdout,"%s - Shutting down - pid %d",Title, mainpid);
  if (CommMngr) {
    delete CommMngr;
    CommMngr = 0;
  }
  if (ufManager)
    {
      delete ufManager;
      ufManager = 0;
    }
  if (NexRadManager)
    {
      delete NexRadManager;
      NexRadManager = 0;
    }
  if (DBMngr)
    {
      delete DBMngr;
      DBMngr = 0;
    }
  if (ScanMng) {
    delete ScanMng;
    ScanMng = 0;
  }
  if (ReplayMngr)
    {
      delete ReplayMngr;
      ReplayMngr = 0;
    }
  closeGlobalFileReaderMng();
  if (FileExists("rapicquitflag", true, true))
    {
      fprintf(stdout,"%s - Shut down complete - pid %d - Removing rapicquitflag",Title, mainpid);
    }
      
  return 0;
}
コード例 #9
0
ファイル: SystemInfo.cpp プロジェクト: Inz999/xbmc
std::string CSysInfo::GetUserAgent()
{
  static std::string result;
  if (!result.empty())
    return result;

  result = "XBMC/" + g_infoManager.GetLabel(SYSTEM_BUILD_VERSION_SHORT) + " (";
#if defined(TARGET_WINDOWS)
  result += GetKernelName() + " " + GetKernelVersion();
  BOOL bIsWow = FALSE;
  if (IsWow64Process(GetCurrentProcess(), &bIsWow) && bIsWow)
      result.append("; WOW64");
  else
  {
    SYSTEM_INFO si = {};
    GetSystemInfo(&si);
    if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
      result.append("; Win64; x64");
    else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
      result.append("; Win64; IA64");
    else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM)
      result.append("; ARM");
  }
#elif defined(TARGET_DARWIN)
#if defined(TARGET_DARWIN_IOS)
  std::string iDevStr(GetModelName()); // device model name with number of model version
  size_t iDevStrDigit = iDevStr.find_first_of("0123456789");
  std::string iDev(iDevStr, 0, iDevStrDigit);  // device model name without number 
  if (iDevStrDigit == 0)
    iDev = "unknown";
  result += iDev + "; ";
  std::string iOSVerison(GetOsVersion());
  size_t lastDotPos = iOSVerison.rfind('.');
  if (lastDotPos != std::string::npos && iOSVerison.find('.') != lastDotPos
      && iOSVerison.find_first_not_of('0', lastDotPos + 1) == std::string::npos)
    iOSVerison.erase(lastDotPos);
  StringUtils::Replace(iOSVerison, '.', '_');
  if (iDev == "iPad" || iDev == "AppleTV")
    result += "CPU OS ";
  else
    result += "CPU iPhone OS ";
  result += iOSVerison + " like Mac OS X";
#else
  result += "Macintosh; ";
  std::string cpuFam(GetBuildTargetCpuFamily());
  if (cpuFam == "x86")
    result += "Intel ";
  else if (cpuFam == "PowerPC")
    result += "PPC ";
  result += "Mac OS X ";
  std::string OSXVersion(GetOsVersion());
  StringUtils::Replace(OSXVersion, '.', '_');
  result += OSXVersion;
#endif
#elif defined(TARGET_ANDROID)
  result += "Linux; Android ";
  std::string versionStr(GetOsVersion());
  const size_t verLen = versionStr.length();
  if (verLen >= 2 && versionStr.compare(verLen - 2, 2, ".0", 2) == 0)
    versionStr.erase(verLen - 2); // remove last ".0" if any
  result += versionStr;
  std::string deviceInfo(GetModelName());

  char buildId[PROP_VALUE_MAX];
  int propLen = __system_property_get("ro.build.id", buildId);
  if (propLen > 0 && propLen <= PROP_VALUE_MAX)
  {
    if (!deviceInfo.empty())
      deviceInfo += " ";
    deviceInfo += "Build/";
    deviceInfo.append(buildId, propLen);
  }

  if (!deviceInfo.empty())
    result += "; " + deviceInfo;
#elif defined(TARGET_POSIX)
  result += "X11; ";
  struct utsname un;
  if (uname(&un) == 0)
  {
    std::string cpuStr(un.machine);
    if (cpuStr == "x86_64" && GetXbmcBitness() == 32)
      cpuStr = "i686 (x86_64)";
    result += un.sysname;
    result += " ";
    result += cpuStr;
  }
  else
    result += "Unknown";
#else
  result += "Unknown";
#endif
  result += ")";
  // add fork ID here in form:
  // result += " XBMC_FORK_" + "forkname" + "/" + "1.0"; // default fork number is '1.0'
#ifdef TARGET_RASPBERRY_PI
  result += " XBMC_HW_RaspberryPi/1.0";
#elif defined (TARGET_DARWIN_IOS)
  std::string iDevVer;
  if (iDevStrDigit == std::string::npos)
    iDevVer = "0.0";
  else
    iDevVer.assign(iDevStr, iDevStrDigit, std::string::npos);
  StringUtils::Replace(iDevVer, ',', '.');
  result += " XBMC_HW_" + iDev + "/" + iDevVer;
#endif
  // add more device IDs here if needed. 
  // keep only one device ID in result! Form:
  // result += " XBMC_HW_" + "deviceID" + "/" + "1.0"; // '1.0' if device has no version

#if defined(TARGET_ANDROID)
  // Android has no CPU string by default, so add it as additional parameter
  struct utsname un1;
  if (uname(&un1) == 0)
  {
    std::string cpuStr(un1.machine);
    StringUtils::Replace(cpuStr, ' ', '_');
    result += " XBMC_CPU/" + cpuStr;
  }
#endif

  result += " XBMC_BITNESS/" + StringUtils::Format("%d", GetXbmcBitness());

  std::string fullVer(g_infoManager.GetLabel(SYSTEM_BUILD_VERSION));
  StringUtils::Replace(fullVer, ' ', '-');
  result += " Version/" + fullVer;

  return result;
}
コード例 #10
0
ファイル: S65ShowVideo.cpp プロジェクト: Ratel13/JinRiCompany
void S65ShowVideo::DownLoadFinish()
{
    
    int nbegin=3;
	m_strUrlContent=m_strUrlContent.substr(nbegin,m_strUrlContent.length()-nbegin);
	CDataConvert dataConvert;
	m_strUrlContent=dataConvert.UTF8ToGB(m_strUrlContent.c_str());
    
    
	Json* root= Json_create(m_strUrlContent.c_str());
    
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    string detailClassName ="S"+PersonalApi::convertIntToString(AppDelegate::S1NaviSelected) +"ShowVideo";
    string currentClassName(detailClassName.c_str());
    string version = currentClassName+"version";
    string needUpDate = currentClassName+"needUpDate";
    string newVersion = currentClassName+"newVersion";
    string time = currentClassName+"time";
    
    Json* root_Version=Json_getItem(root,"version");
    
    if (root_Version)
	{
        string versionStr(root_Version->valuestring);
        
        
        if (CCUserDefault::sharedUserDefault()->getStringForKey(version.c_str()).compare(versionStr) == 0)
        {
            CCUserDefault::sharedUserDefault()->setBoolForKey(needUpDate.c_str(),false);
            
            
            AppDelegate::loadingLabel->setString("");
            //setButtonEnabel(false);
            
            setUpUpDateLabel(CCPointMake(130, 570),CCPointMake(900, 570),CCUserDefault::sharedUserDefault()->getStringForKey(time.c_str()),CCUserDefault::sharedUserDefault()->getBoolForKey(needUpDate.c_str()));
            
            
            return;
        }
        else
        {
            CCUserDefault::sharedUserDefault()->setBoolForKey(needUpDate.c_str(),true);
            CCUserDefault::sharedUserDefault()->setStringForKey(newVersion.c_str(), root_Version->valuestring);
        }
	}
    
    Json* root_time=Json_getItem(root,"time");
    if (root_time)
	{
        CCUserDefault::sharedUserDefault()->setStringForKey(time.c_str(), root_time->valuestring);
	}
    
    setUpUpDateLabel(CCPointMake(130, 570),CCPointMake(900, 570),CCUserDefault::sharedUserDefault()->getStringForKey(time.c_str()),CCUserDefault::sharedUserDefault()->getBoolForKey(needUpDate.c_str()));
    //setButtonEnabel(true);
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    
    
    
	//picture and title
	Json* root_smallpicture=Json_getItem(root,"video");
	if (root_smallpicture && root_smallpicture->type==Json_Array)
	{
		Json* json_child=root_smallpicture->child;
        map<string, string> valueMap;
        showPicMap.clear();
        showBigPicMap.clear();
        int i = 0;//smal image
        int k = 0;
        int j = 0;//big image
		while(json_child)
		{
			Json* child_pic_url=Json_getItem(json_child,"img");
            Json* child_video_url=Json_getItem(json_child,"video_url");
            
            if (i==0) {
                
                //self
                {
                    if (child_pic_url)
                    {
                        char szsamllpicname[512]={0};
                        sprintf(szsamllpicname, "S%d5ScrollBigPic%d.png",AppDelegate::S1NaviSelected,j+1);
                        string picNameStr(szsamllpicname);
                        showBigPicMap[PersonalApi::convertIntToString(j+1)] = picNameStr;
                        DownLoadFile(child_pic_url->valuestring,szsamllpicname);
                        
                        string valueStr = child_video_url->valuestring;
                        valueMap[PersonalApi::convertIntToString(j+1)] = valueStr;
                    }
                    j++;
                }
                
            }else if (i==1) {
                
                {
                    if (child_pic_url)
                    {
                        char szsamllpicname[512]={0};
                        sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1);
                        string picNameStr(szsamllpicname);
                        showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr;
                        DownLoadFile(child_pic_url->valuestring,szsamllpicname);
                        
                        string valueStr = child_video_url->valuestring;
                        valueMap[PersonalApi::convertIntToString(k+1)] = valueStr;
                    }
                    k++;
                }
                
                {
                    if (child_pic_url)
                    {
                        char szsamllpicname[512]={0};
                        sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1);
                        string picNameStr(szsamllpicname);
                        showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr;
                        DownLoadFile(child_pic_url->valuestring,szsamllpicname);
                        
                        string valueStr = child_video_url->valuestring;
                        valueMap[PersonalApi::convertIntToString(k+1)] = valueStr;
                    }
                    k++;
                }
                
                {
                    if (child_pic_url)
                    {
                        char szsamllpicname[512]={0};
                        sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1);
                        string picNameStr(szsamllpicname);
                        showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr;
                        DownLoadFile(child_pic_url->valuestring,szsamllpicname);
                        
                        string valueStr = child_video_url->valuestring;
                        valueMap[PersonalApi::convertIntToString(k+1)] = valueStr;
                    }
                    k++;
                }
                
            }else if (i==3) {
                
                {
                    if (child_pic_url)
                    {
                        char szsamllpicname[512]={0};
                        sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1);
                        string picNameStr(szsamllpicname);
                        showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr;
                        DownLoadFile(child_pic_url->valuestring,szsamllpicname);
                        
                        string valueStr = child_video_url->valuestring;
                        valueMap[PersonalApi::convertIntToString(k+1)] = valueStr;
                    }
                    k++;
                    
                }
                
                {
                    if (child_pic_url)
                    {
                        char szsamllpicname[512]={0};
                        sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1);
                        string picNameStr(szsamllpicname);
                        showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr;
                        DownLoadFile(child_pic_url->valuestring,szsamllpicname);
                        
                        string valueStr = child_video_url->valuestring;
                        valueMap[PersonalApi::convertIntToString(k+1)] = valueStr;
                    }
                    k++;
                    
                }
                
                //self
                {
                    if (child_pic_url)
                    {
                        char szsamllpicname[512]={0};
                        sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1);
                        string picNameStr(szsamllpicname);
                        showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr;
                        DownLoadFile(child_pic_url->valuestring,szsamllpicname);
                        
                        string valueStr = child_video_url->valuestring;
                        valueMap[PersonalApi::convertIntToString(k+1)] = valueStr;
                    }
                    k++;
                }
                
                
            }else{
                if(child_pic_url){
                    char szsamllpicname[512]={0};
                    sprintf(szsamllpicname, "S%d5ScrollPic%d.png",AppDelegate::S1NaviSelected,k+1);
                    string picNameStr(szsamllpicname);
                    showPicMap[PersonalApi::convertIntToString(k+1)] = picNameStr;
                    DownLoadFile(child_pic_url->valuestring,szsamllpicname);
                    
                    string valueStr = child_video_url->valuestring;
                    valueMap[PersonalApi::convertIntToString(k+1)] = valueStr;
                    
                }
                k++;
            }
            
            i++;
			json_child=json_child->next;
		}
        
        string str1 = "S"+PersonalApi::convertIntToString(AppDelegate::S1NaviSelected) +"5scrollPic";
        string str2 = "S"+PersonalApi::convertIntToString(AppDelegate::S1NaviSelected) +"5VideoIntro";
        
        PersonalApi::wirteVecToXml(showPicMap,str1);
        PersonalApi::wirteVecToXml(valueMap,str2);
        
	}
    
    checkPicDownLoading();
}