Ejemplo n.º 1
0
IDocument_ptr Core::LoadDocument (const QString& path)
{
    if (!QFile::exists (path))
        return IDocument_ptr ();

    decltype (Backends_) loaders;
    Q_FOREACH (auto backend, Backends_)
        if (qobject_cast<IBackendPlugin*> (backend)->CanLoadDocument (path))
            loaders << backend;

    if (loaders.isEmpty ())
        return IDocument_ptr ();
    else if (loaders.size () == 1)
        return qobject_cast<IBackendPlugin*> (loaders.at (0))->LoadDocument (path);

    auto backend = DefaultBackendManager_->GetBackend (loaders);
    return backend ?
           qobject_cast<IBackendPlugin*> (backend)->LoadDocument (path) :
           IDocument_ptr ();
}
Ejemplo n.º 2
0
	IDocument_ptr Plugin::LoadDocument (const QString& file)
	{
		return IDocument_ptr (new Document (file, MuCtx_, this));
	}