From 33da41a535a131d1fee787f3363fd6ee0cc19836 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Wed, 12 Mar 2008 00:37:50 +0000 Subject: [PATCH] Changed running from a table widget to a text widget. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6589 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/status/clientstat.cpp | 66 +------ bacula/src/qt-console/status/clientstat.h | 1 - bacula/src/qt-console/status/clientstat.ui | 208 +++++++++----------- 3 files changed, 101 insertions(+), 174 deletions(-) diff --git a/bacula/src/qt-console/status/clientstat.cpp b/bacula/src/qt-console/status/clientstat.cpp index 99ba982f09..91e4bd0405 100644 --- a/bacula/src/qt-console/status/clientstat.cpp +++ b/bacula/src/qt-console/status/clientstat.cpp @@ -48,7 +48,7 @@ ClientStat::ClientStat(QString &client, QTreeWidgetItem *parentTreeWidgetItem) pgInitialize(parentTreeWidgetItem); QTreeWidgetItem* thisitem = mainWin->getFromHash(this); thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/status.png"))); - m_cursor = new QTextCursor(textEdit->document()); + m_cursor = new QTextCursor(textEditHeader->document()); readSettings(); dockPage(); @@ -62,7 +62,7 @@ ClientStat::ClientStat(QString &client, QTreeWidgetItem *parentTreeWidgetItem) void ClientStat::getFont() { - QFont font = textEdit->font(); + QFont font = textEditHeader->font(); QString dirname; m_console->getDirResName(dirname); @@ -72,7 +72,7 @@ void ClientStat::getFont() font.setPointSize(settings.value("consolePointSize", 10).toInt()); font.setFixedPitch(settings.value("consoleFixedPitch", true).toBool()); settings.endGroup(); - textEdit->setFont(font); + textEditHeader->setFont(font); } /* @@ -114,12 +114,12 @@ void ClientStat::populateHeader() { QString command = QString(".status client=\"" + m_client + "\" header"); QStringList results; - textEdit->clear(); + textEditHeader->clear(); if (m_console->dir_cmd(command, results)) { foreach (QString line, results) { line += "\n"; - textEdit->insertPlainText(line); + textEditHeader->insertPlainText(line); } } } @@ -179,46 +179,21 @@ void ClientStat::populateTerminated() } /* - * Populate running table + * Populate running text */ void ClientStat::populateRunning() { QString command = QString(".status client=\"" + m_client + "\" running"); Pmsg1(100, "Clients running cmd : %s\n",command.toUtf8().data()); QStringList results; - QBrush blackBrush(Qt::black); - - runningTable->clear(); - QStringList headerlist = (QStringList() - << tr("Job Id") << tr("Job Level") << tr("Job Data") << tr("Job Info")); - - runningTable->setColumnCount(headerlist.size()); - runningTable->setHorizontalHeaderLabels(headerlist); + textEditRunning->clear(); if (m_console->dir_cmd(command, results)) { - int row = 0; - QTableWidgetItem* p_tableitem; - runningTable->setRowCount(results.size()); foreach (QString line, results) { - /* Iterate through the record returned from the query */ - QStringList fieldlist = line.split("\t"); - int column = 0; - QString statusCode(""); - /* Iterate through fields in the record */ - foreach (QString field, fieldlist) { - field = field.trimmed(); /* strip leading & trailing spaces */ - p_tableitem = new QTableWidgetItem(field, 1); - p_tableitem->setForeground(blackBrush); - p_tableitem->setFlags(0); - runningTable->setItem(row, column, p_tableitem); - column += 1; - } - row += 1; + line += "\n"; + textEditRunning->insertPlainText(line); } } - runningTable->resizeColumnsToContents(); - runningTable->resizeRowsToContents(); - runningTable->verticalHeader()->hide(); } /* @@ -253,12 +228,6 @@ void ClientStat::createConnections() { connect(actionRefresh, SIGNAL(triggered()), this, SLOT(populateAll())); - connect(actionCancelRunning, SIGNAL(triggered()), this, - SLOT(consoleCancelJob())); - - runningTable->setContextMenuPolicy(Qt::ActionsContextMenu); - runningTable->addAction(actionRefresh); - runningTable->addAction(actionCancelRunning); } /* @@ -278,24 +247,9 @@ void ClientStat::writeSettings() void ClientStat::readSettings() { m_groupText = "ClientStatPage"; - m_splitText = "splitterSizes_0"; + m_splitText = "splitterSizes_1"; QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup(m_groupText); splitter->restoreState(settings.value(m_splitText).toByteArray()); settings.endGroup(); } - -/* - * Cancel a running job - */ -void ClientStat::consoleCancelJob() -{ - int currentrow = runningTable->currentRow(); - QTableWidgetItem *item = runningTable->item(currentrow, 0); - if (item) { - QString text = item->text(); - QString cmd("cancel jobid="); - cmd += text; - consoleCommand(cmd); - } -} diff --git a/bacula/src/qt-console/status/clientstat.h b/bacula/src/qt-console/status/clientstat.h index b3896a7987..3f47f01afb 100644 --- a/bacula/src/qt-console/status/clientstat.h +++ b/bacula/src/qt-console/status/clientstat.h @@ -56,7 +56,6 @@ public slots: private slots: void timerTriggered(); - void consoleCancelJob(); private: void createConnections(); diff --git a/bacula/src/qt-console/status/clientstat.ui b/bacula/src/qt-console/status/clientstat.ui index 1af11ec46d..57026d9685 100644 --- a/bacula/src/qt-console/status/clientstat.ui +++ b/bacula/src/qt-console/status/clientstat.ui @@ -5,115 +5,23 @@ 0 0 - 504 - 410 + 618 + 630 Form - - 9 - - - 9 - - - 9 - - - 9 - - - 6 - - - 6 - Qt::Vertical - - - - 200 - 0 - - - - - 0 - 0 - - - - - 16777215 - 100 - - - - - 1 - 0 - - - - Qt::StrongFocus - - - false - - - - - - - - - - - - Qt::ScrollBarAsNeeded - - - QTextEdit::AutoNone - - - false - - - - - - QTextEdit::NoWrap - - - true - - - + - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - + Qt::LeftToRight @@ -121,7 +29,7 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:13pt; font-weight:600;">Running Jobs</span></p></body></html> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:13pt; font-weight:600;">Header</span></p></body></html> Qt::AlignCenter @@ -129,28 +37,94 @@ p, li { white-space: pre-wrap; } - + + + + 200 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + 1 + 0 + + + + Qt::StrongFocus + + + false + + + + + + + + + + + + Qt::ScrollBarAsNeeded + + + QTextEdit::AutoNone + + + false + + + + + + QTextEdit::NoWrap + + + true + + - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - + + + + + + Qt::LeftToRight + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:13pt; font-weight:600;">Running</span></p></body></html> + + + Qt::AlignCenter + + + + + + + + + + + Qt::LeftToRight @@ -166,7 +140,7 @@ p, li { white-space: pre-wrap; } - + -- 2.39.5