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