1 |
#include "MainView.h" |
#include "MainView.h" |
2 |
|
#include <QPushButton> |
3 |
|
#include <QVBoxLayout> |
4 |
|
|
5 |
|
#include <QTimer> |
6 |
|
|
7 |
|
#include <VideoPlayer> //Phonon |
8 |
|
#include <MediaObject> //Phonon |
9 |
|
#include <MediaSource> //Phonon |
10 |
|
|
11 |
|
#include <iostream> |
12 |
|
using namespace std; |
13 |
|
|
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->resize(400,400); |
19 |
red = new QWidget(this); |
//this->setWindowState( Qt::WindowFullScreen ); |
20 |
red->setPalette( QPalette( Qt::red) ); |
|
21 |
red->setStyleSheet("QComboBox { background-color: blue; }"); |
|
22 |
red->resize(200,200); |
/* red = new QWidget(this); |
23 |
|
red->setStyleSheet("QWidget { background-color: red; }"); |
24 |
|
|
25 |
|
green = new QWidget(this); |
26 |
|
green->setStyleSheet("QWidget { background-color: green; }"); |
27 |
|
green->setVisible(false); |
28 |
|
|
29 |
|
current = red;*/ |
30 |
|
|
31 |
|
video = new Phonon::VideoPlayer(Phonon::VideoCategory, this); |
32 |
|
Phonon::MediaSource* source = new Phonon::MediaSource("http://todic.dk/ps3cache/Inglourious_Basterds_2009.avi"); |
33 |
|
|
34 |
|
video->load( *source ); |
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
QVBoxLayout* layout = new QVBoxLayout(); |
39 |
|
//layout->addWidget(red,1 ); |
40 |
|
//layout->addWidget(green,1); |
41 |
|
layout->addWidget(video,1); |
42 |
|
layout->addStretch(); |
43 |
|
layout->setContentsMargins(0,0,0,0); |
44 |
|
setLayout(layout); |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
QTimer* timer = new QTimer(this); |
50 |
|
connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); |
51 |
|
timer->start(1000); |
52 |
} |
} |
53 |
|
|
54 |
|
|
55 |
void MainView::onTimer() |
void MainView::onTimer() |
56 |
{ |
{ |
57 |
|
cout << "timer" << endl; |
58 |
|
if (!video->isPlaying() ) { |
59 |
|
video->play(); |
60 |
|
cout << "starting" << endl; |
61 |
|
} |
62 |
|
|
63 |
|
/* |
64 |
|
if( current == red) { |
65 |
|
red->setVisible(false); |
66 |
|
green->setVisible(true); |
67 |
|
current = green; |
68 |
|
} else { |
69 |
|
red->setVisible(true); |
70 |
|
green->setVisible(false); |
71 |
|
current = red; |
72 |
|
}*/ |
73 |
} |
} |