]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/console/console.h
Get bat select dialog working
[bacula/bacula] / bacula / src / qt-console / console / console.h
1 #ifndef _CONSOLE_H_
2 #define _CONSOLE_H_
3 /*
4    Bacula® - The Network Backup Solution
5
6    Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
7
8    The main author of Bacula is Kern Sibbald, with contributions from
9    many others, a complete list can be found in the file AUTHORS.
10    This program is Free Software; you can redistribute it and/or
11    modify it under the terms of version two of the GNU General Public
12    License as published by the Free Software Foundation plus additions
13    that are listed in the file LICENSE.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25    Bacula® is a registered trademark of John Walker.
26    The licensor of Bacula is the Free Software Foundation Europe
27    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
28    Switzerland, email:ftf@fsfeurope.org.
29 */
30 /*
31  *   Version $Id$
32  *
33  *   Kern Sibbald, January 2007
34  */
35
36 #include <QtGui>
37 #include "ui_console.h"
38 #include "restore.h"
39 #include "select.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);
85    QStringList get_list(char *cmd);
86    bool get_job_defaults(struct job_defaults &);
87    void terminate();
88    void beginNewCommand();
89    void displayToPrompt();
90    void discardToPrompt();
91    void setTreeItem(QTreeWidgetItem *item);
92    void setDirRes(DIRRES *dir);
93
94    QStringList job_list;
95    QStringList client_list;
96    QStringList fileset_list;
97    QStringList messages_list;
98    QStringList pool_list;
99    QStringList storage_list;
100    QStringList type_list;
101    QStringList level_list;
102
103
104 public slots:
105    void connect();                     
106    void read_dir(int fd);
107    int read(void);
108    int write(const char *msg);
109    int write(QString msg);
110    void status_dir(void);
111    void set_font(void);
112    void poll_messages(void);
113
114 private:
115    QTextEdit *m_textEdit;
116    DIRRES *m_dir;
117    BSOCK *m_sock;   
118    bool m_at_prompt;
119    QSocketNotifier *m_notifier;
120    QTextCursor *m_cursor;
121    QTreeWidgetItem *m_consoleItem;
122    bool m_api_set;
123    bool m_messages_pending;
124    QTimer *m_timer;
125 };
126
127 #endif /* _CONSOLE_H_ */