X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fqt-console%2Fmainwin.cpp;h=c3d803c046ef8d36463f93664660dc41921da463;hb=09266bca3fd3b8c553a4ea2ee48abde5a791588a;hp=43b70d54d624f405e152a84c2507858f85cd0763;hpb=e56c4e4610c8448a1f46984939b6260848e66b79;p=bacula%2Fbacula diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 43b70d54d6..c3d803c046 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -1,12 +1,12 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2009 Free Software Foundation Europe e.V. + Copyright (C) 2007-2010 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from 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 + modify it under the terms of version three of the GNU Affero General Public License as published by the Free Software Foundation and included in the file LICENSE. @@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Affero General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -27,7 +27,6 @@ */ /* - * Version $Id$ * * Main Window control for bat (qt-console) * @@ -50,6 +49,7 @@ #include "restore/restoretree.h" #include "help/help.h" #include "jobs/jobs.h" +#include "medialist/mediaview.h" #ifdef HAVE_QWT #include "jobgraphs/jobplot.h" #endif @@ -94,25 +94,37 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) readSettings(); - foreach(Console *console, m_consoleHash) + foreach(Console *console, m_consoleHash) { console->connect_dir(); + } + /* + * Note, the notifier is now a global flag, although each notifier + * can be individually turned on and off at a socket level. Once + * the notifier is turned off, we don't accept anything from anyone + * this prevents unwanted messages from getting into the input + * dialogs such as restore that read from the director and "know" + * what to expect. + */ + m_notify = true; m_currentConsole = (Console*)getFromHash(m_firstItem); - QTimer::singleShot(750, this, SLOT(popLists())); + QTimer::singleShot(2000, this, SLOT(popLists())); if (m_miscDebug) { QString directoryResourceName; m_currentConsole->getDirResName(directoryResourceName); Pmsg1(100, "Setting initial window to %s\n", directoryResourceName.toUtf8().data()); } + app->restoreOverrideCursor(); } void MainWin::popLists() { - foreach(Console *console, m_consoleHash) + foreach(Console *console, m_consoleHash) { console->populateLists(true); - app->restoreOverrideCursor(); + } m_doConnect = true; connectConsoleSignals(); connectSignals(); + app->restoreOverrideCursor(); m_currentConsole->setCurrent(); } @@ -148,13 +160,13 @@ void MainWin::createPages() /* insert the cosole and tree widget item into the hashes */ hashInsert(item, m_currentConsole); + m_currentConsole->dockPage(); /* Set Color of treeWidgetItem for the console * It will be set to green in the console class if the connection is made. */ QBrush redBrush(Qt::red); item->setForeground(0, redBrush); - m_currentConsole->dockPage(); /* * Create instances in alphabetic order of the rest @@ -172,12 +184,14 @@ void MainWin::createPages() new JobPlot(NULL, pass); #endif new MediaList(); + new MediaView(); new Storage(); - if (m_openBrowser) + if (m_openBrowser) { new restoreTree(); - if (m_openDirStat) + } + if (m_openDirStat) { new DirStat(); - + } treeWidget->expandItem(topItem); tabWidget->setCurrentWidget(m_currentConsole); } @@ -301,14 +315,11 @@ void MainWin::disconnectSignals() */ void MainWin::waitEnter() { - if (m_waitState){ - if (mainWin->m_connDebug) - Pmsg0(000, "Should Never Get Here DANGER DANGER, for now I'll return\n"); + if (m_waitState || m_isClosing) { return; } m_waitState = true; - if (mainWin->m_connDebug) - Pmsg0(000, "Entering Wait State\n"); + if (mainWin->m_connDebug) Pmsg0(000, "Entering Wait State\n"); app->setOverrideCursor(QCursor(Qt::WaitCursor)); disconnectSignals(); disconnectConsoleSignals(m_currentConsole); @@ -320,15 +331,19 @@ void MainWin::waitEnter() */ void MainWin::waitExit() { - m_waitState = false; + if (!m_waitState || m_isClosing) { + return; + } if (mainWin->m_connDebug) Pmsg0(000, "Exiting Wait State\n"); - app->restoreOverrideCursor(); - if (m_waitTreeItem != treeWidget->currentItem()) + if (m_waitTreeItem && (m_waitTreeItem != treeWidget->currentItem())) { treeWidget->setCurrentItem(m_waitTreeItem); + } if (m_doConnect) { connectSignals(); connectConsoleSignals(); } + app->restoreOverrideCursor(); + m_waitState = false; } void MainWin::connectConsoleSignals() @@ -512,6 +527,7 @@ void MainWin::treeItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem *pre } /* set the value for the currently active console */ int stackindex = tabWidget->indexOf(nextPage); + nextPage->firstUseDock(); /* Is this page currently on the stack or is it undocked */ if (stackindex >= 0) { @@ -567,13 +583,15 @@ void MainWin::statusPageButtonClicked() } } } - if (!found) + if (!found) { new DirStat(); + } } void MainWin::restoreButtonClicked() { new prerestorePage(); + if (mainWin->m_miscDebug) Pmsg0(000, "in restoreButtonClicked after prerestorePage\n"); } void MainWin::jobPlotButtonClicked() @@ -594,7 +612,7 @@ void MainWin::input_line() QString cmdStr = lineEdit->text(); /* Get the text */ lineEdit->clear(); /* clear the lineEdit box */ if (m_currentConsole->is_connected()) { - if (m_currentConsole->currentDirComm(conn)) { + if (m_currentConsole->findDirComm(conn)) { m_currentConsole->consoleCommand(cmdStr, conn); } else { /* Use consoleCommand to allow typing anything */ @@ -686,6 +704,13 @@ void MainWin::stackItemChanged(int) Pages* page = (Pages*)tabWidget->currentWidget(); /* run the virtual function in case this class overrides it */ page->currentStackItem(); + if (!m_waitState) { + disconnect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(treeItemClicked(QTreeWidgetItem *, int))); + disconnect(treeWidget, SIGNAL( currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *))); + treeWidget->setCurrentItem(getFromHash(page)); + connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(treeItemClicked(QTreeWidgetItem *, int))); + connect(treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *))); + } } /* @@ -916,7 +941,7 @@ void MainWin::readPreferences() settings.endGroup(); settings.beginGroup("JobList"); m_recordLimitCheck = settings.value("recordLimitCheck", true).toBool(); - m_recordLimitVal = settings.value("recordLimitVal", 150).toInt(); + m_recordLimitVal = settings.value("recordLimitVal", 50).toInt(); m_daysLimitCheck = settings.value("daysLimitCheck", false).toBool(); m_daysLimitVal = settings.value("daysLimitVal", 28).toInt(); settings.endGroup();