From 7a8ba1ead6dbe609ecc6eeae5ddde607f0b5bd5f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Enar=20V=C3=A4ikene?= Date: Thu, 1 Dec 2011 16:17:44 +0200 Subject: [PATCH] The LogView widget is now subclassed from Gui::Panel and adds itself to the document interface manager. * Is currently hardcoded to use the SdiWindow::iSdiWindow * The name of the panel defaults to "LogView", but can be changed in the XML file attribute "panelName". --- src/plugins/LogView/CMakeLists.txt | 2 +- src/plugins/LogView/logview.cpp | 33 +++++++++++++++++++++++++----- src/plugins/LogView/logview.h | 7 +++++-- src/plugins/LogView/version.h | 4 ++-- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/plugins/LogView/CMakeLists.txt b/src/plugins/LogView/CMakeLists.txt index 557cacc..8f68dd1 100644 --- a/src/plugins/LogView/CMakeLists.txt +++ b/src/plugins/LogView/CMakeLists.txt @@ -11,7 +11,7 @@ add_definitions(-DLOGVIEW_LIBRARY) include_directories(${eVaf_INCLUDE}) # Required eVaf libraries -set(eVaf_LIBRARIES CommonLib PluginsLib) +set(eVaf_LIBRARIES CommonLib PluginsLib GuiLib) # Source files set(SRCS diff --git a/src/plugins/LogView/logview.cpp b/src/plugins/LogView/logview.cpp index 2eaae97..1f75c58 100644 --- a/src/plugins/LogView/logview.cpp +++ b/src/plugins/LogView/logview.cpp @@ -23,8 +23,11 @@ #include #include #include +#include +#include #include +#include 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("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())); diff --git a/src/plugins/LogView/logview.h b/src/plugins/LogView/logview.h index 1bfe6a8..dd76858 100644 --- a/src/plugins/LogView/logview.h +++ b/src/plugins/LogView/logview.h @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -171,13 +172,13 @@ private: /** * The log view window */ -class Window : public QWidget +class Window : public Gui::Panel { Q_OBJECT public: - Window(QWidget * parent = 0, Qt::WindowFlags flags = 0); + Window(QString const & args, QWidget * parent = 0, Qt::WindowFlags flags = 0); virtual ~Window(); @@ -195,6 +196,8 @@ private: // Methods void restoreSettings(); + QString getPanelName(QString const & args) const; + private: // Members diff --git a/src/plugins/LogView/version.h b/src/plugins/LogView/version.h index d8d3133..b1893b1 100644 --- a/src/plugins/LogView/version.h +++ b/src/plugins/LogView/version.h @@ -25,12 +25,12 @@ /** * Module/library version number in the form major,minor,release,build */ -#define VER_FILE_VERSION 0,1,1,2 +#define VER_FILE_VERSION 0,2,1,3 /** * Module/library version number in the string format (shall end with \0) */ -#define VER_FILE_VERSION_STR "0.1.1.2\0" +#define VER_FILE_VERSION_STR "0.2.1.3\0" /** * Module/library name (shall end with \0) -- 2.47.0