示例#1
0
void App::closeEvent(QCloseEvent* e)
{
    /* Accept the close event by default */
    e->accept();

    QListIterator <QMdiSubWindow*> it(
        qobject_cast<QMdiArea*> (centralWidget())->subWindowList());
    while (it.hasNext() == true)
    {
        QLCFixtureEditor* editor;
        QMdiSubWindow* sub;

        sub = it.next();
        Q_ASSERT(sub != NULL);

        editor = static_cast<QLCFixtureEditor*> (sub->widget());
        Q_ASSERT(editor != NULL);

        editor->show();
        editor->setFocus();

        if (editor->close() == false)
        {
            /* Ignore the close event if just one editor refuses */
            e->ignore();
            break;
        }
    }
}
示例#2
0
void App::loadFixtureDefinition(const QString& path)
{
    QLCFixtureDef* fixtureDef = NULL;

    /* Attempt to create a fixture definition from the selected file */
    QString error(tr("Unrecognized file extension: %1").arg(path));
    if (path.toLower().endsWith(KExtFixture) == true)
        fixtureDef = loadQXF(path, error);
    else if (path.toLower().endsWith(KExtAvolitesFixture) == true)
        fixtureDef = loadD4(path, error);
    else
        fixtureDef = NULL;

    if (fixtureDef != NULL)
    {
        /* Create a new sub window and put a fixture editor widget
           in that sub window with the newly-created fixture def */
        QMdiSubWindow* sub = new QMdiSubWindow(centralWidget());
        QLCFixtureEditor* 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
    {
        QMessageBox::warning(this, tr("Fixture loading failed"),
                             tr("Unable to load fixture definition: ") + error);
    }
}
示例#3
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));
	}
}
示例#4
0
文件: app.cpp 项目: speakman/qlc
void App::slotFileNew()
{
	QLCFixtureDef* fixtureDef = new QLCFixtureDef();

	QLCFixtureEditor* editor = new QLCFixtureEditor(m_workspace, fixtureDef);
	connect(editor, SIGNAL(closed(QLCFixtureEditor*)),
		this, SLOT(slotEditorClosed(QLCFixtureEditor*)));
	editor->init();
	editor->show();
}
示例#5
0
void App::slotFileNew()
{
    QLCFixtureEditor* editor;
    QMdiSubWindow* sub;

    sub = new QMdiSubWindow(centralWidget());
    editor = new QLCFixtureEditor(sub, new QLCFixtureDef());

    sub->setWidget(editor);
    sub->setAttribute(Qt::WA_DeleteOnClose);
    sub->setWindowIcon(QIcon(":/fixture.png"));

    qobject_cast<QMdiArea*> (centralWidget())->addSubWindow(sub);

    editor->show();
    sub->show();
}
示例#6
0
文件: app.cpp 项目: speakman/qlc
void App::slotFileOpen()
{
	QLCFixtureEditor* editor = NULL;
	QLCFixtureDef* fixtureDef = NULL;
	QString path;

	path = QFileDialog::getOpenFileName(m_lastPath, KFixtureFilter, this);

	// Save the last path so that the next file dialog starts from
	// the same place, unless the path is empty
	if (path == QString::null)
		return;
	else
		m_lastPath = path;
	
	if (path.right(strlen(KExtFixture)) == KExtFixture)
	{
		fixtureDef = new QLCFixtureDef(path);
	}
	else if (path.right(strlen(KExtLegacyDeviceClass)) 
		 == KExtLegacyDeviceClass)
	{
		/* Open as an old DC but convert it to a QLCFixture */
		DeviceClass* dc = openLegacyFile(path);
		fixtureDef = new QLCFixtureDef(dc);
		delete dc;
	}

	if (fixtureDef == NULL)
	{
		QMessageBox::warning(this, "Fixture loading failed",
				     "File didn't contain a valid fixture.");
	}
	else
	{
		editor = new QLCFixtureEditor(m_workspace, fixtureDef);
		editor->setFileName(path);
		
		connect(editor, SIGNAL(closed(QLCFixtureEditor*)),
			this, SLOT(slotEditorClosed(QLCFixtureEditor*)));

		editor->init();
		editor->show();
	}
}
示例#7
0
文件: app.cpp 项目: speakman/qlc
//
// File -> Exit or Window destroyed
//
void App::closeEvent(QCloseEvent* e)
{
	QLCFixtureEditor* editor = NULL;

	e->accept();

	QWidgetList wl = workspace()->windowList();
	for (unsigned int i = 0; i < wl.count(); i++)
	{
		editor = static_cast<QLCFixtureEditor*> (wl.at(i));
		assert(editor);

		editor->show();
		editor->setFocus();
		if ( !editor->close() )
		{
			e->ignore();
		}
	}
}