/** * @brief InfoManager::addProject Create project in this manager * @param name Name of the project * @param baseDir Path to given project * @return Return false if manager contains this project, true otherwise */ bool InfoManager::addProject(QString name, QDir baseDir) { if(projects.contains(name)) return false; MetaProject* proj = new MetaProject(name, baseDir); projects[name] = proj; emit projectCreated(name); if(activeProject.isEmpty()) setActiveProject(name); connect(proj,SIGNAL(shaderCreated(QString)),this,SLOT(projectChanged(QString))); connect(proj,SIGNAL(shaderDestroyed(QString,MetaShader::SHADERTYPE)),this,SLOT(projectChanged(QString))); connect(proj,SIGNAL(shProgCreated(QString)),this,SLOT(projectChanged(QString))); connect(proj,SIGNAL(shaderDestroyed(QString,MetaShader::SHADERTYPE)),this,SLOT(projectChanged(QString))); connect(proj,SIGNAL(textureCreated(QString)),this,SLOT(projectChanged(QString))); connect(proj,SIGNAL(textureDestroyed(QString)),this,SLOT(projectChanged(QString))); connect(proj,SIGNAL(uniformCreated(QString)),this,SLOT(projectChanged(QString))); connect(proj,SIGNAL(uniformDestroyed(QString)),this,SLOT(projectChanged(QString))); connect(proj,SIGNAL(modelLoaded()),this,SLOT(projectChanged())); return true; }
PICComponent::PICComponent( ICNDocument *icnDocument, bool newItem, const char *id ) : Component( icnDocument, newItem, id ? id : "pic" ) { m_name = i18n("PIC Micro"); if ( _def_PICComponent_fileName.isEmpty() ) _def_PICComponent_fileName = i18n("<Enter location of PIC Program>"); m_bCreatedInitialPackage = false; m_bLoadingProgram = false; m_pGpsim = 0L; addButton( "run", QRect(), KIcon( "media-playback-start" ) ); addButton( "pause", QRect(), KIcon( "media-playback-pause" ) ); addButton( "reset", QRect(), KIcon( "process-stop" ) ); addButton( "reload", QRect(), KIcon( "view-refresh" ) ); connect( KTechlab::self(), SIGNAL(recentFileAdded(const KUrl &)), this, SLOT(slotUpdateFileList()) ); connect( ProjectManager::self(), SIGNAL(projectOpened()), this, SLOT(slotUpdateFileList()) ); connect( ProjectManager::self(), SIGNAL(projectClosed()), this, SLOT(slotUpdateFileList()) ); connect( ProjectManager::self(), SIGNAL(projectCreated()), this, SLOT(slotUpdateFileList()) ); connect( ProjectManager::self(), SIGNAL(subprojectCreated()), this, SLOT(slotUpdateFileList()) ); connect( ProjectManager::self(), SIGNAL(filesAdded()), this, SLOT(slotUpdateFileList()) ); connect( ProjectManager::self(), SIGNAL(filesRemoved()), this, SLOT(slotUpdateFileList()) ); createProperty( "program", Variant::Type::FileName ); property("program")->setCaption( i18n("Program") ); QString filter; filter = QString("*.flowcode *.cod *.asm *.basic *.c|%1").arg(i18n("All Supported Files")); filter += QString("\n*.flowcode|FlowCode (*.flowcode)"); filter += QString("\n*.cod|%1 (*.cod)").arg(i18n("Symbol File")); filter += QString("\n*.asm|%1 (*.asm)").arg(i18n("Assembly Code")); filter += QString("\n*.basic *.microbe|Microbe (*.basic, *.microbe)"); filter += QString("\n*.c|C (*.c)"); filter += QString("\n*|%1").arg(i18n("All Files")); property("program")->setFilter( filter ); // Used for restoring the pins on file loading before we have had a change // to compile the PIC program createProperty( "lastPackage", Variant::Type::String ); property("lastPackage")->setHidden( true ); // //HACK This is to enable loading with pre-0.3 files (which didn't set a "lastPackage" // // property). This will allow a P16F84 PIC to be initialized (which agrees with pre-0.3 // // behaviour), but it will also load it if // This to allow loading of the PIC component from pre-0.3 files (which didn't set a // "lastPackage" property). if ( !newItem ) property("lastPackage")->setValue("P16F84"); slotUpdateFileList(); slotUpdateBtns(); initPackage( 0 ); }
/** * @brief InfoManager::addProject Add project to this manager * @param project Pointer to given project class (manager will destroy this project in destructor) * @return Return false if manager contains this project, true otherwise */ bool InfoManager::addProject(MetaProject *project) { if(projects.contains(project->getName())) return false; projects.insert(project->getName(), project); emit projectCreated(project->getName()); if(activeProject.isEmpty()) setActiveProject(project->getName()); return true; }
void ProjectManagerWindow::onCreateClicked() { if (!(m_nameLine->text().isEmpty()) && !(m_pathLine->text().isEmpty())) { QString fileExtension = m_extension[m_listWidget->currentItem()]; if (fileExtension == ".robopro") { emit createProject(m_nameLine->text(), m_pathLine->text()); emit createFile("main.cpp", m_pathLine->text()); emit projectCreated(); } else { emit createFile(m_nameLine->text() + fileExtension, m_pathLine->text()); } m_nameLine->setText("undefined"); this->close(); } }
/** Private constructor */ InfoManager::InfoManager() : QObject() { activeProject = ""; connect(this,SIGNAL(projectCreated(QString)),this,SLOT(blockProjectSignals(QString))); }