コード例 #1
0
int Velasquez::ToolBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: toolActivated((*reinterpret_cast< DrawingTool*(*)>(_a[1]))); break;
        case 1: copyRequest(); break;
        case 2: pasteRequest(); break;
        case 3: copyImageToClipboard(); break;
        case 4: pasteFromClipboard(); break;
        case 5: onSceneCleared(); break;
        default: ;
        }
        _id -= 6;
    }
    return _id;
}
コード例 #2
0
ファイル: zoneviewlet.cpp プロジェクト: Omega9/synthclone
ZoneViewlet::ZoneViewlet(QMainWindow *mainWindow, QObject *parent):
    QObject(parent)
{
    // Initialize zones menu and associated actions

    zonesMenu = synthclone::getChild<QMenu>(mainWindow, "zonesMenu");

    applyEffectsAction = synthclone::getChild<QAction>
        (mainWindow, "applyEffectsZonesAction");
    connect(applyEffectsAction, SIGNAL(triggered()),
            SIGNAL(applyEffectsRequest()));

    buildTargetsAction = synthclone::getChild<QAction>
        (mainWindow, "buildTargetsAction");
    connect(buildTargetsAction, SIGNAL(triggered()),
            SIGNAL(buildTargetsRequest()));

    clearEffectJobsAction = synthclone::getChild<QAction>
        (mainWindow, "clearEffectJobsAction");
    connect(clearEffectJobsAction, SIGNAL(triggered()),
            SIGNAL(clearEffectJobsRequest()));

    clearSamplerJobsAction = synthclone::getChild<QAction>
        (mainWindow, "clearSamplerJobsAction");
    connect(clearSamplerJobsAction, SIGNAL(triggered()),
            SIGNAL(clearSamplerJobsRequest()));

    clearSamplerJobsButton = synthclone::getChild<QPushButton>
        (mainWindow, "clearSamplerJobsButton");
    connect(clearSamplerJobsButton, SIGNAL(clicked()),
            SIGNAL(clearSamplerJobsRequest()));

    clearSelectionAction = synthclone::getChild<QAction>
        (mainWindow, "clearZonesSelectionAction");
    connect(clearSelectionAction, SIGNAL(triggered()),
            SIGNAL(clearSelectionRequest()));

    copyAction = synthclone::getChild<QAction>(mainWindow, "copyZonesAction");
    connect(copyAction, SIGNAL(triggered()), SIGNAL(copyRequest()));

    cutAction = synthclone::getChild<QAction>(mainWindow, "cutZonesAction");
    connect(cutAction, SIGNAL(triggered()), SIGNAL(cutRequest()));

    deleteAction = synthclone::getChild<QAction>
        (mainWindow, "deleteZonesAction");
    connect(deleteAction, SIGNAL(triggered()), SIGNAL(deleteRequest()));

    insertAction = synthclone::getChild<QAction>
        (mainWindow, "insertZoneAction");
    connect(insertAction, SIGNAL(triggered()), SIGNAL(insertRequest()));

    invertSelectionAction = synthclone::getChild<QAction>
        (mainWindow, "invertZoneSelectionAction");
    connect(invertSelectionAction, SIGNAL(triggered()),
            SIGNAL(invertSelectionRequest()));

    pasteAction = synthclone::getChild<QAction>(mainWindow, "pasteZonesAction");
    connect(pasteAction, SIGNAL(triggered()), SIGNAL(pasteRequest()));

    playDrySampleAction = synthclone::getChild<QAction>
        (mainWindow, "playDrySampleZonesAction");
    connect(playDrySampleAction, SIGNAL(triggered()),
            SIGNAL(playDrySampleRequest()));

    playWetSampleAction =
        synthclone::getChild<QAction>(mainWindow, "playWetSampleZonesAction");
    connect(playWetSampleAction, SIGNAL(triggered()),
            SIGNAL(playWetSampleRequest()));

    removeEffectJobAction =
        synthclone::getChild<QAction>(mainWindow, "removeEffectJobZonesAction");
    connect(removeEffectJobAction, SIGNAL(triggered()),
            SIGNAL(removeEffectJobRequest()));

    removeSamplerJobAction = synthclone::getChild<QAction>
        (mainWindow, "removeSamplerJobZonesAction");
    connect(removeSamplerJobAction, SIGNAL(triggered()),
            SIGNAL(removeSamplerJobRequest()));

    sampleAction = synthclone::getChild<QAction>
        (mainWindow, "getSampleZonesAction");
    connect(sampleAction, SIGNAL(triggered()), SIGNAL(sampleRequest()));

    selectAllAction = synthclone::getChild<QAction>
        (mainWindow, "selectAllZonesAction");
    connect(selectAllAction, SIGNAL(triggered()), SIGNAL(selectAllRequest()));

    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_AFTERTOUCH,
                               "aftertouchColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_CHANNEL,
                               "channelColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_CHANNEL_PRESSURE,
                               "channelPressureColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_DRY_SAMPLE,
                               "drySampleColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_NOTE,
                               "noteColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_RELEASE_TIME,
                               "releaseTimeColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_SAMPLE_TIME,
                               "sampleTimeColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_STATUS,
                               "statusColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_VELOCITY,
                               "velocityColumnShowAction");
    initializeColumnShowAction(mainWindow, ZONETABLECOLUMN_WET_SAMPLE,
                               "wetSampleColumnShowAction");
    initializeControlColumnShowActions("controlColumnsMenu1", 0, 0x10);
    initializeControlColumnShowActions("controlColumnsMenu2", 0x10, 0x20);
    initializeControlColumnShowActions("controlColumnsMenu3", 0x20, 0x30);
    initializeControlColumnShowActions("controlColumnsMenu4", 0x30, 0x40);
    initializeControlColumnShowActions("controlColumnsMenu5", 0x40, 0x50);
    initializeControlColumnShowActions("controlColumnsMenu6", 0x50, 0x60);
    initializeControlColumnShowActions("controlColumnsMenu7", 0x60, 0x70);
    initializeControlColumnShowActions("controlColumnsMenu8", 0x70, 0x80);

    menuViewlet = new MenuViewlet(zonesMenu);

    // Setup zones table view

    connect(&tableDelegate,
            SIGNAL(aftertouchChangeRequest(int, synthclone::MIDIData)),
            SIGNAL(aftertouchChangeRequest(int, synthclone::MIDIData)));
    connect(&tableDelegate,
            SIGNAL(channelChangeRequest(int, synthclone::MIDIData)),
            SIGNAL(channelChangeRequest(int, synthclone::MIDIData)));
    connect(&tableDelegate,
            SIGNAL(channelPressureChangeRequest(int, synthclone::MIDIData)),
            SIGNAL(channelPressureChangeRequest(int, synthclone::MIDIData)));
    connect(&tableDelegate,
            SIGNAL(controlValueChangeRequest(int, synthclone::MIDIData,
                                             synthclone::MIDIData)),
            SIGNAL(controlValueChangeRequest(int, synthclone::MIDIData,
                                             synthclone::MIDIData)));
    connect(&tableDelegate,
            SIGNAL(noteChangeRequest(int, synthclone::MIDIData)),
            SIGNAL(noteChangeRequest(int, synthclone::MIDIData)));
    connect(&tableDelegate,
            SIGNAL(releaseTimeChangeRequest(int, synthclone::SampleTime)),
            SIGNAL(releaseTimeChangeRequest(int, synthclone::SampleTime)));
    connect(&tableDelegate,
            SIGNAL(sampleTimeChangeRequest(int, synthclone::SampleTime)),
            SIGNAL(sampleTimeChangeRequest(int, synthclone::SampleTime)));
    connect(&tableDelegate,
            SIGNAL(velocityChangeRequest(int, synthclone::MIDIData)),
            SIGNAL(velocityChangeRequest(int, synthclone::MIDIData)));

    itemPrototype = new StandardItem();
    connect(&tableModel, SIGNAL(sortRequest(int, bool)),
            SLOT(handleSortRequest(int, bool)));
    tableModel.setColumnCount(ZONETABLECOLUMN_BASE_TOTAL);
    tableModel.setRowCount(0);
    tableModel.setItemPrototype(itemPrototype);
    tableModel.setHeaderData(ZONETABLECOLUMN_AFTERTOUCH, Qt::Horizontal,
                             tr("Aftertouch"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_CHANNEL, Qt::Horizontal,
                             tr("Channel"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_CHANNEL_PRESSURE, Qt::Horizontal,
                             tr("Channel Pressure"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_DRY_SAMPLE, Qt::Horizontal,
                             tr("Dry Sample"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_NOTE, Qt::Horizontal,
                             tr("Note"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_RELEASE_TIME, Qt::Horizontal,
                             tr("Release Time"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_SAMPLE_TIME, Qt::Horizontal,
                             tr("Sample Time"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_STATUS, Qt::Horizontal,
                             tr("Status"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_VELOCITY, Qt::Horizontal,
                             tr("Velocity"), Qt::DisplayRole);
    tableModel.setHeaderData(ZONETABLECOLUMN_WET_SAMPLE, Qt::Horizontal,
                             tr("Wet Sample"), Qt::DisplayRole);
    for (synthclone::MIDIData i = 0; i < 0x80; i++) {
        int column = ZONETABLECOLUMN_CONTROL_0 + i;
        tableModel.setHeaderData(column, Qt::Horizontal,
                                 synthclone::getMIDIControlString(i),
                                 Qt::DisplayRole);
    }

    tableView = synthclone::getChild<QTableView>(mainWindow, "zoneTableView");
    tableView->installEventFilter(&contextMenuEventFilter);
    tableView->setItemDelegate(&tableDelegate);
    tableView->setModel(&tableModel);
    connect(tableView->selectionModel(),
            SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
            SLOT(handleSelectionChange(QItemSelection, QItemSelection)));

    connect(&contextMenuEventFilter, SIGNAL(contextMenuRequest(int, int)),
            SLOT(handleContextMenuRequest(int, int)));

    emitZoneSelectRequest = true;
}