]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/mainwin.h
Moved dialogs to be pages on the stack. label, run and runcmd.
[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 setContextMenuDockText();
59    void setContextMenuDockText(Pages *, QTreeWidgetItem *);
60    void setTreeWidgetItemDockColor(Pages *, QTreeWidgetItem *);
61    void setTreeWidgetItemDockColor(Pages *);
62    void hashInsert(QTreeWidgetItem *, Pages *);
63    void hashRemove(Pages *);
64    void hashRemove(QTreeWidgetItem *, Pages *);
65    Console *currentConsole();
66    QTreeWidgetItem *currentTopItem();
67    Pages* getFromHash(QTreeWidgetItem *);
68    QTreeWidgetItem* getFromHash(Pages *);
69    /* This hash is to get the page when the page selector widget is known */
70    QHash<QTreeWidgetItem*,Pages*> m_pagehash;
71    /* This hash is to get the page selector widget when the page is known */
72    QHash<Pages*,QTreeWidgetItem*> m_widgethash;
73    /* This is a list of consoles */
74    QHash<QTreeWidgetItem*,Console*> m_consoleHash;
75    void createPageJobList(QString &, QString &, QTreeWidgetItem *);
76
77 public slots:
78    void input_line();
79    void about();
80    void treeItemClicked(QTreeWidgetItem *item, int column);
81    void labelButtonClicked();
82    void runButtonClicked();
83    void restoreButtonClicked();
84    void undockWindowButton();
85    void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
86    void stackItemChanged(int);
87    void toggleDockContextWindow();
88    void closePage();
89
90 protected:
91    void closeEvent(QCloseEvent *event);
92    void keyPressEvent(QKeyEvent *event);
93
94 private:
95    void createConnections(); 
96    void createPages();
97    QTreeWidgetItem *createTopPage(char *name);
98    QTreeWidgetItem *createPage(char *name, QTreeWidgetItem *parent);
99    void createPagebRestore();
100    void createPageMediaList();
101    void createPageClients();
102    void createPageStorage();
103    void createPageFileSet();
104
105 private:
106    Console *m_currentConsole;
107    Pages *m_pagespophold;
108    QStringList m_cmd_history;
109    int m_cmd_last;
110    QTreeWidgetItem *m_firstItem;
111 };
112
113 #endif /* _MAINWIN_H_ */