ndgui/NetworkDiscovery

/home/niklas/workspace/fbgui/src/javascriptinterface.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2010,2011 - RZ Uni Freiburg
00003  * Copyright (c) 2010,2011 - OpenSLX Project
00004  *
00005  * This program/file is free software distributed under the GPL version 2.
00006  * See http://openslx.org/COPYING
00007  *
00008  * If you have any feedback please consult http://openslx.org/feedback and
00009  * send your feedback to feedback@openslx.org
00010  *
00011  * General information about OpenSLX can be found under http://openslx.org
00012  *
00013  *
00014  *         Interface for javascript.
00015  *
00016  */
00017 
00018 #ifndef JAVASCRIPTINTERFACE_H_
00019 #define JAVASCRIPTINTERFACE_H_
00020 
00021 #include "fbgui.h"
00022 
00023 class JavascriptInterface: public QObject {
00024 Q_OBJECT
00025 public:
00026    JavascriptInterface(QWebFrame* parent);
00027    ~JavascriptInterface();
00028 
00029 private:
00030    // pointer to parent
00031    QWebFrame* _parent;
00032    // function to be called withint javascript when downloads are done.
00033    QString _callbackOnDownloadsFinished;
00034    // loads jQuery code
00035    void loadJQuery();
00036 
00037    signals:
00038    // request the file from download manager
00039    void requestFile(const QString& filename);
00040    // quit the application
00041    void quitFbgui();
00042    // shut off the system. connected to  fbgui::performShutDown()
00043    void shutDownClient();
00044    // reboot the system. connected to  fbgui::performReboot()
00045    void rebootClient();
00046 
00047 public slots:
00048    // make sure the interface stays attached on webpage reload
00049    void attachToDOM();
00050 
00051    // slots for calling from the webpage
00052    void startDownload(const QString& filename);
00053    void setCallbackOnFinished(const QString& function);
00054    const QString getSysInfo(const QString& info);
00055    void quit();
00056    void shutDown();
00057    void reboot();
00058 
00059    // callback when downloads are done.
00060    void callbackOnFinished();
00061 
00062    // slots for information exchange with the download manager.
00063    void updateProgressBar(const int& percent, const double& speed,
00064          const QString& unit);
00065    void downloadInfo(const QString& filename, const double& filesize);
00066    void notify(const QString& msg);
00067 
00068    // functions to help test functionality
00069    void trigger();
00070 };
00071 
00072 #endif // JAVASCRIPTINTERFACE_H_
 All Classes Files Functions Variables Defines