From 9fb2e70cb90789ddc9c64314f3b4928af99db013 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sun, 16 Mar 2008 16:36:46 +0000 Subject: [PATCH] Add command debbugging lines based on preferences. Add code to only run command for active tab in storstat. Add connection to run command every time a new tab is clicked. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6619 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/status/clientstat.cpp | 7 +++- bacula/src/qt-console/status/dirstat.cpp | 8 ++++ bacula/src/qt-console/status/storstat.cpp | 41 ++++++++++++++++++--- bacula/src/qt-console/status/storstat.h | 1 + bacula/src/qt-console/status/storstat.ui | 18 ++++----- 5 files changed, 59 insertions(+), 16 deletions(-) diff --git a/bacula/src/qt-console/status/clientstat.cpp b/bacula/src/qt-console/status/clientstat.cpp index b4fe0579bf..e7f18e35b8 100644 --- a/bacula/src/qt-console/status/clientstat.cpp +++ b/bacula/src/qt-console/status/clientstat.cpp @@ -113,6 +113,8 @@ void ClientStat::timerTriggered() void ClientStat::populateHeader() { QString command = QString(".status client=\"" + m_client + "\" header"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; textEditHeader->clear(); @@ -130,6 +132,8 @@ void ClientStat::populateHeader() void ClientStat::populateTerminated() { QString command = QString(".status client=\"" + m_client + "\" terminated"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; QBrush blackBrush(Qt::black); @@ -184,7 +188,8 @@ void ClientStat::populateTerminated() void ClientStat::populateRunning() { QString command = QString(".status client=\"" + m_client + "\" running"); - Pmsg1(100, "Clients running cmd : %s\n",command.toUtf8().data()); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; textEditRunning->clear(); diff --git a/bacula/src/qt-console/status/dirstat.cpp b/bacula/src/qt-console/status/dirstat.cpp index c1e3a027a6..4bcaa714eb 100644 --- a/bacula/src/qt-console/status/dirstat.cpp +++ b/bacula/src/qt-console/status/dirstat.cpp @@ -112,6 +112,8 @@ void DirStat::timerTriggered() void DirStat::populateHeader() { QString command = QString(".status dir header"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; textEdit->clear(); @@ -129,6 +131,8 @@ void DirStat::populateHeader() void DirStat::populateTerminated() { QString command = QString(".status dir terminated"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; QBrush blackBrush(Qt::black); @@ -183,6 +187,8 @@ void DirStat::populateTerminated() void DirStat::populateScheduled() { QString command = QString(".status dir scheduled"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; QBrush blackBrush(Qt::black); @@ -228,6 +234,8 @@ void DirStat::populateScheduled() void DirStat::populateRunning() { QString command = QString(".status dir running"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; QBrush blackBrush(Qt::black); diff --git a/bacula/src/qt-console/status/storstat.cpp b/bacula/src/qt-console/status/storstat.cpp index 4a51064ff7..f228ab1b3a 100644 --- a/bacula/src/qt-console/status/storstat.cpp +++ b/bacula/src/qt-console/status/storstat.cpp @@ -104,13 +104,9 @@ void StorStat::populateAll() { if (!m_console->preventInUseConnect()) return; - populateHeader(); populateTerminated(); populateRunning(); - populateWaitReservation(); - populateDevices(); - populateVolumes(); - populateSpooling(); + populateCurrentTab(tabWidget->currentIndex()); } /* @@ -131,6 +127,8 @@ void StorStat::timerTriggered() void StorStat::populateHeader() { QString command = QString(".status storage=\"" + m_storage + "\" header"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; textEditHeader->clear(); @@ -145,6 +143,8 @@ void StorStat::populateHeader() void StorStat::populateWaitReservation() { QString command = QString(".status storage=\"" + m_storage + "\" waitreservation"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; textEditWaitReservation->clear(); @@ -159,6 +159,8 @@ void StorStat::populateWaitReservation() void StorStat::populateDevices() { QString command = QString(".status storage=\"" + m_storage + "\" devices"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; textEditDevices->clear(); @@ -173,6 +175,8 @@ void StorStat::populateDevices() void StorStat::populateVolumes() { QString command = QString(".status storage=\"" + m_storage + "\" volumes"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; textEditVolumes->clear(); @@ -187,6 +191,8 @@ void StorStat::populateVolumes() void StorStat::populateSpooling() { QString command = QString(".status storage=\"" + m_storage + "\" spooling"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; textEditSpooling->clear(); @@ -204,6 +210,8 @@ void StorStat::populateSpooling() void StorStat::populateTerminated() { QString command = QString(".status storage=\"" + m_storage + "\" terminated"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; QBrush blackBrush(Qt::black); @@ -257,7 +265,9 @@ void StorStat::populateTerminated() */ void StorStat::populateRunning() { - QString command = QString(".status dir running"); + QString command = QString(".status storage=\"" + m_storage + "\" running"); + if (mainWin->m_commandDebug) + Pmsg1(000, "sending command : %s\n",command.toUtf8().data()); QStringList results; QBrush blackBrush(Qt::black); @@ -328,6 +338,8 @@ void StorStat::createConnections() SLOT(populateAll())); connect(actionCancelRunning, SIGNAL(triggered()), this, SLOT(consoleCancelJob())); + connect(tabWidget, SIGNAL(currentChanged(int)), this, + SLOT(populateCurrentTab(int))); terminatedTable->setContextMenuPolicy(Qt::ActionsContextMenu); terminatedTable->addAction(actionRefresh); runningTable->setContextMenuPolicy(Qt::ActionsContextMenu); @@ -373,3 +385,20 @@ void StorStat::consoleCancelJob() consoleCommand(cmd); } } + +/* + * Populate the text edit window in the current tab + */ +void StorStat::populateCurrentTab(int index) +{ + if (index == 0) + populateHeader(); + if (index == 1) + populateWaitReservation(); + if (index == 2) + populateDevices(); + if (index == 3) + populateVolumes(); + if (index == 4) + populateSpooling(); +} diff --git a/bacula/src/qt-console/status/storstat.h b/bacula/src/qt-console/status/storstat.h index 60b03ab195..dd1b41e01b 100644 --- a/bacula/src/qt-console/status/storstat.h +++ b/bacula/src/qt-console/status/storstat.h @@ -61,6 +61,7 @@ public slots: private slots: void timerTriggered(); void consoleCancelJob(); + void populateCurrentTab(int); private: void createConnections(); diff --git a/bacula/src/qt-console/status/storstat.ui b/bacula/src/qt-console/status/storstat.ui index 7ff14d9749..b72635453d 100644 --- a/bacula/src/qt-console/status/storstat.ui +++ b/bacula/src/qt-console/status/storstat.ui @@ -5,8 +5,8 @@ 0 0 - 560 - 477 + 502 + 466 @@ -22,7 +22,7 @@ 0 - + Header @@ -32,7 +32,7 @@ - + Waitreservation @@ -42,7 +42,7 @@ - + Devices @@ -52,7 +52,7 @@ - + Volumes @@ -62,7 +62,7 @@ - + Spooling @@ -73,7 +73,7 @@ - + @@ -96,7 +96,7 @@ p, li { white-space: pre-wrap; } - + -- 2.39.5