Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Bacula® is a registered trademark of John Walker.
+ 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 "version.h"
#include "joblist/joblist.h"
#include "storage/storage.h"
#include "fileset/fileset.h"
#include "restore/restoretree.h"
#include "help/help.h"
#include "jobs/jobs.h"
+#ifdef HAVE_QWT
#include "jobgraphs/jobplot.h"
+#endif
#include "status/dirstat.h"
+#include "util/fmtwidgetitem.h"
/*
* Daemon message callback
readPreferences();
treeWidget->clear();
treeWidget->setColumnCount(1);
- treeWidget->setHeaderLabel("Select Page");
+ treeWidget->setHeaderLabel( tr("Select Page") );
treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
createPages();
createConnections();
+#ifndef HAVE_QWT
+ actionJobPlot->setEnabled(false);
+ actionJobPlot->setVisible(false);
+#endif
+
this->show();
readSettings();
if (m_miscDebug) {
QString directoryResourceName;
m_currentConsole->getDirResName(directoryResourceName);
- Pmsg1(000, "Setting initial window to %s\n", directoryResourceName.toUtf8().data());
+ Pmsg1(100, "Setting initial window to %s\n", directoryResourceName.toUtf8().data());
}
}
/* Create Tree Widget Item */
item = new QTreeWidgetItem(topItem);
- item->setText(0, "Console");
+ item->setText(0, tr("Console"));
if (!m_firstItem){ m_firstItem = item; }
item->setIcon(0,QIcon(QString::fromUtf8(":images/utilities-terminal.png")));
new FileSet();
new Jobs();
createPageJobList("", "", "", "", NULL);
+#ifdef HAVE_QWT
JobPlotPass pass;
pass.use = false;
if (m_openPlot)
new JobPlot(NULL, pass);
+#endif
new MediaList();
new Storage();
if (m_openBrowser)
connect(actionEstimate, SIGNAL(triggered()), this, SLOT(estimateButtonClicked()));
connect(actionBrowse, SIGNAL(triggered()), this, SLOT(browseButtonClicked()));
connect(actionStatusDirPage, SIGNAL(triggered()), this, SLOT(statusPageButtonClicked()));
+#ifdef HAVE_QWT
connect(actionJobPlot, SIGNAL(triggered()), this, SLOT(jobPlotButtonClicked()));
+#endif
connect(actionRestore, SIGNAL(triggered()), this, SLOT(restoreButtonClicked()));
connect(actionUndock, SIGNAL(triggered()), this, SLOT(undockWindowButton()));
connect(actionToggleDock, SIGNAL(triggered()), this, SLOT(toggleDockContextWindow()));
}
}
}
- /* close the console pages and terminate connection */
foreach(Console *console, m_consoleHash){
console->writeSettings();
console->terminate();
bool found = false;
foreach(Pages *page, m_pagehash) {
if (m_currentConsole == page->console()) {
- if (page->name() == "Director Status") {
+ if (page->name() == tr("Director Status")) {
found = true;
page->setCurrent();
}
void MainWin::jobPlotButtonClicked()
{
+#ifdef HAVE_QWT
JobPlotPass pass;
pass.use = false;
new JobPlot(NULL, pass);
+#endif
}
/*
void MainWin::about()
{
QMessageBox::about(this, tr("About bat"),
- tr("<br><h2>bat 1.0, by Dirk H Bartley and Kern Sibbald</h2>"
- "<p>Copyright © 2007-" BYEAR " Free Software Foundation Europe e.V."
+ tr("<br><h2>bat %1 (%2), by Dirk H Bartley and Kern Sibbald</h2>"
+ "<p>Copyright © 2007-%3 Free Software Foundation Europe e.V."
"<p>The <b>bat</b> is an administrative console"
- " interface to the Director."));
+ " interface to the Director.").arg(VERSION).arg(BDATE).arg(BYEAR));
}
void MainWin::help()
prefs.daysSpinBox->setValue(m_daysLimitVal);
prefs.checkMessages->setCheckState(m_checkMessages ? Qt::Checked : Qt::Unchecked);
prefs.checkMessagesSpin->setValue(m_checkMessagesInterval);
+ prefs.refreshStatusDir->setCheckState(m_refreshStatusDir ? Qt::Checked : Qt::Unchecked);
+ prefs.refreshStatusDirSpin->setValue(m_refreshStatusDirInterval);
prefs.executeLongCheckBox->setCheckState(m_longList ? Qt::Checked : Qt::Unchecked);
prefs.rtPopDirCheckBox->setCheckState(m_rtPopDirDebug ? Qt::Checked : Qt::Unchecked);
prefs.rtDirCurICCheckBox->setCheckState(m_rtDirCurICDebug ? Qt::Checked : Qt::Unchecked);
prefs.rtRestore1CheckBox->setCheckState(m_rtRestore1Debug ? Qt::Checked : Qt::Unchecked);
prefs.rtRestore2CheckBox->setCheckState(m_rtRestore2Debug ? Qt::Checked : Qt::Unchecked);
prefs.rtRestore3CheckBox->setCheckState(m_rtRestore3Debug ? Qt::Checked : Qt::Unchecked);
- if (m_radioConvert == 0) {
+ switch (ItemFormatterBase::getBytesConversion()) {
+ case ItemFormatterBase::BYTES_CONVERSION_NONE:
prefs.radioConvertOff->setChecked(Qt::Checked);
- } else if (m_radioConvert == 1){
+ break;
+ case ItemFormatterBase::BYTES_CONVERSION_IEC:
prefs.radioConvertIEC->setChecked(Qt::Checked);
- } else {
- m_radioConvert = 2;
+ break;
+ default:
prefs.radioConvertStandard->setChecked(Qt::Checked);
+ 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();
mainWin->m_daysLimitVal = this->daysSpinBox->value();
mainWin->m_checkMessages = this->checkMessages->checkState() == Qt::Checked;
mainWin->m_checkMessagesInterval = this->checkMessagesSpin->value();
+ mainWin->m_refreshStatusDir = this->refreshStatusDir->checkState() == Qt::Checked;
+ mainWin->m_refreshStatusDirInterval = this->refreshStatusDirSpin->value();
mainWin->m_longList = this->executeLongCheckBox->checkState() == Qt::Checked;
mainWin->m_rtPopDirDebug = this->rtPopDirCheckBox->checkState() == Qt::Checked;
mainWin->m_rtRestore2Debug = this->rtRestore2CheckBox->checkState() == Qt::Checked;
mainWin->m_rtRestore3Debug = this->rtRestore3CheckBox->checkState() == Qt::Checked;
if (this->radioConvertOff->isChecked()) {
- mainWin->m_radioConvert = 0;
+ ItemFormatterBase::setBytesConversion(ItemFormatterBase::BYTES_CONVERSION_NONE);
} else if (this->radioConvertIEC->isChecked()){
- mainWin->m_radioConvert = 1;
+ ItemFormatterBase::setBytesConversion(ItemFormatterBase::BYTES_CONVERSION_IEC);
} else {
- mainWin->m_radioConvert = 2;
+ ItemFormatterBase::setBytesConversion(ItemFormatterBase::BYTES_CONVERSION_SI);
}
mainWin->m_openPlot = this->openPlotCheckBox->checkState() == Qt::Checked;
mainWin->m_openBrowser = this->openBrowserCheckBox->checkState() == Qt::Checked;
settings.setValue("daysLimitCheck", mainWin->m_daysLimitCheck);
settings.setValue("daysLimitVal", mainWin->m_daysLimitVal);
settings.endGroup();
- settings.beginGroup("Messages");
+ settings.beginGroup("Timers");
settings.setValue("checkMessages", mainWin->m_checkMessages);
settings.setValue("checkMessagesInterval", mainWin->m_checkMessagesInterval);
+ settings.setValue("refreshStatusDir", mainWin->m_refreshStatusDir);
+ settings.setValue("refreshStatusDirInterval", mainWin->m_refreshStatusDirInterval);
settings.endGroup();
settings.beginGroup("Misc");
settings.setValue("longList", mainWin->m_longList);
- settings.setValue("byteConvert", mainWin->m_radioConvert);
+ settings.setValue("byteConvert", ItemFormatterBase::getBytesConversion());
settings.setValue("openplot", mainWin->m_openPlot);
settings.setValue("openbrowser", mainWin->m_openBrowser);
settings.setValue("opendirstat", mainWin->m_openDirStat);
m_daysLimitCheck = settings.value("daysLimitCheck", false).toBool();
m_daysLimitVal = settings.value("daysLimitVal", 28).toInt();
settings.endGroup();
- settings.beginGroup("Messages");
+ settings.beginGroup("Timers");
m_checkMessages = settings.value("checkMessages", false).toBool();
m_checkMessagesInterval = settings.value("checkMessagesInterval", 28).toInt();
+ m_refreshStatusDir = settings.value("refreshStatusDir", false).toBool();
+ m_refreshStatusDirInterval = settings.value("refreshStatusDirInterval", 28).toInt();
settings.endGroup();
settings.beginGroup("Misc");
m_longList = settings.value("longList", false).toBool();
- m_radioConvert = settings.value("byteConvert", false).toInt();
+ ItemFormatterBase::setBytesConversion(
+ (ItemFormatterBase::BYTES_CONVERSION) settings.value("byteConvert",
+ ItemFormatterBase::BYTES_CONVERSION_IEC).toInt());
m_openPlot = settings.value("openplot", false).toBool();
m_openBrowser = settings.value("openbrowser", false).toBool();
m_openDirStat = settings.value("opendirstat", false).toBool();
m_rtRestore3Debug = settings.value("rtRestore3Debug", false).toBool();
settings.endGroup();
}
-
-void MainWin::hrConvert(QString &ret, qlonglong &inval)
-{
- double net = 0;
- qlonglong base;
- QStringList suflist;
-
- if (m_radioConvert == 0) {
- ret = QString("%1").arg(inval);
- return;
- } else if (m_radioConvert == 1){
- base = 1000;
- suflist = (QStringList() << "B" << "KiB" << "MiB" << "GiB" << "TiB" << "PiB" << "EiB" << "ZiB");
- } else {
- base = 1024;
- suflist = (QStringList() << "B" << "KB" << "MB" << "GB" << "TB" << "PB" << "EB" << "ZB");
- }
- qlonglong running = base;
- bool done = false;
- int count = 1;
- while (done == false) {
- QString test1 = QString("%1").arg(inval);
- QString test2 = QString("%1").arg(running);
- if (float(inval) < (float)(running)) {
- done = true;
- ret = suflist[count - 1];
- net = (float)inval / (float)(running/base);
- }
- count += 1;
- if (count > suflist.count()) done = true;
- running *= base;
- }
- char format = 'f';
- if (net != 0)
- ret = QString("%1 %2")
- .arg(net, 0, format, 2, QLatin1Char(' '))
- .arg(ret);
- else ret = "0 B";
-}
-
-void MainWin::hrConvertSeconds(QString &ret, qlonglong &inval)
-{
- double net = 0;
- QList<qlonglong> durations;
- durations.append(1);
- durations.append(60);
- durations.append(3600);
- durations.append(86400);
- durations.append(2592000);
- durations.append(31536000);
- QStringList abbrlist = (QStringList() << "Sec" << "Min" << "Hrs" << "Days" << "Mnth" << "Yrs");
- bool done = false;
- int count = 1;
- while (done == false) {
- QString test1 = QString("%1").arg(inval);
- QString test2 = QString("%1").arg(durations[count]);
- if ((inval < durations[count]) || (count >= abbrlist.count() - 1)) {
- done = true;
- net = (float)inval / (float)(durations[count - 1]);
- if (net != 0)
- ret = QString("%1 %2")
- .arg(net, 0, 'f', 2, QLatin1Char(' '))
- .arg(abbrlist[count - 1]);
- else ret = "0 S";
- }
- count += 1;
- }
-}