]> vaikene.ee Git - evaf/blobdiff - src/plugins/LogView/logview.cpp
The LogView widget is now subclassed from Gui::Panel and adds itself to the document...
[evaf] / src / plugins / LogView / logview.cpp
index 2eaae975d2ea4eae1338eeeb417d000d5d1f893a..1f75c58759a43c873a24bc376e06cd661ffcf764 100644 (file)
 #include <Common/Globals>
 #include <Common/iLogger>
 #include <Common/iApp>
+#include <Common/iRegistry>
+#include <SdiWindow/iSdiWindow>
 
 #include <QtGui>
+#include <QXmlStreamReader>
 
 
 using namespace eVaf;
@@ -243,11 +246,14 @@ void Widget::saveToFile()
 
 //-------------------------------------------------------------------
 
-Window::Window(QWidget * parent, Qt::WindowFlags flags)
-    : QWidget(parent, flags)
+Window::Window(QString const & args, QWidget * parent, Qt::WindowFlags flags)
+    : Gui::Panel(parent, flags)
 {
     setObjectName(QString("%1-Window").arg(VER_MODULE_NAME_STR));
 
+    SdiWindow::iSdiWindow * win = evafQueryInterface<SdiWindow::iSdiWindow>("iSdiWindow");
+    win->addPanel(getPanelName(args), this);
+
     setWindowTitle(tr("Messages"));
 
     Common::iLogger * logger = Common::iLogger::instance();
@@ -295,6 +301,25 @@ Window::~Window()
     EVAF_INFO("%s destroyed", qPrintable(objectName()));
 }
 
+QString Window::getPanelName(QString const & args) const
+{
+    QString panelName = "LogView";
+
+    QXmlStreamReader xml(args);
+    while (!xml.atEnd()) {
+        xml.readNext();
+        if (xml.isStartElement() && xml.name() == "attributes") {
+            if (xml.attributes().hasAttribute("panelName")) {
+                QString s = xml.attributes().value("panelName").toString();
+                if (!s.isEmpty())
+                    panelName = s;
+            }
+        }
+    }
+
+    return panelName;
+}
+
 bool Window::event(QEvent * e)
 {
     if (e->type() == QEvent::StatusTip) {
@@ -371,9 +396,7 @@ Module::~Module()
 
 bool Module::init(QString const & args)
 {
-    Q_UNUSED(args);
-
-    wWindow = new Window();
+    wWindow = new Window(args);
 
     EVAF_INFO("%s initialized", qPrintable(objectName()));