summaryrefslogtreecommitdiffstats
path: root/src/fbgui/ndgui.h
blob: 1cb285c8c112cbb65b26268266666fef5ddbbcaf (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/**
 * Copyright (c) 2010,2011 - RZ Uni Freiburg
 * Copyright (c) 2010,2011 - OpenSLX Project
 *
 * This program/file is free software distributed under the GPL version 2.
 * See http://openslx.org/COPYING
 *
 * If you have any feedback please consult http://openslx.org/feedback and
 * send your feedback to feedback@openslx.org
 *
 * General information about OpenSLX can be found under http://openslx.org
 */



#ifndef NDGUI_H
#define NDGUI_H

#include <QtGui>
#include <QtWebKit>
#include <QVariant>

#include "fbgui.h"
#include "networkdiscovery.h"


extern QString gServerIp;
extern bool gAutoUp;
extern QString gSocketServerPath;
extern QString gPathToDhcpExe;

class ndgui: public QMainWindow
{
  Q_OBJECT

public:
  ndgui(QMainWindow *parent = 0);
  ~ndgui();
  Q_INVOKABLE QVariantList getManualConfInterfaces();
  Q_INVOKABLE int ip4_setManualConfiguration(QVariantMap result);
  Q_INVOKABLE QString readLogFile();
  Q_INVOKABLE QVariantMap getInterfaceConf(QString ifName);

  void init();

public slots:
  void handleConnectionEstablished(QString ifName);
  void abortBoot(QString msg);
  void chooseInterfaceDialog(QString msg);
  void handleAllProcessesFinished();

  void restartSystem();
  void shutDownSystem();
  void continueBoot(QString ifName);
  void continueBootWithoutCheck(QString ifName);
  void tryAgain();


  void startSingleShot();
  void startNetworkDiscovery();

  /*test for html gui version*/
  void attachToDOM();
  void loadJQuery();
  void addInterface(const QString &ifName);
  void updateIfStatus(const QString &ifName, const QString &status);
  void updateStatus(const QString &status);
  void updateIfProgressBar(const QString &ifName, const int& percent);
  void notifyCall(QString msg);

signals:
  void initFbgui();

private slots:
  void setUserChoiceTrue();

private:

  QString _tag;

  void createAction();

  bool _userChoice;

  bool _started;

  QWebView* _webView;

  QAction* _allowUserChoice;

  QAction* _tryAgain;

  NetworkDiscovery* _networkDiscovery;

  QList<QString> _ifNameList;		// maps interfaceName to its gateway

  QList<QString> _manConfList;

  QString _manualConfInterfaces;

  // QSplitter to split the main window in two resizable frames.
  QSplitter* _splitter;
  // QTextEdit implementing a minimalistic debug console.
  QTextEdit* _debugConsole;

  // triggers toggleDebugConsole()
  QAction* _toggleDebugConsole;


  void setupLayout();
  void createDebugConsole();
  void toggleDebugConsole();


};

#endif // NDGUI_H