5 |
#include <QVBoxLayout> |
#include <QVBoxLayout> |
6 |
|
|
7 |
#include <QTimer> |
#include <QTimer> |
8 |
|
#include <QKeyEvent> |
9 |
|
|
10 |
#include "MyWebView.h" |
#include "MyWebView.h" |
11 |
#include "clientsiderender.h" |
#include "clientsiderender.h" |
16 |
|
|
17 |
|
|
18 |
MainView::MainView(QWidget* parent) |
MainView::MainView(QWidget* parent) |
19 |
: QWidget(parent) |
: QWidget(parent) |
20 |
{ |
{ |
21 |
this->resize(400,400); |
this->resize(400,400); |
22 |
this->setWindowState( Qt::WindowFullScreen ); |
this->setWindowState( Qt::WindowFullScreen ); |
23 |
|
this->grabKeyboard(); |
24 |
|
|
25 |
qApp->setOverrideCursor( QCursor( Qt::BlankCursor) ); |
qApp->setOverrideCursor( QCursor( Qt::BlankCursor) ); |
26 |
|
|
27 |
render = new ClientSideRender(this); |
render = new ClientSideRender(this); |
28 |
render->setVisible( false ); |
render->setVisible( false ); |
29 |
|
|
30 |
web = new MyWebView(this); |
web = new MyWebView(this); |
31 |
web->setVisible( false); |
web->setVisible( false); |
32 |
|
|
33 |
picture = new PictureView(this); |
picture = new PictureView(this); |
34 |
picture->setVisible( false ); |
picture->setVisible( false ); |
35 |
|
|
36 |
video = new VideoView(this); |
video = new VideoView(this); |
37 |
video->setVisible(false); |
video->setVisible(false); |
38 |
|
|
39 |
QVBoxLayout* layout = new QVBoxLayout(); |
QVBoxLayout* layout = new QVBoxLayout(); |
40 |
layout->addWidget(web,1); |
layout->addWidget(web,1); |
41 |
layout->addWidget(render,1); |
layout->addWidget(render,1); |
42 |
layout->addWidget(picture,1); |
layout->addWidget(picture,1); |
43 |
layout->addWidget(video,1); |
layout->addWidget(video,1); |
44 |
layout->addStretch(); |
layout->addStretch(); |
45 |
layout->setContentsMargins(0,0,0,0); |
layout->setContentsMargins(0,0,0,0); |
46 |
setLayout(layout); |
setLayout(layout); |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
QTimer* timer = new QTimer(this); |
QTimer* timer = new QTimer(this); |
51 |
connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); |
connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); |
52 |
timer->start(100); |
timer->start(100); |
53 |
|
|
54 |
} |
} |
55 |
|
|
56 |
|
void MainView::keyPressEvent ( QKeyEvent* event ) |
57 |
|
{ |
58 |
|
int key = event->key(); |
59 |
|
if (key == ' ' || key == Qt::Key_Return || key == Qt::Key_Enter) { |
60 |
|
qApp->quit(); |
61 |
|
} |
62 |
|
} |
63 |
|
|
64 |
void MainView::onTimer() |
void MainView::onTimer() |
65 |
{ |
{ |
104 |
bool found = false; |
bool found = false; |
105 |
int tries = 0; |
int tries = 0; |
106 |
|
|
107 |
if (screenItems.size() > 0) { //only try if we have a any screens |
if (screenItems.size() > 0) { //only try if we have a any screens |
108 |
while (found == false && tries <= screenItems.size()) { //find next with valid display time |
while (found == false && tries <= screenItems.size()) { //find next with valid display time |
109 |
tries++; |
tries++; |
110 |
currentItemIdx = (currentItemIdx+1) % screenItems.size(); |
currentItemIdx = (currentItemIdx+1) % screenItems.size(); |
111 |
currentItem = screenItems.at(currentItemIdx); |
currentItem = screenItems.at(currentItemIdx); |
112 |
|
|
113 |
if (currentItem.start <= now && now <= currentItem.stop ) |
if (currentItem.start <= now && now <= currentItem.stop ) |
114 |
found = true; |
found = true; |
115 |
} |
} |
116 |
} |
} |
117 |
|
|
118 |
if (found) { |
if (found) { |