+
+/* Quick function to return the current console */
+Console *MainWin::currentConsole()
+{
+ return m_currentConsole;
+}
+
+/* Quick function to return the tree item for the director */
+QTreeWidgetItem *MainWin::currentTopItem()
+{
+ return m_currentConsole->directorTreeItem();
+}
+
+/* Preferences menu item clicked */
+void MainWin::setPreferences()
+{
+ prefsDialog prefs;
+ prefs.commDebug->setCheckState(m_commDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.connDebug->setCheckState(m_connDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.displayAll->setCheckState(m_displayAll ? Qt::Checked : Qt::Unchecked);
+ prefs.sqlDebug->setCheckState(m_sqlDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.commandDebug->setCheckState(m_commandDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.miscDebug->setCheckState(m_miscDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.recordLimit->setCheckState(m_recordLimitCheck ? Qt::Checked : Qt::Unchecked);
+ prefs.recordSpinBox->setValue(m_recordLimitVal);
+ prefs.daysLimit->setCheckState(m_daysLimitCheck ? Qt::Checked : Qt::Unchecked);
+ 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.rtDirICCheckBox->setCheckState(m_rtDirICDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtFileTabICCheckBox->setCheckState(m_rtFileTabICDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtVerTabICCheckBox->setCheckState(m_rtVerTabICDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtUpdateFTCheckBox->setCheckState(m_rtUpdateFTDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtUpdateVTCheckBox->setCheckState(m_rtUpdateVTDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtChecksCheckBox->setCheckState(m_rtChecksDebug ? Qt::Checked : Qt::Unchecked);
+ prefs.rtIconStateCheckBox->setCheckState(m_rtIconStateDebug ? 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);
+ switch (ItemFormatterBase::getBytesConversion()) {
+ case ItemFormatterBase::BYTES_CONVERSION_NONE:
+ prefs.radioConvertOff->setChecked(Qt::Checked);
+ break;
+ case ItemFormatterBase::BYTES_CONVERSION_IEC:
+ prefs.radioConvertIEC->setChecked(Qt::Checked);
+ 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();
+}
+
+/* Preferences dialog */
+prefsDialog::prefsDialog()
+{
+ setupUi(this);
+}
+
+void prefsDialog::accept()
+{
+ this->hide();
+ mainWin->m_commDebug = this->commDebug->checkState() == Qt::Checked;
+ mainWin->m_connDebug = this->connDebug->checkState() == Qt::Checked;
+ mainWin->m_displayAll = this->displayAll->checkState() == Qt::Checked;
+ mainWin->m_sqlDebug = this->sqlDebug->checkState() == Qt::Checked;
+ mainWin->m_commandDebug = this->commandDebug->checkState() == Qt::Checked;
+ mainWin->m_miscDebug = this->miscDebug->checkState() == Qt::Checked;
+ mainWin->m_recordLimitCheck = this->recordLimit->checkState() == Qt::Checked;
+ mainWin->m_recordLimitVal = this->recordSpinBox->value();
+ mainWin->m_daysLimitCheck = this->daysLimit->checkState() == Qt::Checked;
+ 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_rtDirCurICDebug = this->rtDirCurICCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtDirICDebug = this->rtDirICCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtFileTabICDebug = this->rtFileTabICCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtVerTabICDebug = this->rtVerTabICCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtUpdateFTDebug = this->rtUpdateFTCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtUpdateVTDebug = this->rtUpdateVTCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtChecksDebug = this->rtChecksCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtIconStateDebug = this->rtIconStateCheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtRestore1Debug = this->rtRestore1CheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtRestore2Debug = this->rtRestore2CheckBox->checkState() == Qt::Checked;
+ mainWin->m_rtRestore3Debug = this->rtRestore3CheckBox->checkState() == Qt::Checked;
+ if (this->radioConvertOff->isChecked()) {
+ ItemFormatterBase::setBytesConversion(ItemFormatterBase::BYTES_CONVERSION_NONE);
+ } else if (this->radioConvertIEC->isChecked()){
+ ItemFormatterBase::setBytesConversion(ItemFormatterBase::BYTES_CONVERSION_IEC);
+ } else {
+ ItemFormatterBase::setBytesConversion(ItemFormatterBase::BYTES_CONVERSION_SI);
+ }
+ mainWin->m_openPlot = this->openPlotCheckBox->checkState() == Qt::Checked;
+ mainWin->m_openBrowser = this->openBrowserCheckBox->checkState() == Qt::Checked;
+ mainWin->m_openDirStat = this->openDirStatCheckBox->checkState() == Qt::Checked;
+
+ QSettings settings("www.bacula.org", "bat");
+ settings.beginGroup("Debug");
+ settings.setValue("commDebug", mainWin->m_commDebug);
+ settings.setValue("connDebug", mainWin->m_connDebug);
+ settings.setValue("displayAll", mainWin->m_displayAll);
+ settings.setValue("sqlDebug", mainWin->m_sqlDebug);
+ settings.setValue("commandDebug", mainWin->m_commandDebug);
+ settings.setValue("miscDebug", mainWin->m_miscDebug);
+ settings.endGroup();
+ settings.beginGroup("JobList");
+ settings.setValue("recordLimitCheck", mainWin->m_recordLimitCheck);
+ settings.setValue("recordLimitVal", mainWin->m_recordLimitVal);
+ settings.setValue("daysLimitCheck", mainWin->m_daysLimitCheck);
+ settings.setValue("daysLimitVal", mainWin->m_daysLimitVal);
+ settings.endGroup();
+ 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", ItemFormatterBase::getBytesConversion());
+ settings.setValue("openplot", mainWin->m_openPlot);
+ settings.setValue("openbrowser", mainWin->m_openBrowser);
+ settings.setValue("opendirstat", mainWin->m_openDirStat);
+ settings.endGroup();
+ settings.beginGroup("RestoreTree");
+ settings.setValue("rtPopDirDebug", mainWin->m_rtPopDirDebug);
+ settings.setValue("rtDirCurICDebug", mainWin->m_rtDirCurICDebug);
+ settings.setValue("rtDirCurICRetDebug", mainWin->m_rtDirICDebug);
+ settings.setValue("rtFileTabICDebug", mainWin->m_rtFileTabICDebug);
+ settings.setValue("rtVerTabICDebug", mainWin->m_rtVerTabICDebug);
+ settings.setValue("rtUpdateFTDebug", mainWin->m_rtUpdateFTDebug);
+ settings.setValue("rtUpdateVTDebug", mainWin->m_rtUpdateVTDebug);
+ settings.setValue("rtChecksDebug", mainWin->m_rtChecksDebug);
+ settings.setValue("rtIconStateDebug", mainWin->m_rtIconStateDebug);
+ settings.setValue("rtRestore1Debug", mainWin->m_rtRestore1Debug);
+ settings.setValue("rtRestore2Debug", mainWin->m_rtRestore2Debug);
+ settings.setValue("rtRestore3Debug", mainWin->m_rtRestore3Debug);
+ settings.endGroup();
+}
+
+void prefsDialog::reject()
+{
+ this->hide();
+ mainWin->set_status(tr("Canceled"));
+}
+
+/* read preferences for the prefences dialog box */
+void MainWin::readPreferences()
+{
+ QSettings settings("www.bacula.org", "bat");
+ settings.beginGroup("Debug");
+ m_commDebug = settings.value("commDebug", false).toBool();
+ m_connDebug = settings.value("connDebug", false).toBool();
+ m_displayAll = settings.value("displayAll", false).toBool();
+ m_sqlDebug = settings.value("sqlDebug", false).toBool();
+ m_commandDebug = settings.value("commandDebug", false).toBool();
+ m_miscDebug = settings.value("miscDebug", false).toBool();
+ settings.endGroup();
+ settings.beginGroup("JobList");
+ m_recordLimitCheck = settings.value("recordLimitCheck", true).toBool();
+ m_recordLimitVal = settings.value("recordLimitVal", 150).toInt();
+ m_daysLimitCheck = settings.value("daysLimitCheck", false).toBool();
+ m_daysLimitVal = settings.value("daysLimitVal", 28).toInt();
+ settings.endGroup();
+ 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();
+ 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();
+ settings.endGroup();
+ settings.beginGroup("RestoreTree");
+ m_rtPopDirDebug = settings.value("rtPopDirDebug", false).toBool();
+ m_rtDirCurICDebug = settings.value("rtDirCurICDebug", false).toBool();
+ m_rtDirICDebug = settings.value("rtDirCurICRetDebug", false).toBool();
+ m_rtFileTabICDebug = settings.value("rtFileTabICDebug", false).toBool();
+ m_rtVerTabICDebug = settings.value("rtVerTabICDebug", false).toBool();
+ m_rtUpdateFTDebug = settings.value("rtUpdateFTDebug", false).toBool();
+ m_rtUpdateVTDebug = settings.value("rtUpdateVTDebug", false).toBool();
+ m_rtChecksDebug = settings.value("rtChecksDebug", false).toBool();
+ m_rtIconStateDebug = settings.value("rtIconStateDebug", false).toBool();
+ m_rtRestore1Debug = settings.value("rtRestore1Debug", false).toBool();
+ m_rtRestore2Debug = settings.value("rtRestore2Debug", false).toBool();
+ m_rtRestore3Debug = settings.value("rtRestore3Debug", false).toBool();
+ settings.endGroup();
+}
+
+void MainWin::setMessageIcon()
+{
+ if (m_currentConsole->is_messagesPending())
+ actionMessages->setIcon(QIcon(QString::fromUtf8(":/images/mail-message-pending.png")));
+ else
+ actionMessages->setIcon(QIcon(QString::fromUtf8(":/images/mail-message-new.png")));
+}