/[projects]/infoscreen/mainview.cpp
ViewVC logotype

Annotation of /infoscreen/mainview.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 511 - (hide annotations) (download)
Mon Dec 14 13:38:55 2009 UTC (14 years, 5 months ago) by torben
Original Path: infoscreen/MainView.cpp
File size: 1486 byte(s)
Work in progress, but phonon works :)
1 torben 509 #include "MainView.h"
2 torben 510 #include <QPushButton>
3     #include <QVBoxLayout>
4 torben 509
5 torben 510 #include <QTimer>
6    
7 torben 511 #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 torben 509 MainView::MainView(QWidget* parent)
16     : QWidget(parent)
17     {
18     this->resize(400,400);
19 torben 511 //this->setWindowState( Qt::WindowFullScreen );
20 torben 510
21    
22 torben 511 /* red = new QWidget(this);
23 torben 510 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 torben 511 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 torben 510
37 torben 511
38 torben 510 QVBoxLayout* layout = new QVBoxLayout();
39 torben 511 //layout->addWidget(red,1 );
40     //layout->addWidget(green,1);
41     layout->addWidget(video,1);
42 torben 510 layout->addStretch();
43     layout->setContentsMargins(0,0,0,0);
44     setLayout(layout);
45    
46 torben 511
47 torben 510
48    
49     QTimer* timer = new QTimer(this);
50     connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() ));
51 torben 511 timer->start(1000);
52 torben 509 }
53    
54    
55     void MainView::onTimer()
56     {
57 torben 511 cout << "timer" << endl;
58     if (!video->isPlaying() ) {
59     video->play();
60     cout << "starting" << endl;
61     }
62    
63     /*
64 torben 510 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 torben 511 }*/
73 torben 509 }

  ViewVC Help
Powered by ViewVC 1.1.20