]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/mainwin.h
This is the application of a patch from Ricardo. Includes a great qty of translation...
[bacula/bacula] / bacula / src / qt-console / mainwin.h
1 /*
2    Bacula® - The Network Backup Solution
3
4    Copyright (C) 2007-2008 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 and included
11    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
43 class Console;
44 class Pages;
45
46 class MainWin : public QMainWindow, public Ui::MainForm    
47 {
48    Q_OBJECT
49
50 public:
51    MainWin(QWidget *parent = 0);
52    void set_statusf(const char *fmt, ...);
53    void set_status_ready();
54    void set_status(const char *buf);
55    void set_status(const QString &str);
56    void writeSettings();
57    void readSettings();
58    void resetFocus() { lineEdit->setFocus(); };
59    void hashInsert(QTreeWidgetItem *, Pages *);
60    void hashRemove(Pages *);
61    void hashRemove(QTreeWidgetItem *, Pages *);
62    Console *currentConsole();
63    QTreeWidgetItem *currentTopItem();
64    Pages* getFromHash(QTreeWidgetItem *);
65    QTreeWidgetItem* getFromHash(Pages *);
66    /* This hash is to get the page when the page selector widget is known */
67    QHash<QTreeWidgetItem*,Pages*> m_pagehash;
68    /* This hash is to get the page selector widget when the page is known */
69    QHash<Pages*,QTreeWidgetItem*> m_widgethash;
70    /* This is a list of consoles */
71    QHash<QTreeWidgetItem*,Console*> m_consoleHash;
72    void createPageJobList(const QString &, const QString &,
73             const QString &, const QString &, QTreeWidgetItem *);
74    QString m_dtformat;
75    /* Begin Preferences variables */
76    bool m_commDebug;
77    bool m_displayAll;
78    bool m_sqlDebug;
79    bool m_commandDebug;
80    bool m_miscDebug;
81    bool m_recordLimitCheck;
82    int m_recordLimitVal;
83    bool m_daysLimitCheck;
84    int m_daysLimitVal;
85    bool m_checkMessages;
86    int m_checkMessagesInterval;
87    bool m_refreshStatusDir;
88    int m_refreshStatusDirInterval;
89    bool m_longList;
90    bool m_rtPopDirDebug;
91    bool m_rtDirCurICDebug;
92    bool m_rtDirICDebug;
93    bool m_rtFileTabICDebug;
94    bool m_rtVerTabICDebug;
95    bool m_rtUpdateFTDebug;
96    bool m_rtUpdateVTDebug;
97    bool m_rtChecksDebug;
98    bool m_rtIconStateDebug;
99    bool m_rtRestore1Debug;
100    bool m_rtRestore2Debug;
101    bool m_rtRestore3Debug;
102    bool m_openBrowser;
103    bool m_openPlot;
104    bool m_openDirStat;
105
106 public slots:
107    void input_line();
108    void about();
109    void help();
110    void treeItemClicked(QTreeWidgetItem *item, int column);
111    void labelButtonClicked();
112    void runButtonClicked();
113    void estimateButtonClicked();
114    void browseButtonClicked();
115    void statusPageButtonClicked();
116    void jobPlotButtonClicked();
117    void restoreButtonClicked();
118    void undockWindowButton();
119    void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
120    void stackItemChanged(int);
121    void toggleDockContextWindow();
122    void closePage();
123    void setPreferences();
124    void readPreferences();
125
126 protected:
127    void closeEvent(QCloseEvent *event);
128    void keyPressEvent(QKeyEvent *event);
129
130 private:
131    void createConnections(); 
132    void connectConsole();
133    void createPages();
134
135 private:
136    Console *m_currentConsole;
137    Pages *m_pagespophold;
138    QStringList m_cmd_history;
139    int m_cmd_last;
140    QTreeWidgetItem *m_firstItem;
141    bool m_isClosing;
142 };
143
144 #include "ui_prefs.h"
145
146 class prefsDialog : public QDialog, public Ui::PrefsForm
147 {
148    Q_OBJECT
149
150 public:
151    prefsDialog();
152
153 private slots:
154    void accept();
155    void reject();
156 };
157
158 #endif /* _MAINWIN_H_ */