Logo Search packages:      
Sourcecode: rosegarden version File versions  Download package

RosegardenGUIDoc * RosegardenGUIApp::createDocumentFromHydrogenFile ( QString  filePath  )  [protected]

Create document from Hydrogen drum machine file

Definition at line 3918 of file rosegardengui.cpp.

References RosegardenGUIDoc::getComposition(), RosegardenGUIDoc::getStudio(), RosegardenGUIDoc::setAbsFilePath(), RosegardenGUIDoc::setTitle(), and RosegardenGUIDoc::slotDocumentModified().

Referenced by createDocument().

{
    KStartupLogo::hideIfStillThere();
    RosegardenProgressDialog progressDlg(
            i18n("Importing Hydrogen file..."), 100, this);

    CurrentProgressDialog::set(&progressDlg);

    // Inherent autoload
    //
    RosegardenGUIDoc *newDoc = new RosegardenGUIDoc(this, m_pluginManager);

    HydrogenLoader hydrogenLoader(&newDoc->getStudio());

    // TODO: make RG21Loader to actually emit these signals
    //
    connect(&hydrogenLoader, SIGNAL(setProgress(int)),
            progressDlg.progressBar(), SLOT(setValue(int)));

    connect(&hydrogenLoader, SIGNAL(incrementProgress(int)),
            progressDlg.progressBar(), SLOT(advance(int)));

    // "your starter for 40%" - helps the "freeze" work
    //
    progressDlg.progressBar()->advance(40);

    if (!hydrogenLoader.load(file, newDoc->getComposition()))
    {
      CurrentProgressDialog::freeze();
      KMessageBox::error(this,
                     i18n("Can't load Hydrogen file.  It appears to be corrupted."));
      delete newDoc;
      return 0;
    }

    // Set modification flag
    //
    newDoc->slotDocumentModified();

    // Set the caption and add recent
    //
    newDoc->setTitle(QFileInfo(file).fileName());
    newDoc->setAbsFilePath(QFileInfo(file).absFilePath());

    return newDoc;

}


Generated by  Doxygen 1.6.0   Back to index