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
d1b20502
Commit
d1b20502
authored
Feb 27, 2013
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finally, multiple window message are working
parent
620e5057
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
9 deletions
+40
-9
skylivex.pro.user
skylivex.pro.user
+1
-1
ipcmsg.cpp
src/ipcmsg.cpp
+9
-0
ipcmsg.h
src/ipcmsg.h
+6
-0
main.cpp
src/main.cpp
+2
-2
skylivex.cpp
src/skylivex.cpp
+10
-4
skylivex.h
src/skylivex.h
+2
-2
webwin.cpp
src/webwin.cpp
+10
-0
No files found.
skylivex.pro.user
View file @
d1b20502
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by Qt Creator 2.6.1, 2013-02-2
4T21:44:10
. -->
<!-- Written by Qt Creator 2.6.1, 2013-02-2
7T02:00:05
. -->
<qtcreator>
<data>
<variable>
ProjectExplorer.Project.ActiveTarget
</variable>
...
...
src/ipcmsg.cpp
View file @
d1b20502
...
...
@@ -91,3 +91,12 @@ SKMessage::SKMessage(const SKMessage &other)
time
=
other
.
time
;
}
SKMessage
::
SKMessage
(
QString
h
,
SkylivexWin
*
win
)
{
sender
=
QString
(
"unknown"
);
handle
=
h
;
webwin
=
win
;
time
=
QTime
::
currentTime
();
}
src/ipcmsg.h
View file @
d1b20502
...
...
@@ -40,6 +40,10 @@
#include <QHash>
#include <QString>
// Forward declarations
class
SkylivexWin
;
/*
* SKMessage
* An object representing an IPC message
...
...
@@ -56,12 +60,14 @@ class SKMessage
QTime
time
;
QString
sender
;
QString
handle
;
SkylivexWin
*
webwin
;
QHash
<
QString
,
QString
>
parameters
;
SKMessage
(
QString
s
,
QString
h
,
QHash
<
QString
,
QString
>
p
);
SKMessage
(
QString
h
,
QHash
<
QString
,
QString
>
p
);
SKMessage
(
QString
s
,
QString
h
);
SKMessage
(
QString
h
);
SKMessage
(
QString
h
,
SkylivexWin
*
win
);
};
...
...
src/main.cpp
View file @
d1b20502
...
...
@@ -73,8 +73,8 @@ int main(int argc, char *argv[])
QTimer
::
singleShot
(
0
,
skx
,
SLOT
(
initialize
()));
// connect core with the mainwin
QObject
::
connect
(
skx
,
SIGNAL
(
msgFor
MainWin
(
SKMessage
&
)),
&
mainw
,
SLOT
(
msgFromCore
(
SKMessage
&
)));
QObject
::
connect
(
&
mainw
,
SIGNAL
(
putMessage
(
SKMessage
&
)),
skx
,
SLOT
(
receiveFrom
MainWin
(
SKMessage
&
)));
QObject
::
connect
(
skx
,
SIGNAL
(
msgFor
Gui
(
SKMessage
&
)),
&
mainw
,
SLOT
(
msgFromCore
(
SKMessage
&
)));
QObject
::
connect
(
&
mainw
,
SIGNAL
(
putMessage
(
SKMessage
&
)),
skx
,
SLOT
(
receiveFrom
Gui
(
SKMessage
&
)));
// and then.. go!
return
skylivexapp
.
exec
();
...
...
src/skylivex.cpp
View file @
d1b20502
...
...
@@ -42,6 +42,7 @@
#include "skylivex.h"
#include "pluginsinterfaces.h"
#include <iostream>
#include "webwin.h"
#include "ipcmsg.h"
Q_DECLARE_METATYPE
(
SKMessage
)
...
...
@@ -120,15 +121,20 @@ void SkyliveX::initializePlugin(QObject *plugin, QString filename)
void
SkyliveX
::
sendMessage
(
SKMessage
&
msg
)
{
//std::cout << "Send To MainWin: " << msg << std::endl;
emit
msgForMainWin
(
msg
);
emit
msgForGui
(
msg
);
emit
msgForPlugins
(
msg
);
}
void
SkyliveX
::
receiveFrom
MainWin
(
SKMessage
&
msg
)
void
SkyliveX
::
receiveFrom
Gui
(
SKMessage
&
msg
)
{
std
::
cout
<<
"received from MainWin "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
std
::
cout
<<
"received from Gui "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
if
(
msg
.
handle
==
"newwindow"
)
{
std
::
cout
<<
"Connecting new window signals/slots"
<<
std
::
endl
;
connect
(
msg
.
webwin
,
SIGNAL
(
putMessage
(
SKMessage
&
)),
this
,
SLOT
(
receiveFromGui
(
SKMessage
&
)));
connect
(
this
,
SIGNAL
(
msgForGui
(
SKMessage
&
)),
msg
.
webwin
,
SLOT
(
msgFromCore
(
SKMessage
&
)));
}
emit
msgForPlugins
(
msg
);
}
...
...
src/skylivex.h
View file @
d1b20502
...
...
@@ -66,13 +66,13 @@ class SkyliveX : public QObject
public
slots
:
void
initialize
();
void
receiveFrom
MainWin
(
SKMessage
&
msg
);
void
receiveFrom
Gui
(
SKMessage
&
msg
);
void
receiveFromPlugins
(
SKMessage
msg
);
signals
:
void
finished
();
void
kickPlugins
();
void
msgFor
MainWin
(
SKMessage
&
msg
);
void
msgFor
Gui
(
SKMessage
&
msg
);
void
msgForPlugins
(
SKMessage
msg
);
};
...
...
src/webwin.cpp
View file @
d1b20502
...
...
@@ -97,6 +97,11 @@ QWebView* WebWin::createWindow(QWebPage::WebWindowType type)
wv
->
setAttribute
(
Qt
::
WA_DeleteOnClose
,
true
);
if
(
type
==
QWebPage
::
WebModalDialog
)
wv
->
setWindowModality
(
Qt
::
ApplicationModal
);
SKMessage
msg
(
"newwindow"
,
qobject_cast
<
SkylivexWin
*>
(
wv
));
sendMessage
(
msg
);
wv
->
show
();
return
wv
;
}
...
...
@@ -261,7 +266,12 @@ SkylivexWin* SkylivexWin::createSkyliveWindow(QString url, QWebPage::WebWindowTy
std
::
cout
<<
"transform uri in local file "
<<
url
.
toStdString
()
<<
std
::
endl
;
}
wv
->
setUrl
(
QUrl
(
url
));
SKMessage
msg
(
"newwindow"
,
qobject_cast
<
SkylivexWin
*>
(
wv
));
sendMessage
(
msg
);
wv
->
show
();
return
wv
;
}
...
...
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