]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/mainwin.h
Modifications to get human readable information into fields in the
[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 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 writeSettings();
56    void readSettings();
57    void resetFocus() { lineEdit->setFocus(); };
58    void hashInsert(QTreeWidgetItem *, Pages *);
59    void hashRemove(Pages *);
60    void hashRemove(QTreeWidgetItem *, Pages *);
61    void hrConvert(QString &, qlonglong &);
62    void hrConvertSeconds(QString &, qlonglong &);
63    Console *currentConsole();
64    QTreeWidgetItem *currentTopItem();
65    Pages* getFromHash(QTreeWidgetItem *);
66    QTreeWidgetItem* getFromHash(Pages *);
67    /* This hash is to get the page when the page selector widget is known */
68    QHash<QTreeWidgetItem*,Pages*> m_pagehash;
69    /* This hash is to get the page selector widget when the page is known */
70    QHash<Pages*,QTreeWidgetItem*> m_widgethash;
71    /* This is a list of consoles */
72    QHash<QTreeWidgetItem*,Console*> m_consoleHash;
73    void createPageJobList(const QString &, const QString &,
74             const QString &, const QString &, QTreeWidgetItem *);
75    QString m_dtformat;
76    /* Begin Preferences variables */
77    bool m_commDebug;
78    bool m_displayAll;
79    bool m_sqlDebug;
80    bool m_commandDebug;
81    bool m_miscDebug;
82    bool m_recordLimitCheck;
83    int m_recordLimitVal;
84    bool m_daysLimitCheck;
85    int m_daysLimitVal;
86    bool m_checkMessages;
87    int m_checkMessagesInterval;
88    bool m_longList;
89    bool m_rtPopDirDebug;
90    bool m_rtDirCurICDebug;
91    bool m_rtDirICDebug;
92    bool m_rtFileTabICDebug;
93    bool m_rtVerTabICDebug;
94    bool m_rtUpdateFTDebug;
95    bool m_rtUpdateVTDebug;
96    bool m_rtChecksDebug;
97    bool m_rtIconStateDebug;
98    bool m_rtRestore1Debug;
99    bool m_rtRestore2Debug;
100    bool m_rtRestore3Debug;
101    int m_radioConvert;
102
103 public slots:
104    void input_line();
105    void about();
106    void help();
107    void treeItemClicked(QTreeWidgetItem *item, int column);
108    void labelButtonClicked();
109    void runButtonClicked();
110    void estimateButtonClicked();
111    void browseButtonClicked();
112    void jobPlotButtonClicked();
113    void restoreButtonClicked();
114    void undockWindowButton();
115    void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
116    void stackItemChanged(int);
117    void toggleDockContextWindow();
118    void closePage();
119    void setPreferences();
120    void readPreferences();
121
122 protected:
123    void closeEvent(QCloseEvent *event);
124    void keyPressEvent(QKeyEvent *event);
125
126 private:
127    void createConnections(); 
128    void connectConsole();
129    void createPages();
130
131 private:
132    Console *m_currentConsole;
133    Pages *m_pagespophold;
134    QStringList m_cmd_history;
135    int m_cmd_last;
136    QTreeWidgetItem *m_firstItem;
137    bool m_isClosing;
138 };
139
140 #include "ui_prefs.h"
141
142 class prefsDialog : public QDialog, public Ui::PrefsForm
143 {
144    Q_OBJECT
145
146 public:
147    prefsDialog();
148
149 private slots:
150    void accept();
151    void reject();
152 };
153
154 #endif /* _MAINWIN_H_ */