many others, a complete list can be found in the file AUTHORS.
This program is Free Software; you can redistribute it and/or
modify it under the terms of version two of the GNU General Public
- License as published by the Free Software Foundation plus additions
- that are listed in the file LICENSE.
+ License as published by the Free Software Foundation and included
+ in the file LICENSE.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
#include "medialist/medialist.h"
#include "joblist/joblist.h"
#include "clients/clients.h"
+#include "restore/restoretree.h"
#include "help/help.h"
#include "jobs/jobs.h"
+#include "jobgraphs/jobplot.h"
/*
* Daemon message callback
MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
{
+ m_isClosing = false;
m_dtformat = "yyyy-MM-dd HH:mm:ss";
mainWin = this;
setupUi(this); /* Setup UI defined by main.ui (designer) */
item = new QTreeWidgetItem(topItem);
item->setText(0, "Console");
if (!m_firstItem){ m_firstItem = item; }
- item->setIcon(0,QIcon(QString::fromUtf8(":images/utilities-terminal.svg")));
+ item->setIcon(0,QIcon(QString::fromUtf8(":images/utilities-terminal.png")));
/* insert the cosole and tree widget item into the hashes */
hashInsert(item, m_currentConsole);
* Create instances in alphabetic order of the rest
* of the classes that will by default exist under each Director.
*/
-// new new bRestore();
+// new bRestore();
new Clients();
new FileSet();
new Jobs();
- createPageJobList("", "", NULL);
+ createPageJobList("", "", "", "", NULL);
+ JobPlotPass pass;
+ pass.use = false;
+ new JobPlot(NULL, pass);
new MediaList();
new Storage();
+ new restoreTree();
treeWidget->expandItem(topItem);
stackedWidget->setCurrentWidget(m_currentConsole);
* create an instance of the the joblist class on the stack
*/
void MainWin::createPageJobList(const QString &media, const QString &client,
- QTreeWidgetItem *parentTreeWidgetItem)
+ const QString &job, const QString &fileset, QTreeWidgetItem *parentTreeWidgetItem)
{
QTreeWidgetItem *holdItem;
/* save current tree widget item in case query produces no results */
holdItem = treeWidget->currentItem();
- JobList* joblist = new JobList(media, client, parentTreeWidgetItem);
+ JobList* joblist = new JobList(media, client, job, fileset, parentTreeWidgetItem);
/* If this is a query of jobs on a specific media */
- if ((media != "") || (client != "")) {
+ if ((media != "") || (client != "") || (job != "") || (fileset != "")) {
joblist->setCurrent();
/* did query produce results, if not close window and set back to hold */
if (joblist->m_resultCount == 0) {
connect(actionLabel, SIGNAL(triggered()), this, SLOT(labelButtonClicked()));
connect(actionRun, SIGNAL(triggered()), this, SLOT(runButtonClicked()));
connect(actionEstimate, SIGNAL(triggered()), this, SLOT(estimateButtonClicked()));
+ connect(actionBrowse, SIGNAL(triggered()), this, SLOT(browseButtonClicked()));
+ connect(actionJobPlot, SIGNAL(triggered()), this, SLOT(jobPlotButtonClicked()));
connect(actionRestore, SIGNAL(triggered()), this, SLOT(restoreButtonClicked()));
connect(actionUndock, SIGNAL(triggered()), this, SLOT(undockWindowButton()));
connect(actionToggleDock, SIGNAL(triggered()), this, SLOT(toggleDockContextWindow()));
*/
void MainWin::closeEvent(QCloseEvent *event)
{
+ m_isClosing = true;
writeSettings();
+ /*
+ * Close the console pages before non-console pages so that
+ * the notifier is turned off. Otherwise it prints an error when
+ * the page it is using gets destroyed.
+ */
foreach(Console *console, m_consoleHash){
console->writeSettings();
console->terminate();
+ console->closeStackPage();
}
- event->accept();
- foreach(Pages *page, m_pagehash) {
- if (!page->isDocked())
- page->close();
+ /* close all non console pages, this will call settings in destructors */
+ while (m_consoleHash.count() < m_pagehash.count()) {
+ foreach(Pages *page, m_pagehash) {
+ if (page != page->console()) {
+ QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(page);
+ if (pageSelectorTreeWidgetItem->childCount() == 0) {
+ page->console()->setCurrent();
+ page->closeStackPage();
+ }
+ }
+ }
}
+ event->accept();
}
void MainWin::writeSettings()
*/
void MainWin::treeItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem *previousitem)
{
+ if (m_isClosing) return; /* if closing the application, do nothing here */
+
Pages *previousPage, *nextPage;
- Console *previousConsole, *nextConsole;
+ Console *previousConsole = NULL;
+ Console *nextConsole;
+
+ /* remove all actions before adding actions appropriate for new page */
+ foreach(QAction* pageAction, treeWidget->actions()) {
+ treeWidget->removeAction(pageAction);
+ }
/* first determine the next item */
QBrush greyBrush(Qt::lightGray);
dirItem->setBackground(0, greyBrush);
}
- /* make sure the close window and toggle dock options are removed */
- treeWidget->removeAction(actionClosePage);
- treeWidget->removeAction(actionToggleDock);
- /* Is this a page that has been inserted into the hash */
- if (previousPage) {
- foreach(QAction* pageaction, previousPage->m_contextActions) {
- treeWidget->removeAction(pageaction);
- }
- }
}
}
nextPage->setContextMenuDockText();
treeWidget->addAction(actionToggleDock);
- /* if this page is closeable, then add that action */
- if (nextPage->isCloseable()) {
+ /* if this page is closeable, and it has no childern, then add that action */
+ if ((nextPage->isCloseable()) && (currentitem->child(0) == NULL))
treeWidget->addAction(actionClosePage);
- }
/* Add the actions to the Page Selectors tree widget that are part of the
* current items list of desired actions regardless of whether on top of stack*/
void MainWin::runButtonClicked()
{
- new runPage();
+ new runPage("");
}
void MainWin::estimateButtonClicked()
new estimatePage();
}
+void MainWin::browseButtonClicked()
+{
+ new restoreTree();
+}
+
void MainWin::restoreButtonClicked()
{
new prerestorePage();
}
+void MainWin::jobPlotButtonClicked()
+{
+ JobPlotPass pass;
+ pass.use = false;
+ new JobPlot(NULL, pass);
+}
+
/*
* The user just finished typing a line in the command line edit box
*/
QString cmdStr = lineEdit->text(); /* Get the text */
lineEdit->clear(); /* clear the lineEdit box */
if (m_currentConsole->is_connected()) {
- m_currentConsole->consoleCommand(cmdStr);
+ /* Use consoleInput to allow typing anything */
+ m_currentConsole->consoleInput(cmdStr);
} else {
set_status("Director not connected. Click on connect button.");
}
*/
void MainWin::stackItemChanged(int)
{
+ if (m_isClosing) return; /* if closing the application, do nothing here */
Pages* page = (Pages*)stackedWidget->currentWidget();
/* run the virtual function in case this class overrides it */
page->currentStackItem();
prefs.checkMessages->setCheckState(m_checkMessages ? Qt::Checked : Qt::Unchecked);
prefs.checkMessagesSpin->setValue(m_checkMessagesInterval);
prefs.executeLongCheckBox->setCheckState(m_longList ? Qt::Checked : Qt::Unchecked);
-
+ prefs.rtPopDirCheckBox->setCheckState(m_rtPopDirDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtDirCurICCheckBox->setCheckState(m_rtDirCurICDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtDirICCheckBox->setCheckState(m_rtDirICDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtFileTabICCheckBox->setCheckState(m_rtFileTabICDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtVerTabICCheckBox->setCheckState(m_rtVerTabICDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtUpdateFTCheckBox->setCheckState(m_rtUpdateFTDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtUpdateVTCheckBox->setCheckState(m_rtUpdateVTDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtChecksCheckBox->setCheckState(m_rtChecksDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtIconStateCheckBox->setCheckState(m_rtIconStateDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtRestore1CheckBox->setCheckState(m_rtRestore1Debug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtRestore2CheckBox->setCheckState(m_rtRestore2Debug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtRestore3CheckBox->setCheckState(m_rtRestore3Debug ? Qt::Checked : Qt::Unchecked);
prefs.exec();
}
mainWin->m_checkMessages = this->checkMessages->checkState() == Qt::Checked;
mainWin->m_checkMessagesInterval = this->checkMessagesSpin->value();
mainWin->m_longList = this->executeLongCheckBox->checkState() == Qt::Checked;
+
+ mainWin->m_rtPopDirDebug = this->rtPopDirCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtDirCurICDebug = this->rtDirCurICCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtDirICDebug = this->rtDirICCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtFileTabICDebug = this->rtFileTabICCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtVerTabICDebug = this->rtVerTabICCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtUpdateFTDebug = this->rtUpdateFTCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtUpdateVTDebug = this->rtUpdateVTCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtChecksDebug = this->rtChecksCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtIconStateDebug = this->rtIconStateCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtRestore1Debug = this->rtRestore1CheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtRestore2Debug = this->rtRestore2CheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtRestore3Debug = this->rtRestore3CheckBox->checkState() == Qt::Checked;
+
QSettings settings("www.bacula.org", "bat");
settings.beginGroup("Debug");
settings.setValue("commDebug", mainWin->m_commDebug);
settings.beginGroup("Misc");
settings.setValue("longList", mainWin->m_longList);
settings.endGroup();
+ settings.beginGroup("RestoreTree");
+ settings.setValue("rtPopDirDebug", mainWin->m_rtPopDirDebug);
+ settings.setValue("rtDirCurICDebug", mainWin->m_rtDirCurICDebug);
+ settings.setValue("rtDirCurICRetDebug", mainWin->m_rtDirICDebug);
+ settings.setValue("rtFileTabICDebug", mainWin->m_rtFileTabICDebug);
+ settings.setValue("rtVerTabICDebug", mainWin->m_rtVerTabICDebug);
+ settings.setValue("rtUpdateFTDebug", mainWin->m_rtUpdateFTDebug);
+ settings.setValue("rtUpdateVTDebug", mainWin->m_rtUpdateVTDebug);
+ settings.setValue("rtChecksDebug", mainWin->m_rtChecksDebug);
+ settings.setValue("rtIconStateDebug", mainWin->m_rtIconStateDebug);
+ settings.setValue("rtRestore1Debug", mainWin->m_rtRestore1Debug);
+ settings.setValue("rtRestore2Debug", mainWin->m_rtRestore2Debug);
+ settings.setValue("rtRestore3Debug", mainWin->m_rtRestore3Debug);
+ settings.endGroup();
foreach(Console *console, mainWin->m_consoleHash) {
console->startTimer();
}
settings.beginGroup("Misc");
m_longList = settings.value("longList", false).toBool();
settings.endGroup();
+ settings.beginGroup("RestoreTree");
+ m_rtPopDirDebug = settings.value("rtPopDirDebug", false).toBool();
+ m_rtDirCurICDebug = settings.value("rtDirCurICDebug", false).toBool();
+ m_rtDirICDebug = settings.value("rtDirCurICRetDebug", false).toBool();
+ m_rtFileTabICDebug = settings.value("rtFileTabICDebug", false).toBool();
+ m_rtVerTabICDebug = settings.value("rtVerTabICDebug", false).toBool();
+ m_rtUpdateFTDebug = settings.value("rtUpdateFTDebug", false).toBool();
+ m_rtUpdateVTDebug = settings.value("rtUpdateVTDebug", false).toBool();
+ m_rtChecksDebug = settings.value("rtChecksDebug", false).toBool();
+ m_rtIconStateDebug = settings.value("rtIconStateDebug", false).toBool();
+ m_rtRestore1Debug = settings.value("rtRestore1Debug", false).toBool();
+ m_rtRestore2Debug = settings.value("rtRestore2Debug", false).toBool();
+ m_rtRestore3Debug = settings.value("rtRestore3Debug", false).toBool();
+ settings.endGroup();
}