summaryrefslogtreecommitdiffstats
path: root/workspace/LogReceiver/logreceiver.h
blob: 2dce00a46c641cd5e5cd09a73a34a2c421b818fa (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
#ifndef LOGRECEIVER_H
#define LOGRECEIVER_H

#include <QDialog>
#include <QtGui/QWidget>
#include <qprocess.h>
#include <qnetworkinterface.h>
#include <qprogressbar.h>
#include <qboxlayout.h>
#include <qgroupbox.h>
#include "ui_logreceiver.h"

class QLabel;
class QPushButton;
class QLocalServer;
class QLocalSocket;

class LogReceiver: public QDialog {
Q_OBJECT

public:
	LogReceiver(QWidget *parent = 0);
	~LogReceiver();

private slots:
	void handleNewConnection();
	void handleNewInput();
	void handleNewInputLine(QString data);
	void handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
	void handleProcessStarted();
	void handleProgress(int iFaceIndex, int newValue);

private:
	Ui::LogReceiverClass ui;
	QLabel *statusLabel;
	QPushButton *quitButton;
	QLocalServer *server;
	quint16 blockSize;
	QMap<int, QNetworkInterface > interfacesMap;
	QMap<QString, int> indexToIfaceNameMap;
	QMap<QLocalSocket *, QLocalSocket *> clients;
	QMap<Q_PID, QProcess * > clientProcesses;
	QString pathToDhcpcdExe;
	QStringList dhcpcdArguments;


	/*gui elements*/
	QMap<int , QProgressBar *> progressBars;
	QLabel *ndStatusLabel;
	QGroupBox *interfaceGroupBox;
	QVBoxLayout *mainLayout;
	QVBoxLayout *interfaceGroupBoxLayout;
	/**/

	void runDHCPCD(QList<QNetworkInterface> &interfaces);
	void runDHCPCD(QString interface);
	QList<QNetworkInterface> getListOfNetworkInterfaces();

	/*gui functions*/
	void buildGui();
	void createInterfaceGroupBox();
	void addInterfacesToGroupBox(QMap<int, QNetworkInterface > &interfaces);
	bool checkBlackList(QString i);
};

#endif // LOGRECEIVER_H