From fbc32870f95ef770f4d95b73c489f258991fdf92 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Tue, 22 May 2007 01:52:41 +0000 Subject: [PATCH] Add preferences for the messages timer git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4869 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/TODO | 2 + bacula/src/qt-console/console/console.cpp | 9 +- bacula/src/qt-console/console/console.h | 1 + bacula/src/qt-console/mainwin.cpp | 23 +- bacula/src/qt-console/mainwin.h | 6 +- bacula/src/qt-console/prefs.ui | 493 ++++++++++++---------- 6 files changed, 301 insertions(+), 233 deletions(-) diff --git a/bacula/src/qt-console/TODO b/bacula/src/qt-console/TODO index ba10dec7cc..0f32a0e80a 100644 --- a/bacula/src/qt-console/TODO +++ b/bacula/src/qt-console/TODO @@ -72,6 +72,8 @@ global one defined in the mainWin class (if I remember right). ============================================================ DONE: ============================================================ +Preferences for the messages timer. + Get the 5 second bring to bottom of console to stop joblist cancel a running job. diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 725972a719..3e5fdc5cc9 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -63,17 +63,22 @@ Console::Console(QStackedWidget *parent) /* Check for messages every 5 seconds */ m_timer = new QTimer(this); QWidget::connect(m_timer, SIGNAL(timeout()), this, SLOT(poll_messages())); - m_timer->start(5000); + startTimer(); } Console::~Console() { } +void Console::startTimer() +{ + m_timer->start(mainWin->m_checkMessagesInterval*1000); +} + void Console::poll_messages() { m_messages_pending = true; - if (m_at_main_prompt) { + if ((m_at_main_prompt) && (mainWin->m_checkMessages)){ write(".messages"); displayToPrompt(); } diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index f27ec02afa..51a8e204f7 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -100,6 +100,7 @@ public: void setDirRes(DIRRES *dir); QTreeWidgetItem *directorTreeItem() { return m_directorTreeItem; }; void getDirResName(QString &); + void startTimer(); QStringList job_list; QStringList client_list; diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index ed19851407..fb11e81a6d 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -620,6 +620,8 @@ void MainWin::setPreferences() 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.exec(); } @@ -641,18 +643,29 @@ void prefsDialog::accept() 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(); QSettings settings("www.bacula.org", "bat"); - settings.beginGroup("Messages"); + settings.beginGroup("Debug"); settings.setValue("commDebug", mainWin->m_commDebug); 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("Messages"); + settings.setValue("checkMessages", mainWin->m_checkMessages); + settings.setValue("checkMessagesInterval", mainWin->m_checkMessagesInterval); + settings.endGroup(); + foreach(Console *console, mainWin->m_consoleHash) { + console->startTimer(); + } } void prefsDialog::reject() @@ -665,15 +678,21 @@ void prefsDialog::reject() void MainWin::readPreferences() { QSettings settings("www.bacula.org", "bat"); - settings.beginGroup("Messages"); + settings.beginGroup("Debug"); m_commDebug = settings.value("commDebug", 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("Messages"); + m_checkMessages = settings.value("checkMessages", false).toBool(); + m_checkMessagesInterval = settings.value("checkMessagesInterval", 28).toInt(); + settings.endGroup(); } diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index b14ae65386..ff171fa3e0 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -69,6 +69,8 @@ public: /* This is a list of consoles */ QHash m_consoleHash; void createPageJobList(QString &, QString &, QTreeWidgetItem *); + QString m_dtformat; + /* Begin Preferences variables */ bool m_commDebug; bool m_displayAll; bool m_sqlDebug; @@ -78,8 +80,8 @@ public: int m_recordLimitVal; bool m_daysLimitCheck; int m_daysLimitVal; - QString m_dtformat; - + bool m_checkMessages; + int m_checkMessagesInterval; public slots: void input_line(); diff --git a/bacula/src/qt-console/prefs.ui b/bacula/src/qt-console/prefs.ui index 1ad81c8466..8d675c353d 100644 --- a/bacula/src/qt-console/prefs.ui +++ b/bacula/src/qt-console/prefs.ui @@ -5,8 +5,8 @@ 0 0 - 384 - 378 + 415 + 396 @@ -23,257 +23,296 @@ images/bat.png - - - - 9 - 343 - 366 - 26 - + + + 9 - - Qt::Horizontal + + 6 - - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok - - - - - - 0 - 0 - 310 - 25 - - - - - 0 - - - 6 - - - - - Qt::Horizontal - - - - 81 - 20 - - - - - - - - - 5 - 0 - 0 - 0 - - - - <h2>Preferences</h2> - - - - - - - Qt::Horizontal - - - - 101 - 20 - - - - - - - - - - 9 - 40 - 366 - 297 - - - - 1 - - - - Messages - - - - - 10 - 30 - 271 - 181 - - - - - 5 - 0 - 0 - 0 - + + + + 0 - - Debugging Options - - - - - 10 - 21 - 241 - 131 - - - - - 0 + + + Messages + + + + + 10 + 30 + 291 + 181 + - - 6 + + + 5 + 0 + 0 + 0 + + + + Messages Options - - - - Debug comm - - - - - - - Display all messages in console - - - - - - - Debug Commands - - - - - - - Debug Sql queries - - - - - - - Debug Miscelaneous Items - - - - - - - - - - Joblist - - - - - 9 - 62 - 301 - 146 - - - - - 5 - 0 - 0 - 0 - - - - Jolist Limit Options - - - - 9 - - - 6 - - - 0 + 9 6 - + - Days Limit + Message check interval in seconds - - - - 10000 - - - 1 - - - 7 + + + + Check Messages - - - 10000 - - - 1 - - - 25 - - + + + + + + + Joblist + + + + + 9 + 62 + 301 + 146 + + + + + 5 + 0 + 0 + 0 + + + + Jolist Limit Options + + + + 9 + + + 6 + - - - Record Limit + + + 0 - + + 6 + + + + + Days Limit + + + + + + + 10000 + + + 1 + + + 7 + + + + + + + 10000 + + + 1 + + + 25 + + + + + + + Record Limit + + + + - - + + + + + Debug + + + + + 20 + 40 + 271 + 181 + + + + + 5 + 0 + 0 + 0 + + + + Debugging Options + + + + + 10 + 21 + 241 + 131 + + + + + 0 + + + 6 + + + + + Debug comm + + + + + + + Display all messages in console + + + + + + + Debug Commands + + + + + + + Debug Sql queries + + + + + + + Debug Miscelaneous Items + + + + + + + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 81 + 20 + + + + + + + + + 5 + 0 + 0 + 0 + + + + <h2>Preferences</h2> + + + + + + + Qt::Horizontal + + + + 101 + 20 + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + - - + + -- 2.39.5