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
e4f6f169
Commit
e4f6f169
authored
Feb 24, 2013
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make chat and change telescope working
parent
3d3bb04e
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
120 additions
and
16 deletions
+120
-16
maingui.html
gui/nextime/maingui.html
+41
-1
skproto.cpp
plugins/skproto.cpp
+15
-1
skproto.h
plugins/skproto.h
+1
-0
skylivex.pro.user
skylivex.pro.user
+29
-11
jsbridge.cpp
src/jsbridge.cpp
+23
-0
jsbridge.h
src/jsbridge.h
+3
-1
mainwin.cpp
src/mainwin.cpp
+1
-0
mainwin.h
src/mainwin.h
+1
-0
webwin.cpp
src/webwin.cpp
+5
-2
webwin.h
src/webwin.h
+1
-0
No files found.
gui/nextime/maingui.html
View file @
e4f6f169
...
...
@@ -2,6 +2,23 @@
<head>
<title>
SkyliveX 0.1.0
</title>
<script
type=
"text/javascript"
src=
"SkyliveX.js"
></script>
<script
type=
"text/javascript"
>
function
sendMsg
()
{
//publicReceived('me', document.forms.messagesend.msginput.value);
SkyliveX
.
chat_message_send
(
document
.
forms
.
messagesend
.
msginput
.
value
);
document
.
forms
.
messagesend
.
msginput
.
value
=
""
;
}
function
msgInputKey
(
event
)
{
if
(
event
.
keyCode
==
13
)
{
sendMsg
();
}
}
</script>
<style>
#page
{
background-color
:
#FFFFFF
;
...
...
@@ -76,12 +93,32 @@
left
:
0px
;
border
:
1px
solid
#0000FF
;
}
#msginput
{
height
:
100%
;
left
:
0
;
right
:
100
;
position
:
absolute
;
}
#msgsend
{
position
:
absolute
;
right
:
5
;
height
:
100%
;
width
:
90
;
}
</style>
</head>
<body>
<div
id=
"page"
>
<div
id=
"top"
>
<select
id=
"telescopes"
onChange=
"SkyliveX.change_telescope(this.options[this.selectedIndex].value);"
>
<option
value=
"1"
>
telescope 1
</option>
<option
value=
"2"
>
telescope 2
</option>
<option
value=
"3"
>
telescope 3
</option>
<option
value=
"4"
>
telescope 4
</option>
<option
value=
"5"
>
telescope 5
</option>
</select>
</div>
<div
id=
"left"
>
<div
id=
"livearea"
>
...
...
@@ -99,7 +136,10 @@
<p>
user2
</p>
</div>
<div
id=
"chatinput"
>
<p>
INPUT
</p>
<form
name=
"messagesend"
>
<textarea
id=
"msginput"
name=
"msginput"
onKeyDown=
"msgInputKey(event);"
></textarea>
<input
id=
"msgsend"
type=
"submit"
name=
"msgsend"
value=
"Invia"
onClick=
"sendMsg();"
/>
</form>
</div>
</div>
</div>
...
...
plugins/skproto.cpp
View file @
e4f6f169
...
...
@@ -49,6 +49,7 @@ void SkyliveProtocol::startPlugin()
registerHandler
((
QString
)
"connectTelescopes"
,
&
SkyliveProtocol
::
handle_connect
);
registerHandler
((
QString
)
"putlogin"
,
&
SkyliveProtocol
::
handle_putlogin
);
registerHandler
((
QString
)
"publicChatSend"
,
&
SkyliveProtocol
::
handle_publicsend
);
registerHandler
((
QString
)
"changeTelescope"
,
&
SkyliveProtocol
::
handle_changetelescope
);
//pktTimer = new QTimer();
//QObject::connect(pktTimer, SIGNAL(timeout()), this, SLOT(processPackets()));
...
...
@@ -347,12 +348,24 @@ void SkyliveProtocol::handle_publicsend(SKMessage msg)
{
QString
cmd
(
"CPUBLIC"
);
QList
<
QString
>
paramlist
;
QByteArray
message
(
msg
.
parameters
[
0
].
toLocal8Bit
());
QByteArray
message
(
msg
.
parameters
[
"msg"
].
toLocal8Bit
());
paramlist
.
append
(
message
.
toPercentEncoding
());
sendPacket
(
cmd
,
paramlist
);
}
}
void
SkyliveProtocol
::
handle_changetelescope
(
SKMessage
msg
)
{
if
(
msg
.
parameters
.
size
()
>
0
)
{
QString
cmd
(
"CHTELE"
);
QList
<
QString
>
paramlist
;
paramlist
.
append
(
msg
.
parameters
[
"telescope"
]);
sendPacket
(
cmd
,
paramlist
);
}
}
void
SkyliveProtocol
::
clientConnected
()
{
SM_TCPCLIENT
=
CONNECTED
;
...
...
@@ -402,3 +415,4 @@ void SkyliveProtocol::displayError(QAbstractSocket::SocketError socketError)
SM_TCPCLIENT
=
HOME
;
}
plugins/skproto.h
View file @
e4f6f169
...
...
@@ -109,6 +109,7 @@ class SkyliveProtocol : public QObject, SkylivexPluginInterface
void
handle_connect
(
SKMessage
msg
);
void
handle_putlogin
(
SKMessage
msg
);
void
handle_publicsend
(
SKMessage
msg
);
void
handle_changetelescope
(
SKMessage
msg
);
void
sendPacket
(
const
char
*
cmd
,
const
char
*
params
);
void
sendPacket
(
QString
&
cmd
,
QString
&
params
);
void
sendPacket
(
SKProtoMsg
&
pkt
);
...
...
skylivex.pro.user
View file @
e4f6f169
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by Qt Creator 2.6.
2, 2013-02-23T23:53:04
. -->
<!-- Written by Qt Creator 2.6.
1, 2013-02-24T21:44:10
. -->
<qtcreator>
<data>
<variable>
ProjectExplorer.Project.ActiveTarget
</variable>
...
...
@@ -51,10 +51,10 @@
<data>
<variable>
ProjectExplorer.Project.Target.0
</variable>
<valuemap
type=
"QVariantMap"
>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
Desktop Qt 5.0.
1 MinGW 32bit
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
>
Desktop Qt 5.0.
1 MinGW 32bit
</value>
<value
type=
"QByteArray"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
qt.50
1.win32_mingw47
.essentials_kit
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveBuildConfiguration"
>
0
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
Desktop Qt 5.0.
0 GCC 64bit (SDK)
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
>
Desktop Qt 5.0.
0 GCC 64bit (SDK)
</value>
<value
type=
"QByteArray"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
qt.50
0.gcc_64
.essentials_kit
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveBuildConfiguration"
>
1
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveDeployConfiguration"
>
0
</value>
<value
type=
"int"
key=
"ProjectExplorer.Target.ActiveRunConfiguration"
>
0
</value>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.Target.BuildConfiguration.0"
>
...
...
@@ -78,7 +78,16 @@
<value
type=
"QString"
key=
"Qt4ProjectManager.MakeStep.MakeArguments"
></value>
<value
type=
"QString"
key=
"Qt4ProjectManager.MakeStep.MakeCommand"
></value>
</valuemap>
<value
type=
"int"
key=
"ProjectExplorer.BuildStepList.StepsCount"
>
2
</value>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.BuildStepList.Step.2"
>
<value
type=
"bool"
key=
"ProjectExplorer.BuildStep.Enabled"
>
true
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
Make
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
></value>
<value
type=
"QByteArray"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
Qt4ProjectManager.MakeStep
</value>
<value
type=
"bool"
key=
"Qt4ProjectManager.MakeStep.Clean"
>
false
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.MakeStep.MakeArguments"
>
install
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.MakeStep.MakeCommand"
></value>
</valuemap>
<value
type=
"int"
key=
"ProjectExplorer.BuildStepList.StepsCount"
>
3
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
Build
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
></value>
<value
type=
"QByteArray"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
ProjectExplorer.BuildSteps.Build
</value>
...
...
@@ -105,7 +114,7 @@
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
></value>
<value
type=
"QByteArray"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
Qt4ProjectManager.Qt4BuildConfiguration
</value>
<value
type=
"int"
key=
"Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration"
>
2
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory"
>
C:/Users/Ivan/Documents/GitHub/skylivex-build-Desktop_Qt_5_0_1_MinGW_32bit-Debug
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory"
>
/home/nextime/skylivex/
</value>
<value
type=
"bool"
key=
"Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild"
>
true
</value>
</valuemap>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.Target.BuildConfiguration.1"
>
...
...
@@ -129,7 +138,16 @@
<value
type=
"QString"
key=
"Qt4ProjectManager.MakeStep.MakeArguments"
></value>
<value
type=
"QString"
key=
"Qt4ProjectManager.MakeStep.MakeCommand"
></value>
</valuemap>
<value
type=
"int"
key=
"ProjectExplorer.BuildStepList.StepsCount"
>
2
</value>
<valuemap
type=
"QVariantMap"
key=
"ProjectExplorer.BuildStepList.Step.2"
>
<value
type=
"bool"
key=
"ProjectExplorer.BuildStep.Enabled"
>
true
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
Make
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
></value>
<value
type=
"QByteArray"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
Qt4ProjectManager.MakeStep
</value>
<value
type=
"bool"
key=
"Qt4ProjectManager.MakeStep.Clean"
>
false
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.MakeStep.MakeArguments"
>
install
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.MakeStep.MakeCommand"
></value>
</valuemap>
<value
type=
"int"
key=
"ProjectExplorer.BuildStepList.StepsCount"
>
3
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
Build
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
></value>
<value
type=
"QByteArray"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
ProjectExplorer.BuildSteps.Build
</value>
...
...
@@ -156,7 +174,7 @@
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
></value>
<value
type=
"QByteArray"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
Qt4ProjectManager.Qt4BuildConfiguration
</value>
<value
type=
"int"
key=
"Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration"
>
0
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory"
>
C:/Users/Ivan/Documents/GitHub/skylivex-build-Desktop_Qt_5_0_1_MinGW_32bit-Release
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory"
>
/home/nextime/skylivex/
</value>
<value
type=
"bool"
key=
"Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild"
>
true
</value>
</valuemap>
<value
type=
"int"
key=
"ProjectExplorer.Target.BuildConfigurationCount"
>
2
</value>
...
...
@@ -207,7 +225,7 @@
</valuelist>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DefaultDisplayName"
>
skylivex
</value>
<value
type=
"QString"
key=
"ProjectExplorer.ProjectConfiguration.DisplayName"
></value>
<value
type=
"QByteArray"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
Qt4ProjectManager.Qt4RunConfiguration:
C:/Users/Ivan/Documents/GitHub
/skylivex/src/skylivex.pro
</value>
<value
type=
"QByteArray"
key=
"ProjectExplorer.ProjectConfiguration.Id"
>
Qt4ProjectManager.Qt4RunConfiguration:
/home/nextime
/skylivex/src/skylivex.pro
</value>
<value
type=
"int"
key=
"Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase"
>
2
</value>
<value
type=
"QString"
key=
"Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"
></value>
<value
type=
"QString"
key=
"Qt4ProjectManager.Qt4RunConfiguration.ProFile"
>
src/skylivex.pro
</value>
...
...
@@ -230,7 +248,7 @@
</data>
<data>
<variable>
ProjectExplorer.Project.Updater.EnvironmentId
</variable>
<value
type=
"QString"
>
{
70fe70e9-61e4-4722-95de-00b652476132
}
</value>
<value
type=
"QString"
>
{
d2672f72-ce2b-4ab4-891e-45453a7867e7
}
</value>
</data>
<data>
<variable>
ProjectExplorer.Project.Updater.FileVersion
</variable>
...
...
src/jsbridge.cpp
View file @
e4f6f169
...
...
@@ -67,3 +67,26 @@ void JSBridge::toggleTransparentBackground(bool transparentbg)
wwin
->
toggleTransparentBackground
(
transparentbg
);
}
/* a private message */
void
JSBridge
::
chat_message_send
(
QString
dest
,
QString
message
)
{
}
/* a public message */
void
JSBridge
::
chat_message_send
(
QString
message
)
{
std
::
cout
<<
"public message send called from JS"
<<
std
::
endl
;
SKMessage
chatmsg
(
"publicChatSend"
);
chatmsg
.
parameters
.
insert
(
"msg"
,
message
);
wwin
->
sendMessage
(
chatmsg
);
}
void
JSBridge
::
change_telescope
(
QString
tele
)
{
std
::
cout
<<
"Telescope change requested from JS"
<<
std
::
endl
;
SKMessage
msg
(
"changeTelescope"
);
msg
.
parameters
.
insert
(
"telescope"
,
tele
);
wwin
->
sendMessage
(
msg
);
}
src/jsbridge.h
View file @
e4f6f169
...
...
@@ -65,7 +65,9 @@ class JSBridge : public QObject
void
resizeWin
(
int
width
,
int
height
);
void
toggleBorders
(
bool
borders
);
void
toggleTransparentBackground
(
bool
transparentbg
);
void
chat_message_send
(
QString
dest
,
QString
message
);
void
chat_message_send
(
QString
message
);
void
change_telescope
(
QString
tele
);
};
...
...
src/mainwin.cpp
View file @
e4f6f169
...
...
@@ -61,6 +61,7 @@ MainWin::MainWin(QString &htmlfile)
registerHandler
((
QString
)
"publicchatrcv"
,
(
SKHandlerFunction
)
&
MainWin
::
handle_chatreceived
);
msgsender
=
SENDER
;
}
...
...
src/mainwin.h
View file @
e4f6f169
...
...
@@ -57,6 +57,7 @@ class MainWin : public WebWin
public
:
MainWin
(
QString
&
htmlfile
);
~
MainWin
();
QString
msgsender
;
void
handle_corestarted
(
SKMessage
&
msg
);
void
handle_connected
(
SKMessage
&
msg
);
void
handle_asklogin
(
SKMessage
&
msg
);
...
...
src/webwin.cpp
View file @
e4f6f169
...
...
@@ -69,6 +69,8 @@ WebWin::WebWin(QString &htmlfile)
connect
(
page
()
->
mainFrame
(),
SIGNAL
(
javaScriptWindowObjectCleared
()),
this
,
SLOT
(
refreshJsObject
()));
msgsender
=
SENDER
;
}
...
...
@@ -125,7 +127,7 @@ void WebWin::setHtmlCont(QString cont, QUrl baseUrl, bool borders, bool transpar
void
WebWin
::
msgFromCore
(
SKMessage
&
msg
)
{
std
::
cout
<<
"WebWindow msg reveived: "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
if
(
_handlers
.
contains
(
msg
.
handle
)
&&
msg
.
sender
!=
SENDER
)
if
(
_handlers
.
contains
(
msg
.
handle
)
&&
msg
.
sender
!=
msgsender
)
{
SKHandlerFunction
mf
=
_handlers
[
msg
.
handle
];
(
this
->*
mf
)(
msg
);
...
...
@@ -178,7 +180,8 @@ void WebWin::toggleTransparentBackground(bool transparentbg)
void
WebWin
::
sendMessage
(
SKMessage
&
msg
)
{
msg
.
sender
=
SENDER
;
//msg.sender=SENDER;
msg
.
sender
=
msgsender
;
emit
putMessage
(
msg
);
}
...
...
src/webwin.h
View file @
e4f6f169
...
...
@@ -79,6 +79,7 @@ class WebWin : public QWebView
void
toggleBorders
(
bool
borders
);
void
toggleTransparentBackground
(
bool
transparentbg
);
JSBridge
*
jsbridge
;
QString
msgsender
;
private
slots
:
void
refreshJsObject
();
...
...
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