void MainWindow::captureVideo()
{
    capture.open(0);
    resize(1023,546);
    setEditEnable(true);
    timer->start(33);
}
void MainWindow::open()
{
    QString fileName = QFileDialog::getOpenFileName(this,tr("open a video file"),".",
                                                    tr("video files (*.avi *.mp4 *.mp3 *.jpg)"));
    if(!fileName.isEmpty())
    {
        capture.open(fileName.toStdString());
        resize(1023,546);
        setEditEnable(true);
        timer->start(33);
    }
}
Пример #3
0
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: noteOn((*reinterpret_cast< const int(*)>(_a[1]))); break;
        case 1: noteOff((*reinterpret_cast< const int(*)>(_a[1]))); break;
        case 2: pauseActive((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: setChannelChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 4: setVelocityChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 5: setBase_octaveChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 6: setTransposeChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: setEditEnable((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 8: editChord((*reinterpret_cast< QPoint(*)>(_a[1]))); break;
        case 9: on_actionOpenMidi_triggered(); break;
        case 10: on_actionOpen_triggered(); break;
        case 11: on_actionPlayMidi_triggered(); break;
        case 12: on_btn_9_clicked(); break;
        case 13: on_btn_8_clicked(); break;
        case 14: on_btn_7_clicked(); break;
        case 15: on_btn_6_clicked(); break;
        case 16: on_btn_5_clicked(); break;
        case 17: on_btn_4_clicked(); break;
        case 18: on_btn_3_clicked(); break;
        case 19: on_btn_2_clicked(); break;
        case 20: on_btn_1_clicked(); break;
        case 21: on_btn_0_clicked(); break;
        case 22: on_chordAnalyse_triggered(); break;
        case 23: on_redoAction_triggered(); break;
        case 24: on_undoAction_triggered(); break;
        case 25: on_actionSave_triggered(); break;
        case 26: on_actionMIDI_controller_triggered((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 27: saveStaff(); break;
        case 28: loadStaff((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 29: processFinished((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QProcess::ExitStatus(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 30;
    }
    return _id;
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    ui = new Ui_MainWindow;
    ui->setupUi(this);

    putmark = false;

    ui->label->setFixedSize(800,450);

    openAction = new QAction(tr("&Open"),this);
    openAction->setStatusTip(tr("open an exited file"));
    openAction->setShortcut(QKeySequence::Open);
    connect(openAction,SIGNAL(triggered(bool)),this,SLOT(open()));

    captureAction = new QAction(tr("&capture"),this);
    captureAction->setStatusTip(tr("capture the video."));
    captureAction->setShortcut(QKeySequence::New);
    connect(captureAction,SIGNAL(triggered(bool)),this,SLOT(captureVideo()));

    aboutAction = new QAction(tr("aboutQt"),this);
    connect(aboutAction,SIGNAL(triggered(bool)),qApp,SLOT(aboutQt()));

    ui->menuFile->addAction(openAction);
    ui->menuFile->addAction(captureAction);
    ui->menuHelp->addAction(aboutAction);

    connect(ui->okButton,SIGNAL(clicked(bool)),this,SLOT(putWaterMark()));
    connect(ui->startButton,SIGNAL(clicked(bool)),this,SLOT(startSave()));
    connect(ui->stopButton,SIGNAL(clicked(bool)),this,SLOT(stopSave()));
    setEditEnable(false);

    timer = new QTimer ;
    connect(timer,SIGNAL(timeout()),this,SLOT(changeFrame()));

    save = STOP;
}