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