Exemple #1
0
void App::loadFixtureDefinition(const QString& path)
{
	/* Attempt to create a fixture definition from the selected file */
	QLCFixtureDef* fixtureDef = new QLCFixtureDef();
	QFile::FileError error = fixtureDef->loadXML(path);
	if (error == QFile::NoError)
	{
		QLCFixtureEditor* editor;
		QMdiSubWindow* sub;

		/* Create a new sub window and put a fixture editor widget
		   in that sub window with the newly-created fixture def */
		sub = new QMdiSubWindow(centralWidget());
		editor = new QLCFixtureEditor(sub, fixtureDef, path);

		sub->setWidget(editor);
		sub->setAttribute(Qt::WA_DeleteOnClose);
		qobject_cast<QMdiArea*> (centralWidget())->addSubWindow(sub);

		editor->show();
		sub->show();
	}
	else
	{
		delete fixtureDef;
		QMessageBox::warning(this, tr("Fixture loading failed"),
			tr("Unable to load fixture definition: ") +
			QLCFile::errorString(error));
	}
}
Exemple #2
0
QLCFixtureDef* App::loadQXF(const QString& path, QString& errorMsg) const
{
    QLCFixtureDef* fixtureDef = new QLCFixtureDef;
    Q_ASSERT(fixtureDef != NULL);

    QFile::FileError error = fixtureDef->loadXML(path);
    if (error != QFile::NoError)
    {
        delete fixtureDef;
        fixtureDef = NULL;
        errorMsg = QLCFile::errorString(error);
    }

    return fixtureDef;
}
bool QLCFixtureDefCache::loadQXF(const QString& path)
{
    QLCFixtureDef *fxi = new QLCFixtureDef();
    Q_ASSERT(fxi != NULL);

    QFile::FileError error = fxi->loadXML(path);
    if (error == QFile::NoError)
    {
        /* Delete the def if it's a duplicate. */
        if (addFixtureDef(fxi) == false)
            delete fxi;
        fxi = NULL;
    }
    else
    {
        qWarning() << Q_FUNC_INFO << "Fixture definition loading from"
                   << path << "failed:" << QLCFile::errorString(error);
        delete fxi;
        fxi = NULL;
        return false;
    }
    return true;
}