예제 #1
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
    , _timerVisible(true)
    , _vuPlaying(false)
{
    ui->setupUi(this);

    ui->_fadeDuration->setValue(1.5);
    ui->_fadeDuration->setSingleStep(.1);
    ui->_yellowThreshold->setValue(ui->_timer->yellowThreshold());
    ui->_redThreshold->setValue(ui->_timer->redThreshold());
    recalcLabels();

    // animated timer section
    connect(ui->_start, SIGNAL(clicked()), this, SLOT(onStartClicked()));
    connect(ui->_stop, SIGNAL(clicked()), this, SLOT(onStopClicked()));
    connect(ui->_pause, SIGNAL(clicked()), this, SLOT(onPauseClicked()));
    connect(ui->_fade, SIGNAL(clicked()), this, SLOT(onFadeClicked()));
    connect(ui->_yellowThreshold, SIGNAL(valueChanged(int)), this, SLOT(onYellowChanged(int)));
    connect(ui->_redThreshold, SIGNAL(valueChanged(int)), this, SLOT(onRedChanged(int)));

    // vu meter section
    connect(ui->_dimVU, SIGNAL(clicked()), this, SLOT(onDimVUClicked()));
    connect(ui->_playVU, SIGNAL(clicked()), this, SLOT(onPlayVUClicked()));
    connect(ui->_vuMeter, SIGNAL(selectionChanged(float)), this, SLOT(onSelectionChanged(float)));
}
예제 #2
0
파일: mainwindow.cpp 프로젝트: 5tan/cxxmidi
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , _ui(new Ui::MainWindow)
    , _midiOutput(new CxxMidi::Output::Default(0))
    , _midiPlayer(new CxxMidi::Player::Asynchronous(_midiOutput))
    , _midiFile(0)
    , _sliderLocked(false)
{
    _ui->setupUi(this);

    this->createMenuBar();
    this->centralWidget()->setDisabled(true);
    this->resize(this->minimumSizeHint());

    _midiPlayer->setCallbackHeartbeat(&_playerHeartbeatCallback);
    connect(&_playerHeartbeatCallback,SIGNAL(playerTimeChanged(CxxMidi::Time::Point)),
            this,SLOT(updateTimeCode(CxxMidi::Time::Point)),Qt::QueuedConnection);

    _midiPlayer->setCallbackFinished(&_playerFinishedCallback);
    connect(&_playerFinishedCallback,SIGNAL(playerFinished()),
            this,SLOT(playerFinished()),Qt::QueuedConnection);

    connect(_ui->doubleSpinBoxSpeed,SIGNAL(valueChanged(double)),
            this,SLOT(onSpeedChange(double)));

    connect(_ui->pushButtonPlay,SIGNAL(clicked()),
            this,SLOT(onPlayClicked()));

    connect(_ui->pushButtonPause,SIGNAL(clicked()),
            this,SLOT(onPauseClicked()));

    connect(_ui->sliderTimeline,SIGNAL(sliderPressed()),
            this,SLOT(onTimeSliderPressed()));

    connect(_ui->sliderTimeline,SIGNAL(sliderReleased()),
            this,SLOT(onTimeSliderReleased()));


    // first argument is file name
    if(QApplication::arguments().size() >=2 )
    {
        QString fileName = QApplication::arguments().at(1);
        this->openFile(fileName);
    }

    // second argument is output num
    if(QApplication::arguments().size() >=3)
    {
        int num = QApplication::arguments().at(2).toInt();
        this->setOutput(num);
        _outputsActionGroup->actions()[num]->setChecked(true);
    }

    // auto play
    if( QApplication::arguments().size() >= 2)
        _midiPlayer->play();
}
예제 #3
0
/**
  * \brief Constructor
  * @param type as the media type
  * @param parent as the parent widget
  * @param name as the object name
  */
UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name):UBActionableWidget(parent, name)
  , mpMediaObject(NULL)
  , mpVideoWidget(NULL)
  , mpAudioOutput(NULL)
  , mpLayout(NULL)
  , mpSeekerLayout(NULL)
  , mpPlayStopButton(NULL)
  , mpPauseButton(NULL)
  , mpSlider(NULL)
  , mAutoUpdate(false)
  , mGeneratingThumbnail(false)
  , mBorder(5)
  , mpMediaContainer(NULL)
  , mMediaLayout(NULL)
  , mpCover(NULL)
{
    SET_STYLE_SHEET();

    addAction(eAction_Close);
    mType = type;
    mpLayout = new QVBoxLayout(this);
    setLayout(mpLayout);

    mpPlayStopButton = new UBMediaButton(this);
    mpPlayStopButton->setPixmap(QPixmap(":images/play.svg"));
    mpPauseButton = new UBMediaButton(this);
    mpPauseButton->setPixmap(QPixmap(":images/pause.svg"));
    mpPauseButton->setEnabled(false);
    mpSlider = new QSlider(this);
    mpSlider->setOrientation(Qt::Horizontal);
    mpSlider->setMinimum(0);
    mpSlider->setMaximum(0);

    mpSeekerLayout = new QHBoxLayout();
    mpSeekerLayout->addWidget(mpPlayStopButton, 0);
    mpSeekerLayout->addWidget(mpPauseButton, 0);
    mpSeekerLayout->addWidget(mpSlider, 1);
    mpSeekerLayout->setContentsMargins(0, 0, 0, 0);

    connect(mpPlayStopButton, SIGNAL(clicked()), this, SLOT(onPlayStopClicked()));
    connect(mpPauseButton, SIGNAL(clicked()), this, SLOT(onPauseClicked()));
    connect(mpSlider, SIGNAL(valueChanged(int)), this, SLOT(onSliderChanged(int)));
}