]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/console/console.h
Start restore tree
[bacula/bacula] / bacula / src / qt-console / console / console.h
1 #ifndef _CONSOLE_H_
2 #define _CONSOLE_H_
3
4 /*
5    Bacula® - The Network Backup Solution
6
7    Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
8
9    The main author of Bacula is Kern Sibbald, with contributions from
10    many others, a complete list can be found in the file AUTHORS.
11    This program is Free Software; you can redistribute it and/or
12    modify it under the terms of version two of the GNU General Public
13    License as published by the Free Software Foundation plus additions
14    that are listed in the file LICENSE.
15
16    This program is distributed in the hope that it will be useful, but
17    WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19    General Public License for more details.
20
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24    02110-1301, USA.
25
26    Bacula® is a registered trademark of John Walker.
27    The licensor of Bacula is the Free Software Foundation Europe
28    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
29    Switzerland, email:ftf@fsfeurope.org.
30 */
31 /*
32  *   Version $Id$
33  *
34  *   Kern Sibbald, January 2007
35  */
36
37 #include <QtGui>
38 #include "ui_console.h"
39 #include "restore.h"
40
41 #ifndef MAX_NAME_LENGTH
42 #define MAX_NAME_LENGTH 128
43 #endif
44
45 /*
46  * Structure for obtaining the defaults for a job
47  */
48 struct job_defaults {
49    QString job_name;
50    QString pool_name;
51    QString messages_name;
52    QString client_name;
53    QString store_name;
54    QString where;
55    QString level;
56    QString type;
57    QString fileset_name;
58    QString catalog_name;
59    bool enabled;
60 };
61
62 class DIRRES;
63 class BSOCK;
64 class JCR;
65 class CONRES;
66
67 class Console : public QWidget, public Ui::ConsoleForm
68 {
69    Q_OBJECT 
70
71 public:
72    Console(QStackedWidget *parent);
73    void display_text(const char *buf);
74    void display_text(const QString buf);
75    void display_textf(const char *fmt, ...);
76    void update_cursor(void);
77    void write_dir(const char *buf);
78    bool authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
79    bool is_connected() { return m_sock != NULL; };
80    const QFont get_font();
81    void writeSettings();
82    void readSettings();
83    char *msg();
84    void setEnabled(bool enable) { m_notifier->setEnabled(enable); };
85    QStringList get_list(char *cmd);
86    bool get_job_defaults(struct job_defaults &);
87    void terminate();
88    void beginNewCommand();
89    void displayToPrompt();
90
91    QStringList job_list;
92    QStringList client_list;
93    QStringList fileset_list;
94    QStringList messages_list;
95    QStringList pool_list;
96    QStringList storage_list;
97    QStringList type_list;
98    QStringList level_list;
99
100 public slots:
101    void connect(void);
102    void read_dir(int fd);
103    int read(void);
104    int write(const char *msg);
105    int write(QString msg);
106    void status_dir(void);
107    void set_font(void);
108
109 private:
110    QTextEdit *m_textEdit;
111    DIRRES *m_dir;
112    BSOCK *m_sock;   
113    bool m_at_prompt;
114    QSocketNotifier *m_notifier;
115    QTextCursor *m_cursor;
116    QTreeWidgetItem *m_consoleItem;
117 };
118
119 #endif /* _CONSOLE_H_ */