コード例 #1
0
ファイル: StandardRuler.cpp プロジェクト: tedfelix/rosegarden
void StandardRuler::connectRulerToDocPointer(RosegardenDocument *doc)
{
    RG_DEBUG << "StandardRuler::connectRulerToDocPointer";

    Q_ASSERT(m_loopRuler);
    Q_ASSERT(m_markerRuler);

    // use the document as a hub for pointer and loop set related signals
    // pointer and loop drag signals are specific to the current view,
    // so they are re-emitted from the loop ruler by this widget
    //
    QObject::connect
    (m_loopRuler, SIGNAL(setPointerPosition(timeT)),
     doc, SLOT(slotSetPointerPosition(timeT)));

    QObject::connect
    (m_markerRuler, SIGNAL(setPointerPosition(timeT)),
     doc, SLOT(slotSetPointerPosition(timeT)));

    QObject::connect
    (m_loopRuler, SIGNAL(dragPointerToPosition(timeT)),
     this, SIGNAL(dragPointerToPosition(timeT)));

    QObject::connect
    (m_loopRuler, SIGNAL(dragLoopToPosition(timeT)),
     this, SIGNAL(dragLoopToPosition(timeT)));

    QObject::connect
    (m_markerRuler, SIGNAL(setLoop(timeT, timeT)),
     doc, SLOT(slotSetLoop(timeT, timeT)));

    QObject::connect
    (m_loopRuler, SIGNAL(setLoop(timeT, timeT)),
     doc, SLOT(slotSetLoop(timeT, timeT)));

    QObject::connect
    (doc, SIGNAL(loopChanged(timeT, timeT)),
     m_loopRuler,
     SLOT(slotSetLoopMarker(timeT, timeT)));

//    m_loopRuler->setBackgroundColor(GUIPalette::getColour(GUIPalette::PointerRuler));
}
コード例 #2
0
ファイル: TranzportClient.cpp プロジェクト: EQ4/RosegardenW
void
TranzportClient::documentChanged(RosegardenDocument* doc)
{
    RG_DEBUG << "TranzportClient::DocumentChanged " << endl;

    m_rgDocument = doc;
    m_composition = &m_rgDocument->getComposition();
    m_composition->addObserver(this);
    connect(m_rgDocument, SIGNAL(pointerPositionChanged(timeT)),
            this, SLOT(pointerPositionChanged(timeT)));
    connect(m_rgDocument, SIGNAL(loopChanged(timeT,timeT)),
            this, SLOT(loopChanged(timeT,timeT)));
    connect(this, SIGNAL(setPosition(timeT)),
            m_rgDocument, SLOT(slotSetPointerPosition(timeT)));
                
    while (not commands.empty()) {
        commands.pop();
    }
    stateUpdate();
}
コード例 #3
0
ファイル: TranzportClient.cpp プロジェクト: EQ4/RosegardenW
TranzportClient::TranzportClient(RosegardenMainWindow* rgGUIApp) :
    QObject(),
    device_online(true),
    previous_buttons(*reinterpret_cast<uint32_t*>(previousbuf+2)),
    current_buttons(*reinterpret_cast<uint32_t*>(currentbuf+2)),
    datawheel(currentbuf[6]),
    status(currentbuf[1]),
    m_rgGUIApp(rgGUIApp),
    m_rgDocument(rgGUIApp->getDocument()),
    m_composition(&m_rgDocument->getComposition())
{
    m_descriptor = open("/dev/tranzport0",O_RDWR);
    
    if (m_descriptor < 0) {
        throw Exception(qstrtostr(QObject::tr("Failed to open tranzport device /dev/tranzport0")));
    }

    bzero(currentbuf,8);
    bzero(previousbuf,8);

    fcntl(m_descriptor,F_SETOWN, getpid());
    int socketFlags = fcntl(m_descriptor, F_GETFL, 0);
    if (socketFlags != -1) {
        fcntl(m_descriptor, F_SETFL, socketFlags | O_NONBLOCK);
    }

    m_socketReadNotifier = new QSocketNotifier(m_descriptor, QSocketNotifier::Read, 0);
    m_socketWriteNotifier = new QSocketNotifier(m_descriptor, QSocketNotifier::Write,0);

    connect(m_socketReadNotifier, SIGNAL(activated(int)), this, SLOT(readData()));
    connect(m_socketWriteNotifier, SIGNAL(activated(int)), this, SLOT(writeCommandQueue()));
        
    connect(this, SIGNAL(play()),
            m_rgGUIApp, SLOT(slotPlay()) );
    connect(this, SIGNAL(stop()),
            m_rgGUIApp, SLOT(slotStop()) );
    connect(this, SIGNAL(record()),
            m_rgGUIApp, SLOT(slotRecord()) );
    connect(this, SIGNAL(rewind()),
            m_rgGUIApp, SLOT(slotRewind()) );
    connect(this, SIGNAL(rewindToBeginning()),
            m_rgGUIApp, SLOT(slotRewindToBeginning()) );
    connect(this, SIGNAL(fastForward()),
            m_rgGUIApp, SLOT(slotFastforward()) );
    connect(this, SIGNAL(fastForwardToEnd()),
            m_rgGUIApp, SLOT(slotFastForwardToEnd()) );
    connect(this, SIGNAL(toggleRecord()),
            m_rgGUIApp, SLOT(slotToggleRecord()) );
    connect(this, SIGNAL(trackDown()),
            m_rgGUIApp, SLOT(slotTrackDown()) );
    connect(this, SIGNAL(trackUp()),
            m_rgGUIApp, SLOT(slotTrackUp()) );
    connect(this, SIGNAL(trackMute()),
            m_rgGUIApp, SLOT(slotToggleMute()) );
    connect(this, SIGNAL(trackRecord()),
            m_rgGUIApp, SLOT(slotToggleRecordCurrentTrack()) );
    connect(this, SIGNAL(solo(bool)),
            m_rgGUIApp, SLOT(slotToggleSolo(bool)));

    connect(m_rgGUIApp, SIGNAL(documentChanged(RosegardenDocument*)),
            this, SLOT(documentChanged(RosegardenDocument*)));

    connect(m_rgDocument, SIGNAL(pointerPositionChanged(timeT)),
            this, SLOT(pointerPositionChanged(timeT)));

    connect(m_rgDocument, SIGNAL(loopChanged(timeT,timeT)),
            this, SLOT(loopChanged(timeT,timeT)));

    connect(this, SIGNAL(undo()),
            CommandHistory::getInstance(),SLOT(undo()));

    connect(this, SIGNAL(redo()),
            CommandHistory::getInstance(), SLOT(redo()));

    connect(this, SIGNAL(setPosition(timeT)),
            m_rgDocument, SLOT(slotSetPointerPosition(timeT)));

    m_composition->addObserver(this);
    m_socketWriteNotifier->setEnabled(false);
    stateUpdate();

    RG_DEBUG << "TranzportClient::TranzportClient: connected to tranzport device: " << m_descriptor << endl;
}