File: ListWidgetLogger.cpp

package info (click to toggle)
structure-synth 1.5.0-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,268 kB
  • ctags: 1,966
  • sloc: cpp: 10,209; python: 164; makefile: 71; sh: 15
file content (39 lines) | stat: -rw-r--r-- 1,041 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "ListWidgetLogger.h"



namespace SyntopiaCore {
	namespace Logging {

		ListWidgetLogger::ListWidgetLogger(QWidget* parent) : parent(parent) { 	
			listWidget = new QListWidget(parent);
		}

		ListWidgetLogger::~ListWidgetLogger() { 
		}

		void ListWidgetLogger::log(QString message, LogLevel priority) {
			QListWidgetItem* i = new QListWidgetItem(message, listWidget);

			// Levels: NoneLevel, DebugLevel, TimingLevel, InfoLevel, WarningLevel, CriticalLevel, AllLevel

			if ( priority == InfoLevel ) {
				i->setBackgroundColor(QColor(255,255,255));
			} else if ( priority == WarningLevel ) {
				parent->show();
				i->setBackgroundColor(QColor(255,243,73));
			} else if ( priority == CriticalLevel ) {
				parent->show();
				i->setBackgroundColor(QColor(255,2,0));
			} else if ( priority == TimingLevel ) {
				parent->show();
				i->setBackgroundColor(QColor(25,255,0));
			} else {
				i->setBackgroundColor(QColor(220,220,220));
			}
			listWidget->scrollToItem(i); 

		}

	}
}