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(); }
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(); } }