]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/mainwin.h
Add icon to label class in page selector.
[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 plus additions
11    that are listed 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    Console *currentConsole();
62    QTreeWidgetItem *currentTopItem();
63    Pages* getFromHash(QTreeWidgetItem *);
64    QTreeWidgetItem* getFromHash(Pages *);
65    /* This hash is to get the page when the page selector widget is known */
66    QHash<QTreeWidgetItem*,Pages*> m_pagehash;
67    /* This hash is to get the page selector widget when the page is known */
68    QHash<Pages*,QTreeWidgetItem*> m_widgethash;
69    /* This is a list of consoles */
70    QHash<QTreeWidgetItem*,Console*> m_consoleHash;
71    void createPageJobList(QString &, QString &, QTreeWidgetItem *);
72    QString m_dtformat;
73    /* Begin Preferences variables */
74    bool m_commDebug;
75    bool m_displayAll;
76    bool m_sqlDebug;
77    bool m_commandDebug;
78    bool m_miscDebug;
79    bool m_recordLimitCheck;
80    int m_recordLimitVal;
81    bool m_daysLimitCheck;
82    int m_daysLimitVal;
83    bool m_checkMessages;
84    int m_checkMessagesInterval;
85    bool m_longList;
86
87 public slots:
88    void input_line();
89    void about();
90    void help();
91    void treeItemClicked(QTreeWidgetItem *item, int column);
92    void labelButtonClicked();
93    void runButtonClicked();
94    void estimateButtonClicked();
95    void restoreButtonClicked();
96    void undockWindowButton();
97    void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
98    void stackItemChanged(int);
99    void toggleDockContextWindow();
100    void closePage();
101    void setPreferences();
102    void readPreferences();
103
104 protected:
105    void closeEvent(QCloseEvent *event);
106    void keyPressEvent(QKeyEvent *event);
107
108 private:
109    void createConnections(); 
110    void createPages();
111    QTreeWidgetItem *createTopPage(char *name);
112    QTreeWidgetItem *createPage(char *name, QTreeWidgetItem *parent);
113    void createPagebRestore();
114    void createPageMediaList();
115    void createPageClients();
116    void createPageStorage();
117    void createPageFileSet();
118
119 private:
120    Console *m_currentConsole;
121    Pages *m_pagespophold;
122    QStringList m_cmd_history;
123    int m_cmd_last;
124    QTreeWidgetItem *m_firstItem;
125 };
126
127 #include "ui_prefs.h"
128
129 class prefsDialog : public QDialog, public Ui::PrefsForm
130 {
131    Q_OBJECT
132
133 public:
134    prefsDialog();
135
136 private slots:
137    void accept();
138    void reject();
139 };
140
141 #endif /* _MAINWIN_H_ */