NorMIT-nav  16.5
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxConsoleWidget.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 
34 #include "cxConsoleWidget.h"
35 
36 #include <iostream>
37 #include <QVBoxLayout>
38 #include <QMenu>
39 #include <QScrollBar>
40 #include <QContextMenuEvent>
41 #include "cxTypeConversions.h"
42 #include "cxEnumConverter.h"
43 #include "cxDefinitionStrings.h"
44 #include "cxSettings.h"
45 #include "cxStringProperty.h"
46 #include "cxHelperWidgets.h"
48 #include "cxMessageListener.h"
49 #include "cxEnumConverter.h"
50 #include "cxUtilHelpers.h"
51 #include <QTimer>
52 #include <QThread>
53 #include <QTableWidget>
54 #include "cxLogMessageFilter.h"
55 #include <QHeaderView>
56 #include <QStackedLayout>
57 #include <QApplication>
58 #include <QClipboard>
59 #include "cxNullDeleter.h"
60 #include <QPushButton>
61 #include "cxProfile.h"
62 #include "cxTime.h"
63 #include "cxPopupToolbarWidget.h"
64 
65 namespace cx
66 {
67 
69 {
70  this->createTextCharFormats();
71 }
72 
74 {
75  mFormat[mlINFO].setForeground(Qt::black);
76  mFormat[mlSUCCESS].setForeground(QColor(60, 179, 113)); // medium sea green
77  mFormat[mlWARNING].setForeground(QColor(255, 140, 0)); //dark orange
78  mFormat[mlERROR].setForeground(Qt::red);
79  mFormat[mlDEBUG].setForeground(QColor(135, 206, 250)); //sky blue
80  mFormat[mlCERR].setForeground(Qt::red);
81  mFormat[mlCOUT].setForeground(Qt::darkGray);
82 }
83 
87 
88 class MyTableWidget : public QTableWidget
89 {
90 public:
91  MyTableWidget(QWidget* parent=NULL) : QTableWidget(parent) {}
92  virtual ~MyTableWidget() {}
93  virtual void keyPressEvent(QKeyEvent* event);
94 };
95 
96 //source: http://stackoverflow.com/questions/3135737/copying-part-of-qtableview
97 void MyTableWidget::keyPressEvent(QKeyEvent* event)
98 {
99  // If Ctrl-C typed
100  // Or use event->matches(QKeySequence::Copy)
101  if (event->key() == Qt::Key_C && (event->modifiers() & Qt::ControlModifier))
102  {
103  QModelIndexList cells = selectedIndexes();
104  qSort(cells); // Necessary, otherwise they are in column order
105 
106  QString text;
107  int currentRow = 0; // To determine when to insert newlines
108  foreach (const QModelIndex& cell, cells) {
109  if (text.length() == 0) {
110  // First item
111  } else if (cell.row() != currentRow) {
112  // New row
113  text += '\n';
114  } else {
115  // Next cell
116  text += '\t';
117  }
118  currentRow = cell.row();
119  text += cell.data().toString();
120  }
121 
122  QApplication::clipboard()->setText(text);
123  }
124  else
125  {
126  event->ignore();
127  }
128 
129  QTableWidget::keyPressEvent(event);
130 }
131 
133 
135  LogMessageDisplayWidget(parent),
136  mOptions(options),
137  mScrollToBottomEnabled(true)
138 {
139  mTable = new MyTableWidget(this);
140  QVBoxLayout* layout = new QVBoxLayout(this);
141  layout->setMargin(0);
142  this->setLayout(layout);
143  layout->addWidget(mTable);
144 
145  mTable->setShowGrid(false);
146  mTable->setTextElideMode(Qt::ElideLeft);
147  mTable->setWordWrap(false);
148 
149  mTable->setColumnCount(6);
150  mTable->setRowCount(0);
151  mTable->setHorizontalHeaderLabels(QStringList() << "time" << "source" << "function" << "thread" << "level" << "description");
152  mTable->setSelectionBehavior(QAbstractItemView::SelectRows);
153  mTable->verticalHeader()->hide();
154 
155  QFontMetrics metric(this->font());
156  mTable->setColumnWidth(0, metric.width("00:00:00.000xx"));
157  mTable->setColumnWidth(1, metric.width("cxSourceFile.cpp:333xx"));
158  mTable->setColumnWidth(2, metric.width("function()xx"));
159  mTable->setColumnWidth(3, metric.width("mainxx"));
160  mTable->setColumnWidth(4, metric.width("WARNINGxx"));
161  mTable->horizontalHeader()->setStretchLastSection(true);
162 
163  for (int i=0; i<mTable->horizontalHeader()->count(); ++i)
164  {
165  XmlOptionItem headerItem("headerwidth_"+QString::number(i), mOptions.getElement());
166  int value = headerItem.readValue("-1").toInt();
167  if (value<0)
168  continue;
169  mTable->setColumnWidth(i, value);
170  }
171 
172  int textLineHeight = metric.lineSpacing();
173  mTable->verticalHeader()->setDefaultSectionSize(textLineHeight);
174 }
175 
177 {
178  for (int i=0; i<mTable->horizontalHeader()->count(); ++i)
179  {
180  XmlOptionItem headerItem("headerwidth_"+QString::number(i), mOptions.getElement());
181  headerItem.writeValue(QString::number(mTable->columnWidth(i)));
182  }
183 }
184 
186 {
187  mTable->setRowCount(0);
188 }
189 
191 {
192  mTable->horizontalScrollBar()->setValue(mTable->horizontalScrollBar()->minimum());
193 }
194 
196 {
197  int row = mTable->rowCount();
198  mTable->insertRow(row);
199 
200  QString timestamp = message.getTimeStamp().toString("hh:mm:ss.zzz");
201  this->addItem(0, timestamp, message);
202 
203  QString source;
204  if (!message.mSourceFile.isEmpty())
205  source = QString("%1:%2").arg(message.mSourceFile).arg(message.mSourceLine);
206  this->addItem(1, source, message);
207 
208  QString function = message.mSourceFunction;
209  this->addItem(2, function, message);
210 
211  QString thread = message.mThread;
212  this->addItem(3, thread, message);
213 
214  QString level = enum2string(message.getMessageLevel());
215  this->addItem(4, level, message);
216 
217  QString desc = message.getText();
218  this->addItem(5, desc, message);
219 
220  this->scrollToBottom();
221 }
222 
224 {
226  this->scrollToBottom();
227 }
228 
230 {
231  mTable->horizontalHeader()->setVisible(on);
232 }
233 
235 {
237  QTimer::singleShot(0, mTable, SLOT(scrollToBottom()));
238 }
239 
240 QTableWidgetItem* DetailedLogMessageDisplayWidget::addItem(int column, QString text, const Message& message)
241 {
242  int row = mTable->rowCount();
243 
244  QTableWidgetItem* item = new QTableWidgetItem(text);
245  item->setStatusTip(text);
246  item->setToolTip(text);
247  item->setForeground(mFormat[message.getMessageLevel()].foreground());
248  item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
249  mTable->setItem(row-1, column, item);
250  return item;
251 }
252 
256 
258  LogMessageDisplayWidget(parent),
259  mScrollToBottomEnabled(true)
260 {
261  mBrowser = new QTextBrowser(this);
262  mBrowser->setReadOnly(true);
263  mBrowser->setLineWrapMode(QTextEdit::NoWrap);
264  QVBoxLayout* layout = new QVBoxLayout(this);
265  layout->setMargin(0);
266  this->setLayout(layout);
267  layout->addWidget(mBrowser);
268  this->scrollToBottom();
269 }
270 
272 {
273  mBrowser->clear();
274  this->scrollToBottom();
275 }
276 
278 {
279  mBrowser->horizontalScrollBar()->setValue(mBrowser->horizontalScrollBar()->minimum());
280 }
281 
283 {
284  this->format(message);
285 
286  mBrowser->append(this->getCompactMessage(message));
287 
288  this->scrollToBottom();
289 }
290 
292 {
293  mScrollToBottomEnabled = on;
294  this->scrollToBottom();
295 }
296 
297 void SimpleLogMessageDisplayWidget::scrollToBottom()
298 {
299  if (mScrollToBottomEnabled)
300  mBrowser->verticalScrollBar()->setValue(mBrowser->verticalScrollBar()->maximum());
301 }
302 
304 {
305  if(message.mMessageLevel == mlRAW)
306  return message.mText;
307 
308  QString retval;
309  retval= QString("[%1] %2")
310 // .arg(message.mTimeStamp.toString(timestampSecondsFormatNice()))
311  .arg(message.mTimeStamp.toString("hh:mm"))
312  .arg(message.mText);
313  return retval;
314 }
315 
317 {
318  if (!mFormat.count(message.getMessageLevel()))
319  return;
320  mBrowser->setCurrentCharFormat(mFormat[message.getMessageLevel()]);
321 }
322 
326 
327 ConsoleWidget::ConsoleWidget(QWidget* parent, QString uid, QString name, XmlOptionFile options, LogPtr log) :
328  BaseWidget(parent, uid, name),
329  mSeverityAction(NULL),
330  mMessagesWidget(NULL),
331  mMessagesLayout(NULL),
332  mDetailsAction(NULL)
333 {
334  mOptions = options;
335  mLog = log;
336  connect(mLog.get(), &Log::loggingFolderChanged, this, &ConsoleWidget::onLoggingFolderChanged);
337 
338  this->setModified();
339 }
340 
341 ConsoleWidget::ConsoleWidget(QWidget* parent, QString uid, QString name) :
342  BaseWidget(parent, uid, name),
343  mSeverityAction(NULL),
344  mMessagesWidget(NULL),
345  mMessagesLayout(NULL),
346  mDetailsAction(NULL)
347 {
348  mOptions = profile()->getXmlSettings().descend(this->objectName());
349  mLog = reporter();
350  connect(mLog.get(), &Log::loggingFolderChanged, this, &ConsoleWidget::onLoggingFolderChanged);
351 
352  this->setModified();
353 }
354 
356 {
357  if (!mMessagesLayout)
358  {
359  this->createUI();
360  }
361 
362 }
363 
364 void ConsoleWidget::createUI()
365 {
366  mSeverityAction = NULL;
367  mMessagesWidget = NULL;
368 
369  this->setToolTip("Display system information, warnings and errors.");
370 
371  QVBoxLayout* layout = new QVBoxLayout;
372  layout->setMargin(0);
373  layout->setSpacing(0);
374  this->setLayout(layout);
375 
376  mPopupWidget = new PopupToolbarWidget(this);
377  connect(mPopupWidget, &PopupToolbarWidget::popup, this, &ConsoleWidget::updateShowHeader);
378  layout->addWidget(mPopupWidget);
379  this->createButtonWidget(mPopupWidget->getToolbar());
380 
381  mMessagesLayout = new QVBoxLayout;
382  mMessagesLayout->setMargin(0);
383  layout->addLayout(mMessagesLayout);
384 
385  mMessageListener = MessageListener::create(mLog);
386  mMessageFilter.reset(new MessageFilterConsole);
387  mMessageListener->installFilter(mMessageFilter);
388  connect(mMessageListener.get(), &MessageListener::newMessage, this, &ConsoleWidget::receivedMessage);
389  connect(mMessageListener.get(), &MessageListener::newChannel, this, &ConsoleWidget::receivedChannel);
390 
391  QString defVal = enum2string<LOG_SEVERITY>(msINFO);
392  LOG_SEVERITY value = string2enum<LOG_SEVERITY>(this->option("showLevel").readValue(defVal));
393  mMessageFilter->setLowestSeverity(value);
394 
395  mMessageFilter->setActiveChannel(mChannelSelector->getValue());
396  mMessageListener->installFilter(mMessageFilter);
397 
398  this->updateUI();
399 }
400 
401 void ConsoleWidget::createButtonWidget(QWidget* widget)
402 {
403  QHBoxLayout* buttonLayout = new QHBoxLayout(widget);
404  buttonLayout->setMargin(0);
405  buttonLayout->setSpacing(0);
406 
407  this->addSeverityButtons(buttonLayout);
408  buttonLayout->addSpacing(8);
409  this->addDetailsButton(buttonLayout);
410 
411  this->createChannelSelector();
412 
413  LabeledComboBoxWidget* channelSelectorWidget = new LabeledComboBoxWidget(this, mChannelSelector);
414  channelSelectorWidget->showLabel(false);
415  buttonLayout->addSpacing(8);
416  buttonLayout->addWidget(channelSelectorWidget);
417  buttonLayout->setStretch(buttonLayout->count()-1, 0);
418 
419  buttonLayout->addStretch(1);
420 }
421 
422 void ConsoleWidget::updateShowHeader()
423 {
424  bool show = mPopupWidget->popupIsVisible();
425  mMessagesWidget->showHeader(show);
426 }
427 
428 
429 XmlOptionItem ConsoleWidget::option(QString name)
430 {
431  return XmlOptionItem(name, mOptions.getElement());
432 }
433 
435 {
436  if (!mMessageFilter)
437  return;
438 
439  QString levelString = enum2string<LOG_SEVERITY>(mMessageFilter->getLowestSeverity());
440  this->option("showLevel").writeValue(levelString);
441  this->option("showDetails").writeVariant(mDetailsAction->isChecked());
442 }
443 
445 {
446  if (mDetailsAction)
447  {
448  mDetailsAction->setChecked(on);
449  this->updateUI();
450  }
451  else
452  {
453  this->option("showDetails").writeVariant(on);
454  }
455 }
456 
457 void ConsoleWidget::addSeverityButtons(QBoxLayout* buttonLayout)
458 {
459  QAction* actionUp = this->createAction(this,
460  QIcon(":/icons/open_icon_library/zoom-in-3.png"),
461  "More", "More detailed log output",
462  SLOT(onSeverityDown()),
463  buttonLayout, new CXSmallToolButton());
464 
465  this->addSeverityIndicator(buttonLayout);
466 
467  QAction* actionDown = this->createAction(this,
468  QIcon(":/icons/open_icon_library/zoom-out-3.png"),
469  "Less ", "Less detailed log output",
470  SLOT(onSeverityUp()),
471  buttonLayout, new CXSmallToolButton());
472 }
473 
474 void ConsoleWidget::addSeverityIndicator(QBoxLayout* buttonLayout)
475 {
476  QAction* action = new QAction(QIcon(""), "Severity", this);
477  mSeverityAction = action;
478  QString help = "Lowest displayed log severity";
479  action->setStatusTip(help);
480  action->setWhatsThis(help);
481  action->setToolTip(help);
482  QToolButton* button = new CXSmallToolButton();
483  button->setDefaultAction(action);
484  buttonLayout->addWidget(button);
485 }
486 
487 void ConsoleWidget::updateSeverityIndicator()
488 {
489  LOG_SEVERITY severity = mMessageFilter->getLowestSeverity();
490 
491  switch (severity)
492  {
493  case msERROR:
494  this->updateSeverityIndicator("window-close-3.png", "error");
495  break;
496  case msWARNING:
497  this->updateSeverityIndicator("dialog-warning-panel.png", "warning");
498  break;
499  case msINFO:
500  this->updateSeverityIndicator("dialog-information-4.png", "info");
501  break;
502  case msDEBUG:
503  this->updateSeverityIndicator("script-error.png", "debug");
504  break;
505  default:
506  this->updateSeverityIndicator("script-error.png", "");
507  break;
508  }
509 }
510 
511 void ConsoleWidget::updateSeverityIndicator(QString iconname, QString help)
512 {
513  QIcon icon(QString(":/icons/message_levels/%1").arg(iconname));
514  mSeverityAction->setIcon(icon);
515 
516  help = QString("Current log level is %1").arg(help);
517  mSeverityAction->setStatusTip(help);
518  mSeverityAction->setToolTip(help);
519 }
520 
521 void ConsoleWidget::onSeverityUp()
522 {
523  this->onSeverityChange(-1);
524 }
525 
526 void ConsoleWidget::onSeverityDown()
527 {
528  this->onSeverityChange(+1);
529 }
530 
531 void ConsoleWidget::onSeverityChange(int delta)
532 {
533  LOG_SEVERITY severity = mMessageFilter->getLowestSeverity();
534  int val = (int)severity + delta;
535  val = constrainValue(val, 0, int(msCOUNT)-1);
536  severity = static_cast<LOG_SEVERITY>(val);
537 
538  mMessageFilter->setLowestSeverity(severity);
539  mMessageListener->installFilter(mMessageFilter);
540  this->updateUI();
541 }
542 
543 void ConsoleWidget::createChannelSelector()
544 {
545  QString defval = "console";
546  mChannels << "all";
547  mChannels << defval;
548 
549  StringPropertyPtr retval;
550  retval = StringProperty::initialize("ChannelSelector",
551  "", "Log Channel to display",
552  defval, mChannels, mOptions.getElement());
553  connect(retval.get(), &StringPropertyBase::changed, this, &ConsoleWidget::onChannelSelectorChanged);
554  mChannelSelector = retval;
555 }
556 
557 void ConsoleWidget::addDetailsButton(QBoxLayout* buttonLayout)
558 {
559  QIcon icon(":/icons/open_icon_library/system-run-5.png");
560  QAction* action = this->createAction(this,
561  icon,
562  "Details", "Show detailed info on each log entry",
563  SLOT(updateUI()),
564  buttonLayout, new CXSmallToolButton());
565  action->setCheckable(true);
566 
567  bool value = this->option("showDetails").readVariant(false).toBool();
568  action->blockSignals(true);
569  action->setChecked(value);
570  action->blockSignals(false);
571 
572  mDetailsAction = action;
573 }
574 
575 void ConsoleWidget::updateUI()
576 {
577  this->updateSeverityIndicator();
578 
579  this->setWindowTitle("Console: " + mChannelSelector->getValue());
580  this->selectMessagesWidget();
581  this->updateShowHeader();
582  mPopupWidget->refresh();
583 
584  // reset content of browser
585  QTimer::singleShot(0, this, SLOT(clearTable())); // let the messages recently emitted be processed before clearing
586 
587  mMessageListener->restart();
588 }
589 
590 void ConsoleWidget::selectMessagesWidget()
591 {
592  if (mMessagesWidget && (mMessagesWidget->getType()==this->getDetailTypeFromButton()))
593  return;
594 
595  if (mMessagesWidget)
596  {
597  // remove
598  mMessagesLayout->takeAt(0);
599  delete mMessagesWidget;
600  }
601 
602  if (this->getDetailTypeFromButton()=="detail")
603  {
604  mMessagesWidget = new DetailedLogMessageDisplayWidget(this, mOptions);
605  }
606  else
607  {
608  mMessagesWidget = new SimpleLogMessageDisplayWidget(this);
609  }
610 
611  mMessagesLayout->addWidget(mMessagesWidget);
612 }
613 
614 QString ConsoleWidget::getDetailTypeFromButton() const
615 {
616  if (mDetailsAction->isChecked())
617  return "detail";
618  else
619  return "simple";
620 }
621 
622 void ConsoleWidget::clearTable()
623 {
624  if (mMessagesWidget)
625  mMessagesWidget->clear();
626 }
627 
628 void ConsoleWidget::onLoggingFolderChanged()
629 {
630  if (!mMessageFilter)
631  return;
632  mMessageListener->installFilter(mMessageFilter);
633  this->updateUI();
634 }
635 
636 void ConsoleWidget::onChannelSelectorChanged()
637 {
638  mChannelSelector->blockSignals(true);
639 
640  mMessageFilter->setActiveChannel(mChannelSelector->getValue());
641  mMessageListener->installFilter(mMessageFilter);
642  this->updateUI();
643 
644  mChannelSelector->blockSignals(false);
645 }
646 
647 void ConsoleWidget::contextMenuEvent(QContextMenuEvent* event)
648 {
649 // QMenu *menu = mBrowser->createStandardContextMenu();
650 // menu->addSeparator();
651 // menu->addAction(mLineWrappingAction);
652 // menu->exec(event->globalPos());
653 // delete menu;
654 }
655 
656 void ConsoleWidget::showEvent(QShowEvent* event)
657 {
658  if (mMessagesWidget)
659  mMessagesWidget->normalize();
660 }
661 
662 void ConsoleWidget::receivedChannel(QString channel)
663 {
664  if (!mChannels.count(channel))
665  {
666  mChannels.append(channel);
667  mChannelSelector->setValueRange(mChannels);
668  }
669 }
670 
671 void ConsoleWidget::receivedMessage(Message message)
672 {
673  this->receivedChannel(message.mChannel);
674 // if (!mChannels.count(message.mChannel))
675 // {
676 // mChannels.append(message.mChannel);
677 // mChannelSelector->setValueRange(mChannels);
678 // }
679 
680  this->printMessage(message);
681 }
682 
683 void ConsoleWidget::printMessage(const Message& message)
684 {
685  if (mMessagesWidget)
686  mMessagesWidget->add(message);
687 }
688 
689 //void ConsoleWidget::lineWrappingSlot(bool checked)
690 //{
692 //}
693 
694 }//namespace cx
static MessageListenerPtr create(LogPtr log=LogPtr())
mlSUCCESS
Definition: cxDefinitions.h:82
cxResource_EXPORT ProfilePtr profile()
Definition: cxProfile.cpp:176
QString getCompactMessage(Message message)
SimpleLogMessageDisplayWidget(QWidget *parent=NULL)
virtual void showHeader(bool on)=0
mlRAW
Definition: cxDefinitions.h:82
QString mSourceFile
Definition: cxLogMessage.h:98
DetailedLogMessageDisplayWidget(QWidget *parent, XmlOptionFile options)
MyTableWidget(QWidget *parent=NULL)
virtual void keyPressEvent(QKeyEvent *event)
ReporterPtr reporter()
Definition: cxReporter.cpp:59
void newChannel(QString channel)
msDEBUG
Definition: cxDefinitions.h:96
void writeVariant(const QVariant &val)
void format(const Message &message)
formats the text to suit the message level
void loggingFolderChanged()
mlCERR
Definition: cxDefinitions.h:82
virtual QString getType() const =0
QString getText() const
The raw message.
msINFO
Definition: cxDefinitions.h:96
virtual void setScrollToBottom(bool on)
QString mThread
Definition: cxLogMessage.h:96
QDomElement getElement()
return the current element
mlDEBUG
Definition: cxDefinitions.h:82
QDateTime getTimeStamp() const
The time at which the message was created.
MESSAGE_LEVEL mMessageLevel
Definition: cxLogMessage.h:90
QAction * createAction(QObject *parent, QIcon iconName, QString text, QString tip, T slot, QLayout *layout=NULL, QToolButton *button=new QToolButton())
Definition: cxBaseWidget.h:149
Helper class for storing one string value in an xml document.
boost::shared_ptr< class StringProperty > StringPropertyPtr
QString mChannel
Definition: cxLogMessage.h:95
msERROR
Definition: cxDefinitions.h:96
boost::shared_ptr< class Log > LogPtr
Definition: cxLog.h:68
std::map< MESSAGE_LEVEL, QTextCharFormat > mFormat
double constrainValue(double val, double min, double max)
QTableWidgetItem * addItem(int column, QString text, const Message &message)
void createTextCharFormats()
sets up the formating rules for the message levels
virtual void showEvent(QShowEvent *event)
updates internal info before showing the widget
void changed()
emit when the underlying data value is changed: The user interface will be updated.
static StringPropertyPtr initialize(const QString &uid, QString name, QString help, QString value, QStringList range, QDomNode root=QDomNode())
void writeValue(const QString &val)
QDateTime mTimeStamp
Definition: cxLogMessage.h:92
virtual void add(const Message &message)=0
mlINFO
Definition: cxDefinitions.h:82
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:108
QString mSourceFunction
Definition: cxLogMessage.h:99
void contextMenuEvent(QContextMenuEvent *event)
void setDetails(bool on)
virtual void add(const Message &message)
ConsoleWidget(QWidget *parent, QString uid="ConsoleWidget", QString name="Console")
QVariant readVariant(const QVariant &defval=QVariant()) const
void popup(bool show)
mlCOUT
Definition: cxDefinitions.h:82
QString mText
Definition: cxLogMessage.h:89
LogMessageDisplayWidget(QWidget *parent)
msWARNING
Definition: cxDefinitions.h:96
virtual void normalize()=0
mlWARNING
Definition: cxDefinitions.h:82
virtual void prePaintEvent()
void newMessage(Message message)
virtual void add(const Message &message)
MESSAGE_LEVEL getMessageLevel() const
The category of the message.
mlERROR
Definition: cxDefinitions.h:82
QString enum2string(const ENUM &val)
Helper class for xml files used to store ssc/cx data.
QString readValue(const QString &defval) const