Ejemplo n.º 1
0
void TMacroFx::compatibilityTranslatePort(int major, int minor, std::string &portName)
{
	// Reroute translation to the actual fx associated to the port
	const std::string &fxId = portName.substr(portName.find_last_of('_') + 1,
											  std::string::npos);

	if (TFx *fx = getFxById(toWideString(fxId))) {
		size_t opnEnd = portName.find_first_of('_');

		std::string originalPortName = portName.substr(0, opnEnd);
		fx->compatibilityTranslatePort(major, minor, originalPortName);

		portName.replace(0, opnEnd, originalPortName);
	}

	// Seems that at a certain point, the port name got extended...
	if (VersionNumber(major, minor) == VersionNumber(1, 16)) {
		for (int i = 0; i < getInputPortCount(); ++i) {
			const std::string &name = getInputPortName(i);
			if (name.find(portName) != string::npos) {
				portName = name;
				break;
			}
		}
	}
}
Ejemplo n.º 2
0
bool
ExtensionDefinition::isValid() const
{
    // Somewhat delispious, though still not complete validity check.
    return (Definition::isValid()
            // Extensions without a maintainer are invalid
            &&  this->maintainers().count() > 0
            // Unlicensed extensions are invalid
            && !this->licenseName().isEmpty()
            // Licensing is mostly useless without an author
            &&  this->authors().count() > 0
            &&  this->apiVersion() > VersionNumber(0, 0))
        && (! (
                // Extensions without streams must not use these lists
                this->inputTransports().count()
                || this->inputFormats().count()
                || this->outputTransports().count()
                || this->outputFormats().count())
            || (
                // Extensions with streams must use all of them
                this->inputTransports().count()
                && this->inputFormats().count()
                && this->outputTransports().count()
                && this->outputFormats().count()));
}
Ejemplo n.º 3
0
void Iwa_TiledParticlesFx::compatibilityTranslatePort(int major, int minor, std::string &portName)
{
	VersionNumber version(major, minor);

	if (version < VersionNumber(1, 16)) {
		if (portName == "Texture")
			portName = "Texture1";
	} else if (version < VersionNumber(1, 20)) {
		int idx;

		bool chop =
			((idx = portName.find("Texture")) != std::string::npos && idx > 0) ||
			((idx = portName.find("Control")) != std::string::npos && idx > 0);

		if (chop)
			portName.erase(portName.begin(), portName.begin() + idx);
	}
}
void TStageObjectSpline::loadData(TIStream &is) {
  std::vector<TThickPoint> points;
  VersionNumber tnzVersion = is.getVersion();
  if (tnzVersion < VersionNumber(1, 16)) {
    while (!is.eos()) {
      TThickPoint p;
      is >> p.x >> p.y >> p.thick;
      points.push_back(p);
    }
  } else {
/**
 * Sets in motion the communication necessary to ensure that only one instance
 * survives.
 * @returns true if a single instance is assured, false if it was not possible
 *          to enforce the policy
 */
bool InstanceManager::ensureSingleInstance(ResolutionScheme scheme)
{
  // If the server exists, it's because we're already the dominant instance
  if (mServer) {
    return true;
  }

  QLocalSocket socket;
  socket.connectToServer(mKey);
  if (!socket.waitForConnected(10000)) {
    // No remote server? Let's try starting our own.
    startServer();
    return false;
  }

  switch (scheme) {
    case ThisInstanceWins:
      tellServerToQuit(&socket);
      break;

    case HighestVersionWins:
    default:
      QTextStream stream(&socket);
      stream << "version\n";
      stream.flush();
      socket.waitForReadyRead();
      QString remoteVersion = stream.readLine();

      if (VersionNumber(remoteVersion) < VersionNumber(APP_VERSION)) {
        tellServerToQuit(&socket);
        startServer();
      } else {
        QTimer::singleShot(0, qApp, SLOT(quit()));
      }
      break;
  }

  socket.disconnectFromServer();
  socket.waitForDisconnected();

  return true;
}
Ejemplo n.º 6
0
void OwnCloudService::checkAppInfo(QNetworkReply *reply) {
    QString data = QString(reply->readAll());
    // qDebug() << data;

    // we have to add [], so the string can be parsed as JSON
    data = QString("[") + data + QString("]");

    QJSEngine engine;
    QJSValue result = engine.evaluate(data);

    bool appIsValid = result.property(0).property("versioning").toBool();
    QString appVersion = result.property(0).property("app_version")
            .toVariant().toString();
    QString serverVersion = result.property(0).property("server_version")
            .toVariant().toString();

    // reset to "unknown" in case we can't test if versions
    // and trash app are enabled
    settingsDialog->setOKLabelData(6, "unknown", SettingsDialog::Unknown);
    settingsDialog->setOKLabelData(7, "unknown", SettingsDialog::Unknown);

    if (serverVersion != "") {
        VersionNumber serverAppVersion = VersionNumber(appVersion);
        VersionNumber minAppVersion = VersionNumber(QOWNNOTESAPI_MIN_VERSION);

        if (minAppVersion > serverAppVersion) {
            settingsDialog->setOKLabelData(4,
                                           "version " + appVersion + " too low",
                                           SettingsDialog::Warning);
        } else {
            settingsDialog->setOKLabelData(4, "ok", SettingsDialog::OK);
        }

        // check if versions and trash app are enabled after QOwnNotesAPI v0.3.1
        if (serverAppVersion >= VersionNumber("0.3.1")) {
            bool versionsAppEnabled = result.property(0).property(
                    "versions_app").toBool();
            bool trashAppEnabled = result.property(0).property(
                    "trash_app").toBool();

            if (versionsAppEnabled) {
                settingsDialog->setOKLabelData(6, "ok", SettingsDialog::OK);
            } else {
                settingsDialog->setOKLabelData(6, "not enabled",
                                               SettingsDialog::Failure);
            }

            if (trashAppEnabled) {
                settingsDialog->setOKLabelData(7, "ok", SettingsDialog::OK);
            } else {
                settingsDialog->setOKLabelData(7, "not enabled",
                                               SettingsDialog::Failure);
            }
        }

        // check if notes path was found after QOwnNotesAPI v0.4.
        if (serverAppVersion >= VersionNumber("0.4.1")) {
            bool notesPathExists = result.property(0).property(
                    "notes_path_exists").toBool();

            if (notesPathExists) {
                settingsDialog->setOKLabelData(8, "ok", SettingsDialog::OK);
            } else {
                settingsDialog->setOKLabelData(8, "not found",
                                               SettingsDialog::Failure);
            }
        }
    } else {
        settingsDialog->setOKLabelData(4, "not connected",
                                       SettingsDialog::Failure);
    }

    // call callback in settings dialog
    settingsDialog->connectTestCallback(appIsValid, appVersion, serverVersion,
                                        reply->errorString());
}
Ejemplo n.º 7
0
	<< endl;
  va_end (arglist);
  throw (1);
}

/* _________________________________________________________________________

   MakeUtility::ShowVersion
   _________________________________________________________________________ */

void
MakeUtility::ShowVersion ()
{
  OUT__ << Utils::MakeProgramVersionString(Utils::GetExeName().c_str(),
					   VersionNumber(MIKTEX_MAJOR_VERSION,
							 MIKTEX_MINOR_VERSION,
							 MIKTEX_COMP_J2000_VERSION,
							 0))
	<< T_("\n\
Copyright (C) 1998-2009 Christian Schenk\n\
This is free software; see the source for copying conditions.  There is NO\n\
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.")
	<< endl;
}

/* _________________________________________________________________________

   MakeUtility::Verbose
   _________________________________________________________________________ */

void
MakeUtility::Verbose (/*[in]*/ const char *	lpszFormat,