]> git.sur5r.net Git - bacula/bacula/commitdiff
Add preferences for the messages timer
authorDirk H Bartley <dbartley@schupan.com>
Tue, 22 May 2007 01:52:41 +0000 (01:52 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Tue, 22 May 2007 01:52:41 +0000 (01:52 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4869 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/TODO
bacula/src/qt-console/console/console.cpp
bacula/src/qt-console/console/console.h
bacula/src/qt-console/mainwin.cpp
bacula/src/qt-console/mainwin.h
bacula/src/qt-console/prefs.ui

index ba10dec7ccc287fef02abf3ccd9d5dc0022af0e3..0f32a0e80ae0891d93baf3ec8478330b4b209112 100644 (file)
@@ -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.
index 725972a719786625142ce0596b95508670d212b5..3e5fdc5cc99e902fc4ac43242dc5d6554b76e87c 100644 (file)
@@ -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();
    }
index f27ec02afa3a25a0a7fe24183713a232ee9f235a..51a8e204f74577f55214794e45e1592df5779321 100644 (file)
@@ -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;
index ed1985140710def990339e9348de716db9559b85..fb11e81a6ddec1a5faa02a6be35bccee6400ba8c 100644 (file)
@@ -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();
 }
index b14ae65386da0f68705860d12580ec895f5ca8c1..ff171fa3e045e714b92eb4b5ad63ee5f02ab3f3a 100644 (file)
@@ -69,6 +69,8 @@ public:
    /* This is a list of consoles */
    QHash<QTreeWidgetItem*,Console*> 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();
index 1ad81c84668a5dc096fe983d535e155653fb32cd..8d675c353df5c592f2e859e2f15b692b3ff33f0a 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>384</width>
-    <height>378</height>
+    <width>415</width>
+    <height>396</height>
    </rect>
   </property>
   <property name="sizePolicy" >
   <property name="windowIcon" >
    <iconset>images/bat.png</iconset>
   </property>
-  <widget class="QDialogButtonBox" name="buttonBox" >
-   <property name="geometry" >
-    <rect>
-     <x>9</x>
-     <y>343</y>
-     <width>366</width>
-     <height>26</height>
-    </rect>
+  <layout class="QGridLayout" >
+   <property name="margin" >
+    <number>9</number>
    </property>
-   <property name="orientation" >
-    <enum>Qt::Horizontal</enum>
+   <property name="spacing" >
+    <number>6</number>
    </property>
-   <property name="standardButtons" >
-    <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
-   </property>
-  </widget>
-  <widget class="QWidget" name="layoutWidget" >
-   <property name="geometry" >
-    <rect>
-     <x>0</x>
-     <y>0</y>
-     <width>310</width>
-     <height>25</height>
-    </rect>
-   </property>
-   <layout class="QHBoxLayout" >
-    <property name="margin" >
-     <number>0</number>
-    </property>
-    <property name="spacing" >
-     <number>6</number>
-    </property>
-    <item>
-     <spacer>
-      <property name="orientation" >
-       <enum>Qt::Horizontal</enum>
-      </property>
-      <property name="sizeHint" >
-       <size>
-        <width>81</width>
-        <height>20</height>
-       </size>
-      </property>
-     </spacer>
-    </item>
-    <item>
-     <widget class="QLabel" name="label" >
-      <property name="sizePolicy" >
-       <sizepolicy>
-        <hsizetype>5</hsizetype>
-        <vsizetype>0</vsizetype>
-        <horstretch>0</horstretch>
-        <verstretch>0</verstretch>
-       </sizepolicy>
-      </property>
-      <property name="text" >
-       <string>&lt;h2>Preferences&lt;/h2></string>
-      </property>
-     </widget>
-    </item>
-    <item>
-     <spacer>
-      <property name="orientation" >
-       <enum>Qt::Horizontal</enum>
-      </property>
-      <property name="sizeHint" >
-       <size>
-        <width>101</width>
-        <height>20</height>
-       </size>
-      </property>
-     </spacer>
-    </item>
-   </layout>
-  </widget>
-  <widget class="QTabWidget" name="tabWidget" >
-   <property name="geometry" >
-    <rect>
-     <x>9</x>
-     <y>40</y>
-     <width>366</width>
-     <height>297</height>
-    </rect>
-   </property>
-   <property name="currentIndex" >
-    <number>1</number>
-   </property>
-   <widget class="QWidget" name="tab" >
-    <attribute name="title" >
-     <string>Messages</string>
-    </attribute>
-    <widget class="QGroupBox" name="groupBox" >
-     <property name="geometry" >
-      <rect>
-       <x>10</x>
-       <y>30</y>
-       <width>271</width>
-       <height>181</height>
-      </rect>
-     </property>
-     <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>5</hsizetype>
-       <vsizetype>0</vsizetype>
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
+   <item row="1" column="0" >
+    <widget class="QTabWidget" name="tabWidget" >
+     <property name="currentIndex" >
+      <number>0</number>
      </property>
-     <property name="title" >
-      <string>Debugging Options</string>
-     </property>
-     <widget class="QWidget" name="layoutWidget" >
-      <property name="geometry" >
-       <rect>
-        <x>10</x>
-        <y>21</y>
-        <width>241</width>
-        <height>131</height>
-       </rect>
-      </property>
-      <layout class="QGridLayout" >
-       <property name="margin" >
-        <number>0</number>
+     <widget class="QWidget" name="tab" >
+      <attribute name="title" >
+       <string>Messages</string>
+      </attribute>
+      <widget class="QGroupBox" name="groupBox" >
+       <property name="geometry" >
+        <rect>
+         <x>10</x>
+         <y>30</y>
+         <width>291</width>
+         <height>181</height>
+        </rect>
        </property>
-       <property name="spacing" >
-        <number>6</number>
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>5</hsizetype>
+         <vsizetype>0</vsizetype>
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="title" >
+        <string>Messages Options</string>
        </property>
-       <item row="0" column="0" >
-        <widget class="QCheckBox" name="commDebug" >
-         <property name="text" >
-          <string>Debug comm</string>
-         </property>
-        </widget>
-       </item>
-       <item row="1" column="0" >
-        <widget class="QCheckBox" name="displayAll" >
-         <property name="text" >
-          <string>Display all messages in console</string>
-         </property>
-        </widget>
-       </item>
-       <item row="3" column="0" >
-        <widget class="QCheckBox" name="commandDebug" >
-         <property name="text" >
-          <string>Debug Commands</string>
-         </property>
-        </widget>
-       </item>
-       <item row="2" column="0" >
-        <widget class="QCheckBox" name="sqlDebug" >
-         <property name="text" >
-          <string>Debug Sql queries</string>
-         </property>
-        </widget>
-       </item>
-       <item row="4" column="0" >
-        <widget class="QCheckBox" name="miscDebug" >
-         <property name="text" >
-          <string>Debug Miscelaneous Items</string>
-         </property>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-    </widget>
-   </widget>
-   <widget class="QWidget" name="tab_2" >
-    <attribute name="title" >
-     <string>Joblist</string>
-    </attribute>
-    <widget class="QGroupBox" name="groupBox_2" >
-     <property name="geometry" >
-      <rect>
-       <x>9</x>
-       <y>62</y>
-       <width>301</width>
-       <height>146</height>
-      </rect>
-     </property>
-     <property name="sizePolicy" >
-      <sizepolicy>
-       <hsizetype>5</hsizetype>
-       <vsizetype>0</vsizetype>
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="title" >
-      <string>Jolist Limit Options</string>
-     </property>
-     <layout class="QGridLayout" >
-      <property name="margin" >
-       <number>9</number>
-      </property>
-      <property name="spacing" >
-       <number>6</number>
-      </property>
-      <item row="0" column="0" >
        <layout class="QGridLayout" >
         <property name="margin" >
-         <number>0</number>
+         <number>9</number>
         </property>
         <property name="spacing" >
          <number>6</number>
         </property>
         <item row="2" column="0" >
-         <widget class="QCheckBox" name="daysLimit" >
+         <widget class="QLabel" name="checkLabel" >
           <property name="text" >
-           <string>Days Limit</string>
+           <string>Message check interval in seconds</string>
           </property>
          </widget>
         </item>
-        <item row="3" column="0" >
-         <widget class="QSpinBox" name="daysSpinBox" >
-          <property name="maximum" >
-           <number>10000</number>
-          </property>
-          <property name="minimum" >
-           <number>1</number>
-          </property>
-          <property name="singleStep" >
-           <number>7</number>
+        <item row="0" column="0" >
+         <widget class="QCheckBox" name="checkMessages" >
+          <property name="text" >
+           <string>Check Messages</string>
           </property>
          </widget>
         </item>
         <item row="1" column="0" >
-         <widget class="QSpinBox" name="recordSpinBox" >
-          <property name="maximum" >
-           <number>10000</number>
-          </property>
-          <property name="minimum" >
-           <number>1</number>
-          </property>
-          <property name="singleStep" >
-           <number>25</number>
-          </property>
-         </widget>
+         <widget class="QSpinBox" name="checkMessagesSpin" />
         </item>
+       </layout>
+      </widget>
+     </widget>
+     <widget class="QWidget" name="tab_2" >
+      <attribute name="title" >
+       <string>Joblist</string>
+      </attribute>
+      <widget class="QGroupBox" name="groupBox_2" >
+       <property name="geometry" >
+        <rect>
+         <x>9</x>
+         <y>62</y>
+         <width>301</width>
+         <height>146</height>
+        </rect>
+       </property>
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>5</hsizetype>
+         <vsizetype>0</vsizetype>
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="title" >
+        <string>Jolist Limit Options</string>
+       </property>
+       <layout class="QGridLayout" >
+        <property name="margin" >
+         <number>9</number>
+        </property>
+        <property name="spacing" >
+         <number>6</number>
+        </property>
         <item row="0" column="0" >
-         <widget class="QCheckBox" name="recordLimit" >
-          <property name="text" >
-           <string>Record Limit</string>
+         <layout class="QGridLayout" >
+          <property name="margin" >
+           <number>0</number>
           </property>
-         </widget>
+          <property name="spacing" >
+           <number>6</number>
+          </property>
+          <item row="2" column="0" >
+           <widget class="QCheckBox" name="daysLimit" >
+            <property name="text" >
+             <string>Days Limit</string>
+            </property>
+           </widget>
+          </item>
+          <item row="3" column="0" >
+           <widget class="QSpinBox" name="daysSpinBox" >
+            <property name="maximum" >
+             <number>10000</number>
+            </property>
+            <property name="minimum" >
+             <number>1</number>
+            </property>
+            <property name="singleStep" >
+             <number>7</number>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0" >
+           <widget class="QSpinBox" name="recordSpinBox" >
+            <property name="maximum" >
+             <number>10000</number>
+            </property>
+            <property name="minimum" >
+             <number>1</number>
+            </property>
+            <property name="singleStep" >
+             <number>25</number>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="0" >
+           <widget class="QCheckBox" name="recordLimit" >
+            <property name="text" >
+             <string>Record Limit</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
         </item>
        </layout>
-      </item>
-     </layout>
+      </widget>
+     </widget>
+     <widget class="QWidget" name="tab_3" >
+      <attribute name="title" >
+       <string>Debug</string>
+      </attribute>
+      <widget class="QGroupBox" name="groupBox_3" >
+       <property name="geometry" >
+        <rect>
+         <x>20</x>
+         <y>40</y>
+         <width>271</width>
+         <height>181</height>
+        </rect>
+       </property>
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>5</hsizetype>
+         <vsizetype>0</vsizetype>
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="title" >
+        <string>Debugging Options</string>
+       </property>
+       <widget class="QWidget" name="layoutWidget_2" >
+        <property name="geometry" >
+         <rect>
+          <x>10</x>
+          <y>21</y>
+          <width>241</width>
+          <height>131</height>
+         </rect>
+        </property>
+        <layout class="QGridLayout" >
+         <property name="margin" >
+          <number>0</number>
+         </property>
+         <property name="spacing" >
+          <number>6</number>
+         </property>
+         <item row="0" column="0" >
+          <widget class="QCheckBox" name="commDebug" >
+           <property name="text" >
+            <string>Debug comm</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0" >
+          <widget class="QCheckBox" name="displayAll" >
+           <property name="text" >
+            <string>Display all messages in console</string>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="0" >
+          <widget class="QCheckBox" name="commandDebug" >
+           <property name="text" >
+            <string>Debug Commands</string>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="0" >
+          <widget class="QCheckBox" name="sqlDebug" >
+           <property name="text" >
+            <string>Debug Sql queries</string>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="0" >
+          <widget class="QCheckBox" name="miscDebug" >
+           <property name="text" >
+            <string>Debug Miscelaneous Items</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </widget>
+     </widget>
+    </widget>
+   </item>
+   <item row="0" column="0" >
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>81</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QLabel" name="headingLabel" >
+       <property name="sizePolicy" >
+        <sizepolicy>
+         <hsizetype>5</hsizetype>
+         <vsizetype>0</vsizetype>
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text" >
+        <string>&lt;h2>Preferences&lt;/h2></string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>101</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item row="2" column="0" >
+    <widget class="QDialogButtonBox" name="buttonBox" >
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons" >
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+     </property>
     </widget>
-   </widget>
-  </widget>
+   </item>
+  </layout>
  </widget>
  <resources/>
  <connections>