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