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;
        }
    }
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);
}
Example #3
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;
}
Example #4
0
bool Version::operator > (const Version &compareTo) const
{
    Q_ASSERT(isValid());
    Q_ASSERT(compareTo.isValid());

    if (m_major > compareTo.m_major)
        return true;
    if (m_major < compareTo.m_major)
        return false;
    if (m_minor > compareTo.m_minor)
        return true;
    if (m_minor < compareTo.m_minor)
        return false;
    return m_fix > compareTo.m_fix;
}
bool SunJVMLauncher::run(ResourceManager& resource, const string& origin, bool justInstanciate)
{
    DEBUG("Running now " + this->toString() + ", instanciate=" + (justInstanciate?"yes":"no"));

    Version max(resource.getProperty(ResourceManager:: KEY_MAXVERSION));
    Version min(resource.getProperty(ResourceManager:: KEY_MINVERSION));

    // patch proposed by zregvart: if you're using bundeled JVM, you
    // apriori know the version bundled and we can trust. The version
    // check is therefore unrequired.
    if (origin != "bundled") {

        if (VmVersion.isValid() == false)
        {
            DEBUG("No version identified for " + toString());
            SunJVMExe exe(this->JavaHome);
            VmVersion = exe.guessVersion();
            DEBUG("Version found: " + VmVersion.toString());
        }

        if (VmVersion.isValid() == false)
        {
            DEBUG("No version found, can't instanciate DLL without it");
            return false;
        }

        if (min.isValid() && (VmVersion < min))
            return false;

        if (max.isValid() && (max < VmVersion))
            return false;
    }

    DEBUG("Launching " + toString());

    //
    // search for the dll if it's not set in the registry, or if the
    // file doesn't exist
    //
    if ( (this->JavaHome.size()>0)
            && ((this->RuntimeLibPath.size() == 0) || (!FileUtils::fileExists(this->RuntimeLibPath))) )
    {
        std::string assump = FileUtils::concFile(this->JavaHome, "jre\\bin\\jvm.dll");
        std::string assump2 = FileUtils::concFile(this->JavaHome, "jre\\bin\\server\\jvm.dll"); // for JRE 1.5+
        std::string assump3 = FileUtils::concFile(this->JavaHome, "jre\\bin\\client\\jvm.dll"); // for JRE 1.5+
        std::string assump4 = FileUtils::concFile(this->JavaHome, "bin\\javai.dll"); // For JRE 1.1

        if (FileUtils::fileExists(assump))
            this->RuntimeLibPath = assump;
        else if (FileUtils::fileExists(assump2))
            this->RuntimeLibPath = assump2;
        else if (FileUtils::fileExists(assump3))
            this->RuntimeLibPath = assump3;
        else if (FileUtils::fileExists(assump4))
            this->RuntimeLibPath = assump4;
        else
        {
            vector<string> dlls = FileUtils::recursiveSearch(this->JavaHome, string("jvm.dll"));
            if (dlls.size() > 0)
                this->RuntimeLibPath = dlls[0];
        }
    }

    if (FileUtils::fileExists(this->RuntimeLibPath))
    {
        DEBUG("RuntimeLibPath used: " + this->RuntimeLibPath);
        Version v = this->VmVersion;
        if (!v.isValid())
        {
            v = min;
            if (!v.isValid())
                v = Version("1.2.0");
            DEBUG("No version, trying with " + v.toString());
        }

        m_dllrunner = new SunJVMDLL(this->RuntimeLibPath, v);
        // set up the vm parameters...
        setupVM(resource, m_dllrunner);

        if (justInstanciate)
            return m_dllrunner->instanciate();
        else
            return m_dllrunner->run(resource.getProperty(ResourceManager::KEY_MAINCLASSNAME),
                                    true);
    }

    return false;
}