X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fqt-console%2Fconsole%2Fconsole.h;h=65ab2d8c9cfd62c564dd195ce6f2c3069c873e98;hb=32cb8ccf5fb8eb828ad2d623020cdb53d2d0b81e;hp=cd2340cbe34afb402b4a7ff3c21458b592bd047a;hpb=31a81fb3c3c261c62fe75a2cb1aad758a3724cc4;p=bacula%2Fbacula diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index cd2340cbe3..65ab2d8c9c 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -1,39 +1,153 @@ - #ifndef _CONSOLE_H_ #define _CONSOLE_H_ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2007-2008 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version two of the GNU General Public + License as published by the Free Software Foundation and included + in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of Kern Sibbald. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Version $Id$ + * + * Kern Sibbald, January 2007 + */ #include +#include "pages.h" +#include "ui_console.h" + +#ifndef MAX_NAME_LENGTH +#define MAX_NAME_LENGTH 128 +#endif + +/* + * Structure for obtaining the defaults for a job + */ +struct job_defaults { + QString job_name; + QString pool_name; + QString messages_name; + QString client_name; + QString store_name; + QString where; + QString level; + QString type; + QString fileset_name; + QString catalog_name; + bool enabled; +}; class DIRRES; class BSOCK; class JCR; class CONRES; -class Console : public QWidget +class Console : public Pages, public Ui::ConsoleForm { Q_OBJECT public: - Console(); - void set_text(const char *buf); - void set_textf(const char *fmt, ...); - void set_statusf(const char *fmt, ...); - void set_status_ready(); - void set_status(const char *buf); + Console(QStackedWidget *parent); + ~Console(); + void display_text(const char *buf); + void display_text(const QString buf); + void display_textf(const char *fmt, ...); + void display_html(const QString buf); + void update_cursor(void); void write_dir(const char *buf); + int sock_read(); + bool dir_cmd(const char *cmd, QStringList &results); + bool dir_cmd(QString &cmd, QStringList &results); + bool sql_cmd(const char *cmd, QStringList &results); + bool sql_cmd(QString &cmd, QStringList &results); + bool authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons, + char *buf, int buflen); + bool is_connected() { return m_sock != NULL; }; + bool is_ready() { return is_connected() && m_at_prompt && m_at_main_prompt; }; + bool is_connectedGui(); + bool preventInUseConnect(); + const QFont get_font(); + void writeSettings(); + void readSettings(); + char *msg(); + bool notify(bool enable); // enables/disables socket notification - returns the previous state + bool is_notify_enabled() const; + QStringList get_list(char *cmd); + bool get_job_defaults(struct job_defaults &); + void terminate(); + void beginNewCommand(); + void displayToPrompt(); + void discardToPrompt(); + void setDirectorTreeItem(QTreeWidgetItem *); + void setDirRes(DIRRES *dir); + QTreeWidgetItem *directorTreeItem() { return m_directorTreeItem; }; + void getDirResName(QString &); + void startTimer(); + void stopTimer(); + void getVolumeList(QStringList &); + void getStatusList(QStringList &); + bool is_messagesPending() { return m_messages_pending; }; + + QStringList job_list; + QStringList client_list; + QStringList fileset_list; + QStringList messages_list; + QStringList pool_list; + QStringList storage_list; + QStringList type_list; + QStringList level_list; + public slots: - void connect(); + void connect_dir(); void read_dir(int fd); + int read(void); + int write(const char *msg); + int write(QString msg); + void status_dir(void); + void messages(void); + void set_font(void); + void poll_messages(void); + void consoleHelp(); + void consoleReload(); + +public: + DIRRES *m_dir; /* so various pages can reference it */ private: QTextEdit *m_textEdit; - DIRRES *m_dir; BSOCK *m_sock; bool m_at_prompt; + bool m_at_main_prompt; QSocketNotifier *m_notifier; + QTextCursor *m_cursor; + QTreeWidgetItem *m_directorTreeItem; + bool m_api_set; + bool m_messages_pending; + QTimer *m_timer; + bool hasFocus(); + bool messagesPending(bool pend); }; -extern int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons); - #endif /* _CONSOLE_H_ */