void UISubclassWizard::accept() { QString path = QFileInfo( mFilePath ).path().append( "/" ).append( QFileInfo( mFilePath ).baseName() ); QMakeProject* project = UIMain::self()->currentProject(); // QFile header( path.append( ".h" ) ); if ( header.open( QFile::WriteOnly | QFile::Text ) ) { header.write( teHeader->toPlainText().toAscii() ); header.close(); project->addStringListValue( "HEADERS", cbGetWindowManager->currentText(), path ); UIMain::self()->createWindow( path, pHeader, project ); QFile source( path.replace( ".h", ".cpp") ); if ( source.open( QFile::WriteOnly | QFile::Text ) ) { source.write( teSource->toPlainText().toAscii() ); source.close(); project->addStringListValue( "SOURCES", cbGetWindowManager->currentText(), path ); UIMain::self()->createWindow( path, pSource, project ); QDialog::accept(); } else { QMessageBox::warning( this, _WARNING, tr( "Unable to create the files." ) ); QDialog::reject(); } } else { QMessageBox::warning( this, _WARNING, tr( "Unable to create the files." ) ); QDialog::reject(); } }
void UIAddExistingFiles::accept() { QStringList fileNames = selectedFiles(); if ( fileNames.isEmpty() ) return; QString suffix; QMakeProject* project = QMakeProject::getProjectByName( cbProjects->currentText(), projectParent ); foreach ( QString file, fileNames ) { switch ( project->getFileTypeFromFilePath( file ) ) { case pForm: project->addStringListValue( "FORMS", cbPlatforms->currentText(), file ); break; case pHeader: project->addStringListValue( "HEADERS", cbPlatforms->currentText(), file ); break; case pSource: project->addStringListValue( "SOURCES", cbPlatforms->currentText(), file ); break; /* case pTranslation: project->addStringListValue( "TRANSLATIONS", cbPlatforms->currentText(), file ); break; */ case pText: project->addStringListValue( "TEXTS", cbPlatforms->currentText(), file ); break; default: break; } } QDialog::accept(); }