summaryrefslogtreecommitdiffstats
path: root/src/JSObject.h
blob: 3229def37ac4142263c72cc6c4b0b2299ca62a1a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
 * jsObject.h
 *
 *  Created on: Feb 1, 2011
 *      Author: niklas
 * The purpose of the jsObject class is to provide signals which will be emited in the javascript functions.
 * Those javascript functions are writen in a seperate file: jsFunktions.js
 */

#ifndef JSOBJECT_H_
#define JSOBJECT_H_

#include "fbbrowser.h"

typedef enum 
{
	QUIT,
	SHOW_USB_DEVICES,
	SHOW_HARDDRIVES,
	SHOW_MAC_ADDRESS,
	SHOW_IP_ADDRESS,
	SHOW_TIME,
	SHOW_DATE
} jsAction;

class fbbrowser;
class QWebFrame;
class JSObject : public QObject
{
	Q_OBJECT

private:
	QWebFrame* _parent;

public:
	JSObject(QWebFrame *parent);
	virtual ~JSObject();


// no slots needed. class provides only signals
// private slots:
//	void performAction(jsAction a);

// define all the needed signals.
// every action gets its own signal. (the former enum is not needed anymore)
// the signals will be connected in the fbbrowser class with slots of the fbbrowser class

signals:
	void requestFile(QString& filename);
	void getMAC();
	void getTime();
	void signalQuitAll();
	/*
	// should be the last signal to be emited. 
	// Will close the browser and continues the boot sequence
	void closeBrowser();
	// will start the download of all needed files for the following boot sequence
	void startDownload(QString filename);
	// starts the slot which is responsible for extracting the MAC address of the machine
	// the MAC Address will be the parameter of a javascript function which will present it on the webpage
	void getMacAddress();
	// starts the slot which is responsible for extracting the IP address of the machine
	// the IP address will be the parameter of a javascript function which will present it on the webpage
	void getIpAddress();
	// starts the slot which is responsible for extracting the integrated hardware devices of the machine
	// the array of  integrated hardware devices will be the parameter of a javascript function which will present 		// it on the webpage
	void getIntegratedHardwareDevices();
	// starts the slot which is responsible for extracting the usb devices of the machine
	// the array of usb devices will be the parameter of a javascript function which will present it on the webpag
	void getUsbDevices();
	// starts the slot which is responsible for extracting the hard drive devices of the machine
	// the array of hard rive devices will be the parameter of a javascript function which will present it on the 		// webpag
	void getHardDrives();
	*/


public slots:
	/* Slots to commucate with fbbrowser. */
	void attachToDOM();
	void updateProgress(int i);
	void printMAC(QString& macAddress);
	void printTime(QString& time);

	/* Slots for calling from within Javascript. */
	void quitAll();
	void startDownload(QString filename);
	void getMacAddress();
	void showTime();
	void showHelloWorld();

	// Not yet implemented.
	void getSysInfo();
	void getIpAddress();
	void getIntegratedHardwareDevices();
	void getUsbDevices();
	void getHardDrives();

	// for testing reasons
	void showDate();
};

#endif /* JSOBJECT_H_ */