X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fqt-console%2Fmediainfo%2Fmediainfo.cpp;h=040192ad7844482aaa4091badd2bd0fd88423dfd;hb=b6a1f7208143a51f07573fe986fcea297f90944b;hp=77163346c0c30ceafc56043376845706a9ef59a6;hpb=73ada5feb4f32d189c348c91ef2ebb411c7f21dc;p=bacula%2Fbacula diff --git a/bacula/src/qt-console/mediainfo/mediainfo.cpp b/bacula/src/qt-console/mediainfo/mediainfo.cpp index 77163346c0..040192ad78 100644 --- a/bacula/src/qt-console/mediainfo/mediainfo.cpp +++ b/bacula/src/qt-console/mediainfo/mediainfo.cpp @@ -3,29 +3,17 @@ Copyright (C) 2007-2009 Free Software Foundation Europe e.V. - The main author of Bacula is Kern Sibbald, with contributions from - many others, a complete list can be found in the file AUTHORS. - This program is Free Software; you can redistribute it and/or - modify it under the terms of version two of the GNU General Public - License as published by the Free Software Foundation and included - in the file LICENSE. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. + The main author of Bacula is Kern Sibbald, with contributions from many + others, a complete list can be found in the file AUTHORS. + + You may use this file and others of this release according to the + license defined in the LICENSE file, which includes the Affero General + Public License, v3.0 ("AGPLv3") and some additional permissions and + terms pursuant to its AGPLv3 Section 7. Bacula® is a registered trademark of Kern Sibbald. - The licensor of Bacula is the Free Software Foundation Europe - (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, - Switzerland, email:ftf@fsfeurope.org. */ - + #include "bat.h" #include #include @@ -38,9 +26,10 @@ #include "job/job.h" /* - * A constructor + * A constructor */ MediaInfo::MediaInfo(QTreeWidgetItem *parentWidget, QString &mediaName) + : Pages() { setupUi(this); pgInitialize(tr("Media Info"), parentWidget); @@ -52,8 +41,7 @@ MediaInfo::MediaInfo(QTreeWidgetItem *parentWidget, QString &mediaName) connect(pbDelete, SIGNAL(clicked()), this, SLOT(deleteVol())); connect(pbEdit, SIGNAL(clicked()), this, SLOT(editVol())); connect(tableJob, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(showInfoForJob(QTableWidgetItem *))); - - m_closeable = true; + dockPage(); setCurrent(); populateForm(); @@ -133,7 +121,7 @@ void MediaInfo::populateForm() QString stat, LastWritten; struct tm tm; char buf[256]; - QString query = + QString query = "SELECT MediaId, VolumeName, Pool.Name, MediaType, FirstWritten," "LastWritten, VolMounts, VolBytes, Media.Enabled," "Location.Location, VolStatus, RecyclePool.Name, Media.Recycle, " @@ -145,6 +133,9 @@ void MediaInfo::populateForm() "LEFT JOIN Location ON (Media.LocationId=Location.LocationId) " "WHERE Media.VolumeName='" + m_mediaName + "'"; + if (mainWin->m_sqlDebug) { + Pmsg1(000, "MediaInfo query cmd : %s\n",query.toUtf8().data()); + } QStringList results; if (m_console->sql_cmd(query, results)) { QString resultline; @@ -168,7 +159,7 @@ void MediaInfo::populateForm() label_Location->setText(fld.next()); label_VolStatus->setText(fld.next()); label_RecyclePool->setText(fld.next()); - chkbox_Recycle->setCheckState(fld.next().toInt()?Qt::Checked:Qt::Unchecked); + chkbox_Recycle->setCheckState(fld.next().toInt()?Qt::Checked:Qt::Unchecked); edit_utime(fld.next().toULongLong(), buf, sizeof(buf)); label_VolReadTime->setText(QString(buf)); @@ -190,7 +181,7 @@ void MediaInfo::populateForm() t = str_to_utime(LastWritten.toAscii().data()); t = t + stat.toULongLong(); ttime = t; - localtime_r(&ttime, &tm); + localtime_r(&ttime, &tm); strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", &tm); label_Expire->setText(QString(buf)); } @@ -202,16 +193,19 @@ void MediaInfo::populateForm() // jobstatus_to_ascii_gui(stat[0].toAscii(), buf, sizeof(buf)); // stat = buf; -// +// } } - query = + query = "SELECT DISTINCT JobId, Name, StartTime, Type, Level, JobFiles," "JobBytes,JobStatus " "FROM Job JOIN JobMedia USING (JobId) JOIN Media USING (MediaId) " "WHERE Media.VolumeName = '" + m_mediaName + "'"; + if (mainWin->m_sqlDebug) { + Pmsg1(000, "MediaInfo query cmd : %s\n",query.toUtf8().data()); + } results.clear(); if (m_console->sql_cmd(query, results)) { QString resultline; @@ -225,7 +219,7 @@ void MediaInfo::populateForm() TableItemFormatter jobitem(*tableJob, row); /* JobId */ - jobitem.setNumericFld(index++, fld.next()); + jobitem.setNumericFld(index++, fld.next()); /* job name */ jobitem.setTextFld(index++, fld.next());