⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rosegardenguiapp.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    m_synthManager = 0;    delete m_audioMixer;    m_audioMixer = 0;    delete m_bankEditor;    m_bankEditor = 0;    delete m_markerEditor;    m_markerEditor = 0;    delete m_tempoView;    m_tempoView = 0;    delete m_triggerSegmentManager;    m_triggerSegmentManager = 0;    delete oldView;    // set the highlighted track    m_view->slotSelectTrackSegments(comp.getSelectedTrack());    // play tracking on in the editor by default: turn off if need be    KToggleAction *trackingAction = dynamic_cast<KToggleAction *>                                    (actionCollection()->action("toggle_tracking"));    if (trackingAction && !trackingAction->isChecked()) {        m_view->getTrackEditor()->slotToggleTracking();    }    m_view->show();    connect(m_view->getTrackEditor()->getSegmentCanvas(),            SIGNAL(showContextHelp(const QString &)),            this,            SLOT(slotShowToolHelp(const QString &)));    // We have to do this to make sure that the 2nd call ("select")    // actually has any effect. Activating the same radio action    // doesn't work the 2nd time (like pressing down the same radio    // button twice - it doesn't have any effect), so if you load two    // files in a row, on the 2nd file a new SegmentCanvas will be    // created but its tool won't be set, even though it will appear    // to be selected.    //    actionCollection()->action("move")->activate();    if (m_doc->getComposition().getNbSegments() > 0)        actionCollection()->action("select")->activate();    else        actionCollection()->action("draw")->activate();    int zoomLevel = m_doc->getConfiguration().                    get                        <Int>                        (DocumentConfiguration::ZoomLevel);    m_zoomSlider->setSize(double(zoomLevel) / 1000.0);    slotChangeZoom(zoomLevel);    //slotChangeZoom(int(m_zoomSlider->getCurrentSize()));    stateChanged("new_file");    ProgressDialog::processEvents();    if (m_viewChordNameRuler->isChecked()) {        SetWaitCursor swc;        m_view->initChordNameRuler();    } else {        m_view->initChordNameRuler();    }}void RosegardenGUIApp::setDocument(RosegardenGUIDoc* newDocument){    if (m_doc == newDocument)        return ;    emit documentAboutToChange();    kapp->processEvents(); // to make sure all opened dialogs (mixer, midi devices...) are closed    // Take care of all subparts which depend on the document    // Caption    //    QString caption = kapp->caption();    setCaption(caption + ": " + newDocument->getTitle());    //     // reset AudioManagerDialog    //     //    //     delete m_audioManagerDialog; // TODO : replace this with a connection to documentAboutToChange() sig.    //     m_audioManagerDialog = 0;    RosegardenGUIDoc* oldDoc = m_doc;    m_doc = newDocument;    if (m_seqManager) // when we're called at startup, the seq. man. isn't created yet        m_seqManager->setDocument(m_doc);    if (m_markerEditor)        m_markerEditor->setDocument(m_doc);    if (m_tempoView) {        delete m_tempoView;        m_tempoView = 0;    }    if (m_triggerSegmentManager)        m_triggerSegmentManager->setDocument(m_doc);    m_trackParameterBox->setDocument(m_doc);    m_segmentParameterBox->setDocument(m_doc);    m_instrumentParameterBox->setDocument(m_doc);#ifdef HAVE_LIBLO    if (m_pluginGUIManager) {        m_pluginGUIManager->stopAllGUIs();        m_pluginGUIManager->setStudio(&m_doc->getStudio());    }#endif    if (getView() &&            getView()->getTrackEditor() &&            getView()->getTrackEditor()->getSegmentCanvas()) {        getView()->getTrackEditor()->getSegmentCanvas()->endAudioPreviewGeneration();    }    // this will delete all edit views    //    delete oldDoc;    // connect needed signals    //    connect(m_segmentParameterBox, SIGNAL(documentModified()),            m_doc, SLOT(slotDocumentModified()));    connect(m_doc, SIGNAL(pointerPositionChanged(timeT)),            this, SLOT(slotSetPointerPosition(timeT)));    connect(m_doc, SIGNAL(documentModified(bool)),            this, SLOT(slotDocumentModified(bool)));    connect(m_doc, SIGNAL(loopChanged(timeT, timeT)),            this, SLOT(slotSetLoop(timeT, timeT)));    m_doc->getCommandHistory()->attachView(actionCollection());    connect(m_doc->getCommandHistory(), SIGNAL(commandExecuted()),            SLOT(update()));    connect(m_doc->getCommandHistory(), SIGNAL(commandExecuted()),            SLOT(slotTestClipboard()));    // connect and start the autosave timer    connect(m_autoSaveTimer, SIGNAL(timeout()), this, SLOT(slotAutoSave()));    m_autoSaveTimer->start(m_doc->getAutoSavePeriod() * 1000);    // Connect the playback timer    //    connect(m_playTimer, SIGNAL(timeout()), this, SLOT(slotUpdatePlaybackPosition()));    connect(m_stopTimer, SIGNAL(timeout()), this, SLOT(slotUpdateMonitoring()));    // finally recreate the main view    //    initView();    connect(m_doc, SIGNAL(devicesResyncd()),            this, SLOT(slotDocumentDevicesResyncd()));    m_doc->syncDevices();    m_doc->clearModifiedStatus();    if (newDocument->getStudio().haveMidiDevices()) {        stateChanged("got_midi_devices");    } else {        stateChanged("got_midi_devices", KXMLGUIClient::StateReverse);    }    // Ensure the sequencer knows about any audio files    // we've loaded as part of the new Composition    //    m_doc->prepareAudio();    // Do not reset instrument prog. changes after all.    //     if (m_seqManager)    //         m_seqManager->preparePlayback(true);    Composition &comp = m_doc->getComposition();    // Set any loaded loop at the Composition and    // on the marker on SegmentCanvas and clients    //    if (m_seqManager)        m_doc->setLoop(comp.getLoopStart(), comp.getLoopEnd());    emit documentChanged(m_doc);    m_doc->clearModifiedStatus(); // because it's set as modified by the various    // init operations    // TODO: this sucks, have to sort it out somehow.    // Readjust canvas size    //    m_view->getTrackEditor()->slotReadjustCanvasSize();    m_stopTimer->start(100);}voidRosegardenGUIApp::openFile(QString filePath, ImportType type){    RG_DEBUG << "RosegardenGUIApp::openFile " << filePath << endl;    if (type == ImportCheckType && filePath.endsWith(".rgp")) {        importProject(filePath);        return ;    }    RosegardenGUIDoc *doc = createDocument(filePath, type);    if (doc) {        setDocument(doc);        // fix # 1235755, "SPB combo not updating after document swap"        RG_DEBUG << "RosegardenGUIApp::openFile(): calling slotDocColoursChanged() in doc" << endl;        doc->slotDocColoursChanged();        kapp->config()->setGroup(GeneralOptionsConfigGroup);        if (kapp->config()->readBoolEntry("alwaysusedefaultstudio", false)) {            QString autoloadFile =                KGlobal::dirs()->findResource("appdata", "autoload.rg");            QFileInfo autoloadFileInfo(autoloadFile);            if (autoloadFileInfo.isReadable()) {                RG_DEBUG << "Importing default studio from " << autoloadFile << endl;                slotImportStudioFromFile(autoloadFile);            }        }        QFileInfo fInfo(filePath);        m_fileRecent->addURL(fInfo.absFilePath());    }}RosegardenGUIDoc*RosegardenGUIApp::createDocument(QString filePath, ImportType importType){    QFileInfo info(filePath);    RosegardenGUIDoc *doc = 0;    if (!info.exists()) {        // can happen with command-line arg, so...        KStartupLogo::hideIfStillThere();        KMessageBox::sorry(this, i18n("File \"%1\" does not exist").arg(filePath));        return 0;    }    if (info.isDir()) {        KStartupLogo::hideIfStillThere();        KMessageBox::sorry(this, i18n("File \"%1\" is actually a directory"));        return 0;    }    QFile file(filePath);    if (!file.open(IO_ReadOnly)) {        KStartupLogo::hideIfStillThere();        QString errStr =            i18n("You do not have read permission for \"%1\"").arg(filePath);        KMessageBox::sorry(this, errStr);        return 0;    }    // Stop if playing    //    if (m_seqManager && m_seqManager->getTransportStatus() == PLAYING)        slotStop();    slotEnableTransport(false);    if (importType == ImportCheckType) {        KMimeType::Ptr fileMimeType = KMimeType::findByPath(filePath);        if (fileMimeType->name() == "audio/x-midi")            importType = ImportMIDI;        else if (fileMimeType->name() == "audio/x-rosegarden")            importType = ImportRG4;        else if (filePath.endsWith(".rose"))            importType = ImportRG21;        else if (filePath.endsWith(".h2song"))            importType = ImportHydrogen;    }    switch (importType) {    case ImportMIDI:        doc = createDocumentFromMIDIFile(filePath);        break;    case ImportRG21:        doc = createDocumentFromRG21File(filePath);        break;    case ImportHydrogen:        doc = createDocumentFromHydrogenFile(filePath);        break;    default:        doc = createDocumentFromRGFile(filePath);    }    slotEnableTransport(true);    return doc;}RosegardenGUIDoc*RosegardenGUIApp::createDocumentFromRGFile(QString filePath){    // Check for an autosaved file to recover    QString effectiveFilePath = filePath;    bool canRecover = false;    QString autoSaveFileName = kapp->checkRecoverFile(filePath, canRecover);    if (canRecover) {        // First check if the auto-save file is more recent than the doc        QFileInfo docFileInfo(filePath), autoSaveFileInfo(autoSaveFileName);        if (docFileInfo.lastModified() < autoSaveFileInfo.lastModified()) {            RG_DEBUG << "RosegardenGUIApp::openFile : "            << "found a more recent autosave file\n";            // At this point the splash screen may still be there, hide it if            // it's the case            KStartupLogo::hideIfStillThere();            // It is, so ask the user if he wants to use the autosave file            int reply = KMessageBox::questionYesNo(this,                                                   i18n("An auto-save file for this document has been found\nDo you want to open it instead ?"));            if (reply == KMessageBox::Yes)                // open the autosave file instead                effectiveFilePath = autoSaveFileName;            else {                // user doesn't want the autosave, so delete it                // so it won't bother us again if we reload                canRecover = false;                QFile::remove                    (autoSaveFileName);            }        } else            canRecover = false;    }    // Create a new blank document    //    RosegardenGUIDoc *newDoc = new RosegardenGUIDoc(this, m_pluginManager,                    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -