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