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 |
|
#include <MediaObject> //Phonon |
|
10 |
#include <MediaSource> //Phonon |
#include <MediaSource> //Phonon |
11 |
|
|
12 |
#include <iostream> |
#include "MyWebView.h" |
13 |
using namespace std; |
|
14 |
|
|
|
Phonon::VideoPlayer* video = 0; |
|
15 |
MainView::MainView(QWidget* parent) |
MainView::MainView(QWidget* parent) |
16 |
: QWidget(parent) |
: QWidget(parent) |
17 |
{ |
{ |
18 |
this->resize(400,400); |
this->setWindowState( Qt::WindowFullScreen ); |
19 |
//this->setWindowState( Qt::WindowFullScreen ); |
qApp->setOverrideCursor( QCursor( Qt::BlankCursor) ); |
|
|
|
|
|
|
|
/* red = new QWidget(this); |
|
|
red->setStyleSheet("QWidget { background-color: red; }"); |
|
20 |
|
|
|
green = new QWidget(this); |
|
|
green->setStyleSheet("QWidget { background-color: green; }"); |
|
|
green->setVisible(false); |
|
|
|
|
|
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 ); |
|
21 |
|
|
22 |
|
//Phonon::VideoPlayer* video; |
23 |
|
//video = new Phonon::VideoPlayer(Phonon::VideoCategory, this); |
24 |
|
//video->load( Phonon::MediaSource("http://todic.dk/ps3cache/Inglourious_Basterds_2009.avi") ); |
25 |
|
//layout->addWidget(video,1); |
26 |
|
//video->play(); |
27 |
|
|
28 |
|
web = new MyWebView(this); |
29 |
|
|
30 |
QVBoxLayout* layout = new QVBoxLayout(); |
QVBoxLayout* layout = new QVBoxLayout(); |
31 |
//layout->addWidget(red,1 ); |
layout->addWidget(web,1); |
32 |
//layout->addWidget(green,1); |
|
|
layout->addWidget(video,1); |
|
33 |
layout->addStretch(); |
layout->addStretch(); |
34 |
layout->setContentsMargins(0,0,0,0); |
layout->setContentsMargins(0,0,0,0); |
35 |
setLayout(layout); |
setLayout(layout); |
36 |
|
|
|
|
|
|
|
|
|
|
|
37 |
QTimer* timer = new QTimer(this); |
QTimer* timer = new QTimer(this); |
38 |
connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); |
connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); |
39 |
timer->start(1000); |
timer->start(1000); |
40 |
|
|
41 |
|
|
42 |
|
web->start(); |
43 |
} |
} |
44 |
|
|
45 |
|
|
46 |
void MainView::onTimer() |
void MainView::onTimer() |
47 |
{ |
{ |
48 |
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; |
|
|
}*/ |
|
49 |
} |
} |