Example #1
0
void QFileResourceFileEngineHandler::appendSearchDirs(QStringList& dirs,
        const QString& dir, const QString& subdir) const
{
    QString t;
    t = dir+subdir+qApp->applicationName()+'/';
    if ( QFSFileEngine(t).fileFlags(QFSFileEngine::ExistsFlag) )
        dirs.append(t);
    t = dir+subdir;
    if ( QFSFileEngine(t).fileFlags(QFSFileEngine::ExistsFlag) )
        dirs.append(t);
}
Example #2
0
MediaSource::MediaSource(const QString &filename)
    : d(new MediaSourcePrivate(LocalFile))
{
    const QFileInfo fileInfo(filename);
    if (fileInfo.exists()) {
        bool localFs = QAbstractFileEngine::LocalDiskFlag & QFSFileEngine(filename).fileFlags(QAbstractFileEngine::LocalDiskFlag);
        if (localFs) {
            d->url = QUrl::fromLocalFile(fileInfo.absoluteFilePath());
        } else {
#ifndef QT_NO_PHONON_ABSTRACTMEDIASTREAM
            // it's a Qt resource -> use QFile
            d->type = Stream;
            d->ioDevice = new QFile(filename);
            d->setStream(new IODeviceStream(d->ioDevice, d->ioDevice));
#else
            d->type = Invalid;
#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
        }
    } else {
        d->url = filename;
        if (d->url.isValid()) {
            d->type = Url;
        } else {
            d->type = Invalid;
        }
    }
}