void QMathMLFileViewer::readSettings( QSettings& settings )
{
	QString path = settings.value("FmlIde/mmlfileviewer/dir", QVariant(QDir::currentPath())).toString();
	changeDir( path );
	//if( m_dirTree )
	//	m_dirTree->setCurrentIndex( m_dirModel.index( m_currentDir.absolutePath() ) );
	setRecursive(settings.value("FmlIde/mmlfileviewer/recursive", QVariant(true)).toBool());
	if( btnRecursive ) btnRecursive->setChecked( isRecursive() );
}
示例#2
0
void Tree::lookupAndSetTypeDefinitionInCurrentTree(
    Type* type,
    const NameBindings& scope,
    const Location& location) {

    auto definition = scope.lookupType(type->getName());
    if (definition == nullptr) {
        Trace::error("Unknown type: " + type->getName(), location);
    }

    type->setDefinition(definition);

    auto classDefinition = definition->dynCast<ClassDefinition>();
    if (classDefinition != nullptr && classDefinition == getCurrentClass()) {
        classDefinition->setRecursive(true);
    }

    if (type->isFunction()) {
        auto signature = type->getFunctionSignature();
        lookupAndSetTypeDefinitionInCurrentTree(signature->getReturnType(),
                                                scope,
                                                location);
        for (auto argumentType: signature->getArguments()) {
            lookupAndSetTypeDefinitionInCurrentTree(argumentType,
                                                    scope,
                                                    location);
        }
    }

    if (type->hasGenericTypeParameters()) {
        // The type has generic type parameters. This means the type must refer
        // to a generic class.
        if (classDefinition == nullptr) {
            Trace::error("Only classes can take type parameters: " +
                          type->getName(),
                          location);
        }

        if (!classDefinition->isGeneric()) {
            Trace::error("Only generic classes can take type parameters: " +
                          type->getName(),
                          location);
        }

        for (auto typeParameter: type->getGenericTypeParameters()) {
            lookupAndSetTypeDefinitionInCurrentTree(typeParameter,
                                                    scope,
                                                    location);
        }
    }
}
示例#3
0
ISSOptions::ISSOptions(int argc, char* argv[]) :
	recursive(false),
	verbose(false),
	speed(5),
	fullscreen(false)
{
	int c;
	int digit_optind = 0;

	enum long_options_enum
	{
		OPT_PATH = 1,
		OPT_RECURSIVE,
		OPT_VERBOSE,
		OPT_SPEED,
		OPT_FULLSCREEN
	};

	while (1) {
		int this_option_optind = optind ? optind : 1;
		int option_index = 0;
		static struct option long_options[] = {
			{"path",       required_argument, 0,  OPT_PATH },
			{"recursive",  no_argument,       0,  OPT_RECURSIVE },
			{"verbose",    no_argument,       0,  OPT_VERBOSE },
			{"speed",      required_argument, 0,  OPT_SPEED },
			{"fullscreen", no_argument,       0,  OPT_FULLSCREEN },
			{0,            0,                 0,  0 }
		};

		c = getopt_long(argc, argv, "p:rvs:f",
						long_options, &option_index);
		if (c == -1)
			break;

		switch (c) {
			case 'v':
			case OPT_VERBOSE:
				printf("Verbose\n");
				setVerbose(true);
				break;

			case 'p':
			case OPT_PATH:
				printf("Path: '%s'\n", optarg);
				setPath(optarg);
				break;

			case 'r':
			case OPT_RECURSIVE:
				printf("Recursive\n");
				setRecursive(true);
				break;

			case 's':
			case OPT_SPEED:
				printf("Speed: '%s'\n", optarg);
				setSpeed(atoi(optarg));
				break;

			case 'f':
			case OPT_FULLSCREEN:
				printf("Fullscreen\n");
				setFullscreen(true);
				break;

			default:
				fprintf(stderr, "Error parsing arguments!\n");
				return;
		}
	}

	if (optind < argc) {
		printf("non-option ARGV-elements: ");
		while (optind < argc)
			printf("%s ", argv[optind++]);
			printf("\n");
	}
}