From d6588638f1584db86487b542173e9e11737999ed Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sun, 22 Apr 2007 17:03:32 +0000 Subject: [PATCH] Have the title of undocked window describe the type of window it is like the page selector and the director that it represents. Also add bat.pro to svn property svn:ignore to make more svn friendly. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4593 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/TODO | 4 +++- bacula/src/qt-console/clients/clients.cpp | 11 ++--------- bacula/src/qt-console/clients/clients.h | 1 - bacula/src/qt-console/console/console.cpp | 8 ++++++++ bacula/src/qt-console/console/console.h | 2 +- bacula/src/qt-console/fileset/fileset.cpp | 11 ++--------- bacula/src/qt-console/fileset/fileset.h | 1 - bacula/src/qt-console/joblist/joblist.cpp | 2 ++ bacula/src/qt-console/mainwin.cpp | 2 +- bacula/src/qt-console/medialist/medialist.cpp | 10 ++-------- bacula/src/qt-console/medialist/medialist.h | 1 - bacula/src/qt-console/pages.cpp | 19 +++++++++++++++++-- bacula/src/qt-console/pages.h | 2 ++ bacula/src/qt-console/restore/brestore.cpp | 9 +-------- bacula/src/qt-console/restore/restore.h | 1 - bacula/src/qt-console/storage/storage.cpp | 11 ++--------- bacula/src/qt-console/storage/storage.h | 1 - 17 files changed, 43 insertions(+), 53 deletions(-) diff --git a/bacula/src/qt-console/TODO b/bacula/src/qt-console/TODO index bb27bb0831..5aa5cb6399 100644 --- a/bacula/src/qt-console/TODO +++ b/bacula/src/qt-console/TODO @@ -22,7 +22,7 @@ to surf the filestructure on the job. LOW priority items: -Get rid of "Warning: name layoutWidget is already used" when make uic's resture.ui +Get rid of "Warning: name layoutWidget is already used" when make uic's restore.ui move behavior of: MainWin::setContextMenuDockText @@ -51,6 +51,8 @@ global one defined in the mainWin class (if I remember right). ============================================================ DONE: ============================================================ +Set Window titles to reflect what director it is. + Must:: get page selector to follow undocked windows. Otherwise current console won't be current. diff --git a/bacula/src/qt-console/clients/clients.cpp b/bacula/src/qt-console/clients/clients.cpp index 290d8d2319..c4089d57c4 100644 --- a/bacula/src/qt-console/clients/clients.cpp +++ b/bacula/src/qt-console/clients/clients.cpp @@ -43,12 +43,14 @@ Clients::Clients() { setupUi(this); + m_name = "Clients"; pgInitialize(); /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_client.h */ m_populated = false; m_checkcurwidget = true; m_closeable = false; + setTitle(); } Clients::~Clients() @@ -222,12 +224,3 @@ void Clients::currentStackItem() m_populated=true; } } - -/* - * Virtual Function to return the name for the medialist tree widget - */ -void Clients::treeWidgetName(QString &name) -{ - name = "Clients"; -} - diff --git a/bacula/src/qt-console/clients/clients.h b/bacula/src/qt-console/clients/clients.h index 2c1ea4d66e..3b2021ee5c 100644 --- a/bacula/src/qt-console/clients/clients.h +++ b/bacula/src/qt-console/clients/clients.h @@ -48,7 +48,6 @@ public: ~Clients(); virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); - virtual void treeWidgetName(QString &); public slots: void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 128e4765d9..2b4e649c71 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -622,3 +622,11 @@ void Console::setDirRes(DIRRES *dir) { m_dir = dir; } + +/* + * To have the ability to get the name of the director resource. + */ +void Console::getDirResName(QString &name_returned) +{ + name_returned = m_dir->name(); +} diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index b6a0638df6..6a38782dfe 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -97,7 +97,7 @@ public: void setDirectorTreeItem(QTreeWidgetItem *); void setDirRes(DIRRES *dir); QTreeWidgetItem *directorTreeItem() { return m_directorTreeItem; }; - DIRRES *getDirRes() { return m_dir; }; + void getDirResName(QString &); QStringList job_list; QStringList client_list; diff --git a/bacula/src/qt-console/fileset/fileset.cpp b/bacula/src/qt-console/fileset/fileset.cpp index da232bfc55..eb2337ed42 100644 --- a/bacula/src/qt-console/fileset/fileset.cpp +++ b/bacula/src/qt-console/fileset/fileset.cpp @@ -43,12 +43,14 @@ FileSet::FileSet() { setupUi(this); + m_name = "FileSets"; pgInitialize(); /* mp_treeWidget, FileSet Tree Tree Widget inherited from ui_fileset.h */ m_populated = false; m_checkcurwidget = true; m_closeable = false; + setTitle(); } FileSet::~FileSet() @@ -211,12 +213,3 @@ void FileSet::currentStackItem() m_populated=true; } } - -/* - * Virtual Function to return the name for the medialist tree widget - */ -void FileSet::treeWidgetName(QString &name) -{ - name = "FileSet"; -} - diff --git a/bacula/src/qt-console/fileset/fileset.h b/bacula/src/qt-console/fileset/fileset.h index 285b64579b..f219b855fa 100644 --- a/bacula/src/qt-console/fileset/fileset.h +++ b/bacula/src/qt-console/fileset/fileset.h @@ -47,7 +47,6 @@ public: ~FileSet(); virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); - void treeWidgetName(QString &); public slots: void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index a4598cec91..0cbebb6544 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -44,6 +44,7 @@ JobList::JobList(QString &medianame, QString &clientname, QTreeWidgetItem *parentTreeWidgetItem) { setupUi(this); + m_name = "Clients"; m_medianame = medianame; m_clientname = clientname; pgInitialize(parentTreeWidgetItem); @@ -53,6 +54,7 @@ JobList::JobList(QString &medianame, QString &clientname, /* connect to the action specific to this pages class */ connect(actionRefreshJobList, SIGNAL(triggered()), this, SLOT(populateTable())); + setTitle(); } /* diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index ba8b8fe7ab..300510d90c 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -65,7 +65,7 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) } m_currentConsole = (Console*)getFromHash(m_firstItem); treeWidget->setCurrentItem(getFromHash(m_currentConsole)); - /* + /* FIXME * I'd like to turn this into a debug item * DIRRES* dirres = m_currentConsole->getDirRes(); * printf("Setting initial window to %s\n", dirres->name()); diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index cd87bf8c54..df7a7fdeb2 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -45,12 +45,14 @@ MediaList::MediaList() { setupUi(this); + m_name = "Media"; pgInitialize(); /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_medialist.h */ m_populated = false; m_checkcurwidget = true; m_closeable = false; + setTitle(); } MediaList::~MediaList() @@ -220,11 +222,3 @@ void MediaList::currentStackItem() m_populated=true; } } - -/* - * Virtual Function to return the name for the medialist tree widget - */ -void MediaList::treeWidgetName(QString &name) -{ - name = "Media"; -} diff --git a/bacula/src/qt-console/medialist/medialist.h b/bacula/src/qt-console/medialist/medialist.h index fa436f346a..a86d22b555 100644 --- a/bacula/src/qt-console/medialist/medialist.h +++ b/bacula/src/qt-console/medialist/medialist.h @@ -47,7 +47,6 @@ public: ~MediaList(); virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); - virtual void treeWidgetName(QString &); public slots: void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index ba27c228b8..907e551498 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -204,7 +204,7 @@ void Pages::pgInitialize(QTreeWidgetItem *parentTreeWidgetItem) */ void Pages::treeWidgetName(QString &name) { - name = "Default Page Name"; + name = m_name; } /* @@ -222,7 +222,8 @@ void Pages::consoleCommand(QString &command) /* * Function for handling undocked windows becoming active. * Change the currently selected item in the page selector window to the now - * active undocked window. + * active undocked window. This will also make the console for the undocked + * window m_currentConsole. */ void Pages::changeEvent(QEvent *event) { @@ -230,3 +231,17 @@ void Pages::changeEvent(QEvent *event) mainWin->treeWidget->setCurrentItem(mainWin->getFromHash(this)); } } + +/* + * Function to simplify getting the name of the class and the director into + * the caption or title of the window + */ +void Pages::setTitle() +{ + QString title, director; + treeWidgetName(title); + m_console->getDirResName(director); + title += " of Director "; + title += director; + setWindowTitle(title); +} diff --git a/bacula/src/qt-console/pages.h b/bacula/src/qt-console/pages.h index 943ada0efe..24e7d8e509 100644 --- a/bacula/src/qt-console/pages.h +++ b/bacula/src/qt-console/pages.h @@ -77,9 +77,11 @@ protected: void consoleCommand(QString &); virtual void treeWidgetName(QString &); virtual void changeEvent(QEvent *event); + void setTitle(); bool m_closeable; bool m_docked; Console *m_console; + QString m_name; }; #endif /* _PAGES_H_ */ diff --git a/bacula/src/qt-console/restore/brestore.cpp b/bacula/src/qt-console/restore/brestore.cpp index 5636df864c..7e27665784 100644 --- a/bacula/src/qt-console/restore/brestore.cpp +++ b/bacula/src/qt-console/restore/brestore.cpp @@ -40,6 +40,7 @@ bRestore::bRestore() { + m_name = "bRestore"; setupUi(this); pgInitialize(); m_closeable = true; @@ -48,11 +49,3 @@ bRestore::bRestore() bRestore::~bRestore() { } - -/* - * Virtual Function to return the name for the medialist tree widget - */ -void bRestore::treeWidgetName(QString &name) -{ - name = "bRestore"; -} diff --git a/bacula/src/qt-console/restore/restore.h b/bacula/src/qt-console/restore/restore.h index b07426cc9b..bc825fc8ea 100644 --- a/bacula/src/qt-console/restore/restore.h +++ b/bacula/src/qt-console/restore/restore.h @@ -99,7 +99,6 @@ class bRestore : public Pages, public Ui::bRestoreForm public: bRestore(); ~bRestore(); - virtual void treeWidgetName(QString &); public slots: diff --git a/bacula/src/qt-console/storage/storage.cpp b/bacula/src/qt-console/storage/storage.cpp index 8efd845d78..2001bcad08 100644 --- a/bacula/src/qt-console/storage/storage.cpp +++ b/bacula/src/qt-console/storage/storage.cpp @@ -43,12 +43,14 @@ Storage::Storage() { setupUi(this); + m_name = "Storage"; pgInitialize(); /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_storage.h */ m_populated = false; m_checkcurwidget = true; m_closeable = false; + setTitle(); } Storage::~Storage() @@ -211,12 +213,3 @@ void Storage::currentStackItem() m_populated=true; } } - -/* - * Virtual Function to return the name for the medialist tree widget - */ -void Storage::treeWidgetName(QString &name) -{ - name = "Storage"; -} - diff --git a/bacula/src/qt-console/storage/storage.h b/bacula/src/qt-console/storage/storage.h index 49e6c6f124..5ba03d834e 100644 --- a/bacula/src/qt-console/storage/storage.h +++ b/bacula/src/qt-console/storage/storage.h @@ -47,7 +47,6 @@ public: ~Storage(); virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); - virtual void treeWidgetName(QString &); public slots: void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); -- 2.39.5