userlist is quasi-ready

parent 60f7357f
......@@ -45,10 +45,15 @@ skyliveClass.prototype.userlistChange = function(action, u){
}
}
};
skyliveClass.prototype.changeTelescope = function(tele){
if(typeof(telescopeChanged)=="function")
telescopeChanged(tele);
};
SkyliveXPage = new skyliveClass();
SkyliveX.changeContent.connect(SkyliveXPage.changeContent);
SkyliveX.notify.connect(SkyliveXPage.notify);
SkyliveX.alertmsg.connect(SkyliveXPage.msgalert);
SkyliveX.public_received.connect(SkyliveXPage.publicReceived);
SkyliveX.userlist_change.connect(SkyliveXPage.userlistChange);
//SkyliveX.userlist_change.connect(SkyliveXPage.userlistChange);
SkyliveX.changeTelescope.connect(SkyliveXPage.changeTelescope);
<html debug=true>
<head>
<title>SkyliveX 0.1.0</title>
<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
<!-- <script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script> -->
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="SkyliveX.js"></script>
<script type="text/javascript">
......@@ -18,6 +18,7 @@
sendMsg();
}
}
telescopenum = "1";
</script>
<style>
......@@ -190,7 +191,7 @@
{
var d = new Date();
$.get("http://live1.skylive.name/tele1/userlist.txt?"+d.getTime(), function(data) {
$.get("http://live1.skylive.name/tele"+telescopenum+"/userlist.txt?"+d.getTime(), function(data) {
var ad=$("#admins");
ad.empty();
var uarr = data.split("\n");
......@@ -204,6 +205,12 @@
});
});
}
function telescopeChanged(tele)
{
telescopenum=tele;
updateUserlist();
}
document.addEventListener('DOMContentLoaded',function(){
//setTimeout(function() { SkyliveX.resizeWin(636, 420); }, 500);
updateUserlist();
......
......@@ -64,6 +64,7 @@ class JSBridge : public QObject
void public_received(QString user, QString content);
void updateUserList(QString user, QString utype, QString direction);
void deleteUserList();
void changeTelescope(QString telescope);
public slots:
void pushLogin(QString username, QString password);
......
......@@ -135,6 +135,10 @@ void SkyliveX::receiveFromGui(SKMessage &msg)
connect(msg.webwin, SIGNAL(putMessage(SKMessage&)), this, SLOT(receiveFromGui(SKMessage&)));
connect(this, SIGNAL(msgForGui(SKMessage&)), msg.webwin, SLOT(msgFromCore(SKMessage&)));
}
if(msg.handle=="changeTelescope")
{
emit msgForGui(msg);
}
emit msgForPlugins(msg);
}
......
......@@ -198,8 +198,8 @@ 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 != msgsender)
std::cout << "WebWindow msg received: " << msg.handle.toStdString() << std::endl;
if(_handlers.contains(msg.handle) && (msg.handle=="changeTelescope" || msg.sender != msgsender))
{
SKHandlerFunction mf =_handlers[msg.handle];
(this->*mf)(msg);
......@@ -279,6 +279,8 @@ SkylivexWin::SkylivexWin(QString &htmlfile)
registerHandler((QString)"notify", (SKHandlerFunction)&SkylivexWin::handle_notify);
registerHandler((QString)"publicchatrcv", (SKHandlerFunction)&SkylivexWin::handle_chatreceived);
registerHandler((QString)"userlist", (SKHandlerFunction)&SkylivexWin::handle_userlist);
registerHandler((QString)"changeTelescope", (SKHandlerFunction)&SkylivexWin::handle_changetelescope);
}
......@@ -296,6 +298,7 @@ SkylivexWin::SkylivexWin()
registerHandler((QString)"notify", (SKHandlerFunction)&SkylivexWin::handle_notify);
registerHandler((QString)"publicchatrcv", (SKHandlerFunction)&SkylivexWin::handle_chatreceived);
registerHandler((QString)"userlist", (SKHandlerFunction)&SkylivexWin::handle_userlist);
registerHandler((QString)"changeTelescope", (SKHandlerFunction)&SkylivexWin::handle_changetelescope);
}
......@@ -411,3 +414,11 @@ void SkylivexWin::handle_userlist(SKMessage &msg)
}
}
}
void SkylivexWin::handle_changetelescope(SKMessage &msg)
{
if(msg.parameters.size() > 0)
{
jsbridge->changeTelescope(msg.parameters["telescope"]);
}
}
......@@ -132,6 +132,7 @@ class SkylivexWin : public WebWin
void handle_notify(SKMessage &msg);
void handle_chatreceived(SKMessage &msg);
void handle_userlist(SKMessage &msg);
void handle_changetelescope(SKMessage &msg);
private slots:
void refreshJsObject();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment