]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/console/console.h
Get job defaults
[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 struct job_defaults {
46    char job_name[MAX_NAME_LENGTH];
47    char pool_name[MAX_NAME_LENGTH];
48    char messages_name[MAX_NAME_LENGTH];
49    char client_name[MAX_NAME_LENGTH];
50    char store_name[MAX_NAME_LENGTH];
51    char where[MAX_NAME_LENGTH];
52    char level[MAX_NAME_LENGTH];
53    char type[MAX_NAME_LENGTH];
54    char fileset_name[MAX_NAME_LENGTH];
55    char catalog_name[MAX_NAME_LENGTH];
56    bool enabled;
57 };
58
59 class DIRRES;
60 class BSOCK;
61 class JCR;
62 class CONRES;
63
64 class Console : public QWidget, public Ui::ConsoleForm
65 {
66    Q_OBJECT 
67
68 public:
69    Console(QStackedWidget *parent);
70    void set_text(const char *buf);
71    void set_text(const QString buf);
72    void set_textf(const char *fmt, ...);
73    void update_cursor(void);
74    void write_dir(const char *buf);
75    bool authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
76    bool is_connected() { return m_sock != NULL; };
77    const QFont get_font();
78    void writeSettings();
79    void readSettings();
80    char *msg();
81    void setEnabled(bool enable) { m_notifier->setEnabled(enable); };
82    QStringList get_list(char *cmd);
83    bool get_job_defaults(struct job_defaults &);
84
85    QStringList job_list;
86    QStringList client_list;
87    QStringList fileset_list;
88    QStringList messages_list;
89    QStringList pool_list;
90    QStringList storage_list;
91    QStringList type_list;
92    QStringList level_list;
93
94 public slots:
95    void connect(void);
96    void read_dir(int fd);
97    int read(void);
98    int write(const char *msg);
99    void status_dir(void);
100    void set_font(void);
101
102 private:
103    QTextEdit *m_textEdit;
104    DIRRES *m_dir;
105    BSOCK *m_sock;   
106    bool m_at_prompt;
107    QSocketNotifier *m_notifier;
108    QTextCursor *m_cursor;
109    QTreeWidgetItem *m_consoleItem;
110 };
111
112 #endif /* _CONSOLE_H_ */