Ejemplo n.º 1
0
DFFWidget::DFFWidget(DisplayedFile* dfile, QWidget* parent)
		: QWidget(parent), dfile(dfile), mesh(NULL), frameModel(NULL), geomModel(NULL), texSource(NULL),
		  currentGeom(NULL), currentGeomPart(NULL), currentMaterial(NULL), currentTexture(NULL)
{
	ui.setupUi(this);

	File file = dfile->getFile();

	renderContainerWidget = new GLContainerWidget(ui.renderContainerWidget);
	renderContainerWidget->setWindowTitle(tr("%1 - DFF Rendering")
			.arg(file.getPath().getFileName().get()));
	ui.renderContainerWidget->layout()->addWidget(renderContainerWidget);
	renderWidget = new DFFRenderWidget(renderContainerWidget);
	renderContainerWidget->setGLWidget(renderWidget);

	updateLayoutType();

	reloadHighLevelFile();

	System* sys = System::getInstance();
	DFFGUIModule* guiModule = DFFGUIModule::getInstance();
	sys->installGUIModule(guiModule);

	connect(ui.editTexSrcButton, SIGNAL(pressed()), this, SLOT(texSrcEditRequested()));
	connect(ui.texSourceBox, SIGNAL(currentIndexChanged(int)), this, SLOT(texSrcChanged(int)));

	connect(ui.materialList, SIGNAL(currentRowChanged(int)), this, SLOT(materialSelected(int)));
	connect(ui.textureList, SIGNAL(currentRowChanged(int)), this, SLOT(textureSelected(int)));

	connect(ui.geometryFrameLabel, SIGNAL(linkActivated(const QString&)), this,
			SLOT(geometryFrameLinkActivated(const QString&)));
	connect(ui.geometryPartMaterialLabel, SIGNAL(linkActivated(const QString&)), this,
			SLOT(geometryPartMaterialLinkActivated(const QString&)));

	connect(ui.textureOpenButton, SIGNAL(pressed()), this, SLOT(textureOpenRequested()));


	connect(guiModule, SIGNAL(dumpRequested()), this, SLOT(xmlDumpRequested()));
	connect(System::getInstance(), SIGNAL(configurationChanged()), this, SLOT(updateLayoutType()));

	connect(dfile, SIGNAL(saved()), this, SLOT(reloadHighLevelFile()));
}
Ejemplo n.º 2
0
Error Arguments::parse(const char* args) {
    if (args == NULL) {
        return Error::OK;
    } else if (strlen(args) >= sizeof(_buf)) {
        return Error("Argument list too long");
    }

    strcpy(_buf, args);

    for (char* arg = strtok(_buf, ","); arg != NULL; arg = strtok(NULL, ",")) {
        char* value = strchr(arg, '=');
        if (value != NULL) *value++ = 0;

        if (strcmp(arg, "start") == 0) {
            _action = ACTION_START;
        } else if (strcmp(arg, "stop") == 0) {
            _action = ACTION_STOP;
        } else if (strcmp(arg, "status") == 0) {
            _action = ACTION_STATUS;
        } else if (strcmp(arg, "list") == 0) {
            _action = ACTION_LIST;
        } else if (strcmp(arg, "event") == 0) {
            if (value == NULL || value[0] == 0) {
                return Error("event must not be empty");
            }
            _event = value;
        } else if (strcmp(arg, "collapsed") == 0 || strcmp(arg, "folded") == 0) {
            _dump_collapsed = true;
            _counter = value == NULL || strcmp(value, "samples") == 0 ? COUNTER_SAMPLES : COUNTER_TOTAL;
        } else if (strcmp(arg, "flamegraph") == 0 || strcmp(arg, "svg") == 0) {
            _dump_flamegraph = true;
            _counter = value == NULL || strcmp(value, "samples") == 0 ? COUNTER_SAMPLES : COUNTER_TOTAL;
        } else if (strcmp(arg, "summary") == 0) {
            _dump_summary = true;
        } else if (strcmp(arg, "traces") == 0) {
            _dump_traces = value == NULL ? INT_MAX : atoi(value);
        } else if (strcmp(arg, "flat") == 0) {
            _dump_flat = value == NULL ? INT_MAX : atoi(value);
        } else if (strcmp(arg, "interval") == 0) {
            if (value == NULL || (_interval = atol(value)) <= 0) {
                return Error("interval must be > 0");
            }
        } else if (strcmp(arg, "framebuf") == 0) {
            if (value == NULL || (_framebuf = atoi(value)) <= 0) {
                return Error("framebuf must be > 0");
            }
        } else if (strcmp(arg, "threads") == 0) {
            _threads = true;
        } else if (strcmp(arg, "simple") == 0) {
            _simple = true;
        } else if (strcmp(arg, "title") == 0 && value != NULL) {
            _title = value;
        } else if (strcmp(arg, "width") == 0 && value != NULL) {
            _width = atoi(value);
        } else if (strcmp(arg, "height") == 0 && value != NULL) {
            _height = atoi(value);
        } else if (strcmp(arg, "minwidth") == 0 && value != NULL) {
            _minwidth = atof(value);
        } else if (strcmp(arg, "reverse") == 0) {
            _reverse = true;
        } else if (strcmp(arg, "file") == 0) {
            if (value == NULL || value[0] == 0) {
                return Error("file must not be empty");
            }
            _file = value;
        }
    }

    if (dumpRequested() && (_action == ACTION_NONE || _action == ACTION_STOP)) {
        _action = ACTION_DUMP;
    }

    return Error::OK;
}