]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/mainwin.h
Enhance bvfs performance .bvfs_update for MySQL
[bacula/bacula] / bacula / src / qt-console / mainwin.h
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2015 Kern Sibbald
5    Copyright (C) 2007-2014 Free Software Foundation Europe e.V.
6
7    The original author of Bacula is Kern Sibbald, with contributions
8    from many others, a complete list can be found in the file AUTHORS.
9
10    You may use this file and others of this release according to the
11    license defined in the LICENSE file, which includes the Affero General
12    Public License, v3.0 ("AGPLv3") and some additional permissions and
13    terms pursuant to its AGPLv3 Section 7.
14
15    This notice must be preserved when any source code is 
16    conveyed and/or propagated.
17
18    Bacula(R) is a registered trademark of Kern Sibbald.
19 */
20 /* 
21  * qt-console main window class definition.
22  *
23  *  Written by Kern Sibbald, January MMVII
24  */
25
26 #ifndef _MAINWIN_H_
27 #define _MAINWIN_H_
28
29 #include <QtGui>
30 #include <QList>
31 #include "ui_main.h"
32
33 class Console;
34 class Pages;
35
36 class MainWin : public QMainWindow, public Ui::MainForm    
37 {
38    Q_OBJECT
39
40 public:
41    MainWin(QWidget *parent = 0);
42    void set_statusf(const char *fmt, ...);
43    void set_status_ready();
44    void set_status(const char *buf);
45    void set_status(const QString &str);
46    void writeSettings();
47    void readSettings();
48    void resetFocus() { lineEdit->setFocus(); };
49    void hashInsert(QTreeWidgetItem *, Pages *);
50    void hashRemove(Pages *);
51    void hashRemove(QTreeWidgetItem *, Pages *);
52    void setMessageIcon();
53    bool getWaitState() {return m_waitState; };
54    bool isClosing() {return m_isClosing; };
55    Console *currentConsole();
56    QTreeWidgetItem *currentTopItem();
57    Pages* getFromHash(QTreeWidgetItem *);
58    QTreeWidgetItem* getFromHash(Pages *);
59    /* This hash is to get the page when the page selector widget is known */
60    QHash<QTreeWidgetItem*,Pages*> m_pagehash;
61    /* This hash is to get the page selector widget when the page is known */
62    QHash<Pages*,QTreeWidgetItem*> m_widgethash;
63    /* This is a list of consoles */
64    QHash<QTreeWidgetItem*,Console*> m_consoleHash;
65    void createPageJobList(const QString &, const QString &,
66             const QString &, const QString &, QTreeWidgetItem *);
67    QString m_dtformat;
68    /* Begin Preferences variables */
69    bool m_commDebug;
70    bool m_connDebug;
71    bool m_displayAll;
72    bool m_sqlDebug;
73    bool m_commandDebug;
74    bool m_miscDebug;
75    bool m_recordLimitCheck;
76    int m_recordLimitVal;
77    bool m_daysLimitCheck;
78    int m_daysLimitVal;
79    bool m_checkMessages;
80    int m_checkMessagesInterval;
81    bool m_longList;
82    bool m_rtPopDirDebug;
83    bool m_rtDirCurICDebug;
84    bool m_rtDirICDebug;
85    bool m_rtFileTabICDebug;
86    bool m_rtVerTabICDebug;
87    bool m_rtUpdateFTDebug;
88    bool m_rtUpdateVTDebug;
89    bool m_rtChecksDebug;
90    bool m_rtIconStateDebug;
91    bool m_rtRestore1Debug;
92    bool m_rtRestore2Debug;
93    bool m_rtRestore3Debug;
94    bool m_openBrowser;
95    bool m_openPlot;
96    bool m_openDirStat;
97
98    /* Global */
99    bool m_notify;                     /* global flag to turn on/off all notifiers */
100
101 public slots:
102    void input_line();
103    void about();
104    void help();
105    void treeItemClicked(QTreeWidgetItem *item, int column);
106    void labelButtonClicked();
107    void runButtonClicked();
108    void estimateButtonClicked();
109    void browseButtonClicked();
110    void statusPageButtonClicked();
111    void jobPlotButtonClicked();
112    void restoreButtonClicked();
113    void undockWindowButton();
114    void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
115    void stackItemChanged(int);
116    void toggleDockContextWindow();
117    void closePage(int item);
118    void closeCurrentPage();
119    void setPreferences();
120    void readPreferences();
121    void waitEnter();
122    void waitExit();
123    void repopLists();
124    void reloadRepopLists();
125    void popLists();
126    void goToPreviousPage();
127
128 protected:
129    void closeEvent(QCloseEvent *event);
130    void keyPressEvent(QKeyEvent *event);
131
132 private:
133    void connectConsole();
134    void createPages();
135    void connectSignals(); 
136    void disconnectSignals(); 
137    void connectConsoleSignals();
138    void disconnectConsoleSignals(Console *console);
139
140 private:
141    Console *m_currentConsole;
142    Pages *m_pagespophold;
143    QStringList m_cmd_history;
144    int m_cmd_last;
145    QTreeWidgetItem *m_firstItem;
146    QTreeWidgetItem *m_waitTreeItem;
147    bool m_isClosing;
148    bool m_waitState;
149    bool m_doConnect;
150    QList<QTreeWidgetItem *> m_treeWidgetStack;
151    bool m_treeStackTrap;
152 };
153
154 #include "ui_prefs.h"
155
156 class prefsDialog : public QDialog, public Ui::PrefsForm
157 {
158    Q_OBJECT
159
160 public:
161    prefsDialog();
162
163 private slots:
164    void accept();
165    void reject();
166 };
167
168 #endif /* _MAINWIN_H_ */