Beispiel #1
0
int main(int argc, char *argv[])
{
    setenv("XDG_RUNTIME_DIR", "/tmp/luna-session", 0);

    QGuiApplication app(argc, argv);
    QCoreApplication::setApplicationName("luna-recorder");
    QCoreApplication::setApplicationVersion("0.2");

    QCommandLineParser parser;
    parser.setApplicationDescription("Luna Screencast recorder");
    parser.addHelpOption();
    parser.addVersionOption();

    QCommandLineOption fileOpt(QStringList() << "f" << "file",
                               "Output filename", "file");
    parser.addOption(fileOpt);

    QCommandLineOption numberOfFramesOpt(QStringList() << "n" << "number-of-frames",
                                         "Number of frames to record", "number-of-frames");
    parser.addOption(numberOfFramesOpt);

    parser.process(app);

    if (!parser.isSet(fileOpt)) {
        qCritical() << "File name for output needs to be set";
        exit(1);
    }

    const QString fileName = parser.value(fileOpt);
    QFile file(fileName);
    if (!file.open(QIODevice::WriteOnly)) {
        qCritical() << "Failed to open output file";
        exit(1);
    }

    unsigned int numberOfFrames = 0;
    if (parser.isSet(numberOfFramesOpt))
        numberOfFrames = parser.value(numberOfFramesOpt).toInt();

    Recorder recorder(&file, numberOfFrames);
    return app.exec();
}
Beispiel #2
0
void ModelsimGenerator::parseFileSets( QSharedPointer<Component> component, 
									  const QStringList& fileSetNames ) {

	Q_ASSERT_X(component, "ModelsimGenerator::parseFileSets",
		"Null component-pointer given as parameter");

	QString basePath = handler_->getPath(*component->getVlnv());
	if (basePath.isEmpty()) {
		emit errorMessage(tr("Component %1:%2:%3:%4 was not found within "
			"library, stopping generation").arg(
			component->getVlnv()->getVendor()).arg(
			component->getVlnv()->getLibrary()).arg(
			component->getVlnv()->getName()).arg(
			component->getVlnv()->getVersion()));
		return;
	}

	// check each file set
	foreach (QString fileSetName, fileSetNames) {

		// if the specified file set was not found within component
		if (!component->hasFileSet(fileSetName)) {
			emit errorMessage(tr("Fileset %1 was not found within component "
				"%2:%3:%4:%5").arg(fileSetName).arg(
				component->getVlnv()->getVendor()).arg(
				component->getVlnv()->getLibrary()).arg(
				component->getVlnv()->getName()).arg(
				component->getVlnv()->getVersion()));
			continue;
		}

		// get the files in the file set
		QSharedPointer<FileSet> fileSet = component->getFileSet(fileSetName);
		QList<QSharedPointer<File> > fileList = fileSet->getFiles();

		// handle each file
		foreach (QSharedPointer<File> file, fileList) {
			
			// get the absolute path to the file
			QString absolutePath = General::getAbsolutePath(basePath,
				file->getName());

			// make sure the file exists in the file system
			QFileInfo fileInfo(absolutePath);

			if (!fileInfo.exists()) {
				emit errorMessage(tr("The file %1 needed by component %2:%3:%4:%5"
					" was not found in the file system.").arg(
					absolutePath).arg(
					component->getVlnv()->getVendor()).arg(
					component->getVlnv()->getLibrary()).arg(
					component->getVlnv()->getName()).arg(
					component->getVlnv()->getVersion()));
				
				// move on to next file
				continue;
			}

			// create the file settings
			ModelsimGenerator::FileOptions fileOpt(absolutePath);

			// set the options for the file
			fileOpt.libraryName_ = file->getLogicalName();
			fileOpt.buildCommand_ = file->getCommand();
			fileOpt.flags_ = file->getFlags();
			fileOpt.sourceComponent_ = component->getVlnv()->toString();
			fileOpt.sourceFileSet_ = file->fileSetName();

			// if the file with options is not yet on the list, add it
			if (!sourceFiles_.contains(fileOpt))
				sourceFiles_.append(fileOpt);
		}
	}