]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/mainwin.h
Insure that bat.conf is not overwritten during installation.
[bacula/bacula] / bacula / src / qt-console / mainwin.h
1 /*
2    Bacula® - The Network Backup Solution
3
4    Copyright (C) 2007-2007 Free Software Foundation Europe e.V.
5
6    The main author of Bacula is Kern Sibbald, with contributions from
7    many others, a complete list can be found in the file AUTHORS.
8    This program is Free Software; you can redistribute it and/or
9    modify it under the terms of version two of the GNU General Public
10    License as published by the Free Software Foundation plus additions
11    that are listed in the file LICENSE.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23    Bacula® is a registered trademark of John Walker.
24    The licensor of Bacula is the Free Software Foundation Europe
25    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26    Switzerland, email:ftf@fsfeurope.org.
27 */
28 /* 
29  *   Version $Id$
30  *
31  * qt-console main window class definition.
32  *
33  *  Written by Kern Sibbald, January MMVII
34  */
35
36 #ifndef _MAINWIN_H_
37 #define _MAINWIN_H_
38
39 #include <QtGui>
40 #include <QList>
41 #include "ui_main.h"
42 #include "label/label.h"
43 #include "run/run.h"
44 #include "pages.h"
45 #include "restore/restore.h"
46 #include "medialist/medialist.h"
47 #include "joblist/joblist.h"
48 #include "clients/clients.h"
49
50 class Console;
51
52 class MainWin : public QMainWindow, public Ui::MainForm    
53 {
54    Q_OBJECT
55
56 public:
57    MainWin(QWidget *parent = 0);
58    void set_statusf(const char *fmt, ...);
59    void set_status_ready();
60    void set_status(const char *buf);
61    void writeSettings();
62    void readSettings();
63    void resetFocus() { lineEdit->setFocus(); };
64    void setContextMenuDockText();
65    void setContextMenuDockText(Pages *, QTreeWidgetItem *);
66    void setTreeWidgetItemDockColor(Pages *, QTreeWidgetItem *);
67    void setTreeWidgetItemDockColor(Pages *);
68    void hashInsert(QTreeWidgetItem *, Pages *);
69    void hashRemove(Pages *);
70    void hashRemove(QTreeWidgetItem *, Pages *);
71    QTreeWidgetItem *currentTopItem() { return m_currentConsole->directorTreeItem(); };
72    Console *currentConsole() { return m_currentConsole; };
73    Pages* getFromHash(QTreeWidgetItem *);
74    QTreeWidgetItem* getFromHash(Pages *);
75    /* This hash is to get the page when the page selector widget is known */
76    QHash<QTreeWidgetItem*,Pages*> m_pagehash;
77    /* This hash is to get the page selector widget when the page is known */
78    QHash<Pages*,QTreeWidgetItem*> m_widgethash;
79    /* This is a list of consoles */
80    QHash<QTreeWidgetItem*,Console*> m_consoleHash;
81    void createPageJobList(QString &, QString &, QTreeWidgetItem *);
82
83 public slots:
84    void input_line();
85    void about();
86    void treeItemClicked(QTreeWidgetItem *item, int column);
87    void labelDialogClicked();
88    void runDialogClicked();
89    void restoreDialogClicked();
90    void undockWindowButton();
91    void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
92    void stackItemChanged(int);
93    void toggleDockContextWindow();
94    void closePage();
95
96 protected:
97    void closeEvent(QCloseEvent *event);
98    void keyPressEvent(QKeyEvent *event);
99
100 private:
101    void createConnections(); 
102    void createPages();
103    QTreeWidgetItem *createTopPage(char *name);
104    QTreeWidgetItem *createPage(char *name, QTreeWidgetItem *parent);
105    void createPagebRestore();
106    void createPageMediaList();
107    void createPageClients();
108    void createPageStorage();
109    void createPageFileSet();
110
111 private:
112    Console *m_currentConsole;
113    Pages *m_pagespophold;
114    QStringList m_cmd_history;
115    int m_cmd_last;
116    QTreeWidgetItem *m_firstItem;
117 };
118
119 #endif /* _MAINWIN_H_ */