[Kst] branches/work/kst/portto4/kst/src/libkstapp

Mike Fenton mike at staikos.net
Tue Oct 23 20:20:12 CEST 2007


SVN commit 728577 by fenton:

Add EventMonitorEntry creation from EventMonitorDialog and save of
EventMonitorEntry.


 M  +64 -2     eventmonitordialog.cpp  
 M  +11 -0     eventmonitordialog.h  
 M  +29 -1     eventmonitorentry.cpp  
 M  +1 -0      eventmonitorentry.h  
 M  +1 -6      eventmonitortab.ui  


--- branches/work/kst/portto4/kst/src/libkstapp/eventmonitordialog.cpp #728576:728577
@@ -17,6 +17,8 @@
 #include "dataobjectcollection.h"
 #include "defaultnames.h"
 
+#include "eventmonitorentry.h"
+
 namespace Kst {
 
 EventMonitorTab::EventMonitorTab(QWidget *parent)
@@ -31,6 +33,52 @@
 }
 
 
+QString EventMonitorTab::script() const {
+  return _script->toPlainText();
+}
+
+
+QString EventMonitorTab::event() const {
+  return _equation->text();
+}
+
+
+QString EventMonitorTab::description() const {
+  return _description->text();
+}
+
+
+QString EventMonitorTab::emailRecipients() const {
+  return _emailRecipients->text();
+}
+
+
+Debug::LogLevel EventMonitorTab::logLevel() const {
+  if (_debugLogNotice->isChecked()) {
+    return Debug::Notice;
+  } else if (_debugLogWarning->isChecked()) {
+    return Debug::Warning;
+  } else {
+    return Debug::Error;
+  }
+}
+
+
+bool EventMonitorTab::logKstDebug() const {
+  return _debugLog->isChecked();
+}
+
+
+bool EventMonitorTab::logEMail() const {
+  return _emailNotify->isChecked();
+}
+
+
+bool EventMonitorTab::logELOG() const {
+  return _ELOGNotify->isChecked();
+}
+
+
 EventMonitorDialog::EventMonitorDialog(ObjectPtr dataObject, QWidget *parent)
   : DataDialog(dataObject, parent) {
 
@@ -56,8 +104,22 @@
 
 
 ObjectPtr EventMonitorDialog::createNewDataObject() const {
-  qDebug() << "createNewDataObject" << endl;
-  return 0;
+  EventMonitorEntryPtr eventMonitor = new EventMonitorEntry(tagName(),
+                                                      _eventMonitorTab->script(),
+                                                      _eventMonitorTab->event(),
+                                                      _eventMonitorTab->description(),
+                                                      _eventMonitorTab->logLevel(),
+                                                      _eventMonitorTab->logKstDebug(),
+                                                      _eventMonitorTab->logEMail(),
+                                                      _eventMonitorTab->logELOG(),
+                                                      _eventMonitorTab->emailRecipients());
+  eventMonitor->reparse();
+
+  eventMonitor->writeLock();
+  eventMonitor->update(0);
+  eventMonitor->unlock();
+
+  return ObjectPtr(eventMonitor.data());
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/eventmonitordialog.h #728576:728577
@@ -15,6 +15,8 @@
 #include "datadialog.h"
 #include "datatab.h"
 
+#include "debug.h"
+
 #include "kst_export.h"
 
 #include "ui_eventmonitortab.h"
@@ -27,6 +29,15 @@
     EventMonitorTab(QWidget *parent = 0);
     virtual ~EventMonitorTab();
 
+    QString script() const;
+    QString event() const;
+    QString description() const;
+    Debug::LogLevel logLevel() const;
+    bool logKstDebug() const;
+    bool logEMail() const;
+    bool logELOG() const;
+    QString emailRecipients() const;
+
   private Q_SLOTS:
   private:
 };
--- branches/work/kst/portto4/kst/src/libkstapp/eventmonitorentry.cpp #728576:728577
@@ -24,6 +24,8 @@
 #include "datacollection.h"
 #include "eventmonitorentry.h"
 
+#include "debug.h"
+
 #include <assert.h>
 #include <unistd.h>
 
@@ -55,6 +57,21 @@
 }
 
 
+EventMonitorEntry::EventMonitorEntry(const QString &tag, const QString &script, const QString &event, const QString &description, const Debug::LogLevel level, const bool logKstDebug, const bool logEMail, const bool logELOG, const QString& emailRecipients) {
+
+  _event = event;
+  _description = description;
+  _eMailRecipients = emailRecipients;
+  _logKstDebug = logKstDebug;
+  _logEMail = logEMail;
+  _logELOG = logELOG;
+  _level = level;
+  _script = script;
+
+  commonConstructor(tag);
+
+}
+
 EventMonitorEntry::EventMonitorEntry(const QDomElement &e) {
   QString strTag;
 
@@ -147,7 +164,18 @@
 }
 
 
-void EventMonitorEntry::save(QXmlStreamWriter &s) {
+void EventMonitorEntry::save(QXmlStreamWriter &xml) {
+  xml.writeStartElement("event");
+  xml.writeAttribute("tag", tag().tagString());
+  xml.writeAttribute("equation", _event);
+  xml.writeAttribute("description", _description);
+  xml.writeAttribute("logdebug", _logKstDebug);
+  xml.writeAttribute("loglevel", _level);
+  xml.writeAttribute("logemail", _logEMail);
+  xml.writeAttribute("logelog", _logELOG);
+  xml.writeAttribute("emailRecipients", _eMailRecipients);
+  xml.writeAttribute("script", _script);
+  xml.writeEndElement();
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/eventmonitorentry.h #728576:728577
@@ -30,6 +30,7 @@
   Q_OBJECT
   public:
     EventMonitorEntry(const QString &in_tag);
+    EventMonitorEntry(const QString &tag, const QString &script, const QString &event, const QString &description, const Debug::LogLevel level, const bool logKstDebug, const bool logEMail, const bool logELOG, const QString& emailRecipients);
     EventMonitorEntry(const QDomElement &e);
     ~EventMonitorEntry();
 
--- branches/work/kst/portto4/kst/src/libkstapp/eventmonitortab.ui #728576:728577
@@ -363,7 +363,7 @@
        </widget>
       </item>
       <item>
-       <widget class="Q3TextEdit" name="_script" />
+       <widget class="QTextEdit" name="_script" />
       </item>
      </layout>
     </widget>
@@ -496,11 +496,6 @@
  <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
  <customwidgets>
   <customwidget>
-   <class>Q3TextEdit</class>
-   <extends>Q3Frame</extends>
-   <header>q3textedit.h</header>
-  </customwidget>
-  <customwidget>
    <class>Kst::VectorSelector</class>
    <extends>QWidget</extends>
    <header>vectorselector.h</header>


More information about the Kst mailing list