From 12ecac37e6bbdce4bd28fbfbe4551b5a2d822583 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sun, 13 May 2007 00:49:30 +0000 Subject: [PATCH] Add color code of jobstatus to joblist. Make status display use text from status table in database. Use status code when determining color. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4764 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/TODO | 13 ++++--- bacula/src/qt-console/joblist/joblist.cpp | 43 ++++++++++++++++++----- bacula/src/qt-console/joblist/joblist.h | 1 + 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/bacula/src/qt-console/TODO b/bacula/src/qt-console/TODO index 384f1dc0f9..6ffdc7d6fe 100644 --- a/bacula/src/qt-console/TODO +++ b/bacula/src/qt-console/TODO @@ -1,9 +1,11 @@ dhb ==================================================== -Color code termination code in joblist. Create class to display messages from -a specific job. Want the ability to create an instance of that class from -joblist. I also want a table to convert termination code into human readable -text. +Create class to display messages from a specific job. Want the ability to +create an instance of that class from joblist. + +Need to figure out the functionality and inteligence that the last restore +window should have and give it to it. Right now it shows drop downs with no +options. Test left pane of restore with 2 windows drives in one backup job. @@ -81,6 +83,9 @@ global one defined in the mainWin class (if I remember right). ============================================================ DONE: ============================================================ +Color code termination code in joblist. I also want a table to convert +termination code into human readable text. + show purged flag in joblist. Don't have purge option show if already purged. move behavior of: diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index c69704c09c..17a0686e36 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -114,11 +114,12 @@ void JobList::populateTable() query += "SELECT DISTINCT Job.Jobid AS Id, Job.Name AS JobName, Client.Name AS Client," " Job.Starttime AS JobStart, Job.Type AS JobType," " Job.Level AS BackupLevel, Job.Jobfiles AS FileCount," - " Job.JobBytes AS Bytes, Job.JobStatus AS Status," + " Job.JobBytes AS Bytes," + " Job.JobStatus AS Status, Status.JobStatusLong AS Status," " Job.PurgedFiles AS Purged" - " FROM Job, JobMedia, Media, Client" - " WHERE JobMedia.JobId=Job.JobId and JobMedia.MediaId=Media.MediaId" - " and Client.ClientId=Job.ClientId"; + " FROM Job, JobMedia, Media, Client, Status" + " WHERE JobMedia.JobId=Job.JobId AND JobMedia.MediaId=Media.MediaId" + " AND Client.ClientId=Job.ClientId AND Job.JobStatus=Status.JobStatus"; int volumeIndex = volumeComboBox->currentIndex(); if (volumeIndex != -1) m_mediaName = volumeComboBox->itemText(volumeIndex); @@ -167,6 +168,7 @@ void JobList::populateTable() << "Job Id" << "Job Name" << "Client" << "Job Starttime" << "Job Type" << "Job Level" << "Job Files" << "Job Bytes" << "Job Status" << "Purged" ); m_purgedIndex = headerlist.indexOf("Purged"); + statusIndex = headerlist.indexOf("Job Status"); /* Initialize the QTableWidget */ m_checkCurrentWidget = false; @@ -190,14 +192,23 @@ void JobList::populateTable() foreach (resultline, results) { fieldlist = resultline.split("\t"); int column = 0; + bool statusIndexDone = false; + QString statusCode(""); /* Iterate through fields in the record */ foreach (field, fieldlist) { field = field.trimmed(); /* strip leading & trailing spaces */ - p_tableitem = new QTableWidgetItem(field,1); - p_tableitem->setFlags(0); - p_tableitem->setForeground(blackBrush); - mp_tableWidget->setItem(row, column, p_tableitem); - column++; + if ((column == statusIndex) && (!statusIndexDone)){ + statusIndexDone = true; + statusCode = field; + } else { + p_tableitem = new QTableWidgetItem(field,1); + p_tableitem->setFlags(0); + p_tableitem->setForeground(blackBrush); + mp_tableWidget->setItem(row, column, p_tableitem); + if (column == statusIndex) + setStatusColor(p_tableitem, statusCode); + column++; + } } row++; } @@ -215,6 +226,20 @@ void JobList::populateTable() } } +void JobList::setStatusColor(QTableWidgetItem *item, QString &field) +{ + QString greenchars("TCR"); + QString redchars("BEf"); + QString yellowchars("eDAFSMmsjdctp"); + if (greenchars.contains(field, Qt::CaseSensitive)) { + item->setBackground(Qt::green); + } else if (redchars.contains(field, Qt::CaseSensitive)) { + item->setBackground(Qt::red); + } else if (yellowchars.contains(field, Qt::CaseSensitive)){ + item->setBackground(Qt::yellow); + } +} + /* * When the treeWidgetItem in the page selector tree is singleclicked, Make sure * The tree has been populated. diff --git a/bacula/src/qt-console/joblist/joblist.h b/bacula/src/qt-console/joblist/joblist.h index 0b6bfb9aae..85aa834fc4 100644 --- a/bacula/src/qt-console/joblist/joblist.h +++ b/bacula/src/qt-console/joblist/joblist.h @@ -66,6 +66,7 @@ private slots: private: void createConnections(); + void setStatusColor(QTableWidgetItem *item, QString &field); QString m_mediaName; QString m_clientName; QString m_currentJob; -- 2.39.5