]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/console/console.h
Oops. When I changed the contents of the field earlier, I forgot to make this change
[bacula/bacula] / bacula / src / qt-console / console / console.h
index be9509cee4f0a4ca2a935a496f26f1c31262b738..a2107dac04abb5223c2c65d2e0118ceef91620d0 100644 (file)
@@ -1,17 +1,16 @@
 #ifndef _CONSOLE_H_
 #define _CONSOLE_H_
-
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2007-2007 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 plus additions
-   that are listed in the file LICENSE.
+   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
@@ -35,8 +34,8 @@
  */
 
 #include <QtGui>
+#include "pages.h"
 #include "ui_console.h"
-#include "restore.h"
 
 #ifndef MAX_NAME_LENGTH
 #define MAX_NAME_LENGTH 128
@@ -56,17 +55,6 @@ struct job_defaults {
    QString type;
    QString fileset_name;
    QString catalog_name;
-#ifdef xxx
-   char pool_name[MAX_NAME_LENGTH];
-   char messages_name[MAX_NAME_LENGTH];
-   char client_name[MAX_NAME_LENGTH];
-   char store_name[MAX_NAME_LENGTH];
-   char where[MAX_NAME_LENGTH];
-   char level[MAX_NAME_LENGTH];
-   char type[MAX_NAME_LENGTH];
-   char fileset_name[MAX_NAME_LENGTH];
-   char catalog_name[MAX_NAME_LENGTH];
-#endif
    bool enabled;
 };
 
@@ -75,27 +63,48 @@ class BSOCK;
 class JCR;
 class CONRES;
 
-class Console : public QWidget, public Ui::ConsoleForm
+class Console : public Pages, public Ui::ConsoleForm
 {
    Q_OBJECT 
 
 public:
    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);
-   bool authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
+   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();
-   void setEnabled(bool enable) { m_notifier->setEnabled(enable); };
+   void notify(bool enable);
    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 &);
 
    QStringList job_list;
    QStringList client_list;
@@ -106,22 +115,34 @@ public:
    QStringList type_list;
    QStringList level_list;
 
+
 public slots:
-   void connect(void);
+   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_consoleItem;
+   QTreeWidgetItem *m_directorTreeItem;
+   bool m_api_set;
+   bool m_messages_pending;
+   QTimer *m_timer;
 };
 
 #endif /* _CONSOLE_H_ */