1 |
#include "MainView.h" |
#include "MainView.h" |
2 |
|
#include <QApplication> |
3 |
|
#include <QPushButton> |
4 |
|
#include <QLabel> |
5 |
|
#include <QVBoxLayout> |
6 |
|
|
7 |
|
#include <QTimer> |
8 |
|
|
9 |
|
#include "MyWebView.h" |
10 |
|
#include "clientsiderender.h" |
11 |
|
#include "pictureview.h" |
12 |
|
#include "videoview.h" |
13 |
|
|
14 |
MainView::MainView(QWidget* parent) |
MainView::MainView(QWidget* parent) |
15 |
: QWidget(parent) |
: QWidget(parent) |
16 |
{ |
{ |
17 |
this->resize(400,400); |
this->resize(400,400); |
18 |
red = new QWidget(this); |
this->setWindowState( Qt::WindowFullScreen ); |
19 |
red->setPalette( QPalette( Qt::red) ); |
|
20 |
red->setStyleSheet("QComboBox { background-color: blue; }"); |
qApp->setOverrideCursor( QCursor( Qt::BlankCursor) ); |
21 |
red->resize(200,200); |
|
22 |
|
render = new ClientSideRender(this); |
23 |
|
render->setVisible( false ); |
24 |
|
|
25 |
|
web = new MyWebView(this); |
26 |
|
web->setVisible( false); |
27 |
|
|
28 |
|
picture = new PictureView(this); |
29 |
|
picture->setVisible( true ); |
30 |
|
|
31 |
|
video = new VideoView(this); |
32 |
|
video->setVisible(false); |
33 |
|
|
34 |
|
QVBoxLayout* layout = new QVBoxLayout(); |
35 |
|
layout->addWidget(web,1); |
36 |
|
layout->addWidget(render,1); |
37 |
|
layout->addWidget(picture,1); |
38 |
|
layout->addWidget(video,1); |
39 |
|
layout->addStretch(); |
40 |
|
layout->setContentsMargins(0,0,0,0); |
41 |
|
setLayout(layout); |
42 |
|
|
43 |
|
QTimer* timer = new QTimer(this); |
44 |
|
connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); |
45 |
|
timer->start(1000); |
46 |
|
|
47 |
|
web->start(); |
48 |
} |
} |
49 |
|
|
50 |
|
|
51 |
void MainView::onTimer() |
void MainView::onTimer() |
52 |
{ |
{ |
53 |
|
static int count = 0; |
54 |
|
screenManager.timerTick(); |
55 |
|
|
56 |
|
//if (count == 0) |
57 |
|
// video->loadUrl(""); |
58 |
|
|
59 |
|
|
60 |
|
if ( (count%10) == 0) { |
61 |
|
|
62 |
|
int t = count / 10; |
63 |
|
|
64 |
|
if ( (t%2) == 0) { |
65 |
|
picture->loadFromUrl("http://87.104.25.138/infoscreens/data/images/image1.jpg"); |
66 |
|
} else { |
67 |
|
picture->loadFromUrl("http://87.104.25.138/infoscreens/data/images/image2.jpg"); |
68 |
|
} |
69 |
|
} |
70 |
|
count++; |
71 |
} |
} |