]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/restore/restore.h
Make qt-console compatible to Qt5 (Qt4 still work)
[bacula/bacula] / bacula / src / qt-console / restore / restore.h
1 #ifndef _RESTORE_H_
2 #define _RESTORE_H_
3
4 /*
5    Bacula(R) - The Network Backup Solution
6
7    Copyright (C) 2000-2016 Kern Sibbald
8
9    The original author of Bacula is Kern Sibbald, with contributions
10    from many others, a complete list can be found in the file AUTHORS.
11
12    You may use this file and others of this release according to the
13    license defined in the LICENSE file, which includes the Affero General
14    Public License, v3.0 ("AGPLv3") and some additional permissions and
15    terms pursuant to its AGPLv3 Section 7.
16
17    This notice must be preserved when any source code is 
18    conveyed and/or propagated.
19
20    Bacula(R) is a registered trademark of Kern Sibbald.
21 */
22 /*
23  *
24  *  Kern Sibbald, February 2007
25  */
26
27 #include <stdint.h>
28 #include <sys/types.h>     /* Needed for some systems */
29 #if QT_VERSION >= 0x050000
30 #include <QtWidgets>
31 #else
32 #include <QtGui>
33 #endif
34 #include "pages.h"
35 #include "ui_runrestore.h"
36
37 class bRestoreTable : public QTableWidget
38 {
39    Q_OBJECT 
40 private:
41    QPoint dragStartPosition;
42 public:
43    bRestoreTable(QWidget *parent)
44       : QTableWidget(parent)
45    {
46    }
47    void mousePressEvent(QMouseEvent *event);
48    void mouseMoveEvent(QMouseEvent *event);
49
50    void dragEnterEvent(QDragEnterEvent *event);
51    void dragMoveEvent(QDragMoveEvent *event);
52    void dropEvent(QDropEvent *event);
53 };
54
55 #include "ui_brestore.h"
56 #include "ui_restore.h"
57 #include "ui_prerestore.h"
58
59 enum {
60    R_NONE,
61    R_JOBIDLIST,
62    R_JOBDATETIME
63 };
64
65 /*
66  * The pre-restore dialog selects the Job/Client to be restored
67  * It really could use considerable enhancement.
68  */
69 class prerestorePage : public Pages, public Ui::prerestoreForm
70 {
71    Q_OBJECT 
72
73 public:
74    prerestorePage();
75    prerestorePage(QString &data, unsigned int);
76
77 private slots:
78    void okButtonPushed();
79    void cancelButtonPushed();
80    void job_name_change(int index);
81    void recentChanged(int);
82    void jobRadioClicked(bool);
83    void jobidsRadioClicked(bool);
84    void jobIdEditFinished();
85
86 private:
87    int m_conn;
88    int jobdefsFromJob(QStringList &, QString &);
89    void buildPage();
90    bool checkJobIdList();
91    QString m_dataIn;
92    unsigned int m_dataInType;
93 };
94
95 /*  
96  * The restore dialog is brought up once we are in the Bacula
97  * restore tree routines.  It handles putting up a GUI tree
98  * representation of the files to be restored.
99  */
100 class restorePage : public Pages, public Ui::restoreForm
101 {
102    Q_OBJECT 
103
104 public:
105    restorePage(int conn);
106    ~restorePage();
107    void fillDirectory();
108    char *get_cwd();
109    bool cwd(const char *);
110
111 private slots:
112    void okButtonPushed();
113    void cancelButtonPushed();
114    void fileDoubleClicked(QTreeWidgetItem *item, int column);
115    void directoryItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
116    void upButtonPushed();
117    void unmarkButtonPushed();
118    void markButtonPushed();
119    void addDirectory(QString &);
120
121 private:
122    int m_conn;
123    void writeSettings();
124    void readSettings();
125    QString m_cwd;
126    QHash<QString, QTreeWidgetItem *> m_dirPaths;
127    QHash<QTreeWidgetItem *,QString> m_dirTreeItems;
128    QRegExp m_rx;
129    QString m_splitText;
130 };
131
132 class bRestore : public Pages, public Ui::bRestoreForm
133 {
134    Q_OBJECT 
135
136 public:
137    bRestore();
138    ~bRestore();
139    void PgSeltreeWidgetClicked();
140    QString m_client;
141    QString m_jobids;
142    void get_info_from_selection(QStringList &fileids, QStringList &jobids,
143                                 QStringList &dirids, QStringList &fileindexes);
144
145 public slots:
146    void setClient();
147    void setJob();
148    void showInfoForFile(QTableWidgetItem *);
149    void applyLocation();
150    void clearVersions(QTableWidgetItem *);
151    void clearRestoreList();
152    void runRestore();
153    void refreshView();
154 private:
155    QString m_path;
156    int64_t m_pathid;
157    QTableWidgetItem *m_current;
158    void setupPage();
159    bool m_populated;
160    void displayFiles(int64_t pathid, QString path);
161    void displayFileVersion(QString pathid, QString fnid, 
162                            QString client, QString filename);
163 };
164
165 class bRunRestore : public QDialog, public Ui::bRunRestoreForm
166 {
167    Q_OBJECT 
168 private:
169    bRestore *brestore;
170    QStringList m_fileids, m_jobids, m_dirids, m_findexes;
171
172 public:
173    bRunRestore(bRestore *parent);
174    ~bRunRestore() {}
175    void computeVolumeList();
176    int64_t runRestore(QString tablename);
177
178 public slots:
179    void useRegexp();
180    void UFRcb();
181    void computeRestore();
182 };
183
184 #endif /* _RESTORE_H_ */