Exemplo n.º 1
0
    // Find all PackCreationQueue XML files inside a directory
    // and create model branches
    bool screenPath(const QString &absPath)
    {
        // Path already screened in model?
        if (_screenedAbsPath.contains(absPath))
            return true;
        _screenedAbsPath.append(absPath);

        // Find all packcreationqueue-xmlfiles (recursively)
        QFileInfoList files = Utils::getFiles(QDir(absPath), QString(Constants::PACKCREATIONQUEUE_DEFAULT_FILENAME));

        // Add all packcreationqueue to the model
        foreach(const QFileInfo &info, files) {
            // Read the Queue file
            PackCreationQueue queue;
            if (!queue.fromXmlFile(info.absoluteFilePath())) {
                LOG_ERROR_FOR(q, tkTr(Trans::Constants::FILE_1_ISNOT_READABLE).arg(info.absoluteFilePath()));
                continue;
            }

            // Create the queue branch
            if (!packCreationQueueToItem(queue)) {
                LOG_ERROR_FOR(q, QString("Unable to create the queue branch: %1").arg(info.absoluteFilePath()));
                continue;
            }
            _queues << queue;
        }