From: Dirk H Bartley Date: Mon, 9 Apr 2007 00:25:21 +0000 (+0000) Subject: dhb move functions that were not slots from the slots part of mainwin.h X-Git-Tag: Release-7.0.0~6601 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=757ef7f26dbe0a88ea5f9bd57e901dcbd75c8f81;p=bacula%2Fbacula dhb move functions that were not slots from the slots part of mainwin.h Add code to set the color of undocked treeWidgetItems in the page selector window to blue if undocked. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4527 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 4f1300095c..3fd51f1b31 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -45,7 +45,6 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) treeWidget->clear(); treeWidget->setColumnCount(1); treeWidget->setHeaderLabel("Select Page"); -// treeWidget->addAction(actionUndock); treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu); m_pages = 0; @@ -281,7 +280,6 @@ void MainWin::treeItemDoubleClicked(QTreeWidgetItem * /*item*/, int /*column*/) /* * Called with a change of the highlighed tree widget item in the page selector. */ - void MainWin::treeItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem *previousitem) { int treeindex; @@ -459,6 +457,26 @@ void MainWin::setContextMenuDockText( Pages* page, QTreeWidgetItem* item ) docktext += item->text(0) += " Window"; actionToggleDock->setText(docktext); + setTreeWidgetItemDockColor(page, item); +} + +/* + * Function to set the color of the tree widget item based on whether it is + * docked or not. + */ +void MainWin::setTreeWidgetItemDockColor( Pages* page, QTreeWidgetItem* item ) +{ + if( item->text(0) != "Console" ){ + if( page->isDocked() ){ + /* Set the brush to blue if undocked */ + QBrush blackBrush(Qt::black); + item->setForeground(0, blackBrush); + } else { + /* Set the brush back to black if docked */ + QBrush blueBrush(Qt::blue); + item->setForeground(0, blueBrush); + } + } } void MainWin::stackItemChanged(int) diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 87af42f73a..21f6cfa956 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -60,7 +60,9 @@ public: void writeSettings(); void readSettings(); void resetFocus() { lineEdit->setFocus(); }; - + void setContextMenuDockText(); + void setContextMenuDockText(Pages *, QTreeWidgetItem *); + void setTreeWidgetItemDockColor(Pages *, QTreeWidgetItem *); public slots: void input_line(); @@ -74,8 +76,6 @@ public slots: void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); void stackItemChanged(int); void toggleDockContextWindow(); - void setContextMenuDockText(); - void setContextMenuDockText(Pages *, QTreeWidgetItem *); protected: void closeEvent(QCloseEvent *event); diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index a3b076fb1c..19d225f4da 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -32,6 +32,7 @@ */ #include "pages.h" +#include "bat.h" /* * dockPage @@ -108,6 +109,11 @@ void Pages::closeEvent(QCloseEvent* /*event*/) { /* A Widget was closed, lets toggle it back into the window, and set it in front. */ dockPage(); + mainWin->setContextMenuDockText(); +// setTreeWidgetItemDockColor(page, item); +// foreach(Pages *page, m_pagehash){ +// if +// } #ifdef xxx /* FIXME Really having problems getting it to the front,