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
ad8a46b4
Commit
ad8a46b4
authored
Feb 25, 2013
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Permit opening subwindow from js with SkyliveX object working
parent
018ad60b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
17 deletions
+55
-17
SkyliveX.js
gui/SkyliveX.js
+14
-17
webwin.cpp
src/webwin.cpp
+38
-0
webwin.h
src/webwin.h
+3
-0
No files found.
gui/SkyliveX.js
View file @
ad8a46b4
function
skyliveClass
()
{}
function
skyliveClass
()
{}
skyliveClass
.
prototype
.
method
=
function
(
name
,
func
){
skyliveClass
.
prototype
.
changeContent
=
function
(
id
,
content
){
this
.
prototype
[
name
]
=
func
;
return
this
;
}
skyliveClass
.
method
(
'changeContent'
,
function
(
id
,
content
){
var
n
=
document
.
getElementById
(
id
);
var
n
=
document
.
getElementById
(
id
);
if
(
typeof
(
n
)
!=
"undefined"
)
if
(
typeof
(
n
)
!=
"undefined"
)
n
.
innerHTML
=
content
;
n
.
innerHTML
=
content
;
}
)
;
};
skyliveClass
.
method
(
'notify'
,
function
(
content
){
skyliveClass
.
prototype
.
notify
=
function
(
content
){
if
(
typeof
(
notifycb
)
==
"function"
)
if
(
typeof
(
notifycb
)
==
"function"
)
notifycb
(
content
);
notifycb
(
content
);
}
)
;
};
skyliveClass
.
method
(
'msgalert'
,
function
(
content
){
skyliveClass
.
prototype
.
msgalert
=
function
(
content
){
if
(
typeof
(
alertcb
)
==
"function"
)
if
(
typeof
(
alertcb
)
==
"function"
)
alertcb
(
content
);
alertcb
(
content
);
//else
//else
// alert(content);
// alert(content);
}
)
;
};
skyliveClass
.
method
(
'publicReceived'
,
function
(
user
,
msg
){
skyliveClass
.
prototype
.
publicReceived
=
function
(
user
,
msg
){
if
(
typeof
(
public_received
)
==
"function"
)
if
(
typeof
(
public_received
)
==
"function"
)
{
{
public_received
(
user
,
msg
);
public_received
(
user
,
msg
);
...
@@ -32,9 +28,10 @@ skyliveClass.method('publicReceived', function(user, msg){
...
@@ -32,9 +28,10 @@ skyliveClass.method('publicReceived', function(user, msg){
n
.
scollTop
=
n
.
scrollHeight
;
n
.
scollTop
=
n
.
scrollHeight
;
}
}
}
}
});
};
SkyliveX
.
page
=
new
SkyliveClass
();
SkyliveX
.
changeContent
.
connect
(
SkyliveX
.
page
.
changeContent
);
SkyliveXPage
=
new
skyliveClass
();
SkyliveX
.
notify
.
connect
(
SkyliveX
.
page
.
notify
);
SkyliveX
.
changeContent
.
connect
(
SkyliveXPage
.
changeContent
);
SkyliveX
.
alertmsg
.
connect
(
SkyliveX
.
page
.
msgalert
);
SkyliveX
.
notify
.
connect
(
SkyliveXPage
.
notify
);
SkyliveX
.
public_received
.
connect
(
SkyliveX
.
page
.
publicReceived
);
SkyliveX
.
alertmsg
.
connect
(
SkyliveXPage
.
msgalert
);
SkyliveX
.
public_received
.
connect
(
SkyliveXPage
.
publicReceived
);
src/webwin.cpp
View file @
ad8a46b4
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
*/
*/
#include "webwin.h"
#include "webwin.h"
#include <QWebView>
#include <QWebView>
#include <QWebPage>
#include <QWebFrame>
#include <QWebFrame>
#include <QFile>
#include <QFile>
#include <QUrl>
#include <QUrl>
...
@@ -44,6 +45,7 @@
...
@@ -44,6 +45,7 @@
#include <iostream>
#include <iostream>
#include "ipcmsg.h"
#include "ipcmsg.h"
#include "jsbridge.h"
#include "jsbridge.h"
#include "QWebSettings"
#define SENDER "webwin"
#define SENDER "webwin"
...
@@ -52,6 +54,10 @@ WebWin::WebWin(QString &htmlfile)
...
@@ -52,6 +54,10 @@ WebWin::WebWin(QString &htmlfile)
{
{
baseUrl
=
QUrl
::
fromLocalFile
(
QDir
::
current
().
absoluteFilePath
(
"gui/dummy.html"
));
baseUrl
=
QUrl
::
fromLocalFile
(
QDir
::
current
().
absoluteFilePath
(
"gui/dummy.html"
));
settings
()
->
setAttribute
(
QWebSettings
::
JavascriptCanOpenWindows
,
true
);
settings
()
->
setAttribute
(
QWebSettings
::
JavascriptCanCloseWindows
,
true
);
//settings->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
QPalette
pal
=
palette
();
QPalette
pal
=
palette
();
pal
.
setBrush
(
QPalette
::
Base
,
Qt
::
transparent
);
pal
.
setBrush
(
QPalette
::
Base
,
Qt
::
transparent
);
...
@@ -74,11 +80,43 @@ WebWin::WebWin(QString &htmlfile)
...
@@ -74,11 +80,43 @@ WebWin::WebWin(QString &htmlfile)
}
}
WebWin
::
WebWin
()
:
QWebView
()
{
baseUrl
=
QUrl
::
fromLocalFile
(
QDir
::
current
().
absoluteFilePath
(
"gui/dummy.html"
));
settings
()
->
setAttribute
(
QWebSettings
::
JavascriptCanOpenWindows
,
true
);
settings
()
->
setAttribute
(
QWebSettings
::
JavascriptCanCloseWindows
,
true
);
jsbridge
=
new
JSBridge
();
jsbridge
->
wwin
=
qobject_cast
<
WebWin
*>
(
this
);
page
()
->
mainFrame
()
->
addToJavaScriptWindowObject
(
"SkyliveX"
,
jsbridge
);
connect
(
page
()
->
mainFrame
(),
SIGNAL
(
javaScriptWindowObjectCleared
()),
this
,
SLOT
(
refreshJsObject
()));
msgsender
=
SENDER
;
}
WebWin
::~
WebWin
()
WebWin
::~
WebWin
()
{
{
}
}
QWebView
*
WebWin
::
createWindow
(
QWebPage
::
WebWindowType
type
)
{
WebWin
*
wv
=
new
WebWin
;
QWebPage
*
newWeb
=
new
QWebPage
(
wv
);
wv
->
jsbridge
=
new
JSBridge
();
newWeb
->
mainFrame
()
->
addToJavaScriptWindowObject
(
"SkyliveX"
,
wv
->
jsbridge
);
connect
(
newWeb
->
mainFrame
(),
SIGNAL
(
javaScriptWindowObjectCleared
()),
wv
,
SLOT
(
refreshJsObject
()));
wv
->
setPage
(
newWeb
);
wv
->
setAttribute
(
Qt
::
WA_DeleteOnClose
,
true
);
if
(
type
==
QWebPage
::
WebModalDialog
)
wv
->
setWindowModality
(
Qt
::
ApplicationModal
);
wv
->
show
();
return
wv
;
}
// XXX This can be used in future to permit
// XXX This can be used in future to permit
// to drag a window borderless on the desktop.
// to drag a window borderless on the desktop.
/*
/*
...
...
src/webwin.h
View file @
ad8a46b4
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#define WEBWIN_H
#define WEBWIN_H
#include <QWebView>
#include <QWebView>
#include <QWebPage>
#include <QUrl>
#include <QUrl>
#include <QFile>
#include <QFile>
#include <QHash>
#include <QHash>
...
@@ -69,6 +70,7 @@ class WebWin : public QWebView
...
@@ -69,6 +70,7 @@ class WebWin : public QWebView
QHash
<
QString
,
SKHandlerFunction
>
_handlers
;
QHash
<
QString
,
SKHandlerFunction
>
_handlers
;
public
:
public
:
WebWin
();
WebWin
(
QString
&
htmlfile
);
WebWin
(
QString
&
htmlfile
);
~
WebWin
();
~
WebWin
();
void
setHtmlFile
(
QString
&
fname
);
void
setHtmlFile
(
QString
&
fname
);
...
@@ -78,6 +80,7 @@ class WebWin : public QWebView
...
@@ -78,6 +80,7 @@ class WebWin : public QWebView
void
registerHandler
(
QString
type
,
SKHandlerFunction
handler
);
void
registerHandler
(
QString
type
,
SKHandlerFunction
handler
);
void
toggleBorders
(
bool
borders
);
void
toggleBorders
(
bool
borders
);
void
toggleTransparentBackground
(
bool
transparentbg
);
void
toggleTransparentBackground
(
bool
transparentbg
);
QWebView
*
createWindow
(
QWebPage
::
WebWindowType
type
);
JSBridge
*
jsbridge
;
JSBridge
*
jsbridge
;
QString
msgsender
;
QString
msgsender
;
...
...
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