]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/console/console.h
Implement first cut of job defaults in run dialog
[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 #ifdef xxx
60    char pool_name[MAX_NAME_LENGTH];
61    char messages_name[MAX_NAME_LENGTH];
62    char client_name[MAX_NAME_LENGTH];
63    char store_name[MAX_NAME_LENGTH];
64    char where[MAX_NAME_LENGTH];
65    char level[MAX_NAME_LENGTH];
66    char type[MAX_NAME_LENGTH];
67    char fileset_name[MAX_NAME_LENGTH];
68    char catalog_name[MAX_NAME_LENGTH];
69 #endif
70    bool enabled;
71 };
72
73 class DIRRES;
74 class BSOCK;
75 class JCR;
76 class CONRES;
77
78 class Console : public QWidget, public Ui::ConsoleForm
79 {
80    Q_OBJECT 
81
82 public:
83    Console(QStackedWidget *parent);
84    void display_text(const char *buf);
85    void display_text(const QString buf);
86    void display_textf(const char *fmt, ...);
87    void update_cursor(void);
88    void write_dir(const char *buf);
89    bool authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
90    bool is_connected() { return m_sock != NULL; };
91    const QFont get_font();
92    void writeSettings();
93    void readSettings();
94    char *msg();
95    void setEnabled(bool enable) { m_notifier->setEnabled(enable); };
96    QStringList get_list(char *cmd);
97    bool get_job_defaults(struct job_defaults &);
98    void terminate();
99
100    QStringList job_list;
101    QStringList client_list;
102    QStringList fileset_list;
103    QStringList messages_list;
104    QStringList pool_list;
105    QStringList storage_list;
106    QStringList type_list;
107    QStringList level_list;
108
109 public slots:
110    void connect(void);
111    void read_dir(int fd);
112    int read(void);
113    int write(const char *msg);
114    void status_dir(void);
115    void set_font(void);
116
117 private:
118    QTextEdit *m_textEdit;
119    DIRRES *m_dir;
120    BSOCK *m_sock;   
121    bool m_at_prompt;
122    QSocketNotifier *m_notifier;
123    QTextCursor *m_cursor;
124    QTreeWidgetItem *m_consoleItem;
125 };
126
127 #endif /* _CONSOLE_H_ */