From: Dirk H Bartley Date: Sat, 21 Apr 2007 23:43:12 +0000 (+0000) Subject: This implements dynamic pages created on the fly being nested on the tree X-Git-Tag: Release-7.0.0~6541 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=22f94167a4a8669e79290a9b5981097d4c9cad0b;p=bacula%2Fbacula This implements dynamic pages created on the fly being nested on the tree underneath the objects that were used to create them. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4587 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/TODO b/bacula/src/qt-console/TODO index b1d4485cc8..9f937d4186 100644 --- a/bacula/src/qt-console/TODO +++ b/bacula/src/qt-console/TODO @@ -41,6 +41,21 @@ Things to do: - Possibly some other things I didn't think of. +=========================================================== +NOT SURE +=========================================================== + +I'm not sure about this one?? Things seem to work and I did not do a +thing to make it happen: the "dir" is a member of Console + +- We also must somehow make the low level I/O routines know which +director/console to use. Currently they always use the single +global one defined in the mainWin class (if I remember right). + + +============================================================ +DONE: +============================================================ Another idea for what you have implemented: - I think that the dynamic pages that you create on the fly should be nested under the item that creates them more like a @@ -63,21 +78,6 @@ My original concept was to put these in a tabbed widget. Your Idea may make for a cleaner user experience. I like it. It could save the effort of getting a tabbed widget to work. -=========================================================== -NOT SURE -=========================================================== - -I'm not sure about this one?? Things seem to work and I did not do a -thing to make it happen: the "dir" is a member of Console - -- We also must somehow make the low level I/O routines know which -director/console to use. Currently they always use the single -global one defined in the mainWin class (if I remember right). - - -============================================================ -DONE: -============================================================ - I think we need to make the current Director more explicit, by perhaps highlighting it in the page selector when it is current diff --git a/bacula/src/qt-console/clients/clients.cpp b/bacula/src/qt-console/clients/clients.cpp index 7f380c6b13..c10e7d9a91 100644 --- a/bacula/src/qt-console/clients/clients.cpp +++ b/bacula/src/qt-console/clients/clients.cpp @@ -187,7 +187,8 @@ void Clients::createContextMenu() void Clients::showJobs() { QString emptymedia(""); - mainWin->createPageJobList(emptymedia, m_currentlyselected); + QTreeWidgetItem *parentItem = mainWin->getFromHash(this); + mainWin->createPageJobList(emptymedia, m_currentlyselected, parentItem); } /* diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index 9d10be8756..a4598cec91 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -40,12 +40,13 @@ /* * Constructor for the class */ -JobList::JobList(QString &medianame, QString &clientname) +JobList::JobList(QString &medianame, QString &clientname, + QTreeWidgetItem *parentTreeWidgetItem) { setupUi(this); m_medianame = medianame; m_clientname = clientname; - pgInitialize(); + pgInitialize(parentTreeWidgetItem); m_resultCount = 0; m_populated = false; m_closeable = false; diff --git a/bacula/src/qt-console/joblist/joblist.h b/bacula/src/qt-console/joblist/joblist.h index f779dec030..c3ee1fa28f 100644 --- a/bacula/src/qt-console/joblist/joblist.h +++ b/bacula/src/qt-console/joblist/joblist.h @@ -43,7 +43,7 @@ class JobList : public Pages, public Ui::JobListForm Q_OBJECT public: - JobList(QString &medianame, QString &clientname); + JobList(QString &medianame, QString &clientname, QTreeWidgetItem *); virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); int m_resultCount; diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 4012429b1b..1939461777 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -63,8 +63,11 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) } m_currentConsole = (Console*)getFromHash(m_firstItem); treeWidget->setCurrentItem(getFromHash(m_currentConsole)); - DIRRES* dirres = m_currentConsole->getDirRes(); - printf("Setting initial window to %s\n", dirres->name()); + /* + * I'd like to turn this into a debug item + * DIRRES* dirres = m_currentConsole->getDirRes(); + * printf("Setting initial window to %s\n", dirres->name()); + */ } void MainWin::createPages() @@ -109,7 +112,7 @@ void MainWin::createPages() createPagebRestore(); createPageMediaList(); QString emptymedia(""), emptyclient(""); - createPageJobList(emptymedia, emptyclient); + createPageJobList(emptymedia, emptyclient, NULL); createPageClients(); treeWidget->expandItem(topItem); @@ -139,13 +142,14 @@ void MainWin::createPageMediaList() /* * create an instance of the the joblist class on the stack */ -void MainWin::createPageJobList(QString &media, QString &client) +void MainWin::createPageJobList(QString &media, QString &client, + QTreeWidgetItem *parentTreeWidgetItem) { QTreeWidgetItem *item, *holdItem; /* save current tree widget item in case query produces no results */ holdItem = treeWidget->currentItem(); - JobList* joblist = new JobList(media, client); + JobList* joblist = new JobList(media, client, parentTreeWidgetItem); joblist->dockPage(); /* If this is a query of jobs on a specific media */ if ((media != "") || (client != "")) { diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 130b5a516c..109ae59846 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -78,7 +78,7 @@ public: QHash m_widgethash; /* This is a list of consoles */ QHash m_consoleHash; - void createPageJobList(QString &, QString &); + void createPageJobList(QString &, QString &, QTreeWidgetItem *); public slots: void input_line(); diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index 38537ae669..fe751d5638 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -159,7 +159,8 @@ void MediaList::editMedia() void MediaList::showJobs() { QString emptyclient(""); - mainWin->createPageJobList(m_currentlyselected, emptyclient); + QTreeWidgetItem *parentItem = mainWin->getFromHash(this); + mainWin->createPageJobList(m_currentlyselected, emptyclient, parentItem); } /* diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index 8858a76623..74cebde6cb 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -174,13 +174,22 @@ void Pages::closeStackPage() } /* - * Function to set members from the external mainwin + * Function to set members from the external mainwin and it's overload being + * passed a specific QTreeWidgetItem to be it's parent on the tree */ void Pages::pgInitialize() +{ + pgInitialize(NULL); +} + +void Pages::pgInitialize(QTreeWidgetItem *parentTreeWidgetItem) { m_parent = mainWin->stackedWidget; m_console = mainWin->currentConsole(); - QTreeWidgetItem *parentTreeWidgetItem = m_console->directorTreeItem(); + + if (!parentTreeWidgetItem) { + parentTreeWidgetItem = m_console->directorTreeItem(); + } QTreeWidgetItem *item = new QTreeWidgetItem(parentTreeWidgetItem); QString name; diff --git a/bacula/src/qt-console/pages.h b/bacula/src/qt-console/pages.h index a5616ddcb0..aec0d6a0b3 100644 --- a/bacula/src/qt-console/pages.h +++ b/bacula/src/qt-console/pages.h @@ -73,6 +73,7 @@ public slots: protected: void pgInitialize(); + void pgInitialize(QTreeWidgetItem *); bool m_closeable; bool m_docked; virtual void treeWidgetName(QString &);