summaryrefslogtreecommitdiffstats
path: root/src/gui/connectionDialog.h
blob: 8f268d4d43c3ffe9fcfbec9d4c7567ed4197f440 (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
118
119
120
121
122
123
#ifndef _CONNECTIONDIALOG_H_
#define _CONNECTIONDIALOG_H_
#include <src/gui/mainWindow.h>
//#include <src/core/pvsCore.h>
//#include <src/util/pvsUtil.h>


class MainWindow;

/**	ConnectionDialog
  *	Abstract base class for dialogs
  */

class ConnectionDialog : public Gtk::Window
{

public:
    ConnectionDialog(MainWindow* newParent, const Glib::ustring& title);
    ~ConnectionDialog();

protected:

    virtual void on_button_ok_click();	// callback for ok button
    virtual void on_button_cancel_click();	// callback for cancel button

    Gtk::VBox	contentBox;		// box containing the individual content of the dialogs
    Gtk::HBox	buttonBox;		// box containing the shared buttons (ok & cancel) of the dialogs
    Gtk::VBox	windowBox;		// box containing content and button boxes
    Gtk::Button	buttonOK;		// the ok button
    Gtk::Button	buttonCancel;		// the cancel button
    MainWindow*	myParent;		// pointer to the parenting window

};


/**	PasswordDialog
  *	dialog with the sole purpose to ask for a password (if requested)
  */


class PasswordDialog : public ConnectionDialog
{

public:

    PasswordDialog(MainWindow* newParent, const Glib::ustring& title, QString* newTargetPW); 	// the PasswordDialog constructor takes a pointer to a string for the sole
    // reason that it is not connected to the connection that asks for a password and therefore cannot tell the user to which
    // connection it belongs. So the connection puts the hostname in the string which the pointer is pointing to for the password
    // dialog to read out and show to the user. The string is then overwritten with the password the user entered and then used
    // inside the connection to feed the password request.
    ~PasswordDialog();

protected:

    void on_enter_password();
    void on_button_ok_click();
    void on_button_cancel_click();

    Gtk::Frame	frameIP;
    Gtk::Entry	entryPW;

private:
    QString password, *targetPW;
};

/**	NewConDialog
  *	dialog to open up a new connection to a vnc server
  *	offers the options
  *		* to enter a password to not come up
  *		  with a password dialog later
  *		* to read prefab connections from a file
  */


class NewConDialog : public ConnectionDialog
{

public:
    NewConDialog(MainWindow* newParent, const Glib::ustring& title);
    ~NewConDialog();

protected:

    void on_enter_password();	// callback when enter was hit in the password text field.
    void on_enter_IP();		// callback when enter was hit in the IP/Host text field

    void on_button_ok_click();	// ok button callback
    void on_button_fromFile_click();// read-from-file button callback

    Gtk::Frame	frameIP;	// just a frame around the IP text field
    Gtk::Frame	framePW;	// the same for the pw field
    Gtk::Button	buttonFromFile;	// button to read out a file
    Gtk::Entry	entryIP;	// text field for the IP/Hostname
    Gtk::Entry	entryPW;	// text field for the password (optional)

private:
    QString connection_password;
    QString connection_IP;
};

class MessageDialog : public ConnectionDialog
{

public:
    MessageDialog(MainWindow* newParent, const Glib::ustring& title, QString* newMessage);
    ~MessageDialog();

protected:

    void on_enter_message();	// callback when enter was hit in the text field.

    void on_button_ok_click();	// ok button callback
    void on_button_fromFile_click();// read-from-file button callback

    Gtk::Frame	frameMsg;	// just a frame around the text
    Gtk::Entry	entryMsg;	// text field for the message

private:
    QString * message;
};


#endif