From 33ee0a776bde28e12272940b9d2867b7b1313343 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 8 Aug 2009 15:27:35 +0200 Subject: [PATCH] Turn of some debug code --- bacula/src/qt-console/job/job.cpp | 92 +++++++++++++++---------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/bacula/src/qt-console/job/job.cpp b/bacula/src/qt-console/job/job.cpp index ec9ef8d122..d321badaba 100644 --- a/bacula/src/qt-console/job/job.cpp +++ b/bacula/src/qt-console/job/job.cpp @@ -98,7 +98,7 @@ void Job::getFont() void Job::populateAll() { - Pmsg0(0, "populateAll()\n"); +// Pmsg0(50, "populateAll()\n"); populateText(); populateForm(); populateVolumes(); @@ -124,9 +124,9 @@ void Job::populateText() if (!results.size()) { QMessageBox::warning(this, tr("Bat"), tr("There were no results!\n" - "It is possible you may need to add \"catalog = all\" " - "to the Messages resource for this job.\n"), QMessageBox::Ok); - return; + "It is possible you may need to add \"catalog = all\" " + "to the Messages resource for this job.\n"), QMessageBox::Ok); + return; } QString jobstr("JobId "); /* FIXME: should this be translated ? */ @@ -141,47 +141,47 @@ void Job::populateText() QString lastSvc; foreach (QString resultline, results) { fieldlist = resultline.split("\t"); - - if (fieldlist.size() < 2) - continue; - - QString curTime = fieldlist[0].trimmed(); - - field = fieldlist[1].trimmed(); - int colon = field.indexOf(":"); - if (colon > 0) { - /* string is like : ..." - * we split at ':' then remove the jobId xxxx string (always the same) */ - QString curSvc(field.left(colon).replace(jobstr,"").trimmed()); - if (curSvc == lastSvc && curTime == lastTime) { - curTime.clear(); - curSvc.clear(); - } else { - lastTime = curTime; - lastSvc = curSvc; - } -// htmlbuf += "" + curTime + ""; - htmlbuf += "\n" + curSvc + " "; - - /* rest of string is marked as pre-formatted (here trimming should - * be avoided, to preserve original formatting) */ - QString msg(field.mid(colon+2)); - if (msg.startsWith( tr("Error:")) ) { /* FIXME: should really be translated ? */ - /* error msg, use a specific class */ - htmlbuf += "
" + msg + "
";
-	    } else {
-	       htmlbuf += msg ;
-	    }
-	 } else {
- 	    /* non standard string, place as-is */
-	    if (curTime == lastTime) {
-	       curTime.clear();
-	    } else {
-	       lastTime = curTime;
-	    }
-//	    htmlbuf += "" + curTime + "";
-	    htmlbuf += "\n" + field ;
-	 }
+         
+         if (fieldlist.size() < 2)
+            continue;
+
+         QString curTime = fieldlist[0].trimmed();
+
+         field = fieldlist[1].trimmed();
+         int colon = field.indexOf(":");
+         if (colon > 0) {
+            /* string is like  : ..." 
+             * we split at ':' then remove the jobId xxxx string (always the same) */ 
+            QString curSvc(field.left(colon).replace(jobstr,"").trimmed());
+            if (curSvc == lastSvc  && curTime == lastTime) {
+               curTime.clear();
+               curSvc.clear(); 
+            } else {
+               lastTime = curTime;
+               lastSvc = curSvc;
+            }
+//          htmlbuf += "" + curTime + "";
+            htmlbuf += "\n" + curSvc + " ";
+
+            /* rest of string is marked as pre-formatted (here trimming should
+             * be avoided, to preserve original formatting) */
+            QString msg(field.mid(colon+2));
+            if (msg.startsWith( tr("Error:")) ) { /* FIXME: should really be translated ? */
+               /* error msg, use a specific class */
+               htmlbuf += "
" + msg + "
";
+            } else {
+               htmlbuf += msg ;
+            }
+         } else {
+            /* non standard string, place as-is */
+            if (curTime == lastTime) {
+               curTime.clear();
+            } else {
+               lastTime = curTime;
+            }
+//          htmlbuf += "" + curTime + "";
+            htmlbuf += "\n" + field ;
+         }
   
       } /* foreach resultline */
 
@@ -253,7 +253,7 @@ void Job::populateVolumes()
       "SELECT DISTINCT VolumeName, InChanger, Slot "
       "FROM Job JOIN JobMedia USING (JobId) JOIN Media USING (MediaId) "
       "WHERE JobId=" + m_jobId + " ORDER BY VolumeName "; 
-   Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data());
+   if (mainWin->m_sqlDebug) Pmsg1(0, "Query cmd : %s\n",query.toUtf8().data());
          
 
    QStringList results;
-- 
2.39.5