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
bdfa3a0d
Commit
bdfa3a0d
authored
Feb 20, 2013
by
root
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make it compile with gcc 4.7...
parent
0321d9b6
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
65 additions
and
66 deletions
+65
-66
skauth.cpp
plugins/skauth.cpp
+4
-4
skauth.h
plugins/skauth.h
+5
-5
skproto.cpp
plugins/skproto.cpp
+8
-8
skproto.h
plugins/skproto.h
+6
-6
main.cpp
src/main.cpp
+2
-2
mainwin.cpp
src/mainwin.cpp
+16
-16
mainwin.h
src/mainwin.h
+11
-12
skylivex.cpp
src/skylivex.cpp
+8
-8
skylivex.h
src/skylivex.h
+5
-5
No files found.
plugins/skauth.cpp
View file @
bdfa3a0d
...
...
@@ -45,7 +45,7 @@ void SkyliveAuth::startPlugin()
}
void
SkyliveAuth
::
receiveMessage
(
SKMessage
::
SKMessage
msg
)
void
SkyliveAuth
::
receiveMessage
(
SKMessage
msg
)
{
std
::
cout
<<
"SkyliveAuth msg received: "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
if
(
_handlers
.
contains
(
msg
.
handle
)
&&
msg
.
sender
!=
SENDER
)
...
...
@@ -57,7 +57,7 @@ void SkyliveAuth::receiveMessage(SKMessage::SKMessage msg)
}
void
SkyliveAuth
::
sendMessage
(
SKMessage
::
SKMessage
msg
)
void
SkyliveAuth
::
sendMessage
(
SKMessage
msg
)
{
msg
.
sender
=
SENDER
;
emit
putMessage
(
msg
);
...
...
@@ -69,7 +69,7 @@ void SkyliveAuth::registerHandler(QString type, SKHandlerFunction handler)
}
void
SkyliveAuth
::
handle_getlogin
(
SKMessage
::
SKMessage
msg
)
void
SkyliveAuth
::
handle_getlogin
(
SKMessage
msg
)
{
std
::
cout
<<
"Auth module handle Login by "
<<
msg
.
sender
.
toStdString
()
<<
std
::
endl
;
/*
...
...
@@ -78,7 +78,7 @@ void SkyliveAuth::handle_getlogin(SKMessage::SKMessage msg)
* and ask the main process only if we donesn't yet have one
* or if the user has logged out.
*/
SKMessage
::
SKMessage
smsg
(
"asklogin"
);
SKMessage
smsg
(
"asklogin"
);
sendMessage
(
smsg
);
...
...
plugins/skauth.h
View file @
bdfa3a0d
...
...
@@ -45,7 +45,7 @@
#include "ipcmsg.h"
class
SkyliveAuth
;
typedef
void
(
SkyliveAuth
::*
SKHandlerFunction
)(
SKMessage
::
SKMessage
);
typedef
void
(
SkyliveAuth
::*
SKHandlerFunction
)(
SKMessage
);
class
SkyliveAuth
:
public
QObject
,
SkylivexPluginInterface
{
...
...
@@ -58,16 +58,16 @@ class SkyliveAuth : public QObject, SkylivexPluginInterface
public
:
void
startPlugin
();
void
sendMessage
(
SKMessage
::
SKMessage
msg
);
void
sendMessage
(
SKMessage
msg
);
void
registerHandler
(
QString
type
,
SKHandlerFunction
handler
);
void
handle_getlogin
(
SKMessage
::
SKMessage
msg
);
void
handle_getlogin
(
SKMessage
msg
);
public
slots
:
void
receiveMessage
(
SKMessage
::
SKMessage
msg
);
void
receiveMessage
(
SKMessage
msg
);
signals
:
void
putMessage
(
SKMessage
::
SKMessage
msg
);
void
putMessage
(
SKMessage
msg
);
};
...
...
plugins/skproto.cpp
View file @
bdfa3a0d
...
...
@@ -124,7 +124,7 @@ void SkyliveProtocol::processPackets()
std
::
cout
<<
"Packet CRC OK command: "
<<
pkt
.
cmd
.
toStdString
()
<<
" Params: "
<<
pkt
.
params
.
toStdString
()
<<
std
::
endl
;
if
(
pkt
.
cmd
==
"LOGIN"
)
{
SKMessage
::
SKMessage
msg
(
"getlogin"
);
SKMessage
msg
(
"getlogin"
);
sendMessage
(
msg
);
}
...
...
@@ -146,7 +146,7 @@ void SkyliveProtocol::processPackets()
}
else
if
(
pkt
.
cmd
==
"ENABLE"
)
{
SKMessage
::
SKMessage
loginmsg
(
"loginfailed"
);
SKMessage
loginmsg
(
"loginfailed"
);
if
(
pkt
.
params
==
"USERERRATO"
)
{
loginmsg
.
parameters
.
insert
(
"why"
,
"wronguser"
);
...
...
@@ -181,7 +181,7 @@ void SkyliveProtocol::processPackets()
{
if
(
paramlist
.
size
()
>
1
)
// For safety
{
SKMessage
::
SKMessage
alertmsg
(
"alert"
);
SKMessage
alertmsg
(
"alert"
);
alertmsg
.
parameters
.
insert
(
"msg"
,
QByteArray
::
fromPercentEncoding
(
paramlist
[
1
].
toLocal8Bit
()));
sendMessage
(
alertmsg
);
}
...
...
@@ -296,7 +296,7 @@ void SkyliveProtocol::readFromNetwork()
}
}
void
SkyliveProtocol
::
handle_connect
(
SKMessage
::
SKMessage
msg
)
void
SkyliveProtocol
::
handle_connect
(
SKMessage
msg
)
{
authenticated
=
false
;
std
::
cout
<<
"SkyliveProtocol connect: "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
...
...
@@ -308,7 +308,7 @@ void SkyliveProtocol::handle_connect(SKMessage::SKMessage msg)
tcpSocket
->
connectToHost
(
SERVERHOST
,
SERVERPORT
);
}
void
SkyliveProtocol
::
handle_putlogin
(
SKMessage
::
SKMessage
msg
)
void
SkyliveProtocol
::
handle_putlogin
(
SKMessage
msg
)
{
QString
cmd
(
"LOGIN"
);
...
...
@@ -323,12 +323,12 @@ void SkyliveProtocol::handle_putlogin(SKMessage::SKMessage msg)
void
SkyliveProtocol
::
clientConnected
()
{
SM_TCPCLIENT
=
CONNECTED
;
SKMessage
::
SKMessage
msg
(
"telescopeConnected"
);
SKMessage
msg
(
"telescopeConnected"
);
sendMessage
(
msg
);
}
void
SkyliveProtocol
::
receiveMessage
(
SKMessage
::
SKMessage
msg
)
void
SkyliveProtocol
::
receiveMessage
(
SKMessage
msg
)
{
std
::
cout
<<
"SkyliveProtocol msg received: "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
if
(
_handlers
.
contains
(
msg
.
handle
)
&&
msg
.
sender
!=
SENDER
)
...
...
@@ -339,7 +339,7 @@ void SkyliveProtocol::receiveMessage(SKMessage::SKMessage msg)
}
void
SkyliveProtocol
::
sendMessage
(
SKMessage
::
SKMessage
msg
)
void
SkyliveProtocol
::
sendMessage
(
SKMessage
msg
)
{
msg
.
sender
=
SENDER
;
emit
putMessage
(
msg
);
...
...
plugins/skproto.h
View file @
bdfa3a0d
...
...
@@ -82,7 +82,7 @@ enum _SM_TCPCLIENT
class
SkyliveProtocol
;
typedef
void
(
SkyliveProtocol
::*
SKHandlerFunction
)(
SKMessage
::
SKMessage
);
typedef
void
(
SkyliveProtocol
::*
SKHandlerFunction
)(
SKMessage
);
class
SkyliveProtocol
:
public
QObject
,
SkylivexPluginInterface
{
...
...
@@ -104,10 +104,10 @@ class SkyliveProtocol : public QObject, SkylivexPluginInterface
public
:
void
startPlugin
();
void
sendMessage
(
SKMessage
::
SKMessage
msg
);
void
sendMessage
(
SKMessage
msg
);
void
registerHandler
(
QString
type
,
SKHandlerFunction
handler
);
void
handle_connect
(
SKMessage
::
SKMessage
msg
);
void
handle_putlogin
(
SKMessage
::
SKMessage
msg
);
void
handle_connect
(
SKMessage
msg
);
void
handle_putlogin
(
SKMessage
msg
);
void
sendPacket
(
const
char
*
cmd
,
const
char
*
params
);
void
sendPacket
(
QString
&
cmd
,
QString
&
params
);
void
sendPacket
(
SKProtoMsg
&
pkt
);
...
...
@@ -120,12 +120,12 @@ class SkyliveProtocol : public QObject, SkylivexPluginInterface
void
displayError
(
QAbstractSocket
::
SocketError
);
public
slots
:
void
receiveMessage
(
SKMessage
::
SKMessage
msg
);
void
receiveMessage
(
SKMessage
msg
);
private
slots
:
void
processPackets
();
signals
:
void
putMessage
(
SKMessage
::
SKMessage
msg
);
void
putMessage
(
SKMessage
msg
);
};
#endif
src/main.cpp
View file @
bdfa3a0d
...
...
@@ -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
(
msgForMainWin
(
SKMessage
::
SKMessage
&
)),
&
mainw
,
SLOT
(
msgFromCore
(
SKMessage
::
SKMessage
&
)));
QObject
::
connect
(
&
mainw
,
SIGNAL
(
putMessage
(
SKMessage
::
SKMessage
&
)),
skx
,
SLOT
(
receiveFromMainWin
(
SKMessage
::
SKMessage
&
)));
QObject
::
connect
(
skx
,
SIGNAL
(
msgForMainWin
(
SKMessage
&
)),
&
mainw
,
SLOT
(
msgFromCore
(
SKMessage
&
)));
QObject
::
connect
(
&
mainw
,
SIGNAL
(
putMessage
(
SKMessage
&
)),
skx
,
SLOT
(
receiveFromMainWin
(
SKMessage
&
)));
// and then.. go!
return
skylivexapp
.
exec
();
...
...
src/mainwin.cpp
View file @
bdfa3a0d
...
...
@@ -63,13 +63,13 @@ MainWin::MainWin(QString &htmlfile)
jsbridge
.
mwin
=
qobject_cast
<
MainWin
*>
(
this
);
registerHandler
((
QString
)
"coreStarted"
,
&
MainWin
::
handle_corestarted
);
registerHandler
((
QString
)
"telescopeConnected"
,
&
MainWin
::
handle_connected
);
registerHandler
((
QString
)
"asklogin"
,
&
MainWin
::
handle_asklogin
);
registerHandler
((
QString
)
"alert"
,
&
MainWin
::
handle_alert
);
registerHandler
((
QString
)
"notify"
,
&
MainWin
::
handle_notify
);
registerHandler
((
QString
)
"loginok"
,
&
MainWin
::
handle_loginres
);
registerHandler
((
QString
)
"loginfailed"
,
&
MainWin
::
handle_loginres
);
registerHandler
((
QString
)
"coreStarted"
,
(
SKHandlerFunction
)
&
MainWin
::
handle_corestarted
);
registerHandler
((
QString
)
"telescopeConnected"
,
(
SKHandlerFunction
)
&
MainWin
::
handle_connected
);
registerHandler
((
QString
)
"asklogin"
,
(
SKHandlerFunction
)
&
MainWin
::
handle_asklogin
);
registerHandler
((
QString
)
"alert"
,
(
SKHandlerFunction
)
&
MainWin
::
handle_alert
);
registerHandler
((
QString
)
"notify"
,
(
SKHandlerFunction
)
&
MainWin
::
handle_notify
);
registerHandler
((
QString
)
"loginok"
,
(
SKHandlerFunction
)
&
MainWin
::
handle_loginres
);
registerHandler
((
QString
)
"loginfailed"
,
(
SKHandlerFunction
)
&
MainWin
::
handle_loginres
);
}
MainWin
::~
MainWin
()
...
...
@@ -113,7 +113,7 @@ void MainWin::setHtmlCont(QString cont, QUrl baseUrl, bool borders, bool transpa
}
void
MainWin
::
msgFromCore
(
SKMessage
::
SKMessage
&
msg
)
void
MainWin
::
msgFromCore
(
SKMessage
&
msg
)
{
std
::
cout
<<
"MainWindow msg reveived: "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
if
(
_handlers
.
contains
(
msg
.
handle
)
&&
msg
.
sender
!=
SENDER
)
...
...
@@ -167,7 +167,7 @@ void MainWin::toggleTransparentBackground(bool transparentbg)
}
void
MainWin
::
sendMessage
(
SKMessage
::
SKMessage
&
msg
)
void
MainWin
::
sendMessage
(
SKMessage
&
msg
)
{
msg
.
sender
=
SENDER
;
emit
putMessage
(
msg
);
...
...
@@ -180,7 +180,7 @@ void MainWin::registerHandler(QString type, SKHandlerFunction handler)
}
void
MainWin
::
handle_corestarted
(
SKMessage
::
SKMessage
&
msg
)
void
MainWin
::
handle_corestarted
(
SKMessage
&
msg
)
{
msg
.
handle
=
"connectTelescopes"
;
sendMessage
(
msg
);
...
...
@@ -188,13 +188,13 @@ void MainWin::handle_corestarted(SKMessage::SKMessage &msg)
}
void
MainWin
::
handle_connected
(
SKMessage
::
SKMessage
&
msg
)
void
MainWin
::
handle_connected
(
SKMessage
&
msg
)
{
std
::
cout
<<
"Connected by "
<<
msg
.
sender
.
toStdString
()
<<
std
::
endl
;
jsbridge
.
notify
(
"Connected"
);
}
void
MainWin
::
handle_asklogin
(
SKMessage
::
SKMessage
&
msg
)
void
MainWin
::
handle_asklogin
(
SKMessage
&
msg
)
{
std
::
cout
<<
"asklogin by "
<<
msg
.
sender
.
toStdString
()
<<
std
::
endl
;
jsbridge
.
notify
(
"Logging in"
);
...
...
@@ -204,19 +204,19 @@ void MainWin::handle_asklogin(SKMessage::SKMessage &msg)
}
void
MainWin
::
handle_alert
(
SKMessage
::
SKMessage
&
msg
)
void
MainWin
::
handle_alert
(
SKMessage
&
msg
)
{
if
(
msg
.
parameters
.
contains
(
"msg"
))
jsbridge
.
alert
(
msg
.
parameters
[
"msg"
]);
}
void
MainWin
::
handle_notify
(
SKMessage
::
SKMessage
&
msg
)
void
MainWin
::
handle_notify
(
SKMessage
&
msg
)
{
if
(
msg
.
parameters
.
contains
(
"msg"
))
jsbridge
.
notify
(
msg
.
parameters
[
"msg"
]);
}
void
MainWin
::
handle_loginres
(
SKMessage
::
SKMessage
&
msg
)
void
MainWin
::
handle_loginres
(
SKMessage
&
msg
)
{
if
(
msg
.
handle
==
"loginok"
)
{
...
...
@@ -237,7 +237,7 @@ void JSBridge::changePageContent(QString elementid, QString content)
void
JSBridge
::
pushLogin
(
QString
username
,
QString
password
)
{
std
::
cout
<<
"pushLogin called from JS"
<<
std
::
endl
;
SKMessage
::
SKMessage
loginmsg
(
"putlogin"
);
SKMessage
loginmsg
(
"putlogin"
);
loginmsg
.
parameters
.
insert
(
"username"
,
username
);
loginmsg
.
parameters
.
insert
(
"password"
,
password
);
mwin
->
sendMessage
(
loginmsg
);
...
...
src/mainwin.h
View file @
bdfa3a0d
...
...
@@ -43,11 +43,10 @@
#include <QObject>
#include <ipcmsg.h>
class
MainWin
;
// forward declaration for typedef
// This is for member pointers to map messages
typedef
void
(
MainWin
::*
SKHandlerFunction
)(
SKMessage
::
SKMessage
&
);
typedef
void
(
MainWin
::*
SKHandlerFunction
)(
SKMessage
&
);
//typedef int (MainWin::*SKHandlerFunction)(SKMessage&);
/*
* class JSBridge
...
...
@@ -100,22 +99,22 @@ class MainWin : public QWebView
public
:
MainWin
(
QString
&
htmlfile
);
~
MainWin
();
void
sendMessage
(
SKMessage
::
SKMessage
&
msg
);
void
sendMessage
(
SKMessage
&
msg
);
void
registerHandler
(
QString
type
,
SKHandlerFunction
handler
);
void
handle_corestarted
(
SKMessage
::
SKMessage
&
msg
);
void
handle_connected
(
SKMessage
::
SKMessage
&
msg
);
void
handle_asklogin
(
SKMessage
::
SKMessage
&
msg
);
void
handle_alert
(
SKMessage
::
SKMessage
&
msg
);
void
handle_notify
(
SKMessage
::
SKMessage
&
msg
);
void
handle_loginres
(
SKMessage
::
SKMessage
&
msg
);
void
handle_corestarted
(
SKMessage
&
msg
);
void
handle_connected
(
SKMessage
&
msg
);
void
handle_asklogin
(
SKMessage
&
msg
);
void
handle_alert
(
SKMessage
&
msg
);
void
handle_notify
(
SKMessage
&
msg
);
void
handle_loginres
(
SKMessage
&
msg
);
void
toggleBorders
(
bool
borders
);
void
toggleTransparentBackground
(
bool
transparentbg
);
public
slots
:
void
msgFromCore
(
SKMessage
::
SKMessage
&
msg
);
void
msgFromCore
(
SKMessage
&
msg
);
signals
:
void
putMessage
(
SKMessage
::
SKMessage
&
msg
);
void
putMessage
(
SKMessage
&
msg
);
// XXX Future usage
/*
...
...
src/skylivex.cpp
View file @
bdfa3a0d
...
...
@@ -44,13 +44,13 @@
#include <iostream>
#include "ipcmsg.h"
Q_DECLARE_METATYPE
(
SKMessage
::
SKMessage
)
Q_DECLARE_METATYPE
(
SKMessage
)
// Load and initialize plugins and shared memory communication
void
SkyliveX
::
initialize
()
{
qRegisterMetaType
<
SKMessage
::
SKMessage
>
(
"SKMessage::
SKMessage"
);
qRegisterMetaType
<
SKMessage
>
(
"
SKMessage"
);
loadPlugins
();
}
...
...
@@ -79,7 +79,7 @@ void SkyliveX::loadPlugins()
std
::
cout
<<
plugin
<<
std
::
endl
;
}
}
SKMessage
::
SKMessage
msg
(
"coreStarted"
);
SKMessage
msg
(
"coreStarted"
);
sendMessage
(
msg
);
}
...
...
@@ -87,8 +87,8 @@ void SkyliveX::initializePlugin(QObject *plugin, QString filename)
{
// connect signals/slots
connect
(
plugin
,
SIGNAL
(
putMessage
(
SKMessage
::
SKMessage
)),
this
,
SLOT
(
receiveFromPlugins
(
SKMessage
::
SKMessage
)));
connect
(
this
,
SIGNAL
(
msgForPlugins
(
SKMessage
::
SKMessage
)),
plugin
,
SLOT
(
receiveMessage
(
SKMessage
::
SKMessage
)));
connect
(
plugin
,
SIGNAL
(
putMessage
(
SKMessage
)),
this
,
SLOT
(
receiveFromPlugins
(
SKMessage
)));
connect
(
this
,
SIGNAL
(
msgForPlugins
(
SKMessage
)),
plugin
,
SLOT
(
receiveMessage
(
SKMessage
)));
// Move the plugin in it's own thread
QThread
*
consumer
=
new
QThread
();
...
...
@@ -108,7 +108,7 @@ void SkyliveX::initializePlugin(QObject *plugin, QString filename)
}
}
void
SkyliveX
::
sendMessage
(
SKMessage
::
SKMessage
&
msg
)
void
SkyliveX
::
sendMessage
(
SKMessage
&
msg
)
{
//std::cout << "Send To MainWin: " << msg << std::endl;
emit
msgForMainWin
(
msg
);
...
...
@@ -116,13 +116,13 @@ void SkyliveX::sendMessage(SKMessage::SKMessage &msg)
}
void
SkyliveX
::
receiveFromMainWin
(
SKMessage
::
SKMessage
&
msg
)
void
SkyliveX
::
receiveFromMainWin
(
SKMessage
&
msg
)
{
std
::
cout
<<
"received from MainWin "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
emit
msgForPlugins
(
msg
);
}
void
SkyliveX
::
receiveFromPlugins
(
SKMessage
::
SKMessage
msg
)
void
SkyliveX
::
receiveFromPlugins
(
SKMessage
msg
)
{
std
::
cout
<<
"received from plugins "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
sendMessage
(
msg
);
...
...
src/skylivex.h
View file @
bdfa3a0d
...
...
@@ -62,17 +62,17 @@ class SkyliveX : public QObject
~
SkyliveX
()
{}
void
loadPlugins
();
void
initializePlugin
(
QObject
*
,
QString
);
void
sendMessage
(
SKMessage
::
SKMessage
&
msg
);
void
sendMessage
(
SKMessage
&
msg
);
public
slots
:
void
initialize
();
void
receiveFromMainWin
(
SKMessage
::
SKMessage
&
msg
);
void
receiveFromPlugins
(
SKMessage
::
SKMessage
msg
);
void
receiveFromMainWin
(
SKMessage
&
msg
);
void
receiveFromPlugins
(
SKMessage
msg
);
signals
:
void
finished
();
void
msgForMainWin
(
SKMessage
::
SKMessage
&
msg
);
void
msgForPlugins
(
SKMessage
::
SKMessage
msg
);
void
msgForMainWin
(
SKMessage
&
msg
);
void
msgForPlugins
(
SKMessage
msg
);
};
#endif
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