]> vaikene.ee Git - evaf/blobdiff - src/plugins/LogView/logview.h
Implemented the LogView module that shows messages output using the Common::iLogger...
[evaf] / src / plugins / LogView / logview.h
index 383588de454272efb192c1c019531688143004c6..1bfe6a8228b62c30943efa09787ee95fd3ecfa25 100644 (file)
 #include <QQueue>
 #include <QDateTime>
 
+class QListView;
+class QLabel;
+class QTabWidget;
+class QStatusBar;
+class QEvent;
 
 namespace eVaf {
 
@@ -62,12 +67,14 @@ public:
             : dt(QDateTime::currentDateTime())
             , severity(s)
             , text(t)
+            , simplified(t.simplified())
             , where(w)
         {}
 
         QDateTime dt;
         Common::iLogger::Severity severity;
         QString text;
+        QString simplified;
         QString where;
     };
 
@@ -118,6 +125,8 @@ private: // Methods
 
 /**
  * The log view widget
+ *
+ * The Widget class implements a widget that shows messages from one logger source.
  */
 class Widget : public QWidget
 {
@@ -125,9 +134,59 @@ class Widget : public QWidget
 
 public:
 
-    Widget(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+    Widget(QString const & source, QWidget * parent = 0);
+
+    QString const & source() const { return mSource; }
+
+    inline void addMessage(Common::iLogger::Severity severity, QString const & text, QString const & where)
+    {
+        mModel->addMessage(severity, text, where);
+    }
+
+
+private slots:
+
+    void messageAdded(QModelIndex const & index);
+
+    void currentChanged(QModelIndex const &, QModelIndex const &);
 
-    virtual ~Widget();
+    void copyToClipboard();
+
+    void saveToFile();
+
+
+private:
+
+    QString mSource;
+
+    Model * mModel;
+
+    bool mAutoScroll;
+
+    QListView * wList;
+    QLabel * wDetails;
+
+};
+
+/**
+ * The log view window
+ */
+class Window : public QWidget
+{
+    Q_OBJECT
+
+public:
+
+    Window(QWidget * parent = 0, Qt::WindowFlags flags = 0);
+
+    virtual ~Window();
+
+    virtual bool event(QEvent * e);
+
+
+public slots:
+
+    void loggerEvent(Common::iLogger::Severity severity, QString const & text, QString const & source, QString const & where);
 
 
 private: // Methods
@@ -136,6 +195,14 @@ private: // Methods
 
     void restoreSettings();
 
+
+private: // Members
+
+    QString mDefSource;
+    QTabWidget * wTabs;
+    QHash<QString, Widget *> mLogViews;
+    QStatusBar * wStatusBar;
+
 };
 
 /**
@@ -156,11 +223,11 @@ public:
 
     virtual void done();
 
-    virtual bool isReady() const { return wWidget != 0; }
+    virtual bool isReady() const { return wWindow != 0; }
 
 private: // Members
 
-    Widget * wWidget;
+    Window * wWindow;
 
 };