Another little bit of code docs

parent 58e61853
...@@ -29,9 +29,10 @@ ...@@ -29,9 +29,10 @@
* *
* File: main.cpp * File: main.cpp
* *
* Purpose: Core file for the SkyliveX client. It provide core * Purpose: Core file for the SkyliveX client.
* functionality as the enter point of the client and * It launches the client and instantiate the main window,
* to load plugins and make them communicate. * the SkyliveX object (IPC and Plugin loading),
* and establish communication between those two
* *
*/ */
#include <QApplication> #include <QApplication>
......
...@@ -27,9 +27,11 @@ ...@@ -27,9 +27,11 @@
* *
******************************************************************** ********************************************************************
* *
* File: splashpage.cpp * File: mainwin.cpp
* *
* Purpose: * Purpose:
* This define special methods for
* the mainwindow
* *
*/ */
#include "mainwin.h" #include "mainwin.h"
...@@ -45,28 +47,66 @@ ...@@ -45,28 +47,66 @@
#include "ipcmsg.h" #include "ipcmsg.h"
#include "jsbridge.h" #include "jsbridge.h"
/* Give a name for the IPC messages to this window */
#define SENDER "maingui" #define SENDER "maingui"
/*
* Method: MainWin
*
* Arguments:
* - QString &htmlfile
*
* This method initialize the mainwindow object
* pointing it to a local html file, and register
* the handlers for the IPC messages that need to be
* handled from the main window.
*
* This class is derived from the SkylivexWin class,
* so, this window object will have a JSBridge
* and can communicate bidirectionally with the
* HTML/javascript side
*
* This will be the primary GUI window, and it will also
* be the father of all others subwindow.
*/
MainWin::MainWin(QString &htmlfile) MainWin::MainWin(QString &htmlfile)
: SkylivexWin(htmlfile) : SkylivexWin(htmlfile)
{ {
// Handle the client initialization stage
registerHandler((QString)"coreStarted", (SKHandlerFunction)&MainWin::handle_corestarted); registerHandler((QString)"coreStarted", (SKHandlerFunction)&MainWin::handle_corestarted);
// Called when the skylive server is connected ( in TCP meaning of connected )
registerHandler((QString)"telescopeConnected", (SKHandlerFunction)&MainWin::handle_connected); registerHandler((QString)"telescopeConnected", (SKHandlerFunction)&MainWin::handle_connected);
// called when we have a login request from the server or from a plugin
registerHandler((QString)"asklogin", (SKHandlerFunction)&MainWin::handle_asklogin); registerHandler((QString)"asklogin", (SKHandlerFunction)&MainWin::handle_asklogin);
// Called when a login succeed
registerHandler((QString)"loginok", (SKHandlerFunction)&MainWin::handle_loginres); registerHandler((QString)"loginok", (SKHandlerFunction)&MainWin::handle_loginres);
// Called when a login fail
registerHandler((QString)"loginfailed", (SKHandlerFunction)&MainWin::handle_loginres); registerHandler((QString)"loginfailed", (SKHandlerFunction)&MainWin::handle_loginres);
// Called when a plugin ask us to open an URL, for example for skylive Slides
registerHandler((QString)"openurl", (SKHandlerFunction)&MainWin::handle_openurl); registerHandler((QString)"openurl", (SKHandlerFunction)&MainWin::handle_openurl);
// Called when a plugin ask us to open the special youtube page window
registerHandler((QString)"youtubevideo", (SKHandlerFunction)&MainWin::handle_youtubevideo); registerHandler((QString)"youtubevideo", (SKHandlerFunction)&MainWin::handle_youtubevideo);
// Called when a plugin ask us to close the special youtube page window
registerHandler((QString)"closeyoutube", (SKHandlerFunction)&MainWin::handle_closeyoutube); registerHandler((QString)"closeyoutube", (SKHandlerFunction)&MainWin::handle_closeyoutube);
// Set the IPC messages sender name
msgsender = SENDER; msgsender = SENDER;
// At initialization, the special youtube page window is closed
yt_is_open=false; yt_is_open=false;
} }
/* Destructor */
MainWin::~MainWin() MainWin::~MainWin()
{ {
......
...@@ -27,9 +27,11 @@ ...@@ -27,9 +27,11 @@
* *
******************************************************************** ********************************************************************
* *
* File: skylivex.h * File: mainwin.h
* *
* Purpose: * Purpose:
* This file define the special WebView derived object for
* the main window
* *
*/ */
#ifndef MAINWIN_H #ifndef MAINWIN_H
...@@ -46,8 +48,10 @@ ...@@ -46,8 +48,10 @@
/* /*
* class MainWin * class MainWin
* This is just a little webkit transparent window * This is needed cause the MainWindow is something
* to show the splash screen * different from the others, all the window
* with access to the c++ core will be subwindow of this one,
* but this will also serve the login window and the splashscreen
*/ */
class MainWin : public SkylivexWin class MainWin : public SkylivexWin
{ {
...@@ -57,9 +61,9 @@ class MainWin : public SkylivexWin ...@@ -57,9 +61,9 @@ class MainWin : public SkylivexWin
public: public:
MainWin(QString &htmlfile); MainWin(QString &htmlfile);
~MainWin(); ~MainWin();
QString msgsender; QString msgsender; // The name of the mainwindow for the IPC messages
WebWin* yt; WebWin* yt; // a pointer to the special (singleton) Youtube window (if exists)
bool yt_is_open; bool yt_is_open; // a boolean to indicate if the Youtube window is open
void handle_corestarted(SKMessage &msg); void handle_corestarted(SKMessage &msg);
void handle_connected(SKMessage &msg); void handle_connected(SKMessage &msg);
void handle_asklogin(SKMessage &msg); void handle_asklogin(SKMessage &msg);
...@@ -68,7 +72,7 @@ class MainWin : public SkylivexWin ...@@ -68,7 +72,7 @@ class MainWin : public SkylivexWin
void handle_youtubevideo(SKMessage &msg); void handle_youtubevideo(SKMessage &msg);
void handle_closeyoutube(SKMessage &msg); void handle_closeyoutube(SKMessage &msg);
public slots: public slots:
void ytclosesignal(); void ytclosesignal(); // This slot is needed to close the special youtube window
}; };
......
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