/* Function   : onLeaderVersion
 * Arguments  : stream - socket, through which the data is received and sent
 * Description: handler of REPLICATION_LEADER_VERSION command; comparing the
 *				received version to the local one and downloading the replica
 *				from the remote replication daemon when the received version is
 *				better than the local one and there is no downloading
 *				'condor_transferer' running at the same time
 */
void
ReplicatorStateMachine::onLeaderVersion( Stream* stream )
{
    dprintf( D_ALWAYS, "ReplicatorStateMachine::onLeaderVersion started\n" );
    
    if( m_state != BACKUP ) {
        return ;
    }
	checkVersionSynchronization( );

    Version* newVersion = decodeVersionAndState( stream );
	// comparing the received version to the local one
    bool downloadNeeded = replicaSelectionHandler( *newVersion );
    // downloading the replica from the remote replication daemon, when the
	// received version is better and there is no running downloading
	// 'condor_transferers'  
    if( downloadTransferersNumber( ) == 0 && newVersion && downloadNeeded ) {
        dprintf( D_FULLDEBUG, "ReplicatorStateMachine::onLeaderVersion "
				"downloading from %s\n", 
				newVersion->getSinfulString( ).Value( ) );
        download( newVersion->getSinfulString( ).Value( ) );
    }
    // replication leader must not send a version which hasn't been updated
    //assert(downloadNeeded);
    //REPLICATION_ASSERT(downloadNeeded);
	delete newVersion;
}
/* Function   : decodeVersionAndState
 * Arguments  : stream - socket, through which the data is received 
 * Description: receives remote replication daemon version and state from the
 *				given socket
 */
Version*
ReplicatorStateMachine::decodeVersionAndState( Stream* stream )
{
	Version* newVersion = new Version;
	// decode remote replication daemon version
   	if( ! newVersion->decode( stream ) ) {
    	dprintf( D_ALWAYS, "ReplicatorStateMachine::decodeVersionAndState "
                           "cannot read remote daemon version\n" );
       	delete newVersion;
       
       	return 0;
   	}
   	int remoteReplicatorState;

   	stream->decode( );
	// decode remore replication daemon state
   	if( ! stream->code( remoteReplicatorState ) ) {
    	dprintf( D_ALWAYS, "ReplicatorStateMachine::decodeVersionAndState "
                           "unable to decode the state\n" );
       	delete newVersion;
       
       	return 0;
   	}
   	newVersion->setState( ReplicatorState( remoteReplicatorState ) );

   	return newVersion;
   	//updateVersionsList( *newVersion );
}
/* Function   : versionRequestingTimer
 * Description: timer, expiration of which means stopping collecting the pool
 *				versions in VERSION_REQUESTING state, passing to
 *				VERSION_DOWNLOADING state and starting downloading from the
 *				machine with the best version
 */
void
ReplicatorStateMachine::versionRequestingTimer( )
{
    dprintf( D_ALWAYS, 
			"ReplicatorStateMachine::versionRequestingTimer started\n" );
    utilCancelTimer(m_versionRequestingTimerId);
    dprintf( D_FULLDEBUG, "ReplicatorStateMachine::versionRequestingTimer "
			"cancelling version requesting timer\n" );
    m_state = VERSION_DOWNLOADING;
    // selecting the best version amongst all the versions that have been sent
    // by other replication daemons
    Version updatedVersion;

    if( replicaSelectionHandler( updatedVersion ) ) {
        download( updatedVersion.getSinfulString( ).Value( ) );
        dprintf( D_FULLDEBUG, "ReplicatorStateMachine::versionRequestingTimer "
				"registering version downloading timer\n" );
        m_versionDownloadingTimerId = daemonCore->Register_Timer( 
			m_maxTransfererLifeTime,
            (TimerHandlercpp) &ReplicatorStateMachine::versionDownloadingTimer,
            "Time to pass to BACKUP state", this );
    } else {
        versionDownloadingTimer( );
    }
}
Exemple #4
0
// =============================================================================
Common::Result Client::handle_command(Protocol::Packet &packet, Common::ByteArray &payload,
                                      uint16_t offset)
{
   Common::Result result = Common::Result::OK;
   CMD cmd               = static_cast<CMD>(packet.message.itf.member);

   switch (cmd)
   {
      case NEW_VERSION_AVAILABLE_CMD /* CHECK_VERSION_CMD */:
      {
         if (packet.message.isCommand())
         {
            Version version;
            uint16_t size = version.unpack(payload, offset);
            /* *INDENT-OFF* */
            HF_ASSERT(size != 0, {result = Common::Result::FAIL_ARG;});
            /* *INDENT-ON* */

            auto code = new_version_available(packet.source, version);

            Protocol::Response response;
            response.code = static_cast<Common::Result>(code);
            Protocol::Message message(packet.message, response.size());
            response.pack(message.payload);

            send(packet.source, message);
         }
Exemple #5
0
void LoadVersionV1(TiXmlElement *verNode, Package *pkg)
{
  const char *name = verNode->Attribute("name");
  if(!name) name = "";

  Version *ver = new Version(name, pkg);
  unique_ptr<Version> ptr(ver);

  const char *author = verNode->Attribute("author");
  if(author) ver->setAuthor(author);

  const char *time = verNode->Attribute("time");
  if(time) ver->setTime(time);

  TiXmlElement *node = verNode->FirstChildElement("source");

  while(node) {
    LoadSourceV1(node, ver);
    node = node->NextSiblingElement("source");
  }

  node = verNode->FirstChildElement("changelog");

  if(node) {
    if(const char *changelog = node->GetText())
      ver->setChangelog(changelog);
  }

  if(pkg->addVersion(ver))
    ptr.release();
}
UpdateCheckerDlg::UpdateCheckerDlg(Update_Status updateStatus, const Version& latestVersion, CWnd* pParent /*=nullptr*/)
    : CDialog(UpdateCheckerDlg::IDD, pParent)
    , m_updateStatus(updateStatus)
{
    switch (updateStatus) {
    case UPDATER_UPDATE_AVAILABLE:
    case UPDATER_UPDATE_AVAILABLE_IGNORED:
        m_text.Format(IDS_NEW_UPDATE_AVAILABLE,
                      latestVersion.ToString(),
                      UpdateChecker::MPC_HC_VERSION.ToString());
        break;
    case UPDATER_LATEST_STABLE:
        m_text.LoadString(IDS_USING_LATEST_STABLE);
        break;
    case UPDATER_NEWER_VERSION:
        m_text.Format(IDS_USING_NEWER_VERSION,
                      UpdateChecker::MPC_HC_VERSION.ToString(),
                      latestVersion.ToString());
        break;
    case UPDATER_ERROR:
        m_text.LoadString(IDS_UPDATE_ERROR);
        break;
    default:
        ASSERT(0); // should never happen
    }
}
Exemple #7
0
Version::Version(const Version &other)
{
    m_major = other.getMajor();
    m_minor = other.getMinor();
    m_mini = other.getMini();
    m_build = other.getBuild();
}
Exemple #8
0
void UpdateChecker::finished(QNetworkReply* reply_){
    if(reply_->error() != QNetworkReply::NoError){
		emit error(reply_->errorString());
    }else{
		Version last = RaptorVersion;
        QDomDocument document;
        if(document.setContent(reply_->readAll())){
            const QDomNodeList entries = document.elementsByTagName("entry");
            
            for(int i = 0; i < entries.count(); i++) {
                const QDomElement element = entries.at(i).toElement();
				QDomNodeList nodes = element.elementsByTagName("title");
   
				for (int i = 0; i < nodes.count(); i++) {
					const QDomElement elem = nodes.at(i).toElement();
					QString filename = elem.firstChild().toText().data().trimmed();
					QRegExp rx("raptor-.*([\\d\\.\\d\\.\\d]{1,}).*");
					if(rx.exactMatch(filename)){
						Version found(rx.cap(1));
						if(last < found)
							last = found;
					}
				}
			}
		}
		emit lastVersion(last.getVersion());
	}
}
bool XmlConfigurationConverter::updateDocument(XmlDocument* document, std::string dtd,
		const Version& version, std::string rootElementName) {

	// update root element name
	XmlElement* root = document->getRootElement();
	if (!root) {
		return false;
	} // if
	root->setName(rootElementName);

	// update version entry in root element
	if (root->hasAttribute("version")) {
		root->getAttribute("version")->setValue(version.toString());
	} // if
	else {
		XmlAttribute* versionAttribute = new XmlAttribute("version", version.toString());
		root->addAttribute(versionAttribute);
	} // else

	// update dtd reference
	XmlDtdReference* dtdRef = document->getDtd();
	if (!dtdRef) {
		dtdRef = new XmlDtdReference(rootElementName, dtd);
		document->setDtd(dtdRef);
	} else {
		dtdRef->setName(rootElementName);
		dtdRef->setDtd(dtd);
	} // else

	return true;
} // updateRootElement
	Bool Version::operator>(const Version& other) const
	{
		const auto shortes = __min(m_parts.size(), other.GetPartsCount());
		for (SizeT i = 0; i < shortes; i++)
		{
			if (m_parts[i] > other[i])
			{
				return True;
			}
			if (m_parts[i] < other[i])
			{
				return False;
			}
		}

		if (other.GetPartsCount() > m_parts.size())
		{
			return False;
		}

		for (SizeT i = shortes; i < m_parts.size(); i++)
		{
			if (m_parts[i] != 0)
			{
				return True;
			}
		}

		return False;
	}
QList<Update *> AppcastMinSysUpdateFilter::filter(const QList<Update *> candidates)
{
    QList<Update *> filtered;
    foreach (Update *candidate, candidates) {
        AppcastUpdate *update = qobject_cast<AppcastUpdate *>(candidate);
        if (update) {
            Version systemVersion = d_ptr->sysVersion;
            Version minSystemVersion(update->minSysVersion());
            
            if (!systemVersion.isValid()) {
                // An unknown system is typically a newer version of the OS than
                // what was available at the time the application was built.
                // Assume compatiblity until proven otherwise.
                filtered.append(candidate);
                continue;
            }
            if (!minSystemVersion.isValid()) {
                // The minimum version was not specified, which means any
                // version is acceptable.
                filtered.append(candidate);
                continue;
            }
            
            if (systemVersion >= minSystemVersion) {
                filtered.append(candidate);
                continue;
            }
        } else {
            // This is not a type understood by this filter.  Let it through so
            // other filters in the chain get a chance to handle it.
            filtered.append(candidate);
            continue;
        }
    }
Exemple #12
0
Version Popt::getVersion(const Package &p, VersionFlag vf, bool versionMustExist) {
	if(_args.empty()) {
		switch(vf) {
			case NO_DEFAULT:
				// No default, skip to the popArg call below which
				// will trigger the appropriate error.
				break;
			case INSTALLED:
				if(p.isInstalled()) {
					return p.getInstalledVersion(); // exists per definition
				}
				break; // Fall through to popArg
			case INSTALLED_OR_CURRENT:
				if(p.isInstalled()) {
					return p.getInstalledVersion(); // exists per definition
				}
				// fall through to next case
			case CURRENT:
				if(p.hasVersions()) {
					return p.getRecentVersion(); // Exists per definition
				}
				break; // Fall through to popArg
			case NONE_NEEDED:
				// Ignores versionMustExist, caller has to handle this,
				// but at least we do not return an invalid version just an empty
				// one, the caller can easily distinct them.
				return Version::EMPTY_VERSION;
		}
	}
	const Version v(popArg("missing version"));
	if(v.isEmptyVersion() || versionMustExist) {
		p.checkVersionExists(v);
	}
	return v;
}
Exemple #13
0
void VersionManager::addVersion_Click(){

    if (askSaveChangeds()){
        currentVersionChanged_ = false;
    } else {
        return;
    }

    bool ok;
    QString name;
    Version *vers = new Version();

    name = QInputDialog::getText(this, tr("Add version"),
                                 tr("Version name:"), QLineEdit::Normal,
                                 "", &ok);
    if (ok && !name.isEmpty()){
        vers->name_ = name;
        while (vers->load()){
            name = QInputDialog::getText(this, tr("Add version"),
                                         tr("Sorry. It seems that the version name already exists.<br>Please choose another version name."), QLineEdit::Normal,
                                         name, &ok);
            if (!ok || name.isEmpty())
                break;

            vers->clear();
            vers->name_ = name;
        }

        if (vers->save()){
            getVersions();
            setVersionFocus(vers->name_);
            currentVersionChanged_ = true;
        }
    }
}
Exemple #14
0
bool Version::TryParse(const StringRef& versionString, Version& outVersion)
{
	outVersion = Version::Zero;
	List<HeapString> parts;
	StringParser::Split(versionString, StringRef("."), parts);

	uint length = (uint)parts.Count();
	RETURN_FALSE_IF(length < 2 || length>4);

	long outMajor;
	if (parts[0].TryParseInt(outMajor))
	{
		outVersion.SetMajor((uint)outMajor);
	}
	else
	{
		return false;
	}

	long outMinor;
	if (parts[1].TryParseInt(outMinor))
	{
		outVersion.SetMinor((uint)outMinor);
	}
	else
	{
		return false;
	}

	length -= 2;
	if (length > 0)
	{
		long outBuild;
		if (parts[2].TryParseInt(outBuild))
		{
			outVersion.SetBuild((uint)outBuild);
		}
		else
		{
			return false;
		}

		--length;
		if (length > 0)
		{
			long outRevision;
			if (parts[3].TryParseInt(outRevision))
			{
				outVersion.SetRevision((uint)outRevision);
			}
			else
			{
				return false;
			}
		}
	}

	return true;
}
Exemple #15
0
void PrefixSettings::txtRunString_Changed(){
    QString run_string = txtRunString->toPlainText().replace("\"", "\\\"");

    QString console_bin = CoreLib->getSetting("console", "bin").toString();
    QString console_args = CoreLib->getSetting("console", "args", false).toString();

    if (console_bin.split("/").last() == "konsole"){
        console_args.append(" /bin/sh -c ");
    }

    run_string.replace("%CONSOLE_BIN%", console_bin);
    run_string.replace("%CONSOLE_ARGS%", QString("%1 \"").arg(console_args));

    Version ver;
    if (!txtWineBin->text().isEmpty()){
        ver.wine_exec_ = txtWineBin->text();
        ver.wine_loader_ = txtWineLoaderBin->text();
        ver.wine_server_ = txtWineServerBin->text();
        ver.wine_dllpath32_ = txtWineLibs->text();
        ver.wine_dllpath64_ = txtWineLibs->text();
    } else {
        ver.clear();
        ver.name_ = comboVersionList->currentText();
        if (!ver.load()){
            QMessageBox::critical(this, tr("Error"), tr("Unable to load version by name: %1").arg(ver.name_));
            return;
        }
    }

    QString env;
    env.append(QString(" WINE='%1' ").arg(ver.wine_exec_));
    env.append(QString(" WINEPREFIX='%1' ").arg(txtPrefixPath->text()));
    env.append(QString(" WINESERVER='%1' ").arg(ver.wine_server_));
    env.append(QString(" WINELOADER='%1' ").arg(ver.wine_loader_));
    if (comboArchList->currentText()=="win64"){
        env.append(QString(" WINEDLLPATH='%1' ").arg(ver.wine_dllpath64_));
    } else if (comboArchList->currentText()=="win32"){
        env.append(QString(" WINEDLLPATH='%1' ").arg(ver.wine_dllpath32_));
    }
    env.append(QString(" WINEARCH='%1' ").arg(comboArchList->currentText()));
    env.append(QString(" WINEDEBUG='%1' ").arg("-all"));
    env.append(QString(" WINEDLLOVERRIDES='' "));
    env.append(QString(" LANG='' "));

    run_string.replace("%ENV_BIN%", CoreLib->getWhichOut("env"));
    run_string.replace("%ENV_ARGS%", env);

    run_string.replace("%WORK_DIR%", QString("cd \'%1\' &&").arg(QDir::homePath()));
    run_string.replace("%SET_NICE%", QString("%1 -n 10").arg(CoreLib->getSetting("system", "nice", false).toString()));

    run_string.replace("%WINE_BIN%", ver.wine_exec_);

    run_string.replace("%VIRTUAL_DESKTOP%", " explorer.exe /desktop=winecfg,800x600 ");
    run_string.replace("%PROGRAM_BIN%", "\'winecfg\'");
    run_string.replace("%PROGRAM_ARGS%", "-h");
    run_string.append(" \"");

    lblTemalate->setText(run_string);
}
Ref<DetectorResult> Detector::processFinderPatternInfo(Ref<FinderPatternInfo> info){
  Ref<FinderPattern> topLeft(info->getTopLeft());
  Ref<FinderPattern> topRight(info->getTopRight());
  Ref<FinderPattern> bottomLeft(info->getBottomLeft());

  float moduleSize = calculateModuleSize(topLeft, topRight, bottomLeft);
  if (moduleSize < 1.0f) {
    throw zxing::ReaderException("bad module size");
  }
  int dimension = computeDimension(topLeft, topRight, bottomLeft, moduleSize);
  Version *provisionalVersion = Version::getProvisionalVersionForDimension(dimension);
  int modulesBetweenFPCenters = provisionalVersion->getDimensionForVersion() - 7;

  Ref<AlignmentPattern> alignmentPattern;
  // Anything above version 1 has an alignment pattern
  if (provisionalVersion->getAlignmentPatternCenters().size() > 0) {


    // Guess where a "bottom right" finder pattern would have been
    float bottomRightX = topRight->getX() - topLeft->getX() + bottomLeft->getX();
    float bottomRightY = topRight->getY() - topLeft->getY() + bottomLeft->getY();


    // Estimate that alignment pattern is closer by 3 modules
    // from "bottom right" to known top left location
    float correctionToTopLeft = 1.0f - 3.0f / (float)modulesBetweenFPCenters;
    int estAlignmentX = (int)(topLeft->getX() + correctionToTopLeft * (bottomRightX - topLeft->getX()));
    int estAlignmentY = (int)(topLeft->getY() + correctionToTopLeft * (bottomRightY - topLeft->getY()));


    // Kind of arbitrary -- expand search radius before giving up
    for (int i = 4; i <= 16; i <<= 1) {
      try {
        alignmentPattern = findAlignmentInRegion(moduleSize, estAlignmentX, estAlignmentY, (float)i);
        break;
      } catch (zxing::ReaderException const& re) {
        (void)re;
        // try next round
      }
    }
    if (alignmentPattern == 0) {
      // Try anyway
    }

  }

  Ref<PerspectiveTransform> transform = createTransform(topLeft, topRight, bottomLeft, alignmentPattern, dimension);
  Ref<BitMatrix> bits(sampleGrid(image_, dimension, transform));
  ArrayRef< Ref<ResultPoint> > points(new Array< Ref<ResultPoint> >(alignmentPattern == 0 ? 3 : 4));
  points[0].reset(bottomLeft);
  points[1].reset(topLeft);
  points[2].reset(topRight);
  if (alignmentPattern != 0) {
    points[3].reset(alignmentPattern);
  }

  Ref<DetectorResult> result(new DetectorResult(bits, points));
  return result;
}
Exemple #17
0
Version::Version(const Version& val)
	:mMajor(val.Major()),
	mMinor(val.Minor()),
	mBuild(val.Build()),
	mRevision(val.Revision())
{

}
Exemple #18
0
int main() {

    // Default pins to low status
    for (int i = 0; i < 5; i++){
        leds[i].output();
        leds[i] = (i & 1) ^ 1;
    }

    //bool sdok= (sd.disk_initialize() == 0);
    sd.disk_initialize();

    Kernel* kernel = new Kernel();

    kernel->streams->printf("Smoothie ( grbl port ) version 0.8.0-rc1 with new accel @%ldMHz\r\n", SystemCoreClock / 1000000);
    Version version;
    kernel->streams->printf("  Build version %s, Build date %s\r\n", version.get_build(), version.get_build_date());

    // Create and add main modules
    kernel->add_module( new Laser() );
    kernel->add_module( new Extruder() );
    kernel->add_module( new SimpleShell() );
    kernel->add_module( new Configurator() );
    kernel->add_module( new CurrentControl() );
    kernel->add_module( new TemperatureControlPool() );
    kernel->add_module( new SwitchPool() );
    kernel->add_module( new PauseButton() );
    kernel->add_module( new PlayLed() );
    kernel->add_module( new Endstops() );
    kernel->add_module( new Player() );
    kernel->add_module( new Panel() );
    kernel->add_module( new Touchprobe() );

    // Create and initialize USB stuff
    u.init();
    //if(sdok) { // only do this if there is an sd disk
    //    msc= new USBMSD(&u, &sd);
    //    kernel->add_module( msc );
    //}

    kernel->add_module( &msc );

    kernel->add_module( &usbserial );
    if( kernel->config->value( second_usb_serial_enable_checksum )->by_default(false)->as_bool() ){
        kernel->add_module( new USBSerial(&u) );
    }
    kernel->add_module( &dfu );
    kernel->add_module( &u );

    // clear up the config cache to save some memory
    kernel->config->config_cache_clear();

    // Main loop
    while(1){
        kernel->call_event(ON_MAIN_LOOP);
        kernel->call_event(ON_IDLE);
    }
}
Exemple #19
0
void PrefixSettings::getVersionsList(){
    comboVersionList->clear();
    Version ver;
    QList<Version> list = ver.load_all();

    for (int i = 0; i < list.size(); ++i)
        comboVersionList->addItem(list.at(i).name_);

    comboVersionList->setCurrentIndex(comboVersionList->findText(version_name));
}
Exemple #20
0
// P. 150
core::ResultCode BlockHeader::restoreFull(ISchema& schema, DWGBuffer& buffer, const Handle& handle, const Version& version) const
{
//  LOG_WARNING(handle.getValue());
  UnicodeString strName = buffer.readText(version);
  bool flag = buffer.readBit();
  int xref = buffer.readBit16() - 1;
  bool xdep = buffer.readBit();
  bool anonymous = buffer.readBit();
  bool hasattr = buffer.readBit();
  bool isxref = buffer.readBit();
  bool isoverlaidxref = buffer.readBit();

  if (version.isAtLeast(Version::R2000))
    bool loadedbit = buffer.readBit();

  if (version.isAtLeast(Version::R2004))
  {
    size_t owned = buffer.readBit32();
  }

  const double baseX = buffer.readBitDouble();
  const double baseY = buffer.readBitDouble();
  const double baseZ = buffer.readBitDouble();
  UnicodeString strPathName = buffer.readText(version);
//  LOG_DEBUG(strName << " - " << strPathName << " [" << baseX << ", " << baseY << ", " << baseZ << "]");

  if (version.isAtLeast(Version::R2000))
  {
    int tot = 0;
    while (true)
    {
      size_t insertcount = buffer.readRaw8(); // TODO: Read until insertcount == 0???
      if (insertcount == 0)
        break;
      ++tot;
    }
    UnicodeString strDescription = buffer.readText(version);
    const uint32_t previewSize = buffer.readBit32();
    buffer.skipBytes(previewSize);

    if (version.isAtLeast(Version::R2007)) {
      const int16_t insertUnits = buffer.readBit16();
      const bool isExplodable = buffer.readBit();
      const char blockScaling = buffer.readRaw8();
      LOG_WARNING(insertUnits << ".. " << isExplodable << " " << blockScaling);
    }

    Handle handleRefs = buffer.readHandle();
//    LOG_WARNING(tot << " " << strDescription << ": " << previewSize);
//    LOG_WARNING(handleRefs.getCode() << ": " << handleRefs.getValue());
  }

  return core::rcSuccess;
}
void VersionsConverterManager::displayTooOldSaveError(Version const &saveVersion)
{
	bool const showVersionDetails = saveVersion.isValid();
	QString const reason = showVersionDetails
			? QObject::tr("This project was created by version %1 of the editor.").arg(saveVersion.toString())
			: QObject::tr("This project was created by too old version of the editor.");

	QString const errorMessage = reason + QObject::tr(" It is now considered outdated and cannot be opened.");

	showError(errorMessage);
}
TEST(VersionTest, Interface) {
  Version V;

  ASSERT_TRUE(V.isNull());
  ASSERT_TRUE(Version(1) < Version(1, 1));
  ASSERT_TRUE(Version(1) < Version(2));
  ASSERT_TRUE(Version(1, 1) < Version(2));
  ASSERT_TRUE(Version(1, 1) == Version(1, 1));
  ASSERT_EQ(Version(1).getMajor(), unsigned(1));
  ASSERT_EQ(Version(1).getMinor(), unsigned(0));
  ASSERT_EQ(Version(1, 2).getMinor(), unsigned(2));
}
Exemple #23
0
static std::vector<MSVC> installedCompilers()
{
    std::vector<MSVC> msvcs;
    std::vector<MSVCInstallInfo> installInfos = installedMSVCsFromVsWhere();
    if (installInfos.empty())
        installInfos = installedMSVCsFromRegistry();
    for (const MSVCInstallInfo &installInfo : installInfos) {
        MSVC msvc;
        msvc.internalVsVersion = Version::fromString(installInfo.version, true);
        if (!msvc.internalVsVersion.isValid())
            continue;

        QDir vsInstallDir(installInfo.installDir);
        msvc.vsInstallPath = vsInstallDir.absolutePath();
        if (vsInstallDir.dirName() != QStringLiteral("VC")
                && !vsInstallDir.cd(QStringLiteral("VC"))) {
            continue;
        }

        msvc.version = QString::number(Internal::VisualStudioVersionInfo(
            msvc.internalVsVersion).marketingVersion());
        if (msvc.version.isEmpty()) {
            qbsWarning() << Tr::tr("Unknown MSVC version %1 found.").arg(installInfo.version);
            continue;
        }

        if (msvc.internalVsVersion.majorVersion() < 15) {
            QDir vcInstallDir = vsInstallDir;
            if (!vcInstallDir.cd(QStringLiteral("bin")))
                continue;
            msvc.vcInstallPath = vcInstallDir.absolutePath();
            msvcs.push_back(msvc);
        } else {
            QDir vcInstallDir = vsInstallDir;
            vcInstallDir.cd(QStringLiteral("Tools/MSVC"));
            const auto vcVersionStrs = vcInstallDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
            for (const QString &vcVersionStr : vcVersionStrs) {
                const Version vcVersion = Version::fromString(vcVersionStr);
                if (!vcVersion.isValid())
                    continue;
                QDir specificVcInstallDir = vcInstallDir;
                if (!specificVcInstallDir.cd(vcVersionStr)
                    || !specificVcInstallDir.cd(QStringLiteral("bin"))) {
                    continue;
                }
                msvc.vcInstallPath = specificVcInstallDir.absolutePath();
                msvcs.push_back(msvc);
            }
        }
    }
    return msvcs;
}
int main(int, char * [])
{
    // enlist all versions

    std::cout << std::endl << std::endl << "[VERSIONS]" << std::endl << std::endl;

    std::cout << "# Versions: " << Meta::versions().size() << std::endl << std::endl;

    for (Version v : Meta::versions())
        std::cout << v.toString() << std::endl;

    // enlist all enums

    std::cout << std::endl << std::endl << "[ENUMS]" << std::endl << std::endl;

    if (Meta::stringsByGL())
    {
        std::cout << "# Enums: " << Meta::enums().size() << std::endl << std::endl;

        for (GLenum e : Meta::enums()) // c++ 14 ...
            std::cout << " (" << std::hex << std::showbase << std::internal << std::setfill('0') << std::setw(8) 
                << static_cast<std::underlying_type<GLenum>::type>(e) << ") " << Meta::getString(e) << std::dec << std::endl;

        std::cout << std::dec;
    }
    else
        std::cout << std::endl << "warning: Enums cannot be enlisted since the glbinding used was compiled without GL_BY_STRINGS support." << std::endl;

    // enlist all extensions

    std::cout << std::endl << std::endl << "[EXTENSIONS]" << std::endl << std::endl;

    if (Meta::stringsByGL())
    {
        std::cout << " # Extensions: " << Meta::extensions().size() << std::endl << std::endl;

        for (GLextension e : Meta::extensions())
        {
            const Version v = Meta::getRequiringVersion(e);
            std::cout << " " << Meta::getString(e) << " " << (v.isNull() ? "" : v.toString()) << std::endl;
        }
    }
    else
        std::cout << std::endl << "warning: EXTENSIONS cannot be enlisted since the glbinding used was compiled without GL_BY_STRINGS support." << std::endl;

    // print some gl infos (query)

    std::cout << std::endl
        << "OpenGL Revision: " << Meta::glRevision() << " (gl.xml)" << std::endl << std::endl;

    return 0;
}
Exemple #25
0
StlExport::StlExport(const QUrl &baseUrl, const Version &version, QObject *parent) :
  QObject(parent),
  _manager(new QNetworkAccessManager()),
  _manager2(new QNetworkAccessManager()),
  _messageName("finfoil"),
  _versionSuffix("_v" + QString::number(version.Major()) + "."
                 + QString::number(version.Minor()) + "."
                 + QString::number(version.Revision())),
  _baseUrl(baseUrl)
{
    _messageName.append(_versionSuffix);
    _messageName.append(".html");
}
void
AbstractReplicatorStateMachine::cancelVersionsListLeader( )
{
    Version* version;
    
    m_versionsList.Rewind( );

    while( m_versionsList.Next( version ) ) {
        version->setState( BACKUP );
    }
    
    m_versionsList.Rewind( );
}
Exemple #27
0
 bool CheckVersionDiff()
 {
     bool diff = false;
     if(HasConnection())
     {
         std::string js = RetrieveContent("https://api.github.com/repos/xortroll/goldleaf/releases", "application/json");
         json j = json::parse(js);
         std::string latestid = j[0]["tag_name"].get<std::string>();
         Version latestv = Version::FromString(latestid);
         Version currentv = Version::FromString("0.3");
         diff = latestv.IsLower(currentv);
     }
     return diff;
 }
Exemple #28
0
UpdateDialog::UpdateDialog(QWidget *parent, const Version &local,
			const Version &remote) : QDialog(parent),
	ui(new Ui::UpdateDialog) {
	ui->setupUi(this);
	m_remoteVersion = remote.toString().c_str();
    ui->versionLabel->setText(QApplication::translate("UpdateDialog",
			"Version %1 has been released (you are using %2). Would you like to visit the download page?",
			0, QApplication::UnicodeUTF8).arg(m_remoteVersion).arg(local.toString().c_str()));
	ui->changeView->setHtml("Loading change log ..");
	m_networkManager = new QNetworkAccessManager(this);
	connect(m_networkManager, SIGNAL(finished(QNetworkReply *)),
			this, SLOT(onNetworkFinished(QNetworkReply *)));
	m_networkReply = m_networkManager->get(QNetworkRequest(QUrl("http://www.mitsuba-renderer.org/changelog.html")));
}
Exemple #29
0
Version Application::lastVersion() {
    if (m_versions.size() < 1)
        throw NoVersions();

    std::map<std::string, Version>::iterator itr = m_versions.begin();
    Version lastVer = itr->second;

    while (itr != m_versions.end()) {
        if (itr->second.version() > lastVer.version())
            lastVer = itr->second;
        itr++;
    }

    return lastVer;
}
Exemple #30
0
// print out build version
void SimpleShell::version_command( string parameters, StreamOutput *stream)
{
    Version vers;
    uint32_t dev = getDeviceType();
    const char *mcu = (dev & 0x00100000) ? "LPC1769" : "LPC1768";
    stream->printf("Build version: %s, Build date: %s, MCU: %s, System Clock: %ldMHz\r\n", vers.get_build(), vers.get_build_date(), mcu, SystemCoreClock / 1000000);
}