1 |
#include "MainView.h" |
#include "MainView.h" |
2 |
|
#include <QApplication> |
3 |
#include <QPushButton> |
#include <QPushButton> |
4 |
|
#include <QLabel> |
5 |
#include <QVBoxLayout> |
#include <QVBoxLayout> |
6 |
|
|
7 |
#include <QTimer> |
#include <QTimer> |
8 |
|
|
9 |
#include <VideoPlayer> //Phonon |
//#include <VideoPlayer> //Phonon |
10 |
#include <MediaObject> //Phonon |
//#include <MediaSource> //Phonon |
11 |
#include <MediaSource> //Phonon |
|
12 |
|
#include "MyWebView.h" |
13 |
|
#include "clientsiderender.h" |
14 |
|
|
|
#include <iostream> |
|
|
using namespace std; |
|
15 |
|
|
|
Phonon::VideoPlayer* video = 0; |
|
16 |
MainView::MainView(QWidget* parent) |
MainView::MainView(QWidget* parent) |
17 |
: QWidget(parent) |
: QWidget(parent) |
18 |
{ |
{ |
19 |
this->resize(400,400); |
this->resize(400,400); |
20 |
//this->setWindowState( Qt::WindowFullScreen ); |
this->setWindowState( Qt::WindowFullScreen ); |
|
|
|
|
|
|
|
/* red = new QWidget(this); |
|
|
red->setStyleSheet("QWidget { background-color: red; }"); |
|
21 |
|
|
22 |
green = new QWidget(this); |
// qApp->setOverrideCursor( QCursor( Qt::BlankCursor) ); |
|
green->setStyleSheet("QWidget { background-color: green; }"); |
|
|
green->setVisible(false); |
|
23 |
|
|
|
current = red;*/ |
|
|
|
|
|
video = new Phonon::VideoPlayer(Phonon::VideoCategory, this); |
|
|
Phonon::MediaSource* source = new Phonon::MediaSource("http://todic.dk/ps3cache/Inglourious_Basterds_2009.avi"); |
|
|
|
|
|
video->load( *source ); |
|
24 |
|
|
25 |
|
//Phonon::VideoPlayer* video; |
26 |
|
//video = new Phonon::VideoPlayer(Phonon::VideoCategory, this); |
27 |
|
//video->load( Phonon::MediaSource("http://todic.dk/ps3cache/Inglourious_Basterds_2009.avi") ); |
28 |
|
//layout->addWidget(video,1); |
29 |
|
//video->play(); |
30 |
|
|
31 |
|
render = new ClientSideRender(this); |
32 |
|
render->setVisible( false ); |
33 |
|
web = new MyWebView(this); |
34 |
|
web->setVisible( true); |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
QVBoxLayout* layout = new QVBoxLayout(); |
QVBoxLayout* layout = new QVBoxLayout(); |
39 |
//layout->addWidget(red,1 ); |
layout->addWidget(web,1); |
40 |
//layout->addWidget(green,1); |
layout->addWidget(render,1); |
|
layout->addWidget(video,1); |
|
41 |
layout->addStretch(); |
layout->addStretch(); |
42 |
layout->setContentsMargins(0,0,0,0); |
layout->setContentsMargins(0,0,0,0); |
43 |
setLayout(layout); |
setLayout(layout); |
|
|
|
|
|
|
|
|
|
44 |
|
|
45 |
QTimer* timer = new QTimer(this); |
QTimer* timer = new QTimer(this); |
46 |
connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); |
connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); |
47 |
timer->start(1000); |
timer->start(1000); |
48 |
|
|
49 |
|
web->start(); |
50 |
} |
} |
51 |
|
|
52 |
|
|
53 |
void MainView::onTimer() |
void MainView::onTimer() |
54 |
{ |
{ |
55 |
cout << "timer" << endl; |
screenManager.timerTick(); |
|
if (!video->isPlaying() ) { |
|
|
video->play(); |
|
|
cout << "starting" << endl; |
|
|
} |
|
|
|
|
|
/* |
|
|
if( current == red) { |
|
|
red->setVisible(false); |
|
|
green->setVisible(true); |
|
|
current = green; |
|
|
} else { |
|
|
red->setVisible(true); |
|
|
green->setVisible(false); |
|
|
current = red; |
|
|
}*/ |
|
56 |
} |
} |