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
c29db5c4
Commit
c29db5c4
authored
Feb 18, 2013
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add message dispatcher to mainWin and setup connectTelescpes message
parent
79e46b4d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
5 deletions
+44
-5
skproto.cpp
plugins/skproto.cpp
+0
-2
mainwin.cpp
src/mainwin.cpp
+27
-1
mainwin.h
src/mainwin.h
+15
-0
skylivex.cpp
src/skylivex.cpp
+2
-2
No files found.
plugins/skproto.cpp
View file @
c29db5c4
...
@@ -42,8 +42,6 @@
...
@@ -42,8 +42,6 @@
void
SkyliveProtocol
::
startPlugin
()
void
SkyliveProtocol
::
startPlugin
()
{
{
std
::
cout
<<
"SkyliveProtocol initialized in thread "
<<
thread
()
<<
std
::
endl
;
std
::
cout
<<
"SkyliveProtocol initialized in thread "
<<
thread
()
<<
std
::
endl
;
SKMessage
::
SKMessage
prova
(
"ANTANI STA PROVA!!"
);
sendMessage
(
prova
);
registerHandler
((
QString
)
"connectTelescopes"
,
&
SkyliveProtocol
::
handle_connect
);
registerHandler
((
QString
)
"connectTelescopes"
,
&
SkyliveProtocol
::
handle_connect
);
}
}
...
...
src/mainwin.cpp
View file @
c29db5c4
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include <QWebView>
#include <QWebView>
#include <QFile>
#include <QFile>
#include <QDir>
#include <QDir>
#include <QString>
#include <QPalette>
#include <QPalette>
#include <iostream>
#include <iostream>
#include "ipcmsg.h"
#include "ipcmsg.h"
...
@@ -58,7 +59,7 @@ MainWin::MainWin(QFile &htmlfile)
...
@@ -58,7 +59,7 @@ MainWin::MainWin(QFile &htmlfile)
setHtml
(
htmlFileName
,
baseUrl
);
setHtml
(
htmlFileName
,
baseUrl
);
resize
(
250
,
200
);
resize
(
250
,
200
);
registerHandler
((
QString
)
"coreStarted"
,
&
MainWin
::
handle_corestarted
);
}
}
MainWin
::~
MainWin
()
MainWin
::~
MainWin
()
...
@@ -69,4 +70,29 @@ MainWin::~MainWin()
...
@@ -69,4 +70,29 @@ MainWin::~MainWin()
void
MainWin
::
msgFromCore
(
SKMessage
::
SKMessage
&
msg
)
void
MainWin
::
msgFromCore
(
SKMessage
::
SKMessage
&
msg
)
{
{
std
::
cout
<<
"MainWindow msg reveived: "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
std
::
cout
<<
"MainWindow msg reveived: "
<<
msg
.
handle
.
toStdString
()
<<
std
::
endl
;
if
(
_handlers
.
contains
(
msg
.
handle
))
{
SKHandlerFunction
mf
=
_handlers
[
msg
.
handle
];
(
this
->*
mf
)(
msg
);
}
}
void
MainWin
::
sendMessage
(
SKMessage
::
SKMessage
&
msg
)
{
emit
putMessage
(
msg
);
}
void
MainWin
::
registerHandler
(
QString
type
,
SKHandlerFunction
handler
)
{
_handlers
[
type
]
=
handler
;
}
void
MainWin
::
handle_corestarted
(
SKMessage
::
SKMessage
&
msg
)
{
msg
.
handle
=
"connectTelescopes"
;
sendMessage
(
msg
);
}
}
src/mainwin.h
View file @
c29db5c4
...
@@ -38,10 +38,16 @@
...
@@ -38,10 +38,16 @@
#include <QWebView>
#include <QWebView>
#include <QUrl>
#include <QUrl>
#include <QFile>
#include <QFile>
#include <QHash>
#include <QString>
#include <QString>
#include <QObject>
#include <QObject>
#include <ipcmsg.h>
#include <ipcmsg.h>
class
MainWin
;
// forward declaration for typedef
// This is for member pointers to map messages
typedef
void
(
MainWin
::*
SKHandlerFunction
)(
SKMessage
::
SKMessage
&
);
/*
/*
* class MainWin
* class MainWin
* This is just a little webkit transparent window
* This is just a little webkit transparent window
...
@@ -56,13 +62,22 @@ class MainWin : public QWebView
...
@@ -56,13 +62,22 @@ class MainWin : public QWebView
QFile
htmlfile
;
QFile
htmlfile
;
QString
htmlFileName
;
QString
htmlFileName
;
private
:
QHash
<
QString
,
SKHandlerFunction
>
_handlers
;
public
:
public
:
MainWin
(
QFile
&
htmlfile
);
MainWin
(
QFile
&
htmlfile
);
~
MainWin
();
~
MainWin
();
void
sendMessage
(
SKMessage
::
SKMessage
&
msg
);
void
registerHandler
(
QString
type
,
SKHandlerFunction
handler
);
void
handle_corestarted
(
SKMessage
::
SKMessage
&
msg
);
public
slots
:
public
slots
:
void
msgFromCore
(
SKMessage
::
SKMessage
&
msg
);
void
msgFromCore
(
SKMessage
::
SKMessage
&
msg
);
signals
:
void
putMessage
(
SKMessage
::
SKMessage
msg
);
};
};
...
...
src/skylivex.cpp
View file @
c29db5c4
...
@@ -57,8 +57,6 @@ void SkyliveX::initialize()
...
@@ -57,8 +57,6 @@ void SkyliveX::initialize()
void
SkyliveX
::
process
()
void
SkyliveX
::
process
()
{
{
//SKMessage::SKMessage sarca("ANTANI!");
//sendMessage(sarca);
}
}
...
@@ -85,6 +83,8 @@ void SkyliveX::loadPlugins()
...
@@ -85,6 +83,8 @@ void SkyliveX::loadPlugins()
std
::
cout
<<
plugin
<<
std
::
endl
;
std
::
cout
<<
plugin
<<
std
::
endl
;
}
}
}
}
SKMessage
::
SKMessage
msg
(
"coreStarted"
);
sendMessage
(
msg
);
}
}
void
SkyliveX
::
initializePlugin
(
QObject
*
plugin
,
QString
filename
)
void
SkyliveX
::
initializePlugin
(
QObject
*
plugin
,
QString
filename
)
...
...
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