X-Git-Url: https://vaikene.ee/gitweb/pswgen11.html?a=blobdiff_plain;ds=inline;f=src%2Fplugins%2FLogView%2Flogview.cpp;h=1bd41a170a5573cfa799ae89c59417b8000ba709;hb=HEAD;hp=2eaae975d2ea4eae1338eeeb417d000d5d1f893a;hpb=31e526453fe2983e8855342c980a1814bd39db7b;p=evaf
diff --git a/src/plugins/LogView/logview.cpp b/src/plugins/LogView/logview.cpp
index 2eaae97..1bd41a1 100644
--- a/src/plugins/LogView/logview.cpp
+++ b/src/plugins/LogView/logview.cpp
@@ -3,7 +3,7 @@
* @brief Implementation of the LogView module
* @author Enar Vaikene
*
- * Copyright (c) 2011 Enar Vaikene
+ * Copyright (c) 2011-2019 Enar Vaikene
*
* This file is part of the eVaf C++ cross-platform application development framework.
*
@@ -23,8 +23,11 @@
#include
#include
#include
+#include
+#include
-#include
+#include
+#include
using namespace eVaf;
@@ -59,7 +62,6 @@ QVariant Model::data(QModelIndex const & index, int role) const
// Return the message for the display role
case Qt::DisplayRole: {
return mData.at(index.row()).simplified;
- break;
}
// Change color for different message types
@@ -68,18 +70,14 @@ QVariant Model::data(QModelIndex const & index, int role) const
switch (s) {
case Common::iLogger::Info:
return QBrush(QColor(Qt::blue));
- break;
case Common::iLogger::Warning:
return QBrush(QColor(Qt::black));
- break;
case Common::iLogger::Error:
case Common::iLogger::Fatal:
return QBrush(QColor(Qt::red));
- break;
default:
return QVariant();
}
- break;
}
} // switch (role)
@@ -155,7 +153,7 @@ bool Model::saveToFile(QString const & fileName)
return true;
}
-char const * const Model::severityText(Common::iLogger::Severity s) const
+char const * Model::severityText(Common::iLogger::Severity s) const
{
if (s >= Common::iLogger::None && s < Common::iLogger::Count)
return SeverityText[s];
@@ -243,11 +241,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 +296,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 +391,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()));