/*
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.
*/
/*
- * Version $Id$
*
* Main Window control for bat (qt-console)
*
#include "restore/restoretree.h"
#include "help/help.h"
#include "jobs/jobs.h"
+#include "medialist/mediaview.h"
#ifdef HAVE_QWT
#include "jobgraphs/jobplot.h"
#endif
treeWidget->setColumnCount(1);
treeWidget->setHeaderLabel( tr("Select Page") );
treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
-
+ // tabWidget->setTabsClosable(true); /* wait for QT 4.5 */
createPages();
resetFocus(); /* lineEdit->setFocus() */
readSettings();
- foreach(Console *console, m_consoleHash)
+ foreach(Console *console, m_consoleHash) {
console->connect_dir();
+ }
m_currentConsole = (Console*)getFromHash(m_firstItem);
- QTimer::singleShot(750, this, SLOT(popLists()));
+ QTimer::singleShot(5000, 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();
}
foreach_res(dir, R_DIRECTOR) {
/* Create console tree stacked widget item */
- m_currentConsole = new Console(stackedWidget);
+ m_currentConsole = new Console(tabWidget);
m_currentConsole->setDirRes(dir);
m_currentConsole->readSettings();
*/
QBrush redBrush(Qt::red);
item->setForeground(0, redBrush);
- m_currentConsole->dockPage();
/*
* Create instances in alphabetic order of the rest
new JobPlot(NULL, pass);
#endif
new MediaList();
+ new MediaView();
new Storage();
if (m_openBrowser)
new restoreTree();
new DirStat();
treeWidget->expandItem(topItem);
- stackedWidget->setCurrentWidget(m_currentConsole);
+ tabWidget->setCurrentWidget(m_currentConsole);
+ m_currentConsole->undockPage();
+ m_currentConsole->dockPage();
}
UnlockRes();
}
connect(actionBat_Help, SIGNAL(triggered()), this, SLOT(help()));
connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(treeItemClicked(QTreeWidgetItem *, int)));
connect(treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
- connect(stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(stackItemChanged(int)));
+ connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(stackItemChanged(int)));
connect(actionQuit, SIGNAL(triggered()), app, SLOT(closeAllWindows()));
connect(actionLabel, SIGNAL(triggered()), this, SLOT(labelButtonClicked()));
connect(actionRun, SIGNAL(triggered()), this, SLOT(runButtonClicked()));
connect(actionPreferences, SIGNAL(triggered()), this, SLOT(setPreferences()));
connect(actionRepopLists, SIGNAL(triggered()), this, SLOT(repopLists()));
connect(actionReloadRepop, SIGNAL(triggered()), this, SLOT(reloadRepopLists()));
- connect(actionBack, SIGNAL(triggered()), this, SLOT(goToPreviousPage()));
}
void MainWin::disconnectSignals()
disconnect(actionBat_Help, SIGNAL(triggered()), this, SLOT(help()));
disconnect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(treeItemClicked(QTreeWidgetItem *, int)));
disconnect(treeWidget, SIGNAL( currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
- disconnect(stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(stackItemChanged(int)));
+ disconnect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(stackItemChanged(int)));
disconnect(actionQuit, SIGNAL(triggered()), app, SLOT(closeAllWindows()));
disconnect(actionLabel, SIGNAL(triggered()), this, SLOT(labelButtonClicked()));
disconnect(actionRun, SIGNAL(triggered()), this, SLOT(runButtonClicked()));
disconnect(actionPreferences, SIGNAL(triggered()), this, SLOT(setPreferences()));
disconnect(actionRepopLists, SIGNAL(triggered()), this, SLOT(repopLists()));
disconnect(actionReloadRepop, SIGNAL(triggered()), this, SLOT(reloadRepopLists()));
- disconnect(actionBack, SIGNAL(triggered()), this, SLOT(goToPreviousPage()));
}
/*
void MainWin::waitExit()
{
m_waitState = false;
- if (mainWin->m_connDebug)
- Pmsg0(000, "Exiting Wait State\n");
- app->restoreOverrideCursor();
+ if (mainWin->m_connDebug) Pmsg0(000, "Exiting Wait State\n");
if (m_waitTreeItem != treeWidget->currentItem())
treeWidget->setCurrentItem(m_waitTreeItem);
if (m_doConnect) {
connectSignals();
connectConsoleSignals();
}
+ app->restoreOverrideCursor();
}
void MainWin::connectConsoleSignals()
{
connect(actionConnect, SIGNAL(triggered()), m_currentConsole, SLOT(connect_dir()));
connect(actionSelectFont, SIGNAL(triggered()), m_currentConsole, SLOT(set_font()));
- connect(actionStatusDir, SIGNAL(triggered()), m_currentConsole, SLOT(status_dir()));
connect(actionMessages, SIGNAL(triggered()), m_currentConsole, SLOT(messages()));
}
void MainWin::disconnectConsoleSignals(Console *console)
{
disconnect(actionConnect, SIGNAL(triggered()), console, SLOT(connect_dir()));
- disconnect(actionStatusDir, SIGNAL(triggered()), console, SLOT(status_dir()));
disconnect(actionMessages, SIGNAL(triggered()), console, SLOT(messages()));
disconnect(actionSelectFont, SIGNAL(triggered()), console, SLOT(set_font()));
}
/* Is this a page that has been inserted into the hash */
if (getFromHash(item)) {
Pages* page = getFromHash(item);
- int stackindex=stackedWidget->indexOf(page);
+ int stackindex=tabWidget->indexOf(page);
if (stackindex >= 0) {
- stackedWidget->setCurrentWidget(page);
+ tabWidget->setCurrentWidget(page);
}
/* run the virtual function in case this class overrides it */
page->PgSeltreeWidgetClicked();
dirItem->setBackground(0, magentaBrush);
}
/* set the value for the currently active console */
- int stackindex = stackedWidget->indexOf(nextPage);
+ int stackindex = tabWidget->indexOf(nextPage);
/* Is this page currently on the stack or is it undocked */
if (stackindex >= 0) {
/* put this page on the top of the stack */
- stackedWidget->setCurrentIndex(stackindex);
+ tabWidget->setCurrentIndex(stackindex);
} else {
/* it is undocked, raise it to the front */
nextPage->raise();
*/
void MainWin::input_line()
{
+ int conn;
QString cmdStr = lineEdit->text(); /* Get the text */
lineEdit->clear(); /* clear the lineEdit box */
if (m_currentConsole->is_connected()) {
- /* Use consoleCommand to allow typing anything */
- m_currentConsole->consoleCommand(cmdStr);
+ if (m_currentConsole->findDirComm(conn)) {
+ m_currentConsole->consoleCommand(cmdStr, conn);
+ } else {
+ /* Use consoleCommand to allow typing anything */
+ m_currentConsole->consoleCommand(cmdStr);
+ }
} else {
set_status(tr("Director not connected. Click on connect button."));
}
*/
void MainWin::undockWindowButton()
{
- Pages* page = (Pages*)stackedWidget->currentWidget();
+ Pages* page = (Pages*)tabWidget->currentWidget();
page->togglePageDocking();
}
void MainWin::stackItemChanged(int)
{
if (m_isClosing) return; /* if closing the application, do nothing here */
- Pages* page = (Pages*)stackedWidget->currentWidget();
+ 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 *)));
+ }
}
/*