Exemplo n.º 1
0
bool HelloWorld::on_timer_update_image()
{
    Glib::RefPtr<Gdk::Window> win = get_window();
    if (win)
    {
        Gdk::Rectangle r(0, 0, m_VW.get_width(), m_VW.get_height());
        win->invalidate_rect(r, true);
    }
	return true;
}
Exemplo n.º 2
0
bool HelloWorld::on_timer_update_image()
{
    Glib::RefPtr<Gdk::Window> win = get_window();
    if (win)
    {
    	int top_x, top_y, bottom_x, bottom_y;

    	m_VW.translate_coordinates(*this, 0, 0, top_x, top_y);
    	m_VW.translate_coordinates(*this, m_VW.get_width(), m_VW.get_height(), bottom_x, bottom_y);
        Gdk::Rectangle r(top_x, top_y, bottom_x, bottom_y);
        win->invalidate_rect(r, true);
    }
	return true;
}
VideoWidget *
XinePlayerBackend::initialize(QWidget *videoWidgetParent)
{
	XineVideoLayerWidget *videoLayer = new XineVideoLayerWidget(0);
	VideoWidget *videoWidget = new VideoWidget(videoLayer, videoWidgetParent);
	if(!initializeXine(videoWidget->videoLayer()->winId())) {
		delete videoWidget;
		finalizeXine();
		kError() << "xine initialization failed!";
		return 0;
	}

	videoLayer->setVideoDriver(m_videoDriver);
	connect(videoLayer, SIGNAL(geometryChanged()), this, SLOT(onVideoLayerGeometryChanged()));

	return videoWidget;
}
Exemplo n.º 4
0
QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args)
{
    TRACE_CONTEXT(Backend::createObject, EBackend);
    TRACE_ENTRY("class %d", c);

    QObject* result = 0;

    switch (c) {
    case AudioOutputClass:
        result = new AudioOutput(this, parent);
        break;

    case MediaObjectClass:
        result = new MediaObject(parent);
        break;

    case VolumeFaderEffectClass:
    case VisualizationClass:
    case VideoDataOutputClass:
    case EffectClass:
    {
        Q_ASSERT(args.count() == 1);
        Q_ASSERT(args.first().type() == QVariant::Int);
        const EffectFactory::Type type =
            static_cast<EffectFactory::Type>(args.first().toInt());
        return m_effectFactory->createAudioEffect(type, parent);
    }

    case VideoWidgetClass:
    {
        VideoWidget *widget = new VideoWidget(qobject_cast<QWidget *>(parent));
#ifndef PHONON_MMF_VIDEO_SURFACES
        widget->setAncestorMoveMonitor(m_ancestorMoveMonitor.data());
#endif
        result = widget;
    }
        break;

    default:
        TRACE_PANIC(InvalidBackendInterfaceClass);
    }

    TRACE_RETURN("0x%08x", result);
}
VideoPlayer::VideoPlayer(QWidget *parent)
    : QWidget(parent)
    , mediaPlayer(0, QMediaPlayer::VideoSurface)
    , playButton(0)
    , positionSlider(0)
{
    VideoWidget *videoWidget = new VideoWidget;

    QAbstractButton *openButton = new QPushButton(tr("Open..."));
    connect(openButton, SIGNAL(clicked()), this, SLOT(openFile()));

    playButton = new QPushButton;
    playButton->setEnabled(false);
    playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));

    connect(playButton, SIGNAL(clicked()),
            this, SLOT(play()));

    positionSlider = new QSlider(Qt::Horizontal);
    positionSlider->setRange(0, 0);

    connect(positionSlider, SIGNAL(sliderMoved(int)),
            this, SLOT(setPosition(int)));

    QBoxLayout *controlLayout = new QHBoxLayout;
    controlLayout->setMargin(0);
    controlLayout->addWidget(openButton);
    controlLayout->addWidget(playButton);
    controlLayout->addWidget(positionSlider);

    QBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(videoWidget);
    layout->addLayout(controlLayout);

    setLayout(layout);

    mediaPlayer.setVideoOutput(videoWidget->videoSurface());
    connect(&mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)),
            this, SLOT(mediaStateChanged(QMediaPlayer::State)));
    connect(&mediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
    connect(&mediaPlayer, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
}
Exemplo n.º 6
0
void CPlayerList::start()
{

  QSettings settings(QCoreApplication::applicationDirPath () + "/config.ini",
                    QSettings::IniFormat);

  scene = new QGraphicsScene(desk.screenGeometry(), this);
  scene->setBackgroundBrush(Qt::black);


  if( settings.value("displayDefaultImage",true).toBool() )
  {
    CImage *image = new CImage(QPixmap(":/images/horux.png"));
    image->setDuration(5000);
    mediaList << image;

    connect(image, SIGNAL(finished()), this, SLOT(playNext()));
  }

  splash = new SplashItem();
  splash->setZValue(5);
  splash->setPos(100, scene->sceneRect().top());
  scene->addItem(splash);

  myview = new QGraphicsView(scene);
  myview->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  myview->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  myview->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
  myview->setFrameShadow(QFrame::Plain);
  myview->setFrameShape(QFrame::NoFrame);
  myview->showFullScreen();
  myview->setCursor( QCursor( Qt::BlankCursor ) );



  QString mediaPath = settings.value("media_path","").toString();

  QSqlQuery query("SELECT * FROM hr_horux_media_media WHERE published=1 AND id_device=" + deviceId + " ORDER by `order`");
  while(query.next())
  {
    QString type = query.value(2).toString();
    QString path = mediaPath + query.value(3).toString();

    int time = query.value(4).toInt();
    QFile file(path);
    if(file.exists())
    {
      if(type == "IMAGE")
      {
        CImage *image = new CImage(QPixmap(path));
        image->setDuration(time * 1000);
        mediaList << image;
      
        connect(image, SIGNAL(finished()), this, SLOT(playNext()));
      }
      
      if(type == "MOVIE")
      {
        VideoWidget *video = new VideoWidget();
      
        video->setDuration(time * 1000);
        video->setMedia(path);

        mediaList << video;
  
        connect(video, SIGNAL(finished()), this, SLOT(playNext()));
      }
    }
  }


  if(mediaList.count() == 0)
  {
    CImage *image = new CImage(QPixmap(":/images/horux.png"));
    image->setDuration(5000);
    mediaList << image;

    connect(image, SIGNAL(finished()), this, SLOT(playNext()));
  }

  group = new QtStateGroup(scene);

  createTransition();

  stateList.at(0)->activate();

  isStart = true;

  if(mediaList.size() > 0)
  {
    index = 0;
    playNext();
  }
}
Exemplo n.º 7
0
void HelloWorld::on_button_clicked()
{
	cout << "on_button_click" << endl;
	cout << m_VW.get_width() << " " << m_VW.get_height() << endl;
}
Exemplo n.º 8
0
 void keyPressEvent( QKeyEvent *e )
 {
     emit owner->keyPressed( e );
 }