HEADERS += select/select.h
SOURCES += select/select.cpp
+## BatStack
+HEADERS += batstack.h
+SOURCES += batstack.cpp
+
## MediaList
HEADERS += medialist/medialist.h
SOURCES += medialist/medialist.cpp
--- /dev/null
+/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2000-2007 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
+ License as published by the Free Software Foundation plus additions
+ that are listed 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
+ 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
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Bacula® is a registered trademark of John Walker.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+*/
+/*
+ * Version $Id: batstack.cpp 4230 2007-02-21 20:07:37Z kerns $
+ *
+ * Kern Sibbald, January 2007
+ */
+
+#include "batstack.h"
+
+void BatStack::AddTostack()
+{
+ /* These two lines are for making sure if it is being changed from a window
+ * That it has the proper window flag and parent. */
+ setWindowFlags(Qt::Widget);
+ setParent(m_parent);
+ /* This was being done already */
+ m_parent->addWidget(this);
+ /* Set stacked flag */
+ m_stacked=true;
+}
+
+void BatStack::RemoveFromstack()
+{
+ /* Change from a stacked widget to a normal window */
+ /* FIXME Will need to make it so that window cannot be closed */
+ m_parent->removeWidget(this);
+ setWindowFlags(Qt::Window);
+ showNormal();
+ /* Clear stacked flag */
+ m_stacked=false;
+}
+
+void BatStack::Togglestack()
+{
+ if( m_stacked ){
+ RemoveFromstack();
+ } else {
+ AddTostack();
+ }
+}
--- /dev/null
+#ifndef _BATSTACK_H_
+#define _BATSTACK_H_
+/*
+ Bacula® - The Network Backup Solution
+
+ Copyright (C) 2000-2007 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
+ License as published by the Free Software Foundation plus additions
+ that are listed 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
+ 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
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+
+ Bacula® is a registered trademark of John Walker.
+ The licensor of Bacula is the Free Software Foundation Europe
+ (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+ Switzerland, email:ftf@fsfeurope.org.
+*/
+/*
+ * Version $Id: batstack.h 4230 2007-02-21 20:07:37Z kerns $
+ *
+ * Kern Sibbald, January 2007
+ */
+
+#include <QtGui>
+
+class BatStack : public QWidget
+{
+// Q_OBJECT
+
+public:
+ void AddTostack();
+ void RemoveFromstack();
+ void Togglestack();
+ QStackedWidget *m_parent;
+// BatStack();
+
+private:
+ bool m_stacked;
+// int m_PgSelTreeIndex;
+};
+#endif /* _BATSTACK_H_ */
Console::Console(QStackedWidget *parent)
{
QFont font;
+ m_parent=parent;
(void)parent;
setupUi(this);
#include "ui_console.h"
#include "restore.h"
#include "select.h"
+#include "batstack.h"
#ifndef MAX_NAME_LENGTH
#define MAX_NAME_LENGTH 128
class JCR;
class CONRES;
-class Console : public QWidget, public Ui::ConsoleForm
+class Console : public BatStack, public Ui::ConsoleForm
{
Q_OBJECT
<rect>
<x>0</x>
<y>0</y>
- <width>973</width>
+ <width>882</width>
<height>801</height>
</rect>
</property>
<property name="windowIcon" >
<iconset>images/bat.png</iconset>
</property>
+ <property name="toolTip" >
+ <string/>
+ </property>
+ <property name="statusTip" >
+ <string>Bacula Administration Tool</string>
+ </property>
+ <property name="whatsThis" >
+ <string>It's a Dock widget to allow page selection</string>
+ </property>
<widget class="QWidget" name="centralwidget" >
<layout class="QGridLayout" >
<property name="margin" >
<property name="focusPolicy" >
<enum>Qt::StrongFocus</enum>
</property>
+ <property name="toolTip" >
+ <string/>
+ </property>
+ <property name="statusTip" >
+ <string/>
+ </property>
<property name="currentIndex" >
<number>-1</number>
</property>
<rect>
<x>0</x>
<y>0</y>
- <width>973</width>
+ <width>882</width>
<height>28</height>
</rect>
</property>
<property name="focusPolicy" >
<enum>Qt::StrongFocus</enum>
</property>
+ <property name="toolTip" >
+ <string/>
+ </property>
+ <property name="statusTip" >
+ <string/>
+ </property>
<property name="floating" >
<bool>false</bool>
</property>
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip" >
- <string>Selects right panel</string>
+ <string>Selects panel window</string>
+ </property>
+ <property name="statusTip" >
+ <string>Use items in this tree to select what window is in panel</string>
</property>
<property name="autoFillBackground" >
<bool>true</bool>
</widget>
</widget>
<widget class="QDockWidget" name="dockWidget_2" >
+ <property name="toolTip" >
+ <string>Console Entry</string>
+ </property>
+ <property name="statusTip" >
+ <string>Enter a bacula command</string>
+ </property>
+ <property name="whatsThis" >
+ <string>Cosole Command entry Dock Widget</string>
+ </property>
+ <property name="features" >
+ <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable|QDockWidget::NoDockWidgetFeatures</set>
+ </property>
<property name="allowedAreas" >
- <set>Qt::BottomDockWidgetArea</set>
+ <set>Qt::BottomDockWidgetArea|Qt::NoDockWidgetArea|Qt::TopDockWidgetArea</set>
+ </property>
+ <property name="windowTitle" >
+ <string>Cosole Command Line Entry</string>
</property>
<attribute name="dockWidgetArea" >
<number>8</number>
</widget>
</item>
<item>
- <widget class="QLineEdit" name="lineEdit" />
+ <widget class="QLineEdit" name="lineEdit" >
+ <property name="statusTip" >
+ <string>Click here to enter command</string>
+ </property>
+ </widget>
</item>
</layout>
</item>
QTreeWidgetItem *item, *topItem;
m_console = new Console(stackedWidget);
- stackedWidget->addWidget(m_console);
+ m_console->AddTostack();
- bRestore *brestore = new bRestore(stackedWidget);
- stackedWidget->addWidget(brestore);
+ m_brestore = new bRestore(stackedWidget);
+ m_brestore->AddTostack();
m_medialist = new MediaList(stackedWidget, m_console);
- stackedWidget->addWidget(m_medialist);
+ m_medialist->AddTostack();
/* Just take the first Director */
LockRes();
item->setForeground(0, redBrush);
item = createPage("brestore", topItem, true);
- item = createPage("MediaList", topItem, true);
+ item = createPage("Storage Tree", topItem, true);
treeWidget->expandItem(topItem);
stackedWidget->setCurrentIndex(0);
}
+/* Create a root Tree Widget */
QTreeWidgetItem *MainWin::createTopPage(char *name, bool canDisplay)
{
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget);
return item;
}
+/* Create A Tree Widget Item Representing a Page */
QTreeWidgetItem *MainWin::createPage(char *name, QTreeWidgetItem *parent, bool canDisplay)
{
QTreeWidgetItem *item = new QTreeWidgetItem(parent);
void MainWin::treeItemClicked(QTreeWidgetItem *item, int column)
{
- int index = item->data(column, Qt::UserRole).toInt();
- if (index >= 0) {
- stackedWidget->setCurrentIndex(index);
+ /* There just has to be a more elegant way of doing this
+ * as more and more pages get added, this could get realllly long */
+ int treeindex = item->data(column, Qt::UserRole).toInt();
+ int stackindex=-1;
+ if( treeindex == 0 ) {
+ stackindex=stackedWidget->indexOf( m_console );
+ }
+ if( treeindex == 1 ) {
+ stackindex=stackedWidget->indexOf( m_brestore );
+ }
+ if( treeindex == 2 ) {
+ stackindex=stackedWidget->indexOf( m_medialist );
+ }
+ if( stackindex >= 0 ){
+ stackedWidget->setCurrentIndex(stackindex);
}
}
*/
void MainWin::treeItemDoubleClicked(QTreeWidgetItem *item, int column)
{
- int index = item->data(column, Qt::UserRole).toInt();
- if (index >= 0) {
- stackedWidget->setCurrentIndex(index);
+ /* There just has to be a more elegant way of doing this
+ * as more and more pages get added, this could get realllly long */
+ int treeindex = item->data(column, Qt::UserRole).toInt();
+ if( treeindex == 0 ) {
+ m_console->Togglestack();
+ }
+ if( treeindex == 1 ) {
+ m_brestore->Togglestack();
+ }
+ if( treeindex == 2 ) {
+ m_medialist->Togglestack();
}
}
private:
QString m_UserInput;
Console *m_console;
+ bRestore *m_brestore;
MediaList *m_medialist;
QStringList m_cmd_history;
int m_cmd_last;
MediaList::MediaList(QStackedWidget *parent, Console *console)
{
setupUi(this);
- parent->addWidget(this);
- poollist = new QStringList();
+ m_parent=parent;
+// AddTostack();
+ m_poollist = new QStringList();
m_treeWidget = treeWidget; /* our medialist screen */
m_console = console;
createConnections();
- popupmedia="";
+ m_popupmedia="";
}
void MediaList::populateTree()
//topItem->setSizeHint(0,QSize(1050,50));
/* Start with a list of pools */
- poollist->clear();
+ m_poollist->clear();
QString *scmd = new QString(".pools\n");
m_console->write_dir(scmd->toUtf8().data());
while ((stat=m_console->read()) > 0) {
- poollist->append(m_console->msg());
+ m_poollist->append(m_console->msg());
}
- for ( QStringList::Iterator poolitem = poollist->begin(); poolitem != poollist->end(); ++poolitem ) {
+ for ( QStringList::Iterator poolitem = m_poollist->begin(); poolitem != m_poollist->end(); ++poolitem ) {
treeitem = new QTreeWidgetItem(topItem);
m_console->setTreeItem(treeitem);
poolitem->replace(QRegExp("\n"), "");
case 1:
break;
case 2:
- /* Can't figure out how to make a right button do this her Qt::LeftButton, Qt::RightButton, Qt::MidButton */
- popupmedia = text;
+ /* Can't figure out how to make a right button do this --- Qt::LeftButton, Qt::RightButton, Qt::MidButton */
+ m_popupmedia = text;
QMenu *popup = new QMenu( m_treeWidget );
connect(popup->addAction("Edit Properties"), SIGNAL(triggered()), this, SLOT(editMedia()));
connect(popup->addAction("Show Jobs On Media"), SIGNAL(triggered()), this, SLOT(showJobs()));
void MediaList::editMedia()
{
- MediaEdit* edit = new MediaEdit(m_console, popupmedia);
+ MediaEdit* edit = new MediaEdit(m_console, m_popupmedia);
edit->show();
}
void MediaList::showJobs()
{
- JobList* joblist = new JobList(m_console, popupmedia);
+ JobList* joblist = new JobList(m_console, m_popupmedia);
joblist->show();
}
#include "ui_medialist.h"
#include "console.h"
#include <qstringlist.h>
+#include "batstack.h"
-class MediaList : public QWidget, public Ui::MediaListForm
+class MediaList : public BatStack, public Ui::MediaListForm
{
Q_OBJECT
MediaList(QStackedWidget *parent,Console *console);
void populateTree();
-
public slots:
void treeItemClicked(QTreeWidgetItem *item, int column);
void treeItemDoubleClicked(QTreeWidgetItem *item, int column);
private:
Console *m_console;
QTreeWidget *m_treeWidget;
- QStringList *poollist;
- QString popupmedia;
+ QStringList *m_poollist;
+ QString m_popupmedia;
+ //QStackedWidget *m_parent;
};
#endif /* _MEDIALIST_H_ */
{
(void)parent;
setupUi(this);
-// parent->addWidget(this);
+ m_parent=parent;
}
#include "ui_brestore.h"
#include "ui_restore.h"
#include "ui_prerestore.h"
+#include "batstack.h"
class Console;
};
-class bRestore : public QWidget, public Ui::bRestoreForm
+class bRestore : public BatStack, public Ui::bRestoreForm
{
Q_OBJECT