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

📄 trackbuttons.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 3 页
字号:
            for (Composition::trackcontainer::iterator tit =                     comp.getTracks().begin();                 tit != comp.getTracks().end(); ++tit) {                if (tit->second->getInstrument() == (*it)->getId()) {                    instrUsedByAnyone = true;                    break;                }            }        }        QIconSet iconSet            (connected ?             (instrUsedByAnyone ?              instrUsedByMe ?              connectedSelectedPixmap :              connectedUsedPixmap : connectedPixmap) :             (instrUsedByAnyone ?              instrUsedByMe ?              unconnectedSelectedPixmap :              unconnectedUsedPixmap : unconnectedPixmap));        if (pname != "")            iname += " (" + pname + ")";        instrumentSubMenus[instrumentSubMenus.size() - 1]->insertItem(iconSet, iname, i++);    }}voidTrackButtons::slotInstrumentPopupActivated(int item){    RG_DEBUG << "TrackButtons::slotInstrumentPopupActivated " << item << endl;    Composition &comp = m_doc->getComposition();    Studio &studio = m_doc->getStudio();    Instrument *inst = studio.getInstrumentFromList(item);    RG_DEBUG << "TrackButtons::slotInstrumentPopupActivated: instrument " << inst << endl;    if (inst != 0) {        Track *track = comp.getTrackByPosition(m_popupItem);        if (track != 0) {            track->setInstrument(inst->getId());            // select instrument            emit instrumentSelected((int)inst->getId());            m_trackLabels[m_popupItem]->getInstrumentLabel()->                setText(strtoqstr(inst->getPresentationName()));            // reset the alternative label            m_trackLabels[m_popupItem]->clearAlternativeLabel();            // Now see if the program is being shown for this instrument            // and if so reset the label            //            if (inst->sendsProgramChange())                m_trackLabels[m_popupItem]->setAlternativeLabel(strtoqstr(inst->getProgramName()));            if (inst->getType() == Instrument::Audio) {                m_recordLeds[m_popupItem]->setColor                (GUIPalette::getColour                 (GUIPalette::RecordAudioTrackLED));            } else {                m_recordLeds[m_popupItem]->setColor                (GUIPalette::getColour                 (GUIPalette::RecordMIDITrackLED));            }        } else            RG_DEBUG << "slotInstrumentPopupActivated() - can't find item!\n";    } else        RG_DEBUG << "slotInstrumentPopupActivated() - can't find item!\n";}voidTrackButtons::changeTrackInstrumentLabels(TrackLabel::InstrumentTrackLabels label){    // Set new label    m_trackInstrumentLabels = label;    // update and reconnect with new value    for (int i = 0; i < (int)m_tracks; i++) {        m_trackLabels[i]->showLabel(label);    }}voidTrackButtons::changeInstrumentLabel(InstrumentId id, QString label){    Composition &comp = m_doc->getComposition();    Track *track;    for (int i = 0; i < (int)m_tracks; i++) {        track = comp.getTrackByPosition(i);        if (track && track->getInstrument() == id) {            m_trackLabels[i]->setAlternativeLabel(label);            Instrument *ins = m_doc->getStudio().                              getInstrumentById(track->getInstrument());            if (ins && ins->getType() == Instrument::Audio) {                m_recordLeds[i]->setColor                (GUIPalette::getColour                 (GUIPalette::RecordAudioTrackLED));            } else {                m_recordLeds[i]->setColor                (GUIPalette::getColour                 (GUIPalette::RecordMIDITrackLED));            }        }    }}voidTrackButtons::changeTrackLabel(TrackId id, QString label){    Composition &comp = m_doc->getComposition();    Track *track;    for (int i = 0; i < (int)m_tracks; i++) {        track = comp.getTrackByPosition(i);        if (track && track->getId() == id) {            if (m_trackLabels[i]->getTrackLabel()->text() != label) {                m_trackLabels[i]->getTrackLabel()->setText(label);                emit widthChanged();                emit nameChanged();            }            return ;        }    }}voidTrackButtons::slotSynchroniseWithComposition(){    Composition &comp = m_doc->getComposition();    Studio &studio = m_doc->getStudio();    Track *track;    for (int i = 0; i < (int)m_tracks; i++) {        track = comp.getTrackByPosition(i);        if (track) {            if (track->isMuted())                m_muteLeds[i]->off();            else                m_muteLeds[i]->on();            Instrument *ins = studio.                              getInstrumentById(track->getInstrument());            QString instrumentName(i18n("<no instrument>"));            if (ins)                instrumentName = strtoqstr(ins->getPresentationName());            m_trackLabels[i]->getInstrumentLabel()->setText(instrumentName);            setRecordButton(i, comp.isTrackRecording(track->getId()));            if (ins && ins->getType() == Instrument::Audio) {                m_recordLeds[i]->setColor                (GUIPalette::getColour                 (GUIPalette::RecordAudioTrackLED));            } else {                m_recordLeds[i]->setColor                (GUIPalette::getColour                 (GUIPalette::RecordMIDITrackLED));            }        }    }}voidTrackButtons::slotLabelSelected(int position){    Track *track =        m_doc->getComposition().getTrackByPosition(position);    if (track) {        emit trackSelected(track->getId());    }}voidTrackButtons::setMuteButton(TrackId track, bool value){    Track *trackObj = m_doc->getComposition().getTrackById(track);    if (trackObj == 0)        return ;    int pos = trackObj->getPosition();    RG_DEBUG << "TrackButtons::setMuteButton() trackId = "    << track << ", pos = " << pos << endl;    m_muteLeds[pos]->setState(value ? KLed::Off : KLed::On);}voidTrackButtons::slotTrackInstrumentSelection(TrackId trackId, int item){    RG_DEBUG << "TrackButtons::slotTrackInstrumentSelection(" << trackId << ")\n";    Composition &comp = m_doc->getComposition();    int position = comp.getTrackById(trackId)->getPosition();    m_popupItem = position;    slotInstrumentPopupActivated( item );}QFrame* TrackButtons::makeButton(Rosegarden::TrackId trackId){    // The buttonGap sets up the sizes of the buttons    //    static const int buttonGap = 8;    QFrame *trackHBox = 0;    KLedButton *mute = 0;    KLedButton *record = 0;    TrackVUMeter *vuMeter = 0;    TrackLabel *trackLabel = 0;    int vuWidth = 20;    int vuSpacing = 2;    int labelWidth = m_trackLabelWidth - ( (m_cellSize - buttonGap) * 2 +                                            vuSpacing * 2 + vuWidth );    // Set the label from the Track object on the Composition    //    Rosegarden::Track *track = m_doc->getComposition().getTrackById(trackId);    if (track == 0) return 0;    // Create a horizontal box for each track    //    trackHBox = new QFrame(this);    QHBoxLayout *hblayout = new QHBoxLayout(trackHBox);            trackHBox->setMinimumSize(labelWidth, m_cellSize - m_borderGap);    trackHBox->setFixedHeight(m_cellSize - m_borderGap);    // Try a style for the box    //    trackHBox->setFrameStyle(StyledPanel);    trackHBox->setFrameShape(StyledPanel);    trackHBox->setFrameShadow(Raised);    // Insert a little gap    hblayout->addSpacing(vuSpacing);    // Create a VU meter    vuMeter = new TrackVUMeter(trackHBox,                               VUMeter::PeakHold,                               vuWidth,                               buttonGap,                               track->getPosition());    m_trackMeters.push_back(vuMeter);    hblayout->addWidget(vuMeter);    // Create another little gap    hblayout->addSpacing(vuSpacing);    //    // 'mute' and 'record' leds    //    mute = new KLedButton(Rosegarden::GUIPalette::getColour              (Rosegarden::GUIPalette::MuteTrackLED), trackHBox);    QToolTip::add(mute, i18n("Mute track"));    hblayout->addWidget(mute);    record = new KLedButton(Rosegarden::GUIPalette::getColour                (Rosegarden::GUIPalette::RecordMIDITrackLED), trackHBox);    QToolTip::add(record, i18n("Record on this track"));    hblayout->addWidget(record);    record->setLook(KLed::Sunken);    mute->setLook(KLed::Sunken);    record->off();    // Connect them to their sigmappers    connect(record, SIGNAL(stateChanged(bool)),            m_recordSigMapper, SLOT(map()));    connect(mute, SIGNAL(stateChanged(bool)),            m_muteSigMapper, SLOT(map()));    m_recordSigMapper->setMapping(record, track->getPosition());    m_muteSigMapper->setMapping(mute, track->getPosition());    // Store the KLedButton    //    m_muteLeds.push_back(mute);    m_recordLeds.push_back(record);    //    // Track label    //    trackLabel = new TrackLabel(trackId, track->getPosition(), trackHBox);    hblayout->addWidget(trackLabel);    if (track->getLabel() == std::string("")) {    Rosegarden::Instrument *ins =        m_doc->getStudio().getInstrumentById(track->getInstrument());    if (ins && ins->getType() == Rosegarden::Instrument::Audio) {        trackLabel->getTrackLabel()->setText(i18n("<untitled audio>"));    } else {        trackLabel->getTrackLabel()->setText(i18n("<untitled>"));    }    }    else        trackLabel->getTrackLabel()->setText(strtoqstr(track->getLabel()));    trackLabel->setFixedSize(labelWidth, m_cellSize - buttonGap);    trackLabel->setFixedHeight(m_cellSize - buttonGap);    trackLabel->setIndent(7);    connect(trackLabel, SIGNAL(renameTrack(QString, TrackId)),            SLOT(slotRenameTrack(QString, TrackId)));    // Store the TrackLabel pointer    //    m_trackLabels.push_back(trackLabel);    // Connect it    setButtonMapping(trackLabel, trackId);    connect(trackLabel, SIGNAL(changeToInstrumentList()),            m_instListSigMapper, SLOT(map()));    connect(trackLabel, SIGNAL(clicked()),            m_clickedSigMapper, SLOT(map()));    //    // instrument label    //    Rosegarden::Instrument *ins =        m_doc->getStudio().getInstrumentById(track->getInstrument());    QString instrumentName(i18n("<no instrument>"));    if (ins) instrumentName = strtoqstr(ins->getPresentationName());    // Set label to program change if it's being sent    //    if (ins != 0 && ins->sendsProgramChange())        trackLabel->setAlternativeLabel(strtoqstr(ins->getProgramName()));    trackLabel->showLabel(m_trackInstrumentLabels);    mute->setFixedSize(m_cellSize - buttonGap, m_cellSize - buttonGap);    record->setFixedSize(m_cellSize - buttonGap, m_cellSize - buttonGap);    // set the mute button    //    if (track->isMuted())        mute->off();    return trackHBox;}}#include "TrackButtons.moc"

⌨️ 快捷键说明

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