コード例 #1
0
ファイル: MultimediaWidget.cpp プロジェクト: trueos/lumina
MultimediaWidget::MultimediaWidget(QWidget *parent) : QWidget(parent), ui(new Ui::MultimediaWidget){
  ui->setupUi(this); //load the designer file

  //Add in the special QMultimediaWidgets
  mediaObj = new QMediaPlayer(this);
    mediaObj->setVolume(100);
    mediaObj->setNotifyInterval(500); //only every 1/2 second update
  videoDisplay = new QVideoWidget(this);
    videoDisplay->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    ui->videoLayout->addWidget(videoDisplay);
    mediaObj->setVideoOutput(videoDisplay);
    videoDisplay->setVisible(false);

  UpdateIcons();
  UpdateText();

  //Connect the special signals/slots for the media object
  connect(mediaObj, SIGNAL(durationChanged(qint64)), this, SLOT(playerDurationChanged(qint64)) );
  connect(mediaObj, SIGNAL(seekableChanged(bool)), ui->playerSlider, SLOT(setEnabled(bool)) );
  connect(mediaObj, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(playerStatusChanged(QMediaPlayer::MediaStatus)) );
  connect(mediaObj, SIGNAL(positionChanged(qint64)), this, SLOT(playerTimeChanged(qint64)) );
  connect(mediaObj, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(playerStateChanged(QMediaPlayer::State)) );
  connect(mediaObj, SIGNAL(videoAvailableChanged(bool)), this, SLOT(playerVideoAvailable(bool)) );
  connect(mediaObj, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(playerError()) );

  //Disable some of the initial states
  ui->tool_player_stop->setEnabled(false); //nothing to stop yet
  ui->tool_player_pause->setVisible(false); //nothing to pause yet
  ui->playerSlider->setEnabled(false); //nothing to seek yet
}
コード例 #2
0
PlayerWidget::PlayerWidget(QWidget* parent)
    : QWidget(parent)
    , ui(new Ui::PlayerWidget)
    , songTime(0)
    , mTrackFinishEmitTime(12000)
    , m_CurrentTrack(nullptr)
    , remainCueTime(0)
    , m_isStarted(false)
    , m_isHanging(false)
    , p(new PlayerWidgetPrivate)
{
    ui->setupUi(this);

    p->isEndAnnounced = false;

    //create the player
    player = new Player(this);
    player->prepare();

    ui->butFwd->setIcon(QIcon(":forward.png"));
    ui->butRew->setIcon(QIcon(":backward.png"));
    ui->butPlay->setIcon(QIcon(":play.png"));
    ui->butPlay->setChecked(false);
    ui->butFwd->setIconSize(QSize(26, 26));
    ui->butRew->setIconSize(QSize(26, 26));
    ui->butPlay->setIconSize(QSize(26, 26));
    ui->butCue->setChecked(false);

    vuMeter = ui->vuMeter;
    vuMeter->setOrientation(Qt::Horizontal);
    vuMeter->LevelColorNormal.setRgb(112, 146, 190);
    vuMeter->LevelColorHigh.setRgb(218, 59, 9);
    vuMeter->LevelColorOff.setRgb(31, 45, 65);
    vuMeter->setLinesPerSegment(2);
    vuMeter->setSpacesBetweenSegments(1);
    vuMeter->setSegmentsPerPeak(2);

    timerLevel = new QTimer(this);
    connect(timerLevel, SIGNAL(timeout()), SLOT(timerLevel_timeOut()));

    timerPosition = new QTimer(this);
    connect(timerPosition, SIGNAL(timeout()), SLOT(timerPosition_timeOut()));

    connect(player, SIGNAL(finish()), this, SLOT(playerFinished()));
    connect(player, SIGNAL(error()), this, SLOT(playerError()));
    connect(player, SIGNAL(loadFinished()), this, SLOT(playerLoaded()));

    ui->lblTitle->setText("");
    ui->lblInfo->setText("");

    QFont font = ui->lblInfo->font();
    QFont fonttime = ui->lblTime->font();
#if defined(Q_OS_DARWIN)
    int newSize = font.pointSize() - 4;
    fonttime.setPointSize(fonttime.pointSize() + 2);
#else
    int newSize = font.pointSize() - 1;
#endif
    font.setPointSize(newSize);
    ui->lblInfo->setFont(font);
    ui->lblTime->setFont(fonttime);
    ui->lblTimeRemain->setFont(fonttime);

    m_isStarted = false;
    setAcceptDrops(true);
    this->stop();

    trackanalyser = new TrackAnalyser(this);
    connect(trackanalyser, SIGNAL(finishGain()), this, SLOT(analyseGainFinished()));
}
コード例 #3
0
ファイル: PlayerSetupDialog.cpp プロジェクト: dtbinh/dviz
void PlayerSetupDialog::setCurrentPlayer(PlayerConnection* con)
{
    if(con == m_con)
        return;

    m_stickyConnectionMessage = false;
    if(m_con)
    {
        disconnect(ui->playerName, 0, m_con, 0);
        disconnect(ui->playerHost, 0, m_con, 0);
        disconnect(ui->playerUser, 0, m_con, 0);
        disconnect(ui->playerPass, 0, m_con, 0);
        disconnect(m_con, 0, this, 0);
    }

    if(m_subviewModel)
    {
        delete m_subviewModel;
        m_subviewModel = 0;
    }

    m_con = con;

    if(!con)
    {
        ui->boxConnection->setEnabled(false);
        ui->boxOutput->setEnabled(false);
        ui->boxSubviewOpts->setEnabled(false);
        ui->boxSubviews->setEnabled(false);
        ui->boxKeystone->setEnabled(true);
        return;
    }

    if(con->isConnected())
        conConnected();
    else
        conDisconnected();

    // Set up the UI with values from the player before connecting slots so we dont needlessly update the object
    ui->playerName->setText(con->name());
    ui->playerHost->setText(con->host());
    ui->playerUser->setText(con->user());
    ui->playerPass->setText(con->pass());
    ui->autoconnectBox->setChecked(con->autoconnect());
    ui->optIgnoreAR->setChecked(con->aspectRatioMode() == Qt::IgnoreAspectRatio);

    QRect screen = con->screenRect();
    if(screen.isEmpty())
        con->setScreenRect(screen = QRect(0,0,1024,768));
    ui->outputX->setValue(screen.x());
    ui->outputY->setValue(screen.y());
    ui->outputWidth->setValue(screen.width());
    ui->outputHeight->setValue(screen.height());

    QRect view = con->viewportRect();
    if(view.isEmpty())
        con->setViewportRect(view = QRect(0,0,1000,750));
    ui->viewportX->setValue(view.x());
    ui->viewportY->setValue(view.y());
    ui->viewportWidth->setValue(view.width());
    ui->viewportHeight->setValue(view.height());

    connect(ui->playerName, SIGNAL(textChanged(QString)), con, SLOT(setName(QString)));
    connect(ui->playerHost, SIGNAL(textChanged(QString)), con, SLOT(setHost(QString)));
    connect(ui->playerUser, SIGNAL(textChanged(QString)), con, SLOT(setUser(QString)));
    connect(ui->playerPass, SIGNAL(textChanged(QString)), con, SLOT(setPass(QString)));

    connect(con, SIGNAL(connected()), this, SLOT(conConnected()));
    connect(con, SIGNAL(disconnected()), this, SLOT(conDisconnected()));
    connect(con, SIGNAL(loginSuccess()), this, SLOT(conLoginSuccess()));
    connect(con, SIGNAL(loginFailure()), this, SLOT(conLoginFailure()));
    connect(con, SIGNAL(playerError(QString)), this, SLOT(conPlayerError(QString)));
    connect(con, SIGNAL(pingResponseReceived(QString)), this, SLOT(conPingResponseReceived(QString)));
    connect(con, SIGNAL(testStarted()), this, SLOT(conTestStarted()));
    connect(con, SIGNAL(testEnded()), this, SLOT(conTestEnded()));
    connect(con, SIGNAL(testResults(bool)), this, SLOT(conTestResults(bool)));

    ui->boxConnection->setEnabled(true);
    ui->boxOutput->setEnabled(true);

    m_subviewModel = new PlayerSubviewsModel(con);

    ui->subviewListview->setModel(m_subviewModel);
    ui->subviewListview->setCurrentIndex(m_subviewModel->index(0,0));

    GLWidgetSubview *sub = !con->subviews().isEmpty() ? con->subviews().at(0) : 0;
    if(!sub)
        con->addSubview(sub = new GLWidgetSubview());
    if(sub->title().isEmpty())
        sub->setTitle("Default Subview");

    setCurrentSubview(sub);
}