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 "pictureview.h" |
15 |
|
|
|
#include <iostream> |
|
|
using namespace std; |
|
16 |
|
|
|
Phonon::VideoPlayer* video = 0; |
|
17 |
MainView::MainView(QWidget* parent) |
MainView::MainView(QWidget* parent) |
18 |
: QWidget(parent) |
: QWidget(parent) |
19 |
{ |
{ |
20 |
this->resize(400,400); |
this->resize(400,400); |
21 |
//this->setWindowState( Qt::WindowFullScreen ); |
this->setWindowState( Qt::WindowFullScreen ); |
22 |
|
|
23 |
|
qApp->setOverrideCursor( QCursor( Qt::BlankCursor) ); |
24 |
|
|
25 |
/* red = new QWidget(this); |
|
26 |
red->setStyleSheet("QWidget { background-color: red; }"); |
//Phonon::VideoPlayer* video; |
27 |
|
//video = new Phonon::VideoPlayer(Phonon::VideoCategory, this); |
28 |
|
//video->load( Phonon::MediaSource("http://todic.dk/ps3cache/Inglourious_Basterds_2009.avi") ); |
29 |
|
//layout->addWidget(video,1); |
30 |
|
//video->play(); |
31 |
|
|
32 |
green = new QWidget(this); |
render = new ClientSideRender(this); |
33 |
green->setStyleSheet("QWidget { background-color: green; }"); |
render->setVisible( false ); |
34 |
green->setVisible(false); |
|
35 |
|
web = new MyWebView(this); |
36 |
|
web->setVisible( false); |
37 |
|
|
38 |
|
picture = new PictureView(this); |
39 |
|
picture->setVisible( true ); |
40 |
|
|
|
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 ); |
|
|
|
|
41 |
|
|
42 |
|
|
43 |
QVBoxLayout* layout = new QVBoxLayout(); |
QVBoxLayout* layout = new QVBoxLayout(); |
44 |
//layout->addWidget(red,1 ); |
layout->addWidget(web,1); |
45 |
//layout->addWidget(green,1); |
layout->addWidget(render,1); |
46 |
layout->addWidget(video,1); |
layout->addWidget(picture,1); |
47 |
layout->addStretch(); |
layout->addStretch(); |
48 |
layout->setContentsMargins(0,0,0,0); |
layout->setContentsMargins(0,0,0,0); |
49 |
setLayout(layout); |
setLayout(layout); |
|
|
|
|
|
|
|
|
|
50 |
|
|
51 |
QTimer* timer = new QTimer(this); |
QTimer* timer = new QTimer(this); |
52 |
connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); |
connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); |
53 |
timer->start(1000); |
timer->start(1000); |
54 |
|
|
55 |
|
web->start(); |
56 |
} |
} |
57 |
|
|
58 |
|
|
59 |
void MainView::onTimer() |
void MainView::onTimer() |
60 |
{ |
{ |
61 |
cout << "timer" << endl; |
static int count = 0; |
62 |
if (!video->isPlaying() ) { |
screenManager.timerTick(); |
63 |
video->play(); |
|
64 |
cout << "starting" << endl; |
if ( (count%10) == 0) { |
65 |
} |
|
66 |
|
int t = count / 10; |
67 |
/* |
qDebug() << t; |
68 |
if( current == red) { |
if ( (t%2) == 0) { |
69 |
red->setVisible(false); |
picture->loadFromUrl("http://87.104.25.138/infoscreens/data/images/image1.jpg"); |
70 |
green->setVisible(true); |
} else { |
71 |
current = green; |
picture->loadFromUrl("http://87.104.25.138/infoscreens/data/images/image2.jpg"); |
72 |
} else { |
} |
73 |
red->setVisible(true); |
} |
74 |
green->setVisible(false); |
count++; |
|
current = red; |
|
|
}*/ |
|
75 |
} |
} |