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
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;
}
_("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 */
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);
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;
}
}
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;
}
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;
}
}
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);
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;
}
}
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;
#include <QtGui>
#include "bat.h"
+#include "util/comboutil.h"
#include "jobgraphs/jobplot.h"
JobPlot::JobPlot(QTreeWidgetItem *parentTreeWidgetItem, JobPlotPass &passVals)
{
setupUserInterface();
- m_name = "JobPlot";
+ m_name = tr("JobPlot");
pgInitialize(parentTreeWidgetItem);
readSplitterSettings();
QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
*/
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);
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) {
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);
" 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());
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 );
}
*/
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);
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);
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
*/
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();
}
void reGraph();
private:
+ void fillSymbolCombo(QComboBox *q);
void setSymbolType(int, int type);
void addCurve();
void writeSettings();
#include "jobgraphs/jobplot.h"
#endif
#include "util/fmtwidgetitem.h"
+#include "util/comboutil.h"
/*
* Constructor for the class
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"));
" 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());
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(
/*
* Graph this table
*/
-#ifdef HAVE_QWT
void JobList::graphTable()
{
+#ifdef HAVE_QWT
JobPlotPass pass;
pass.recordLimitCheck = limitCheckBox->checkState();
pass.daysLimitCheck = daysCheckBox->checkState();
pass.use = true;
QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(this);
new JobPlot(pageSelectorTreeWidgetItem, pass);
-}
#endif
+}
/*
* Save user settings associated with this page
void preRestoreFromTime();
void showLogForJob();
void consoleCancelJob();
-#ifdef HAVE_QWT
void graphTable();
-#endif
private:
void createConnections();
createConnections();
+#ifndef HAVE_QWT
+ actionJobPlot->setEnabled(false);
+ actionJobPlot->setVisible(false);
+#endif
+
this->show();
readSettings();
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
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();
void estimateButtonClicked();
void browseButtonClicked();
void statusPageButtonClicked();
-#ifdef HAVE_QWT
void jobPlotButtonClicked();
-#endif
void restoreButtonClicked();
void undockWindowButton();
void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *);
setupUi(this);
this->show();
- QString labelText("Storage : ");
- labelText += storageName;
+ QString labelText( tr("Storage : %1").arg(storageName) );
storageLabel->setText(labelText);
}
{
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;
}
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();
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"));
}
}
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 */
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();
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);
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"));
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"));
} 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);
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());
} 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());
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 =
{
/* 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);
++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();
} /* 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);
{
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);
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"));
}
}
{
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);
--- /dev/null
+/*
+ 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 <QComboBox>
+#include <QString>
+#include <QStringList>
+#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) );
+ }
+}
+
--- /dev/null
+#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_ */