Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
skylivex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
astronomy
skylivex
Commits
b1a7bfdd
Commit
b1a7bfdd
authored
Feb 28, 2013
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make youtube work on a single window
parent
09f87a9c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
13 deletions
+63
-13
skproto.cpp
plugins/skproto.cpp
+10
-4
mainwin.cpp
src/mainwin.cpp
+41
-9
mainwin.h
src/mainwin.h
+5
-0
webwin.cpp
src/webwin.cpp
+5
-0
webwin.h
src/webwin.h
+2
-0
No files found.
plugins/skproto.cpp
View file @
b1a7bfdd
...
...
@@ -213,24 +213,30 @@ void SkyliveProtocol::processPackets()
{
SKMessage
mmsg
(
"youtubevideo"
);
//
#if defined(Q_OS_WIN)
#if defined(Q_OS_WIN)
QString
yt
(
"http://youtube.googleapis.com/v/"
);
yt
.
append
(
paramlist
[
0
]);
yt
.
append
(
"?autoplay=1&start="
);
yt
.
append
(
paramlist
[
1
]);
//
#else
#else
//SKMessage mmsg("openurl");
/*
QString
yt
(
"http://www.youtube.com/embed/"
);
yt
.
append
(
paramlist
[
0
]);
yt
.
append
(
"?html5=1&autoplay=1&start="
);
yt
.
append
(
paramlist
[
1
]);
#endif
*/
#endif
mmsg
.
parameters
.
insert
(
"url"
,
yt
);
mmsg
.
parameters
.
insert
(
"volume"
,
paramlist
[
2
]);
sendMessage
(
mmsg
);
}
}
else
if
(
pkt
.
cmd
==
"CLOSEYOUTUBE"
)
{
SKMessage
mmsg
(
"closeyoutube"
);
QList
<
QString
>
paramlist
=
pkt
.
params
.
split
(
PARAM_SEPARATOR
);
mmsg
.
parameters
.
insert
(
"when"
,
paramlist
[
0
]);
sendMessage
(
mmsg
);
}
else
{
std
::
cout
<<
"Unknown command from server"
<<
std
::
endl
;
...
...
src/mainwin.cpp
View file @
b1a7bfdd
...
...
@@ -59,8 +59,10 @@ MainWin::MainWin(QString &htmlfile)
registerHandler
((
QString
)
"openurl"
,
(
SKHandlerFunction
)
&
MainWin
::
handle_openurl
);
registerHandler
((
QString
)
"youtubevideo"
,
(
SKHandlerFunction
)
&
MainWin
::
handle_youtubevideo
);
registerHandler
((
QString
)
"closeyoutube"
,
(
SKHandlerFunction
)
&
MainWin
::
handle_closeyoutube
);
msgsender
=
SENDER
;
yt_is_open
=
false
;
}
...
...
@@ -136,19 +138,49 @@ void MainWin::handle_youtubevideo(SKMessage &msg)
{
if
(
msg
.
parameters
.
contains
(
"url"
))
{
std
::
cout
<<
"OPEN URL "
<<
msg
.
parameters
[
"url"
].
toStdString
()
<<
std
::
endl
;
std
::
cout
<<
"OPEN URL "
<<
msg
.
parameters
[
"url"
].
toStdString
()
<<
std
::
endl
;
//if(msg.parameters.contains("width")
//if(msg.parameters.contains("height);
WebWin
*
wv
=
new
WebWin
();
QWebPage
*
newWeb
=
new
QWebPage
(
wv
);
if
(
!
yt_is_open
)
{
yt
=
new
WebWin
();
yt_is_open
=
true
;
QWebPage
*
newWeb
=
new
QWebPage
(
yt
);
yt
->
setPage
(
newWeb
);
yt
->
setAttribute
(
Qt
::
WA_DeleteOnClose
,
true
);
yt
->
settings
()
->
setAttribute
(
QWebSettings
::
PluginsEnabled
,
true
);
yt
->
settings
()
->
setAttribute
(
QWebSettings
::
JavascriptEnabled
,
true
);
yt
->
setUrl
(
QUrl
(
msg
.
parameters
[
"url"
]));
connect
(
yt
,
SIGNAL
(
closingWindow
()),
this
,
SLOT
(
ytclosesignal
()));
yt
->
show
();
}
else
{
yt
->
setUrl
(
QUrl
(
msg
.
parameters
[
"url"
]));
}
wv
->
setPage
(
newWeb
);
wv
->
setAttribute
(
Qt
::
WA_DeleteOnClose
,
true
);
wv
->
settings
()
->
setAttribute
(
QWebSettings
::
PluginsEnabled
,
true
);
wv
->
settings
()
->
setAttribute
(
QWebSettings
::
JavascriptEnabled
,
true
);
wv
->
setUrl
(
QUrl
(
msg
.
parameters
[
"url"
]));
wv
->
show
();
}
}
}
void
MainWin
::
ytclosesignal
()
{
yt_is_open
=
false
;
}
void
MainWin
::
handle_closeyoutube
(
SKMessage
&
msg
)
{
if
(
msg
.
handle
==
"closeyoutube"
)
{
try
{
if
(
yt_is_open
)
yt
->
close
();
}
catch
(
int
e
)
{
std
::
cout
<<
"ERROR Closing youtube window "
<<
std
::
endl
;
}
}
}
...
...
src/mainwin.h
View file @
b1a7bfdd
...
...
@@ -58,12 +58,17 @@ class MainWin : public SkylivexWin
MainWin
(
QString
&
htmlfile
);
~
MainWin
();
QString
msgsender
;
WebWin
*
yt
;
bool
yt_is_open
;
void
handle_corestarted
(
SKMessage
&
msg
);
void
handle_connected
(
SKMessage
&
msg
);
void
handle_asklogin
(
SKMessage
&
msg
);
void
handle_loginres
(
SKMessage
&
msg
);
void
handle_openurl
(
SKMessage
&
msg
);
void
handle_youtubevideo
(
SKMessage
&
msg
);
void
handle_closeyoutube
(
SKMessage
&
msg
);
public
slots
:
void
ytclosesignal
();
};
...
...
src/webwin.cpp
View file @
b1a7bfdd
...
...
@@ -92,6 +92,11 @@ WebWin::~WebWin()
}
void
WebWin
::
closeEvent
(
QCloseEvent
*
event
)
{
emit
closingWindow
();
}
QWebView
*
WebWin
::
createWindow
(
QWebPage
::
WebWindowType
type
)
{
WebWin
*
wv
=
new
WebWin
;
...
...
src/webwin.h
View file @
b1a7bfdd
...
...
@@ -72,6 +72,7 @@ class WebWin : public QWebView
WebWin
();
WebWin
(
QString
&
htmlfile
);
~
WebWin
();
void
closeEvent
(
QCloseEvent
*
event
);
void
setHtmlFile
(
QString
&
fname
);
void
setHtmlFile
(
QString
&
fname
,
bool
borders
,
bool
transparentbg
);
void
setHtmlCont
(
QString
cont
,
QUrl
baseUrl
,
bool
borders
,
bool
transparentbg
);
...
...
@@ -88,6 +89,7 @@ class WebWin : public QWebView
signals
:
void
putMessage
(
SKMessage
&
msg
);
void
closingWindow
();
// XXX Future usage
//protected:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment