From 2bed9a6b8a055273881afcddc7538d9e43973e39 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Thu, 29 May 2008 01:19:31 +0000 Subject: [PATCH] This is the application of a patch from Ricardo. Includes a great qty of translation changes as well as some great changes to the jobplot screen. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7051 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/bat.pro.in | 4 +- bacula/src/qt-console/bcomm/dircomm.cpp | 15 +- bacula/src/qt-console/console/console.cpp | 42 ++-- bacula/src/qt-console/jobgraphs/jobplot.cpp | 182 ++++++++---------- bacula/src/qt-console/jobgraphs/jobplot.h | 1 + bacula/src/qt-console/joblist/joblist.cpp | 83 ++------ bacula/src/qt-console/joblist/joblist.h | 2 - bacula/src/qt-console/mainwin.cpp | 12 +- bacula/src/qt-console/mainwin.h | 2 - bacula/src/qt-console/mount/mount.cpp | 9 +- bacula/src/qt-console/restore/restore.cpp | 8 +- bacula/src/qt-console/restore/restoretree.cpp | 26 +-- bacula/src/qt-console/status/clientstat.cpp | 2 +- bacula/src/qt-console/status/dirstat.cpp | 4 +- bacula/src/qt-console/status/storstat.cpp | 2 +- bacula/src/qt-console/util/comboutil.cpp | 108 +++++++++++ bacula/src/qt-console/util/comboutil.h | 62 ++++++ 17 files changed, 332 insertions(+), 232 deletions(-) create mode 100644 bacula/src/qt-console/util/comboutil.cpp create mode 100644 bacula/src/qt-console/util/comboutil.h diff --git a/bacula/src/qt-console/bat.pro.in b/bacula/src/qt-console/bat.pro.in index bfb9871ffb..664a3ecab9 100644 --- a/bacula/src/qt-console/bat.pro.in +++ b/bacula/src/qt-console/bat.pro.in @@ -147,8 +147,8 @@ HEADERS += status/storstat.h SOURCES += status/storstat.cpp # Utility sources -HEADERS += util/fmtwidgetitem.h -SOURCES += util/fmtwidgetitem.cpp +HEADERS += util/fmtwidgetitem.h util/comboutil.h +SOURCES += util/fmtwidgetitem.cpp util/comboutil.cpp INSTALLS += bins INSTALLS += confs diff --git a/bacula/src/qt-console/bcomm/dircomm.cpp b/bacula/src/qt-console/bcomm/dircomm.cpp index b0456456fc..88fd594af1 100644 --- a/bacula/src/qt-console/bcomm/dircomm.cpp +++ b/bacula/src/qt-console/bcomm/dircomm.cpp @@ -107,11 +107,11 @@ void DirComm::connect_dir(DIRRES *dir, CONRES *cons) m_dir = dir; if (!m_dir) { - mainWin->set_status("No Director found."); + mainWin->set_status( tr("No Director found.") ); return; } if (m_sock) { - mainWin->set_status("Already connected."); + mainWin->set_status( tr("Already connected.") ); return; } @@ -177,7 +177,7 @@ void DirComm::connect_dir(DIRRES *dir, CONRES *cons) _("Director daemon"), m_dir->address, NULL, m_dir->DIRport, 0); if (m_sock == NULL) { - mainWin->set_status("Connection failed"); + mainWin->set_status( tr("Connection failed") ); return; } else { /* Update page selector to green to indicate that Console is connected */ @@ -289,7 +289,7 @@ void DirComm::write_dir(const char *msg) QApplication::setOverrideCursor(Qt::WaitCursor); write(msg); } else { - mainWin->set_status(" Director not connected. Click on connect button."); + mainWin->set_status( tr(" Director not connected. Click on connect button.") ); mainWin->actionConnect->setIcon(QIcon(":images/disconnected.png")); QBrush redBrush(Qt::red); QTreeWidgetItem *item = mainWin->getFromHash(this); @@ -518,10 +518,9 @@ bool DirComm::is_connectedGui() if (is_connected()) { return true; } else { - QString message("Director "); - message += " is curerntly disconnected\n Please reconnect!!"; - QMessageBox::warning(this, tr("Bat"), - tr(message.toUtf8().data()), QMessageBox::Ok ); + QString message( tr("Director is currently disconnected\n Please reconnect!")); + QMessageBox::warning(this, "Bat", + message.toUtf8().data(), QMessageBox::Ok ); return false; } } diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index b177b4ba24..3d7eb2c812 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -129,11 +129,11 @@ void Console::connect_dir() m_textEdit = textEdit; /* our console screen */ if (!m_dir) { - mainWin->set_status("No Director found."); + mainWin->set_status( tr("No Director found.")); goto bail_out; } if (m_sock) { - mainWin->set_status("Already connected."); + mainWin->set_status( tr("Already connected.")); goto bail_out; } @@ -187,7 +187,7 @@ void Console::connect_dir() if (!m_dir->tls_ctx) { display_textf(_("Failed to initialize TLS context for Director \"%s\".\n"), m_dir->name()); - mainWin->set_status("Connection failed"); + mainWin->set_status( tr("Connection failed") ); goto bail_out; } } @@ -537,7 +537,7 @@ void Console::write_dir(const char *msg) QApplication::setOverrideCursor(Qt::WaitCursor); write(msg); } else { - mainWin->set_status(" Director not connected. Click on connect button."); + mainWin->set_status( tr(" Director not connected. Click on connect button.")); mainWin->actionConnect->setIcon(QIcon(":images/disconnected.png")); QBrush redBrush(Qt::red); QTreeWidgetItem *item = mainWin->getFromHash(this); @@ -799,10 +799,8 @@ bool Console::is_connectedGui() if (is_connected()) { return true; } else { - QString message("Director "); - message += " is currently disconnected\n Please reconnect!!"; - QMessageBox::warning(this, "Bat", - tr(message.toUtf8().data()), QMessageBox::Ok ); + QString message = tr("Director is currently disconnected\nPlease reconnect!"); + QMessageBox::warning(this, "Bat", message, QMessageBox::Ok ); return false; } } @@ -814,27 +812,21 @@ bool Console::is_connectedGui() bool Console::preventInUseConnect() { if (!is_connected()) { - QString message("Director "); - message += m_dir->name(); - message += " is currently disconnected\n Please reconnect!!"; - QMessageBox::warning(this, "Bat", - tr(message.toUtf8().data()), QMessageBox::Ok ); + QString message = tr("Director %1 is currently disconnected\n" + "Please reconnect!").arg(m_dir->name()); + QMessageBox::warning(this, "Bat", message, QMessageBox::Ok ); return false; } else if (!m_at_main_prompt){ - QString message("Director "); - message += m_dir->name(); - message += " is currently busy\n Please complete restore or other " - " operation !! This is a limitation that will be resolved before a beta" - " release. This is currently an alpha release."; - QMessageBox::warning(this, "Bat", - tr(message.toUtf8().data()), QMessageBox::Ok ); + QString message = tr("Director %1 is currently busy\n Please complete " + "restore or other operation! This is a limitation " + "that will be resolved before a beta release. " + "This is currently an alpha release.").arg(m_dir->name()); + QMessageBox::warning(this, "Bat", message, QMessageBox::Ok ); return false; } else if (!m_at_prompt){ - QString message("Director "); - message += m_dir->name(); - message += " is currently not at a prompt\n Please try again!!"; - QMessageBox::warning(this, "Bat", - tr(message.toUtf8().data()), QMessageBox::Ok ); + QString message = tr("Director %1 is currently not at a prompt\n" + " Please try again!").arg(m_dir->name()); + QMessageBox::warning(this, "Bat", message, QMessageBox::Ok ); return false; } else { return true; diff --git a/bacula/src/qt-console/jobgraphs/jobplot.cpp b/bacula/src/qt-console/jobgraphs/jobplot.cpp index e6763f8ec2..5e50a6d325 100644 --- a/bacula/src/qt-console/jobgraphs/jobplot.cpp +++ b/bacula/src/qt-console/jobgraphs/jobplot.cpp @@ -37,6 +37,7 @@ #include #include "bat.h" +#include "util/comboutil.h" #include "jobgraphs/jobplot.h" @@ -76,7 +77,7 @@ JobPlotControls::JobPlotControls() JobPlot::JobPlot(QTreeWidgetItem *parentTreeWidgetItem, JobPlotPass &passVals) { setupUserInterface(); - m_name = "JobPlot"; + m_name = tr("JobPlot"); pgInitialize(parentTreeWidgetItem); readSplitterSettings(); QTreeWidgetItem* thisitem = mainWin->getFromHash(this); @@ -134,13 +135,13 @@ void JobPlot::reGraph() */ void JobPlot::setupControls() { - QStringList graphType = QStringList() << /* "Fitted" <<*/ "Sticks" << "Lines" << "Steps" << "None"; + QStringList graphType = QStringList() << /* tr("Fitted") <<*/ tr("Sticks") + << tr("Lines") << tr("Steps") << tr("None"); controls->plotTypeCombo->addItems(graphType); - QStringList symbolType = QStringList() << "Ellipse" << "Rect" << "Diamond" << "Triangle" - << "DTrianle" << "UTriangle" << "LTriangle" << "RTriangle" << "Cross" << "XCross" - << "HLine" << "Vline" << "Star1" << "Star2" << "Hexagon" << "None"; - controls->fileSymbolTypeCombo->addItems(symbolType); - controls->byteSymbolTypeCombo->addItems(symbolType); + + fillSymbolCombo(controls->fileSymbolTypeCombo); + fillSymbolCombo(controls->byteSymbolTypeCombo); + readControlSettings(); controls->fileCheck->setCheckState(Qt::Checked); @@ -152,24 +153,25 @@ void JobPlot::setupControls() connect(controls->byteCheck, SIGNAL(stateChanged(int)), this, SLOT(byteCheckChanged(int))); connect(controls->refreshButton, SIGNAL(pressed()), this, SLOT(reGraph())); - controls->clientComboBox->addItem("Any"); + controls->clientComboBox->addItem(tr("Any")); controls->clientComboBox->addItems(m_console->client_list); QStringList volumeList; m_console->getVolumeList(volumeList); - controls->volumeComboBox->addItem("Any"); + controls->volumeComboBox->addItem(tr("Any")); controls->volumeComboBox->addItems(volumeList); - controls->jobComboBox->addItem("Any"); + controls->jobComboBox->addItem(tr("Any")); controls->jobComboBox->addItems(m_console->job_list); - controls->levelComboBox->addItem("Any"); - controls->levelComboBox->addItems( QStringList() << "F" << "D" << "I"); - controls->purgedComboBox->addItem("Any"); - controls->purgedComboBox->addItems( QStringList() << "0" << "1"); - controls->fileSetComboBox->addItem("Any"); + + levelComboFill(controls->levelComboBox); + + boolComboFill(controls->purgedComboBox); + + controls->fileSetComboBox->addItem(tr("Any")); controls->fileSetComboBox->addItems(m_console->fileset_list); QStringList statusLongList; m_console->getStatusList(statusLongList); - controls->statusComboBox->addItem("Any"); + controls->statusComboBox->addItem(tr("Any")); controls->statusComboBox->addItems(statusLongList); if (m_pass.use) { @@ -177,27 +179,15 @@ void JobPlot::setupControls() controls->limitSpinBox->setValue(m_pass.recordLimitSpin); controls->daysCheckBox->setCheckState(m_pass.daysLimitCheck); controls->daysSpinBox->setValue(m_pass.daysLimitSpin); - int jobIndex = controls->jobComboBox->findText(m_pass.jobCombo, Qt::MatchExactly); - if (jobIndex != -1) - controls->jobComboBox->setCurrentIndex(jobIndex); - int clientIndex = controls->clientComboBox->findText(m_pass.clientCombo, Qt::MatchExactly); - if (clientIndex != -1) - controls->clientComboBox->setCurrentIndex(clientIndex); - int volumeIndex = controls->volumeComboBox->findText(m_pass.volumeCombo, Qt::MatchExactly); - if (volumeIndex != -1) - controls->volumeComboBox->setCurrentIndex(volumeIndex); - int filesetIndex = controls->fileSetComboBox->findText(m_pass.fileSetCombo, Qt::MatchExactly); - if (filesetIndex != -1) - controls->fileSetComboBox->setCurrentIndex(filesetIndex); - int purgedIndex = controls->purgedComboBox->findText(m_pass.purgedCombo, Qt::MatchExactly); - if (purgedIndex != -1) - controls->purgedComboBox->setCurrentIndex(purgedIndex); - int levelIndex = controls->levelComboBox->findText(m_pass.levelCombo, Qt::MatchExactly); - if (levelIndex != -1) - controls->levelComboBox->setCurrentIndex(levelIndex); - int statusIndex = controls->statusComboBox->findText(m_pass.statusCombo, Qt::MatchExactly); - if (statusIndex != -1) - controls->statusComboBox->setCurrentIndex(statusIndex); + + comboSel(controls->jobComboBox, m_pass.jobCombo); + comboSel(controls->clientComboBox, m_pass.clientCombo); + comboSel(controls->volumeComboBox, m_pass.volumeCombo); + comboSel(controls->fileSetComboBox, m_pass.fileSetCombo); + comboSel(controls->purgedComboBox, m_pass.purgedCombo); + comboSel(controls->levelComboBox, m_pass.levelCombo); + comboSel(controls->statusComboBox, m_pass.statusCombo); + } else { /* Set Defaults for check and spin for limits */ controls->limitCheckBox->setCheckState(mainWin->m_recordLimitCheck ? Qt::Checked : Qt::Unchecked); @@ -225,30 +215,19 @@ void JobPlot::runQuery() " LEFT OUTER JOIN FileSet ON (FileSet.FileSetId=Job.FileSetId)"; QStringList conditions; - int jobIndex = controls->jobComboBox->currentIndex(); - if ((jobIndex != -1) && (controls->jobComboBox->itemText(jobIndex) != "Any")) - conditions.append("Job.Name='" + controls->jobComboBox->itemText(jobIndex) + "'"); - int clientIndex = controls->clientComboBox->currentIndex(); - if ((clientIndex != -1) && (controls->clientComboBox->itemText(clientIndex) != "Any")) - conditions.append("Client.Name='" + controls->clientComboBox->itemText(clientIndex) + "'"); + comboCond(conditions, controls->jobComboBox, "Job.Name"); + comboCond(conditions, controls->clientComboBox, "Client.Name"); int volumeIndex = controls->volumeComboBox->currentIndex(); - if ((volumeIndex != -1) && (controls->volumeComboBox->itemText(volumeIndex) != "Any")) { + if ((volumeIndex != -1) && (controls->volumeComboBox->itemText(volumeIndex) != tr("Any"))) { query += " LEFT OUTER JOIN JobMedia ON (JobMedia.JobId=Job.JobId)" " LEFT OUTER JOIN Media ON (JobMedia.MediaId=Media.MediaId)"; conditions.append("Media.VolumeName='" + controls->volumeComboBox->itemText(volumeIndex) + "'"); } - int fileSetIndex = controls->fileSetComboBox->currentIndex(); - if ((fileSetIndex != -1) && (controls->fileSetComboBox->itemText(fileSetIndex) != "Any")) - conditions.append("FileSet.FileSet='" + controls->fileSetComboBox->itemText(fileSetIndex) + "'"); - int purgedIndex = controls->purgedComboBox->currentIndex(); - if ((purgedIndex != -1) && (controls->purgedComboBox->itemText(purgedIndex) != "Any")) - conditions.append("Job.PurgedFiles='" + controls->purgedComboBox->itemText(purgedIndex) + "'"); - int levelIndex = controls->levelComboBox->currentIndex(); - if ((levelIndex != -1) && (controls->levelComboBox->itemText(levelIndex) != "Any")) - conditions.append("Job.Level='" + controls->levelComboBox->itemText(levelIndex) + "'"); - int statusIndex = controls->statusComboBox->currentIndex(); - if ((statusIndex != -1) && (controls->statusComboBox->itemText(statusIndex) != "Any")) - conditions.append("Status.JobStatusLong='" + controls->statusComboBox->itemText(statusIndex) + "'"); + comboCond(conditions, controls->fileSetComboBox, "FileSet.FileSet"); + boolComboCond(conditions, controls->purgedComboBox, "Job.PurgedFiles"); + levelComboCond(conditions, controls->levelComboBox, "Job.Level"); + comboCond(conditions, controls->statusComboBox, "Status.JobStatusLong"); + /* If Limit check box For limit by days is checked */ if (controls->daysCheckBox->checkState() == Qt::Checked) { QDateTime stamp = QDateTime::currentDateTime().addDays(-controls->daysSpinBox->value()); @@ -306,10 +285,10 @@ void JobPlot::runQuery() row++; } } - if ((controls->volumeComboBox->itemText(volumeIndex) != "Any") && (results.count() == 0)){ + if ((controls->volumeComboBox->itemText(volumeIndex) != tr("Any")) && (results.count() == 0)){ /* for context sensitive searches, let the user know if there were no * * results */ - QMessageBox::warning(this, tr("Bat"), + QMessageBox::warning(this, "Bat", tr("The Jobs query returned no results.\n" "Press OK to continue?"), QMessageBox::Ok ); } @@ -354,23 +333,23 @@ void JobPlot::setupUserInterface() */ void JobPlot::addCurve() { - m_jobPlot->setTitle("Files and Bytes backed up"); + m_jobPlot->setTitle(tr("Files and Bytes backed up")); m_jobPlot->insertLegend(new QwtLegend(), QwtPlot::RightLegend); // Set axis titles m_jobPlot->enableAxis(QwtPlot::yRight); - m_jobPlot->setAxisTitle(QwtPlot::yRight, "<-- Bytes Kb"); - m_jobPlot->setAxisTitle(m_jobPlot->xBottom, "date of backup -->"); - m_jobPlot->setAxisTitle(m_jobPlot->yLeft, "Number of Files -->"); + m_jobPlot->setAxisTitle(QwtPlot::yRight, tr("<-- Bytes Kb")); + m_jobPlot->setAxisTitle(m_jobPlot->xBottom, tr("date of backup -->")); + m_jobPlot->setAxisTitle(m_jobPlot->yLeft, tr("Number of Files -->")); m_jobPlot->setAxisScaleDraw(QwtPlot::xBottom, new DateTimeScaleDraw()); // Insert new curves - m_fileCurve = new QwtPlotCurve("Files"); + m_fileCurve = new QwtPlotCurve( tr("Files") ); m_fileCurve->setPen(QPen(Qt::red)); m_fileCurve->setCurveType(m_fileCurve->Yfx); m_fileCurve->setYAxis(QwtPlot::yLeft); - m_byteCurve = new QwtPlotCurve("Bytes"); + m_byteCurve = new QwtPlotCurve(tr("Bytes")); m_byteCurve->setPen(QPen(Qt::blue)); m_byteCurve->setCurveType(m_byteCurve->Yfx); m_byteCurve->setYAxis(QwtPlot::yRight); @@ -430,19 +409,19 @@ void JobPlot::addCurve() void JobPlot::setPlotType(QString currentText) { QwtPlotCurve::CurveStyle style = QwtPlotCurve::NoCurve; - if (currentText == "Fitted") { + if (currentText == tr("Fitted")) { style = QwtPlotCurve::Lines; m_fileCurve->setCurveAttribute(QwtPlotCurve::Fitted); m_byteCurve->setCurveAttribute(QwtPlotCurve::Fitted); - } else if (currentText == "Sticks") { + } else if (currentText == tr("Sticks")) { style = QwtPlotCurve::Sticks; - } else if (currentText == "Lines") { + } else if (currentText == tr("Lines")) { style = QwtPlotCurve::Lines; m_fileCurve->setCurveAttribute(QwtPlotCurve::Fitted); m_byteCurve->setCurveAttribute(QwtPlotCurve::Fitted); - } else if (currentText == "Steps") { + } else if (currentText == tr("Steps")) { style = QwtPlotCurve::Steps; - } else if (currentText == "None") { + } else if (currentText == tr("None")) { style = QwtPlotCurve::NoCurve; } m_fileCurve->setStyle(style); @@ -450,6 +429,27 @@ void JobPlot::setPlotType(QString currentText) m_jobPlot->replot(); } +void JobPlot::fillSymbolCombo(QComboBox *q) +{ + q->addItem( tr("Ellipse"), (int)QwtSymbol::Ellipse); + q->addItem( tr("Rect"), (int)QwtSymbol::Rect); + q->addItem( tr("Diamond"), (int)QwtSymbol::Diamond); + q->addItem( tr("Triangle"), (int)QwtSymbol::Triangle); + q->addItem( tr("DTrianle"), (int)QwtSymbol::DTriangle); + q->addItem( tr("UTriangle"), (int)QwtSymbol::UTriangle); + q->addItem( tr("LTriangle"), (int)QwtSymbol::LTriangle); + q->addItem( tr("RTriangle"), (int)QwtSymbol::RTriangle); + q->addItem( tr("Cross"), (int)QwtSymbol::Cross); + q->addItem( tr("XCross"), (int)QwtSymbol::XCross); + q->addItem( tr("HLine"), (int)QwtSymbol::HLine); + q->addItem( tr("Vline"), (int)QwtSymbol::VLine); + q->addItem( tr("Star1"), (int)QwtSymbol::Star1); + q->addItem( tr("Star2"), (int)QwtSymbol::Star2); + q->addItem( tr("Hexagon"), (int)QwtSymbol::Hexagon); + q->addItem( tr("None"), (int)QwtSymbol::NoSymbol); +} + + /* * slot to respond to the symbol type combo changing */ @@ -467,44 +467,20 @@ void JobPlot::setSymbolType(int index, int type) QwtSymbol sym; sym.setPen(QColor(Qt::black)); sym.setSize(7); - if (index == 0) { - sym.setStyle(QwtSymbol::Ellipse); - } else if (index == 1) { - sym.setStyle(QwtSymbol::Rect); - } else if (index == 2) { - sym.setStyle(QwtSymbol::Diamond); - } else if (index == 3) { - sym.setStyle(QwtSymbol::Triangle); - } else if (index == 4) { - sym.setStyle(QwtSymbol::DTriangle); - } else if (index == 5) { - sym.setStyle(QwtSymbol::UTriangle); - } else if (index == 6) { - sym.setStyle(QwtSymbol::LTriangle); - } else if (index == 7) { - sym.setStyle(QwtSymbol::RTriangle); - } else if (index == 8) { - sym.setStyle(QwtSymbol::Cross); - } else if (index == 9) { - sym.setStyle(QwtSymbol::XCross); - } else if (index == 10) { - sym.setStyle(QwtSymbol::HLine); - } else if (index == 11) { - sym.setStyle(QwtSymbol::VLine); - } else if (index == 12) { - sym.setStyle(QwtSymbol::Star1); - } else if (index == 13) { - sym.setStyle(QwtSymbol::Star2); - } else if (index == 14) { - sym.setStyle(QwtSymbol::Hexagon); - } - if (type == 0) { + + QVariant style; + if (0 == type) { + style = controls->fileSymbolTypeCombo->itemData(index); + sym.setStyle( (QwtSymbol::Style)style.toInt() ); sym.setBrush(QColor(Qt::yellow)); m_fileCurve->setSymbol(sym); - } - if (type == 1) { + + } else { + style = controls->byteSymbolTypeCombo->itemData(index); + sym.setStyle( (QwtSymbol::Style)style.toInt() ); sym.setBrush(QColor(Qt::blue)); m_byteCurve->setSymbol(sym); + } m_jobPlot->replot(); } diff --git a/bacula/src/qt-console/jobgraphs/jobplot.h b/bacula/src/qt-console/jobgraphs/jobplot.h index 423bf57acd..3fc06e43a7 100644 --- a/bacula/src/qt-console/jobgraphs/jobplot.h +++ b/bacula/src/qt-console/jobgraphs/jobplot.h @@ -128,6 +128,7 @@ private slots: void reGraph(); private: + void fillSymbolCombo(QComboBox *q); void setSymbolType(int, int type); void addCurve(); void writeSettings(); diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index c410600213..5e5712d07d 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -41,6 +41,7 @@ #include "jobgraphs/jobplot.h" #endif #include "util/fmtwidgetitem.h" +#include "util/comboutil.h" /* * Constructor for the class @@ -226,47 +227,26 @@ void JobList::prepareFilterWidgets() if (!m_populated) { clientComboBox->addItem(tr("Any")); clientComboBox->addItems(m_console->client_list); - int clientIndex = clientComboBox->findText(m_clientName, Qt::MatchExactly); - if (clientIndex != -1) - clientComboBox->setCurrentIndex(clientIndex); + comboSel(clientComboBox, m_clientName); QStringList volumeList; m_console->getVolumeList(volumeList); volumeComboBox->addItem(tr("Any")); volumeComboBox->addItems(volumeList); - int volumeIndex = volumeComboBox->findText(m_mediaName, Qt::MatchExactly); - if (volumeIndex != -1) { - volumeComboBox->setCurrentIndex(volumeIndex); - } + comboSel(volumeComboBox, m_mediaName); + jobComboBox->addItem(tr("Any")); jobComboBox->addItems(m_console->job_list); - int jobIndex = jobComboBox->findText(m_jobName, Qt::MatchExactly); - if (jobIndex != -1) { - jobComboBox->setCurrentIndex(jobIndex); - } + comboSel(jobComboBox, m_jobName); - levelComboBox->addItem(tr("Any")); - levelComboBox->addItem(job_level_to_str(L_FULL), L_FULL); - levelComboBox->addItem(job_level_to_str(L_INCREMENTAL), L_INCREMENTAL); - levelComboBox->addItem(job_level_to_str(L_DIFFERENTIAL), L_DIFFERENTIAL); - levelComboBox->addItem(job_level_to_str(L_SINCE), L_SINCE); - levelComboBox->addItem(job_level_to_str(L_VERIFY_CATALOG), L_VERIFY_CATALOG); - levelComboBox->addItem(job_level_to_str(L_VERIFY_INIT), L_VERIFY_INIT); - levelComboBox->addItem(job_level_to_str(L_VERIFY_VOLUME_TO_CATALOG), L_VERIFY_VOLUME_TO_CATALOG); - levelComboBox->addItem(job_level_to_str(L_VERIFY_DISK_TO_CATALOG), L_VERIFY_DISK_TO_CATALOG); - levelComboBox->addItem(job_level_to_str(L_VERIFY_DATA), L_VERIFY_DATA); - /* levelComboBox->addItem(job_level_to_str(L_BASE), L_BASE); base jobs ignored */ - - purgedComboBox->addItem(tr("Any"), -1); - purgedComboBox->addItem(tr("No"), 0); - purgedComboBox->addItem(tr("Yes"), 1); + levelComboFill(levelComboBox); + + boolComboFill(purgedComboBox); fileSetComboBox->addItem(tr("Any")); fileSetComboBox->addItems(m_console->fileset_list); - int filesetIndex = fileSetComboBox->findText(m_filesetName, Qt::MatchExactly); - if (filesetIndex != -1) { - fileSetComboBox->setCurrentIndex(filesetIndex); - } + comboSel(fileSetComboBox, m_filesetName); + QStringList statusLongList; m_console->getStatusList(statusLongList); statusComboBox->addItem(tr("Any")); @@ -299,36 +279,14 @@ void JobList::fillQueryString(QString &query) " LEFT OUTER JOIN Media ON (JobMedia.MediaId=Media.MediaId) "; conditions.append("Media.VolumeName='" + m_mediaName + "'"); } - int clientIndex = clientComboBox->currentIndex(); - if (clientIndex != -1) - m_clientName = clientComboBox->itemText(clientIndex); - if (m_clientName != tr("Any")) { - conditions.append("Client.Name='" + m_clientName + "'"); - } - int jobIndex = jobComboBox->currentIndex(); - if (jobIndex != -1) - m_jobName = jobComboBox->itemText(jobIndex); - if ((jobIndex != -1) && (jobComboBox->itemText(jobIndex) != tr("Any"))) { - conditions.append("Job.Name='" + jobComboBox->itemText(jobIndex) + "'"); - } - int levelIndex = levelComboBox->currentIndex(); - if ((levelIndex != -1) && (levelComboBox->itemText(levelIndex) != tr("Any"))) { - conditions.append( QString("Job.Level='%1'").arg(levelComboBox->itemData(levelIndex).toChar()) ); - } - int statusIndex = statusComboBox->currentIndex(); - if ((statusIndex != -1) && (statusComboBox->itemText(statusIndex) != tr("Any"))) { - conditions.append("Status.JobStatusLong='" + statusComboBox->itemText(statusIndex) + "'"); - } - int purgedIndex = purgedComboBox->currentIndex(); - if (purgedIndex != -1 && purgedComboBox->itemData(purgedIndex).toInt() >= 0 ) { - conditions.append("Job.PurgedFiles='" + purgedComboBox->itemData(purgedIndex).toString() + "'"); - } - int fileSetIndex = fileSetComboBox->currentIndex(); - if (fileSetIndex != -1) - m_filesetName = fileSetComboBox->itemText(fileSetIndex); - if ((fileSetIndex != -1) && (fileSetComboBox->itemText(fileSetIndex) != tr("Any"))) { - conditions.append("FileSet.FileSet='" + fileSetComboBox->itemText(fileSetIndex) + "'"); - } + + comboCond(conditions, clientComboBox, "Client.Name"); + comboCond(conditions, jobComboBox, "Job.Name"); + levelComboCond(conditions, levelComboBox, "Job.Level"); + comboCond(conditions, statusComboBox, "Status.JobStatusLong"); + boolComboCond(conditions, purgedComboBox, "Job.PurgedFiles"); + comboCond(conditions, fileSetComboBox, "FileSet.FileSet"); + /* If Limit check box For limit by days is checked */ if (daysCheckBox->checkState() == Qt::Checked) { QDateTime stamp = QDateTime::currentDateTime().addDays(-daysSpinBox->value()); @@ -448,6 +406,7 @@ void JobList::createConnections() connect(graphButton, SIGNAL(pressed()), this, SLOT(graphTable())); #else graphButton->setEnabled(false); + graphButton->setVisible(false); #endif /* for the tableItemChanged to maintain m_currentJob */ connect(mp_tableWidget, SIGNAL( @@ -617,9 +576,9 @@ void JobList::consoleCancelJob() /* * Graph this table */ -#ifdef HAVE_QWT void JobList::graphTable() { +#ifdef HAVE_QWT JobPlotPass pass; pass.recordLimitCheck = limitCheckBox->checkState(); pass.daysLimitCheck = daysCheckBox->checkState(); @@ -635,8 +594,8 @@ void JobList::graphTable() pass.use = true; QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(this); new JobPlot(pageSelectorTreeWidgetItem, pass); -} #endif +} /* * Save user settings associated with this page diff --git a/bacula/src/qt-console/joblist/joblist.h b/bacula/src/qt-console/joblist/joblist.h index ca73b88c11..0bdebdef87 100644 --- a/bacula/src/qt-console/joblist/joblist.h +++ b/bacula/src/qt-console/joblist/joblist.h @@ -68,9 +68,7 @@ private slots: void preRestoreFromTime(); void showLogForJob(); void consoleCancelJob(); -#ifdef HAVE_QWT void graphTable(); -#endif private: void createConnections(); diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index b01a62c595..c8ddf00dab 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -83,6 +83,11 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) createConnections(); +#ifndef HAVE_QWT + actionJobPlot->setEnabled(false); + actionJobPlot->setVisible(false); +#endif + this->show(); readSettings(); @@ -468,14 +473,14 @@ void MainWin::restoreButtonClicked() new prerestorePage(); } -#ifdef HAVE_QWT void MainWin::jobPlotButtonClicked() { +#ifdef HAVE_QWT JobPlotPass pass; pass.use = false; new JobPlot(NULL, pass); -} #endif +} /* * The user just finished typing a line in the command line edit box @@ -687,6 +692,9 @@ void MainWin::setPreferences() break; } prefs.openPlotCheckBox->setCheckState(m_openPlot ? Qt::Checked : Qt::Unchecked); +#ifndef HAVE_QWT + prefs.openPlotCheckBox->setVisible(false); +#endif prefs.openBrowserCheckBox->setCheckState(m_openBrowser ? Qt::Checked : Qt::Unchecked); prefs.openDirStatCheckBox->setCheckState(m_openDirStat ? Qt::Checked : Qt::Unchecked); prefs.exec(); diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 81ae9758fe..d3b6b29dd3 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -113,9 +113,7 @@ public slots: void estimateButtonClicked(); void browseButtonClicked(); void statusPageButtonClicked(); -#ifdef HAVE_QWT void jobPlotButtonClicked(); -#endif void restoreButtonClicked(); void undockWindowButton(); void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); diff --git a/bacula/src/qt-console/mount/mount.cpp b/bacula/src/qt-console/mount/mount.cpp index 70073c141c..6832605639 100644 --- a/bacula/src/qt-console/mount/mount.cpp +++ b/bacula/src/qt-console/mount/mount.cpp @@ -48,8 +48,7 @@ mountDialog::mountDialog(Console *console, QString &storageName) setupUi(this); this->show(); - QString labelText("Storage : "); - labelText += storageName; + QString labelText( tr("Storage : %1").arg(storageName) ); storageLabel->setText(labelText); } @@ -57,7 +56,7 @@ void mountDialog::accept() { QString scmd; if (m_storageName == "") { - QMessageBox::warning(this, "No Storage name", "No Storage name given", + QMessageBox::warning(this, tr("No Storage name"), tr("No Storage name given"), QMessageBox::Ok, QMessageBox::Ok); return; } @@ -69,10 +68,10 @@ void mountDialog::accept() Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data()); } - m_console->display_text("Context sensitive command :\n\n"); + m_console->display_text( tr("Context sensitive command :\n\n")); m_console->display_text("**** "); m_console->display_text(scmd + " ****\n"); - m_console->display_text("Director Response :\n\n"); + m_console->display_text(tr("Director Response :\n\n")); m_console->write_dir(scmd.toUtf8().data()); m_console->displayToPrompt(); diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index a01422c04d..25187d9193 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -395,8 +395,8 @@ void restorePage::unmarkButtonPushed() m_console->discardToPrompt(); } if (count == 0) { - mainWin->set_status("Nothing selected, nothing done"); - statusLine->setText("Nothing selected, nothing done"); + mainWin->set_status(tr("Nothing selected, nothing done")); + statusLine->setText(tr("Nothing selected, nothing done")); } } @@ -420,7 +420,7 @@ bool restorePage::cwd(const char *dir) Dmsg2(100, "cwd=%s msg=%s\n", m_cwd.toUtf8().data(), m_console->msg()); } else { Dmsg1(000, "stat=%d\n", stat); - QMessageBox::critical(this, "Error", "cd command failed", QMessageBox::Ok); + QMessageBox::critical(this, "Error", tr("cd command failed"), QMessageBox::Ok); } m_console->discardToPrompt(); return true; /* ***FIXME*** return real status */ @@ -439,7 +439,7 @@ char *restorePage::get_cwd() Dmsg2(100, "cwd=%s msg=%s\n", m_cwd.toUtf8().data(), m_console->msg()); } else { Dmsg1(000, "Something went wrong read stat=%d\n", stat); - QMessageBox::critical(this, "Error", ".pwd command failed", QMessageBox::Ok); + QMessageBox::critical(this, "Error", tr(".pwd command failed"), QMessageBox::Ok); } m_console->discardToPrompt(); return m_cwd.toUtf8().data(); diff --git a/bacula/src/qt-console/restore/restoretree.cpp b/bacula/src/qt-console/restore/restoretree.cpp index ee9055109a..8c37d650b5 100644 --- a/bacula/src/qt-console/restore/restoretree.cpp +++ b/bacula/src/qt-console/restore/restoretree.cpp @@ -174,7 +174,7 @@ void restoreTree::populateDirectoryTree() prBar1->setVisible(true); prBar1->setRange(0,taskcount); prBar1->setValue(0); - prLabel1->setText(tr("Task ") + QString("%1").arg(ontask)+ " of " + QString("%1").arg(taskcount)); + prLabel1->setText(tr("Task %1 of %2").arg(ontask).arg(taskcount)); prLabel1->setVisible(true); prBar2->setVisible(true); prBar2->setRange(0,0); @@ -192,7 +192,7 @@ void restoreTree::populateDirectoryTree() m_prevDaysCheckState = daysCheckBox->checkState(); updateRefresh(); prBar1->setValue(ontask++); - prLabel1->setText(tr("Task ") + QString("%1").arg(ontask)+ " of " + QString("%1").arg(taskcount)); + prLabel1->setText(tr("Task %1 of %2").arg(ontask).arg(taskcount)); prBar2->setValue(0); prBar2->setRange(0,0); prLabel2->setText(tr("Querying Jobs")); @@ -235,7 +235,7 @@ void restoreTree::populateDirectoryTree() if (mainWin->m_sqlDebug) Pmsg1(000, "Query cmd : %s\n", cmd.toUtf8().data()); prBar1->setValue(ontask++); - prLabel1->setText(tr("Task ") + QString("%1").arg(ontask) + " of " + QString("%1").arg(taskcount)); + prLabel1->setText(tr("Task %1 of %2").arg(ontask).arg(taskcount)); prBar2->setValue(0); prBar2->setRange(0,0); prLabel2->setText(tr("Querying for Directories")); @@ -278,7 +278,7 @@ void restoreTree::populateDirectoryTree() } else { QMessageBox::warning(this, "Bat", tr("No jobs were selected in the job query !!!.\n" - "Press OK to continue?"), + "Press OK to continue"), QMessageBox::Ok ); } prBar1->setVisible(false); @@ -381,7 +381,7 @@ bool restoreTree::addDirectory(QString &m_cwd, QString &newdirr) bool ok = true, added = false; if ((mainWin->m_miscDebug) && (m_debugTrap)) { - QString msg = QString(tr("In addDirectory cwd \"%1\" newdir \"%2\"\n")) + QString msg = QString("In addDirectory cwd \"%1\" newdir \"%2\"\n") .arg(m_cwd) .arg(newdir); Pmsg0(000, msg.toUtf8().data()); @@ -435,7 +435,7 @@ bool restoreTree::addDirectory(QString &m_cwd, QString &newdirr) } else { ok = false; if ((mainWin->m_miscDebug) && (m_debugTrap)) { - QString msg = QString(tr("In else of if parent cwd \"%1\" newdir \"%2\"\n")) + QString msg = QString("In else of if parent cwd \"%1\" newdir \"%2\"\n") .arg(m_cwd) .arg(newdir); Pmsg0(000, msg.toUtf8().data()); @@ -518,7 +518,7 @@ void restoreTree::directoryCurrentItemChanged(QTreeWidgetItem *item, QTreeWidget this, SLOT(fileTableItemChanged(QTableWidgetItem *))); QBrush blackBrush(Qt::black); QString directory = item->data(0, Qt::UserRole).toString(); - directoryLabel->setText(tr("Present Working Directory : ") + directory); + directoryLabel->setText(tr("Present Working Directory: %1").arg(directory)); int pathid = m_directoryPathIdHash.value(directory, -1); if (pathid != -1) { QString cmd = @@ -1506,9 +1506,9 @@ void restoreTree::restoreButtonPushed() { /* Set progress bars and repaint */ prLabel1->setVisible(true); - prLabel1->setText("Task 1 of 3"); + prLabel1->setText(tr("Task 1 of 3")); prLabel2->setVisible(true); - prLabel2->setText("Processing Checked directories"); + prLabel2->setText(tr("Processing Checked directories")); prBar1->setVisible(true); prBar1->setRange(0, 3); prBar1->setValue(0); @@ -1613,8 +1613,8 @@ void restoreTree::restoreButtonPushed() ++diter; } /* while (*diter) */ prBar1->setValue(1); - prLabel1->setText("Task 2 of 3"); - prLabel2->setText("Processing Exceptions"); + prLabel1->setText( tr("Task 2 of 3")); + prLabel2->setText(tr("Processing Exceptions")); prBar2->setRange(0, 0); repaint(); @@ -1651,8 +1651,8 @@ void restoreTree::restoreButtonPushed() } /* while ftera.hasNext */ /* The progress bars for the next step */ prBar1->setValue(2); - prLabel1->setText("Task 3 of 3"); - prLabel2->setText("Filling Database Table"); + prLabel1->setText(tr("Task 3 of 3")); + prLabel2->setText(tr("Filling Database Table")); prBar2->setRange(0, vFMCounter); vFMCounter = 0; prBar2->setValue(vFMCounter); diff --git a/bacula/src/qt-console/status/clientstat.cpp b/bacula/src/qt-console/status/clientstat.cpp index e7f18e35b8..28b7caeb43 100644 --- a/bacula/src/qt-console/status/clientstat.cpp +++ b/bacula/src/qt-console/status/clientstat.cpp @@ -43,7 +43,7 @@ ClientStat::ClientStat(QString &client, QTreeWidgetItem *parentTreeWidgetItem) { m_client = client; setupUi(this); - m_name = tr("Client Status") + " " + m_client; + m_name = tr("Client Status %1").arg(m_client); m_closeable = true; pgInitialize(parentTreeWidgetItem); QTreeWidgetItem* thisitem = mainWin->getFromHash(this); diff --git a/bacula/src/qt-console/status/dirstat.cpp b/bacula/src/qt-console/status/dirstat.cpp index fce1a794c6..a0becc182a 100644 --- a/bacula/src/qt-console/status/dirstat.cpp +++ b/bacula/src/qt-console/status/dirstat.cpp @@ -394,8 +394,8 @@ void DirStat::runningTableItemChanged(QTableWidgetItem * /*currentItem*/, QTable m_selectedJobsList.append(sitem->text()); } if (m_selectedJobsList.count() > 1) { - actionCancelRunning->setText(QString("Cancel list of %1 Jobs").arg(m_selectedJobsList.count())); + actionCancelRunning->setText(tr("Cancel list of %1 Jobs").arg(m_selectedJobsList.count())); } else { - actionCancelRunning->setText("Cancel Single Job"); + actionCancelRunning->setText(tr("Cancel Single Job")); } } diff --git a/bacula/src/qt-console/status/storstat.cpp b/bacula/src/qt-console/status/storstat.cpp index bad5b47f2c..d624763359 100644 --- a/bacula/src/qt-console/status/storstat.cpp +++ b/bacula/src/qt-console/status/storstat.cpp @@ -58,7 +58,7 @@ StorStat::StorStat(QString &storage, QTreeWidgetItem *parentTreeWidgetItem) { m_storage = storage; setupUi(this); - m_name = tr("Storage Status") + " " + m_storage; + m_name = tr("Storage Status %1").arg(m_storage); m_closeable = true; pgInitialize(parentTreeWidgetItem); QTreeWidgetItem* thisitem = mainWin->getFromHash(this); diff --git a/bacula/src/qt-console/util/comboutil.cpp b/bacula/src/qt-console/util/comboutil.cpp new file mode 100644 index 0000000000..8d893fd503 --- /dev/null +++ b/bacula/src/qt-console/util/comboutil.cpp @@ -0,0 +1,108 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2007-2008 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. + + Bacula® is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ + +/* + * Version $Id$ + * + * ComboBox helper functions + * + * Riccardo Ghetta, May 2008 + * + */ + +#include +#include +#include +#include "bat.h" +#include "comboutil.h" + +static const QString QS_ANY(QObject::tr("Any")); + + +/* selects value val on combo, if exists */ +void comboSel(QComboBox *combo, const QString &val) +{ + int index = combo->findText(val, Qt::MatchExactly); + if (index != -1) { + combo->setCurrentIndex(index); + } +} + +/* if the combo has selected something different from "Any" uses the selection + * to build a condition on field fldname and adds it to the condition list */ +void comboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname) +{ + int index = combo->currentIndex(); + if (index != -1 && combo->itemText(index) != QS_ANY) { + cndlist.append( QString("%1='%2'").arg(fldname).arg(combo->itemText(index)) ); + } +} + + +/* boolean combo (yes/no) */ +void boolComboFill(QComboBox *combo) +{ + combo->addItem(QS_ANY, -1); + combo->addItem(QObject::tr("No"), 0); + combo->addItem(QObject::tr("Yes"), 1); +} + +void boolComboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname) +{ + int index = combo->currentIndex(); + if (index != -1 && combo->itemData(index).toInt() >= 0 ) { + QString cnd = combo->itemData(index).toString(); + cndlist.append( QString("%1='%2'").arg(fldname).arg(cnd) ); + } +} + +/* backup level combo */ +void levelComboFill(QComboBox *combo) +{ + combo->addItem(QS_ANY); + combo->addItem(job_level_to_str(L_FULL), L_FULL); + combo->addItem(job_level_to_str(L_INCREMENTAL), L_INCREMENTAL); + combo->addItem(job_level_to_str(L_DIFFERENTIAL), L_DIFFERENTIAL); + combo->addItem(job_level_to_str(L_SINCE), L_SINCE); + combo->addItem(job_level_to_str(L_VERIFY_CATALOG), L_VERIFY_CATALOG); + combo->addItem(job_level_to_str(L_VERIFY_INIT), L_VERIFY_INIT); + combo->addItem(job_level_to_str(L_VERIFY_VOLUME_TO_CATALOG), L_VERIFY_VOLUME_TO_CATALOG); + combo->addItem(job_level_to_str(L_VERIFY_DISK_TO_CATALOG), L_VERIFY_DISK_TO_CATALOG); + combo->addItem(job_level_to_str(L_VERIFY_DATA), L_VERIFY_DATA); + /* combo->addItem(job_level_to_str(L_BASE), L_BASE); base jobs ignored */ +} + +void levelComboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname) +{ + int index = combo->currentIndex(); + if (index != -1 && combo->itemText(index) != QS_ANY ) { + QString cnd = combo->itemData(index).toChar(); + cndlist.append( QString("%1='%2'").arg(fldname).arg(cnd) ); + } +} + diff --git a/bacula/src/qt-console/util/comboutil.h b/bacula/src/qt-console/util/comboutil.h new file mode 100644 index 0000000000..c9e9d86b4c --- /dev/null +++ b/bacula/src/qt-console/util/comboutil.h @@ -0,0 +1,62 @@ +#ifndef _COMBOUTIL_H_ +#define _COMBOUTIL_H_ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2007-2008 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. + + Bacula® is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Version $Id$ + * + * Combobox helpers - Riccardo Ghetta, May 2008 + */ + +class QComboBox; +class QString; +class QStringList; + +/* selects value val on combo, if exists */ +void comboSel(QComboBox *combo, const QString &val); + +/* if the combo has selected something different from "Any" uses the selection + * to build a condition on field fldname and adds it to the condition list */ +void comboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname); + +/* these helpers are used to give an uniform content to common combos. + * There are two routines per combo type: + * - XXXXComboFill fills the combo with values. + * - XXXXComboCond checks the combo and, if selected adds a condition + * on the field fldName to the list of conditions cndList + */ + +/* boolean combo (yes/no) */ +void boolComboFill(QComboBox *combo); +void boolComboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname); + +/* backup level combo */ +void levelComboFill(QComboBox *combo); +void levelComboCond(QStringList &cndlist, const QComboBox *combo, const char *fldname); + +#endif /* _COMBOUTIL_H_ */ -- 2.39.5